:root {
  --bg: #FFF3E8; --card: #FFFFFF; --ink: #24190F; --muted: #7A6A5C; --line: #E8D9C8; --primary: #E21B4A;
  --chip: #F6E7D6; --ok: #2E7D32; --warn: #E65100; --bad: #C62828; --pill-text: #fff;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1B1410; --card: #2A201A; --ink: #F5E9DC; --muted: #B7A595; --line: #43362C; --chip: #3A2D24; --warn: #FFB74D; --bad: #FF8A80; --ok: #81C784; --pill-text: #2B0F00; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang HK", "Noto Sans HK", "Microsoft JhengHei", sans-serif; font-size: 15px; line-height: 1.35; padding-bottom: calc(var(--safe-b) + 24px); }
button { font: inherit; color: inherit; cursor: pointer; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 10px) 14px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar .tt { flex: 1; min-width: 0; }
.bar h1 { margin: 0; font-size: 20px; letter-spacing: 1px; white-space: nowrap; }
.bar .upd { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 19px; background: var(--chip); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:disabled { opacity: .35; }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.add-btn { border: 0; border-radius: 20px; padding: 9px 16px; background: var(--primary); color: #fff; font-weight: 700; }
main { padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; }
.card { position: relative; display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.card .stripe { width: 6px; flex: none; background: var(--accent); }
.card .body { flex: 1; min-width: 0; padding: 12px 14px 12px 14px; }
.head { display: flex; align-items: center; gap: 8px; }
.head .title { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { flex: none; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.tools { display: flex; flex: none; }
.tools button { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; }
.tools button:disabled { opacity: .25; }
.tools svg { width: 18px; height: 18px; fill: currentColor; }
.sub { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.row + .row { border-top: 1px dashed var(--line); }
.badge { flex: none; min-width: 44px; text-align: center; font-size: 13px; font-weight: 800; padding: 3px 8px; border-radius: 8px; }
.mid { flex: 1; min-width: 0; }
.dest { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { font-size: 12px; color: var(--warn); }
.note.muted { color: var(--muted); }
.platbar { margin: 8px -14px 0; padding: 4px 14px; border-radius: 0; background: #37474F; color: #fff; display: flex; align-items: center; gap: 8px; }  /* 貼住卡片左右邊（抵銷 .body 嘅 14px 內邊距），100% 闊、直角 */
.platbar .pnum { background: #fff; border-radius: 4px; min-width: 24px; text-align: center; padding: 0 7px; font-size: 14px; font-weight: 800; }
.platbar .ptxt { font-size: 13px; font-weight: 800; }
.platbar small { font-size: 11px; opacity: .95; }
.plat { display: inline-block; font-size: 11px; font-weight: 700; background: #37474F; color: #fff; border-radius: 6px; padding: 1px 6px; margin-top: 2px; }
.etaBox { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.eta { font-size: 26px; font-weight: 800; line-height: 1.1; }
.eta small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.eta.near { color: var(--warn); }
.eta .pillEta { display: inline-block; font-size: 17px; padding: 1px 12px; border-radius: 14px; color: var(--pill-text); }
.eta .pillEta.soon { background: var(--bad); font-size: 14px; }
.eta .pillEta.three { background: var(--warn); }
.rest { font-size: 12px; color: var(--muted); }
.dash { font-size: 22px; font-weight: 800; color: var(--muted); }
.msg { font-size: 13px; color: var(--muted); padding: 6px 0; }
.updline { margin-top: 6px; text-align: right; font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.updline.stale { color: var(--bad); }
.updline.src { margin-top: 1px; font-weight: 500; }
.strip { margin: 2px 0 4px; }
.strip svg { width: 100%; height: 26px; display: block; }
.strip .lbl { display: flex; font-size: 11px; color: var(--muted); }
.strip .lbl span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .lbl .me { color: var(--ink); font-weight: 800; text-align: center; }
.strip .lbl .s { text-align: left; } .strip .lbl .e { text-align: right; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.panel h3 { margin: 0 0 2px; font-size: 15px; }
.panel p { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 16px; padding: 6px 13px; }
.chip.on { background: #D8F4EE; border-color: #5BBFAE; color: #0B4F44; font-weight: 700; }
@media (prefers-color-scheme: dark) { .chip.on { background: #17413A; color: #A8EBDD; } }
.switchRow { display: flex; align-items: center; gap: 10px; }
.switchRow .t { flex: 1; }
.sw { position: relative; width: 50px; height: 30px; border-radius: 15px; border: 0; background: var(--line); flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: transform .15s; }
.sw.on { background: var(--primary); } .sw.on::after { transform: translateX(20px); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 12px; }
.foot { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 8px 0; }
/* 加入畫面 */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; padding-bottom: calc(var(--safe-b) + 24px); }
.sheet .bar h1 { font-size: 18px; }
.sheet .wrap { max-width: 640px; margin: 0 auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.search { width: 100%; padding: 12px 14px; font: inherit; color: var(--ink); background: var(--chip); border: 0; border-radius: 14px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; width: 100%; border: 0; background: transparent; text-align: left; }
.item + .item { border-top: 1px solid var(--line); }
.item .main { flex: 1; min-width: 0; }
.item .l1 { font-size: 15px; } .item .l2 { font-size: 12px; color: var(--muted); }
.item .num { width: 26px; text-align: right; color: var(--muted); font-size: 13px; flex: none; }
.hint { font-size: 13px; color: var(--muted); padding: 4px 2px; }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal .box { width: 100%; max-width: 560px; background: var(--card); border-radius: 20px 20px 0 0; padding: 18px 16px calc(var(--safe-b) + 18px); display: flex; flex-direction: column; gap: 12px; }
.modal h2 { margin: 0; font-size: 17px; }
.modal input[type=text] { padding: 11px 12px; font: inherit; color: var(--ink); background: var(--chip); border: 1px solid var(--line); border-radius: 12px; }
.modal .btns { display: flex; gap: 10px; justify-content: flex-end; }
.btn { border: 0; border-radius: 20px; padding: 10px 18px; background: var(--chip); font-weight: 600; }
.btn.primary { background: var(--primary); color: #fff; }
