/* Office Stock — ธีมตาม AMS จริง (Brand Kit 20/10/2569, จาก reference/ams-theme.json)
   primary #0B2A5B · primary-dark #071D42 · secondary #176B9B · accent #12AEC1 · accent-bg #E7F8FB · bg #F7FAFC · ฟอนต์ Prompt/Inter
   ย้ายเฉพาะ design tokens (ไม่นำ CSS AMS ทั้งไฟล์มาวาง) */
:root {
  --navy: #0B2A5B; --navy-2: #176B9B; --navy-dark: #071D42; --teal: #12AEC1; --teal-ink: #0B7F8F; --teal-soft: #E7F8FB;
  --bg: #F7FAFC; --surface: #FFFFFF; --surface-2: #EEF4F9; --text: #102A43; --muted: #5F7088; --border: #DCE8F2;
  --primary: #0B2A5B; --primary-strong: #071D42; --primary-soft: #E7F8FB; --on-primary: #FFFFFF;
  --accent: #12AEC1; --accent-ink: #0B7F8F; --accent-soft: #E7F8FB; --on-accent: #071D42;
  --header-bg: #FFFFFF; --header-fg: #0B2A5B; --header-muted: #5F7088;
  --danger: #C0352B; --danger-soft: #FCE8E6; --warn: #9A5B00; --warn-soft: #FFF2D9; --ok: #11795A; --ok-soft: #DDF3EA; --info-soft: #E3EEF8; --info: #1D4F91;
  --radius: 10px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.06);
  --nav-h: 64px; --top-h: 60px;
  --font: 'Prompt', 'Inter', system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", "Sarabun", "Leelawadee UI", Tahoma, sans-serif;
  color-scheme: light only;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 0 16px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top));
  background: var(--header-bg); color: var(--header-fg); border-bottom: 3px solid var(--teal); }
.topbar .brand { font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.08rem; letter-spacing: .01em; }
.topbar .brand-short { display: none; }
@media (max-width: 359px) { .topbar .brand-full { display: none; } .topbar .brand-short { display: inline; } }
@media (max-width: 480px) { .topbar .who { font-size: .78rem; max-width: 40vw; } }
.topbar-logo { height: 32px; width: auto; display: block; }
.topbar .who small { color: var(--header-muted) !important; }
.topbar button { background: transparent; color: inherit; border: 0; font: inherit; padding: 8px; min-height: 44px; border-radius: 8px; }
.topbar .who { font-size: .85rem; opacity: .9; text-align: right; line-height: 1.2; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; }
main { padding: 16px; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1200px; margin: 0 auto; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-h); color: var(--muted); text-decoration: none; font-size: .75rem; }
.bottomnav a.active { color: var(--accent-ink); font-weight: 700; box-shadow: inset 0 3px 0 var(--accent); }
.bottomnav svg, .sidenav svg { width: 24px; height: 24px; }
.sidenav { display: none; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 85vw); background: var(--surface); z-index: 31; padding: calc(16px + env(safe-area-inset-top)) 12px 16px; overflow-y: auto; box-shadow: var(--shadow); }
.navlist a { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 48px; border-radius: 10px; color: var(--text); text-decoration: none; }
.navlist a.active { background: var(--accent-soft); color: var(--text); font-weight: 700; box-shadow: inset 4px 0 0 var(--accent); }
.navlist a:hover:not(.active) { background: var(--surface-2); }
.navlist a.active svg { color: var(--accent-ink); }
.navlist hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
@media (min-width: 900px) {
  .bottomnav, .menu-btn { display: none !important; }
  .sidenav { display: block; position: fixed; top: var(--top-h); bottom: 0; left: 0; width: 248px; background: var(--surface); border-right: 1px solid var(--border); padding: 12px; overflow-y: auto; }
  main { margin-left: 248px; padding: 24px; padding-bottom: 32px; max-width: none; }
}

/* components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.tight { padding: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.space-between { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } .grid.dash { grid-template-columns: 1fr 1fr; } }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin-bottom: 14px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(8, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-decoration: none; color: inherit; display: block; }
.kpi { border-top: 3px solid var(--accent); }
.kpi .v { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi .l { font-size: .8rem; color: var(--muted); }
.kpi.kpi-alert { border-top-color: var(--danger); }
.kpi.kpi-alert .v { color: var(--danger); }
.kpi.kpi-warn { border-top-color: var(--warn); }
.kpi.kpi-warn .v { color: var(--warn); }

label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 2px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; vertical-align: middle; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn:not(.primary):not(.danger):not(.ghost):hover:not(:disabled) { border-color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-ink); }
.btn.small { min-height: 36px; padding: 6px 10px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 10px 0; z-index: 5; }
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }
.choice { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choice { grid-template-columns: 1fr 1fr; } }
.choice a { display: block; padding: 18px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); text-decoration: none; color: inherit; }
.choice a:hover { border-color: var(--accent); }
.choice a { border-top: 4px solid var(--accent); }
.choice a strong { display: block; font-size: 1.1rem; color: var(--text); margin-bottom: 4px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.alert { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; border: 1px solid transparent; }
.alert.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert ul { margin: 4px 0 0; padding-left: 20px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-2); color: var(--text); font-weight: 700; white-space: nowrap; position: sticky; top: 0; border-bottom: 2px solid var(--border); }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 40%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; color: inherit; text-decoration: none; }
.list-item .t { font-weight: 700; }
.list-item .s { font-size: .88rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.lines .line { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--surface); }
.lines .line .row > * { min-width: 0; }
.line-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .line-grid { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; } .line-grid.rcv { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.line.bad { border-color: var(--danger); background: var(--danger-soft); }
.line.warn { border-color: var(--warn); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 1; border: 1px solid var(--border); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 999px; width: 32px; height: 32px; font-size: 18px; }
.photo .st { position: absolute; left: 0; right: 0; bottom: 0; font-size: .75rem; padding: 3px 6px; background: rgba(0,0,0,.6); color: #fff; }
.photo.big { aspect-ratio: auto; }
.photo.big img { height: auto; max-height: 70vh; object-fit: contain; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 14px; text-align: center; background: var(--surface); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs a, .tabs button { flex: none; padding: 8px 14px; min-height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-size: .92rem; cursor: pointer; }
.tabs .active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.tabs a:hover:not(.active) { border-color: var(--accent); }
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
@media (min-width: 900px) { .filters { grid-template-columns: repeat(5, 1fr); align-items: end; } }
.filters .field { margin: 0; }

.bars .bar { display: grid; grid-template-columns: minmax(80px, 38%) 1fr auto; gap: 8px; align-items: center; margin: 6px 0; font-size: .9rem; }
.bars .track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--accent); border-radius: 6px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: .95rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .dl { grid-template-columns: 1fr; } .dl dt { margin-top: 6px; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--border); padding: 4px 0 10px 12px; font-size: .9rem; }

.offline-banner { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 19; background: var(--danger); color: #fff; padding: 8px 16px; text-align: center; font-weight: 600; }
@media (min-width: 900px) { .offline-banner { margin-left: 248px; } }
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 480px); }
.toast { background: var(--navy); color: #fff; padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); color: #fff; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal-backdrop { align-items: center; } .modal { border-radius: 16px; } }
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; background: linear-gradient(var(--header-bg) 0 38%, var(--bg) 38% 100%); }
.login { width: min(420px, 100%); border-top: 4px solid var(--teal); margin: 0; }
.login-title { text-align: center; margin-bottom: 14px; }
.login-brand { text-align: center; color: var(--header-fg); }
.login-brand h1 { font-size: 1.9rem; margin: 0; letter-spacing: .01em; color: var(--header-fg); }
.login-brand p { margin: 4px 0 0; color: var(--header-muted); }
.login-logo { max-height: 72px; width: auto; display: block; margin: 0 auto 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; font-size: .85rem; background: var(--surface-2); padding: 10px; border-radius: 8px; max-height: 240px; overflow: auto; }
.qtybox { font-variant-numeric: tabular-nums; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

.line.skipped { background: var(--surface-2); border-style: dashed; }
.timestem-notice ul { margin: 6px 0 4px; }
.tree, .tree ul { list-style: none; margin: 0; padding-left: 18px; }
.tree { padding-left: 0; }
.tree li { position: relative; padding: 4px 0 4px 14px; border-left: 2px solid var(--border); }
.tree li::before { content: ''; position: absolute; left: 0; top: 16px; width: 10px; border-top: 2px solid var(--border); }
.tree .node { display: inline-block; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.badge.out { background: var(--danger); color: #fff; }

/* เครดิตผู้ออกแบบ (รูปแบบเดียวกับ AMS — ตำแหน่งยืนยันอีกครั้งเมื่อได้ภาพอ้างอิง) */
.credit { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); line-height: 1.35; }
.credit-logo { height: 22px; width: auto; flex: none; }
.credit.side { margin-top: 16px; padding: 12px; border-top: 1px solid var(--border); }
.credit.login-credit { justify-content: center; text-align: center; }
.sidenav { display: none; }
@media (min-width: 900px) { .sidenav { display: flex; flex-direction: column; } .sidenav .credit.side { margin-top: auto; } }
.drawer { display: flex; flex-direction: column; }
.drawer .credit.side { margin-top: auto; }
.drawer-head { padding: 0 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.drawer-brand { font-weight: 700; color: var(--accent-ink); font-size: .85rem; letter-spacing: .02em; margin-bottom: 6px; }
.drawer-logo { max-height: 36px; width: auto; display: block; margin-bottom: 6px; }
.card { border-color: var(--border); }
.section-title h1 { color: var(--text); }
h1 { color: var(--text); }

.filters > *, .grid > *, .line-grid > * { min-width: 0; }
.topbar svg { width: 24px; height: 24px; display: block; }
.card.login { border-top: 4px solid var(--teal); }

/* ===== หน้า Login / OTP (v1.3) — Light Corporate: กรมท่า #12304A + ฟ้าอมเขียว #12AEC1 ===== */
.login-wrap { position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; justify-content: flex-start; background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + clamp(24px, 6vh, 56px)) 16px calc(env(safe-area-inset-bottom, 0px) + 24px); }
.login-wrap::before { content: ''; position: absolute; inset: 0 0 auto 0; height: calc(env(safe-area-inset-top, 0px) + clamp(24px, 6vh, 56px) + 196px); background: var(--header-bg); border-bottom: 3px solid var(--teal); z-index: -1; }
.login-brand { display: flex; flex-direction: column; align-items: center; }
.login-brand h1 { font-size: clamp(1.6rem, 5vw, 2rem); }
.login-logo { max-height: 72px; max-width: 220px; margin: 0 auto 10px; }
.logo-slot { width: 76px; height: 76px; margin: 0 auto 10px; border: 2px dashed color-mix(in srgb, var(--header-fg) 55%, transparent); border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--header-fg); background: color-mix(in srgb, var(--header-fg) 8%, transparent); }
.logo-slot-mark { font-weight: 800; letter-spacing: .12em; font-size: .9rem; }
.logo-slot-note { font-size: .6rem; line-height: 1.15; text-align: center; color: var(--header-muted); padding: 0 4px; }
.card.login { width: min(440px, 100%); padding: 22px 22px 18px; box-shadow: 0 10px 30px rgba(18,48,74,.12); }
.login-title { font-size: 1.25rem; margin: 2px 0 14px; color: var(--text); }
.auth-desc { color: var(--muted); font-size: .92rem; margin: -6px 0 14px; text-align: center; overflow-wrap: anywhere; }
.auth-desc strong { color: var(--text); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 72px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 4px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--accent-ink); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.pw-toggle:hover { background: var(--surface-2); }
.check-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 2px 0 14px; }
.check-row .check { align-items: center; margin: 0; font-size: .9rem; min-height: 32px; cursor: pointer; }
.check-row .check input { width: 20px; height: 20px; flex: none; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.auth-links.center { justify-content: center; }
.link-btn { border: 0; background: none; padding: 6px 2px; min-height: 36px; font: inherit; font-size: .92rem; font-weight: 600; color: var(--accent-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.link-btn:hover { color: var(--primary); }
.login-hints { margin: 14px 0 0; padding: 12px 12px 12px 28px; background: var(--surface-2); border-radius: 10px; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.login-hints li + li { margin-top: 4px; }
.otp-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; padding-left: calc(12px + .5em); }
.otp-input::placeholder { color: color-mix(in srgb, var(--muted) 55%, transparent); letter-spacing: .5em; }
.otp-timer { text-align: center; font-size: .88rem; color: var(--muted); margin: -4px 0 12px; font-variant-numeric: tabular-nums; }
.otp-timer.expired { color: var(--danger); font-weight: 600; }
.auth-form .btn.block + .btn.block { margin-top: 8px; }
.pw-rules { list-style: none; margin: 0 0 14px; padding: 0; font-size: .85rem; color: var(--muted); display: grid; gap: 4px; }
.pw-rules li { padding-left: 24px; position: relative; }
.pw-rules li::before { content: '○'; position: absolute; left: 4px; }
.pw-rules li.met { color: var(--ok); }
.pw-rules li.met::before { content: '✓'; font-weight: 700; }
.setup-steps { padding-left: 20px; font-size: .9rem; line-height: 1.6; }
.setup-steps code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .82rem; overflow-wrap: anywhere; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; min-height: 0 !important; }
.credit.login-credit { margin-top: 4px; }
@media (max-width: 380px) { .card.login { padding: 18px 14px 14px; } .check-row { flex-direction: column; gap: 2px; } }
.sec-list { display: grid; gap: 0; margin-bottom: 12px; }
.sec-row { display: grid; grid-template-columns: 1fr minmax(120px, 200px); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sec-input { display: flex; align-items: center; gap: 8px; }
.sec-input input[type=number] { max-width: 110px; }
@media (max-width: 560px) { .sec-row { grid-template-columns: 1fr; gap: 6px; } }

/* ===== v4: วัสดุ (การ์ด/ตาราง/รูป), แถบโรงงาน, ตัวเลือกรูป ===== */
.mat-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 14px; }
.mat-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.mat-card:hover { border-color: var(--accent); }
.mat-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.mat-body .t { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.mat-body .s { color: var(--muted); font-size: .85rem; }
.mat-qty { font-size: 1.25rem; font-weight: 700; }
.mat-qty small { font-weight: 400; margin-left: 4px; }
.img-box { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.img-box img, .mat-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-missing { opacity: .4; }
.no-img { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: .85rem; text-align: center; padding: 8px; }
.no-img span:first-child { font-size: 1.8rem; }
.no-img.big { min-height: 200px; border: 2px dashed var(--border); border-radius: var(--radius); width: 100%; }
.thumb-sm { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; }
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.mat-detail { display: grid; gap: 14px; grid-template-columns: 1fr; }
.mat-hero { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.mat-hero .img-box { aspect-ratio: 4 / 3; max-height: 60vh; }
.mat-hero img { object-fit: contain; }
.mat-grid.pick { grid-template-columns: repeat(2, 1fr); max-height: 50vh; overflow-y: auto; }
.factory-bar, .factory-chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; margin-bottom: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: .95rem; }
.factory-bar select { min-height: 36px; border: 0; background: transparent; font-weight: 600; color: inherit; }
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.view-toggle button { border: 0; background: var(--surface); color: var(--text); padding: 6px 14px; min-height: 36px; cursor: pointer; }
.view-toggle button.active { background: var(--primary); color: var(--on-primary); }
.ro-chip { background: var(--info-soft); color: var(--info); border-radius: 999px; padding: 2px 10px; font-size: .8rem; white-space: nowrap; }
.nav-sub { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px 2px; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.ok-card { border-color: var(--ok); background: var(--ok-soft); }
.grid.two { grid-template-columns: 1fr; }
.modal.wide { max-width: 860px; }
.photo-capture, .img-picker { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.card.tight { padding: 10px 12px; margin-bottom: 8px; }
.space-between { justify-content: space-between; }
.role-radios { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.pre { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; max-width: 520px; overflow-wrap: anywhere; }
@media (min-width: 640px) { .mat-grid { grid-template-columns: repeat(3, 1fr); } .grid.two { grid-template-columns: 1fr 1fr; } .mat-detail { grid-template-columns: minmax(280px, 40%) 1fr; } }
@media (min-width: 1000px) { .mat-grid { grid-template-columns: repeat(4, 1fr); } .mat-grid.pick { grid-template-columns: repeat(3, 1fr); } }

/* ---------- v2.1.0: ตะกร้าเบิก / ปุ่มย้อนกลับ / รับเข้าหน้าเดียว ---------- */
.mat-card .mat-link { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.mat-card .mat-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 10px; }
.mat-card .mat-actions .btn { flex: 1 1 auto; }
td .mat-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; min-width: 190px; }
.cart-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: inherit; text-decoration: none; font-size: 1.3rem; }
.cart-count { position: absolute; top: 2px; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; line-height: 20px; text-align: center; }
.btn .cart-count { position: static; display: inline-block; margin-left: 4px; }
.cart-count.hidden { display: none; }
.back { display: inline-flex; align-items: center; min-height: 36px; font-weight: 600; }
.modal-back { background: none; border: 0; font: inherit; font-weight: 600; color: var(--accent-ink); cursor: pointer; padding: 4px 0; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 10px; }
.chip { font: inherit; font-size: .85rem; padding: 4px 10px; min-height: 32px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: inherit; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.receive-choice a.active { border-color: var(--accent); background: var(--surface-2, var(--surface)); }
.section-h { margin: 18px 0 8px; font-size: 1.1rem; }

/* ===== v2.1.0 แบรนด์ AMS: โลโก้จริง, หัวเว็บ/เมนู/Login แบบ AMS (เฉพาะ token และรูปแบบที่เกี่ยวข้อง) ===== */
/* หัวเว็บ: พื้นขาว ตัวอักษรกรมท่า ให้โลโก้สีน้ำเงินเห็นชัด */
.topbar { border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(11,42,91,.04), 0 2px 10px rgba(11,42,91,.05); }
.topbar .brand { color: var(--primary); font-weight: 700; }
.brand-link { display: flex; align-items: center; flex: none; border-radius: 10px; }
.brand-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.topbar-logo { height: 40px; width: 40px; object-fit: contain; border-radius: 9px; flex: none; }
.topbar button:focus-visible, .nav-collapse:focus-visible, .navlist a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.accent, .login .btn.primary, .auth-form .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.accent:hover:not(:disabled), .login .btn.primary:hover:not(:disabled), .auth-form .btn.primary:hover:not(:disabled) { background: #0F9AAB; border-color: #0F9AAB; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(18,174,193,.22); }
.toast { background: var(--primary-strong); }
/* Sidebar: พื้นไล่สีฟ้าอ่อนแบบ AMS */
.sidenav, .drawer { background: linear-gradient(180deg, #F8FCFF 0%, #EAF6FF 100%); }
.navlist a { color: var(--primary); font-weight: 500; }
.navlist a:hover:not(.active) { background: var(--accent-soft); color: var(--primary-strong); }
.navlist a.active { background: var(--accent-soft); color: var(--primary-strong); box-shadow: inset 4px 0 0 var(--accent); }
.nav-ic { display: inline-flex; flex: none; }
.nav-label { min-width: 0; overflow-wrap: anywhere; }
.nav-collapse { display: none; }
.drawer-head .drawer-logo { height: 44px; width: 44px; object-fit: contain; border-radius: 10px; display: block; margin-bottom: 8px; }
.drawer-brand { color: var(--primary); font-size: .95rem; }
.credit-logo { height: 28px; width: 28px; object-fit: contain; border-radius: 6px; }
.credit-text { min-width: 0; overflow-wrap: anywhere; word-break: keep-all; }
@media (min-width: 900px) {
  .sidenav { width: 248px; transition: width .2s ease; }
  main { transition: margin-left .2s ease; }
  .nav-collapse { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; min-height: 0; margin: 0 0 6px auto; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--primary); cursor: pointer; }
  .nav-collapse svg { width: 18px; height: 18px; transition: transform .2s ease; }
  .nav-collapse:hover { background: var(--accent-soft); }
  #layout.nav-collapsed .sidenav { width: 76px; padding: 12px 8px; }
  #layout.nav-collapsed main { margin-left: 76px; }
  #layout.nav-collapsed .nav-collapse { margin: 0 auto 6px; }
  #layout.nav-collapsed .nav-collapse svg { transform: rotate(180deg); }
  #layout.nav-collapsed .navlist a { justify-content: center; padding: 12px 6px; }
  /* เก็บข้อความไว้ให้โปรแกรมอ่านหน้าจอ แต่ซ่อนจากสายตาเมื่อพับ */
  #layout.nav-collapsed .nav-label, #layout.nav-collapsed .nav-sub, #layout.nav-collapsed .credit-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #layout.nav-collapsed .credit.side { justify-content: center; padding: 12px 0; }
}
/* Login / OTP / ตั้งรหัสผ่าน: พื้นฟ้าอ่อนเต็มหน้า การ์ดขาวกลางจอ โลโก้ในการ์ดด้านบน */
.login-wrap { background: linear-gradient(135deg, #F7FAFC 0%, #E0F2FE 100%); justify-content: center; padding: calc(env(safe-area-inset-top, 0px) + 20px) 16px calc(env(safe-area-inset-bottom, 0px) + 20px); }
.login-wrap::before { content: none; display: none; }
.auth-box { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 28px 22px; box-shadow: 0 20px 25px -5px rgba(15,23,42,.08), 0 8px 10px -6px rgba(15,23,42,.08); }
.auth-box .card.login { width: auto; max-width: none; padding: 0; margin: 0; border: 0; border-top: 0; box-shadow: none; background: transparent; }
.login-brand { color: var(--primary); margin-bottom: 18px; }
.login-brand h1 { color: var(--primary-strong); font-size: clamp(1.4rem, 5vw, 1.6rem); font-weight: 700; }
.login-brand p { color: var(--muted); font-size: .9rem; }
.login-logo { height: 72px; width: 72px; max-height: none; max-width: none; object-fit: contain; margin: 0 auto 12px; border-radius: 14px; }
.logo-slot { border-color: var(--border); color: var(--primary); background: var(--surface-2); }
.logo-slot-note { color: var(--muted); }
.credit.login-credit { color: var(--muted); }
@media (max-width: 380px) { .auth-box { padding: 20px 16px 16px; } }
@media (max-height: 480px) and (orientation: landscape) { .login-wrap { justify-content: flex-start; } .login-logo { height: 48px; width: 48px; margin-bottom: 6px; } .login-brand { margin-bottom: 8px; } .login-brand p { display: none; } }
.brand-link:empty { display: none; }

/* UI-01: compact authentication, independent navigation scroll and About dialog */
:root { --top-h: 56px; }
.topbar-logo { width: 34px; height: 34px; }
.login-wrap { gap: 12px; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.auth-box { width: min(400px, 100%); padding: 18px 22px 16px; }
.login-logo { height: 48px; width: 48px; margin-bottom: 6px; border-radius: 10px; }
.login-brand { margin-bottom: 10px; }
.login-brand h1 { font-size: 1.35rem; }
.login-brand p { font-size: .8rem; margin-top: 4px; }
.login-title { font-size: 1.1rem; margin: 0 0 10px; }
.auth-box .field { margin-bottom: 10px; }
.auth-box .check-row { gap: 4px 12px; margin-bottom: 10px; }
.auth-box .check-row .check { font-size: .8rem; }
.auth-box .auth-links { margin-top: 6px; }
.auth-box .link-btn { font-size: .82rem; }
.auth-box .login-hints { font-size: .72rem; padding: 8px 10px 8px 24px; margin-top: 8px; }
.credit { width: 100%; border: 0; background: transparent; font-family: inherit; font-weight: 400; text-align: left; cursor: pointer; border-radius: 8px; }
.credit:hover { background: var(--accent-soft); }
.credit:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.credit-text { display: flex; flex-direction: column; gap: 3px; }
.credit-version { color: var(--accent-ink); font-size: .75rem; font-weight: 600; }
.credit.login-credit { width: auto; padding: 6px 10px; }
.nav-collapse { flex: 0 0 32px; height: 32px; width: 32px; min-height: 32px; }
.sidenav .navlist, .drawer .navlist { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.sidenav .credit.side, .drawer .credit.side { flex: 0 0 auto; margin-top: 8px; padding: 10px 8px; }
.drawer { overflow: hidden; }
.drawer-head { flex: 0 0 auto; }
.navlist a { min-height: 40px; padding: 8px 10px; font-size: .88rem; gap: 10px; }
.navlist svg { width: 20px; height: 20px; }
.nav-sub { padding: 6px 10px 2px; }
@media (min-width: 900px) {
  .sidenav { width: 232px; padding: 8px; overflow: hidden; top: calc(var(--top-h) + env(safe-area-inset-top)); }
  main { margin-left: 232px; padding: 20px; }
  #layout.nav-collapsed .sidenav { padding: 8px; }
  #layout.nav-collapsed .navlist a { padding: 8px 6px; }
  #layout.nav-collapsed .credit.side { padding: 10px 0; }
}
@media (max-height: 720px) {
  .login-wrap { justify-content: flex-start; }
  .auth-box { padding: 14px 20px; }
  .login-brand { margin-bottom: 8px; }
  .login-logo { width: 40px; height: 40px; }
}
@media (max-width: 380px) { .auth-box { padding: 14px; } }
.about-dialog { width: min(580px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--border); border-radius: 16px; color: var(--text); background: var(--surface); overflow-y: auto; box-shadow: 0 20px 60px #071d4233; }
.about-dialog::backdrop { background: #071d4277; backdrop-filter: blur(3px); }
.about-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.about-heading h2 { margin: 0; color: var(--primary); }
.about-close { flex: none; width: 44px; height: 44px; font: inherit; font-size: 1.8rem; color: var(--muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.about-close:hover, .about-close:focus-visible { background: var(--accent-soft); outline-color: var(--accent); }
.about-body { text-align: center; padding: 24px 20px; background: linear-gradient(135deg, #fff, #e7f8fb); overflow-wrap: anywhere; }
.about-logo { display: block; width: 112px; height: 112px; object-fit: contain; margin: 0 auto 16px; }
.about-body h3 { color: var(--primary); font-size: 1.5rem; }
.about-version { font-weight: 600; color: var(--accent-ink); }

.login-help { font-size: .78rem; margin-top: 8px; color: var(--muted); }
.login-help summary { cursor: pointer; padding: 6px 0; min-height: 32px; color: var(--accent-ink); }
.login-help summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-height: 720px) and (min-width: 381px) {
  .login-brand { display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; text-align: left; align-items: center; }
  .login-brand .login-logo { grid-row: 1 / 3; margin: 0; }
  .login-brand h1 { font-size: 1.15rem; }
  .login-brand p { font-size: .75rem; }
}

/* UI-02: readable, compact page components and consistent pale blue header. */
:root { --header-bg: #F0F9FF; }
.topbar { background: linear-gradient(180deg, #F8FCFF 0%, #EAF6FF 100%); }
.credit.side { font-size: .72rem; line-height: 1.4; gap: 7px; }
.credit.side .credit-logo { width: 24px; height: 24px; }
.credit.side .credit-text { gap: 2px; overflow-wrap: normal; word-break: normal; }
.credit-caption { font-size: .7rem; }
.credit-name { font-size: .74rem; font-weight: 500; }
.credit.side .credit-version { font-size: .72rem; }
main { min-width: 0; font-size: .9rem; }
main h1 { font-size: 1.25rem; line-height: 1.4; }
main h2 { font-size: 1.05rem; line-height: 1.45; }
main h3, main .section-h { font-size: 1rem; line-height: 1.45; }
main label { font-size: .84rem; }
main .btn { font-size: .88rem; padding: 8px 12px; }
main .btn.small { font-size: .82rem; padding: 6px 10px; }
main .btn svg { width: 18px; height: 18px; flex: none; }
main .tabs a, main .tabs button { font-size: .84rem; padding: 8px 12px; }
main table { font-size: .84rem; }
main th, main td { padding: 8px; }
main .section-title { flex-wrap: wrap; align-items: center; }
main .section-title h1 { min-width: 0; margin-bottom: 0; }
main .section-title > .row { min-width: 0; }
main .kpis { grid-template-columns: repeat(auto-fit, minmax(min(132px, 100%), 1fr)); gap: 10px; }
main .kpi { min-width: 0; padding: 10px; }
main .kpi .v { font-size: clamp(1.2rem, 1.6vw, 1.5rem); overflow-wrap: anywhere; }
main .kpi .l { font-size: .78rem; line-height: 1.5; }
main .list-item, main .card, main .row > *, .modal .row > * { min-width: 0; }
main .list-item .t, main .list-item .s, main td { overflow-wrap: anywhere; }
main input, main select, main textarea { min-width: 0; }
@media (min-width: 900px) {
  main input, main select, main textarea { font-size: .9rem; padding: 8px 10px; }
  main .filters { grid-template-columns: repeat(auto-fit, minmax(min(164px, 100%), 1fr)); }
}
@media (max-width: 480px) {
  main { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-left: 8px; padding-right: 8px; gap: 6px; }
  .topbar .brand { font-size: .95rem; }
  .topbar .who { font-size: .72rem; max-width: 28vw; }
  .topbar-logo { width: 28px; height: 28px; }
  .topbar .brand-full { display: none; }
  .topbar .brand-short { display: inline; }
  .section-title > .row { flex-wrap: wrap; }
}

.cart-icon { display: inline-flex; }
.cart-icon svg { width: 22px; height: 22px; display: block; }
/* v2.2.0 — action quantities and executive summary */
.quick-actions { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.quick-action-row { display: grid; grid-template-columns: auto 120px 1fr; gap: 6px; align-items: center; min-width: 0; }
.quick-unit { font-size: .72rem; color: var(--muted); }
.quantity-control { display: flex; min-width: 0; align-items: stretch; }
.quantity-control input { width: 48px; min-width: 0; padding: 6px 2px; text-align: center; border-radius: 0; appearance: textfield; }
.quantity-control input::-webkit-inner-spin-button { appearance: none; }
.quantity-step { font: inherit; font-weight: 600; width: 36px; min-height: 44px; padding: 0; color: var(--primary); border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.quantity-step:first-child { border-radius: 8px 0 0 8px; }
.quantity-step:last-child { border-radius: 0 8px 8px 0; }
.quantity-step:disabled, .quantity-control input:disabled { opacity: .45; cursor: not-allowed; }
.quick-actions .btn { white-space: normal; line-height: 1.4; min-height: 44px; }
.quick-mode-hint { font-size: .7rem; line-height: 1.4; }
.mat-grid .quick-action-row { grid-template-columns: 110px minmax(0,1fr); }
.mat-grid .quick-unit { grid-column: 1/-1; }
.mat-grid .quantity-control input { width: 42px; }
.mat-grid .quantity-step { width: 34px; }
.mat-grid .img-box { aspect-ratio: 16/10; }
.mat-grid .img-box img { object-fit: contain; background: #fff; }
@media (min-width: 900px) { .mat-grid { grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); } }
.table-wrap .quick-actions { min-width: 310px; }
.summary-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.summary-metric { display: flex; flex-direction: column; border: 1px solid var(--border); border-top: 3px solid var(--accent); padding: 12px; border-radius: 10px; background: white; }
.summary-metric span, .summary-metric small { color: var(--muted); font-size: .76rem; }
.summary-metric strong { font-size: 1.55rem; color: var(--primary); }
.summary-unit-picker { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.summary-unit-picker select { width: auto; min-width: 110px; margin-left: 8px; }
.summary-chart-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.summary-chart-card { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 16px; min-width: 0; }
.chart-caption { font-size: .75rem; color: var(--muted); margin: 4px 0 12px; }
.summary-bar-row { display: grid; grid-template-columns: 135px minmax(50px,1fr) auto; gap: 8px; align-items: center; margin: 14px 0; font-size: .8rem; }
.summary-track { height: 12px; background: var(--surface-2); overflow: hidden; border-radius: 6px; }
.summary-fill { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--accent); }
.summary-fill.received, .trend-bar.received { background: #12AEC1; }
.summary-fill.withdrawn, .trend-bar.withdrawn { background: #176B9B; }
.summary-fill.balance { background: #11795A; }
.requester-share { margin-bottom: 10px; font-size: .78rem; }
.requester-share .row { margin-bottom: 4px; }
.health-stack { display: flex; height: 24px; border-radius: 8px; overflow: hidden; background: var(--surface-2); margin-bottom: 12px; }
.health-part.normal { background: #11795A; }
.health-part.low { background: #DEA024; }
.health-part.out { background: #C0352B; }
.health-label::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.health-label.normal::before { background: #11795A; }.health-label.low::before { background: #DEA024; }.health-label.out::before { background: #C0352B; }
.trend-bars { display: flex; height: 150px; gap: 8px; margin-top: 12px; }
.trend-group { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.trend-group small { font-size: .6rem; white-space: nowrap; margin-top: 6px; }
.trend-pair { display: flex; height: 120px; width: 100%; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--border); }
.trend-bar { width: 38%; max-width: 20px; border-radius: 3px 3px 0 0; }
.chart-legend { display: flex; gap: 16px; justify-content: center; font-size: .75rem; margin-top: 10px; }
.chart-legend .received { color: #087C8D; }.chart-legend .withdrawn { color: #176B9B; }
.summary-notes { margin-bottom: 20px; font-size: .78rem; color: var(--muted); }
.summary-notes summary { cursor: pointer; padding: 8px 0; }
.stock-print-root { display: none; }
@media (max-width: 640px) { .summary-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } .summary-chart-grid { grid-template-columns: 1fr; } .quick-action-row { grid-template-columns: 110px 1fr; } .quick-unit { grid-column:1/-1; } .summary-bar-row { grid-template-columns: 110px minmax(40px,1fr) auto; } }
@page { size: A4 landscape; margin: 8mm; }
@media print {
  body > *:not(#stock-print-root):not(#ams-print-root) { display: none !important; }
  body { background: white; margin: 0; }
}
  #stock-print-root { width: 281mm; color: #102A43; font: 8pt/1.28 'Prompt',Tahoma,sans-serif; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  #stock-print-root * { box-shadow: none; }
  #stock-print-root h1 { font-size: 16pt; margin: 0 0 2mm; }
  #stock-print-root h2 { font-size: 9pt; margin: 2mm 0 1mm; }
  #stock-print-root p { margin: 1mm 0; }
  #stock-print-root .print-summary-head { display:flex; align-items:center; gap:3mm; border-bottom:1px solid #DCE8F2; padding-bottom:2mm; }
  #stock-print-root .print-summary-head small { margin-left:auto; max-width:42mm; }
  #stock-print-root .print-summary-head p { max-width:190mm; overflow-wrap:anywhere; }
  #stock-print-root .summary-metrics { gap:2mm; margin:2mm 0; }
  #stock-print-root .summary-metric { padding:2mm; border-radius:2mm; }
  #stock-print-root .summary-metric strong { font-size:14pt; }
  #stock-print-root .summary-metric span, #stock-print-root .summary-metric small { font-size:7pt; }
  #stock-print-root table { font-size:7pt; table-layout:fixed; width:100%; }
  #stock-print-root th, #stock-print-root td { padding:1mm; white-space:normal; overflow-wrap:anywhere; }
  #stock-print-root .table-wrap { overflow:visible; border-radius:1mm; }
  #stock-print-root .print-two { display:grid; grid-template-columns: 2fr 1fr; gap:3mm; }
  #stock-print-root footer { font-size:6.5pt; border-top:1px solid #DCE8F2; margin-top:2mm; padding-top:1mm; }
  #stock-print-root section, #stock-print-root tr { break-inside:avoid; }
@media print { #stock-print-root { display:block; } }

.material-table table { min-width: 1350px; }
.material-table th:nth-child(2), .material-table td:nth-child(2) { min-width: 90px; white-space: nowrap; }
.material-table th:nth-child(3), .material-table td:nth-child(3) { min-width: 210px; }
.material-table .thumb-sm { min-width: 44px; }
.summary-metric strong { overflow-wrap: anywhere; }
.mat-grid:not(.pick) { grid-template-columns: repeat(auto-fill,minmax(min(100%,250px),1fr)); }
.public-info-links { display:flex; justify-content:center; flex-wrap:wrap; gap:4px 14px; font-size:11px; line-height:1.5; margin-top:12px; }
.public-info-links a { color:var(--muted); text-underline-offset:3px; }
#stock-print-root .health-stack { height: 6mm; margin: 2mm 0; }

/* ===== v2.2.5: เบิกผ่าน QR กลางโรงงาน ===== */
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #D64545; color: #fff; font-size: .72rem; line-height: 20px; text-align: center; font-weight: 700; }
.nav-badge.hidden { display: none; }
.pub-wrap { max-width: 720px; margin: 0 auto; padding: 12px 16px 96px; }
.pub-head { display: flex; align-items: center; gap: 12px; padding: 8px 0 12px; border-bottom: 1px solid var(--line, #DCE8F2); margin-bottom: 12px; }
.pub-title { font-weight: 700; font-size: 1.15rem; }
.pub-foot { text-align: center; padding: 16px 0; font-size: .8rem; }
.pub-list { display: grid; gap: 8px; margin-top: 8px; }
.pub-mat { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px; border: 1px solid var(--line, #DCE8F2); border-radius: 10px; background: var(--card, #fff); flex-wrap: wrap; }
.pub-mat.out { opacity: .6; }
.pub-qty { display: flex; align-items: center; gap: 6px; }
.pub-qty input { width: 80px; text-align: center; }
.pub-stick { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--card, #fff); border-top: 1px solid var(--line, #DCE8F2); z-index: 20; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wd-no { text-align: right; } .wd-no strong { font-size: 1.3rem; } .wd-no.big { text-align: center; margin: 8px 0; } .wd-no.big strong { font-size: 2rem; }
.wd-code { text-align: center; margin-bottom: 12px; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; }
.wd-steps { list-style: none; padding: 0; display: grid; gap: 8px; } .wd-steps li.done strong { color: #1B7F4B; }
.pub-done ol { margin: 6px 0 0 18px; padding: 0; }
.qr-card .qr-img.sm svg { width: 180px; height: 180px; } .qr-img svg { max-width: 100%; height: auto; }
.wd-sheet { font: 10.5pt/1.5 'Prompt', Tahoma, sans-serif; color: #102A43; }
.wd-sheet-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #102A43; padding-bottom: 6px; margin-bottom: 8px; } .wd-sheet-head h1 { font-size: 16pt; margin: 0 0 2px; }
.wd-sheet-table { width: 100%; border-collapse: collapse; margin: 8px 0; } .wd-sheet-table th, .wd-sheet-table td { border: 1px solid #5B6B7B; padding: 4px 6px; text-align: left; } .wd-sheet-table td.num { text-align: right; }
.wd-sigs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 36px; text-align: center; } .sig-line { border-bottom: 1px solid #102A43; height: 36px; margin-bottom: 4px; }
.wd-sheet-foot { margin-top: 18px; font-size: 9pt; }
.qr-poster { text-align: center; font: 14pt/1.6 'Prompt', Tahoma, sans-serif; color: #102A43; } .qr-poster h1 { font-size: 26pt; margin: 6mm 0 2mm; } .qr-poster h2 { font-size: 18pt; margin: 0 0 6mm; } .qr-poster .qr-img svg { width: 120mm; height: 120mm; } .qr-poster ol { display: inline-block; text-align: left; font-size: 15pt; margin: 6mm 0; }
#ams-print-root { display: none; }
@page ams { size: A4 portrait; margin: 12mm; }
@media print { #ams-print-root { display: block; page: ams; background: #fff; } .no-print { display: none !important; } }
@media (max-width: 640px) { .pub-mat { align-items: flex-start; } }

/* v2.2.5: หน้าเบิกสาธารณะแบบการ์ด + รถเข็น */
.pub-wrap { max-width: 1500px; }
.pub-wrap .material-table .quick-action-row { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; white-space: nowrap; } .pub-wrap .material-table .quick-unit { display: none; } .pub-wrap .material-table td { padding: 6px 8px; }
.pub-grid { margin-top: 12px; }
.pub-grid .mat-card .mat-actions { align-items: center; padding-top: 4px; }
.pub-grid .pub-qty { flex: 1 1 100%; justify-content: space-between; } .pub-grid .pub-qty input { flex: 1; width: auto; min-width: 0; }
.pub-card-out, .mat-card.pub-out { opacity: .65; }
.pub-ribbon { position: absolute; top: 8px; left: 8px; background: #C0392B; color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 999px; }
.pub-incart { color: #1B7F4B; font-weight: 600; min-height: 1em; }
.pub-search { padding: 8px; } .pub-search input { width: 100%; }
.pub-mat .pub-qty { flex-wrap: wrap; }
.mat-grid.pub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .mat-grid.pub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .mat-grid.pub-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pub-grid .pub-qty { display: flex; gap: 4px; width: 100%; } .pub-grid .pub-qty input { min-width: 0; width: 100%; padding-left: 4px; padding-right: 4px; } .pub-grid .pub-qty .quantity-step { flex: 0 0 34px; min-width: 34px; padding: 0; }
.pub-grid .mat-actions .btn { width: 100%; }
.pub-grid .mat-body .t { font-size: .92rem; }
.pub-wrap .sticky-actions { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
/* v2.2.10: สีกราฟ — รับเข้า = เขียว, เบิกใช้ = เหลือง, พร้อมใช้ = น้ำเงิน (เจ้าของขอ 29/10/2569) + ตัวเลือกหน่วยขนาดเท่าตัวกรองหน้าวัสดุ */
.summary-fill.received, .trend-bar.received { background: #1E9E5A; }
.summary-fill.withdrawn, .trend-bar.withdrawn { background: #EAB308; }
.summary-fill.balance { background: #176B9B; }
.chart-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .received { color: #13753F; font-weight: 600; }.chart-legend .received::before { background: #1E9E5A; }
.chart-legend .withdrawn { color: #8A6400; font-weight: 600; }.chart-legend .withdrawn::before { background: #EAB308; }
.summary-unit-picker select { min-width: 220px; }
.summary-unit-head { font-size: .78rem; font-weight: 700; color: var(--primary); margin: 14px 0 -6px; padding-top: 8px; border-top: 1px dashed var(--border); }
.summary-unit-head:first-of-type { border-top: 0; padding-top: 0; }
/* v2.2.11: กล้องสด (ถ่ายรูปจัดของ) */
.cam-overlay { position: fixed; inset: 0; z-index: 1000; background: #000; display: flex; flex-direction: column; }
.cam-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam-video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam-msg { position: absolute; color: #fff; font-size: 1rem; text-align: center; padding: 12px; }
.cam-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: #111; }
.cam-bar .btn.ghost { color: #fff; border-color: #555; }
.cam-shoot { font-size: 1.1rem; padding: 14px 24px; }
/* v2.2.12: โหมดจับเวลา (?timing=1) */
.timing-badge { position: fixed; top: calc(6px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 99998; max-width: min(96vw, 560px); background: rgba(18,48,74,.94); color: #fff; font: 600 13px/1.4 system-ui, sans-serif; border-radius: 10px; padding: 6px 10px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.timing-main { cursor: pointer; }
.timing-list { max-height: 40vh; overflow: auto; font-weight: 400; font-size: 12px; margin-top: 6px; border-top: 1px solid rgba(255,255,255,.25); padding-top: 4px; }
.timing-list.hidden { display: none; }
.timing-actions { display: flex; gap: 6px; margin-top: 4px; }
.timing-actions button { font-size: 12px; padding: 2px 8px; border-radius: 6px; border: 0; background: #fff; color: #12304A; }

/* ===== v2.2.14 ธีมมินิมอล (override) — ไม่มีโลโก้ในหน้าเว็บ, พื้นขาวสะอาด, เส้นบาง, ตัวเลขเด่น ===== */
:root {
  --bg: #FAFBFC; --surface-2: #F3F5F8; --border: #E8ECF1; --muted: #6B7686; --text: #1B2433;
  --shadow: none; --radius: 12px;
}
body { background: var(--bg); letter-spacing: .005em; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); box-shadow: none; }
.topbar .brand, .topbar a.brand { color: var(--navy); text-decoration: none; font-weight: 600; font-size: 1.1rem; letter-spacing: .02em; }
.topbar a.brand:hover { color: var(--teal-ink); }
.sidenav, .drawer { background: #fff; }
.sidenav { border-right: 1px solid var(--border); }
.navlist a { color: #46536A; font-weight: 400; border-radius: 8px; }
.navlist a:hover:not(.active) { background: var(--surface-2); color: var(--navy); }
.navlist a.active { background: var(--surface-2); color: var(--navy); font-weight: 600; box-shadow: none; }
.navlist a.active svg { color: var(--teal-ink); }
.bottomnav { border-top: 1px solid var(--border); }
.bottomnav a.active { box-shadow: none; color: var(--navy); }
.card { box-shadow: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.login { border-top: 1px solid var(--border); box-shadow: 0 8px 28px rgba(16,42,67,.06); }
h1 { font-size: 1.5rem; font-weight: 600; color: var(--navy); }
h2 { font-size: 1.05rem; font-weight: 600; color: var(--navy); }
.kpis { gap: 12px; }
.kpi, main .kpi { border: 1px solid var(--border); border-top: 1px solid var(--border); border-radius: var(--radius); padding: 16px 14px; background: #fff; transition: border-color .15s; }
a.kpi:hover { border-color: var(--teal); }
.kpi .v, main .kpi .v { font-size: clamp(1.5rem, 2vw, 1.9rem); font-weight: 600; color: var(--navy); letter-spacing: -.01em; }
.kpi .l, main .kpi .l { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.kpi.kpi-alert, .kpi.kpi-warn { border-top: 1px solid var(--border); position: relative; }
.kpi.kpi-alert::before, .kpi.kpi-warn::before { content: ""; position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; }
.kpi.kpi-alert::before { background: var(--danger); } .kpi.kpi-warn::before { background: #E0A100; }
.kpi.kpi-alert .v { color: var(--danger); } .kpi.kpi-warn .v { color: var(--warn); }
.summary-metric { border: 1px solid var(--border); border-top: 1px solid var(--border); border-radius: var(--radius); padding: 16px 14px; }
.summary-metric strong { font-weight: 600; color: var(--navy); }
.summary-chart-card { border-radius: var(--radius); padding: 20px; }
.summary-track, .bars .track { height: 8px; border-radius: 4px; background: var(--surface-2); }
.summary-fill, .bars .fill { background: var(--teal); }
.summary-fill.received, .trend-bar.received { background: #34B27B; }
.summary-fill.withdrawn, .trend-bar.withdrawn { background: #6C8CD5; }
.trend-bar { border-radius: 3px 3px 0 0; }
.table-wrap { border-radius: var(--radius); border-color: var(--border); }
th { background: #fff; color: var(--muted); font-weight: 500; font-size: .8rem; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid #F0F3F6; }
tbody tr:hover td { background: #FAFCFD; }
.badge { font-weight: 500; }
.btn { border-radius: 8px; font-weight: 500; }
.btn.accent, .login .btn.primary, .auth-form .btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.accent:hover:not(:disabled), .login .btn.primary:hover:not(:disabled), .auth-form .btn.primary:hover:not(:disabled) { background: var(--navy-dark); border-color: var(--navy-dark); }
input, select, textarea { border-radius: 8px; }
.login-brand h1 { font-weight: 600; letter-spacing: .02em; }
.login-brand { text-align: center; }
.summary-chart-grid { align-items: start; gap: 16px; }
main .kpis { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
.kpi .v, main .kpi .v { font-size: clamp(1.35rem, 1.5vw, 1.65rem); overflow-wrap: normal; }
main h2 { margin: 28px 0 12px; }
.summary-notes, main > small, .page-foot { margin-top: 8px; }
.login-wrap::before { display: none; }
.login-wrap { justify-content: center; background: var(--bg); }
.login-brand h1 { color: var(--navy); }
.login-brand p { color: var(--muted); }
/* v2.2.14: ชื่อผู้ใช้บนหัวเว็บ — บรรทัดเดียวต่อบรรทัด ตัดด้วย … ไม่ล้นหัวเว็บบนมือถือ */
.topbar .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; line-height: 1.3; }
.topbar .who small { display: inline; }
@media (max-width: 480px) { .topbar .who { max-width: 44vw; font-size: .76rem; } }

/* ===== v2.2.15 สีสัน: หัวเว็บไล่สีน้ำเงิน-ฟ้า + เมนูซ้ายน้ำเงินเข้ม (ตัวอักษรขาว) ===== */
.login-brand .login-logo { height: 72px; width: 72px; border-radius: 18px; box-shadow: 0 6px 18px rgba(11,42,91,.25); margin: 0 auto 12px; }
.topbar { background: linear-gradient(90deg, #0B2A5B 0%, #12467F 55%, #176B9B 100%); color: #fff; border-bottom: 0; box-shadow: 0 2px 10px rgba(11,42,91,.25); }
.topbar .brand, .topbar a.brand { color: #fff; }
.topbar a.brand:hover { color: #BDEFF5; }
.topbar .who, .topbar .who small { color: #fff !important; }
.topbar .who small { opacity: .75; }
.topbar button { color: #fff; }
.topbar button:hover { background: rgba(255,255,255,.14); }
.topbar button:focus-visible { outline-color: #7FE3EE; }
.sidenav, .drawer { background: linear-gradient(180deg, #0F3470 0%, #0B2A5B 55%, #071D42 100%); border-right: 0; color: #E6EEF9; }
.navlist a { color: #CFDDF2; }
.navlist a:hover:not(.active) { background: rgba(255,255,255,.09); color: #fff; }
.navlist a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #2CD0DD; }
.navlist a.active svg, .navlist a:hover svg { color: #2CD0DD; }
.navlist hr { border-top-color: rgba(255,255,255,.14); }
.navlist .nav-sub, .navlist small, .sidenav .muted, .drawer .muted { color: #8FB0DC; }
.nav-collapse { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.nav-collapse:hover { background: rgba(255,255,255,.2); }
.drawer-head { border-bottom-color: rgba(255,255,255,.16); }
.drawer-head strong, .drawer-brand { color: #fff; }
.drawer-head small, .drawer-head .muted { color: #A9C2E6; }
.credit.side { border-top-color: rgba(255,255,255,.16); color: #A9C2E6; }
.credit:hover { background: rgba(255,255,255,.08); }
.credit-name { color: #E6EEF9; }
.credit-version, .credit.side .credit-version { color: #7FE3EE; }
.sidenav { scrollbar-color: rgba(255,255,255,.3) transparent; }
.drawer-backdrop { background: rgba(7,29,66,.5); }

/* v2.2.16: โลโก้เล็กหน้าชื่อระบบบนหัวเว็บ */
.topbar a.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .brand-mark { width: 38px; height: 38px; flex: none; border-radius: 11px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.35), 0 3px 8px rgba(0,0,0,.25); }
.topbar .brand-full, .topbar .brand-short { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { .topbar .brand-mark { width: 34px; height: 34px; border-radius: 10px; } }
@media (max-width: 480px) { .topbar a.brand { gap: 8px; font-size: .95rem; } .topbar .who { max-width: 36vw; } .topbar .brand-mark { width: 32px; height: 32px; } }
/* v2.2.17: มุมโค้งของกรอบโลโก้ต้องเท่ากับมุมโค้งของรูปไอคอน (22.3%) ไม่ให้ดูเป็นสี่เหลี่ยมโดนตัดมุม */
.topbar .brand-mark, .login-brand .login-logo { border-radius: 22.3% !important; }
.topbar .brand-mark { box-shadow: 0 0 0 1px rgba(255,255,255,.28), 0 4px 10px rgba(0,0,0,.28); }
.topbar a.brand { overflow: visible; text-overflow: clip; padding: 4px 4px 4px 0; }

/* ===== v2.3.1 ===== */
/* หน้า Login: โลโก้กับชื่อระบบไม่เบียดกัน — จอเตี้ย (แล็ปท็อป/ซูม) ใช้โลโก้เล็กลงแต่ยังเรียงบน-ล่างกึ่งกลาง ไม่ใช้ตารางกริด 40px เดิมที่ทำให้โลโก้ 72px ล้นทับข้อความ */
.login-brand { display: flex !important; flex-direction: column; align-items: center; text-align: center !important; }
.login-brand .login-logo { grid-row: auto !important; flex: 0 0 auto; margin: 0 auto 10px !important; }
.login-brand h1, .login-brand p { margin-left: 0; margin-right: 0; max-width: 100%; overflow-wrap: anywhere; }
@media (max-height: 720px) {
  .login-brand { margin-bottom: 10px; }
  .login-brand .login-logo { width: 56px !important; height: 56px !important; margin-bottom: 8px !important; }
  .login-brand h1 { font-size: 1.35rem; }
  .login-brand p { font-size: .8rem; margin-top: 2px; }
}
/* ตารางแบบ stack: จอแคบแสดงแต่ละแถวเป็นการ์ด */
@media (max-width: 720px) {
  .table-wrap.stack { border: 0; background: transparent; overflow: visible; }
  .table-wrap.stack table, .table-wrap.stack tbody, .table-wrap.stack tr, .table-wrap.stack td { display: block; width: 100%; }
  .table-wrap.stack thead { display: none; }
  .table-wrap.stack tr { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 10px; padding: 8px 12px; }
  .table-wrap.stack td { display: flex; gap: 10px; padding: 4px 0; border: 0; text-align: left; min-width: 0; overflow-wrap: anywhere; }
  .table-wrap.stack td::before { content: attr(data-label); flex: 0 0 5.2em; color: var(--muted); font-size: .78rem; }
}

/* v2.3.7: ตัวเลขงานรอทำบนแถบเมนูล่าง (มือถือ) */
.bottomnav a { position: relative; }
.bn-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 999px; background: #D64545; color: #fff; font-size: .68rem; line-height: 18px; text-align: center; font-weight: 700; }
.bn-badge.hidden { display: none; }

/* v2.3.19: เครดิตท้ายเมนู — ปกติแสดงแค่เลขเวอร์ชันแบบจาง ๆ; ชี้เมาส์/โฟกัสคีย์บอร์ด แล้วชื่อผู้พัฒนาเลื่อนขึ้นมาอย่างนุ่มนวล */
.credit-more { display: grid; grid-template-rows: 1fr; }
.credit-more-inner { display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow: hidden; }
.credit-version { display: inline-flex; align-items: center; gap: 6px; }
.credit-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; opacity: .8; }
.credit .v-short { display: none; }
.credit.side { border-top-color: transparent; padding: 8px 10px; }
.credit.side .credit-text { gap: 0; }
.credit.side .credit-more { grid-template-rows: 0fr; opacity: 0; transform: translateY(4px); transition: grid-template-rows .28s ease, opacity .22s ease, transform .28s ease; }
.credit.side .credit-more-inner { padding-bottom: 0; transition: padding .28s ease; }
.credit.side .credit-version { align-self: flex-start; font-size: .7rem; font-weight: 500; letter-spacing: .02em; color: rgba(127, 227, 238, .55); padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); transition: color .2s ease, background .2s ease, box-shadow .2s ease; }
.credit.side:hover, .credit.side:focus-visible { background: rgba(255, 255, 255, .06); }
.credit.side:hover .credit-more, .credit.side:focus-visible .credit-more { grid-template-rows: 1fr; opacity: 1; transform: none; }
.credit.side:hover .credit-more-inner, .credit.side:focus-visible .credit-more-inner { padding-bottom: 8px; }
.credit.side:hover .credit-version, .credit.side:focus-visible .credit-version { color: #7FE3EE; background: rgba(44, 208, 221, .12); box-shadow: inset 0 0 0 1px rgba(44, 208, 221, .35); }
@media (hover: none) { .credit.side:hover .credit-more { grid-template-rows: 0fr; opacity: 0; transform: translateY(4px); } .credit.side:hover .credit-more-inner { padding-bottom: 0; } }
@media (prefers-reduced-motion: reduce) { .credit.side .credit-more, .credit.side .credit-more-inner, .credit.side .credit-version { transition: none; } }
@media (min-width: 900px) {
  #layout.nav-collapsed .credit.side .credit-text { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; align-items: center; }
  #layout.nav-collapsed .credit.side .credit-more { display: none; }
  #layout.nav-collapsed .credit.side .credit-version { align-self: center; padding: 3px 6px; font-size: .64rem; }
  #layout.nav-collapsed .credit.side .v-long, #layout.nav-collapsed .credit.side .credit-dot { display: none; }
  #layout.nav-collapsed .credit.side .v-short { display: inline; }
}

/* v2.3.20 (ปรับเพิ่ม): กราฟวงกลมสถานะสต๊อกปัจจุบัน */
.health-chart { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: 4px; }
.health-donut { position: relative; flex: none; width: 148px; height: 148px; border-radius: 50%; background: var(--surface-2); box-shadow: 0 6px 18px -8px rgba(11, 42, 91, .35); }
.health-donut.empty { background: var(--surface-2); }
.health-donut-hole { position: absolute; inset: 22px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--border); }
.health-donut-hole strong { font-size: 1.7rem; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.health-donut-hole small { font-size: .78rem; color: var(--muted); }
.health-legend { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.health-legend-row { display: grid; grid-template-columns: 1fr auto 3.6em; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.health-legend-row:last-child { border-bottom: 0; padding-bottom: 0; }
.health-legend-row strong { font-variant-numeric: tabular-nums; }
.health-legend-row small { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .health-chart { justify-content: center; } .health-donut { width: 132px; height: 132px; } .health-donut-hole { inset: 20px; } }

/* v2.3.20 (ปรับเพิ่ม): ป้าย QR — บรรทัด "หน่วยงานธุรการ" ระหว่างหัวเรื่องกับชื่อโรงงาน */
.qr-poster .qr-poster-unit { margin: 0 0 2mm; font-size: 16pt; font-weight: 600; color: var(--accent-ink); letter-spacing: .02em; }
