:root {
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #ecebe5; --ink: #17191c; --ink-2: #5c6066; --line: #dedcd4;
  --accent: #1f4d3a; --accent-ink: #ffffff; --accent-soft: #dfe9e2; --hero: #1f4d3a; --hero-ink: #ffffff;
  --good: #2f7d4f; --mid: #b7801b; --bad: #b4412f; --good-bg: #e3f1e8; --mid-bg: #f8edd6; --bad-bg: #f7e1dc;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111314; --surface: #1a1d1f; --surface-2: #23272a; --ink: #eceae4; --ink-2: #9ca1a6; --line: #2c3033;
    --accent: #7fc4a0; --accent-ink: #0e1a14; --accent-soft: #1d2f26; --hero: #1d3a2d; --hero-ink: #e6f2ea;
    --good: #7fc4a0; --mid: #e2b85c; --bad: #ef8a78; --good-bg: #1c2e24; --mid-bg: #33291a; --bad-bg: #3a221d;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.top {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 16px 12px; position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
}
.eyebrow { color: var(--ink-2); font-size: 13px; letter-spacing: .02em; }
.top h1 { font-size: 28px; line-height: 1.1; letter-spacing: -.02em; font-weight: 680; }
.claude {
  flex: none; text-decoration: none; color: var(--accent); background: var(--accent-soft);
  padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
}

main#view { padding: 4px 16px 24px; display: grid; gap: 12px; max-width: 640px; margin: 0 auto; }

.card { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card h2 { font-size: 13px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.lead { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.sub { color: var(--ink-2); font-size: 14px; }
.card .lines { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 15px; }
.card .lines li { color: var(--ink); }
.card .lines li.muted { color: var(--ink-2); font-size: 14px; }
.hero { background: var(--hero); color: var(--hero-ink); border: none; }
.hero h2 { color: color-mix(in srgb, var(--hero-ink) 70%, transparent); }

.blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; margin-top: 10px; }
.blk { border-radius: 10px; padding: 8px 6px; text-align: center; font-size: 13px; line-height: 1.25; }
.blk b { display: block; font-size: 15px; }
.blk.green { background: var(--good-bg); color: var(--good); }
.blk.yellow { background: var(--mid-bg); color: var(--mid); }
.blk.red { background: var(--bad-bg); color: var(--bad); }
.blk small { display: block; color: var(--ink-2); }

.status { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--good-bg); color: var(--good); }
.pill.down { background: var(--bad-bg); color: var(--bad); font-weight: 600; }

.list { display: grid; gap: 8px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.item > button.head { all: unset; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 12px 14px; width: 100%; box-sizing: border-box; cursor: pointer; }
.item .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: transparent; }
.item.unread .dot { background: var(--accent); }
.item.alert .dot { background: var(--bad); }
.item .t { font-weight: 600; }
.item .s { color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .time { color: var(--ink-2); font-size: 12px; white-space: nowrap; margin-top: 2px; }
.item .body { padding: 0 14px 14px 32px; font-size: 15px; display: none; }
.item.open .body { display: block; }
.item.open .s { display: none; }
.body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 12px 0 4px; }
.body ul { margin: 4px 0; padding-left: 18px; }
.body p { margin: 6px 0; }
.item .actions { display: flex; gap: 8px; margin-top: 10px; }

.task { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); background: none; padding: 0; cursor: pointer; display: grid; place-items: center; }
.task.done .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task.done .t { text-decoration: line-through; color: var(--ink-2); }
.due { font-size: 13px; color: var(--ink-2); }
.due.late { color: var(--bad); font-weight: 600; }
.section-label { font-size: 13px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; margin: 8px 2px 0; }

.empty { text-align: center; color: var(--ink-2); padding: 48px 16px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }
.refresh { justify-self: center; }

button.primary, button.ghost, .small { border: none; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.ghost { background: var(--surface-2); }
.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; background: var(--surface-2); }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs button { all: unset; position: relative; display: grid; justify-items: center; gap: 2px; font-size: 12px; color: var(--ink-2); padding: 6px 0; cursor: pointer; }
.tabs .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 650; }
.badge { position: absolute; top: 0; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }

.fab {
  position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 11;
  width: 56px; height: 56px; border-radius: 18px; border: none; background: var(--accent); color: var(--accent-ink);
  font-size: 28px; line-height: 1; box-shadow: 0 6px 20px rgba(0,0,0,.18); cursor: pointer;
}

.sheet { border: none; padding: 0; width: 100%; max-width: 640px; margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); }
.sheet::backdrop { background: rgba(0,0,0,.35); }
.sheet form { display: grid; gap: 10px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet input:not([type=radio]), .sheet textarea { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 11px 12px; }
.sheet textarea { resize: vertical; }
.when { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 8px 4px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.row { display: flex; gap: 8px; justify-content: flex-end; }

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 14px; justify-items: center; }
.login-card h1 { font-size: 26px; }
.login-card form { width: 100%; display: grid; gap: 8px; }
.login-card label { font-size: 14px; color: var(--ink-2); }
.login-card input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; }
.login-card img { border-radius: 14px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .item, .card { transition: background .15s; } }
