/* HT Pick RM — styles for Zebra handhelds (Chrome on Android). Same look as the mockup. */
:root {
  --bg: #eef1f5; --surface: #ffffff; --surface-2: #f5f7fa; --ink: #1b2430; --ink-2: #5b6675; --line: #d5dbe3;
  --brand: #0b5cad; --brand-ink: #ffffff; --ok: #1d7a3e; --ok-bg: #e3f4e9; --warn: #9a5b00; --warn-bg: #fff3dc;
  --err: #b42318; --err-bg: #fde8e6; --field: #fbfcfd; --field-ro: #eef1f5; --focus: #f0b400;
  --shadow: 0 10px 30px rgba(20, 30, 50, .15);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10141a; --surface: #1a2029; --surface-2: #212833; --ink: #e8edf3; --ink-2: #9aa6b5; --line: #333d4a;
    --brand: #4c9be8; --brand-ink: #0b1420; --ok: #5fd08a; --ok-bg: #173323; --warn: #f2b84b; --warn-bg: #352a12;
    --err: #ff8a80; --err-bg: #3a1a18; --field: #141a22; --field-ro: #222a35; --shadow: 0 10px 30px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Sarabun", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.4;
}
.hidden { display: none !important; }

.device {
  width: 100%; max-width: 480px; margin: 0 auto; background: var(--surface);
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}
.appbar { background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 56px; position: sticky; top: 0; z-index: 2; }
.appbar h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 700; }
.appbar .sub { font-size: 13px; opacity: .85; font-weight: 400; display: block; }
.iconbtn { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 10px; min-width: 44px; height: 40px; font: inherit; font-weight: 700; cursor: pointer; padding: 0 8px; }
.ctx { display: flex; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.ctx b { color: var(--ink); }
.screen { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px; }

/* Forms */
.row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 8px; }
.row.three { grid-template-columns: 84px 1fr 60px; }
.row.hu { grid-template-columns: 84px 1fr 1fr; }
label.l { font-weight: 600; font-size: 15px; }
.field { width: 100%; min-height: 46px; border: 2px solid var(--line); border-radius: 10px; background: var(--field); color: var(--ink); font: inherit; font-size: 17px; padding: 8px 10px; min-width: 0; }
.field:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.field[readonly] { background: var(--field-ro); border-color: transparent; }
.field.scan { border-style: dashed; border-color: var(--brand); }
.field:disabled { opacity: .5; }
.unit { font-weight: 600; text-align: center; background: var(--field-ro); border-radius: 10px; min-height: 46px; display: grid; place-items: center; }
.desc { background: var(--field-ro); border-radius: 10px; padding: 10px 12px; font-size: 16px; min-height: 22px; }
.desc:empty { display: none; }
.hint { font-size: 13px; color: var(--ink-2); }
.spacer { flex: 1; }
.who { font-size: 14px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.who a { color: var(--brand); font-weight: 600; }

.btn { min-height: 52px; border-radius: 12px; border: 2px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; width: 100%; }
.btn.secondary { background: transparent; color: var(--brand); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: var(--surface); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btnrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.btnrow.two { grid-template-columns: 1fr 1fr; }
.btnrow .btn { font-size: 16px; min-height: 48px; }

/* WT list */
.list { display: flex; flex-direction: column; gap: 8px; }
.wt { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; background: var(--surface); }
.wt.done { background: var(--ok-bg); }
.wt.pending { border-color: var(--warn); }
.wt .l1 { font-weight: 700; overflow-wrap: anywhere; }
.wt .l1 span { font-weight: 400; }
.wt .l2, .wt .l3 { font-size: 15px; display: flex; gap: 14px; flex-wrap: wrap; }
.wt .l3 b { font-variant-numeric: tabular-nums; }
.wt .pick { grid-row: 1 / span 3; grid-column: 2; width: 84px; min-height: 48px; font-size: 16px; }
.wt .pend { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.wt .pend .msg { font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ok); color: var(--surface); }
.nav-pos { text-align: center; font-size: 14px; color: var(--ink-2); }

/* Messages, sheet, busy */
.msg { border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.msg small { display: block; font-weight: 400; margin-top: 4px; opacity: .85; overflow-wrap: anywhere; }
.msg.err { background: var(--err-bg); color: var(--err); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; padding: 16px; }
.sheet { background: var(--surface); color: var(--ink); width: 100%; max-width: 448px; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 85vh; overflow: auto; }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet ol { margin: 0; padding-left: 4px; list-style: none; }
.sheet li { margin: 6px 0; }
.sheet li.failed { color: var(--err); font-weight: 700; }
.sheet li.todo { color: var(--ink-2); }
.tag { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.busy { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; z-index: 20; color: #fff; font-weight: 700; font-size: 18px; }
.spinner { width: 48px; height: 48px; border: 5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Settings */
.folder { font-size: 15px; overflow-wrap: anywhere; }
.pdfst { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 56px; cursor: pointer; }
.opt input { width: 22px; height: 22px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 700; margin-bottom: 6px; }

/* ---------- Small handhelds (2026-10-23: fields overflowed the screen on a Zebra TC52, ~360 px wide) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
/* Grid/flex children may shrink below their content (long printer names, WT/HU numbers) instead of widening the page */
.row > *, .btnrow > *, .wt > *, .ctx > *, .appbar > * { min-width: 0; }
select.field { text-overflow: ellipsis; }
.desc, .wt .l1, .msg, .ctx { overflow-wrap: anywhere; }
.btn { white-space: normal; }

@media (max-width: 400px) {
  .screen { padding: 10px; gap: 8px; }
  .appbar { padding: 8px 10px; min-height: 50px; }
  .appbar h1 { font-size: 16px; }
  .iconbtn { min-width: 40px; height: 36px; }
  .row { grid-template-columns: 70px minmax(0, 1fr); gap: 6px; }
  .row.three { grid-template-columns: 70px minmax(0, 1fr) 48px; }
  .row.hu { grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr); }
  label.l { font-size: 14px; }
  .field { font-size: 16px; min-height: 44px; padding: 6px 8px; }
  .unit { min-height: 44px; font-size: 14px; }
  .btn { min-height: 48px; font-size: 17px; }
  .btnrow { gap: 6px; }
  .btnrow .btn { font-size: 14px; min-height: 46px; padding: 0 4px; }
  .wt { padding: 8px; gap: 2px 8px; }
  .wt .l2, .wt .l3 { font-size: 14px; gap: 8px; }
  .wt .pick { width: 72px; min-height: 44px; font-size: 15px; }
  .sheet { padding: 12px; }
}

/* Screen 1 footer links (admin, change password, log out) */
.who .links { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
