:root {
  --bg: #f6f8ff;
  --surface: rgba(255,255,255,0.82);
  --ink: #101828;
  --muted: #667085;
  --rule: rgba(53,92,255,0.14);
  --accent: #355cff;
  --accent2: #11a7a0;
  --danger: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(53,92,255,0.12), transparent 30rem),
    radial-gradient(circle at 90% 12%, rgba(17,167,160,0.12), transparent 28rem),
    var(--bg);
  overflow: hidden;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  height: 100vh;
  height: 100dvh;
  padding: 18px;
}
.sidebar, .panel, .card {
  border: 1px solid var(--rule);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(42,66,150,0.1);
}
.sidebar {
  border-radius: 28px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.avatar {
  width: 58px;
  height: 58px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.avatar input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.avatar.has-avatar span { display: none; }
.avatar.has-avatar img { display: block; }
.brand h1 { margin: 14px 0 0; font-size: 1.2rem; }
.brand p { margin: 4px 0 20px; color: var(--muted); font-size: 0.88rem; }
.nav {
  display: grid;
  gap: 8px;
}
.nav button, .ghost {
  border-radius: 16px;
  padding: 11px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}
.nav button.active, .nav button:hover, .ghost:hover {
  background: rgba(53,92,255,0.09);
  color: var(--accent);
}
#signOutBtn { margin-top: auto; text-align: center; }
.main {
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 28px;
  padding: 26px;
}
.panel.active { display: block; }
.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: center;
}
.auth-panel[hidden] { display: none; }
.hero {
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(53,92,255,0.12), rgba(17,167,160,0.12));
}
.hero h2 {
  max-width: 720px;
  margin: 18px 0;
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  letter-spacing: -0.07em;
  line-height: 0.95;
}
.hero p, .muted { color: var(--muted); }
.pill {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(53,92,255,0.1);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.82rem;
}
.date-card, .stats {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}
.date-card {
  grid-template-columns: 120px 1fr 120px;
}
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat, .card {
  border-radius: 22px;
  padding: 16px;
}
.stat {
  border: 1px solid var(--rule);
  background: rgba(255,255,255,0.72);
}
.stat strong {
  display: block;
  color: var(--accent);
  font-size: 1.55rem;
}
.stat span { color: var(--muted); font-size: 0.85rem; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.form {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.task-grid {
  grid-template-columns: minmax(220px, 1.5fr) 110px 145px 120px 130px 90px auto;
  align-items: center;
}
.money-grid {
  grid-template-columns: minmax(160px, 1fr) minmax(150px, 1fr) auto;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: rgba(255,255,255,0.78);
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 150px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(53,92,255,0.45);
  box-shadow: 0 0 0 4px rgba(53,92,255,0.09);
}
.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 43px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: rgba(255,255,255,0.78);
}
.primary {
  border-radius: 16px;
  padding: 11px 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-weight: 800;
}
.list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: rgba(255,255,255,0.68);
}
.item.pinned { border-color: rgba(53,92,255,0.36); background: rgba(53,92,255,0.08); }
.item.done .title { text-decoration: line-through; color: var(--muted); }
.meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}
.tag {
  color: var(--accent);
  background: rgba(53,92,255,0.08);
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: var(--danger);
  background: rgba(255,236,236,0.9);
}
.progress-wrap {
  height: 10px;
  border-radius: 999px;
  background: rgba(53,92,255,0.1);
  overflow: hidden;
  margin-top: 8px;
}
.progress {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.ai-box {
  white-space: pre-wrap;
  padding: 16px;
  border-radius: 18px;
  background: rgba(16,24,40,0.92);
  color: #fff;
  min-height: 180px;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 13px 15px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.22s;
}
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 82px minmax(0, 1fr); gap: 10px; padding: 8px; }
  .sidebar { border-radius: 22px; padding: 10px; }
  .brand { display: none; }
  .avatar { width: 48px; height: 48px; border-radius: 18px; margin: 0 auto 12px; }
  .nav button { min-height: 54px; text-align: center; font-size: 0.76rem; padding: 8px 4px; }
  .panel { border-radius: 22px; padding: 16px; }
  .auth-panel, .task-grid, .money-grid, .date-card, .stats { grid-template-columns: 1fr; }
  .hero { padding: 20px; }
}
