/* Tallyday. Pine and marigold on sage paper. Bricolage Grotesque for headings and numbers, Figtree for text.
   Tokens first, then layout, then components. No inline styles anywhere (CSP): dynamic values arrive as custom properties. */

@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }

:root {
  --bg: #E9EEE6;
  --surface: #FBFCF8;
  --surface-2: #F1F5EC;
  --ink: #16241D;
  --muted: #50615A;
  --line: #CCD6C9;
  --primary: #1D5A43;
  --on-primary: #F6FAF5;
  --accent: #F0B429;
  --accent-ink: #6E4B00;
  --danger: #B3361F;
  --edge: rgba(22, 36, 29, 0.22);
  --edge-primary: #0F3426;
  --ring: #1D5A43;
  --h-off: #CCD6C9;
  --h0: #DCE4D8; --h1: #B5D3C2; --h2: #6FA98A; --h3: #1D5A43;
  --shadow: 0 1px 0 rgba(22, 36, 29, 0.06), 0 8px 24px -12px rgba(22, 36, 29, 0.22);
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 66px;
  color-scheme: light;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  --bg: #0F1814; --surface: #172420; --surface-2: #1D2D27; --ink: #E9F0EA; --muted: #9FB2A7; --line: #2B3E35;
  --primary: #5FC79B; --on-primary: #06130D; --accent: #F5C451; --accent-ink: #F5C451; --danger: #FF8E78;
  --edge: rgba(0, 0, 0, 0.55); --edge-primary: #2C7F5B; --ring: #F5C451;
  --h-off: #2B3E35; --h0: #22332B; --h1: #2E5A47; --h2: #3F8F6C; --h3: #5FC79B;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 10px 26px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0F1814; --surface: #172420; --surface-2: #1D2D27; --ink: #E9F0EA; --muted: #9FB2A7; --line: #2B3E35;
    --primary: #5FC79B; --on-primary: #06130D; --accent: #F5C451; --accent-ink: #F5C451; --danger: #FF8E78;
    --edge: rgba(0, 0, 0, 0.55); --edge-primary: #2C7F5B; --ring: #F5C451;
    --h-off: #2B3E35; --h0: #22332B; --h1: #2E5A47; --h2: #3F8F6C; --h3: #5FC79B;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 10px 26px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  touch-action: manipulation; /* no 300 ms tap delay, no double-tap zoom */
  /* overscroll-behavior is left at its default so pull-to-refresh keeps working */
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .stat-big, .stat-n, .count-line, .brand span { font-family: var(--display); letter-spacing: -0.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sr-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.skip:focus { top: calc(var(--safe-t) + 8px); }

/* ---- shell ---- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 10px) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; min-height: 44px; }
.brand span { font-size: 1.25rem; font-weight: 700; }
.bm-bg { fill: #1D5A43; }
.bm-ink { fill: none; stroke: var(--on-primary); stroke-width: 3; stroke-linecap: round; }
.bm-ink { stroke: #F2F6EF; }
.brand-mark path:last-child { stroke: #F0B429; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 0.875rem; font-weight: 600; background: var(--surface); border: 1.5px solid var(--line); }
.pill.offline { background: var(--accent); color: #2B1E00; border-color: transparent; }
.pill .ico { width: 16px; height: 16px; }
.main { padding: 4px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); outline: none; }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + var(--safe-b)) max(8px, env(safe-area-inset-left));
  background: var(--surface); border-top: 1.5px solid var(--line);
}
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; text-decoration: none; font-size: 0.75rem; font-weight: 600; color: var(--muted); border-radius: 14px; }
.nav .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--primary); }
.nav a[aria-current="page"] .ico { background: var(--primary); stroke: var(--on-primary); width: 52px; height: 30px; padding: 3px 14px; border-radius: 99px; box-sizing: border-box; }
:root[data-theme="dark"] .nav a[aria-current="page"], :root[data-theme="auto"] .nav a[aria-current="page"] { color: var(--ink); }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .nav a[aria-current="page"] { color: var(--primary); } }

@media (min-width: 900px) {
  h1 { font-size: 3.6rem; }
  .shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); grid-template-rows: auto 1fr; padding-bottom: 48px; max-width: 1480px; margin: 0 auto; }
  .topbar { grid-column: 1; grid-row: 1; position: static; flex-wrap: wrap; padding: 28px 20px 12px 28px; }
  .nav { grid-column: 1; grid-row: 2; position: sticky; top: 0; align-self: start; inset: auto; display: flex; flex-direction: column; gap: 4px; padding: 8px 14px 20px 20px; background: transparent; border: 0; margin-top: 4px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; min-height: 48px; font-size: 1rem; }
  .nav a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); border: 1.5px solid var(--line); }
  .nav a[aria-current="page"] .ico { background: none; stroke: var(--primary); width: 24px; height: 24px; padding: 0; border-radius: 0; }
  :root[data-theme="dark"] .nav a[aria-current="page"] .ico, :root[data-theme="auto"] .nav a[aria-current="page"] .ico { stroke: var(--primary); }
  .main { grid-column: 2; grid-row: 1 / span 2; padding: 32px 40px 0 16px; max-width: 1100px; width: 100%; }
  .pill { order: 3; width: 100%; justify-content: center; }
}

/* ---- view header ---- */
.view { display: grid; gap: 20px; padding-top: 6px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h1 { font-size: clamp(2rem, 8.5vw, 3.1rem); line-height: 1; font-weight: 700; letter-spacing: -0.035em; outline: none; }
.date-line { color: var(--muted); margin-top: 6px; }
.head-meta { text-align: right; display: grid; gap: 8px; justify-items: end; }
.count-line { font-size: 1.15rem; font-weight: 500; color: var(--muted); }
.count-line b { color: var(--ink); font-size: 1.6rem; font-weight: 700; }
.pips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 220px; }
.pip { width: 6px; height: 18px; border-radius: 3px; background: var(--line); }
.pip.on { background: var(--accent); }
@media (max-width: 520px) { .today-head { align-items: flex-start; } .head-meta { justify-items: end; } }

/* ---- cards and lists ---- */
.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; }
.card-head h2 { font-size: 1.25rem; font-weight: 650; }
.pad { padding: 8px 16px 16px; }
.pad-x { padding-left: 16px; padding-right: 16px; }
.pad-b { padding-bottom: 16px; }
.hint { color: var(--muted); font-size: 0.875rem; padding-top: 4px; padding-bottom: 12px; }
.pad-x.pad-b .hint, .stack-s > .hint, .support .hint { padding-bottom: 0; }
.hint.warn { color: var(--danger); }
.stack, .stack-s { display: grid; gap: 20px; align-content: start; }
.stack-s { gap: 14px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-end { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.row-end.top { margin-top: 12px; }
.grow { flex: 1; }
.today-grid, .insight-grid, .settings-grid, .cards { display: grid; gap: 20px; align-items: start; }
@media (min-width: 700px) and (max-width: 899px), (min-width: 1100px) {
  .today-grid, .insight-grid, .settings-grid, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-grid > .stat-cards { grid-column: 1 / -1; }
}
.badge { display: inline-block; min-width: 24px; text-align: center; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1.5px solid var(--line); font-size: 0.8125rem; font-weight: 700; }

.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1.5px solid var(--line); min-height: 64px; }
.list > li:first-child { border-top-color: transparent; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-title { background: none; border: 0; padding: 4px 0; text-align: left; font-weight: 600; font-size: 1.0625rem; line-height: 1.3; min-height: 28px; overflow-wrap: anywhere; }
.row-title.static { display: block; cursor: default; }
.row-sub { color: var(--muted); font-size: 0.875rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-sub.is-late { color: var(--danger); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; }
.chip .ico { width: 14px; height: 14px; }
.is-done > .row-main .row-title { color: var(--muted); }
.task.is-done .row-title { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--accent); }
.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* the tactile tick: a key that sinks when pressed */
.tick {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; padding: 0;
  background: var(--surface); border: 2px solid var(--ink); color: transparent;
  box-shadow: 0 3px 0 var(--ink); transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.tick:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.tick.is-done { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 1px 0 var(--edge-primary); transform: translateY(2px); }
.tick.is-done .ico { stroke-width: 2.6; }
.tick-sq { border-radius: 12px; }
.tick.is-multi { border-radius: 50%; border-width: 0; background: conic-gradient(var(--primary) calc(var(--p, 0) * 360deg), var(--line) 0); box-shadow: 0 3px 0 var(--edge); position: relative; }
.tick.is-multi::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface); }
.tick.is-multi > * { position: relative; }
.tick-n { font: 700 1.125rem var(--display); color: var(--ink); }
.tick.is-multi.is-done { background: var(--primary); box-shadow: 0 1px 0 var(--edge-primary); }
.tick.is-multi.is-done::before { background: var(--primary); }

.streak { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-family: var(--display); font-size: 1.125rem; }
.streak b { font-weight: 700; min-width: 1ch; }
.tally { stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; fill: none; flex: none; }
.tally line:last-child { stroke-width: 2.6; }
:root:not([data-theme="dark"]) .tally { stroke: #D79A0B; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .tally { stroke: var(--accent); } }

/* habit cards */
.habit-card { padding: 16px; display: grid; gap: 14px; }
.habit-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.habit-card h3 { font-size: 1.25rem; font-weight: 650; }
.stats-inline { display: flex; gap: 28px; }
.stats-inline > div { display: grid; }
.stat-n { display: inline-flex; align-items: center; gap: 8px; font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-l { color: var(--muted); font-size: 0.8125rem; }
.archived { display: grid; gap: 10px; justify-items: start; }
.archived .card { width: 100%; }

/* heat map */
.habit-card .heatmap { max-width: 330px; }
.heatmap { width: 100%; max-width: 420px; height: auto; display: block; }
.hm { stroke: none; }
.hm-off { fill: none; stroke: var(--h-off); stroke-width: 1; stroke-dasharray: 2 2; opacity: 0.8; }
.hm-0 { fill: var(--h0); } .hm-1 { fill: var(--h1); } .hm-2 { fill: var(--h2); } .hm-3 { fill: var(--h3); }
.hm-today { stroke: var(--accent); stroke-width: 2; stroke-dasharray: none; opacity: 1; }
.legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 0.8125rem; color: var(--muted); }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
i.lg.hm-0 { background: var(--h0); } i.lg.hm-1 { background: var(--h1); } i.lg.hm-2 { background: var(--h2); } i.lg.hm-3 { background: var(--h3); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font: 500 10px var(--sans); }
.bar { fill: var(--h2); } .bar-now { fill: var(--accent); }
.bar-empty { stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px 16px; align-items: end; }
.stat { display: grid; gap: 2px; }
.stat-big { font-size: clamp(2.4rem, 9vw, 3.4rem); font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.delta { font-size: 0.8125rem; font-weight: 600; }
.delta.up { color: var(--primary); } .delta.down { color: var(--danger); }
:root[data-theme="dark"] .delta.up { color: var(--primary); }
.week-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.ws { display: grid; gap: 4px; justify-items: center; font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
.ws-bar { width: 100%; max-width: 44px; height: 56px; border-radius: 10px; background: var(--surface-2); border: 1.5px solid var(--line); display: flex; align-items: flex-end; overflow: hidden; }
.ws-fill { width: 100%; height: calc(var(--v, 0) * 100%); background: var(--primary); }
.ws-future .ws-bar { border-style: dashed; background: none; }
.best li .streak { margin-left: auto; }
.notes li { display: grid; gap: 2px; align-items: start; }
.note-date { font-size: 0.8125rem; font-weight: 600; color: var(--muted); }

/* ---- buttons and forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; text-decoration: none; line-height: 1.1;
  box-shadow: 0 2px 0 var(--edge); transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--edge); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 2px 0 var(--edge-primary); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--primary); }
:root[data-theme="dark"] .btn-quiet { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .btn-quiet { color: var(--ink); } }
.btn-quiet:hover { background: var(--surface-2); }
.btn-quiet:active { transform: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
:root[data-theme="dark"] .btn-danger { color: #1A0803; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .btn-danger { color: #1A0803; } }
.btn-danger-quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--danger); }
.btn-danger-quiet:hover { background: var(--surface-2); }
.btn-chip { min-height: 44px; border-radius: 99px; padding: 0 14px; box-shadow: none; font-size: 0.9375rem; }
.btn-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-small { min-height: 44px; }
.icon-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--ink); }
.icon-btn:hover { background: var(--surface-2); }
.grip { touch-action: none; cursor: grab; }

.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field.inline { grid-auto-flow: column; justify-content: start; align-items: center; gap: 12px; }
.field-label { font-size: 0.875rem; font-weight: 650; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 1rem; /* 16px stops iOS zoom on focus */
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.85; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; border-color: transparent; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--danger); font-weight: 600; min-height: 0; }
.form-error:empty { display: none; }
.form-ok { color: var(--primary); font-weight: 600; }
.quick { display: flex; gap: 10px; padding: 10px; align-items: center; margin: 10px 0 14px; }
.today .quick { padding: 0; border: 0; box-shadow: none; margin: 4px 0 14px; background: none; }
.quick input[type="text"] { flex: 1; min-width: 0; }
.quick .date-input { width: 150px; flex: none; }
@media (max-width: 520px) { .quick { flex-wrap: wrap; } .quick .date-input { flex: 1; width: auto; } .quick .btn-primary { flex: none; } }
.journal { font-size: 1.0625rem; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 8px; }

.day-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.day-chip span { display: grid; place-items: center; min-width: 48px; min-height: 44px; padding: 0 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; box-shadow: 0 2px 0 var(--edge); }
.day-chip input:checked + span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 1px 0 var(--edge-primary); }
.day-chip input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line); }
.seg-item { position: relative; }
.seg-item input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-item span { display: grid; place-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; font-weight: 600; }
.seg-item input:checked + span { background: var(--surface); box-shadow: 0 1px 0 var(--edge), 0 0 0 1.5px var(--ink); }
.seg-item input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 1px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; font-weight: 600; }
input[role="switch"] { appearance: none; -webkit-appearance: none; flex: none; width: 56px; height: 32px; border-radius: 99px; background: var(--line); border: 0; position: relative; cursor: pointer; transition: background 0.15s; margin: 0; }
input[role="switch"]::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
input[role="switch"]:checked { background: var(--primary); }
input[role="switch"]:checked::after { transform: translateX(24px); }
.bullets { padding-left: 18px; list-style: disc; display: grid; gap: 4px; margin: 8px 0 14px; color: var(--muted); }
.steps { padding-left: 20px; list-style: decimal; display: grid; gap: 6px; }
.explainer p { margin-bottom: 4px; }
details.support summary, .done-box summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.done-box summary { padding: 4px 16px; }
.support-list { display: grid; gap: 8px; margin: 6px 0 12px; }
.support-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9375rem; }
.support-list .ok { color: var(--primary); } .support-list .no { color: var(--muted); }
.meter { height: 14px; border-radius: 99px; background: var(--surface-2); border: 1.5px solid var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--w, 0); background: var(--accent); }

/* ---- empty states, log, banner, toasts ---- */
.empty { padding: 28px 20px; display: grid; gap: 12px; justify-items: start; max-width: 620px; }
.empty h2 { font-size: 1.5rem; }
.log li { gap: 10px; align-items: baseline; min-height: 48px; }
.log-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.log-time { color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.st-sent { background: var(--h1); } .st-retry { background: var(--accent); color: #2B1E00; } .st-dropped { background: var(--danger); color: #fff; }

.banner { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px 10px 16px; background: var(--ink); color: var(--bg); border-radius: 16px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5); font-weight: 600; }
.banner[hidden] { display: none; }
.banner span { flex: 1; min-width: 160px; }
.banner .btn-quiet { color: var(--bg); }
.banner .btn-primary { background: var(--accent); border-color: var(--accent); color: #2B1E00; box-shadow: none; }
.toasts { position: fixed; z-index: 70; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); display: grid; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--ink); color: var(--bg); border-radius: 14px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5); animation: pop 0.18s ease-out; }
.toast .btn-quiet { color: var(--accent); min-height: 44px; }
.install-card { padding: 16px; display: grid; gap: 12px; background: var(--surface-2); }
.install-card h2 { font-size: 1.125rem; margin-bottom: 2px; }
@media (min-width: 900px) { .banner { left: auto; right: 24px; bottom: 24px; max-width: 460px; } .toasts { bottom: 24px; left: 276px; } }

/* ---- sheets ---- */
dialog.sheet {
  width: min(100%, 520px); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; color: var(--ink); background: var(--surface);
  border-radius: 24px 24px 0 0; overflow: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3); animation: sheet-up 0.22s ease-out;
}
dialog.sheet::backdrop { background: rgba(8, 16, 12, 0.55); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 24px; animation-name: pop; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 4px 20px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-head h2 { font-size: 1.375rem; }
.sheet-body { display: grid; gap: 16px; padding: 8px 20px calc(20px + var(--safe-b)); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- tasks: swipe and reorder ---- */
.task { position: relative; overflow: hidden; padding: 0 !important; display: block !important; min-height: 64px; }
.task-in { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); transform: translateX(var(--dx, 0)); touch-action: pan-y; transition: transform 0.2s ease-out; min-height: 64px; }
.task.swiping .task-in { transition: none; }
.task.swiped-out .task-in { transform: translateX(110%); }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; gap: 8px; padding-left: 20px; background: var(--primary); color: var(--on-primary); font-weight: 700; opacity: 0; }
.task.swiping .swipe-bg { opacity: 0.55; }
.task.swiping.armed .swipe-bg { opacity: 1; }
.task.dragging { background: var(--surface-2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); position: relative; z-index: 2; }
.reorder { display: flex; align-items: center; }
.task-group { overflow: hidden; }
.week-wrap { border-top: 1.5px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.stack-s > .btn { justify-self: start; }
.done-box ul { border-top: 1.5px solid var(--line); }

/* ---- offline page ---- */
body.plain { display: grid; place-items: center; min-height: 100dvh; padding: 20px; }
.plain-card { max-width: 440px; padding: 28px; display: grid; gap: 14px; justify-items: start; }
.plain-card h1 { font-size: 1.75rem; line-height: 1.15; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .tick.is-done { forced-color-adjust: none; }
}
