:root {
  --bg: #f6f2ea; --surface: #fffdf9; --sunk: #efe9de; --ink: #1c2230; --muted: #5d6676; --line: #e2dbcd;
  --accent: #23614f; --accent-2: #2f7d66; --accent-ink: #ffffff; --warn: #9a4a12; --warn-bg: #fbeedd;
  --bad: #a3271f; --hi: #ffe873; --hi-ink: #1c2230; --chip: #e7efe9; --shadow: 0 1px 2px rgb(28 34 48 / 6%), 0 4px 16px rgb(28 34 48 / 6%);
  --radius: 14px; --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --surface: #1a1f28; --sunk: #232a35; --ink: #e8ebf0; --muted: #9ca5b4; --line: #2c3442;
    --accent: #5db497; --accent-2: #74c6aa; --accent-ink: #0d1a15; --warn: #f0a868; --warn-bg: #3a2a1a;
    --bad: #ff8a80; --hi: rgb(255 214 10 / 32%); --hi-ink: #fff6c8; --chip: #22332c; --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --surface: #1a1f28; --sunk: #232a35; --ink: #e8ebf0; --muted: #9ca5b4; --line: #2c3442;
  --accent: #5db497; --accent-2: #74c6aa; --accent-ink: #0d1a15; --warn: #f0a868; --warn-bg: #3a2a1a;
  --bad: #ff8a80; --hi: rgb(255 214 10 / 32%); --hi-ink: #fff6c8; --chip: #22332c; --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; color: var(--ink); }
.brand img { width: 30px; height: 30px; border-radius: 8px; }

/* hero */
.hero { padding: 28px 0 12px; }
.hero h1 { font: 600 clamp(2rem, 6vw, 3.1rem)/1.05 var(--serif); letter-spacing: -.02em; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 58%, var(--hi) 58%, var(--hi) 92%, transparent 92%); }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 36em; }

/* cards and forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=time], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .chip:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px;
}
.field + .field { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--chip); cursor: pointer; font-size: .875rem; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* results / review items */
.items { display: grid; gap: 12px; margin: 16px 0; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.item.needs-check { border-left: 4px solid var(--warn); }
.item.is-ready { border-left: 4px solid var(--accent); }
.item h3 { font-size: 1.1rem; margin: 2px 0 2px; }
.when { font-weight: 600; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--chip); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.reasons { margin: 8px 0 0; padding: 8px 12px; background: var(--warn-bg); color: var(--warn); border-radius: 10px; font-size: .9rem; list-style: none; }
.reasons li + li { margin-top: 2px; }
.quote { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--line); color: var(--muted); font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
mark { background: var(--hi); color: var(--hi-ink); padding: 0 2px; border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark small { font-size: .65rem; font-weight: 700; text-transform: uppercase; opacity: .6; margin-left: 3px; }
.actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--chip); font-size: .92rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px;
  border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); z-index: 20; max-width: calc(100% - 32px); }

/* features strip */
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 28px 0; }
.points div { padding: 14px; border-radius: var(--radius); background: var(--sunk); }
.points b { display: block; margin-bottom: 2px; }
footer { padding: 24px 0 40px; font-size: .85rem; color: var(--muted); }

/* app shell */
.app main { padding-bottom: 96px; }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 600; position: relative; }
nav.tabs a svg { width: 22px; height: 22px; }
nav.tabs a[aria-current="page"] { color: var(--accent); }
nav.tabs .count { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--warn); color: #fff; border-radius: 999px; font-size: .68rem; padding: 0 6px; min-width: 18px; text-align: center; }
@media (min-width: 900px) {
  nav.tabs { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); display: flex; justify-content: center; gap: 8px; }
  nav.tabs a { flex-direction: row; gap: 6px; padding: 12px 14px; font-size: .9rem; }
  nav.tabs .count { position: static; }
  .app main { padding-bottom: 40px; }
}
.view h2 { font: 600 1.6rem/1.15 var(--serif); margin-top: 8px; }

/* calendar */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: .85rem; }
.month .dow { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.month button { border: 0; background: transparent; min-height: 40px; border-radius: 10px; cursor: pointer; position: relative; }
.month button.has::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.month button.today { outline: 2px solid var(--accent); }
.month button.out { color: var(--muted); opacity: .45; }
.day { margin-top: 18px; }
.day h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.ev { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; width: 100%; text-align: left; }
.ev + .ev { margin-top: 6px; }
.ev .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.ev.cancelled .title, .ev.removed .title { text-decoration: line-through; color: var(--muted); }
.ev.optional { border-style: dashed; }
.tag { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
pre.digest { white-space: pre-wrap; font: .92rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.secret { font: .85rem ui-monospace, Menlo, monospace; word-break: break-all; background: var(--sunk); padding: 10px; border-radius: 10px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: min(520px, calc(100% - 32px)); padding: 18px; }
dialog::backdrop { background: rgb(0 0 0 / 40%); }
.w-date { max-width: 200px; }
.h-serif { font: 600 1.35rem/1.2 var(--serif); }
html { scroll-padding-bottom: 96px; }
@media (min-width: 900px) { html { scroll-padding-bottom: 0; scroll-padding-top: 56px; } }
.ev { grid-template-columns: max-content 1fr; }
.ev .t { white-space: nowrap; min-width: 64px; }
#who { max-width: 55%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr { width: 240px; height: 240px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 12px; }
.paircode { font: 700 2rem/1 ui-monospace, Menlo, monospace; letter-spacing: .12em; padding: 14px 18px; background: var(--sunk); border-radius: 12px; display: inline-block; }
.groups { display: grid; gap: 6px; max-height: 360px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; }
.check.group { padding: 8px; border-radius: 8px; }
.check.group:hover { background: var(--sunk); }
