/* Aquamarine design system. Colours are tokens; theme, accent, font and density
   are set as data attributes on <html> from the account's preferences. */

:root {
  --bg: #ffffff;
  --surface: #f4f4f2;
  --surface-2: #e9e9e6;
  --line: #d9d9d5;
  /* Input and checkbox edges: at least 3:1 on every surface. */
  --line-strong: #80807a;
  --ink: #1c1c1a;
  --ink-2: #5c5c57;
  --ink-3: #6f6f69;
  --danger: #b4232c;
  --danger-ink: #ffffff;
  --danger-bg: #fbe9ea;
  --ok: #1f7a4d;
  --ok-bg: #e4f3ea;
  --warn: #8a5a00;
  --warn-bg: #fbf1dc;
  --accent: #2f5fd0;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecfb;
  --focus: #2f5fd0;
  --radius: 6px;
  --radius-lg: 10px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font: var(--font-sans);
  --space: 8px;
  --row: 40px;
  --sidebar: 220px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #1b1a18;
  --surface: #242320;
  --surface-2: #2e2d29;
  --line: #3a3934;
  --line-strong: #7a786f;
  --ink: #ecebe6;
  --ink-2: #b3b1a8;
  --ink-3: #94928a;
  --danger: #f08a90;
  --danger-bg: #3a2325;
  --ok: #7ccf9c;
  --ok-bg: #1f3328;
  --warn: #e8b85a;
  --warn-bg: #3a2f1a;
  --accent-soft: #273352;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #1b1a18;
    --surface: #242320;
    --surface-2: #2e2d29;
    --line: #3a3934;
    --line-strong: #7a786f;
    --ink: #ecebe6;
    --ink-2: #b3b1a8;
    --ink-3: #94928a;
    --danger: #f08a90;
    --danger-bg: #3a2325;
    --ok: #7ccf9c;
    --ok-bg: #1f3328;
    --warn: #e8b85a;
    --warn-bg: #3a2f1a;
    --accent-soft: #273352;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

[data-accent="blue"] { --accent: #2f5fd0; --accent-soft: #e6ecfb; }
[data-accent="teal"] { --accent: #0f7f82; --accent-soft: #dff2f2; }
[data-accent="green"] { --accent: #2b7a45; --accent-soft: #e2f1e6; }
[data-accent="amber"] { --accent: #a35f07; --accent-soft: #f9ecd7; }
[data-accent="rose"] { --accent: #bf3a5a; --accent-soft: #fae4ea; }
[data-accent="violet"] { --accent: #6243c9; --accent-soft: #ebe5fa; }
[data-accent="gray"] { --accent: #4e4e49; --accent-soft: #e7e7e4; }

/* Link text. The stock accents are dark enough for white button text, so on
   dark backgrounds links use a lighter mix to keep 4.5:1. Theme tokens that
   set their own accent also set --link to it (theme.ts). */
:root { --link: var(--accent); }
[data-theme="dark"] { --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--bg)); --link: color-mix(in srgb, var(--accent) 50%, #fff); --focus: var(--link); }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] { --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--bg)); --link: color-mix(in srgb, var(--accent) 50%, #fff); --focus: var(--link); }
}

/* The app icon (logo_tag, ui/logo.tsx, logo.ts). It follows the theme's accent. */
.logo { display: inline-block; flex: none; vertical-align: -0.2em; }
.logo-tile { fill: var(--accent); }
.logo-wave { fill: none; stroke: var(--accent-ink); stroke-width: 40; stroke-linecap: round; }
.logo-wave.back { stroke-opacity: 0.55; }

[data-font="serif"] { --font: var(--font-serif); }
[data-font="mono"] { --font: var(--font-mono); }
[data-density="compact"] { --space: 6px; --row: 32px; }

/* Colour swatches for tags and projects */
.c-gray { --c: #6b6b66; }
.c-blue { --c: #2f5fd0; }
.c-teal { --c: #0f7f82; }
.c-green { --c: #2b7a45; }
.c-amber { --c: #a35f07; }
.c-rose { --c: #bf3a5a; }
.c-violet { --c: #6243c9; }
/* Lighter swatches on dark surfaces so chip text keeps 4.5:1 contrast. */
.c-gray { --c-dark: #a8a8a2; }
.c-blue { --c-dark: #8fb0ff; }
.c-teal { --c-dark: #6fd0d3; }
.c-green { --c-dark: #7ccf9c; }
.c-amber { --c-dark: #f0b85a; }
.c-rose { --c-dark: #f29ab0; }
.c-violet { --c-dark: #b4a3f5; }
[data-theme="dark"] :is(.c-gray, .c-blue, .c-teal, .c-green, .c-amber, .c-rose, .c-violet) { --c: var(--c-dark); }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] :is(.c-gray, .c-blue, .c-teal, .c-green, .c-amber, .c-rose, .c-violet) { --c: var(--c-dark); }
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 1;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
::placeholder { color: var(--ink-3); }
small, .muted { color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 13px; }
.page-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
}
code, pre { font-family: var(--font-mono); font-size: 13px; }
pre { background: var(--surface); padding: 12px; border-radius: var(--radius); overflow: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: calc(var(--space) * 2) 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--ink-2); font-size: 13px; }
details > summary { cursor: pointer; color: var(--ink-2); }
details > summary::-webkit-details-marker { display: none; }
details > summary { list-style: none; }
details > summary::before { content: "▸ "; }
details[open] > summary::before { content: "▾ "; }

/* App shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: calc(var(--space) * 2);
  display: flex;
  flex-direction: column;
  gap: calc(var(--space) * 2);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.sidebar .brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar .brand a { color: var(--ink); font-weight: 600; }
.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 32px;
}
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.sidebar nav .count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sidebar .foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.sidebar .foot a, .sidebar .foot button { color: var(--ink-2); font-size: 13px; padding: 4px 8px; display: flex; justify-content: space-between; gap: 8px; }
.main { min-width: 0; padding: calc(var(--space) * 3) calc(var(--space) * 4); max-width: 1180px; }
.main.narrow { max-width: 760px; }
.main.wide { max-width: none; }
.topbar { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: calc(var(--space) * 3); }
.topbar h1 { flex: 1 1 auto; }
.topbar .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.menu-toggle { display: none; background: var(--bg); border: 1px solid var(--line); padding: 4px; min-width: 32px; min-height: 32px; border-radius: var(--radius); cursor: pointer; align-items: center; justify-content: center; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 20; transform: translateX(-100%); transition: transform 150ms ease; }
  .sidebar[data-open="true"] { transform: none; box-shadow: var(--shadow); }
  .menu-toggle { display: inline-flex; position: fixed; top: 10px; right: 10px; z-index: 30; }
  .sidebar[data-open="true"] + .main::before { content: ""; position: fixed; inset: 0; background: rgb(0 0 0 / 0.3); z-index: 10; }
  pre { max-width: 100%; }
  .main { padding: 16px; }
  .topbar h1 { font-size: 20px; }
}

/* Public layout (sign in, profile, workspaces) */
.public { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.public .card { width: 100%; max-width: 400px; }
.public .wordmark { font-weight: 600; font-size: 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.public h1 + p { margin-top: 8px; }
.published-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.published-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.published-list a { min-width: 0; overflow-wrap: anywhere; }
.published-list time { flex-shrink: 0; color: var(--ink-3); font-size: 13px; }

/* Blocks */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: calc(var(--space) * 2.5); }
.card.soft { background: var(--surface); border-color: transparent; }
.stack { display: flex; flex-direction: column; gap: calc(var(--space) * 2); }
.stack.tight { gap: var(--space); }
.row { display: flex; align-items: center; gap: var(--space); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: calc(var(--space) * 2); }
.section { margin-bottom: calc(var(--space) * 4); }
.section > h2 { margin-bottom: var(--space); display: flex; align-items: baseline; gap: 10px; }
.section > h2 .count { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.flash.alert { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.flash.notice { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.empty { color: var(--ink-2); padding: calc(var(--space) * 2) 0; }
.empty strong { color: var(--ink); font-weight: 500; display: block; }

/* Buttons */
.btn, button.btn, .btn-primary, .btn-danger, .btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn:active, .btn-primary:active, .btn-danger:active, .btn-quiet:active, .icon-btn:active { transform: scale(0.97); }
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-danger { color: var(--danger); border-color: var(--line); }
.btn-danger:hover { background: var(--danger-bg); text-decoration: none; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn.small, .btn-primary.small, .btn-danger.small, .btn-quiet.small { min-height: 28px; padding: 0 8px; font-size: 13px; }
.btn.big, .btn-primary.big, .btn-danger.big, .btn-quiet.big { min-height: 52px; padding: 0 22px; font-size: 17px; }
.btn[disabled], .btn-primary[disabled] { opacity: 0.5; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; }
button.link:hover { text-decoration: underline; }
.icon-btn { background: none; border: 0; padding: 4px; color: var(--ink-2); cursor: pointer; border-radius: var(--radius); display: inline-flex; min-width: 28px; min-height: 28px; align-items: center; justify-content: center; transition: background-color 120ms var(--ease-out), transform 120ms var(--ease-out); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: calc(var(--space) * 2); }
.field label, label.label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .error { color: var(--danger); font-size: 13px; }
.field .hint { font-size: 13px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="time"], input[type="date"], input[type="datetime-local"], input[type="url"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:user-invalid { border-color: var(--danger); }
select { appearance: auto; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1 1 200px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 14px; }
.check input { width: 16px; height: 16px; margin: 0; }
.choices { display: flex; gap: 6px; flex-wrap: wrap; }
.choices label { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 34px; }
.choices input { position: absolute; opacity: 0; }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choices label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatches label { width: 34px; padding: 0; justify-content: center; }
.swatches .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--c); }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: calc(var(--space) * 2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 16px; }

/* Lists and task rows */
.list { display: flex; flex-direction: column; }
.task {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: var(--row);
  padding: 4px 6px;
  border-radius: var(--radius);
  border-bottom: 1px solid var(--line);
}
.task:hover { background: var(--surface); }
.task .title { color: var(--ink); min-width: 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.task .title a { color: inherit; }
.task.done .title a { color: var(--ink-3); text-decoration: line-through; }
.task .meta { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.task .meta form { display: inline; }
.task.paused .title a { color: var(--ink-2); }
.task.dragging { opacity: 0.4; }
.check-btn {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--bg);
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: transparent; flex: none;
  transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.check-btn:hover { border-color: var(--accent); color: var(--accent); }
.check-btn:active { transform: scale(0.9); }
.check-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); line-height: 1.6; white-space: nowrap; }
.chip.proj { background: color-mix(in srgb, var(--c) 14%, var(--bg)); color: var(--c); }
.chip.tag::before { content: "#"; opacity: 0.6; }
.chip.danger { background: var(--danger-bg); color: var(--danger); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.prio { font-size: 12px; color: var(--warn); letter-spacing: -1px; }
.prio.p3 { color: var(--danger); }
.subcount { font-size: 12px; color: var(--ink-3); }

/* Today */
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: calc(var(--space) * 4); }
@media (max-width: 960px) { .today-grid { grid-template-columns: 1fr; } }
.timeline { display: flex; flex-direction: column; gap: 2px; }
.timeline .item { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--radius); }
.timeline .item.event { background: var(--surface); }
.timeline .item.task .when { color: var(--accent); }
.timeline .item.done { opacity: 0.55; }
.timeline .item.now { background: var(--accent-soft); }
.timeline .when { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
.next-up { background: var(--accent-soft); border-radius: var(--radius-lg); padding: 16px; }
.next-up h2 { color: var(--accent); font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.next-up .big { font-size: 20px; font-weight: 600; }
.routine-pill { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.routine-pill > span > a { color: var(--c, var(--accent)); font-weight: 500; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.column { background: var(--surface); border-radius: var(--radius-lg); padding: 10px; min-height: 160px; }
.column h2 { font-size: 13px; color: var(--ink-2); font-weight: 500; margin-bottom: 8px; display: flex; justify-content: space-between; }
.column .cards { display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.column.over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.kcard { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; cursor: grab; display: flex; flex-direction: column; gap: 4px; }
.kcard a { color: var(--ink); }
.kcard .meta { font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.kcard.done a { color: var(--ink-3); text-decoration: line-through; }
.project-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.project-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.project-row a { color: var(--ink); font-weight: 500; }
.project-row .count { margin-left: auto; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Task views (shared with the desktop app) */
.vswitch { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 16px; padding: 3px; background: var(--surface); border-radius: 999px; width: max-content; max-width: 100%; }
.vswitch a, .vswitch button { padding: 5px 12px; border-radius: 999px; color: var(--ink-2); font-size: 13px; border: 0; background: none; cursor: pointer; }
.vswitch a:hover, .vswitch button:hover { color: var(--ink); text-decoration: none; }
.vswitch a[aria-current="page"], .vswitch button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); font-weight: 500; }
.view { min-width: 0; }
.vfilter { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -8px 0 12px; }
.vfilter input, .vfilter select { min-height: 30px; padding: 0 8px; font-size: 13px; width: auto; }
.vfilter input[type="search"] { flex: 1 1 100px; max-width: 200px; }
.vfilter input[type="date"] { width: 118px; padding: 0 4px; }
.vfilter.active { padding: 4px 6px; border-radius: var(--radius); background: var(--accent-soft); }
.vcard { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); cursor: pointer; }
.vcard:hover { border-color: var(--line-strong); }
.vcard[draggable="true"] { cursor: grab; }
.vcard.dragging { opacity: 0.4; }
.vcard .check-btn { margin-top: 2px; }
.vcard .vbody { min-width: 0; flex: 1; }
.vcard .vtitle { font-size: 14px; line-height: 1.35; display: flex; gap: 6px; align-items: baseline; }
.vcard.done .vtitle { color: var(--ink-3); text-decoration: line-through; }
.vcard .vmeta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 3px; align-items: center; }
.vcard .late { color: var(--danger); }
.vcard.compact { padding: 2px 6px; gap: 6px; border-radius: var(--radius); font-size: 12px; }
.vcard.compact .check-btn { width: 14px; height: 14px; font-size: 9px; margin-top: 3px; }
.vcard.compact .vtitle { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.vlist .vgroup { margin-bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
.vlist .vgroup > h2, .vcol > h2 { font-size: 13px; color: var(--ink-2); font-weight: 500; display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.vcol > h2 .today { color: var(--accent); }
.vcol > h2 small { color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.view .count { color: var(--ink-3); font-weight: 400; font-size: 12px; font-variant-numeric: tabular-nums; }
.vboard { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(170px, 1fr)); gap: 10px; align-items: stretch; min-height: calc(100cqh - 230px); overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.vboard.days { grid-template-columns: repeat(var(--cols, 7), minmax(118px, 1fr)); }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; align-items: start; }
.vcol { background: var(--surface); border-radius: var(--radius-lg); padding: 8px 8px 10px; min-height: 120px; display: flex; flex-direction: column; min-width: 0; }
.vcol > h2 { padding: 2px 4px 8px; }
.vcol .vcards { display: flex; flex-direction: column; gap: 6px; min-height: 40px; flex: 1; }
.vcol.over, .vcal-day.over { outline: 2px dashed var(--accent); outline-offset: -3px; }
.vnone { min-height: 36px; border: 1px dashed var(--line); border-radius: var(--radius); }
.vadd { margin-left: auto; border: 0; background: none; color: var(--ink-3); font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer; border-radius: var(--radius); }
.vadd:hover, .vadd:focus-visible { color: var(--accent); background: var(--surface-2); }
.vcol > h2, .vlist .vgroup > h2 { justify-content: flex-start; }
.addable { cursor: copy; }
.addable .vcard { cursor: pointer; }
.vcal-day .vcard { cursor: pointer; }
.vmatrix { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vmatrix .vcol:first-child { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.vmatrix .vcol:nth-child(2) { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.vnav { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.vnav .range { margin-left: 8px; font-weight: 500; }
.vcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--line); gap: 1px; }
.vcal-head { background: var(--surface); padding: 6px; font-size: 12px; color: var(--ink-2); text-align: center; }
.vcal-day { background: var(--bg); min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.vcal-day .n { font-size: 12px; color: var(--ink-2); padding: 0 2px; font-variant-numeric: tabular-nums; }
.vcal-day.outside { background: var(--surface); }
.vcal-day.outside .n { color: var(--ink-3); }
.vcal-day.today .n { color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  .vmatrix { grid-template-columns: 1fr; }
  .vcal-day { min-height: 64px; }
  .vboard { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78vw; min-height: 0; padding-bottom: 6px; }
  .vboard.days { grid-template-columns: none; grid-auto-columns: 44vw; }
}

/* Calendar */
.week { display: grid; grid-template-columns: 48px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.week .head { padding: 6px 4px; font-size: 13px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); }
.week .head.today { color: var(--accent); font-weight: 600; }
.week .head small { display: block; color: var(--ink-3); font-weight: 400; }
.week .gutter { font-size: 11px; color: var(--ink-3); text-align: right; padding: 0 4px; font-variant-numeric: tabular-nums; }
.week .col { position: relative; border-left: 1px solid var(--line); }
.week .col.today { background: color-mix(in srgb, var(--accent) 4%, var(--bg)); }
.week .hour { height: 48px; border-top: 1px solid var(--line); }
.week .block {
  position: absolute; left: 3px; right: 3px; border-radius: 4px; padding: 2px 6px; font-size: 12px; overflow: hidden;
  background: var(--accent-soft); color: var(--accent); cursor: grab; line-height: 1.3;
}
.week .block.event { background: var(--surface-2); color: var(--ink); }
.week .block.done { opacity: 0.5; }
.week .block.dragging { opacity: 0.4; }
.week .block .t { display: block; color: inherit; opacity: 0.75; font-variant-numeric: tabular-nums; }
.week .block .n { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week .col.over { background: var(--accent-soft); }
.week .allday { min-height: 22px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2px 3px; display: flex; flex-direction: column; gap: 2px; }
.week .allday .block { position: static; height: auto; }
.unscheduled { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.unscheduled .kcard { cursor: grab; padding: 4px 10px; }
@media (max-width: 760px) { .week { grid-template-columns: 36px repeat(7, minmax(80px, 1fr)); overflow-x: auto; } .week-wrap { overflow-x: auto; } }

/* Focus and routine screens */
.focus { min-height: calc(100vh - 48px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 24px; padding: 24px; }
.focus .task-name { font-size: clamp(22px, 3vw, 32px); font-weight: 600; max-width: 28ch; }
.focus .clock { font-size: clamp(64px, 14vw, 120px); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.focus .clock.over { color: var(--warn); }
.focus .bar { width: min(520px, 90vw); height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.focus .bar > div { height: 100%; background: var(--accent); transform-origin: left; transition: transform 1s linear; }
.focus .bar.over > div { background: var(--warn); }
.focus .controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.focus .side { width: min(520px, 90vw); text-align: left; }
.focus .step-icon { font-size: 48px; line-height: 1; }
.focus .done-by { font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.focus .done-by.behind { color: var(--warn); }
.focus .done-by.ahead { color: var(--ok); }
.steps { display: flex; flex-direction: column; gap: 2px; }
.steps .step { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; padding: 4px 6px; border-radius: var(--radius); font-size: 14px; align-items: center; }
.steps .step.current { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.steps .step.done { color: var(--ink-3); }
.steps .step .secs { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
.dots { display: flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.dots i.done { background: var(--accent); }
.dots i.current { background: var(--accent); outline: 2px solid var(--accent-soft); }

/* Pages / editor */
.doc { max-width: 72ch; }
.doc .title-input { font-size: 28px; font-weight: 600; border: 0; padding: 0; background: transparent; min-height: 44px; }
.doc .title-input:focus { outline: none; }
.doc .icon-input { width: 56px; font-size: 28px; text-align: center; border: 0; background: transparent; padding: 0; }
.doc textarea.body { border: 0; padding: 0; background: transparent; min-height: 60vh; font-family: var(--font-mono); font-size: 14px; line-height: 1.6; resize: none; }
.doc textarea.body:focus { outline: none; }
.doc .save-state { font-size: 12px; color: var(--ink-3); min-height: 18px; }
.prose { max-width: 72ch; line-height: 1.65; }
.prose h1 { font-size: 28px; margin: 24px 0 8px; }
.prose h2 { font-size: 20px; margin: 20px 0 6px; }
.prose h3 { font-size: 16px; margin: 16px 0 4px; }
.prose p { margin: 0 0 12px; }
.prose ul { list-style: disc; padding-left: 22px; margin: 0 0 12px; }
.prose ol { list-style: decimal; padding-left: 22px; margin: 0 0 12px; }
.prose li.todo { list-style: none; margin-left: -22px; }
.prose blockquote { border-left: 3px solid var(--line-strong); margin: 0 0 12px; padding-left: 12px; color: var(--ink-2); }
.prose a.wikilink { background: var(--accent-soft); padding: 0 3px; border-radius: 3px; }
.prose a.wikilink.missing { background: var(--surface-2); color: var(--ink-2); }
.prose code { background: var(--surface); padding: 1px 4px; border-radius: 3px; }
.prose pre { background: var(--surface); padding: 12px; border-radius: var(--radius); overflow-x: auto; margin: 0 0 12px; }
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: var(--radius); }
.prose h4, .prose h5, .prose h6 { font-size: 15px; margin: 14px 0 4px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.prose del { color: var(--ink-3); }
.prose mark { background: var(--warn-bg); color: inherit; padding: 0 2px; border-radius: 2px; }
.prose table { border-collapse: collapse; margin: 0 0 12px; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface); font-weight: 600; }
.prose .callout { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; }
.prose .callout p { margin: 0 0 6px; }
.prose .callout p:last-child { margin-bottom: 0; }
.prose .callout-title { font-weight: 600; }
.prose .callout[data-callout="warning"], .prose .callout[data-callout="caution"], .prose .callout[data-callout="attention"] { border-color: var(--warn); background: var(--warn-bg); }
.prose .callout[data-callout="danger"], .prose .callout[data-callout="error"], .prose .callout[data-callout="bug"], .prose .callout[data-callout="failure"], .prose .callout[data-callout="fail"], .prose .callout[data-callout="missing"] { border-color: var(--danger); background: var(--danger-bg); }
.prose .callout[data-callout="success"], .prose .callout[data-callout="check"], .prose .callout[data-callout="done"] { border-color: var(--ok); background: var(--ok-bg); }
.prose .callout[data-callout="quote"], .prose .callout[data-callout="cite"] { border-color: var(--line-strong); background: var(--surface); }
.prose .footnotes { font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); margin-top: 20px; padding-top: 8px; }
.properties { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; margin: 0 0 16px; padding: 10px 12px; background: var(--surface); border-radius: var(--radius); }
.properties dt { color: var(--ink-3); }
.properties dd { margin: 0; }
.outline { display: flex; flex-direction: column; gap: 2px; font-size: 13px; margin: 0 0 16px; padding: 10px 12px; border-left: 2px solid var(--line); }
.outline a { color: var(--ink-2); }
.outline a.l2 { padding-left: 12px; }
.outline a.l3 { padding-left: 24px; }
.breadcrumbs { font-size: 13px; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--ink-2); }

/* Report */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.stat .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--ink-2); }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 140px; }
.bars .bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 12px; color: var(--ink-2); }
.bars .bar > i { width: 100%; max-width: 40px; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .bar.peak > i { background: var(--ok); }

/* Settings */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: calc(var(--space) * 4); }
.settings nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 24px; align-self: start; }
.settings nav a { padding: 6px 8px; border-radius: var(--radius); color: var(--ink); }
.settings nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.settings nav a:hover { background: var(--surface); text-decoration: none; }
.settings nav .group { font-size: 12px; color: var(--ink-3); margin: 10px 8px 2px; }
.settings .pane { max-width: 640px; min-width: 0; }
@media (max-width: 760px) { .settings { grid-template-columns: 1fr; } .settings nav { position: static; flex-direction: row; flex-wrap: wrap; } .settings nav .group { display: none; } }
.provider { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.provider h3 { display: flex; gap: 8px; align-items: center; }
.token { font-family: var(--font-mono); font-size: 13px; background: var(--surface); padding: 8px 10px; border-radius: var(--radius); word-break: break-all; user-select: all; }
.theme-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-preview label { flex-direction: column; align-items: stretch; height: 72px; justify-content: flex-end; }
.theme-preview .sample { border-radius: 4px; height: 36px; border: 1px solid var(--line); }
.theme-preview .sample.light { background: #fff; }
.theme-preview .sample.dark { background: #1b1a18; }
.theme-preview .sample.system { background: linear-gradient(90deg, #fff 50%, #1b1a18 50%); }

/* Dialogs and palette */
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); color: var(--ink); padding: 20px; width: min(520px, 92vw); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.palette { width: min(600px, 92vw); padding: 0; margin-top: 10vh; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 48px; font-size: 16px; padding: 0 16px; }
.palette input:focus { outline: none; }
.palette ul { max-height: 50vh; overflow: auto; padding: 6px; }
.palette li a, .palette li button { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: var(--radius); color: var(--ink); width: 100%; text-align: left; border: 0; background: none; cursor: pointer; }
.palette li a:hover, .palette li a[aria-selected="true"], .palette li button:hover { background: var(--surface); text-decoration: none; }
.palette li .kind { color: var(--ink-3); font-size: 12px; }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }
.shortcuts dt { text-align: right; }
.shortcuts dd { margin: 0; }

/* Notifications */
.notif { display: flex; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); align-items: baseline; }
.notif.unread { background: var(--accent-soft); }
.notif .when { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; padding: 0 5px; }

/* Onboarding */
.onboard { max-width: 520px; margin: 0 auto; }
.onboard .progress { display: flex; gap: 6px; margin-bottom: 24px; }
.onboard .progress i { height: 3px; flex: 1; background: var(--line); border-radius: 2px; }
.onboard .progress i.on { background: var(--accent); }

/* Near-zero rather than none, so animationend still fires for components
   that wait for their exit animation before unmounting. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}
@media print { .sidebar, .topbar .actions { display: none; } .shell { display: block; } }
