/* ระบบชั่งน้ำหนักรถ — ลานคอนกรีต, หน้าปัดหัวอ่านเครื่องชั่ง, ป้ายทะเบียนรถ */
:root {
  --bg: #e4e6e1;          /* พื้นคอนกรีต */
  --surface: #f7f7f4;
  --surface-2: #eef0eb;
  --ink: #1d272c;
  --muted: #5b676b;
  --line: #cbd0c8;
  --steel: #24495c;       /* ปุ่มหลัก */
  --steel-2: #1a3747;
  --vfd-bg: #0d1613;      /* หน้าปัดหัวอ่าน */
  --vfd: #8cffc1;
  --vfd-dim: #3d6b55;
  --in: #2b6d90;          /* รับเข้า */
  --out: #96580f;         /* จ่ายออก */
  --mixer: #f2b705;       /* รถโม่ */
  --danger: #b23b1a;
  --ok: #22754a;
  --r-sm: 6px;
  --r: 10px;
  --font: 'Anuphan', 'Leelawadee UI', 'Tahoma', sans-serif;
  --font-num: 'Chakra Petch', 'Anuphan', sans-serif;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--font-num); line-height: 1.25; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }
h2 small { font: 400 .85rem var(--font); color: var(--muted); }
p { margin: 0; }
small { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.i { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
[hidden] { display: none !important; }
.loading, .empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 1rem; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .5rem 1rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-primary { background: var(--steel); border-color: var(--steel); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--steel-2); border-color: var(--steel-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.btn-dark { background: #1c2a25; border-color: #2c3f37; color: #cfe9dc; }
.btn-dark:hover:not(:disabled) { border-color: var(--vfd-dim); }
.btn-dark[aria-pressed="true"] { background: var(--vfd); color: var(--vfd-bg); border-color: var(--vfd); }
.btn-sm { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn-lg { min-height: 52px; font-size: 1.05rem; }
.btn-xl { min-height: 68px; font-size: 1.2rem; width: 100%; font-weight: 600; }
.btn-icon { width: 44px; padding: 0; }
.save-w { font-family: var(--font-num); opacity: .85; margin-left: .25rem; }

/* ---------- ฟอร์ม ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > span { font-size: .875rem; color: var(--muted); font-weight: 500; }
.field input, .field select {
  min-height: 44px; padding: .45rem .7rem; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--steel); outline: 2px solid rgb(36 73 92 / .2); outline-offset: 0; }
.field input[readonly] { background: var(--surface-2); }
.pin-input { font-family: var(--font-num); font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; }
.check { display: flex; align-items: center; gap: .55rem; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--steel); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.grid-2, .grid-3 { display: grid; gap: .9rem 1rem; align-items: end; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.hint { font-size: .875rem; color: var(--muted); }
.err { color: var(--danger); font-weight: 500; min-height: 1.4em; }
.err:empty { min-height: 0; }
.notice { background: #fff6d6; border: 1px solid #ecd47a; padding: .7rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: .45rem .9rem; border-radius: 4px; cursor: pointer;
  min-height: 40px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: .4rem;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line); }
.seg-big { display: flex; width: 100%; }
.seg-big button { flex: 1; justify-content: center; min-height: 52px; font-size: 1.05rem; }
.seg-big button[data-mode="mixer"][aria-selected="true"] { background: var(--mixer); color: var(--ink); box-shadow: none; }
.seg-big button[data-mode="general"][aria-selected="true"] { background: var(--steel); color: #fff; box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 40px; padding: .3rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; }
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 3px solid #f2b705; outline-offset: 2px; }

details.more { margin-top: .9rem; }
details.more summary { cursor: pointer; color: var(--steel); font-weight: 500; padding: .4rem 0; }
details.more[open] summary { margin-bottom: .6rem; }

/* ---------- ป้ายทะเบียนรถ (สีขาว ขอบดำ แบบป้ายรถไทย) ---------- */
.plate {
  display: inline-block; font-family: var(--font-num); font-weight: 700; letter-spacing: .02em;
  background: #fff; border: 2px solid var(--ink); border-radius: 4px; padding: 0 .45rem; line-height: 1.6; white-space: nowrap;
}
.plate-lg { font-size: 1.6rem; padding: .1rem .8rem; border-width: 3px; }

.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .5rem; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag-in { background: #e3eff6; color: var(--in); border-color: #bcd6e6; }
.tag-out { background: #f8ecdb; color: var(--out); border-color: #e7cfa9; }
.tag-mixer { background: var(--mixer); color: var(--ink); border-color: #d9a400; }
.tag-pending { background: #fff; color: var(--ink); border-style: dashed; border-color: var(--muted); }
.tag-void { background: #f6e0d9; color: var(--danger); border-color: #e7b8a9; }
.tag-warn { background: #fff3cc; color: #7a5a00; border-color: #ecd47a; }
.dot-warn { color: #b07d00; font-weight: 700; }
.count { display: inline-block; min-width: 1.6em; text-align: center; font-size: .8rem; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 .4em; margin-left: .3rem; vertical-align: .15em; }

/* ---------- โครงหน้า ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0 1.25rem; height: 60px;
  background: var(--ink); color: #e9eee9;
}
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--vfd-bg); color: var(--vfd); border: 1px solid #2c3f37; }
.brand-name { font-family: var(--font-num); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26ch; }
.nav { display: flex; gap: .15rem; margin-left: auto; }
.nav a {
  display: flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border-radius: var(--r-sm);
  color: #aab8b2; text-decoration: none; font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgb(255 255 255 / .06); }
.nav a.on { color: var(--ink); background: #e9eee9; }
.who { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: #aab8b2; white-space: nowrap; }
.who .btn-ghost { color: #e9eee9; }
.who .btn-ghost:hover { background: rgb(255 255 255 / .08); }

.view { padding: 1.25rem; max-width: 1440px; margin: 0 auto; }
.page { display: flex; flex-direction: column; gap: 1rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.panel > h2 { margin-bottom: .8rem; }
.empty-line { color: var(--muted); padding: .6rem 0; }
.result-line { color: var(--muted); font-size: .92rem; }

/* ---------- รายการแบบแถว ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "plate num num" "sub sub sub";
  align-items: center; gap: .2rem .7rem; width: 100%; text-align: left;
  padding: .65rem .4rem; border: 0; background: transparent; cursor: pointer; border-radius: var(--r-sm);
}
.row:hover { background: var(--surface-2); }
.row.on { background: #fff7d6; box-shadow: inset 3px 0 0 var(--mixer); }
.row .plate { grid-area: plate; justify-self: start; }
.row-sub { grid-area: sub; font-size: .85rem; color: var(--muted); }
.row-num { grid-area: num; justify-self: end; font-family: var(--font-num); font-weight: 600; font-size: 1.1rem; }

/* ---------- ตาราง ---------- */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { font-weight: 600; color: var(--muted); font-size: .85rem; background: var(--surface-2); position: sticky; top: 0; }
.table .n { text-align: right; font-family: var(--font-num); white-space: nowrap; }
.table .strong { font-weight: 700; }
.table tbody tr[data-id] { cursor: pointer; }
.table tbody tr[data-id]:hover { background: var(--surface-2); }
.table tr.voided td { color: var(--muted); text-decoration: line-through; }
.table tfoot th { background: var(--surface-2); border-top: 2px solid var(--ink); }
.row-actions { text-align: right; white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end; }
.filters .field { flex: 0 1 170px; }
.filters .field-grow { flex: 1 1 260px; }

/* ---------- หน้าปัดหัวอ่านเครื่องชั่ง ---------- */
.vfd { font-family: var(--font-num); font-weight: 600; }
.indicator {
  grid-area: ind;
  background: var(--vfd-bg); color: #cfe9dc; border-radius: var(--r);
  padding: 1rem 1.25rem 1.25rem; border: 1px solid #22322c;
  box-shadow: inset 0 0 0 6px #121e1a;
}
.ind-top { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ind-src { display: flex; gap: .4rem; flex-wrap: wrap; }
.ind-status { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .95rem; }
.ind-status::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: #4b5a54; }
.st-stable::before { background: var(--vfd); box-shadow: 0 0 10px var(--vfd); }
.st-moving::before { background: var(--mixer); animation: blink .8s steps(2, start) infinite; }
.st-manual::before { background: #9cc3ff; }
.ind-display { display: flex; align-items: baseline; justify-content: flex-end; gap: .75rem; padding: .5rem 0 .25rem; }
.ind-value {
  font-family: var(--font-num); font-weight: 600; line-height: 1; letter-spacing: .02em;
  font-size: clamp(4rem, 10vw, 8.5rem); color: var(--vfd);
  text-shadow: 0 0 18px rgb(140 255 193 / .45);
  transition: color .2s, text-shadow .2s;
}
.indicator[data-state="moving"] .ind-value { color: #c7e8d6; text-shadow: none; opacity: .75; }
.indicator[data-state="off"] .ind-value { color: var(--vfd-dim); text-shadow: none; }
.indicator[data-state="manual"] .ind-value { color: #9cc3ff; text-shadow: 0 0 16px rgb(156 195 255 / .35); }
.ind-unit { font-family: var(--font-num); font-size: 1.6rem; color: var(--vfd-dim); }
.ind-manual, .ind-sim { display: flex; align-items: center; gap: .75rem; margin-top: .6rem; flex-wrap: wrap; }
.ind-manual input, .ind-sim input {
  background: #13211c; border: 1px solid #2c3f37; color: #fff; border-radius: var(--r-sm);
  font-family: var(--font-num); font-size: 1.6rem; padding: .3rem .7rem; width: 220px; text-align: right;
}
.ind-sim input { font-size: 1.1rem; width: 140px; }
@keyframes blink { to { visibility: hidden; } }

/* ---------- หน้าชั่ง ---------- */
.station {
  display: grid; gap: 1rem;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas: "ind side" "form side";
  align-items: start;
}
.weigh-form { grid-area: form; display: flex; flex-direction: column; gap: 1rem; }
.weigh-form form { display: flex; flex-direction: column; gap: 1rem; }
.field-plate input { font-family: var(--font-num); font-weight: 700; font-size: 2rem; min-height: 64px; border: 3px solid var(--ink); text-align: center; letter-spacing: .03em; }
.side { grid-area: side; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 76px; }
.step-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; border-radius: var(--r-sm); border: 1px dashed var(--muted); }
.step-out { border: 2px solid var(--steel); background: #e8f0f4; }
.step-title { font-weight: 600; font-size: 1.05rem; }
.step-sub { color: var(--muted); font-size: .9rem; }
.step-w { font-family: var(--font-num); font-size: 1.2rem; white-space: nowrap; }
.vfd-ink { font-weight: 700; font-size: 1.6rem; }
.save-hint { text-align: center; color: var(--muted); font-size: .9rem; margin-top: -.4rem; }

/* ---------- หน้าภาพรวม ---------- */
.home { display: flex; flex-direction: column; gap: 1rem; max-width: 820px; margin: 0 auto; }
.day-nav { display: flex; align-items: center; justify-content: space-between; }
.day-label { text-align: center; display: flex; flex-direction: column; }
.day-label strong { font-family: var(--font-num); font-size: 1.3rem; }
.day-label span { color: var(--muted); font-size: .9rem; }
.board { background: var(--vfd-bg); color: #cfe9dc; border-radius: var(--r); padding: 1.2rem 1.3rem; box-shadow: inset 0 0 0 6px #121e1a; }
.board-label { font-size: .95rem; color: #8fa89d; }
.board-value { display: flex; align-items: baseline; gap: .6rem; }
.board-value .vfd { font-size: clamp(3.5rem, 14vw, 5.5rem); line-height: 1; color: var(--vfd); text-shadow: 0 0 16px rgb(140 255 193 / .4); }
.board-unit { font-family: var(--font-num); font-size: 1.3rem; color: #8fa89d; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem 1.2rem; margin: 1rem 0 0; padding-top: 1rem; border-top: 1px solid #22322c; }
.board-grid dt { font-size: .88rem; color: #8fa89d; }
.board-grid dt small { color: #6c8278; }
.board-grid dd { margin: 0; color: #8fa89d; }
.board-grid dd .vfd { font-size: 1.6rem; color: #e6fff1; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 140px; align-items: end; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; border: 0; background: transparent; padding: 0; cursor: pointer; gap: 4px; }
.bar-fill { display: block; background: var(--steel); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .55; }
.bar:hover .bar-fill { opacity: .8; }
.bar.on .bar-fill { opacity: 1; background: var(--ink); }
.bar-day { font-size: .72rem; color: var(--muted); text-align: center; font-family: var(--font-num); }

/* ---------- หน้าต่างรายละเอียด ---------- */
dialog.modal {
  border: 0; border-radius: var(--r); padding: 1.3rem; width: min(560px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 2rem); background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
dialog.modal-wide { width: min(780px, calc(100vw - 1.5rem)); }
dialog.modal::backdrop { background: rgb(18 27 31 / .55); }
.confirm p { margin-bottom: 1.2rem; font-size: 1.05rem; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.detail-tags { display: flex; gap: .35rem; margin-top: .5rem; flex-wrap: wrap; }
.weights { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 1rem; }
.weights > div { padding: .7rem .8rem; display: flex; flex-direction: column; }
.weights > div + div { border-left: 1px solid var(--line); }
.weights span { font-size: .85rem; color: var(--muted); }
.weights strong { font-family: var(--font-num); font-size: 1.45rem; }
.weights small { font-size: .78rem; }
.weights .net { background: var(--vfd-bg); color: var(--vfd); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.weights .net span, .weights .net small { color: #8fa89d; }
.kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; margin: 0 0 1.2rem; }
.kv dt { font-size: .82rem; color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- เข้าสู่ระบบ ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: var(--ink); }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: var(--r); padding: 1.8rem 1.6rem; display: flex; flex-direction: column; gap: 1rem; }
.auth-wide { width: min(460px, 100%); }
.auth-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; background: var(--vfd-bg); color: var(--vfd); font-size: 1.4rem; }
.auth .seg { display: flex; }
.auth .seg button { flex: 1; justify-content: center; }

/* ---------- ตั้งค่า ---------- */
.settings .panel > p { margin-bottom: .8rem; }
.linkbox { display: flex; gap: .5rem; margin-bottom: 1rem; }
.linkbox input { flex: 1; min-height: 44px; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font-family: var(--font-num); }
pre.raw { background: var(--vfd-bg); color: var(--vfd); padding: .8rem 1rem; border-radius: var(--r-sm); font-size: .85rem; overflow-x: auto; min-height: 4rem; margin: 0; }

/* ---------- รายงานบนจอ ---------- */
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; overflow-x: auto; }
.rep-head { text-align: center; margin-bottom: 1rem; }
.rep-co { font-weight: 600; }
.rep-head h2 { font-size: 1.2rem; margin: .2rem 0; }
.rep-sub { color: var(--muted); }
.rep-group td { background: var(--surface-2); font-weight: 600; }
.rep-sub-total td { font-weight: 600; font-size: .88rem; border-bottom: 2px solid var(--line); }

/* ---------- แจ้งเตือน ---------- */
#toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: 1.2rem; display: flex; flex-direction: column; gap: .5rem; width: min(520px, calc(100vw - 2rem)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: var(--r-sm); box-shadow: 0 8px 24px rgb(0 0 0 / .25); border-left: 5px solid var(--vfd); transition: opacity .3s, transform .3s; }
.toast-error { border-left-color: #ff7b52; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- จอเล็ก / มือถือ ---------- */
@media (max-width: 1100px) {
  .station { grid-template-columns: 1fr; grid-template-areas: "ind" "form" "side"; }
  .side { position: static; }
  .who span { display: none; }
}
@media (max-width: 860px) {
  .topbar { height: 54px; padding: 0 .9rem; }
  .nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 .25rem env(safe-area-inset-bottom);
    background: var(--ink); justify-content: space-around; gap: 0; border-top: 1px solid #2a3940;
  }
  .nav a { flex-direction: column; gap: .1rem; font-size: .72rem; padding: .4rem .3rem; flex: 1; justify-content: center; border-radius: 0; }
  .nav a .i { width: 1.45em; height: 1.45em; }
  .nav a.on { background: transparent; color: var(--vfd); }
  .who { margin-left: auto; }
  .view { padding: .9rem .75rem calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem); }
  #toasts { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + .8rem); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.45rem; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .filters .field { flex: 1 1 140px; }
  .kvs { grid-template-columns: 1fr 1fr; }
  .weights strong { font-size: 1.15rem; }
  .brand-name { max-width: 18ch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .ind-manual input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- การพิมพ์ ---------- */
#print-root { display: none; }
#print-root.measuring { display: block; position: absolute; left: -10000px; top: 0; }
@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; color: #000; }
}

/* ใบเสร็จความร้อน */
.receipt { font: 13px/1.4 var(--font); color: #000; padding: 2mm 0 4mm; }
.paper-80 .receipt { width: 72mm; margin: 0 auto; }
.paper-58 .receipt { width: 48mm; margin: 0 auto; font-size: 11px; }
.r-head { text-align: center; }
.r-co { font-weight: 700; font-size: 1.15em; }
.r-title { font-weight: 700; font-size: 1.2em; margin-top: 1.5mm; }
.r-copy { text-align: center; font-weight: 700; border: 1px solid #000; margin: 1mm auto 0; width: max-content; padding: 0 3mm; }
.r-sep { border-top: 1px dashed #000; margin: 1.6mm 0; }
.r-row { display: flex; justify-content: space-between; gap: 2mm; }
.r-row span:last-child { text-align: right; font-weight: 600; }
.r-big span:last-child { font-size: 1.25em; font-weight: 700; }
.r-strong span { font-weight: 700; }
.r-total { font-size: 1.15em; font-weight: 700; }
.r-total span { font-weight: 700; }
.r-w { margin: .6mm 0; }
.r-wl small { color: #000; font-size: .9em; }
.r-wv { text-align: right; font-family: var(--font-num); font-weight: 700; font-size: 1.45em; line-height: 1.2; }
.r-note { text-align: center; font-size: .92em; }
.r-sign { display: flex; gap: 4mm; text-align: center; font-size: .9em; margin-top: 8mm; }
.r-sign > div { flex: 1; }
.r-dots { border-bottom: 1px dotted #000; height: 6mm; margin-bottom: 1mm; }

/* ใบชั่งครึ่ง A4 */
.a5 { font: 13px/1.45 var(--font); color: #000; }
.a5-head { text-align: center; }
.a5-co { font-size: 1.4em; font-weight: 700; }
.a5-title { font-size: 1.3em; font-weight: 700; margin: 2mm 0 3mm; }
.a5-body { display: flex; gap: 8mm; }
.a5-body table { border-collapse: collapse; }
.a5-body th { text-align: left; font-weight: 400; padding: .4mm 3mm .4mm 0; white-space: nowrap; vertical-align: top; }
.a5-body td { font-weight: 600; padding: .4mm 0; }
.a5-l { flex: 1; }
.a5-r td.n { text-align: right; font-family: var(--font-num); padding: 0 2mm; min-width: 28mm; }
.a5-baht { text-align: right; margin-top: 2mm; }
.a5-sign { display: flex; gap: 20mm; justify-content: center; text-align: center; margin-top: 10mm; }
.a5-sign > div { width: 60mm; }

/* รายงาน A4 */
.report-print { font: 11px/1.35 var(--font); color: #000; }
.report-print .table th, .report-print .table td { padding: 1mm 1.5mm; border-bottom: .2mm solid #999; }
.report-print .table thead th { background: #eee; color: #000; position: static; }
.report-print .rep-group td { background: #f3f3f3; }
.report-print .rep-sub { color: #000; }
.report-print .table tfoot th { background: #eee; border-top: .4mm solid #000; }
.report-print tr { break-inside: avoid; }
