:root {
  --font: "Google Sans", "Noto Sans Thai Looped", system-ui, sans-serif;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #dfe4ea;
  --text: #17212b;
  --muted: #5d6b7a;
  --brand: #0f3d5e;
  --brand-soft: #e3eef6;
  --accent: #1b7f4d;
  --warn-bg: #fff4dc;
  --warn: #8a5a00;
  --danger: #c0352b;
  --ok: #1b7f4d;
  --focus: #2f7de1;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141b;
    --surface: #151f29;
    --surface-2: #1b2733;
    --border: #2a3846;
    --text: #e7edf3;
    --muted: #96a5b4;
    --brand: #7cc0f0;
    --brand-soft: #1b3346;
    --accent: #58c58b;
    --warn-bg: #3a2d10;
    --warn: #f3c266;
    --danger: #ff7b6e;
    --ok: #58c58b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tnum { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- แถบด้านบน ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem max(16px, env(safe-area-inset-left)) .6rem max(16px, env(safe-area-inset-right));
  padding-top: max(.6rem, env(safe-area-inset-top));
  background: #0f3d5e; color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { opacity: .75; font-size: .72rem; }
.mainnav { display: none; gap: .25rem; margin-left: auto; }
.mainnav a { color: #dce9f3; text-decoration: none; padding: .45rem .8rem; border-radius: 999px; font-size: .95rem; }
.mainnav a:hover { background: rgba(255, 255, 255, .1); }
.mainnav a.active { background: #fff; color: #0f3d5e; font-weight: 600; }
.clock { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-variant-numeric: tabular-nums; }
.clock-main { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
#clock-time { font-size: 1.1rem; font-weight: 600; }
#clock-date { font-size: .72rem; opacity: .85; white-space: nowrap; }
@media (max-width: 859px) {
  .brand-text small { display: none; }
  .brand-text strong { font-size: .92rem; }
  .clock .chip { font-size: .7rem; padding: .05rem .45rem; }
}
@media (max-width: 380px) { .brand-text { display: none; } }
.clock .chip { background: rgba(255, 255, 255, .15); color: #fff; border: 0; }

.banner { background: var(--warn-bg); color: var(--warn); padding: .5rem 16px; text-align: center; font-size: .9rem; }

main { max-width: 1120px; margin: 0 auto; padding: 1rem 16px calc(var(--tabbar-h) + 1.5rem); outline: none; }
.loading { padding: 3rem 0; text-align: center; color: var(--muted); }

/* ---------- แถบเมนูล่าง (มือถือ) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .75rem; }
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--brand); font-weight: 600; }

@media (min-width: 860px) {
  .mainnav { display: flex; }
  .clock { margin-left: 1rem; }
  .tabbar { display: none; }
  main { padding-bottom: 2rem; }
}

/* ---------- องค์ประกอบทั่วไป ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card + .card { margin-top: 1rem; }
.grid > .card + .card, .kpis > .card + .card, .dir-grid > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.page-head p { margin: 0; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-bg); }
.chip.off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
button.chip { cursor: pointer; }
a.chip { text-decoration: none; color: var(--text); }
a.chip:hover { background: var(--brand-soft); }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .5rem; border-radius: 6px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.code { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6em; padding: .05rem .35rem; border-radius: 6px; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.line-dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; flex: none; }
.line-logo { width: 28px; height: 28px; object-fit: contain; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .55rem 1rem; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; font-size: .95rem; min-height: 42px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: #0f3d5e; border-color: #0f3d5e; color: #fff; }
.btn.primary:hover { background: #154f78; }
.btn.danger { color: var(--danger); }
.btn.small { padding: .3rem .65rem; min-height: 34px; font-size: .85rem; }
.btn.icon { padding: .45rem; min-width: 42px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label.field { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--muted); }
label.field > span { font-weight: 500; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="time"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%; padding: .6rem .75rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); min-height: 44px; font-size: 1rem;
}
textarea { min-height: 90px; resize: vertical; }
input[type="color"] { width: 64px; height: 44px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.check { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: .95rem; }
.check input { width: 20px; height: 20px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: .35rem .9rem; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- ช่องค้นหาสถานี ---------- */
.picker { position: relative; }
.picker-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 340px; overflow: auto; margin: 0; padding: .25rem; list-style: none;
}
.picker-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: 8px; cursor: pointer; }
.picker-list li[aria-selected="true"], .picker-list li:hover { background: var(--brand-soft); }
.picker-list .sub { color: var(--muted); font-size: .82rem; }
.picker-empty { padding: .75rem; color: var(--muted); }
.recent { margin-top: .75rem; }

/* ---------- กระดานเวลาขบวน ---------- */
.station-head { display: flex; gap: .9rem; align-items: center; }
.station-head h1 { margin: 0; font-size: 1.6rem; }
.station-head .en { color: var(--muted); }
.dir-grid { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 720px) { .dir-grid { grid-template-columns: repeat(2, 1fr); } }
.dir-card { border-top: 5px solid var(--line, var(--brand)); }
.dir-card h3 { display: flex; align-items: center; gap: .5rem; }
.next-big { display: flex; align-items: baseline; gap: .6rem; margin: .5rem 0 .25rem; }
.next-big .num { font-size: 2.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.next-big .unit { color: var(--muted); }
.next-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.next-list .t { padding: .25rem .6rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.next-list .t.short { border-style: dashed; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .75rem; margin-top: .75rem; font-size: .9rem; }
.facts div { display: flex; flex-direction: column; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.closed { color: var(--danger); font-weight: 600; }
.transfer-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

/* ---------- ป้ายชานชาลา (สีเหลือง-ดำ แบบป้ายในสถานี) ---------- */
.pf { display: inline-flex; align-items: stretch; vertical-align: middle; border-radius: 8px; overflow: hidden; font-weight: 700; line-height: 1; box-shadow: 0 0 0 2px #1d1d1b; white-space: nowrap; }
.pf-l { background: #ffd400; color: #1d1d1b; padding: .3rem .5rem; font-size: .8rem; display: flex; align-items: center; }
.pf-n { background: #1d1d1b; color: #ffd400; padding: .3rem .55rem; font-size: 1rem; min-width: 1.9em; text-align: center; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
h3 .pf, .mresult .pf { font-size: 1.05em; }
.mdir-pf { margin-top: .35rem; }
.mdir-pf .pf { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.timeline .detail .pf { transform: translateY(-1px); }

/* ผังชานชาลาของสถานีเชื่อมต่อ */
.pfmap { margin-top: 1rem; }
.pfmap h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.pfmap-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; }
.pfmap-list li { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; border: 1px solid var(--border); border-left: 5px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.pfmap-pf { flex: none; }
.pfmap-to { display: flex; flex-direction: column; min-width: 0; }
.pfmap-to strong { overflow-wrap: anywhere; }

/* ---------- มือถือ: เลือกทีละขั้น ---------- */
.mhead { margin: .25rem 0 .75rem; }
.mhead h1 { margin: 0; }
.mhead p { margin: .15rem 0 0; }
.msteps { display: flex; align-items: center; gap: .25rem; margin-bottom: 1rem; }
.mstep { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: .4rem; padding: .4rem .5rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); text-decoration: none; }
.mstep .n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); }
.mstep .t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; font-size: .82rem; }
.mstep .t small { font-size: .68rem; color: var(--muted); }
.mstep .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mstep.done { color: var(--text); }
.mstep.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.mstep.active { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.mstep.active .n { background: var(--brand); border-color: var(--brand); color: var(--surface); }
.msep { color: var(--muted); flex: none; }
.mlast { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: inherit; margin-bottom: 1rem; border-left: 5px solid var(--brand); }
.mlist { display: grid; gap: .6rem; }
.mitem { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; min-height: 64px; background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.mitem:active { background: var(--surface-2); }
.mitem .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chev { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.mstations li { padding-top: .2rem; padding-bottom: .2rem; }
.mstations a { min-height: 48px; }
.mdirs { display: grid; gap: .9rem; }
.mdir { display: flex; flex-direction: column; gap: .2rem; padding: 1.1rem 1.2rem; border-radius: var(--radius); background: var(--line); color: var(--line-text, #fff); text-decoration: none; box-shadow: var(--shadow); min-height: 110px; justify-content: center; }
.mdir:active { transform: scale(.99); }
.mdir-name { font-size: 1.45rem; font-weight: 700; }
.mdir-sub { opacity: .9; font-size: .9rem; }
.mdir-next { margin-top: .35rem; align-self: flex-start; background: rgba(0, 0, 0, .18); padding: .15rem .6rem; border-radius: 999px; font-size: .85rem; }
.mresult { border-top: 6px solid var(--line); }
.mresult-dir { font-size: 1.7rem; margin: .5rem 0 0; }
.mtrains { list-style: none; margin: 1rem 0 .5rem; padding: 0; display: grid; gap: .5rem; }
.mtrains li { display: flex; align-items: center; gap: 1rem; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.mtrains li.first { border: 2px solid var(--line); }
.mt-min { min-width: 4.5rem; font-size: 1.9rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.mtrains li.first .mt-min { font-size: 2.6rem; }
.mt-min small { font-size: .85rem; font-weight: 500; color: var(--muted); margin-left: .2rem; }
.mt-min .now { font-size: 1.05rem; color: var(--ok); }
.mt-info { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.mactions { display: grid; gap: .6rem; margin-top: 1rem; }
.mactions .btn { min-height: 48px; }

/* ---------- ผลวางแผนเส้นทาง ---------- */
.plan-form { display: grid; gap: .75rem; }
@media (min-width: 720px) { .plan-form { grid-template-columns: 1fr auto 1fr; align-items: end; } .plan-form .when { grid-column: 1 / -1; } }
.swap { align-self: end; }
.option { cursor: default; }
.option-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.option-head .dur { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.option-lines { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.timeline { list-style: none; margin: 1rem 0 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 1rem 2.2rem; }
.timeline > li::before { content: ""; position: absolute; left: .6rem; top: .35rem; bottom: -.35rem; width: 6px; border-radius: 3px; background: var(--line, var(--border)); }
.timeline > li.walk::before { background: repeating-linear-gradient(to bottom, var(--muted) 0 4px, transparent 4px 9px); width: 3px; left: .75rem; }
.timeline > li:last-child::before { display: none; }
.timeline .stop { display: flex; justify-content: space-between; gap: .75rem; font-weight: 600; }
.timeline .stop::before { content: ""; position: absolute; left: .35rem; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line, var(--muted)); margin-top: .3rem; }
.timeline .detail { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.timeline .end { padding-left: 2.2rem; position: relative; font-weight: 600; display: flex; justify-content: space-between; }
.timeline .end::before { content: ""; position: absolute; left: .3rem; top: .3rem; width: 16px; height: 16px; border-radius: 50%; background: var(--line, var(--brand)); }
.notice { background: var(--warn-bg); color: var(--warn); padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .9rem; }
.future { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; color: var(--muted); font-size: .9rem; }

/* ---------- รายการสาย ---------- */
.line-card { display: flex; gap: .9rem; align-items: center; text-decoration: none; color: inherit; border-left: 6px solid var(--line); }
.line-card:hover { background: var(--surface-2); }
.line-card .meta { flex: 1; min-width: 0; }
.line-card .meta strong { display: block; }
.diagram { list-style: none; margin: 1rem 0 0; padding: 0; }
.diagram li { position: relative; padding: .45rem 0 .45rem 2.4rem; }
.diagram li::before { content: ""; position: absolute; left: .85rem; top: 0; bottom: 0; width: 6px; background: var(--line); }
.diagram li:first-child::before { top: 50%; }
.diagram li:last-child::before { bottom: 50%; }
.diagram li::after { content: ""; position: absolute; left: .55rem; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); }
.diagram li.ix::after { width: 16px; height: 16px; left: .45rem; border-color: var(--text); }
.diagram a { color: inherit; text-decoration: none; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.diagram a:hover strong { text-decoration: underline; }

/* ---------- ผู้ดูแลระบบ ---------- */
.admin-tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1rem; scrollbar-width: thin; }
.admin-tabs a { white-space: nowrap; padding: .45rem .85rem; border-radius: 999px; text-decoration: none; color: var(--muted); border: 1px solid var(--border); background: var(--surface); font-size: .9rem; }
.admin-tabs a.active { background: #0f3d5e; color: #fff; border-color: #0f3d5e; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
.kpi { padding: .85rem 1rem; }
.kpi .v { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: .4rem; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: .75rem; }
.toolbar > * { flex: 1 1 160px; }
.toolbar > .btn { flex: 0 0 auto; }
.form-grid { display: grid; gap: .75rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, 1fr); } .form-grid .full { grid-column: 1 / -1; } }
.login { max-width: 420px; margin: 2rem auto; }
.rec-clock { font-size: 1.6rem; font-weight: 700; }
.rec-buttons { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 720px) { .rec-buttons { grid-template-columns: repeat(2, 1fr); } }
.rec-btn {
  width: 100%; min-height: 96px; border: 0; border-radius: var(--radius); cursor: pointer;
  background: var(--line); color: var(--line-text, #fff); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  padding: .9rem; box-shadow: var(--shadow); transition: transform .08s, filter .15s; touch-action: manipulation;
}
.rec-btn:active { transform: scale(.98); }
.rec-btn:hover { filter: brightness(1.06); }
.rec-btn[disabled] { filter: grayscale(.4) brightness(.9); cursor: wait; }
.rec-btn-main { font-size: 1.15rem; font-weight: 700; }
.rec-btn-sub { font-size: .85rem; opacity: .9; }
.rec-analysis { margin-top: .4rem; padding: 0 .25rem; }
.time-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.time-chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; min-height: 30px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); cursor: pointer;
  font-size: .82rem; font-variant-numeric: tabular-nums;
}
.time-chip span { color: var(--muted); }
.time-chip:hover { border-color: var(--danger); color: var(--danger); }
.time-chip:hover span { color: var(--danger); }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-top: .6rem; }

/* ---------- โมดัล / แจ้งเตือน ---------- */
.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.modal::backdrop { background: rgba(10, 20, 30, .45); }
#modal-body { padding: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.form-error { color: var(--danger); font-size: .9rem; margin-top: .5rem; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px); transform: translateX(-50%) translateY(20px); background: #17212b; color: #fff; padding: .6rem 1rem; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 860px) { .toast { bottom: 24px; } }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
