/* Uniclock styles. Colours are tokens on :root; dark mode is defined twice (system setting, and data-theme="dark"). */
:root {
  --bg: #f3f2f7; --card: #ffffff; --ink: #18161f; --muted: #5f5b6e; --line: #e2e0ea; --track: #e8e6ef;
  --accent: #5b45d6; --accent-ink: #ffffff; --accent-soft: #ebe7fd;
  --got: #12936b; --waste: #d6402f; --rec: #c27c0e; --partial: #3f86c9; --got-ink: #0d7a58; --waste-ink: #b8361f; --rec-ink: #8f5a00; --partial-ink: #2b6ca8; --cancel-ink: #66636f; --on-fill: #ffffff; --cancel: #8a8799; --unmarked: #b9b6c6; --upcoming: #dcd9e6;
  --today: #5b45d6; --week: #12936b; --sem: #c27c0e; --s-cur: #5b45d6; --s-prev: #c27c0e;
  --u0: #5b45d6; --u1: #2f74c0; --u2: #0f8478; --u3: #9a5c08; --u4: #b2367a; --u5: #5f7a1c; --u6: #8a5a34; --u7: #4f5d75;
  --shadow: 0 1px 2px rgba(20, 16, 40, .06), 0 6px 20px rgba(20, 16, 40, .05);
  --r: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0c12; --card: #18161f; --ink: #f1eff7; --muted: #a6a2b6; --line: #2c2936; --track: #2a2734;
    --accent: #9c8cff; --accent-ink: #120f22; --accent-soft: #272143;
    --got: #36c995; --waste: #ff6b5a; --rec: #f0b241; --partial: #72b3f0; --got-ink: #36c995; --waste-ink: #ff6b5a; --rec-ink: #f0b241; --partial-ink: #72b3f0; --cancel-ink: #a6a2b6; --on-fill: #120f22; --cancel: #8f8ba0; --unmarked: #5e5a6c; --upcoming: #34303f;
    --today: #9c8cff; --week: #36c995; --sem: #f0b241; --s-cur: #8a78fa; --s-prev: #bd8016;
    --u0: #5b45d6; --u1: #2f74c0; --u2: #0f8478; --u3: #9a5c08; --u4: #b2367a; --u5: #5f7a1c; --u6: #8a5a34; --u7: #4f5d75;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0c12; --card: #18161f; --ink: #f1eff7; --muted: #a6a2b6; --line: #2c2936; --track: #2a2734;
  --accent: #9c8cff; --accent-ink: #120f22; --accent-soft: #272143;
  --got: #36c995; --waste: #ff6b5a; --rec: #f0b241; --partial: #72b3f0; --got-ink: #36c995; --waste-ink: #ff6b5a; --rec-ink: #f0b241; --partial-ink: #72b3f0; --cancel-ink: #a6a2b6; --on-fill: #120f22; --cancel: #8f8ba0; --unmarked: #5e5a6c; --upcoming: #34303f;
  --today: #9c8cff; --week: #36c995; --sem: #f0b241; --s-cur: #8a78fa; --s-prev: #bd8016;
  --u0: #5b45d6; --u1: #2f74c0; --u2: #0f8478; --u3: #9a5c08; --u4: #b2367a; --u5: #5f7a1c; --u6: #8a5a34; --u7: #4f5d75;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* IBM Plex Sans (OFL, Latin subset, bundled) for Latin text and numbers; Chinese uses the phone's own CJK font,
   picked per language so Simplified text gets Simplified glyph shapes. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-sans-400.woff2) format("woff2"); unicode-range: U+0000-024F, U+2000-206F, U+20AC, U+2190-21FF, U+2212; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-sans-500.woff2) format("woff2"); unicode-range: U+0000-024F, U+2000-206F, U+20AC, U+2190-21FF, U+2212; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/plex-sans-600.woff2) format("woff2"); unicode-range: U+0000-024F, U+2000-206F, U+20AC, U+2190-21FF, U+2212; }
:root { --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root:lang(zh-Hant) { --font: "IBM Plex Sans", "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei UI", "Microsoft JhengHei", system-ui, sans-serif; }
:root:lang(zh-Hans) { --font: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word; line-break: strict;
}
:root:lang(zh-Hant) body, :root:lang(zh-Hans) body { line-height: 1.6; }
p, li, .hint, .muted { text-wrap: pretty; }
h1, h2 { text-wrap: balance; }
.nw { white-space: nowrap; } /* keeps "2026 Semester 2", "A$1,192" and similar together */
[hidden] { display: none !important; }
h1 { font-size: 26px; margin: 8px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 8px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.num, .waste-num, .ring-val, .tbl td.n, .donut-mid b { font-variant-numeric: tabular-nums; }

/* layout */
.app { max-width: 600px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 0 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.brand img { border-radius: 7px; }
.view { display: grid; gap: 12px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.banner span:first-child { min-width: 0; }
.banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.banner .actions { display: flex; gap: 6px; flex-shrink: 0; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }

/* forms */
.field { display: grid; gap: 4px; margin: 8px 0; font-size: 13px; color: var(--muted); min-width: 0; }
.field > span:first-child { font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: 16px; /* ≥16px so iOS does not zoom */
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
@supports (-webkit-touch-callout: none) { textarea { font-size: 16px; } }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="range"] { padding: 0; accent-color: var(--accent); background: none; border: 0; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex-shrink: 0; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row output { min-width: 3.2em; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 6px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.status { font-size: 13px; color: var(--muted); margin: 8px 0 0; min-height: 1em; }
.status.bad { color: var(--waste-ink); }
.status:empty { display: none; }
.err { color: var(--waste-ink); font-size: 14px; margin: 4px 0; }
.hint { font-size: 13px; color: var(--muted); }
details > summary { cursor: pointer; color: var(--accent); font-size: 14px; margin: 6px 0; }
details.how ol { padding-left: 20px; margin: 6px 0; font-size: 14px; }
details.how li { margin: 4px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; cursor: pointer; min-height: 40px; text-decoration: none; white-space: nowrap;
}
.btn.small { font-size: 13px; padding: 6px 10px; min-height: 32px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--waste-ink); }
.btn.icon { width: 40px; padding: 0; font-size: 22px; line-height: 1; }
.btn:disabled { opacity: .5; cursor: default; }

/* switches */
.switches { display: grid; gap: 2px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.switch:last-child { border-bottom: 0; }
.switch small { display: block; color: var(--muted); font-size: 12px; }

/* waste counter */
.waste { display: grid; gap: 2px; text-align: center; padding: 18px 14px; }
.waste .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.waste-num { font-size: 40px; line-height: 1.1; color: var(--waste); letter-spacing: -.02em; font-weight: 600; }

/* rings (same idea as Payclock's home screen) */
.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ring { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--r); padding: 10px 6px 10px; display: grid; justify-items: center; gap: 2px; font: inherit; color: var(--ink); cursor: pointer; min-width: 0; }
.ring[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.ring-svg { position: relative; width: 100%; max-width: 104px; aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: var(--track); }
.ring .arc { stroke: var(--c); stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2, .8, .2, 1), opacity .3s; }
.ring .arc.lost { stroke: var(--waste); opacity: .85; }
.ring-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-pct { font-size: 20px; font-weight: 600; }
.ring-pct small { font-size: 11px; font-weight: 600; margin-left: 1px; }
.ring-val { font-size: 12px; color: var(--muted); }
.ring-name { font-size: 13px; font-weight: 600; margin-top: 2px; }
.ring-sub { font-size: 12px; line-height: 1.3; color: var(--muted); text-align: center; }

/* donut */
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg button { white-space: nowrap; flex: 1; border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); padding: 6px 4px; border-radius: 8px; cursor: pointer; min-width: 0; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.donut-wrap { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center; }
.donut { position: relative; width: 140px; aspect-ratio: 1; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 18; }
.donut .seg-arc { transition: stroke-dasharray .9s cubic-bezier(.2, .8, .2, 1), stroke-dashoffset .9s cubic-bezier(.2, .8, .2, 1); }
.donut-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.donut-mid b { font-size: 18px; }
.donut-mid span { font-size: 11px; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; min-width: 0; }
.legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 340px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .legend { width: 100%; } }

/* class lists */
.classlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.classlist li { display: grid; grid-template-columns: 4px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.classlist li:last-child { border-bottom: 0; }
.classlist .bar { align-self: stretch; border-radius: 4px; background: var(--uc); }
.classlist .what { min-width: 0; }
.classlist .what b { display: block; }
.classlist .what span { font-size: 12px; color: var(--muted); }
.classlist .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.quick { display: flex; gap: 4px; margin-top: 6px; }
.quick button { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 8px; font: inherit; font-size: 12px; padding: 4px 8px; cursor: pointer; min-height: 30px; }
.quick button[aria-pressed="true"] { color: var(--on-fill); border-color: transparent; background: var(--sc); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* unit table */
.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { white-space: nowrap; text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 6px 6px 0; }
.tbl td { padding: 7px 6px 7px 0; border-top: 1px solid var(--line); white-space: nowrap; }
.tbl td.n, .tbl th.n { text-align: right; }
.tbl .code { font-weight: 600; }
.tbl .code small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); padding-left: 14px; }
.tbl .code i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--uc); margin-right: 6px; }

/* week view */
.weeknav { display: grid; grid-template-columns: 40px 1fr 40px; gap: 8px; align-items: center; }
.weeklabel { border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; padding: 6px; }
.weeksum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; text-align: center; font-size: 12px; color: var(--muted); }
.weeksum b { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.weeksum .w b { color: var(--waste-ink); }
.weeksum .g b { color: var(--got-ink); }
.grid-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 6px 10px 0; overflow: hidden; }
.tt { display: grid; grid-template-columns: 30px repeat(var(--days), minmax(0, 1fr)); position: relative; }
.tt-head { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0 6px; line-height: 1.2; }
.tt-head b { display: block; font-size: 14px; color: var(--ink); }
.tt-head.today b { color: var(--accent); }
.tt-hours { position: relative; }
.tt-hours span { position: absolute; right: 4px; font-size: 10px; color: var(--muted); transform: translateY(-50%); }
.tt-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% var(--hh); }
.tt-col.today { background-color: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.blk {
  position: absolute; left: 2px; right: 2px; border-radius: 7px; padding: 3px 4px; overflow: hidden; cursor: pointer; text-align: left;
  font: inherit; font-size: 11px; line-height: 1.2; border: 0; color: #fff; background: var(--uc);
  display: flex; flex-direction: column; gap: 1px;
}
.blk b { font-size: 11px; font-weight: 600; overflow-wrap: normal; word-break: keep-all; line-height: 1.1; }
.blk .t { opacity: .92; white-space: nowrap; overflow: hidden; }
.blk .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.blk .st { position: absolute; right: 3px; bottom: 2px; font-size: 11px; font-weight: 600; }
.blk.upcoming { opacity: .78; }
.blk.unmarked { background: color-mix(in srgb, var(--uc) 35%, var(--card)); color: var(--ink); outline: 1.5px dashed var(--uc); outline-offset: -1.5px; }
.blk.missed { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--waste) 22%, var(--card)) 0 6px, var(--card) 6px 12px); color: var(--ink); outline: 1.5px solid var(--waste); outline-offset: -1.5px; }
.blk.missed .v { color: var(--waste-ink); text-decoration: line-through; }
.blk.recording, .blk.partial { background: linear-gradient(to top, color-mix(in srgb, var(--uc) 30%, var(--card)) var(--lostpct), var(--uc) var(--lostpct)); }
.blk.cancelled { background: var(--track); color: var(--muted); }
.blk.cancelled .v { text-decoration: line-through; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--waste); z-index: 2; pointer-events: none; }

/* history */
.cmp-head { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; margin: 4px 0 10px; }
.cmp-head .arrow { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: var(--cancel); font-size: 15px; flex-shrink: 0; }
.cmp-head.better .arrow { background: var(--got); }
.cmp-head.worse .arrow { background: var(--waste); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--bg); border-radius: 12px; padding: 10px 8px; display: grid; gap: 2px; min-width: 0; }
.tile span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.tile b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tile small { font-size: 12px; color: var(--muted); }
.legend.inline { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; }
.legend.inline li { display: flex; gap: 6px; align-items: center; }
.semrow { display: grid; gap: 6px; width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 0; cursor: pointer; }
.semrow[aria-current="true"] .semname::after { content: " ●"; color: var(--accent); }
.semrow .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.semname { font-weight: 600; }
.semrow .nums { font-size: 13px; color: var(--muted); }
.semrow .nums b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 2px; height: 12px; }
.stack i { display: block; height: 100%; background: var(--c); min-width: 0; }
.stack i:first-child { border-radius: 4px 0 0 4px; }
.stack i:last-child { border-radius: 0 4px 4px 0; }
.stack i:only-child { border-radius: 4px; }
.trend { position: relative; touch-action: pan-y; }
.trend svg { width: 100%; height: auto; display: block; overflow: visible; }
.trend .grid line { stroke: var(--line); stroke-width: 1; }
.trend .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.trend .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .pt { stroke: var(--card); stroke-width: 2; }
.trend .lbl { font-size: 11px; font-weight: 600; font-family: var(--font); fill: var(--ink); }
.trend .xh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.trend-read { font-size: 13px; color: var(--muted); min-height: 1.4em; margin: 6px 0 0; font-variant-numeric: tabular-nums; }

/* units editor */
.unit { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.unit-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unit-head .muted { white-space: nowrap; }
.unit-head .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--uc); flex-shrink: 0; }
.unit-head b { flex: 1; min-width: 0; }
.unit-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.unit-meta b { color: var(--ink); }
.unit-form { margin-top: 6px; }
.colors { display: flex; gap: 6px; flex-wrap: wrap; }
.colors button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; background: var(--uc); cursor: pointer; }
.colors button[aria-pressed="true"] { border-color: var(--ink); }
.total { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.preview-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.preview-row b { display: block; font-size: 14px; }

/* sheet */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 600px; background: var(--card); color: var(--ink); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); }
.sheet::backdrop { background: rgba(10, 8, 20, .45); }
.sheet-in { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.sheet-head { display: grid; grid-template-columns: 12px 1fr 40px; gap: 10px; align-items: center; }
.sheet-head .dot { width: 12px; height: 32px; border-radius: 4px; background: var(--uc); }
.sheet-value { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sheet-value b { font-size: 28px; font-variant-numeric: tabular-nums; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.status-grid button { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; font: inherit; font-size: 13px; font-weight: 500; padding: 10px 4px; cursor: pointer; min-height: 44px; }
.status-grid button[aria-pressed="true"] { background: var(--sc); border-color: var(--sc); color: var(--on-fill); }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabbar-in { max-width: 600px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar button { white-space: nowrap; border: 0; background: none; font: inherit; font-size: 11px; color: var(--muted); padding: 8px 0 6px; display: grid; justify-items: center; gap: 2px; cursor: pointer; min-height: 52px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* lock */
.lock { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.lock-card { width: 100%; max-width: 380px; padding: 20px; }
.lock-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lock-top select { width: auto; font-size: 14px; padding: 6px 8px; }
.lock-icon { border-radius: 11px; }
.lock .btn.primary { width: 100%; margin-top: 8px; min-height: 46px; }

/* footer notes */
.foot { font-size: 12px; color: var(--muted); line-height: 1.5; padding: 4px 4px 8px; }
.foot p { margin: 0 0 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Phones and tablets (touch): every tap target at least 44 × 44 px, form text at least 16px */
@media (pointer: coarse) {
  .btn, .btn.small, .chip, .weeklabel, .seg button, .quick button, .status-grid button, .tabbar button { min-height: 44px; }
  .btn.icon { width: 44px; height: 44px; }
  .weeknav { grid-template-columns: 44px 1fr 44px; }
  .quick { gap: 6px; }
  .quick button { min-width: 44px; padding: 4px 10px; }
  .colors button { width: 44px; height: 44px; }
  details > summary { min-height: 44px; display: flex; align-items: center; }
  select, input:not([type="checkbox"]):not([type="range"]) { min-height: 44px; }
  input[type="checkbox"] { width: 24px; height: 24px; }
  .switch, .check { min-height: 44px; }
  textarea { font-size: 16px; }
  .semrow { min-height: 44px; }
}


/* ================= UI pass 2 (2026-11-05): conventions shared with Payclock ================= */
/* header: icon, name and today's date; round avatar opens Settings → Account */
.brand > div { display: grid; line-height: 1.2; }
.brand .name { font-weight: 600; font-size: 17px; }
.brand .date { font-size: 12px; color: var(--muted); font-weight: 400; }
.brand img { border-radius: 9px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; flex: none; }
/* home hero */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 16px 18px 18px; display: grid; gap: 4px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; inset: -40% -30% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--waste) 16%, transparent), transparent 70%); pointer-events: none; }
.hero > * { position: relative; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.pill.soft { cursor: default; background: var(--accent-soft); border-color: transparent; }
.hero .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.hero-num { font-size: 42px; line-height: 1.1; letter-spacing: -.02em; font-weight: 600; color: var(--waste-ink); font-variant-numeric: tabular-nums; }
.hero-num.plain { color: var(--ink); }
.hero .btn.wide { width: 100%; margin-top: 10px; min-height: 46px; }
/* folded detail cards on Home */
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 44px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; margin: 0 4px 0 auto; flex: none; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold[open] > summary { margin-bottom: 10px; }
.sum-t { font-weight: 600; font-size: 16px; color: var(--ink); }
.sum-v { font-size: 13px; color: var(--muted); margin-left: auto; text-align: right; }
/* settings sections */
details.section { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
details.section > summary { color: var(--ink); list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t c" "s c"; gap: 0 10px; padding: 14px 16px; min-height: 56px; align-items: center; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: ""; grid-area: c; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
details.section[open] > summary::after { transform: rotate(-135deg); }
.sec-t { grid-area: t; font-weight: 600; font-size: 16px; }
.sec-s { grid-area: s; font-size: 13px; color: var(--muted); }
details.section[open] .sec-s { display: none; }
.sec-b { padding: 0 16px 16px; }
/* "+ Add" forms fold under their list */
details.add { margin-top: 8px; }
details.add > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent); cursor: pointer; min-height: 44px; }
details.add > summary::-webkit-details-marker { display: none; }
details.add > summary::before { content: "+"; font-size: 18px; line-height: 1; }
details.add[open] > summary::before { content: "−"; }
/* toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); opacity: 0; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); text-align: center; transition: opacity .2s, transform .2s; box-shadow: 0 6px 20px rgb(0 0 0 / .2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* footer */
.foot ul { margin: 4px 0 8px; padding-left: 18px; }
.foot li { margin: 2px 0; }
.foot-calc > summary { cursor: pointer; font-weight: 600; color: var(--ink); min-height: 44px; display: flex; align-items: center; }
.legal b { color: var(--ink); }
.copy { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; display: grid; gap: 2px; }
.copy p { margin: 0; }
.copy b { color: var(--ink); }
@media (pointer: coarse) { .pill { min-height: 44px; } .avatar { width: 44px; height: 44px; } }
