/* TMC-STORE — ถอดจาก mock-up v2 (vault/01_Architecture/mockup_TMC-122/2026-10-06_v2)
   กติกา (ADR §10.2): ดีไซน์เดียวทั้ง PC และ HMI 1280×800 · ห้ามตั้งความสูงตายตัว · เลื่อนทั้งหน้าที่เดียว
   ไม่มีอะไรทำงานเฉพาะ hover · ปุ่มหลักสูง ≥ 64px */

@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-400.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-500.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-latin-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-600.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-latin-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 700; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-700.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 700; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-500.woff2) format('woff2'); }

:root {
  --bg: #F3F4F1; --surface: #FFFFFF; --line: #DDE0DA; --line-2: #C9CDC6;
  --ink: #16191D; --ink-2: #3C434B; --muted: #5A6169; --muted-2: #9AA1A9;
  --pri: #0E6B66; --pri-ink: #0A4F4B; --pri-tint: #E7F2EF; --pri-row: #F2F8F6;
  --neu-tint: #EEF0F3; --neu-ink: #2C333A;
  --blue-tint: #E4EEFB; --blue-ink: #1D4F91;
  --df: #8A4006; --df-line: #B45309; --df-tint: #FFF8EF; --df-chip: #FDF1E3; --df-ink: #6B3304;
  --bad: #B42318; --bad-tint: #FDECEA; --bad-ink: #8C1D13;
  --ok: #1B7A3E; --adj-tint: #F1E8FA; --adj-ink: #5B2A86;
  --font: 'IBM Plex Sans Thai', 'IBM Plex Sans JP', 'Yu Gothic UI', 'Meiryo', 'Hiragino Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; }
:lang(ja) body, body:lang(ja) { line-height: 1.6; }
a { color: var(--pri); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 14px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- หัวจอ ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.brand b { font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.brand span { font-size: 14px; color: var(--muted); }
.top-r { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.langs { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--bg); gap: 2px; }
.langs form { display: contents; }
.langs button { height: 36px; min-width: 52px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 600; color: var(--muted); }
.langs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--bg); }
.who .av { width: 32px; height: 32px; border-radius: 50%; background: var(--pri); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.who .nm { font-size: 15px; font-weight: 500; }
.who .clk { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.btn-line { height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; }

/* ---------- เนื้อหา ---------- */
.main { display: flex; flex-direction: column; gap: 24px; padding: 32px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.card.tight { padding: 24px; gap: 16px; border-radius: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.grow { flex: 999 1 640px; min-width: 0; }
.side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.h1 { font-size: 30px; font-weight: 700; margin: 0; line-height: 1.25; }
.h2 { font-size: 20px; font-weight: 700; margin: 0; }
.h3 { font-size: 17px; font-weight: 600; margin: 0; }

/* ช่องสแกน */
.scanbox { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 2px solid var(--pri); border-radius: 18px; padding: 0 20px; height: 72px; }
.scanbox span { font-size: 16px; color: var(--muted); white-space: nowrap; }
.scanbox input { flex: 1; min-width: 0; border: 0; outline: none; font-family: var(--mono); font-size: 26px; background: transparent; }
.scanbox.off { border-color: var(--line-2); }

/* แจ้งเตือน */
.alert { padding: 14px 18px; border-radius: 14px; font-size: 16px; font-weight: 500; }
.alert-ok { background: var(--pri-tint); color: var(--pri-ink); }
.alert-warn { background: var(--df-tint); color: var(--df); border: 1px solid #F3D9B8; }
.alert-bad { background: var(--bad-tint); color: var(--bad-ink); }
.alerts { display: flex; flex-direction: column; gap: 8px; }

/* chip */
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--neu-tint); color: var(--neu-ink); }
.chip.lg { padding: 6px 12px; font-size: 14px; }
.chip.in, .chip.STORED { background: var(--pri-tint); color: var(--pri-ink); }
.chip.out, .chip.OUT { background: var(--neu-tint); color: var(--neu-ink); }
.chip.ret { background: var(--blue-tint); color: var(--blue-ink); }
.chip.df { background: var(--df-chip); color: var(--df-ink); }
.chip.old, .chip.bad { background: var(--bad-tint); color: var(--bad-ink); }
.chip.adj { background: var(--adj-tint); color: var(--adj-ink); }
.chip.DONE { background: var(--bg); color: var(--muted); }
.chip.admin { background: var(--ink); color: #fff; }
.chip.supervisor { background: var(--blue-tint); color: var(--blue-ink); }
.chip.viewer { background: var(--bg); color: var(--muted); }

/* ตัวเลขใหญ่ */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat { background: var(--bg); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .k { font-size: 14px; color: var(--muted); }
.stat .v { font-size: 52px; font-weight: 700; line-height: 1.1; }
.stat .v.md { font-size: 36px; }
.stat .s { font-size: 14px; color: var(--muted); }

/* ปุ่ม */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; padding: 0 28px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); font-size: 18px; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.df { background: var(--df-tint); border: 1px dashed var(--df-line); color: var(--df-ink); }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.btns .btn { flex: 1 1 200px; }

/* โซน A–F */
.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.zone { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; min-height: 112px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; }
.zone b { font-size: 34px; line-height: 1; font-weight: 700; }
.zone span { font-size: 14px; color: var(--muted); }
.zone .hint { font-size: 13px; font-weight: 600; color: var(--pri); }
.zone.full { border-style: dashed; }
.zone[aria-pressed="true"] { background: var(--pri); border: 2px solid var(--pri); color: #fff; }
.zone[aria-pressed="true"] span, .zone[aria-pressed="true"] .hint { color: #E7F2EF; }
.zone.cur { opacity: .45; }

/* ตัวเลือกจุดประสงค์ */
.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: #fff; }
.seg label:has(input:checked) { background: var(--pri); border-color: var(--pri); color: #fff; }

/* แป้นตัวเลข (ADR §10.2 ข้อ 3) */
.qtybox { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px; border-radius: 16px; border: 2px solid var(--pri); background: var(--surface); }
.qtybox output { font-size: 52px; font-weight: 700; line-height: 1.1; min-width: 2ch; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { min-height: 64px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); font-size: 26px; font-weight: 600; }

/* หน้าคืน: แป้นซ้าย · โซนขวา 3 คอลัมน์ (mock-up Return) */
.ret-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; }
.ret-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ret-col .zones { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ret-col .zone { min-height: 96px; }
.stats.one { grid-template-columns: 1fr; }
@media (max-width: 900px) { .ret-grid { grid-template-columns: 1fr; } }

/* ประวัติย่อ */
.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tl li { display: flex; gap: 12px; }
.tl .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted-2); margin-top: 6px; flex: none; }
.tl li:first-child .dot { background: var(--pri); }
.tl .a { font-weight: 600; }
.tl .b { font-size: 14px; color: var(--muted); }

/* ตาราง */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.sel td { background: var(--pri-row); }
.tbl tr.off td { opacity: .6; }
.note-warn { color: var(--df); }
.note-bad { color: var(--bad); }

/* ฟอร์มสำนักงาน */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); }
.inp { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); min-width: 0; }
.inp:focus { outline: 2px solid var(--pri); outline-offset: 1px; }
.form-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.form-row .field { flex: 1 1 180px; }

/* สำนักงาน: เมนูซ้าย */
.office { display: flex; min-height: 100vh; }
.nav { width: 240px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.nav .brand { padding: 0 8px 20px; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a[aria-current="page"] { background: var(--pri-tint); color: var(--pri-ink); font-weight: 600; }
.nav .sec { margin: 18px 14px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted-2); }
.office .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.office .top { padding: 14px 32px; }
@media (max-width: 900px) {
  .office { flex-direction: column; }
  .nav { width: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav .brand, .nav .sec { display: none; }
  .main { padding: 16px; }
  .top { padding: 12px 16px; }
  .card { padding: 20px; }
  .stats { grid-template-columns: 1fr; }
}

/* โซนในหน้ายอดคงเหลือ */
.bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--pri); }
.bar i.warn { background: var(--df-line); }
.bar i.none { background: var(--line-2); width: 30%; }
.w0{width:0}.w10{width:10%}.w20{width:20%}.w30{width:30%}.w40{width:40%}.w50{width:50%}.w60{width:60%}.w70{width:70%}.w80{width:80%}.w90{width:90%}.w100{width:100%}

/* รหัสจับคู่สถานี */
.pair { font-family: var(--mono); font-size: 72px; font-weight: 600; letter-spacing: .15em; text-align: center; padding: 24px; background: var(--bg); border-radius: 20px; }
.center-page { max-width: 720px; margin: 48px auto; padding: 0 16px; }
.temp-pw { font-family: var(--mono); font-size: 28px; padding: 16px; background: var(--df-tint); border: 1px dashed var(--df-line); border-radius: 14px; user-select: all; }

/* เมนูหน้าสถานี (TMC 11 ต.ค.) */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { flex: 1 1 140px; display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 0 20px; border-radius: 16px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 18px; font-weight: 600; text-decoration: none; }
.tab[aria-current="page"] { background: var(--pri); border-color: var(--pri); color: #fff; }
.tab.df { background: var(--df-tint); border: 1px dashed var(--df-line); color: var(--df-ink); }
.tab.df[aria-current="page"] { background: var(--df); border: 1px solid var(--df); color: #fff; }

/* รายการ FIFO */
.fifo-part { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.fifo-sum { font-size: 16px; color: var(--ink-2); }
.fifo-sum b { font-size: 24px; color: var(--ink); }
.tbl.fifo td { vertical-align: middle; }
.tbl.fifo tr.first td { background: var(--pri-row); }
.tbl.fifo tr.sel td { outline: 2px solid var(--pri); outline-offset: -2px; }
