:root {
  color-scheme: light dark;
  --page: #f3f5f7;
  --card: #ffffff;
  --text: #17202a;
  --muted: #5d6b7a;
  --line: #d5dce3;
  --accent: #0f6b6b;
  --accent-soft: #dff0ef;
  --on-accent: #ffffff;
  --danger: #b3261e;
  --warn: #8a5a00;
  --pill-todo: #e6ebf0;
  --pill-todo-text: #3d4a57;
  --pill-work: #dbeafe;
  --pill-work-text: #1d4f91;
  --pill-held: #fdecc8;
  --pill-held-text: #7a4e00;
  --pill-done: #d9f2e2;
  --pill-done-text: #17643a;
  --shadow: 0 1px 2px rgb(0 0 0 / 7%);
  --nav-height: 58px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #11171d;
    --card: #1b232b;
    --text: #e8edf2;
    --muted: #9aa8b5;
    --line: #33404c;
    --accent: #58bdb9;
    --accent-soft: #1d3a3a;
    --on-accent: #0b1a1a;
    --danger: #f2998f;
    --warn: #e4b75f;
    --pill-todo: #2c3640;
    --pill-todo-text: #c4cfd9;
    --pill-work: #1e3552;
    --pill-work-text: #a8cdf7;
    --pill-held: #43351a;
    --pill-held-text: #edc77c;
    --pill-done: #1a3d2a;
    --pill-done-text: #99e0b5;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--page); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-wrap: anywhere; }
main { width: 100%; }
h1, h2, p, dl, dd, ol { margin: 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: 0.6; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.big-icon { display: block; width: 44px; height: 44px; margin-bottom: 12px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* --- Login ---------------------------------------------------------------------------------- */
.login-card { max-width: 420px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
@media (min-width: 480px) {
  .login-card { margin-top: 48px; padding: 32px 28px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
}
.brand { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; color: var(--accent); }
.login-card h1 { margin: 8px 0 8px; font-size: 26px; line-height: 1.2; }
.intro { margin-bottom: 20px; color: var(--muted); }
.step { margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--accent); }
.field-block { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
input { display: block; width: 100%; min-height: 50px; padding: 12px 14px; font: inherit; font-size: 16px; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.input-row { position: relative; }
.input-row input { padding-right: 76px; }
.reveal { position: absolute; top: 0; right: 0; height: 50px; min-width: 70px; font-size: 14px; color: var(--accent); }
.code-input { text-align: center; font-size: 26px; font-weight: 600; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.primary { display: block; width: 100%; min-height: 52px; padding: 14px; font-weight: 600; text-align: center; text-decoration: none; color: var(--on-accent); background: var(--accent); border-radius: 12px; }
.secondary { display: block; width: 100%; min-height: 48px; padding: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 12px; }
.link-button { margin: 10px 0 8px; }
.error { margin-bottom: 12px; font-size: 14px; color: var(--danger); }
.steps { margin: 0 0 20px; padding-left: 22px; }
.steps > li { margin-bottom: 14px; padding-left: 2px; }
.stores { margin-top: 4px; font-size: 14px; color: var(--muted); }
.stores a { display: inline-block; padding: 4px 2px; font-weight: 600; }
.secret { display: block; margin: 8px 0; font-size: 12px; text-align: center; color: var(--muted); }
.other-ways summary { padding: 8px 0; font-size: 14px; color: var(--muted); cursor: pointer; }
.qr { display: block; width: 200px; height: 200px; margin: 8px auto; padding: 8px; background: #ffffff; border-radius: 8px; }

/* --- The menus ------------------------------------------------------------------------------ */
body.wide main { max-width: 720px; margin: 0 auto; padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px); }
.head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; min-height: 52px; padding: env(safe-area-inset-top) 8px 0 16px; background: var(--page); border-bottom: 1px solid var(--line); }
.head-title { flex: 1; font-size: 18px; font-weight: 700; }
.head .back { display: none; margin-left: -8px; }
.head.has-back .back { display: flex; }
.icon-button { align-items: center; justify-content: center; width: 44px; height: 44px; }
.plain { min-height: 44px; padding: 0 10px; font-size: 14px; color: var(--muted); }
.menu-content { padding: 12px 16px 0; }
.tabs { position: fixed; right: 0; bottom: 0; left: 0; z-index: 2; display: flex; padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-height); font-size: 12px; color: var(--muted); }
.tab[aria-current="page"] { color: var(--accent); font-weight: 600; }
.chips { display: flex; gap: 8px; margin-bottom: 10px; }
.chip { flex: 1; min-height: 40px; padding: 8px 6px; font-size: 14px; font-weight: 500; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.chip[aria-selected="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.search { min-height: 44px; margin-bottom: 12px; padding: 10px 14px; }
.card { display: block; width: 100%; margin-bottom: 8px; padding: 14px; text-align: left; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); }
.row { min-height: 60px; }
.row:active, .event summary:active { background: var(--accent-soft); }
.row-title { display: block; font-weight: 600; line-height: 1.3; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.row-sub { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.pill { display: inline-block; padding: 2px 9px; font-size: 12px; font-weight: 600; border-radius: 10px; }
.status-todo { color: var(--pill-todo-text); background: var(--pill-todo); }
.status-in_progress { color: var(--pill-work-text); background: var(--pill-work); }
.status-blocked { color: var(--pill-held-text); background: var(--pill-held); }
.status-done { color: var(--pill-done-text); background: var(--pill-done); }
.due.late { font-weight: 600; color: var(--danger); }
.due.soon { font-weight: 600; color: var(--warn); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.skeleton { height: 72px; margin-bottom: 8px; background: var(--card); border-radius: 12px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.group { margin-top: 20px; }
.group h2 { margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.menu-content > .group:first-child { margin-top: 4px; }
.task-title { font-size: 21px; line-height: 1.25; }
.facts { margin-top: 12px; }
.fact { display: flex; gap: 12px; padding: 7px 0; font-size: 15px; border-bottom: 1px solid var(--line); }
.fact:last-child { border-bottom: 0; }
.fact dt { flex: 0 0 38%; color: var(--muted); }
.fact dd { flex: 1; }
.text { white-space: pre-wrap; }
.note { margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.file { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.file-name { flex: 1; color: var(--text); font-size: 15px; }
.file-size { flex: none; font-size: 13px; }
.entry .pill { margin-bottom: 4px; }
.entry-head { margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.entry-head b { color: var(--text); }
.event { padding: 0; }
.event summary { display: flex; gap: 12px; min-height: 60px; padding: 12px 14px; list-style: none; cursor: pointer; border-radius: 12px; }
.event summary::-webkit-details-marker { display: none; }
.event-time { flex: 0 0 62px; display: flex; flex-direction: column; font-size: 14px; color: var(--muted); }
.event-time b { color: var(--accent); font-size: 15px; }
.event-main { flex: 1; }
.event .facts { margin: 0; padding: 0 14px 8px; border-top: 1px solid var(--line); }
.event > .text { padding: 0 14px 14px; font-size: 15px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.person-main { flex: 1; min-width: 0; }
.avatar { flex: none; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; font-size: 14px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 50%; }
.round { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--accent); background: var(--accent-soft); border-radius: 50%; }
