:root {
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #F5F4F0;
  --aura-1: rgba(110, 123, 255, .11);
  --aura-2: rgba(236, 72, 153, .06);
  --surface: #FFFFFF;
  --surface-2: #F8F7F4;
  --surface-3: #EEEDE8;
  --surface-hover: #F4F3EF;
  --text: #17171C;
  --text-2: #55555F;
  --text-3: #6E6E78;
  --border: rgba(23, 23, 32, .075);
  --border-strong: rgba(23, 23, 32, .13);
  --tag-base: #141418;

  --hero-bg: #141419;
  --hero-border: transparent;
  --mark-bg: #17171C;
  --mark-fg: #FFFFFF;
  --active-bg: #17171C;
  --active-text: #FFFFFF;
  --seg-ind: #FFFFFF;
  --toast-bg: #18181D;

  --accent: #4D5BF7;
  --accent-soft: rgba(77, 91, 247, .11);
  --success: #0F7F48;
  --danger: #CE2C31;
  --warn: #A35F00;

  --sk-1: #ECEBE6;
  --sk-2: #F8F7F3;

  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .04), 0 1px 1px rgba(20, 20, 30, .02);
  --shadow-md: 0 1px 2px rgba(20, 20, 30, .04), 0 4px 12px -6px rgba(20, 20, 30, .10);
  --shadow-lg: 0 1px 3px rgba(20, 20, 30, .05), 0 10px 24px -14px rgba(20, 20, 30, .20);
  --shadow-overlay: 0 2px 4px rgba(20, 20, 30, .04), 0 14px 30px -8px rgba(20, 20, 30, .16), 0 36px 70px -20px rgba(20, 20, 30, .22);

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0B0E;
    --aura-1: rgba(110, 123, 255, .13);
    --surface: #15151A;
    --surface-2: #1A1A20;
    --surface-3: #24242C;
    --surface-hover: #1C1C22;
    --text: #F3F3F6;
    --text-2: #A7A7B3;
    --text-3: #868692;
    --border: rgba(255, 255, 255, .07);
    --border-strong: rgba(255, 255, 255, .12);
    --tag-base: #FFFFFF;
    --hero-bg: #16161C;
    --hero-border: rgba(255, 255, 255, .08);
    --mark-bg: #F3F3F6;
    --mark-fg: #111114;
    --active-bg: #F3F3F6;
    --active-text: #111114;
    --seg-ind: #3A3A44;
    --toast-bg: #26262E;
    --accent: #7C87FF;
    --accent-soft: rgba(124, 135, 255, .16);
    --success: #2FBF71;
    --danger: #FF6369;
    --warn: #F2A93B;
    --sk-1: #18181E;
    --sk-2: #23232B;
    --shadow-sm: inset 0 1px 0 rgba(255, 255, 255, .03), 0 1px 2px rgba(0, 0, 0, .45);
    --shadow-md: inset 0 1px 0 rgba(255, 255, 255, .04), 0 6px 16px -8px rgba(0, 0, 0, .5);
    --shadow-lg: inset 0 1px 0 rgba(255, 255, 255, .05), 0 12px 28px -16px rgba(0, 0, 0, .6);
    --shadow-overlay: inset 0 1px 0 rgba(255, 255, 255, .05), 0 28px 64px -14px rgba(0, 0, 0, .75);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 520px; pointer-events: none; z-index: -1;
  background:
    radial-gradient(760px 340px at 12% -150px, var(--aura-1), transparent 70%),
    radial-gradient(680px 320px at 92% -170px, var(--aura-2), transparent 70%);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell: sidebar + list + panel from 1280 px, sidebar + list from 900 px, one column below. */
.shell { max-width: 1480px; margin: 0 auto; padding: 0 16px; }
.sidebar, .panel { display: none; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 32px; padding: 0 24px; }
  .sidebar { display: flex; }
  .topbar { display: none; }
}
@media (min-width: 1280px) {
  .shell { grid-template-columns: 232px minmax(0, 1fr) 360px; }
  .panel { display: block; }
  #heroSlot { display: none; }
  #statusLine { display: none; }
}
.main { min-width: 0; max-width: 800px; width: 100%; padding: 22px 0 140px; }
@media (min-width: 900px) { .main { padding-top: 30px; } }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; flex-direction: column; gap: 22px;
  padding: 24px 0 20px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font: 700 17px/1 var(--font-display); letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--mark-bg); color: var(--mark-fg); box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .35); }
.brand-mark svg { width: 18px; height: 18px; }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item, .unit-row {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border-radius: 10px; font-size: 14px; font-weight: 550; color: var(--text-2); text-align: left;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
@media (hover: hover) { .nav-item:hover, .unit-row:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); } }
.nav-item[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.side-label { padding: 0 10px 6px; font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.unit-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--u, var(--text-3)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--u, transparent) 18%, transparent); }
.unit-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-2); background: var(--surface-3); }
.unit-row[aria-pressed="true"] { background: var(--active-bg); color: var(--active-text); }
.unit-row[aria-pressed="true"] .count { color: var(--active-text); background: color-mix(in srgb, var(--active-text) 18%, transparent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.side-actions .btn { flex: 1 1 auto; padding: 0 10px; white-space: nowrap; }
.sidebar { overflow-x: hidden; }

/* Status */
.status { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-3); }
.status .line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.status .bad { color: var(--danger); font-weight: 600; }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--success); }
.sync-dot.bad { background: var(--danger); }
.link { color: var(--accent); font-weight: 650; }
@media (hover: hover) { .link:hover { text-decoration: underline; } }
#statusLine { margin-top: 8px; }
#statusLine .status { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }

/* Top bar (under 900 px) */
.topbar {
  position: sticky; top: 0; z-index: 40; margin: 0 -16px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%);
  border-bottom: 1px solid var(--border);
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tabs { display: flex; gap: 4px; margin-top: 10px; }
.tabs .nav-item { width: auto; height: 32px; font-size: 13.5px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); transition: background-color .2s ease, color .2s ease, transform .2s var(--ease-out); }
.icon-btn svg { width: 20px; height: 20px; }
@media (hover: hover) { .icon-btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); } }
.icon-btn:active { transform: scale(.96); }
.icon-btn.spinning svg { animation: spin .9s linear infinite; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 14px 0 2px; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips { display: none; } }
.chips .unit-row { flex: none; width: auto; height: 34px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 13.5px; font-weight: 600; }

/* Greeting */
.greeting h1 { margin: 6px 0 6px; font: 700 clamp(26px, 5vw, 32px)/1.12 var(--font-display); letter-spacing: -.028em; text-wrap: balance; }
.sub { margin: 0; color: var(--text-2); font-size: 14.5px; }

/* Next-deadline card */
@property --glow { syntax: '<color>'; inherits: true; initial-value: #6366F1; }
.hero {
  --glow: #6366F1;
  position: relative; isolation: isolate; overflow: hidden;
  margin-top: 22px; padding: 22px 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px;
  border-radius: 24px; background: var(--hero-bg); color: #fff;
  border: 1px solid var(--hero-border); box-shadow: var(--shadow-lg);
  transition: --glow .4s var(--ease-out);
}
.hero-glow { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(560px 280px at 96% -32%, color-mix(in srgb, var(--glow) 62%, transparent), transparent 70%),
    radial-gradient(440px 220px at -6% 135%, color-mix(in srgb, var(--glow) 26%, transparent), transparent 70%); }
.hero-glow::after { content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(380px 220px at 92% 0%, #000, transparent 75%);
  mask-image: radial-gradient(380px 220px at 92% 0%, #000, transparent 75%); }
.hero-label { display: inline-flex; align-items: center; gap: 9px; font-size: 11.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: rgba(255, 255, 255, .62); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #34D399; }
.hero[data-level="soon"] .live-dot { background: #FBBF24; }
.hero[data-level="urgent"] .live-dot { background: #FF6B6B; box-shadow: 0 0 0 3px rgba(255, 107, 107, .28); }
.hero-unit { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 13px; color: rgba(255, 255, 255, .6); }
.hero-tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 650; letter-spacing: .02em; color: color-mix(in srgb, var(--u, #6366F1) 50%, #fff); background: color-mix(in srgb, var(--u, #6366F1) 24%, transparent); }
.hero-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--u, #6366F1); }
.hero-title { margin: 8px 0 0; font: 600 19px/1.3 var(--font-display); letter-spacing: -.015em; text-wrap: balance; }
.hero-digits { margin-top: 14px; display: flex; align-items: baseline; white-space: nowrap; font: 600 clamp(38px, 9vw, 54px)/1 var(--font-display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.hero-digits .sep { opacity: .32; margin: 0 .03em; }
.hero-digits .du { font-size: .46em; opacity: .5; margin: 0 .4em 0 .08em; letter-spacing: 0; }
.hero-words { margin-top: 14px; font: 600 24px/1.25 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.hero-meta { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; color: rgba(255, 255, 255, .66); }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.hero.is-empty .hero-title { font-size: 22px; margin-top: 14px; }
.hero-stats { margin: 0; display: flex; flex-direction: column; justify-content: center; min-width: 124px; padding-left: 24px; border-left: 1px solid rgba(255, 255, 255, .1); }
.hero-stats div { display: flex; flex-direction: column-reverse; padding: 7px 0; }
.hero-stats dt { font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .72); }
.hero-stats dd { margin: 0; font: 600 24px/1.15 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero.is-hidden { display: none; }
.hero.is-compact { grid-template-columns: minmax(0, 1fr); padding: 16px 20px; border-radius: 20px; }
.hero.is-compact .hero-glow { opacity: .55; }
.hero.is-compact .hero-stats, .hero.is-compact .hero-meta, .hero.is-compact .hero-label { display: none; }
.hero.is-compact .hero-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "unit digits" "title digits"; column-gap: 20px; align-items: center; }
.hero.is-compact .hero-unit { grid-area: unit; margin-top: 0; }
.hero.is-compact .hero-title { grid-area: title; margin-top: 6px; font-size: 16.5px; }
.hero.is-compact .hero-digits, .hero.is-compact .hero-words { grid-area: digits; margin-top: 0; font-size: 30px; }
.hero.is-compact .hero-words { font-size: 15px; max-width: 220px; text-align: right; }
/* In the 360 px panel the stats sit under the countdown. */
.panel .hero, .hero.is-narrow { grid-template-columns: minmax(0, 1fr); margin-top: 0; padding: 20px; }
.panel .hero-stats, .hero.is-narrow .hero-stats { flex-direction: row; min-width: 0; padding: 14px 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.panel .hero-stats div, .hero.is-narrow .hero-stats div { flex: 1; padding: 0; }
.panel .hero-digits { font-size: 44px; }
.panel .hero.is-compact .hero-digits { font-size: 26px; }

/* Groups and cards */
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 2px 12px; }
.group-head h2 { margin: 0; display: flex; align-items: center; gap: 9px; font: 650 17px/1.2 var(--font-display); letter-spacing: -.015em; }
.g-note { font-size: 13px; color: var(--text-3); }
.group-head[data-group="Overdue"] .count, .group-head[data-group="Today"] .count { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
details.unclear > summary { list-style: none; cursor: pointer; }
details.unclear > summary::-webkit-details-marker { display: none; }
details.unclear > summary .chev { width: 16px; height: 16px; color: var(--text-3); transition: transform .2s var(--ease-out); }
details.unclear[open] > summary .chev { transform: rotate(90deg); }

.card-wrap { padding-bottom: 10px; }
.card {
  --u: #6366F1;
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px;
  padding: 16px 16px 16px 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .25s var(--ease-out), border-color .25s ease;
}
.card::before { content: ""; position: absolute; left: -1px; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--u); }
.card::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
  .card:hover::after { opacity: 1; }
}
.card.is-selected { border-color: color-mix(in srgb, var(--u) 55%, var(--border-strong)); }
.card.is-selected::after { opacity: 1; }
.card.flash { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; }
.unit-tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 650; letter-spacing: .02em; color: color-mix(in srgb, var(--u) 55%, var(--tag-base)); background: color-mix(in srgb, var(--u) 13%, transparent); }
.unit-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--u); }
.card-type { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.waiting { border-style: dashed; }
.card-title { margin: 9px 0 10px; font: 600 16.5px/1.35 var(--font-display); letter-spacing: -.011em; text-wrap: pretty; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--text-2); }
.meta { display: inline-flex; align-items: center; gap: 7px; }
.meta > svg { width: 15px; height: 15px; flex: none; color: var(--text-3); }
.meta b { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.meta.overdue { color: var(--danger); font-weight: 600; }
.meta.unclear { color: var(--warn); font-weight: 600; }
.card-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 14px; }
.countdown {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 11px 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
}
.countdown[data-level="soon"] { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 24%, transparent); }
.countdown .u { font-weight: 500; opacity: .62; margin: 0 4px 0 1px; }
.countdown .u:last-child { margin-right: 0; }
.cd-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.card-actions { display: flex; align-items: center; gap: 4px; }
.btn-done {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 9px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text);
  transition: background-color .3s var(--ease-out), border-color .3s ease, transform .2s var(--ease-spring);
}
@media (hover: hover) { .btn-done:hover { background: var(--surface-hover); border-color: color-mix(in srgb, var(--success) 45%, var(--border-strong)); } }
.btn-done:active { transform: scale(.96); transition-duration: 0s; }
.chk { width: 18px; height: 18px; flex: none; overflow: visible; }
.chk circle { fill: transparent; stroke: var(--text-3); stroke-width: 1.7; }
.chk path { fill: none; stroke: var(--success); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 12; stroke-dashoffset: 12; transition: stroke-dashoffset .3s var(--ease-out), opacity .2s ease; }
@media (hover: hover) { .btn-done:hover .chk circle { stroke: var(--success); } .btn-done:hover .chk path { stroke-dashoffset: 0; opacity: .45; } }
.btn-more { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; color: var(--text-2); transition: background-color .2s ease, transform .2s var(--ease-out); }
.btn-more svg { width: 18px; height: 18px; }
@media (hover: hover) { .btn-more:hover { background: var(--surface-3); color: var(--text); } }
.btn-more[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.linked-note { font-size: 12.5px; color: var(--text-3); }

.card-wrap.leaving { animation: leave .25s var(--ease-out) forwards; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow-sm); text-decoration: none; transition: background-color .2s, transform .2s var(--ease-out);
}
@media (hover: hover) { .btn:hover { background: var(--surface-hover); } }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--active-bg); color: var(--active-text); border-color: transparent; }
.btn.small { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn svg { width: 16px; height: 16px; }

/* Panel and details */
.panel { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 30px 0 24px; }
.panel-section { margin-top: 22px; }
.panel-label { margin: 0 4px 10px; font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.mini-ann { display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: border-color .2s; }
@media (hover: hover) { .mini-ann:hover { border-color: var(--border-strong); } }
.mini-ann .t { margin-top: 6px; font-weight: 600; font-size: 14px; line-height: 1.35; }
.mini-ann .s { margin-top: 4px; font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.detail { animation: fadeIn .2s ease-out; }
.detail-card { --u: #6366F1; padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.detail h2 { margin: 12px 0 6px; font: 650 20px/1.3 var(--font-display); letter-spacing: -.018em; text-wrap: balance; }
.facts { margin: 14px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.detail-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13.5px; }
.detail-block h3 { margin: 0 0 8px; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.detail-text { white-space: pre-wrap; color: var(--text-2); max-height: 320px; overflow: auto; }
.file-list, .linked-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.linked-list li { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.linked-list li.is-marked { border-color: var(--accent); }
.linked-list .lt { font-weight: 600; }
.linked-list .ld { font-size: 12.5px; color: var(--text-2); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* Sheet (details under 1280 px) */
dialog.sheet {
  margin: 12px 12px 12px auto; height: calc(100vh - 24px); max-height: none; width: min(420px, calc(100vw - 24px));
  padding: 0; border: 1px solid var(--border); border-radius: 24px; background: var(--bg); color: var(--text);
  box-shadow: var(--shadow-overlay);
}
dialog.sheet[open] { animation: slideIn .3s var(--ease-out); }
dialog.sheet::backdrop { background: rgba(12, 12, 18, .32); }
.sheet-inner { height: 100%; overflow-y: auto; padding: 16px; }
.sheet-close { position: sticky; top: 0; display: flex; justify-content: flex-end; margin-bottom: 4px; }
/* The sheet has its own close button. */
.sheet .detail-head .icon-btn { display: none; }
@media (max-width: 899px) {
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; height: auto; max-height: 90vh; border-radius: 24px 24px 0 0; }
  dialog.sheet[open] { animation: slideUp .3s var(--ease-out); }
}

/* Announcements */
.ann { cursor: pointer; }
.ann.important::before { background: var(--danger); }
.ann .summary { margin-top: 2px; font-size: 14px; color: var(--text-2); text-wrap: pretty; }

/* Settings */
.section-label { margin: 26px 4px 8px; font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.group-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.row { display: block; padding: 14px 16px; }
.row + .row { border-top: 1px solid var(--border); }
.row-title { display: block; font-size: 14.5px; font-weight: 600; }
.row-desc { margin-top: 2px; font-size: 13px; color: var(--text-2); }
.row select, .row input[type=number], .token-input {
  margin-top: 10px; height: 38px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); min-width: 200px; max-width: 100%;
}
.token-input { width: 100%; }
.choice { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; font-size: 14px; }
.choice .row-desc { margin: 0; }
.row-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.form-foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.msg { font-size: 13px; color: var(--text-2); }
.seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; padding: 3px; border-radius: 12px; background: var(--surface-3); max-width: 420px; }
.seg-ind { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3); border-radius: 9px; background: var(--seg-ind); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 3px 10px -3px rgba(0, 0, 0, .14); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .3s var(--ease-out); }
.seg button { position: relative; z-index: 1; height: 34px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.seg button[aria-checked="true"] { color: var(--text); }

/* Menu */
.menu {
  position: fixed; z-index: 60; width: 220px; padding: 6px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-overlay); animation: pop .18s var(--ease-out);
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; font-size: 14px; text-align: left; text-decoration: none; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item svg { width: 16px; height: 16px; color: var(--text-2); }

/* Empty, error and skeleton */
.empty { text-align: center; padding: 56px 20px 40px; }
.empty-art { width: 72px; height: 72px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 24px; color: var(--success); background: linear-gradient(135deg, color-mix(in srgb, var(--success) 18%, var(--surface)), var(--surface)); border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.empty-art svg { width: 32px; height: 32px; }
.empty h2 { margin: 0 0 6px; font: 650 20px/1.2 var(--font-display); letter-spacing: -.02em; }
.empty p { margin: 0 auto; max-width: 340px; font-size: 14.5px; color: var(--text-2); }
.error-box { margin-top: 18px; padding: 14px 16px; border-radius: 14px; color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); font-size: 14px; }
.sk { position: relative; overflow: hidden; border-radius: 8px; background: var(--sk-1); }
.sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 25%, var(--sk-2) 50%, transparent 75%); transform: translateX(-100%); animation: shimmer 1.5s linear infinite; }
.sk-h { width: 108px; height: 18px; margin: 30px 2px 14px; border-radius: 6px; }
.sk-card { display: flex; justify-content: space-between; gap: 16px; padding: 18px; margin-bottom: 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.sk-card .l { flex: 1; display: flex; flex-direction: column; gap: 11px; }
.sk-tag { width: 84px; height: 20px; } .sk-title { width: 72%; height: 16px; } .sk-meta { width: 46%; height: 12px; }
.sk-btn { width: 120px; height: 32px; border-radius: 999px; align-self: flex-end; }

/* Toasts */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--toast-bg); color: #fff; box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .4); font-size: 14px; animation: rise .25s var(--ease-out); }
.toast.no-act { padding-right: 18px; }
.toast-act { height: 32px; padding: 0 12px; border-radius: 9px; font-weight: 650; color: #AEB5FF; }
.toast-act:hover { background: rgba(255, 255, 255, .09); }

/* First-load entrance, capped in app.js to the first 8 cards. */
.enter { animation: rise .28s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 40ms); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes leave { to { opacity: 0; transform: translateX(16px); } }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }

@media (max-width: 600px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 20px; border-radius: 22px; }
  .hero-stats { flex-direction: row; min-width: 0; padding: 14px 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .1); }
  .hero-stats div { flex: 1; padding: 0; }
  .hero.is-compact { padding: 14px 16px; }
  .hero.is-compact .hero-digits { font-size: 26px; }
  .card { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 15px 14px 12px 18px; }
  .card-side { flex-direction: row; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .sk::after { display: none; }
}

.card-main { min-width: 0; }
.title-btn { font: inherit; color: inherit; text-align: left; letter-spacing: inherit; }
@media (hover: hover) { .title-btn:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; } }
