/* ============================================================
   高雄公民監票 — 中立配色（墨黑＋紫灰點綴，不使用任何政黨代表色）
   ============================================================ */
:root {
  --bg: #f4f4f6; --bg-2: #ebebf0; --card: #ffffff; --ink: #17181c; --ink-2: #2b2d35;
  --muted: #62646f; --line: #e3e3ea; --line-2: #d2d2dc;
  --brand: #23252d; --brand-2: #3a3d49; --accent: #5b4fc4; --accent-soft: #eeecfb; --accent-ink: #3d3392;
  --brand-soft: #eeecfb;
  --l0: #d9480f; --l1: #c78a00; --l2: #2f8f5b; --mine: #5b4fc4;
  --danger: #c0262d; --danger-soft: #fdeeee; --warn-soft: #fff7e2;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 4px 16px rgba(20, 20, 30, .05);
  --shadow-lg: 0 12px 40px rgba(20, 20, 30, .18);
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); line-height: 1.6; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 900px) { .wrap { padding: 0 28px; } }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .45em; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 6.2vw, 46px); font-weight: 800; }
h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 19px; font-weight: 800; padding-right: 36px; }
.muted { color: var(--muted); font-size: 14px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- 頂端列 ---------- */
.top { background: rgba(23, 24, 28, .96); backdrop-filter: saturate(1.4) blur(8px); color: #fff; position: sticky; top: 0; z-index: 1000; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; }
.top-in > div, .top-in > span { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.brand { color: #fff; text-decoration: none; font-weight: 800; display: flex; gap: 10px; align-items: center; font-size: 17px; white-space: nowrap; }
.logo { width: 32px; height: 32px; border-radius: 9px; display: block; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2); }
.top .btn.light { background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .22); }
.top .btn.light:hover { background: rgba(255, 255, 255, .22); }

/* ---------- 首頁主視覺 ---------- */
.hero { padding: 26px 0 8px; }
.hero-grid { display: grid; gap: 18px; }
@media (min-width: 900px) {
  .hero { padding: 44px 0 18px; }
  .hero-grid { grid-template-columns: 1.15fr 1fr; align-items: end; gap: 36px; }
}
.eyebrow { display: inline-block; color: var(--accent-ink); background: var(--accent-soft); font-weight: 700; font-size: 13px; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; }
.lead { color: var(--muted); margin: 0 0 14px; font-size: 16px; max-width: 34em; }
@media (min-width: 900px) { .lead { font-size: 17px; } }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.hero-actions .btn { flex: 1 1 200px; }
@media (min-width: 900px) { .hero-actions .btn { flex: 0 0 auto; } }

.phase { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.phase div { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow); }
.phase div.now { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.phase div.now::after { content: "進行中"; position: absolute; top: -9px; right: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.phase b { display: block; font-size: 14px; color: var(--ink); margin-bottom: 2px; }
@media (max-width: 480px) { .phase { grid-template-columns: 1fr; } .phase div { display: flex; justify-content: space-between; align-items: center; } .phase b { margin: 0; } }

/* ---------- 版面：手機單欄；電腦左側「我的監票」＋須知，右側選投開票所 ---------- */
.layout { display: grid; gap: 16px; grid-template-areas: "mine" "pick" "guide"; padding-bottom: 8px; }
.layout > #mine { grid-area: mine; }
.layout > .pick { grid-area: pick; }
.layout > .guide { grid-area: guide; }
@media (min-width: 980px) {
  .layout { grid-template-columns: minmax(340px, 400px) 1fr; grid-template-areas: "mine pick" "guide pick"; align-items: start; gap: 22px; }
  .layout > .pick { grid-row: 1 / span 2; }
}

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0; box-shadow: var(--shadow); }
@media (min-width: 900px) { .card { padding: 22px 24px; } }
main > .card, .stack > .card { margin: 16px 0; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sec-head h2 { margin: 0; }

/* ---------- 按鈕 ---------- */
.btn { appearance: none; border: 1.5px solid transparent; border-radius: 12px; padding: 11px 18px; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px;
  transition: background .15s, border-color .15s, transform .05s; text-align: center; line-height: 1.3; }
.btn:hover { background: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--bg); border-color: var(--ink-2); }
.btn.light { background: #fff; color: var(--ink); }
.btn.warn { background: var(--card); color: var(--danger); border-color: #efb5b8; }
.btn.warn:hover { background: var(--danger-soft); }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: var(--accent-ink); }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; margin-top: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .btn { flex: 1 1 150px; }
.row > .btn.sm { flex: 0 0 auto; }

/* ---------- 篩選 ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.filters .grow { grid-column: 1 / -1; }
@media (min-width: 700px) { .filters { grid-template-columns: 1fr 1fr 1.3fr; } .filters .grow { grid-column: auto; } }
@media (min-width: 980px) and (max-width: 1180px) { .filters { grid-template-columns: 1fr 1fr; } .filters .grow { grid-column: 1 / -1; } }
.filters label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; font-weight: 600; }
select, input, textarea { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 11px; background: #fff; color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 79, 196, .18); }
select:disabled { background: var(--bg); color: var(--muted); }
textarea { min-height: 120px; resize: vertical; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 36px; color: var(--ink-2); }
.chip:hover { border-color: var(--ink-2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.l0 { background: var(--l0); } .l1 { background: var(--l1); } .l2 { background: var(--l2); }
.summary { font-size: 14px; color: var(--muted); margin: 12px 0 6px; padding: 8px 12px; background: var(--bg); border-radius: 10px; }

/* ---------- 投開票所清單 ---------- */
.map { height: 340px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 12px; z-index: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.item { display: flex; gap: 12px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 13px 4px; }
.list > .item:first-child { border-top: 0; }
.item > div:first-child { min-width: 0; flex: 1; }
.item.pinned { background: var(--accent-soft); border-radius: 12px; padding: 13px 14px; border: 1px solid #d2ccf5; margin-bottom: 6px; }
.item.hl { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.item .meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item .nm { font-weight: 700; cursor: pointer; font-size: 16px; }
.item .nm:hover { color: var(--accent-ink); }
.pick .list .item > div:last-child .btn { min-width: 72px; }
.lvl { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; margin-top: 3px; }
.lvl.l0 { color: var(--l0); background: #fdeee6; } .lvl.l1 { color: #8a6000; background: #fdf3d6; } .lvl.l2 { color: var(--l2); background: #e4f3ea; }
.item > div:last-child > .lvl { margin: 0; color: var(--accent-ink) !important; background: var(--accent-soft); }

/* ---------- 我的監票地點 ---------- */
.mine { border: 1.5px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.mine h2 { margin-bottom: 6px; }
.mine .badge { display: inline-block; background: var(--ink); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 11px; border-radius: 999px; margin-top: 4px; }
.mine .big { font-size: 22px; font-weight: 800; margin: 8px 0 2px; line-height: 1.3; }
.mine .list .item { flex-wrap: wrap; }
.mine .list .item > .row { flex-wrap: wrap; }
.progress { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin: 12px 0 4px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #8a7fe0); border-radius: 99px; }
.notice { background: var(--warn-soft); border: 1px solid #f0dca0; border-radius: 12px; padding: 11px 13px; font-size: 14px; margin: 10px 0; }
.notice .btn { margin-top: 8px; }
.notice.ok { background: #e9f6ef; border-color: #bfe2cd; }
.notice.bad { background: var(--danger-soft); border-color: #f2bcbf; color: #7a1a1f; }

/* ---------- 須知、頁尾 ---------- */
.guide ul { padding-left: 1.2em; margin: 0 0 10px; }
.guide li { margin: 7px 0; }
.guide li::marker { color: var(--accent); }
.foot { font-size: 13px; color: var(--muted); padding: 18px 0 44px; text-align: center; }
.foot p { max-width: 46em; margin: 0 auto; }

/* ---------- 彈出視窗 ---------- */
.sheet { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(15, 15, 22, .5); animation: fade .2s; }
.sheet-box { position: relative; background: #fff; width: 100%; max-width: 580px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 26px 20px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .22s ease-out; }
.sheet-box::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line-2); }
@media (min-width: 640px) {
  .sheet { align-items: center; padding: 20px; }
  .sheet-box { border-radius: 22px; padding: 28px 28px 24px; animation: pop .18s ease-out; }
  .sheet-box::before { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
@keyframes pop { from { transform: scale(.97); opacity: .6; } }
.x { position: absolute; right: 10px; top: 10px; border: 0; background: var(--bg); border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); width: 38px; height: 38px; }
.x:hover { background: var(--bg-2); color: var(--ink); }
.field { margin: 14px 0; }
.field > span { display: block; font-weight: 800; margin-bottom: 6px; }
.field small { color: var(--muted); display: block; margin-top: 3px; }
.cand { display: grid; grid-template-columns: 1fr 128px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.cand .nm { display: flex; align-items: center; gap: 8px; font-weight: 700; flex-wrap: wrap; }
.cand input { text-align: right; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cand .prev { grid-column: 1 / -1; font-size: 12px; color: var(--muted); text-align: right; margin-top: -6px; }
.total { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; padding: 10px 0; font-variant-numeric: tabular-nums; }
#fTotal { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
#fTotal.bad { background: var(--danger-soft); }
.total.bad { color: var(--danger); }
.photo-prev { max-width: 100%; border-radius: 12px; margin-top: 8px; border: 1px solid var(--line); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; padding: 12px; background: var(--bg); border-radius: 12px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--accent); }
.practice { background: var(--accent-soft); color: var(--accent-ink); border-radius: 12px; padding: 9px 13px; font-size: 14px; margin-bottom: 12px; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(140px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; z-index: 3000;
  transition: transform .25s; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); font-weight: 600; }
.toast.show { transform: translateX(-50%) translateY(0); }

.leaflet-container { font: inherit; }
.pin { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }

/* ---------- 專屬代碼 ---------- */
.code-box { font: 800 clamp(32px, 10vw, 44px)/1.15 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .12em; text-align: center; padding: 22px 8px; margin: 14px 0;
  border: 2px dashed var(--accent); border-radius: 16px; background: linear-gradient(180deg, #faf9ff, var(--accent-soft)); color: var(--ink); user-select: all; }
.code-sm { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; background: #fff; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line-2); }
.code-in { width: 100%; font: 700 26px ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .14em; text-align: center; text-transform: uppercase; padding: 12px; }

/* ---------- 後台 ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1050px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow); font-weight: 600; }
.kpi b { display: block; font-size: 26px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; }
.admin-grid { display: grid; gap: 16px; margin: 16px 0; }
@media (min-width: 1050px) { .admin-grid { grid-template-columns: 1fr 1fr; align-items: start; } .admin-grid > .span2 { grid-column: 1 / -1; } }
.bar { height: 22px; display: flex; border-radius: 7px; overflow: hidden; background: var(--bg-2); }
.bar span { display: block; height: 100%; }
.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--bg); position: sticky; top: 0; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; white-space: nowrap; }
tr:hover td { background: #fafafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.flag { color: var(--danger); font-weight: 700; white-space: normal; }

/* ---------- 詳細監票流程頁 ---------- */
.guide-layout { display: grid; gap: 16px; padding-bottom: 40px; }
@media (min-width: 980px) { .guide-layout { grid-template-columns: 240px 1fr; gap: 28px; align-items: start; } }
.guide-nav { position: sticky; top: 58px; z-index: 5; margin: 0 -16px; padding: 10px 16px; background: rgba(244, 244, 246, .94); backdrop-filter: blur(6px); overflow-x: auto; }
.guide-nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; white-space: nowrap; }
.guide-nav a { display: block; padding: 6px 13px; border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 600; background: var(--card); }
.guide-nav a:hover { border-color: var(--accent); color: var(--accent-ink); }
@media (min-width: 980px) {
  .guide-nav { top: 82px; margin: 0; padding: 0; background: none; backdrop-filter: none; overflow: visible; }
  .guide-nav ul { flex-direction: column; white-space: normal; gap: 2px; }
  .guide-nav a { border: 0; background: none; border-radius: 10px; padding: 8px 12px; }
  .guide-nav a:hover { background: var(--card); }
}
.guide-body { display: grid; gap: 16px; min-width: 0; }
.guide-body .card h2 { scroll-margin-top: 130px; display: flex; align-items: center; gap: 10px; }
.guide-body .card h2 .n { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 15px; }
.guide-body ul { padding-left: 1.2em; margin: 6px 0; }
.guide-body li { margin: 6px 0; }
.guide-body li::marker { color: var(--accent); }
.steps { counter-reset: s; list-style: none; padding: 0 !important; margin: 6px 0; display: grid; gap: 4px; }
.steps > li { counter-increment: s; position: relative; padding: 2px 0 12px 44px; margin: 0 !important; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; }
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 2px; width: 2px; background: var(--accent-soft); }
.steps b { display: block; margin-bottom: 2px; }
.time { display: grid; grid-template-columns: 100px 1fr; margin: 4px 0; border-left: 2px solid var(--accent-soft); }
.time dt { font-weight: 800; font-variant-numeric: tabular-nums; padding: 8px 0 8px 14px; color: var(--accent-ink); }
.time dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.time dt { border-bottom: 1px solid var(--line); }
@media (max-width: 480px) { .time { grid-template-columns: 1fr; } .time dt { border-bottom: 0; padding-bottom: 0; } .time dd { padding-left: 14px; } }
.faq p { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.faq p:first-of-type { border-top: 0; }
.sec-head label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.sec-head label select { width: auto; max-width: min(360px, 70vw); }

/* ---------- 後台手機版 ---------- */
.admin-grid > *, #dash > * { min-width: 0; }
@media (max-width: 640px) {
  .admin-main { padding: 0 12px; }
  .admin-top #updated { font-size: 11px !important; text-align: right; line-height: 1.3; }
  .kpis { gap: 8px; }
  .kpi { padding: 10px 12px; font-size: 12px; border-radius: 12px; }
  .kpi b { font-size: 20px; }
  .admin-grid { gap: 12px; margin: 12px 0; }
  .admin-grid .card { padding: 16px 14px; }
  .sec-head { align-items: flex-start; }
  .sec-head label { width: 100%; flex-direction: column; align-items: stretch; gap: 4px; }
  .sec-head label select { max-width: none; width: 100%; }
  .admin-grid .row > input, .admin-grid .row > select { flex: 1 1 100% !important; }
  .admin-grid .row > .btn { flex: 1 1 100% !important; }
  #issues .item > div { width: 100%; }
  #issues .isSt { max-width: none !important; flex: 1 1 100%; }
  /* 表格改成一筆一張卡片 */
  table.cards tr:first-child:has(th) { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin: 0 0 10px; background: #fff; }
  table.cards td { border: 0; padding: 5px 0; white-space: normal; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.cards td::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; flex: none; }
  table.cards td:empty { display: none; }
  table.cards td.num { text-align: right; }
  table.cards tr:hover td { background: none; }
}
@media (max-width: 640px) { table.cards td.muted { justify-content: flex-start; text-align: left; } #distTbl th, #distTbl td { padding: 8px 6px; font-size: 13px; } }
.brand-domain { font-size: 12px; font-weight: 600; opacity: .7; letter-spacing: .02em; margin-left: 2px; align-self: center; }
#siteTitle { display: inline-flex; gap: 6px; align-items: baseline; }
@media (max-width: 340px) { .brand-domain { display: none; } }

/* ---------- 高雄元素：港都天際線、海浪分隔線 ---------- */
.hero-side { display: grid; gap: 10px; }
.skyline { display: block; width: 100%; height: auto; max-height: 150px; object-fit: contain; object-position: bottom; }
@media (max-width: 899px) { .skyline { max-height: 96px; } .hero-side { margin-top: 4px; } }
.lead b { color: var(--ink); font-variant-numeric: tabular-nums; }
.wave-line { height: 14px; margin: 14px 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='14' viewBox='0 0 60 14'%3E%3Cpath d='M0 7q7.5-6 15 0t15 0t15 0t15 0' stroke='%239d93ff' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center; opacity: .8; }
.foot .wave-line { margin: 0 auto 12px; max-width: 360px; }
.foot-tag { font-weight: 800; color: var(--accent-ink); font-size: 15px; margin-bottom: 8px !important; letter-spacing: .04em; }

/* ---------- 後台選單 ---------- */
.admin-shell { display: grid; gap: 16px; margin: 16px 0 40px; }
.admin-nav { display: flex; gap: 6px; overflow-x: auto; position: sticky; top: 58px; z-index: 50; margin: 0 -12px; padding: 8px 12px; background: rgba(244, 244, 246, .95); backdrop-filter: blur(6px); scrollbar-width: none; }
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a { flex: none; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: 14px; border: 1px solid var(--line-2); background: var(--card); white-space: nowrap; }
.admin-nav a:hover { border-color: var(--accent); color: var(--accent-ink); }
.admin-nav a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-nav a.danger { color: var(--danger); }
.admin-nav a.danger.on { background: var(--danger); color: #fff; border-color: var(--danger); }
.admin-panels { min-width: 0; }
.kpi-title { margin: 18px 0 8px; font-size: 15px; color: var(--muted); }
@media (min-width: 900px) {
  .admin-shell { grid-template-columns: 190px 1fr; align-items: start; gap: 24px; }
  .admin-nav { flex-direction: column; top: 80px; margin: 0; padding: 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
  .admin-nav a { border: 0; border-radius: 10px; padding: 10px 14px; background: none; }
  .admin-nav a:hover { background: var(--bg); }
}
#cdTbl td[data-l="投開票所"], #lgTbl td[data-l="裝置"] { white-space: normal; min-width: 160px; }

/* ---------- 浮動按鈕：LINE 社群 ---------- */
.community-fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 1500;
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px 11px 13px; border-radius: 999px; background: var(--ink); color: #fff;
  text-decoration: none; font-weight: 800; font-size: 14px; box-shadow: 0 8px 24px rgba(20, 20, 30, .28); border: 1px solid rgba(255, 255, 255, .14); }
.community-fab svg { color: #b9b1f6; flex: none; }
.community-fab:hover { background: var(--accent-ink); }
body:has(.sheet:not([hidden])) .community-fab { display: none; }
@media (max-width: 480px) { .community-fab { padding: 10px 14px 10px 11px; font-size: 13px; } }
/* 頁尾留出空間，避免浮動按鈕蓋住最後一行 */
.foot { padding-bottom: 90px; }

.dev-contact { margin-top: 10px !important; font-size: 13px; color: var(--muted); }
.dev-contact a { color: var(--accent-ink); font-weight: 700; }

/* 主標題旁的正字 LOGO */
.hero-title { display: flex; align-items: center; gap: .32em; }
.hero-logo { width: 1.25em; height: 1.25em; flex: none; border-radius: 22%; box-shadow: 0 6px 18px rgba(61, 51, 146, .25); }
@media (max-width: 360px) { .hero-title { gap: .25em; } .hero-logo { width: 1.1em; height: 1.1em; } }

/* 首頁即時志工人數 */
.live-count { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 15px; color: var(--ink-2); }
.live-count b { color: var(--accent-ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.live-count .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--l2); box-shadow: 0 0 0 0 rgba(47, 143, 91, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(47, 143, 91, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 143, 91, 0); } }
@media (prefers-reduced-motion: reduce) { .live-count .pulse { animation: none; } }
.seq-banner { margin: 4px 0 10px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, var(--accent-soft), #fff); border: 1px solid #d2ccf5; font-size: 16px; font-weight: 700; color: var(--ink); text-align: center; }
.seq-banner b { font-size: 24px; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.seq-big { padding: 22px 14px; font-size: 18px; line-height: 1.6; }
.seq-big b { font-size: 40px; display: inline-block; margin: 0 4px; }
.seq-big small { font-size: 14px; color: var(--muted); font-weight: 600; }
.drill-bar { position: sticky; top: 0; z-index: 2500; background: var(--danger); color: #fff; text-align: center; font-weight: 800; font-size: 14px; padding: 8px 12px; }
#flagTbl td.flag { min-width: 180px; }

/* ---------- 後台：電腦版左側固定側欄 ---------- */
.admin-nav .nav-brand, .admin-nav .nav-foot { display: none; }
@media (min-width: 900px) {
  body.admin-page.authed .admin-top { display: none; }
  body.admin-page.authed .admin-main { max-width: none !important; margin: 0 0 0 232px; padding: 0 32px; }
  body.admin-page.authed .admin-shell { display: block; margin: 24px 0 48px; }
  body.admin-page.authed .admin-nav {
    position: fixed; left: 0; top: 0; bottom: 0; width: 232px; margin: 0; padding: 18px 14px; z-index: 900;
    display: flex; flex-direction: column; gap: 4px; border: 0; border-radius: 0; box-shadow: none;
    background: var(--ink); overflow-y: auto;
  }
  body.admin-page.authed .admin-nav .nav-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; margin-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, .12); color: #fff; font-weight: 800; font-size: 17px; }
  body.admin-page.authed .admin-nav .nav-brand img { border-radius: 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2); }
  body.admin-page.authed .admin-nav a:not(.nav-brand) { color: rgba(255, 255, 255, .78); padding: 11px 14px; border-radius: 10px; font-size: 15px; }
  body.admin-page.authed .admin-nav a:not(.nav-brand):hover { background: rgba(255, 255, 255, .08); color: #fff; }
  body.admin-page.authed .admin-nav a.on { background: var(--accent); color: #fff; }
  body.admin-page.authed .admin-nav a.danger { color: #ff9b9f; }
  body.admin-page.authed .admin-nav a.danger.on { background: var(--danger); color: #fff; }
  body.admin-page.authed .admin-nav .nav-foot { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .6); font-size: 12px; }
  body.admin-page.authed .admin-nav .nav-foot .btn { width: 100%; }
  body.admin-page.authed .drill-bar { margin-left: 232px; }
}
@media (min-width: 900px) { body.admin-page.authed .admin-nav .nav-brand, body.admin-page.authed .admin-nav .nav-brand:hover { background: none; color: #fff; border-radius: 0; } }

/* 首頁公開開票統計 */
.pub-results { margin: 8px 0 20px; border: 1.5px solid var(--accent); }
.pub-results h2 small { font-size: 13px; font-weight: 600; }
.res-pick { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.res-pick select { width: auto; max-width: min(320px, 70vw); }
.res-row { margin: 10px 0; }
.res-row .total { padding: 2px 0; font-weight: 700; }
.res-note { margin-top: 12px; font-size: 13px; }
@media (max-width: 640px) { .res-pick { width: 100%; flex-direction: column; align-items: stretch; } .res-pick select { max-width: none; width: 100%; } }

/* 後台開關 */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 800; font-size: 15px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch .track { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--line-2); transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .15s; }
.switch input:checked + .track { background: var(--l2); }
.switch input:checked + .track::after { left: 25px; }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
/* 網站風格的提示框（取代瀏覽器內建 alert／confirm） */
.ui-dialog { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ui-dialog-bg { position: absolute; inset: 0; background: rgba(15, 15, 22, .5); animation: fade .15s; }
.ui-dialog-box { position: relative; width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 22px 22px 18px; box-shadow: var(--shadow-lg); animation: pop .15s ease-out; }
.ui-dialog-box h3 { padding: 0; margin-bottom: 8px; }
.ui-dialog-box p { margin: 0 0 14px; font-size: 16px; line-height: 1.6; color: var(--ink); white-space: normal; overflow-wrap: anywhere; }
.ui-dialog-input { margin-bottom: 14px; font-size: 18px; }
.ui-dialog-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ui-dialog-btns .btn { min-width: 96px; }
.btn.danger-solid { background: var(--danger); }
.btn.danger-solid:hover { background: #9c1c22; }
@media (max-width: 480px) { .ui-dialog { align-items: flex-end; padding: 12px; } .ui-dialog-btns .btn { flex: 1 1 0; } }

/* ---------- 後台：開票進度看板 ---------- */
.pg-done { background: var(--l2); } .pg-live { background: var(--accent); } .pg-none { background: #c9cbd3; }
.pg-bar { height: 34px; display: flex; border-radius: 9px; overflow: hidden; background: var(--bg-2); align-items: stretch; }
.pg-bar span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.pg-bar span.pg-none { color: var(--ink); }
.pg-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.pg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pg-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #fff; white-space: nowrap; }
.pg-tag.pg-none { color: var(--ink); }
.pg-note { background: var(--warn-soft); border: 1px solid #f0dca0; border-radius: 12px; padding: 10px 13px; margin: 0 0 14px; color: var(--ink); }
.kpi.ok b { color: var(--l2); } .kpi.warn b { color: #a06b00; } .kpi.bad b { color: var(--danger); }
.kpi b small { font-size: 14px; font-weight: 600; color: var(--muted); }
textarea.ui-dialog-input { width: 100%; font-size: 14px; line-height: 1.5; resize: vertical; }

/* ---------- 圖卡使用教學（監票流程頁） ---------- */
.cards-tut { margin-bottom: 18px; scroll-margin-top: 80px; }
.tut-ctl { display: flex; align-items: center; gap: 8px; }
.tut-ctl .btn { min-width: 40px; font-size: 20px; line-height: 1; padding: 6px 10px; }
.tut-n { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); min-width: 44px; text-align: center; }
.tut-track { list-style: none; margin: 4px 0 0; padding: 0 0 10px; display: grid; grid-auto-flow: column; grid-auto-columns: min(82%, 360px); column-gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tut-track:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.tut-track li { scroll-snap-align: start; }
.tut-track a { display: block; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); background: #f4efe6; }
.tut-track img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; }
.tut-tip { margin: 6px 0 0; font-size: 13px; }
@media (min-width: 900px) { .tut-track { grid-auto-columns: calc((100% - 28px) / 3); } }

/* ---------- 首頁認領倒數（固定在最上方的橫幅） ---------- */
.cd-banner { background: linear-gradient(90deg, #4b3fb8, #6a4fd0); color: #fff; border-top: 1px solid rgba(255,255,255,.12); }
.cd-banner.urgent { background: linear-gradient(90deg, #b3202a, #d9480f); }
.cd-in { display: flex; align-items: center; justify-content: center; gap: 6px 14px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.cd-title { font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 7px; letter-spacing: .04em; }
.cd-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: cdpulse 1.4s infinite; }
@keyframes cdpulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); } 70% { box-shadow: 0 0 0 9px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
.cd-time { display: inline-flex; align-items: baseline; gap: 3px; font-size: 13px; font-weight: 700; }
.cd-time b { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.95); color: #b3202a; border-radius: 7px; padding: 4px 7px; margin-left: 4px; }
.cd-banner:not(.urgent) .cd-time b { color: #3d3392; }
.cd-sub { font-size: 13.5px; opacity: .95; }
.cd-sub b { font-size: 16px; }
.cd-btn { background: #fff; color: #b3202a; font-weight: 800; font-size: 14px; padding: 7px 14px; border-radius: 999px; text-decoration: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.cd-banner:not(.urgent) .cd-btn { color: #3d3392; }
.cd-btn:hover { transform: translateY(-1px); }
@media (max-width: 560px) { .cd-in { gap: 6px 10px; padding-top: 6px; padding-bottom: 7px; } .cd-time b { font-size: 20px; padding: 3px 6px; } .cd-date { display: none; } .cd-sub { font-size: 13px; } .cd-btn { padding: 5px 12px; font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .cd-dot { animation: none; } }

/* ---------- 後台：作廢最後結果 ---------- */
.fin-box { margin-top: 14px; border-color: #f2bcbf; }
.fin-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.fin-votes { margin: 4px 0; font-size: 14px; line-height: 1.8; }

/* ---------- 後台：開票報告表照片牆 ---------- */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 10px 0; }
.ph-item { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.ph-item img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--bg-2); }
.ph-item figcaption { padding: 8px 10px; font-size: 12.5px; line-height: 1.5; }
.ph-none { aspect-ratio: 3 / 4; display: grid; place-items: center; color: var(--muted); background: var(--bg-2); }
.ph-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 4px; align-items: end; }
.ph-filters label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; font-weight: 600; }
.ph-filters .grow { grid-column: 1 / -1; }
.ph-filters input[style*="width"] { width: 100% !important; }
@media (min-width: 900px) { .ph-filters { grid-template-columns: 160px 140px 1fr 110px auto; } .ph-filters .grow { grid-column: auto; } }
#pickTitle, #mine { scroll-margin-top: 140px; }
