[hidden] { display: none !important; }
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #111518;
  --soft: #5b6670;
  --faint: #8d979f;
  --rule: #e2e7eb;
  --accent: #0988b0;
  --biz: #0b7d5b;
  --per: #2f6fd6;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0d1114; --surface: #161c20; --ink: #eef2f4; --soft: #a4b0b8; --faint: #6f7b84; --rule: #253038;
  --accent: #3cc6e6; --biz: #2fbf8c; --per: #6a9cf5; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0d1114; --surface: #161c20; --ink: #eef2f4; --soft: #a4b0b8; --faint: #6f7b84; --rule: #253038;
  --accent: #3cc6e6; --biz: #2fbf8c; --per: #6a9cf5; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 15px; line-height: 1.4; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.shell { max-width: 820px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 110px; }
header.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); display: flex; align-items: center; gap: 12px; padding-block: 14px 10px; flex-wrap: wrap; }
header.bar img { width: 34px; height: 34px; border-radius: 8px; }
header.bar h1 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-right: auto; }
nav.tabs { display: flex; background: var(--rule); border-radius: 10px; padding: 3px; }
nav.tabs button { font: inherit; font-weight: 600; font-size: .9rem; border: 0; background: transparent; color: var(--soft); padding: 6px 14px; border-radius: 8px; cursor: pointer; }
nav.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
button:focus-visible, .row:focus-visible, .drop:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.section-title { font-size: .85rem; font-weight: 700; color: var(--soft); margin: 18px 4px 6px; display: flex; justify-content: space-between; }
.list { background: var(--surface); border-radius: 16px; overflow: hidden; border: 1px solid var(--rule); }
.swipe { position: relative; overflow: hidden; border-top: 1px solid var(--rule); }
.swipe:first-child { border-top: 0; }
.under { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 18px; font-weight: 700; color: #fff; font-size: .9rem; }
.under .b { opacity: 0; } .under .p { opacity: 0; }
.row { position: relative; background: var(--surface); display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: center; padding: 11px 16px; cursor: grab; touch-action: pan-y; user-select: none; }
.row.sel { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.glyph { display: grid; justify-items: center; gap: 2px; }
.glyph .o { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--soft); }
.glyph .l { width: 2px; height: 12px; border-radius: 1px; background: var(--rule); }
.glyph .d { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.glyph .rt { font-size: 11px; line-height: 9px; color: var(--accent); font-weight: 800; }
.txt { min-width: 0; display: grid; gap: 3px; }
.from { font-size: .88rem; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.from .t { color: var(--faint); margin-left: 6px; }
.to { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.right { text-align: right; display: grid; gap: 4px; justify-items: end; }
.mi { font-weight: 700; font-variant-numeric: tabular-nums; }
.mi small { font-weight: 400; color: var(--soft); }
.tag { font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.tag.b { color: var(--biz); background: color-mix(in srgb, var(--biz) 14%, transparent); }
.tag.p { color: var(--per); background: color-mix(in srgb, var(--per) 14%, transparent); }
.tag.u { color: var(--soft); border: 1px dashed var(--faint); }
.undo { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; align-items: center; gap: 14px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(18px); border: 1px solid var(--rule); border-radius: 999px; padding: 10px 12px 10px 18px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.35); max-width: calc(100% - 32px); }
.undo .dot { width: 8px; height: 8px; border-radius: 50%; }
.undo span.lbl { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.undo button { font: inherit; font-weight: 700; color: var(--accent); background: transparent; border: 0; cursor: pointer; padding: 4px 8px; }
.drop { margin-top: 30px; background: var(--surface); border: 2px dashed var(--rule); border-radius: 22px; padding: 40px 24px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.drop h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.01em; }
.drop p { margin: 0; color: var(--soft); max-width: 46ch; }
.btn { font: inherit; font-weight: 700; color: #fff; background: var(--accent); border: 0; border-radius: 999px; padding: 11px 22px; cursor: pointer; }
.btn.ghost { color: var(--accent); background: transparent; border: 1.5px solid var(--accent); }
.hint { font-size: .82rem; color: var(--faint); text-align: center; margin: 14px 0 0; }
.report { display: grid; gap: 18px; padding-top: 10px; }
.big { font-size: clamp(2.4rem, 9vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.a { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.chip.b { color: var(--biz); background: color-mix(in srgb, var(--biz) 13%, transparent); }
.chip.s { color: var(--soft); background: var(--rule); }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 16px; }
.card h3 { margin: 0 0 10px; font-size: 1rem; }
.chart { width: 100%; height: auto; display: block; }
.place { display: grid; gap: 4px; padding: 6px 0; }
.place .top { display: flex; justify-content: space-between; gap: 10px; }
.place .top span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place .top span:last-child { color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.place .bar { height: 5px; border-radius: 3px; background: var(--biz); opacity: .8; }
.yearpick { font: inherit; font-weight: 700; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note { font-size: .82rem; color: var(--soft); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Signed out */
.welcome { min-height: 100dvh; display: grid; place-items: center; padding-block: 40px; }
.welcome .card { width: min(440px, 100%); padding: 34px 28px; display: grid; gap: 18px; justify-items: center; text-align: center; border-radius: 26px; box-shadow: 0 30px 60px -40px rgba(9, 136, 176, .55); }
.welcome img { width: 88px; height: 88px; border-radius: 20px; box-shadow: 0 12px 30px -14px rgba(0,0,0,.45); }
.welcome h1 { margin: 0; font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.welcome p { margin: 0; color: var(--soft); max-width: 34ch; }
.welcome .btn { width: 100%; padding: 14px 22px; font-size: 1rem; }
.welcome .alt { font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; font-weight: 600; padding: 4px; }
.welcome form { display: grid; gap: 10px; width: 100%; }
.welcome input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.welcome .err { color: #c2410c; font-size: .9rem; }
.who { position: relative; }
.who > button { font: inherit; font-weight: 600; font-size: .9rem; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 6px; display: grid; min-width: 180px; box-shadow: 0 16px 30px -18px rgba(0,0,0,.4); z-index: 30; }
.menu button { font: inherit; text-align: left; background: none; border: 0; color: var(--ink); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--bg); }
.menu .meta { font-size: .8rem; color: var(--soft); padding: 6px 10px; }
.loading { text-align: center; color: var(--soft); padding: 60px 0; }
.empty { margin-top: 30px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.empty h2 { margin: 0; font-size: 1.3rem; }
.empty p { margin: 0; color: var(--soft); max-width: 44ch; }
