:root {
  --bg: #0e0f12; --panel: #16181d; --panel2: #1d2027; --line: #2a2e37; --text: #eceef2; --muted: #9aa1ad;
  --gold: #ffbc29; --gold-ink: #1a1400; --red: #ff5d5d; --orange: #ffa53a; --green: #3ccf7f; --blue: #5aa9ff;
  --red-bg: rgba(255,93,93,.13); --orange-bg: rgba(255,165,58,.13); --green-bg: rgba(60,207,127,.13); --blue-bg: rgba(90,169,255,.13);
  --r: 10px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hide { display: none !important; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: rgba(14,15,18,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand b { color: var(--gold); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--panel2); }
.who { color: var(--muted); font-size: 12px; white-space: nowrap; }
.who a { margin-left: 8px; }

main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.section { margin-top: 22px; }

/* stat tiles */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12px; }

/* flags */
.flag { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--text); }
.flag:hover { border-color: #3a3f4b; text-decoration: none; }
.flag .count { min-width: 54px; text-align: center; font-size: 22px; font-weight: 700; border-radius: 8px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.flag.high .count { background: var(--red-bg); color: var(--red); }
.flag.medium .count { background: var(--orange-bg); color: var(--orange); }
.flag.low .count { background: var(--blue-bg); color: var(--blue); }
.flag.zero .count { background: var(--panel2); color: var(--muted); }
.flag .t { font-weight: 600; }
.flag .d { color: var(--muted); font-size: 12.5px; }

/* forms */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: transparent; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #444a57; }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--panel2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #1b1e24; }
td.wrap { white-space: normal; }
.kv { width: 100%; margin-top: 10px; background: transparent; }
.kv td { white-space: normal; padding: 7px 0; }
.kv td:first-child { color: var(--muted); width: 120px; padding-right: 10px; }

/* pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.orange { background: var(--orange-bg); color: var(--orange); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.gold { background: rgba(255,188,41,.14); color: var(--gold); }

/* timeline */
.tl { position: relative; margin: 0; padding: 0; list-style: none; }
.tl li { position: relative; padding: 0 0 16px 22px; }
.tl li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.tl li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl li.scan::before { background: var(--gold); }
.tl li.shipment::before { background: var(--blue); }
.tl li.order::before { background: var(--green); }
.tl li.note::before { background: #c58cff; }
.tl .when { color: var(--muted); font-size: 12px; }
.tl .what { font-weight: 600; }
.tl .det { color: var(--muted); font-size: 12.5px; }

/* banners & toasts */
.banner { padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); }
.banner.red { background: var(--red-bg); border-color: rgba(255,93,93,.4); }
.banner.orange { background: var(--orange-bg); border-color: rgba(255,165,58,.4); }
.banner.green { background: var(--green-bg); border-color: rgba(60,207,127,.4); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.4); }

/* scanner */
.scan-wrap { max-width: 860px; margin: 0 auto; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode { padding: 16px; border-radius: var(--r); border: 2px solid var(--line); background: var(--panel); cursor: pointer; text-align: center; font-weight: 700; font-size: 16px; }
.mode .k { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.mode.on[data-mode=packed] { border-color: var(--green); background: var(--green-bg); }
.mode.on[data-mode=stuck] { border-color: var(--orange); background: var(--orange-bg); }
.mode.on[data-mode=remake] { border-color: var(--blue); background: var(--blue-bg); }
.scan-input { width: 100%; font-size: 26px; padding: 18px; font-family: var(--mono); letter-spacing: .04em; text-align: center; margin-top: 14px; }
.result { margin-top: 14px; padding: 22px; border-radius: var(--r); text-align: center; border: 2px solid var(--line); background: var(--panel); min-height: 110px; }
.result .big { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.result.ok { border-color: var(--green); background: var(--green-bg); }
.result.warn { border-color: var(--orange); background: var(--orange-bg); }
.result.bad { border-color: var(--red); background: var(--red-bg); }
.result .items { color: var(--muted); margin-top: 6px; font-size: 13px; }
.op-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.counter { font-variant-numeric: tabular-nums; }

/* lot progress */
.bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--panel2); margin-top: 8px; }
.bar span { display: block; height: 100%; }
.bar .p { background: var(--green); } .bar .s { background: var(--orange); } .bar .r { background: var(--blue); }
.bar .u { background: var(--red); } .bar .c { background: #555; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; text-align: center; padding: 30px 26px; }
.gbtn { display: inline-flex; gap: 10px; align-items: center; justify-content: center; width: 100%; margin-top: 18px; }
.secret { font-family: var(--mono); font-size: 12px; word-break: break-all; background: var(--panel2); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--muted); }
pre.code { white-space: pre-wrap; word-break: break-word; background: var(--panel2); padding: 10px; border-radius: 8px; font: 12px/1.4 var(--mono); max-height: 260px; overflow: auto; }

@media (max-width: 720px) {
  .top { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  main { padding: 16px 12px 50px; }
  .field-row { grid-template-columns: 1fr; }
  .modes { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .mode { padding: 12px 6px; font-size: 14px; }
  .scan-input { font-size: 20px; padding: 14px; }
}
@media print {
  .top, .noprint { display: none !important; }
  body, table, .card { background: #fff; color: #000; }
  th { background: #eee; color: #000; }
}
