/* =========================================================
   The Forge — design system (Cohere-inspired)
   White editorial canvas · deep green band · flat surfaces
   Display: Space Grotesk · Body: Inter · Labels: mono
   ========================================================= */
:root {
  --font-display: "CohereText", "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
  --font-text: "Unica77 Cohere Web", Inter, Arial, ui-sans-serif, system-ui, sans-serif;
  --font-mono: "CohereMono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Brand */
  --primary: #17171c;          /* near-black CTAs */
  --on-primary: #ffffff;
  --green: #003c33;            /* deep enterprise green band */
  --blue: #1863dc;             /* links */
  --coral: #ff7759;            /* taxonomy chips, warm markers */
  --coral-soft: #ffad9b;

  /* Surfaces */
  --bg: #ffffff;
  --surface: #ffffff;
  --stone: #eeece7;
  --fill: #f5f5f3;

  /* Text & rules */
  --text: #212121;
  --muted: #93939f;
  --slate: #75758a;
  --hairline: #d9d9dd;
  --border: #e5e7eb;

  /* Semantic */
  --focus: #4c6ee6;
  --focus-input: #9b60aa;
  --danger: #b30000;
  --warn: #b35c00;
  --ok: #0f7b5f;

  /* Aliases used by the app */
  --accent: var(--primary);
  --accent-2: var(--blue);
  --accent-soft: var(--stone);
  --input-bg: #ffffff;
  --band: var(--green);
  --on-band: #ffffff;
  --on-band-muted: rgba(255, 255, 255, 0.64);
  --band-rule: rgba(255, 255, 255, 0.2);

  /* Shape */
  --r-xs: 4px; --r-sm: 8px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px; --r-pill: 32px;
  --radius: var(--r-md);

  /* Spacing (8px base) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;

  --sidebar-w: 248px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --primary: #ffffff;
  --on-primary: #17171c;
  --bg: #0e0e11;
  --surface: #17171c;
  --stone: #1f1f25;
  --fill: #1f1f25;
  --text: #f2f2f2;
  --slate: #a5a5b4;
  --hairline: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.1);
  --blue: #6e9cff;
  --danger: #ff6b6b;
  --warn: #ffb259;
  --ok: #4fd1a5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
a { color: var(--blue); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code { font: 13px var(--font-mono); background: var(--fill); padding: 1px 6px; border-radius: var(--r-xs); }
kbd { font: 11px var(--font-mono); padding: 2px 6px; border: 1px solid var(--hairline); border-radius: var(--r-xs); color: var(--muted); margin-left: auto; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; }

/* Mono labels — uppercase technical markers */
.section-title, .tile-head .label, .col-head .count, .result .kind, .field label, .cal .dow, .countdown, .thumb-tag {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.02em;
}

/* Thin-line monochrome icon holder */
.app-icon {
  width: 28px; height: 28px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--text); border: 1px solid var(--hairline);
}
.app-icon svg.i { width: 16px; height: 16px; }
.app-icon.lg { width: 40px; height: 40px; }
.app-icon.lg svg.i { width: 20px; height: 20px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column; gap: 4px;
  padding: 24px 16px;
  background: var(--bg); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.brand img { border-radius: var(--r-sm); }
.brand strong { display: block; font: 500 18px/1.1 var(--font-display); letter-spacing: -0.01em; }
.brand small { color: var(--muted); font: 11px var(--font-mono); text-transform: uppercase; }
#side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; border-radius: var(--r-sm);
  border: 0; background: none; color: var(--text); text-align: left; width: 100%; font-size: 15px;
}
.nav-link .app-icon { border-color: transparent; }
.nav-link:hover { background: var(--fill); }
.nav-link.active { background: var(--stone); font-weight: 500; }
.nav-link .count { margin-left: auto; font: 12px var(--font-mono); color: var(--muted); }
.side-search { margin-top: auto; justify-content: flex-start !important; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 40px 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.topbar-row { display: flex; align-items: center; gap: 12px; }
.topbar h1 { display: inline-flex; align-items: center; gap: 8px; font: 400 40px/1 var(--font-display); letter-spacing: -0.02em; }
.brand-mark { display: inline-grid; color: var(--coral); }
.brand-mark svg.i { width: 28px; height: 28px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.view { padding: 32px 40px 120px; max-width: 1280px; width: 100%; outline: none; }

/* ---------- Controls ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-top: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: var(--r-xl); min-height: 36px;
  border: 1px solid var(--text); background: transparent; color: var(--text);
  font-size: 14px; white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c, var(--muted)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--r-pill); min-height: 44px;
  border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary);
  font-size: 14px; font-weight: 500; line-height: 1.2;
  transition: opacity .15s var(--ease);
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--text); font-weight: 400; }
.btn.danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn.sm { padding: 4px 16px; min-height: 32px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--text);
}
.icon-btn:hover { border-color: var(--text); }
.icon-btn.bare { border: 0; background: none; color: var(--muted); width: 36px; height: 36px; }
.icon-btn.bare:hover { color: var(--text); background: var(--fill); }
.icon-btn svg.i { width: 18px; height: 18px; }

input[type="text"], input[type="search"], input[type="date"], input[type="time"], input[type="number"], input[type="email"], input[type="password"], input[type="url"], select, textarea {
  width: 100%; padding: 12px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--hairline); background: var(--surface);
  outline: none; font-size: 16px; /* prevents iOS zoom */
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393939f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px;
}
input:focus, select:focus, textarea:focus { border-color: var(--focus-input); }
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
input[type="checkbox"] { accent-color: var(--primary); }

/* ---------- Cards & sections ---------- */
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 24px;
}
.card.click { cursor: pointer; transition: border-color .15s var(--ease); }
.card.click:hover { border-color: var(--text); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font: 400 22px/1.3 var(--font-text); letter-spacing: -0.01em; }
.card-head .link { margin-left: auto; font-size: 14px; color: var(--blue); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.section { margin-bottom: 40px; }
.section-title { font-size: 12px; color: var(--slate); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.clip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; border: 1px dashed var(--hairline); border-radius: var(--r-md); font-size: 14px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font: 400 18px var(--font-text); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 2px 10px; border-radius: var(--r-xl);
  border: 1px solid var(--hairline); color: var(--text); background: transparent; white-space: nowrap;
}
.badge.danger { color: var(--danger); border-color: currentColor; }
.badge.warn { color: #c2410c; border-color: var(--coral-soft); background: color-mix(in srgb, var(--coral) 8%, transparent); }
.badge.ok { color: var(--ok); border-color: currentColor; }

/* ---------- Hero / Today: dark feature band ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 40px; border-radius: var(--r-lg); margin-bottom: 40px;
  background: var(--band); color: var(--on-band);
}
.hero h2 { position: relative; font: 400 56px/1 var(--font-display); letter-spacing: -0.02em; padding-right: 56px; }
.hero .hero-date { position: relative; margin: 12px 0 0; font-size: 16px; color: var(--on-band-muted); }
.hero .hero-meta { position: relative; margin: 4px 0 32px; font: 12px var(--font-mono); text-transform: uppercase; letter-spacing: .02em; color: var(--on-band-muted); }
.hero-deco { position: absolute; top: -48px; right: -48px; width: 320px; height: 320px; z-index: -1; pointer-events: none; color: var(--on-band); opacity: .2; }
.hero-badge {
  position: absolute; top: 32px; right: 32px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: var(--on-band); border: 1px solid var(--band-rule);
}
.hero-badge svg.i { width: 20px; height: 20px; }
.hero .capture-box, .hero .pills { position: relative; }

.capture { display: flex; gap: 8px; }
.capture-box { gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--input-bg); border: 1px solid transparent; }
.capture-box:focus-within { border-color: var(--focus-input); }
.capture-box input, .capture-box input:focus { height: 48px; padding: 0 16px; background: transparent; border: 0; color: #212121; }
.capture-box input::placeholder { color: #93939f; }
.capture-box .btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; background: #17171c; border-color: #17171c; color: #fff; }
.capture-box .mic-btn { width: 48px; height: 48px; flex: none; border-radius: 50%; color: #75758a; }
.capture-box .mic-btn:hover { background: #f5f5f3; color: #17171c; }
.capture-box .mic-btn.listening { color: #fff; background: var(--coral); animation: mic-pulse 1.2s ease-in-out infinite; }
.capture-box .mic-btn.listening svg.i { width: 16px; height: 16px; }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 119, 89, .25); } }
.capture-box.busy input { opacity: .6; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Outline pills on the band */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px;
  padding: 6px 16px; border-radius: var(--r-xl); font-size: 14px;
  border: 1px solid var(--band-rule); background: transparent; color: var(--on-band);
}
.pill svg.i { width: 16px; height: 16px; }
.pill:hover { border-color: var(--on-band); }
.pill.active { background: var(--on-band); border-color: var(--on-band); color: var(--band); }
.pills.sub { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--band-rule); }
.pills.sub .pill { min-height: 32px; font-size: 13px; padding: 4px 12px; color: var(--on-band-muted); }
.pills.sub .pill .dot { box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); }
.pills.sub .pill[data-tone="danger"] { color: var(--coral); border-color: var(--coral); }
.confirm-note { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; background: var(--stone); }
.confirm-note.warn { background: color-mix(in srgb, var(--coral) 12%, transparent); }
input.missing { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 6%, var(--surface)); }

/* ---------- Stat tiles: stone product cards ---------- */
.tile {
  position: relative; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 16px;
  background: var(--stone); border: 0; border-radius: var(--r-md);
}
.tile.click:hover { box-shadow: inset 0 0 0 1px var(--text); }
.tile-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tile-head .label { font-size: 12px; color: var(--slate); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-icon { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--text); border: 1px solid var(--hairline); background: var(--surface); }
.tile-icon svg.i { width: 16px; height: 16px; }
.tile-chev { margin-left: auto; flex: none; color: var(--muted); display: grid; }
.tile-chev svg.i { width: 16px; height: 16px; }
.tile-head .range-select { margin-left: auto; }
.tile-head .range-select + .tile-chev { display: none; }
.range-select { width: auto; min-height: 28px; padding: 2px 28px 2px 12px; font-size: 12px; border-radius: var(--r-xl); background-color: var(--surface); background-position: right 8px center; background-size: 14px; }
.tile-body { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.tile-body > div:first-child { flex: none; min-width: 0; }
.tile .value { font: 400 40px/1 var(--font-display); letter-spacing: -0.02em; }
.tile .delta { font-size: 13px; margin-top: 8px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.tile .spark { flex: 1 1 56px; min-width: 56px; height: 40px; margin: 0; }
.spark { width: 100%; height: 40px; display: block; }
.spark-grid { stroke: var(--hairline); stroke-width: 1; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 40px; flex: none; }
.mini-bars i { display: block; width: 6px; border-radius: 2px; background: var(--bc); }
.tile-progress { flex: 1 1 40px; min-width: 40px; max-width: 60%; height: 4px; margin-bottom: 6px; border-radius: 2px; background: var(--hairline); overflow: hidden; }
.tile-progress span { display: block; height: 100%; background: var(--text); }
.tile.wide { grid-column: 1 / -1; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.tile.wide .tile-body { flex-wrap: nowrap; }
.tile.wide .value { font-size: 56px; }
.tile.wide .spark { height: 96px; flex: 1 1 auto; }

/* ---------- Lists: rule-separated rows ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.item:last-child { border-bottom: 0; }
.item-main { flex: 1; min-width: 0; cursor: pointer; }
.item-title { font-size: 16px; overflow-wrap: anywhere; }
.item-meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.item.done .item-title { text-decoration: line-through; color: var(--muted); }
.check {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 22px; height: 22px; margin: 1px 0 0; border-radius: 50%;
  border: 1px solid var(--slate); background: transparent; cursor: pointer; display: grid; place-items: center;
}
.check:checked { background: var(--primary); border-color: var(--primary); }
.check:checked::after { content: ""; width: 5px; height: 10px; border: solid var(--on-primary); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.prio { width: 2px; align-self: stretch; border-radius: 1px; flex: none; }
.prio.p1 { background: var(--coral); }
.prio.p2 { background: var(--slate); }
.prio.p3 { background: var(--hairline); }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 400 16px var(--font-display); color: #fff; background: var(--c); }
.time { font: 13px var(--font-mono); color: var(--muted); min-width: 52px; padding-top: 3px; }

/* ---------- Ideas board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.col { scroll-snap-align: start; background: var(--stone); border-radius: var(--r-md); padding: 12px; min-height: 200px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 12px; font: 400 18px var(--font-text); }
.col-head .count { margin-left: auto; color: var(--slate); font-size: 12px; }
.col .card { padding: 16px; margin-bottom: 8px; border-color: transparent; }
.col.drag-over { box-shadow: inset 0 0 0 1px var(--text); }
.idea-title { font-size: 16px; margin-bottom: 4px; overflow-wrap: anywhere; }
.score { font: 13px var(--font-mono); color: var(--blue); }

/* ---------- Schedule ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.cal-head h3 { font: 400 28px/1.1 var(--font-display); letter-spacing: -0.01em; margin-right: auto; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.day {
  aspect-ratio: 1; border-radius: 50%; border: 1px solid transparent; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 15px; font-variant-numeric: tabular-nums; padding: 0;
}
.day:hover { border-color: var(--hairline); }
.day.out { opacity: .3; }
.day.today { border-color: var(--blue); color: var(--blue); }
.day.sel { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.day .dots { display: flex; gap: 2px; height: 4px; }
.day .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--c, var(--text)); }
.day.sel .dots i { background: var(--on-primary); }
.day.dl { box-shadow: inset 0 0 0 1px var(--coral); }
.day.planned { text-decoration: underline; text-underline-offset: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.plan { min-height: 112px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.week-day { padding: 16px; min-height: 180px; }
.week-day .card-head { margin-bottom: 8px; }
.week-day .card-head h3 { font-size: 16px; }
.week-day.is-today { border-color: var(--text); }
.week-day.past { opacity: .55; }
.week-day .item { padding: 8px 0; gap: 8px; flex-wrap: wrap; }
.week-day .time { min-width: 0; width: 100%; font-size: 12px; }
.plan-snippet { background: var(--stone); padding: 8px 12px; border-radius: var(--r-sm); margin-bottom: 8px; cursor: pointer; }
.plan-link { background: none; border: 0; padding: 4px 0; color: var(--blue); text-decoration: underline; }
.countdown { min-width: 64px; justify-content: center; font-size: 12px; margin-top: 2px; }
@media (max-width: 1200px) { .week { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }

/* ---------- Resources: media cards ---------- */
.res { display: flex; flex-direction: column; padding: 12px; }
.res.is-done { opacity: .55; }
.thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; margin-bottom: 12px; border-radius: var(--r-sm); overflow: hidden; text-decoration: none; background: var(--stone); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-emoji { font-size: 36px; }
.thumb-tag { position: absolute; left: 8px; top: 8px; font-size: 11px; padding: 2px 8px; border-radius: var(--r-xl); background: #17171c; color: #fff; }
.thumb-mini { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--stone); flex: none; }

/* ---------- Goals ---------- */
.progress { height: 4px; background: var(--hairline); border-radius: 2px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--text); }
.kr { margin-top: 16px; }
.kr-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.kr-row b { font: 400 13px var(--font-mono); }
.ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 13px var(--font-mono);
  background: conic-gradient(var(--text) calc(var(--p) * 1%), var(--hairline) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; }

/* ---------- Toolbar / filter pills ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { flex: 1; min-width: 180px; }
.seg { display: inline-flex; gap: 8px; }
.seg button { border: 1px solid var(--text); background: transparent; padding: 6px 16px; border-radius: var(--r-xl); color: var(--text); font-size: 14px; white-space: nowrap; }
.seg button.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.seg button .muted { font-family: var(--font-mono); font-size: 12px; }
.seg button.active .muted { color: inherit; opacity: .7; }

/* ---------- Modal ---------- */
.modal {
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0;
  width: min(560px, calc(100vw - 32px)); max-height: 88vh;
  background: var(--surface); color: var(--text);
}
.modal::backdrop { background: rgba(0, 0, 0, .4); }
.modal[open] { animation: pop .2s var(--ease); display: flex; flex-direction: column; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 24px 24px 8px; }
.modal-head h2 { font: 400 28px/1.1 var(--font-display); letter-spacing: -0.01em; margin-right: auto; }
.modal-head h2 svg.i { width: 20px; height: 20px; color: var(--coral); vertical-align: -2px; margin-right: 4px; }
.modal-body { padding: 8px 24px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 16px 24px calc(16px + var(--safe-b)); border-top: 1px solid var(--border); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; color: var(--slate); margin-bottom: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.range-val { float: right; color: var(--text); }
.field textarea.tall { min-height: 260px; }

.ai-item { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.ai-item:last-child { border-bottom: 0; }
.ai-item .row { flex-wrap: nowrap; }
.ai-item select { width: auto; flex: 1; min-width: 0; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
.ai-item .field-row { gap: 8px; grid-template-columns: 1fr 1fr; }
.ai-item:has(.check:not(:checked)) > :not(.row) { opacity: .4; }
.ai-item:has(.ai-kind option[value="idea"]:checked) .ai-when,
.ai-item:has(.ai-kind option[value="note"]:checked) .ai-when,
.ai-item:has(.ai-kind option[value="link"]:checked) .ai-when { display: none; }

/* ---------- Search ---------- */
.search-input { font-size: 18px !important; padding: 16px !important; }
.results { margin-top: 12px; max-height: 60vh; overflow-y: auto; }
.result { display: flex; gap: 12px; align-items: center; padding: 12px 0; cursor: pointer; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--hairline); text-align: left; }
.result:hover .item-main, .result:focus .item-main { text-decoration: underline; }
.result .kind { font-size: 11px; color: var(--muted); min-width: 72px; }

.sync-badge { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-xl); border: 1px solid var(--hairline); background: var(--surface); color: var(--text); font: 11px var(--font-mono); text-transform: uppercase; }
.sync-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-badge[data-status="synced"] i { background: var(--ok); }
.sync-badge[data-status="syncing"] i { background: var(--blue); animation: pulse 1s infinite alternate; }
.sync-badge[data-status="error"] i, .sync-badge[data-status="signed-out"] i { background: var(--coral); }
@keyframes pulse { to { opacity: .3; } }
@media (max-width: 480px) { .sync-badge span { display: none; } .sync-badge { width: 40px; justify-content: center; padding: 0; } }

/* ---------- Bottom nav, FAB, toast ---------- */
.bottom-nav { display: none; }
.fab {
  position: fixed; right: 32px; bottom: 32px; z-index: 30;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center;
}
.fab svg.i { width: 24px; height: 24px; stroke-width: 2; }
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 100;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: #17171c; color: #fff; padding: 12px 20px; border-radius: var(--r-pill);
  display: flex; gap: 16px; align-items: center; font-size: 14px;
  transition: all .25s var(--ease); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--coral-soft); padding: 0; text-decoration: underline; }

.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-grid .nav-link { flex-direction: column; gap: 8px; padding: 16px 8px; border: 1px solid var(--border); text-align: center; font-size: 13px; align-items: center; border-radius: var(--r-md); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; }
  .topbar h1 { font-size: 32px; }
  .brand-mark svg.i { width: 24px; height: 24px; }
  .chips { padding-top: 12px; }
  .view { padding: 24px 16px calc(var(--nav-h) + 96px + var(--safe-b)); }
  .card { padding: 16px; }
  .card-head h3 { font-size: 18px; }
  .section { margin-bottom: 32px; }
  .grid { gap: 12px; }
  .grid.two { grid-template-columns: 1fr; }
  .grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 16px; gap: 12px; }
  .tile .value { font-size: 32px; }
  .tile.wide .value { font-size: 40px; }
  .tile.wide .spark { height: 72px; }
  .hero { padding: 24px 16px; margin-bottom: 32px; }
  .hero h2 { font-size: 40px; }
  .hero-badge { top: 24px; right: 16px; width: 40px; height: 40px; }
  .hero .hero-meta { margin-bottom: 24px; }
  .board { grid-auto-columns: 84%; margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px; }
  .field-row { grid-template-columns: 1fr; }
  .week { grid-template-columns: 1fr; }
  .week-day { min-height: 0; }
  .toolbar .seg { overflow-x: auto; max-width: 100%; }
  .cal-head h3 { font-size: 24px; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: var(--bg); border-top: 1px solid var(--border);
  }
  .bottom-nav button {
    position: relative; border: 0; background: none; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px;
  }
  .bottom-nav button svg.i { width: 22px; height: 22px; }
  .bottom-nav button.active { color: var(--text); }
  .bottom-nav button.active::before { content: ""; position: absolute; top: 0; left: 50%; width: 24px; height: 2px; margin-left: -12px; background: var(--text); }
  .fab { right: 16px; bottom: calc(var(--nav-h) + 16px + var(--safe-b)); }
  .toast { bottom: calc(var(--nav-h) + 24px + var(--safe-b)); }

  .modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
  .modal[open] { animation: sheet .3s var(--ease); }
  .modal-head { position: relative; padding: 28px 16px 8px; }
  .modal-head::before { content: ""; position: absolute; left: 50%; top: 10px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--hairline); }
  .modal-head h2 { font-size: 24px; }
  .modal-body { padding: 8px 16px; }
  .modal-foot { padding: 12px 16px calc(12px + var(--safe-b)); }
}
@keyframes sheet { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Resource collections & search ---------- */
.res-search { position: relative; margin-bottom: 16px; }
.res-search svg.i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.res-search input[type="search"] { padding-left: 48px; min-height: 52px; border-radius: var(--r-pill); font-size: 16px; }
.res-add-col { width: auto; max-width: 40%; flex: none; }
.folder-bar { margin-bottom: 12px; }
.folder-bar .section-title { margin: 0; }
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.folder {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0;
  padding: 16px; border-radius: var(--r-md); border: 1px solid transparent;
  background: var(--stone); color: var(--text); text-align: left;
}
.folder:hover { border-color: var(--text); }
.folder.active { background: var(--primary); color: var(--on-primary); }
.folder-icon { display: grid; margin-bottom: 8px; }
.folder-name { font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-meta { font: 12px var(--font-mono); text-transform: uppercase; opacity: .7; }
.folder-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.folder-head h3 { font: 400 28px/1.1 var(--font-display); letter-spacing: -0.01em; }
.res-actions { margin-top: 8px; flex-wrap: nowrap; }
.res-move { flex: 1; min-width: 0; width: auto; padding-top: 6px; padding-bottom: 6px; font-size: 13px; border-radius: var(--r-xl); }
mark { background: color-mix(in srgb, var(--coral) 30%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
@media (max-width: 900px) {
  .folders { display: flex; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .folders::-webkit-scrollbar { display: none; }
  .folder { flex: 0 0 148px; }
  .folder-head h3 { font-size: 24px; }
  .res-add-col { max-width: 36%; font-size: 14px; }
}

/* ---------- Early access & welcome ---------- */
.early-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--coral) 10%, var(--surface)); border: 1px solid var(--coral-soft); font-size: 14px;
}
.early-strip a { color: var(--text); font-weight: 500; }
.welcome-lead { margin: 0 0 24px; font-size: 16px; color: var(--slate); }

/* ---------- Accounts, plans & upgrade ---------- */
.early-strip .btn.sm { flex: none; }
.google-btn { width: 100%; background: var(--surface); color: var(--text); border-color: var(--hairline); }
.google-btn:hover { border-color: var(--text); opacity: 1; }
.gsi-slot { display: flex; justify-content: center; min-height: 44px; color-scheme: light; }
.gsi-slot[hidden] { display: none; }
.or-rule { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font: 12px var(--font-mono); text-transform: uppercase; }
.or-rule::before, .or-rule::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; font-size: inherit; }
.link-danger { background: none; border: 0; padding: 0; color: var(--danger); text-decoration: underline; font-size: 13px; }
.plan-perks { list-style: none; padding: 0; margin: 0 0 16px; }
.plan-perks li { padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 15px; }
.plan-perks li::before { content: "✓"; margin-right: 12px; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; border-radius: var(--r-md); background: var(--stone); }
.plan-card.featured { background: var(--surface); box-shadow: inset 0 0 0 1px var(--text); }
.plan-card p { margin: 0 0 8px; }
.plan-price { font: 400 36px/1 var(--font-display); letter-spacing: -0.02em; }
.plan-price small { font: 14px var(--font-text); color: var(--muted); }
.plan-price s { margin: 0 4px 0 8px; font-size: 20px; color: var(--muted); }
.founder-note { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--r-md); background: color-mix(in srgb, var(--coral) 14%, transparent); font-size: 14px; }
.founder-line { margin: -8px 0 16px; font-size: 13px; color: var(--muted); }
.founder-line b { color: var(--text); font-weight: 500; }
.plan-flag { position: absolute; top: -10px; right: 12px; font: 11px var(--font-mono); text-transform: uppercase; padding: 2px 8px; border-radius: var(--r-xl); background: var(--coral); color: #fff; }
@media (max-width: 420px) { .plan-grid { grid-template-columns: 1fr; } }
a.btn { text-decoration: none; }

/* ---------- Sign-up / sign-in screen ---------- */
body.gated .app, body.gated .bottom-nav, body.gated .fab { display: none !important; }
.auth { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; background: var(--bg); overflow-y: auto; }
.auth[hidden] { display: none; }
.auth-panel {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 24px;
  padding: 48px; background: var(--green); color: #fff;
}
.auth-panel h1 { font: 400 48px/1 var(--font-display); letter-spacing: -0.02em; max-width: 12ch; }
.auth-panel ul { list-style: none; padding: 0; margin: 0; }
.auth-panel li { padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .8); }
.auth-brand { display: flex; align-items: center; gap: 12px; position: absolute; top: 40px; left: 48px; }
.auth-brand img { border-radius: var(--r-sm); }
.auth-brand strong { display: block; font: 500 18px/1.1 var(--font-display); }
.auth-brand small { font: 11px var(--font-mono); text-transform: uppercase; color: rgba(255, 255, 255, .64); }
.auth-main { display: grid; place-items: center; padding: 48px 24px calc(48px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font: 400 36px/1.05 var(--font-display); letter-spacing: -0.02em; margin: 0 0 8px; }
.auth-sub { color: var(--slate); margin: 0 0 24px; }
.auth-card form .btn, .auth-card .google-btn { width: 100%; }
.auth-submit { margin-top: 8px; }
.auth-card .field label { display: flex; justify-content: space-between; align-items: baseline; }
.auth-forgot { font: 13px var(--font-text); text-transform: none; letter-spacing: 0; }
.auth-error { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--r-sm); font-size: 14px; color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.auth-switch { margin: 24px 0 0; text-align: center; }
.auth-legal { margin-top: 16px; text-align: center; }
.auth-loading { display: grid; place-items: center; min-height: 200px; }
.spinner.dark { border-color: var(--hairline); border-top-color: var(--text); width: 28px; height: 28px; }
@media (max-width: 900px) {
  .auth { display: block; }
  .auth-panel { padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 16px; gap: 12px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .auth-panel h1 { display: none; }
  .auth-brand { position: static; }
  .auth-panel h1 { font-size: 30px; max-width: none; }
  .auth-panel ul { display: none; }
  .auth-main { display: flex; justify-content: center; padding: 32px 16px calc(32px + var(--safe-b)); }
  .auth-card h2 { font-size: 30px; }
}

/* Trial highlight on the sign-up screen */
.trial-badge { align-self: flex-start; font: 12px var(--font-mono); text-transform: uppercase; letter-spacing: .02em; padding: 6px 12px; border-radius: var(--r-xl); background: var(--coral); color: #17171c; }
.trial-card {
  display: flex; align-items: center; gap: 16px; margin: 0 0 24px; padding: 16px;
  border-radius: var(--r-md); border: 1px solid var(--coral-soft);
  background: color-mix(in srgb, var(--coral) 10%, var(--surface));
}
.trial-days { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 64px; height: 64px; border-radius: 50%; background: var(--coral); color: #17171c; font: 400 28px/1 var(--font-display); }
.trial-days small { font: 10px var(--font-mono); text-transform: uppercase; margin-top: 2px; }
.trial-card strong { display: block; font: 500 18px/1.2 var(--font-text); }
.trial-card span:not(.trial-days) { display: block; font-size: 13px; color: var(--slate); margin-top: 4px; }
/* Sign-in screen on small and short screens */
@media (max-width: 380px) {
  .auth-panel h1 { font-size: 24px; }
  .auth-card h2 { font-size: 26px; }
  .trial-card { gap: 12px; padding: 12px; }
  .trial-days { width: 52px; height: 52px; font-size: 22px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .auth { display: block; }
  .auth-panel { padding: calc(env(safe-area-inset-top, 0px) + 12px) 24px 12px; flex-direction: row; align-items: center; gap: 16px; }
  .auth-panel h1, .auth-panel ul { display: none; }
  .auth-brand { position: static; }
  .auth-main { padding: 24px; display: flex; justify-content: center; }
}

/* ---------- Trial countdown (sidebar card + mobile pill) ---------- */
.side-trial {
  margin-top: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 16px; border-radius: var(--r-md); background: var(--stone);
}
.side-trial[hidden] { display: none; }
.side-trial:not([hidden]) + .side-search { margin-top: 8px; }
.side-trial .label { font: 11px var(--font-mono); text-transform: uppercase; color: var(--muted); }
.side-trial-days { font: 400 28px/1 var(--font-display); letter-spacing: -0.02em; }
.side-trial-days span { font: 14px var(--font-text); color: var(--muted); letter-spacing: 0; }
.side-trial-bar { height: 4px; border-radius: 2px; background: var(--hairline); overflow: hidden; }
.side-trial-bar i { display: block; height: 100%; background: var(--coral); }
.side-trial p { margin: 0; }
.side-trial-clock { font-family: var(--font-mono); white-space: nowrap; }
.side-trial .btn { width: 100%; }
.trial-pill {
  display: none; align-items: center; gap: 6px; height: 32px; padding: 0 12px; align-self: center;
  border: 0; border-radius: var(--r-xl); background: var(--coral); color: #17171c;
  font: 11px var(--font-mono); text-transform: uppercase; white-space: nowrap;
}
.trial-pill i { width: 6px; height: 6px; border-radius: 50%; background: #17171c; }
.trial-pill.ended { background: var(--text); color: var(--bg); }
.trial-pill.ended i { display: none; }
@media (max-width: 900px) { .trial-pill:not([hidden]) { display: inline-flex; } }
@media (max-width: 900px) {
  .topbar h1 { min-width: 0; white-space: nowrap; overflow: hidden; }
  .topbar-actions { flex: none; }
}
@media (max-width: 480px) {
  .topbar h1 { font-size: 26px; }
  .topbar-actions { gap: 4px; }
  .trial-pill { padding: 0 10px; }
}
@media (max-width: 400px) {
  .topbar h1 { font-size: 24px; }
  .topbar h1 .brand-mark { display: none; }
  .trial-pill i { display: none; }
}

/* ---------- Install to home screen ---------- */
.install-hero { display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--stone); }
.install-hero img { flex: none; border-radius: 15px; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.install-hero strong { display: block; font: 500 20px/1.2 var(--font-display); }
.install-hero span { font-size: 13px; color: var(--muted); }
.install-perks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; font-size: 15px; }
.install-perks li { display: flex; align-items: center; gap: 8px; }
.install-perks svg.i { width: 16px; height: 16px; color: var(--ok); flex: none; }
.install-steps { list-style: none; counter-reset: step; padding: 0; margin: 8px 0 16px; display: grid; gap: 8px; }
.install-steps li { counter-increment: step; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--hairline); border-radius: var(--r-md); font-size: 15px; line-height: 1.35; }
.install-steps li::before { content: counter(step); flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--text); color: var(--bg); font: 12px var(--font-mono); }
.install-steps small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.install-glyph { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--fill); color: var(--blue); }
.install-glyph svg.i { width: 22px; height: 22px; }
