@font-face {
  font-family: "InterVar";
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "InstrumentSerif";
  src: url("/fonts/InstrumentSerif-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F5F3EE;
  --bg-2: #EDEAE3;
  --surface: #FFFEFB;
  --surface-2: #F8F6F1;
  --ink: #16181C;
  --ink-2: #4A4E57;
  --muted: #7B7F88;
  --line: rgba(22, 24, 28, .10);
  --line-strong: rgba(22, 24, 28, .20);
  --accent: #14594A;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(20, 89, 74, .09);
  --copper: #B87333;
  --gold: #A98645;
  --danger: #B5463A;
  --m-iv: #2F7A62;
  --m-do: #B87333;
  --m-ban: #4C62A8;
  --m-cal: #9A5B7A;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -18px rgba(0,0,0,.25);
  --shadow-lift: 0 1px 2px rgba(0,0,0,.05), 0 20px 48px -24px rgba(0,0,0,.30);
  --ease: cubic-bezier(.22,1,.36,1);
  --font: "InterVar", ui-sans-serif, system-ui, sans-serif;
  --display: "InstrumentSerif", Georgia, serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0C0F10;
  --bg-2: #111516;
  --surface: #151A1B;
  --surface-2: #1A2021;
  --ink: #ECEAE4;
  --ink-2: #B7B5AE;
  --muted: #8A8C8B;
  --line: rgba(236, 234, 228, .10);
  --line-strong: rgba(236, 234, 228, .18);
  --accent: #6FC3AC;
  --accent-ink: #0C0F10;
  --accent-soft: rgba(111, 195, 172, .12);
  --copper: #D9A066;
  --gold: #C6A56B;
  --danger: #E08377;
  --m-iv: #6FC3AC;
  --m-do: #D9A066;
  --m-ban: #8C9BD6;
  --m-cal: #D39AB6;
  --shadow: 0 1px 2px rgba(0,0,0,.28), 0 16px 38px -20px rgba(0,0,0,.70);
  --shadow-lift: 0 1px 2px rgba(0,0,0,.34), 0 24px 54px -24px rgba(0,0,0,.78);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(720px 420px at 8% -10%, color-mix(in srgb, var(--accent) 4%, transparent), transparent 62%),
    linear-gradient(180deg, var(--bg), var(--bg));
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -.008em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: .018;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
ul, ol, h1, h2, h3, p { margin: 0; padding: 0; }
svg { display: block; }
.icon { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; }
.icon svg { width: 20px; height: 20px; }
.icon-btn .icon svg, .search-trigger .icon svg, .bottom-nav .icon svg { width: 19px; height: 19px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--surface-2); color: var(--muted);
  font-family: var(--font); font-size: 10px; font-weight: 600;
  box-shadow: 0 1px 0 var(--line);
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- shell ---------- */
.app-shell { min-height: 100dvh; }
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: 248px; display: flex; flex-direction: column;
  padding: 26px 18px 20px;
  background:
    radial-gradient(280px 240px at 0% 0%, var(--accent-soft), transparent 72%),
    color-mix(in srgb, var(--surface) 76%, var(--bg));
  border-right: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; gap: 11px; min-height: 46px; padding: 0 8px; }
.wordmark-mark {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  font-family: var(--display); font-size: 27px; line-height: 1; padding-top: 3px;
  box-shadow: var(--shadow);
}
.wordmark-text { display: flex; flex-direction: column; gap: 2px; font-family: var(--display); font-size: 27px; line-height: .9; letter-spacing: -.02em; }
.wordmark-text span {
  font-family: var(--font); font-size: 9px; line-height: 1.2; letter-spacing: .15em;
  text-transform: uppercase; color: var(--muted); font-weight: 650;
}
.rail-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 42px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: var(--ink-2); font-size: 13px; font-weight: 540;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-item::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px;
  border-radius: 2px; background: transparent; transition: background .18s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-item.is-active::before { background: var(--accent); }
.nav-icon { display: grid; place-items: center; width: 20px; height: 20px; color: var(--muted); }
.nav-item:hover .nav-icon, .nav-item.is-active .nav-icon { color: currentColor; }
.nav-icon svg { width: 19px; height: 19px; }
.rail-today { margin-top: auto; padding: 14px 12px 16px; border-top: 1px solid var(--line); }
.rail-label, .section-label {
  color: var(--muted); font-size: 11px; line-height: 1.2; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 600;
}
.rail-today-summary { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.rail-next { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.rail-next-meta { font-size: 11px; color: var(--muted); line-height: 1.35; }
.rail-counts { display: flex; gap: 12px; margin-top: 2px; color: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.rail-skeleton { width: 100%; height: 12px; border-radius: 999px; background: var(--bg-2); margin-top: 14px; }
.rail-skeleton.short { width: 58%; margin-top: 8px; }
.rail-foot { display: flex; flex-direction: column; gap: 10px; padding: 16px 4px 0; border-top: 1px solid var(--line); }
.theme-switch {
  display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 9px;
  border-radius: 9px; color: var(--ink-2); font-size: 12px; font-weight: 550;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.theme-switch:hover { background: var(--surface-2); color: var(--ink); }
.theme-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-strong); background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
:root[data-theme="dark"] .theme-dot { background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 9px;
  width: fit-content; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); background: var(--surface-2); font-size: 11px; font-weight: 550;
}
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.sync-pill.is-saved { color: var(--accent); border-color: var(--line); background: var(--accent-soft); }
.sync-pill.is-saved .sync-dot { background: var(--accent); }
.sync-pill.is-saving .sync-dot { background: var(--gold); animation: pulse 1s ease-in-out infinite; }
.sync-pill.is-offline { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.sync-pill.is-offline .sync-dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .28; transform: scale(.72); } }

.workspace { margin-left: 248px; height: 100dvh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; flex: none; display: flex; align-items: center; gap: 18px;
  padding: 0 32px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  position: relative; z-index: 30;
}
.page-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.page-id h1 { font-size: 16px; font-weight: 620; letter-spacing: -.015em; line-height: 1.2; white-space: nowrap; }
.page-meta { font-size: 11px; color: var(--muted); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 9px 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--muted); font-size: 12px; transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--ink-2); background: var(--surface-2); }
.search-trigger .icon { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 570;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.btn:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 30px; padding: 0 9px; font-size: 11px; border-radius: 8px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid transparent; color: var(--muted);
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); border-color: var(--line); }
.icon-btn.small { width: 30px; height: 30px; border-radius: 8px; }
.mobile-wordmark, .mobile-theme { display: none; }

.main { flex: 1; min-height: 0; position: relative; overflow-y: auto; overflow-x: hidden; scrollbar-color: var(--line-strong) transparent; }
.overview { width: min(100%, 1180px); margin: 0 auto; padding: 28px 32px 54px; }
.overview.route-in { animation: routeIn .22s var(--ease) both; }
@keyframes routeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: start; }
.panel {
  min-width: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
}
.panel-head { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 13px; font-weight: 640; letter-spacing: -.01em; }
.panel-head .section-label { margin-right: auto; }
.panel-head .meta { margin-left: auto; color: var(--muted); font-size: 11px; }
.panel-body { padding: 18px 20px 20px; }

/* ---------- hero + now ---------- */
.hero-panel { grid-column: span 8; padding: 28px 30px 26px; position: relative; }
.hero-panel::after {
  content: ""; position: absolute; right: -80px; top: -110px; width: 300px; height: 300px;
  border: 1px solid var(--line); border-radius: 50%; opacity: .32; pointer-events: none;
}
.hero-date { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.hero-greeting {
  margin-top: 12px; font-family: var(--display); font-weight: 400;
  font-size: clamp(40px, 4.3vw, 54px); line-height: .96; letter-spacing: -.02em;
}
.hero-line { display: flex; align-items: center; gap: 8px; margin-top: 13px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.hero-line .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.kpis { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 25px; }
.kpi {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
  color: var(--ink-2); font-size: 12px; font-weight: 550;
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.kpi:hover { border-color: var(--line-strong); background: var(--surface); transform: translateY(-1px); }
.kpi .kpi-mark { width: 3px; height: 14px; border-radius: 3px; background: var(--m-iv); }
.kpi:nth-child(2) .kpi-mark { background: var(--m-do); }
.kpi:nth-child(3) .kpi-mark { background: var(--m-ban); }
.kpi strong { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.now-panel {
  grid-column: span 4; position: relative; min-height: 230px; padding: 22px 22px 20px;
  color: var(--accent-ink); background: var(--accent); border-color: transparent;
  display: flex; flex-direction: column;
}
.now-panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(150% 90% at 100% 0%, rgba(255,255,255,.20), transparent 55%);
}
.now-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.now-label { font-size: 11px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.now-clock { font-family: var(--display); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; opacity: .88; }
.now-content { position: relative; z-index: 1; margin-top: auto; padding-top: 34px; }
.now-time { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .72; font-variant-numeric: tabular-nums; }
.now-title { margin-top: 8px; font-family: var(--display); font-size: 32px; line-height: 1.02; letter-spacing: -.02em; }
.now-meta { margin-top: 10px; font-size: 11px; line-height: 1.4; opacity: .72; }
.now-link { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; align-self: flex-start; font-size: 11px; font-weight: 650; opacity: .92; }
.now-link .icon, .now-link .icon svg { width: 14px; height: 14px; }

/* ---------- agenda ---------- */
.agenda-panel { grid-column: span 7; }
.agenda-list { display: flex; flex-direction: column; }
.agenda-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 13px 0; border-bottom: 1px solid var(--line); min-height: 54px; }
.agenda-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.agenda-time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; padding-top: 3px; white-space: nowrap; }
.agenda-main { min-width: 0; }
.agenda-title { display: block; width: 100%; font-size: 13px; font-weight: 570; line-height: 1.35; overflow-wrap: anywhere; text-align: left; background: none; border: 0; padding: 0; }
.agenda-title:hover { color: var(--accent); }
.agenda-sub { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.agenda-block-mark { width: 3px; height: 28px; border-radius: 3px; background: var(--m-cal); }
.agenda-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.agenda-section-label { margin-bottom: 7px; }
.agenda-group { display: flex; flex-direction: column; }
.agenda-habit { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 3px 0; }
.agenda-habit-title { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-2); }
.agenda-habit.is-done .agenda-habit-title { color: var(--muted); text-decoration: line-through; }
.agenda-tick { width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 8px; display: grid; place-items: center; color: var(--muted); opacity: .72; transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), opacity .18s var(--ease); }
.agenda-tick:hover { border-color: var(--accent); color: var(--accent); }
.agenda-tick.is-on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); opacity: 1; }
.agenda-tick svg { width: 14px; height: 14px; }
.quota-chip { color: var(--copper); font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.empty-calm { padding: 25px 8px 24px; text-align: center; }
.empty-calm h3 { font-family: var(--display); font-size: 30px; font-weight: 400; letter-spacing: -.02em; }
.empty-calm p { margin-top: 7px; color: var(--muted); font-size: 12px; }
.empty-calm .btn { margin-top: 16px; }

/* ---------- actions ---------- */
.actions-panel { grid-column: span 5; }
.capture-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 600;
  transition: transform .18s var(--ease), filter .18s var(--ease);
}
.capture-btn:hover { filter: brightness(1.06); }
.capture-btn:active { transform: scale(.985); }
.capture-btn kbd { color: var(--bg); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); box-shadow: none; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.quick-action {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  color: var(--ink-2); font-size: 11px; font-weight: 570; text-align: left;
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.quick-action:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.quick-action .icon, .quick-action .icon svg { width: 15px; height: 15px; }
.quick-action > svg { width: 15px; height: 15px; flex: none; }
.send-picker { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--line); }
.send-picker label { display: block; margin-bottom: 8px; }
.send-row { display: flex; gap: 7px; }
.select {
  flex: 1; min-width: 0; min-height: 38px; padding: 0 30px 0 10px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink-2);
  font-size: 11px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%237B7F88' stroke-width='1.6'%3E%3Cpath d='m5 7.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}

/* ---------- modules ---------- */
.modules-section { grid-column: span 12; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 11px; }
.section-head h2 { font-family: var(--display); font-size: 28px; font-weight: 400; letter-spacing: -.02em; line-height: 1; }
.section-head span { margin-left: auto; color: var(--muted); font-size: 11px; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.module-card {
  position: relative; display: flex; flex-direction: column; min-height: 184px; padding: 17px 17px 15px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow); overflow: hidden;
  transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.module-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.module-card::before { content: ""; position: absolute; left: 0; top: 17px; bottom: 17px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mc); }
.module-card[data-module="iv"] { --mc: var(--m-iv); }
.module-card[data-module="do"] { --mc: var(--m-do); }
.module-card[data-module="ban"] { --mc: var(--m-ban); }
.module-card[data-module="cal"] { --mc: var(--m-cal); }
.module-head { display: flex; align-items: center; gap: 9px; }
.module-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--mc); background: color-mix(in srgb, var(--mc) 9%, var(--surface)); }
.module-icon svg { width: 16px; height: 16px; }
.module-head h3 { font-size: 13px; font-weight: 640; }
.module-head .arrow { margin-left: auto; color: var(--muted); opacity: 0; transform: translateX(-3px); transition: opacity .18s var(--ease), transform .18s var(--ease); }
.module-head .arrow svg { width: 15px; height: 15px; }
.module-card:hover .arrow { opacity: 1; transform: none; }
.module-stat { margin-top: 17px; font-family: var(--display); font-size: 38px; line-height: .9; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.module-stat small { font-family: var(--font); font-size: 11px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.module-note { margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.module-viz { margin-top: auto; padding-top: 15px; min-height: 48px; }
.progress-track { height: 5px; border-radius: 5px; background: var(--bg-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--mc); transition: width .3s var(--ease); }
.progress-meta { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.mini-ring { position: relative; width: 48px; height: 48px; display: grid; place-items: center; margin-top: 2px; }
.mini-ring svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 4; }
.mini-ring .track { stroke: var(--bg-2); }
.mini-ring .fill { stroke: var(--mc); stroke-linecap: round; transition: stroke-dashoffset .3s var(--ease); }
.mini-ring span { position: absolute; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.column-bars { display: flex; align-items: flex-end; gap: 4px; height: 42px; }
.column-bars i { display: block; flex: 1; border-radius: 3px 3px 1px 1px; background: color-mix(in srgb, var(--mc) 35%, var(--bg-2)); min-height: 3px; }
.column-bars i:first-child { background: var(--mc); }
.day-strip { position: relative; height: 26px; border-radius: 5px; background: var(--bg-2); overflow: hidden; }
.day-strip i { position: absolute; top: 5px; height: 16px; border-radius: 3px; background: var(--mc); opacity: .82; }
.day-strip .nowline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--copper); opacity: .65; }

/* ---------- activity + streaks ---------- */
.activity-panel { grid-column: span 7; }
.activity-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; align-items: end; min-height: 164px; padding-top: 8px; }
.activity-col { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.activity-bars { width: 100%; height: 118px; display: flex; flex-direction: column-reverse; align-items: stretch; justify-content: flex-start; gap: 2px; }
.activity-bars i { display: block; width: 100%; min-height: 2px; border-radius: 3px; transition: filter .18s var(--ease), transform .18s var(--ease); }
.activity-bars i:nth-child(1) { background: var(--m-do); }
.activity-bars i:nth-child(2) { background: var(--m-ban); }
.activity-bars i:nth-child(3) { background: var(--m-cal); }
.activity-col:hover .activity-bars i { filter: brightness(1.12); transform: scaleY(1.015); transform-origin: bottom; }
.activity-day { color: var(--muted); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.activity-tip {
  position: absolute; left: 50%; bottom: 150px; z-index: 3; transform: translate(-50%, 4px);
  min-width: 120px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow);
  font-size: 9px; line-height: 1.5; text-align: left; opacity: 0; pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.activity-col:hover .activity-tip, .activity-col:focus-within .activity-tip { opacity: 1; transform: translate(-50%, 0); }
.legend { display: flex; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 6px; height: 6px; border-radius: 2px; }
.legend i:nth-child(1) { background: var(--m-do); }
.legend span:nth-child(1) i { background: var(--m-do); }
.legend span:nth-child(2) i { background: var(--m-ban); }
.legend span:nth-child(3) i { background: var(--m-cal); }
.legend strong { margin-left: auto; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.streak-panel { grid-column: span 5; }
.streak-list { display: flex; flex-direction: column; }
.streak-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.streak-row:first-child { padding-top: 0; }
.streak-row:last-child { border-bottom: 0; padding-bottom: 0; }
.streak-name { font-size: 12px; font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streak-sub { margin-top: 3px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.streak-count { text-align: right; font-family: var(--display); font-size: 27px; line-height: .9; font-variant-numeric: tabular-nums; }
.streak-count small { display: block; margin-top: 3px; font-family: var(--font); font-size: 8px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.streak-dots { display: flex; gap: 4px; margin-top: 8px; }
.streak-dots i { width: 11px; height: 11px; border-radius: 3px; background: var(--bg-2); border: 1px solid var(--line); }
.streak-dots i.on { background: var(--m-do); border-color: var(--m-do); }
.streak-dots i.today { box-shadow: 0 0 0 1px var(--copper) inset; }
.panel-foot { display: flex; justify-content: flex-end; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-size: 11px; font-weight: 650; }
.text-link .icon, .text-link .icon svg { width: 14px; height: 14px; }

/* ---------- loading ---------- */
.loading-shell { display: flex; flex-direction: column; gap: 20px; }
.skel { position: relative; overflow: hidden; border-radius: 16px; background: var(--bg-2); }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 58%, transparent), transparent); transform: translateX(-100%); animation: shimmer 1.5s infinite; }
.skel-hero { height: 286px; }
.skel-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.skel-panel { height: 260px; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- module iframe ---------- */
.module-view { height: calc(100dvh - 64px); min-height: 360px; position: relative; background: var(--surface); }
.module-frame-wrap { position: absolute; inset: 0; background: var(--bg); }
.module-frame { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.module-fallback { height: 100%; padding: 40px; display: grid; place-items: center; text-align: center; color: var(--muted); }

/* ---------- bottom nav ---------- */
.bottom-nav { display: none; }

/* ---------- palette ---------- */
.palette { position: fixed; inset: 0; z-index: 120; display: grid; place-items: start center; padding: min(13vh, 120px) 18px 24px; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 10, .38); backdrop-filter: blur(8px); }
.palette-card {
  position: relative; width: min(640px, 100%); max-height: min(620px, 72vh); display: flex; flex-direction: column;
  border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface);
  box-shadow: 0 4px 10px rgba(0,0,0,.07), 0 32px 84px -24px rgba(0,0,0,.44);
  overflow: hidden; animation: paletteIn .2s var(--ease) both;
}
@keyframes paletteIn { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
.palette-search { display: flex; align-items: center; gap: 11px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.palette-search .icon { color: var(--muted); }
.palette-search input { flex: 1; min-width: 0; height: 32px; border: 0; outline: 0; background: transparent; font-size: 15px; }
.palette-search input::placeholder { color: var(--muted); }
.palette-results { overflow-y: auto; padding: 8px; }
.palette-group { padding: 8px 8px 4px; }
.palette-group-label { padding: 0 6px 6px; }
.palette-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center;
  min-height: 46px; padding: 6px 8px 6px 10px; border-radius: 10px; cursor: pointer;
  color: var(--ink-2); transition: background .14s var(--ease), color .14s var(--ease);
}
.palette-item:hover, .palette-item.is-selected { background: var(--accent-soft); color: var(--ink); }
.palette-main { display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; text-align: left; }
.palette-main > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.palette-ico { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; color: var(--palette-color, var(--accent)); background: color-mix(in srgb, var(--palette-color, var(--accent)) 10%, var(--surface)); flex: none; }
.palette-ico svg { width: 15px; height: 15px; }
.palette-title { display: block; font-size: 12px; font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-actions { display: flex; gap: 4px; }
.palette-action { min-height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); font-size: 9px; font-weight: 600; }
.palette-action:hover, .palette-action:focus-visible { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.palette-empty { padding: 38px 16px 44px; text-align: center; color: var(--muted); font-size: 12px; }
.palette-empty strong { display: block; margin-bottom: 5px; color: var(--ink-2); font-family: var(--display); font-size: 25px; font-weight: 400; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.palette-foot span { display: flex; align-items: center; gap: 4px; }
.palette-foot kbd { height: 17px; min-width: 17px; font-size: 8px; }

/* ---------- toast + dialog ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 160; transform: translateX(-50%);
  max-width: min(440px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 9px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lift); font-size: 11px; font-weight: 550;
  animation: toastIn .18s var(--ease) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 5px); } to { opacity: 1; transform: translate(-50%, 0); } }
.dialog { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 20px; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(8,10,10,.4); backdrop-filter: blur(7px); }
.dialog-card {
  position: relative; width: min(440px, 100%); padding: 24px; border: 1px solid var(--line-strong);
  border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lift);
  animation: paletteIn .2s var(--ease) both;
}
.dialog-card h2 { font-family: var(--display); font-weight: 400; font-size: 31px; line-height: 1; letter-spacing: -.02em; }
.dialog-card p { margin-top: 11px; color: var(--ink-2); font-size: 12px; line-height: 1.55; }
.checkline { display: flex; align-items: center; gap: 9px; margin-top: 18px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink-2); font-size: 11px; }
.checkline input { width: 16px; height: 16px; accent-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ---------- desktop density ---------- */
@media (max-width: 1100px) {
  .overview { padding-left: 24px; padding-right: 24px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .dash-grid { gap: 16px; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 959px) {
  .rail { display: none; }
  .workspace { margin-left: 0; height: 100dvh; }
  .topbar {
    height: 56px; padding: 0 16px; gap: 12px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
  }
  .mobile-wordmark { display: block; font-family: var(--display); font-size: 26px; line-height: 1; letter-spacing: -.02em; }
  .page-id { display: none; }
  .top-actions { gap: 5px; }
  .search-trigger { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-trigger-label, .search-trigger kbd { display: none; }
  .new-btn { min-height: 40px; height: 40px; padding: 0 12px; }
  .mobile-theme { display: grid; }
  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .overview { padding: 18px 16px 30px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hero-panel, .now-panel, .agenda-panel, .actions-panel, .activity-panel, .streak-panel, .modules-section { grid-column: span 1; }
  .hero-panel { padding: 23px 21px 21px; }
  .hero-greeting { font-size: 44px; }
  .hero-line { align-items: flex-start; flex-wrap: wrap; }
  .now-panel { min-height: 204px; padding: 20px; }
  .now-content { padding-top: 25px; }
  .now-title { font-size: 30px; }
  .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; }
  .agenda-row { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 9px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .module-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .module-card { min-height: 162px; }
  .activity-chart { gap: 5px; }
  .activity-bars i { width: 6px; }
  .activity-tip { display: none; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 0 6px env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(18px) saturate(150%);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 44px; min-height: 44px; color: var(--muted); font-size: 9px; font-weight: 570;
  }
  .bottom-nav a.is-active { color: var(--accent); }
  .bottom-nav .icon, .bottom-nav .icon svg { width: 19px; height: 19px; }
  .module-view { height: calc(100dvh - 56px - 64px - env(safe-area-inset-bottom, 0px)); min-height: 300px; }
  .palette { padding: 0; place-items: stretch; }
  .palette-card { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; }
  .palette-search { padding: 13px 14px; }
  .palette-results { padding-bottom: 72px; }
  .palette-foot { display: none; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .btn, .icon-btn, .theme-switch, .kpi, .quick-action, .capture-btn, .nav-item, .search-trigger, .bottom-nav a, .module-card, .agenda-tick, .text-link, .palette-action, .palette-item {
    min-height: 44px;
  }
  .now-link, .agenda-title, .palette-main, .select { min-height: 44px; }
  .agenda-tick, .icon-btn, .icon-btn.small { min-width: 44px; }
  .icon-btn.small { width: 44px; height: 44px; }
}

@media (max-width: 420px) {
  .hero-greeting { font-size: 40px; }
  .now-title { font-size: 28px; }
  .quick-grid { grid-template-columns: 1fr; }
  .kpis { gap: 6px; }
  .kpi { padding: 0 10px; font-size: 11px; }
  .streak-count { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
