:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1d232b;
  --muted: #66707c;
  --line: #e4e2db;
  --brand: #0f5a8a;
  --brand-ink: #ffffff;
  --brand-soft: #e5f0f7;
  --ok: #1e7a45;
  --ok-soft: #e3f3e9;
  --warn: #a35b00;
  --warn-soft: #fbefdc;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --line-green: #06c755;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 2px 8px rgba(20, 30, 40, .05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-head { background: var(--brand); color: var(--brand-ink); padding: 20px 0 18px; }
.site-head h1 { margin: 0; font-size: 1.45rem; letter-spacing: .02em; }
.site-head p { margin: 6px 0 0; opacity: .92; font-size: .95rem; white-space: pre-line; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .95rem;
  min-height: 40px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-line { background: var(--line-green); border-color: var(--line-green); color: #fff; }
.btn-danger { color: var(--bad); border-color: #efc2be; background: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.45); color: #fff; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .85rem; }

/* Account bar */
.account { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #cfd8df; object-fit: cover; flex: none; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; margin: 14px 0; }
.panel h2 { margin: 0 0 6px; font-size: 1.05rem; }
.mine { border-color: #9cc9a9; background: var(--ok-soft); }
.mine .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .78rem; color: var(--muted); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Filters */
.filters { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 0 8px; border-bottom: 1px solid var(--line); }
.filter-row { display: flex; gap: 8px; }
.filter-row select, .filter-row input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; min-height: 44px; }
.filter-row select { flex: 0 0 auto; max-width: 42%; }
.filter-row input { flex: 1; min-width: 0; }
.chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.result-count { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }

/* Station list */
.list { list-style: none; margin: 8px 0 40px; padding: 0; display: grid; gap: 8px; }
.st { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.st.is-mine { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.st-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.code { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); background: var(--brand-soft);
  border-radius: 6px; padding: 0 6px; font-size: .85rem; }
.st-name { font-weight: 650; }
.st-meta { font-size: .85rem; color: var(--muted); grid-column: 1; }
.st-meta a { color: var(--muted); }
.st-note { font-size: .82rem; color: var(--warn); grid-column: 1; }
.st-side { grid-column: 2; grid-row: 1 / span 3; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.slots { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #b8c0c8; }
.dot.on { background: var(--ok); border-color: var(--ok); }
.full .dot.on { background: var(--muted); border-color: var(--muted); }
.tag { font-size: .75rem; border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.tag-empty { background: var(--bad-soft); color: var(--bad); }
.tag-part { background: var(--warn-soft); color: var(--warn); }
.tag-full { background: #eceef0; color: var(--muted); }
.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }
.sentinel { height: 1px; }

/* Modal */
dialog { border: none; border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 24px)); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20, 25, 30, .45); }
.dlg { padding: 18px 18px 16px; }
.dlg h3 { margin: 0 0 8px; font-size: 1.1rem; }
.dlg p { margin: 0 0 10px; color: var(--muted); font-size: .93rem; white-space: pre-line; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-size: .88rem; font-weight: 600; }
.field input, .field textarea, .field select { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; width: 100%; }
.field small { color: var(--muted); font-size: .8rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: .92rem; z-index: 100; max-width: calc(100vw - 32px);
  box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.error { background: var(--bad); }
.hidden { display: none !important; }
.loading { text-align: center; padding: 40px 0; color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 10px 0 30px; }
