/* Djinda Produce WMS — Superfood Consulting house theme (matches the UDA
   Daily Planner): navy sidebar, DM Sans, 14px cards, indigo accents.
   Layout is tuned for a landscape iPad on the shop floor: 44px+ touch
   targets, gloved-hand numpads, and a bottom action bar on task screens. */
:root {
  --p:  #060852;  /* Primary navy */
  --p2: #1a1875;  /* Navy hover */
  --p3: #3730a3;  /* Indigo accent */
  --p4: #a5b4fc;  /* Lavender */
  --p5: #e0e7ff;  /* Very light indigo */
  --bg: #f8f8f8;
  --s:  #ffffff;
  --bd: #dde1f5;
  --t:  #1e293b;
  --m:  #6b7280;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --ok: #047857;
  --ok-bg: #d1fae5;
  --client: #f5821f; /* Djinda Produce orange — logo underline only */
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--t);
  font-size: 14px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
.mono { font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums; }
::selection { background: var(--p5); color: var(--p); }
:focus-visible { outline: 2px solid var(--p3); outline-offset: 2px; }

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--p); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600; text-decoration: none; }
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- app shell */
#app { display: flex; min-height: 100vh; min-height: 100dvh; }

#sidebar {
  background: var(--p); width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column; padding: 0 0 1rem;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
#sidebar-header { background: #fff; border-bottom: 3px solid var(--client, #f5821f); padding: .8rem 1rem; display: flex; align-items: center; gap: .5rem; }
#sidebar-header img { height: 40px; width: auto; }
#sidebar .app-name { color: rgba(255,255,255,.9); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; padding: 1rem 1.1rem .4rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.nav-group-label { color: rgba(255,255,255,.4); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: .9rem 1.1rem .25rem; }
.chip {
  display: flex; align-items: center; gap: .55rem; margin: 2px .6rem; padding: .55rem .6rem; border-radius: 8px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.75); text-decoration: none; font-weight: 500; transition: all .15s; cursor: pointer; font-size: 13px;
}
.chip.active { background: rgba(165,180,252,.18); border-color: rgba(165,180,252,.45); color: #fff; }
.chip:focus-visible { outline-color: var(--p4); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--p4); flex-shrink: 0; }
.chip .count { margin-left: auto; background: rgba(255,255,255,.14); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px; font-family: 'DM Mono', monospace; }
.sidebar-footer { margin-top: auto; padding: 1rem 1.1rem 0; display: flex; align-items: center; gap: .5rem; color: rgba(255,255,255,.45); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; flex-wrap: wrap; }
.sidebar-footer .credit-chip { background: #fff; border-radius: 6px; padding: 3px 8px; display: inline-flex; align-items: center; }
.sidebar-status { margin: .6rem .6rem 0; padding: .5rem .6rem; border-radius: 8px; font-size: 11px; color: rgba(255,255,255,.7); background: rgba(255,255,255,.06); display: flex; align-items: center; gap: .5rem; width: calc(100% - 1.2rem); border: 1px solid rgba(255,255,255,.08); font-family: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.sidebar-status .mode-pill { background: rgba(255,255,255,.14); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.segmented { display: inline-flex; border: 1.5px solid var(--bd); border-radius: 10px; overflow: hidden; background: #fff; }
.segmented .seg { border: none; border-radius: 0; background: #fff; color: var(--m); padding: .65rem 1.2rem; font-size: 14px; min-width: 160px; }
.segmented .seg + .seg { border-left: 1.5px solid var(--bd); }
.segmented .seg.active { background: var(--p); color: #fff; }
.segmented .seg:disabled { opacity: .45; }
.sidebar-status .led { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; flex-shrink: 0; }
.sidebar-status .led.on { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.2); }
.sidebar-status .led.demo { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.2); }
.sidebar-status .led.off { background: #f87171; }
.wh-chip { display: block; margin: .5rem .6rem 0; padding: .45rem .6rem; border-radius: 8px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; }
.wh-chip small { display: block; color: rgba(255,255,255,.5); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; }

#main { flex: 1; padding: 1.2rem 1.6rem 6rem; min-width: 0; }
#main.has-actionbar { padding-bottom: 7rem; }

.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; gap: 1rem; flex-wrap: wrap; }
.top-bar .crumbs { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.section-label { font-size: 11px; color: var(--m); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
h1 { font-size: 21px; font-weight: 700; color: var(--p); margin: 0; }
h2 { font-size: 15px; font-weight: 600; color: var(--p); margin: 0 0 .7rem; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 .4rem; }
p { margin: 0 0 .6rem; }
a { color: var(--p3); }

.card { background: var(--s); border: 1px solid var(--bd); border-radius: 14px; padding: 1.1rem 1.25rem; box-shadow: 0 1px 3px rgba(6,8,82,.05); margin-bottom: 1rem; }
.card.tight { padding: .8rem .9rem; }
.card.flush { padding: 0; overflow: hidden; }
.cards-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.cards-row > .card { flex: 1; min-width: 200px; margin-bottom: 0; }

.info-banner { background: var(--p5); border-left: 3px solid var(--p3); border-radius: 8px; padding: .85rem 1rem; font-size: 13px; color: var(--p2); margin-bottom: 1rem; }
.warn-banner { background: var(--warn-bg); border-left: 3px solid var(--warn); border-radius: 8px; padding: .85rem 1rem; font-size: 13px; color: var(--warn); margin-bottom: 1rem; font-weight: 600; }
.danger-banner { background: var(--danger-bg); border-left: 3px solid var(--danger); border-radius: 8px; padding: .85rem 1rem; font-size: 13px; color: var(--danger); margin-bottom: 1rem; font-weight: 600; }
.ok-banner { background: var(--ok-bg); border-left: 3px solid var(--ok); border-radius: 8px; padding: .85rem 1rem; font-size: 13px; color: var(--ok); margin-bottom: 1rem; font-weight: 600; }

.badge { background: var(--p5); color: var(--p3); font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; display: inline-block; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.muted { background: #eef0f3; color: var(--m); }
.badge.navy { background: var(--p); color: #fff; }

button, .btn, .btn-primary { font-family: 'DM Sans', sans-serif; font-size: 13px; cursor: pointer; transition: all .15s; border-radius: 8px; padding: .5rem 1rem; font-weight: 600; }
.btn { background: var(--s); color: var(--t); border: 1.5px solid var(--bd); }
.btn-primary { background: var(--p); color: #fff; border: 1.5px solid var(--p); }
.btn.small, .btn-primary.small { padding: .28rem .6rem; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: #fca5a5; }
.btn.ok { color: var(--ok); border-color: #6ee7b7; }
.btn.active { background: var(--p5); border-color: var(--p4); color: var(--p2); }
.btn.big, .btn-primary.big { font-size: 15px; padding: .85rem 1.4rem; border-radius: 10px; }
.btn.icon-btn { padding: .4rem .7rem; font-size: 15px; line-height: 1; }
button:disabled, .btn:disabled, .btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }

@media (hover: hover) {
  .chip:hover { background: rgba(255,255,255,.13); color: #fff; }
  .sidebar-status:hover { background: rgba(255,255,255,.12); color: #fff; }
  .btn:hover:not(:disabled) { background: var(--p5); border-color: var(--p4); }
  .btn-primary:hover:not(:disabled) { background: var(--p2); border-color: var(--p2); }
  .btn.danger:hover:not(:disabled) { background: var(--danger-bg); }
  .list-row:hover, .option-row:hover { background: var(--p5); }
  table.grid tr:hover td { background: #f3f4ff; }
}

input, select, textarea { border: 1px solid var(--bd); border-radius: 8px; padding: .5rem .7rem; font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--t); background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--p3); box-shadow: 0 0 0 3px rgba(55,48,163,.1); outline: none; }
input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185,28,28,.12); }
input.num { width: 96px; font-family: 'DM Mono', monospace; text-align: right; }
label.field { display: flex; flex-direction: column; gap: .3rem; font-size: 12px; font-weight: 600; color: var(--m); }
label.field > input, label.field > select, label.field > textarea { font-weight: 400; color: var(--t); }
label.check { display: flex; align-items: center; gap: .6rem; font-size: 13px; font-weight: 500; cursor: pointer; min-height: 44px; }
label.check input { width: 22px; height: 22px; accent-color: var(--p3); }
.fields { display: flex; gap: .9rem; flex-wrap: wrap; align-items: flex-end; }
.fields > label.field { flex: 1; min-width: 160px; }

/* ------------------------------------------------------------- search/tabs */
.search-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.search-bar input[type="search"], .search-bar input[type="text"] { flex: 1; min-width: 220px; min-height: 46px; font-size: 15px; padding-left: 2.4rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat .8rem center; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab { padding: .5rem 1rem; border-radius: 20px; border: 1.5px solid var(--bd); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; transition: all .15s; display: inline-flex; align-items: center; gap: .45rem; }
.tab.active { background: var(--p); color: #fff; border-color: var(--p); }
.tab .n { font-family: 'DM Mono', monospace; font-size: 11px; background: rgba(0,0,0,.08); padding: 0 7px; border-radius: 10px; }
.tab.active .n { background: rgba(255,255,255,.2); }

/* ------------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; gap: .6rem; }
.list-row {
  display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; align-items: center;
  background: var(--s); border: 1px solid var(--bd); border-radius: 12px; padding: .85rem 1rem;
  box-shadow: 0 1px 3px rgba(6,8,82,.05); cursor: pointer; text-decoration: none; color: inherit; transition: all .15s; min-height: 64px;
}
.list-row.static { cursor: default; }
.list-row .title { font-weight: 700; font-size: 15px; color: var(--p); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.list-row .sub { font-size: 12.5px; color: var(--m); display: flex; gap: .8rem; flex-wrap: wrap; }
.list-row .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.list-row .chev { color: var(--p4); font-size: 20px; }
.list-row.done { opacity: .6; }
.list-row.urgent { border-color: #fca5a5; }
.due { font-size: 12px; font-weight: 700; }
.due.late { color: var(--danger); }
.due.today { color: var(--warn); }
.due.ok { color: var(--m); font-weight: 500; }

.empty { text-align: center; color: var(--m); padding: 2.5rem 1rem; }
.empty .big { font-size: 30px; margin-bottom: .4rem; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--p5); border-top-color: var(--p3); border-radius: 50%; animation: spin .8s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--p5); border-top-color: var(--p3); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }

/* -------------------------------------------------------------------- home */
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.launch-card { background: var(--s); border: 1px solid var(--bd); border-radius: 16px; padding: 1.2rem 1.1rem; min-height: 132px; display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgba(6,8,82,.05); transition: all .15s; position: relative; }
.launch-card:active { transform: scale(.98); }
.launch-card .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--p5); color: var(--p3); display: flex; align-items: center; justify-content: center; }
.launch-card .ttl { font-weight: 700; font-size: 15px; color: var(--p); }
.launch-card .dsc { font-size: 12px; color: var(--m); }
.launch-card .pill { position: absolute; top: .9rem; right: .9rem; background: var(--p); color: #fff; font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.launch-card .pill.warn { background: var(--warn); }
.stat { text-align: center; }
.stat .v { font-family: 'DM Mono', monospace; font-size: 26px; font-weight: 500; color: var(--p); line-height: 1.1; }
.stat .v.warn { color: var(--warn); }
.stat .v.danger { color: var(--danger); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--bd); font-size: 13px; align-items: baseline; }
.activity li:last-child { border-bottom: none; }
.activity .when { color: var(--m); font-size: 11.5px; white-space: nowrap; min-width: 70px; }

/* ------------------------------------------------------------- order detail */
.order-head { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1.5rem; }
.kv { display: flex; flex-direction: column; gap: .1rem; }
.kv .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--m); font-weight: 700; }
.kv .v { font-size: 14px; font-weight: 500; }
.progress { height: 8px; background: var(--p5); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--p3); border-radius: 4px; transition: width .2s; }
.progress.done > div { background: var(--ok); }

/* line rows in pick / pack / receive */
.line-row {
  display: grid; grid-template-columns: 56px 1fr auto; gap: .2rem 1rem; align-items: center;
  background: var(--s); border: 1px solid var(--bd); border-radius: 12px; padding: .8rem 1rem; cursor: pointer;
  box-shadow: 0 1px 3px rgba(6,8,82,.05); transition: all .15s; min-height: 72px;
}
.line-row.active { border-color: var(--p3); box-shadow: 0 0 0 3px rgba(55,48,163,.12); }
.line-row.done { border-color: #a7f3d0; background: #f4fdf9; }
.line-row.short { border-color: #fcd34d; background: #fffbeb; }
.line-row .bin { font-family: 'DM Mono', monospace; font-weight: 500; font-size: 13px; color: var(--p3); background: var(--p5); padding: .5rem .3rem; border-radius: 8px; text-align: center; align-self: stretch; display: flex; align-items: center; justify-content: center; }
.line-row .bin.none { color: var(--m); background: #f1f2f6; font-size: 11px; }
.line-row .desc { font-weight: 600; font-size: 14.5px; }
.line-row .code { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--m); display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.line-row .qty { font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 500; text-align: right; white-space: nowrap; }
.line-row .qty small { font-size: 13px; color: var(--m); }
.line-row .tick { font-size: 18px; color: var(--ok); }

/* pick workspace: list + detail panel side by side on iPad landscape */
.workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 1rem; align-items: start; }
.workspace .panel { position: sticky; top: 1rem; }
.panel-detail { background: var(--s); border: 1px solid var(--bd); border-radius: 14px; padding: 1.1rem 1.2rem; box-shadow: 0 1px 3px rgba(6,8,82,.05); }
.big-qty { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: .6rem 0 .9rem; }
.big-qty .val { font-family: 'DM Mono', monospace; font-size: 46px; font-weight: 500; color: var(--p); min-width: 110px; text-align: center; line-height: 1; }
.big-qty .of { font-size: 14px; color: var(--m); }
.big-qty button { width: 64px; height: 64px; font-size: 28px; border-radius: 14px; }
.batch-row { display: grid; grid-template-columns: 1fr auto auto; gap: .3rem .8rem; align-items: center; padding: .6rem .75rem; border: 1px solid var(--bd); border-radius: 10px; margin-bottom: .45rem; background: #fff; cursor: pointer; min-height: 56px; }
.batch-row.chosen { border-color: var(--p3); background: var(--p5); }
.batch-row.expired { border-color: #fca5a5; }
.batch-row .bn { font-family: 'DM Mono', monospace; font-weight: 500; font-size: 15px; }
.batch-row .bx { font-size: 12px; color: var(--m); }
.batch-row .bq { font-family: 'DM Mono', monospace; text-align: right; font-size: 14px; }
.batch-row .bq b { font-size: 17px; color: var(--p); }
.serial-list { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.serial-list .tag { background: var(--p5); color: var(--p2); font-family: 'DM Mono', monospace; font-size: 12px; padding: .35rem .6rem; border-radius: 8px; display: inline-flex; gap: .4rem; align-items: center; }
.serial-list .tag button { padding: 0 .3rem; font-size: 12px; background: none; border: none; color: var(--p3); }

/* bottom action bar on task screens */
.action-bar {
  position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-top: 1px solid var(--bd);
  padding: .8rem 1.6rem calc(.8rem + env(safe-area-inset-bottom)); display: flex; gap: .7rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.action-bar .info { font-size: 13px; color: var(--m); }
.action-bar .btn, .action-bar .btn-primary { min-height: 52px; font-size: 15px; padding: .7rem 1.4rem; border-radius: 10px; }

/* ------------------------------------------------------------------ tables */
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--m); font-weight: 700; padding: .5rem .6rem; border-bottom: 2px solid var(--bd); white-space: nowrap; background: var(--s); }
table.grid td { padding: .55rem .6rem; border-bottom: 1px solid var(--bd); vertical-align: middle; }
table.grid td.num, table.grid th.num { text-align: right; font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums; }
table.grid td.txt { font-weight: 600; }
table.grid tr.muted td { color: var(--m); }
.table-scroll { overflow-x: auto; }

/* ------------------------------------------------------------------ PIN gate */
.pin-gate { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; background: var(--p); padding: 1rem; }
.pin-card { background: var(--s); border-radius: 14px; padding: 2rem 2.2rem; box-shadow: 0 12px 40px rgba(0,0,0,.35); display: flex; flex-direction: column; align-items: center; gap: .9rem; text-align: center; max-width: 340px; width: 100%; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: .3rem 0; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bd); }
.pin-dot.on { background: var(--p); border-color: var(--p); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }

/* -------------------------------------------------------------- dialogs */
dialog.app-dialog { border: 1px solid var(--bd); border-radius: 14px; padding: 1.3rem 1.4rem; box-shadow: 0 12px 40px rgba(6,8,82,.25); max-width: 440px; width: calc(100vw - 2rem); font-family: 'DM Sans', system-ui, sans-serif; color: var(--t); background: #fff; }
dialog.app-dialog.wide { max-width: 760px; }
dialog.app-dialog.sheet { max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow: auto; }
dialog.app-dialog::backdrop { background: rgba(6,8,82,.35); }
dialog.app-dialog h2 { margin-bottom: .4rem; }
dialog.app-dialog p { margin: 0 0 1rem; font-size: 13.5px; color: var(--m); }
dialog.app-dialog .dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .8rem; }
dialog.app-dialog .dialog-error { color: var(--danger); font-size: 12.5px; font-weight: 600; margin: .35rem 0 0; min-height: 1em; }
dialog.app-dialog .dialog-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }
dialog.app-dialog .dialog-actions .btn, dialog.app-dialog .dialog-actions .btn-primary { min-height: 48px; font-size: 14px; padding: .6rem 1.3rem; }
dialog.app-dialog input:not([type="checkbox"]), dialog.app-dialog select, dialog.app-dialog textarea { width: 100%; min-height: 46px; font-size: 16px; }
dialog.app-dialog label.field { margin-bottom: .7rem; }

.numpad-display { font-size: 42px; text-align: center; padding: .4rem 0 .8rem; color: var(--p); font-weight: 500; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numpad-key { min-height: 64px; border-radius: 12px; border: 1px solid var(--bd); background: var(--bg); font-size: 24px; font-weight: 500; color: var(--t); font-family: 'DM Sans', sans-serif; }
.numpad-key.alt { font-size: 18px; color: var(--m); }
.numpad-key:active { background: var(--p5); }
.preset-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.preset-row .btn { flex: 1; min-height: 44px; }
.option-list { display: flex; flex-direction: column; gap: .4rem; }
.option-row { text-align: left; background: #fff; border: 1px solid var(--bd); border-radius: 10px; padding: .75rem .9rem; font-weight: 500; font-size: 14px; min-height: 52px; display: flex; flex-direction: column; gap: .15rem; }
.option-row.active { border-color: var(--p3); background: var(--p5); }
.option-row .option-hint { font-size: 12px; color: var(--m); font-weight: 400; }

/* scanner */
.scan-frame { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; margin-bottom: .6rem; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-reticle { position: absolute; inset: 18% 12%; border: 2px solid rgba(165,180,252,.9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); pointer-events: none; }
.scan-status { font-size: 12.5px; color: var(--m); text-align: center; margin-bottom: .6rem; }
.scan-row { display: flex; gap: .6rem; }
.scan-row .scan-input { flex: 1; font-size: 18px; letter-spacing: .04em; }
.scan-row .btn-primary { min-height: 46px; white-space: nowrap; }

/* toast */
.toast-host { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; align-items: center; }
.toast { background: var(--p); color: #fff; padding: .7rem 1rem; border-radius: 10px; font-weight: 600; font-size: 13.5px; box-shadow: 0 8px 24px rgba(6,8,82,.25); opacity: 0; transform: translateY(-6px); transition: all .2s; max-width: 360px; }
.toast.show { opacity: 1; transform: none; }
.toast.ok { background: var(--ok); }
.toast.warn { background: var(--warn); }
.toast.danger { background: var(--danger); }

/* bins */
.bin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.bin-tile { border: 1px solid var(--bd); border-radius: 10px; padding: .6rem .7rem; background: #fff; text-align: left; min-height: 60px; display: flex; flex-direction: column; gap: .15rem; }
.bin-tile .bc { font-family: 'DM Mono', monospace; font-weight: 500; color: var(--p3); font-size: 14px; }
.bin-tile .bn { font-size: 11px; color: var(--m); }

/* packing */
.package-card { border: 1px solid var(--bd); border-radius: 12px; padding: .8rem .9rem; margin-bottom: .6rem; background: #fff; display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; }
.package-card .pn { font-family: 'DM Mono', monospace; font-weight: 500; color: var(--p3); background: var(--p5); padding: .4rem .6rem; border-radius: 8px; }

/* print */
.print-only { display: none; }
@media print {
  #sidebar, .action-bar, .top-bar .btn-row, .no-print { display: none !important; }
  #main { padding: 0; }
  .print-only { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace .panel { position: static; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  #app { flex-direction: column; }
  #sidebar { width: 100%; height: auto; position: static; padding-bottom: .6rem; }
  #sidebar .nav-scroll { display: flex; overflow-x: auto; padding: 0 .4rem; gap: .1rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #sidebar .app-name { padding: .6rem 1rem .3rem; }
  .nav-group-label, .sidebar-footer, .sidebar-status { display: none; }
  .wh-chip { display: none; }
  .chip { flex-shrink: 0; white-space: nowrap; margin: 2px .15rem; }
  #main { padding: 1rem .9rem 6rem; }
  .action-bar { left: 0; }
  .order-head { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
}
@media (min-width: 901px) { #sidebar .nav-scroll { display: block; } }

@media (pointer: coarse) {
  button, .btn, .btn-primary, .chip, .tab { min-height: 44px; }
  .btn.small, .btn-primary.small { min-height: 38px; padding: .35rem .7rem; }
  select, input { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
