/*
 * StudyFlow — Midnight Aurora redesign
 * A cool, vivid, glass-forward visual language layered over styles.css and
 * theme-refresh.css. Indigo / violet / cyan accents with serif display type
 * and soft layered shadows. Pairs with glass-morphism.css for the frosted UI.
 *
 * Loaded LAST so it wins cascade. Does not change markup or JS behaviour.
 */

/* ============================================================
   1. Design tokens — Midnight Aurora (cool, vivid, glass-forward)
   ============================================================ */
:root {
  --paper: #eef1f8;
  --paper-deep: #e1e7f3;
  --surface: #fafbff;
  --surface-2: #edf1fb;
  --ink: #161a2b;
  --ink-soft: #2b3150;
  --muted: #62698a;
  --nav-muted: #4a5170;
  --faint: #9aa2bd;
  --line: rgba(22, 26, 43, 0.11);
  --line-soft: rgba(22, 26, 43, 0.06);

  --accent: #4a5bd4;      /* indigo primary */
  --accent-deep: #3543a8; /* deep indigo */
  --accent-ink: #ffffff;
  --gold: #d97706;        /* amber warmth (metric gradient) */
  --gold-soft: #f2d395;
  --terra: #dc5f6a;       /* coral (destructive/attention) */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --shadow-paper: 0 1px 2px rgba(22, 26, 43, 0.05), 0 8px 22px rgba(42, 43, 112, 0.10);
  --shadow-lift: 0 2px 6px rgba(22, 26, 43, 0.06), 0 18px 36px rgba(42, 43, 112, 0.16);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] {
  --paper: #0c0f1d;
  --paper-deep: #080a15;
  --surface: #161a2e;
  --surface-2: #1a2038;
  --ink: #e9edfb;
  --ink-soft: #c6cdea;
  --muted: #8a93b7;
  --nav-muted: #a5accc;
  --faint: #57608a;
  --line: rgba(233, 237, 251, 0.13);
  --line-soft: rgba(233, 237, 251, 0.07);

  --accent: #7c8cff;
  --accent-deep: #a3affe;
  --accent-ink: #0c1025;
  --gold: #f0b35c;
  --gold-soft: #e7c68f;
  --terra: #e2717b;

  --shadow-paper: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px rgba(0, 0, 0, 0.42);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.45), 0 20px 44px rgba(0, 0, 0, 0.55);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ============================================================
   2. Body — cool mist canvas with a subtle grain
   ============================================================ */
body {
  background: var(--paper);
  color: var(--ink);
  letter-spacing: -0.011em;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
[data-theme="dark"] body { background: var(--paper); }

/* ============================================================
   3. Icon atoms (unchanged) & button base
   ============================================================ */
.uic { display: grid; place-items: center; flex: 0 0 auto; line-height: 0; }
.uic svg { width: 1.15em; height: 1.15em; stroke: currentColor; stroke-width: 2; display: block; }

/* ============================================================
   4. Typography — serif display, deep indigo ink
   ============================================================ */
h1, h2, h3, .brand, .next h2, .page-head h1, .page-head h2 {
  font-family: var(--serif);
}
h1 {
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--ink);
}
h2 {
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--ink);
}
h3 { font-weight: 600; color: var(--ink); }
.section-label, .eyebrow {
  font-family: var(--sans);
  color: var(--muted);
}
.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
}
p, li, td, small, label { color: var(--ink-soft); }

/* ============================================================
   5. Side rail — frosted indigo panel, serif wordmark
   ============================================================ */
.side {
  width: 252px;
  background: var(--surface-2);
  border-right: 1px solid var(--line-soft);
  box-shadow: var(--shadow-inner);
}
.brand { gap: 11px; font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.brand b {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--serif); font-style: italic; font-size: 17px;
  box-shadow: 0 4px 12px rgba(74, 91, 212, 0.3);
}
[data-theme="dark"] .brand b { color: var(--accent-ink); }
.side nav {
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}
.side nav button {
  color: var(--muted);
  font-weight: 500;
  border-radius: var(--radius-xs);
}
.side nav button:hover {
  background: var(--surface);
  color: var(--ink);
  transform: none;
  box-shadow: var(--shadow-paper);
}
.side nav button.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(74, 91, 212, 0.25);
}
[data-theme="dark"] .side nav button.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.side-bottom > button {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-soft);
}

/* ============================================================
   6. Header
   ============================================================ */
header { margin-bottom: 26px; }
#title, #kicker { font-family: var(--serif); }

/* ============================================================
   7. Cards & panels — flat base (glass applied by glass-morphism.css)
   ============================================================ */
.metrics article, .card, .ring-card, .history-card, .chart-card,
.streak-card, .exam-readiness, .weekly-review, .plan article,
.study-subjects article, .attention, .recommend, .page-head > button,
.study-intro, .panel, .calendar, .toolbar, .tabs, .gemini-ask {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: var(--shadow-paper);
  border-radius: var(--radius);
}
.metrics article:hover, .card:hover {
  box-shadow: var(--shadow-lift);
  border-color: var(--line);
  transform: translateY(-2px);
}
.metrics strong {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.metrics i { background: var(--surface-2); }
.metrics b { background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* ============================================================
   8. Buttons — hierarchy through variant, not size
   ============================================================ */
button {
  font-family: var(--sans);
}
.actions button, .toolbar > button, .toolbar > div button, .dialog-head > button,
.section-head button, .page-head > button, .recommend button, .ring-card > button,
.types button, .features button, .connection-actions button, .gemini-ask-row button,
.settings-form button, .recommend-actions button {
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-paper);
  font-weight: 600;
}
.actions button:hover, .toolbar > button:hover, .section-head button:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

/* Primary — filled indigo */
.primary, #study-focus, #result, #rec-start, #focus, #first-focus,
#open-settings, .recommend button.primary,
#header-add.add-btn, .gemini-ask-row .primary {
  background: #4a5bd4;
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 6px 16px rgba(74, 91, 212, 0.26);
}
[data-theme="dark"] .primary, [data-theme="dark"] #study-focus,
[data-theme="dark"] #result, [data-theme="dark"] #rec-start,
[data-theme="dark"] #focus, [data-theme="dark"] #first-focus,
[data-theme="dark"] #open-settings,
[data-theme="dark"] #header-add.add-btn,
[data-theme="dark"] .gemini-ask-row .primary {
  background: #7c8cff;
  color: #0c1025;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.primary:hover, #study-focus:hover, #result:hover, #rec-start:hover,
#focus:hover, #first-focus:hover, #header-add.add-btn:hover,
.gemini-ask-row .primary:hover {
  background: #3543a8;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(74, 91, 212, 0.34);
  transform: translateY(-2px);
}
[data-theme="dark"] .primary:hover, [data-theme="dark"] #study-focus:hover,
[data-theme="dark"] #result:hover, [data-theme="dark"] #rec-start:hover,
[data-theme="dark"] #focus:hover, [data-theme="dark"] #first-focus:hover,
[data-theme="dark"] #header-add.add-btn:hover {
  background: #a3affe;
  color: #0c1025;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

/* Secondary link-style */
.section-head button[data-route], .tabs button.active, #refresh {
  color: var(--accent);
}

/* ============================================================
   9. Today hero — indigo band with amber glow
   ============================================================ */
.hero {
  min-height: 250px;
  padding: 30px 32px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--accent-ink);
  background:
    radial-gradient(120% 120% at 85% -20%, rgba(217, 119, 6, 0.28) 0%, transparent 55%),
    linear-gradient(130deg, #3543a8 0%, #4a5bd4 55%, #5a6ee0 100%);
  box-shadow: 0 24px 50px rgba(53, 67, 168, 0.3);
}
.hero .eyebrow, .hero-label, .hero-top span { color: rgba(255, 255, 255, 0.72); }
.hero-top span {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  font-family: var(--sans);
}
.next > i {
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold-soft);
  font-family: var(--serif);
}
.next h2 { font-family: var(--serif); color: var(--accent-ink); font-size: 28px; font-weight: 600; }
.next small, .next-meta { color: rgba(255, 255, 255, 0.7); }
.hero-bottom .section-label { color: var(--gold-soft); }
.hero button {
  background: var(--gold);
  color: #251a09;
  border: 1px solid transparent;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.hero button:hover {
  background: #c96a00;
  color: #251a09;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}
#focus .uic svg { color: inherit; }

/* ============================================================
   10. Nudge & recommend — indigo/amber accents
   ============================================================ */
.nudge {
  background: linear-gradient(140deg, rgba(74, 91, 212, 0.08), rgba(217, 119, 6, 0.08));
  border: 1px solid var(--line-soft);
  color: var(--ink-soft);
}
.nudge h3 { color: var(--accent); }
.recommend {
  border: 1px solid rgba(74, 91, 212, 0.16);
  background: linear-gradient(120deg, rgba(74, 91, 212, 0.07), rgba(217, 119, 6, 0.05));
}
.recommend-icon { color: var(--accent); }

/* ============================================================
   11. Timeline & events
   ============================================================ */
.timeline { border-left: 2px solid var(--line-soft); }
.event-row:before { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--event, var(--gold)); }
.event-row button {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: var(--shadow-paper);
  backdrop-filter: none;
}
.event-row button:hover { box-shadow: var(--shadow-lift); }

/* ============================================================
   12. Calendar
   ============================================================ */
.calendar { background: var(--surface); box-shadow: var(--shadow-paper); border-radius: var(--radius); }
.month-day.today { background: rgba(74, 91, 212, 0.1); }
.month-day.today .daynum { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
[data-theme="dark"] .month-day.today .daynum { color: var(--accent-ink); }
.cal-head b, .cal-month { color: var(--ink); font-family: var(--serif); }

/* ============================================================
   13. Focus modal
   ============================================================ */
.focus-modal {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

/* ============================================================
   14. Progress & insights
   ============================================================ */
.insights .insight, .achievements .achievement {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-paper);
}
.streak-week .dot { background: var(--surface-2); }
.streak-week .dot.on { background: var(--accent); }

/* ============================================================
   15. Forms & inputs — frosted fields
   ============================================================ */
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-xs);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 91, 212, 0.14);
  outline: none;
}
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8174' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.4rem;
}
[data-theme="dark"] select { color-scheme: dark; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f8778' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
[data-theme="dark"], [data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { color-scheme: dark; }

/* ============================================================
   16. Dialogs / modals — frosted sheet
   ============================================================ */
dialog, .modal, [class$="-modal"] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

/* ============================================================
   17. Mobile
   ============================================================ */
.mobile {
  background: var(--surface-2);
  border-top: 1px solid var(--line-soft);
}

/* ============================================================
   18. Selection & focus visibility (WCAG)
   ============================================================ */
::selection { background: var(--gold); color: #251a09; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   Dark parity — re-affirm midnight surfaces under dark mode
   (matches theme-refresh's higher-specificity dark rules)
   ============================================================ */
[data-theme="dark"] .side {
  background: var(--surface-2);
  border-right-color: var(--line-soft);
  box-shadow: var(--shadow-inner);
}
[data-theme="dark"] .hero {
  background:
    radial-gradient(120% 120% at 85% -20%, rgba(217, 119, 6, 0.16) 0%, transparent 55%),
    linear-gradient(130deg, #232c6b 0%, #323ca0 55%, #4652c4 100%);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .metrics article,
[data-theme="dark"] .card,
[data-theme="dark"] .ring-card,
[data-theme="dark"] .history-card,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .streak-card,
[data-theme="dark"] .plan article,
[data-theme="dark"] .panel,
[data-theme="dark"] .weekly-review,
[data-theme="dark"] .recommend,
[data-theme="dark"] .calendar,
[data-theme="dark"] .toolbar {
  background: var(--surface);
  border-color: var(--line-soft);
  box-shadow: var(--shadow-paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
[data-theme="dark"] .nudge {
  background: linear-gradient(140deg, rgba(74, 91, 212, 0.16), rgba(217, 119, 6, 0.12));
  color: var(--ink-soft);
  border-color: var(--line-soft);
}
[data-theme="dark"] .metrics b,
[data-theme="dark"] .streak-week .dot.on {
  background: linear-gradient(90deg, var(--accent), var(--gold));
}
[data-theme="dark"] .trend-up,
[data-theme="dark"] .success-text { color: var(--accent); }

/* Dark card/interaction accents so hierarchy reads on paper */
[data-theme="dark"] .metrics article:hover,
[data-theme="dark"] .card:hover {
  background: var(--surface-2);
  border-color: var(--line);
}
[data-theme="dark"] .side nav button:hover {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-paper);
}
[data-theme="dark"] .actions button,
[data-theme="dark"] .toolbar > button,
[data-theme="dark"] .toolbar > div button,
[data-theme="dark"] .dialog-head > button,
[data-theme="dark"] .page-head > button,
[data-theme="dark"] .section-head button,
[data-theme="dark"] .recommend button,
[data-theme="dark"] .ring-card > button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme="dark"] .month-day.today { background: rgba(74, 91, 212, 0.25); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme="dark"] .gemini-dock {
  background: var(--surface-2);
  border-color: var(--line-soft);
}

/* =========================================================================
   WALLET LAYOUT — modern editorial single-column of tall status cards
   Overrides the multi-column grids into calm vertical stacked wallet cards.
   ========================================================================= */
.page {
  max-width: 840px;
  margin-inline: auto;
}
.page-head {
  margin-bottom: 22px;
}

/* Collapse every multi-column grid into a single vertical stack.
   Note: #calendar-grid is intentionally left as its functional grid. */
.two-col,
.study-layout,
.study-deep,
.progress-col {
  grid-template-columns: 1fr !important;
  display: grid;
  gap: 20px;
}
.metrics,
.subjects {
  grid-template-columns: 1fr !important;
  gap: 14px;
}

/* Wallet cards — tall, soft, separated like stacked index cards */
.two-col aside,
.two-col section,
.study-layout > section,
.study-layout .study-side,
.study-deep .card,
.card,
.ring-card,
.metrics article,
.subject,
.chart-card,
.insights,
.achievements,
.streak-card,
.exam-readiness,
.history-card,
.weekly-review {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-paper);
  padding: 26px 26px 22px;
}
.study-layout .study-side {
  display: grid;
  gap: 16px;
}
.two-col > section {
  padding: 0;
  border: 0;
  border-left: 0;
  background: transparent;
  box-shadow: none;
}

/* Status rows inside wallet cards — separated by hairline dividers */
.two-col aside article + article,
.subject + .subject,
.achievements > div + div,
.metrics article + article {
  border-top: 1px solid var(--line-soft);
}

/* Big serif number rows — the signature wallet detail */
.metrics article {
  text-align: left;
  border-left: 3px solid var(--accent);
}
.metrics strong {
  display: block;
  margin: 8px 0 4px;
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.metrics article p,
.metrics small {
  display: list-item;
  list-style: none;
  font-size: 11.5px;
}
.two-col aside .card .section-head,
.streak-card .section-head,
.exam-readiness .section-head,
.history-card .section-head {
  margin-bottom: 14px;
}
.two-col aside article,
.streak-card,
.exam-readiness,
.history-card {
  border-left: 3px solid var(--accent);
}

/* Nudge — calm wallet strip, not a niche card */
.nudge {
  background: #eef3ee;
  color: #2a4a43;
}
[data-theme="dark"] .nudge {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-soft);
}
.nudge h3 {
  font-family: var(--serif);
  font-size: 20px;
  margin-bottom: 6px;
}

/* Plan rows — stacked wallet entries */
.plan-row {
  grid-template-columns: 52px 1fr auto;
  border-left: 3px solid var(--accent);
}
.plan-date {
  color: var(--accent);
}

/* Hero → a tall focus wallet card with big serif numbers */
.hero {
  min-height: 0;
  padding: 34px 34px 28px;
  border-radius: var(--radius);
}
.hero-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hero .next h2 {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.hero .next i {
  font-family: var(--serif);
}
.hero p {
  max-width: 46ch;
}

/* Ring card centers its big % number like a wallet dial */
.ring-card {
  text-align: left;
}
.ring {
  margin: 10px 0 6px;
}
.ring strong {
  font-family: var(--serif);
  font-size: 34px;
  letter-spacing: -0.02em;
}

/* Progress chart/insights stacked, insights as hairline rows */
.chart-card + .insights {
  border-left: 3px solid var(--accent);
}
.insights > div > div,
#insights > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
#insights > div:last-child {
  border-bottom: 0;
}

/* Timeline = the wallet's main work list */
.timeline {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-paper);
  padding: 14px 22px;
}

/* Mobile: keep wallet stack, drop redundant gap */
@media (max-width: 700px) {
  .page {
    padding: 0 4px;
  }
  .metrics strong {
    font-size: 36px;
  }
}

/* Calendar stays a real grid — let it break out wider when active */
.page#calendar {
  max-width: 1180px;
}

/* =========================================================================
   TEXT PACING — a calmer, more readable vertical rhythm
   ========================================================================= */
body,
button,
input,
select,
textarea {
  line-height: 1.55;
}
h1, .page-head h2 {
  line-height: 1.12;
}
h2, h3, .next h2 {
  line-height: 1.22;
}
p {
  line-height: 1.62;
  margin: 0.35em 0 0.75em;
}
p + p {
  margin-top: 0.55em;
}
small {
  line-height: 1.5;
}
.section-label, .eyebrow {
  line-height: 1.35;
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.13em;
}
.card .section-head, .section-head {
  margin-bottom: 16px;
}
.section-head p {
  margin: 0;
}
.section-head h2 {
  margin: 3px 0 0;
}

/* Card + prose breathing room */
.card, .ring-card, .metrics article, .subject, .timeline,
.two-col aside article, .insights, .achievements {
  line-height: 1.55;
}
.metrics article p { margin: 0 0 2px; }
.metrics article small { display: block; margin: 2px 0 0; }

/* Muted labels up one notch to a comfortable read size */
.due-date, .plan-date, .chip, .ring small, .cal-head {
  font-size: 11px;
}
.hero .hero-label {
  margin: 0;
}

/* =========================================================================
   SIDE RAIL — clean glass panel, calm navigation rhythm
   ========================================================================= */
.side {
  width: 256px;
  background: var(--surface-2);
  border-right: 1px solid var(--line-soft);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.02);
}
.side nav {
  gap: 4px;
  margin-top: 26px;
}
.side nav::before {
  content: "Workspace";
  display: block;
  margin: 0 12px 10px;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.side nav button {
  min-height: 44px;
  padding: 11px 12px 11px 14px;
  font-size: 14px;
  font-weight: 550;
  letter-spacing: -0.01em;
}
.side nav button > span:first-child {
  width: 20px;
  flex: 0 0 20px;
  font-size: 17px;
}
.side nav button:hover {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-paper);
}
.side nav button.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(74, 91, 212, 0.22);
}
[data-theme="dark"] .side nav button.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.side-bottom {
  gap: 6px;
}
.side-bottom > button {
  min-height: 40px;
  font-size: 13px;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
}
.side-bottom > button:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

[data-theme="dark"] .side { box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.02); }

/* =========================================================================
   SIDEBAR REMOVED → full-width top navigation bar
   ========================================================================= */
.side {
  display: none !important;
}
.mobile {
  display: none !important;
}
main {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
@media (min-width: 1923px) {
  main { margin-left: 0 !important; }
}

/* Top bar — brand, centered tabs, actions */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 22px;
  max-width: 1240px;
  margin: 0 auto 18px;
  padding: 14px 0;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
[data-theme="dark"] .topbar {
  background: color-mix(in srgb, var(--paper) 86%, transparent);
}
.topbar .brand {
  flex: 0 0 auto;
  gap: 10px;
  font-size: 19px;
}
.topbar .brand b {
  width: 32px; height: 32px;
  border-radius: 9px;
  font-size: 16px;
}
.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-paper);
}
.topnav button {
  border: 0;
  background: transparent;
  color: var(--nav-muted);
  font-weight: 550;
  font-size: 13.5px;
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.18s;
  line-height: 1;
}
.topnav button:hover { background: var(--surface-2); color: var(--ink); }
.topnav button.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 12px rgba(74, 91, 212, 0.22);
}
[data-theme="dark"] .topnav button.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.topbar .actions {
  flex: 0 0 auto;
}

/* Search trigger retains icon-button sizing */
.mobile-search {
  border: 1px solid var(--line-soft) !important;
  background: var(--surface) !important;
  color: var(--muted) !important;
  border-radius: var(--radius-xs) !important;
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
}
.mobile-search:hover { color: var(--ink) !important; }

/* Page title block below the top bar */
.page-titleblock {
  max-width: 1240px;
  margin: 0 auto 6px;
}
.page-titleblock h1 {
  margin: 2px 0 0;
  font-size: clamp(22px, 2.6vw, 28px);   /* TypeUI: dashboard h1 cap = 28px */
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.page-titleblock .section-label { margin: 0 0 4px; }
.page-titleblock #date-line,
.page-titleblock .day-summary {
  margin: 6px 0 0;
}
header { margin-bottom: 0; }
header:not(.topbar) { margin-bottom: 0; }

/* Responsive: collapse top nav into icons on small screens */
@media (max-width: 900px) {
  .topbar { gap: 10px; }
  .topnav { gap: 0; margin-inline: 0; }
  .topnav button span:last-child { display: none; }
  .topnav button { padding: 8px 11px; }
  .topbar .actions span#connection-status,
  .topbar .actions span#saved { display: none; }
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; padding: 12px 0 10px; }
  .topbar .brand span { display: none; }
  .topnav { order: 3; width: 100%; justify-content: space-around; margin: 8px 0 0; }
  .topnav button { padding: 9px 0; flex: 1; }
  .topbar .actions { gap: 6px; }
  .page-titleblock h1 { font-size: 22px; }
}
