:root {
  color-scheme: light dark;
  --background: light-dark(#edf2eb, #0c1711);
  --surface: light-dark(#fff, #15261d);
  --subtle: light-dark(#f1f6ef, #1b3025);
  --ink: light-dark(#172b1f, #edf8ef);
  --muted: light-dark(#4b6053, #b4c9bb);
  --line: light-dark(#cedcd1, #365044);
  --green: light-dark(#185236, #9de3bb);
  --focus: light-dark(#155d9b, #91caff);
  --gold: #ffd061;
  --error-bg: light-dark(#fff1ee, #402824);
  --error-ink: light-dark(#9b322a, #ffb9ae);
  --round: 17px;
  --shadow: 0 7px 30px light-dark(#1832240e, #0003);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--ink); font: 1rem/1.55 "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif; }
.shell { width: min(100% - 28px, 720px); margin-inline: auto; }
.masthead { background: #103c2a; border-bottom: 3px solid var(--gold); color: #f4faf5; }
.masthead-inner { display: flex; gap: 13px; align-items: center; padding: 14px 0; }
.masthead img { object-fit: contain; border-radius: 5px; }
.masthead div > b, .masthead div > span { display: block; }
.masthead div > span { color: #cee6d7; font-size: .84rem; }
main.shell { padding: 24px 0 calc(32px + env(safe-area-inset-bottom)); }
.overview { background: linear-gradient(120deg, #123e2c, #206044); padding: 18px clamp(12px, 4vw, 26px); border-radius: var(--round); color: #f6fbf6; box-shadow: var(--shadow); }
.overview-header, .section-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px 15px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.16rem, 4.7vw, 1.58rem); }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
.synced { font-size: .78rem; color: #d5efdf; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 13px 0 0; padding-top: 10px; border-top: 1px solid #ffffff45; }
.metrics div { padding-inline: 8px; border-inline-start: 1px solid #ffffff36; }
.metrics div:first-child { border: 0; padding-inline-start: 0; }
.metrics dt { color: #d5efdf; font-size: clamp(.73rem, 3.6vw, .86rem); min-height: 2.8em; line-height: 1.35; }
.metrics dd { margin: 0; font-size: clamp(1.45rem, 7vw, 2.26rem); line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.metrics div:first-child dd { color: var(--gold); }
.page-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-block: 16px 11px; border-radius: 12px; background: var(--subtle); border: 1px solid var(--line); }
button, input, textarea, select { font: inherit; }
button { min-height: 44px; cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:is(input,select,textarea,button,summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.page-nav button { border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 700; font-size: .92rem; }
.page-nav button[aria-pressed="true"] { background: var(--surface); color: var(--green); box-shadow: inset 0 -3px var(--gold); }
.card { border: 1px solid var(--line); border-radius: var(--round); background: var(--surface); box-shadow: var(--shadow); }
.section-title { padding: 13px clamp(13px, 4vw, 24px); border-bottom: 1px solid var(--line); }
.section-title h2 { min-width: 0; overflow-wrap: anywhere; }
form, .ticket-body, .receipt-content { display: grid; gap: 13px; padding: 15px clamp(13px, 4vw, 24px) 20px; }
.fields { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 10px; }
label { display: grid; gap: 4px; color: var(--ink); font-size: .88rem; font-weight: 700; }
input, select, textarea { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--subtle); color: var(--ink); font-size: 1rem; font-weight: 400; }
textarea { resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 23px; }
.primary, .secondary, .text-button { border-radius: 9px; padding: 8px 12px; font-weight: 750; }
.primary { background: var(--gold); color: #332300; border: 1px solid transparent; }
.secondary { color: var(--green); background: var(--subtle); border: 1px solid var(--line); }
.text-button { width: fit-content; background: transparent; color: var(--green); border: 1px solid transparent; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions > button { flex: 1 1 180px; }
.error, .notice { padding: 9px 11px; border-radius: 8px; }
.error { color: var(--error-ink); background: var(--error-bg); }
.notice { color: var(--green); background: var(--subtle); }
.hint, .receipt-content p { color: var(--muted); font-size: .88rem; }
.pill { border-radius: 99px; padding: 4px 10px; font-size: .8rem; font-weight: 750; background: var(--subtle); color: var(--green); }
.pill.waiting, .pill.parts { background: #fff2cd; color: #66451b; }
.pill.accepted, .pill.repairing { background: #ddecff; color: #174877; }
.pill.closed { background: #dcefe4; color: #194b30; }
.ticket { margin-top: 14px; }
.ticket-meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; margin: 0; }
.ticket-meta dt { color: var(--muted); font-size: .8rem; }
.ticket-meta dd { margin: 0; overflow-wrap: anywhere; font-weight: 650; }
#ticket-description, .timeline p { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { margin: 8px 0 0; padding: 0; list-style: none; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line); }
.timeline li > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.timeline time { color: var(--muted); font-size: .8rem; }
.timeline p { margin-top: 5px; }
details { border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); }
summary { min-height: 44px; padding: 8px 11px; font-weight: 750; color: var(--green); cursor: pointer; }
details form { padding: 10px 11px 12px; }
@media (min-width: 500px) { .metrics dt { min-height: 0; margin-bottom: 6px; } }
