:root {
  --bg: #0f1620; --panel: #1a2432; --panel-2: #22303f; --border: #2a3647;
  --text: #e8edf3; --muted: #8796a8;
  --ok: #2fbf71; --warn: #f0b429; --bad: #e5484d; --info: #3b82f6; --accent: #7c5cff;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 12px 16px;
  background: var(--info); color: #fff; font-weight: 600; min-height: 48px; }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.big { font-size: 20px; padding: 16px 24px; }
button:disabled { opacity: .5; cursor: default; }
input { font: inherit; background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; min-height: 48px; width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.r { text-align: right; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.tb-left, .tb-mid, .tb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.station { font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.badge { padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--panel-2); }
.badge.READY { background: #23324a; }
.badge.FETCHING { background: #3a2f12; color: #ffd76a; }
.badge.WAITING_FOR_CONFIRMATION { background: #12361f; color: #7ff0ac; }
.badge.DELIVERING { background: #2a2050; color: #c4b5fd; }
.badge.ERROR { background: #4a1416; color: #ffb4b4; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  background: var(--panel-2); font-size: 13px; color: var(--muted); }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.pill.on .dot { background: var(--ok); }
.pill.connecting .dot { background: var(--warn); }
.pill.spectr-on { color: #7ff0ac; }
.pill.spectr-err { color: #ffb4b4; }
.operator { font-weight: 600; }
.clock { color: var(--muted); font-size: 14px; }

.emergency { background: var(--bad); color: #fff; font-weight: 800; text-align: center; padding: 12px; font-size: 20px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; padding: 16px; max-width: 1600px; margin: 0 auto; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }
.col-main, .col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.card-title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }

.task-card { min-height: 300px; }
.idle { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; text-align: center; }
.idle-title { font-size: 34px; font-weight: 700; }
.idle-sub { color: var(--muted); margin-top: 10px; font-size: 18px; }
.task-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.task-type { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.task-title { font-size: 32px; font-weight: 800; margin: 6px 0 10px; line-height: 1.15; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 16px; }
.task-meta b { color: var(--text); font-weight: 600; }
.qty-box { text-align: center; background: var(--panel-2); border-radius: 14px; padding: 12px 22px; min-width: 150px; }
.qty-label { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.qty { font-size: 88px; font-weight: 900; line-height: 1; color: #7ff0ac; }
.task-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 6px; align-items: center; }
.task-actions input { width: 160px; font-size: 22px; }
.orders { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
.orders th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.orders th.r { text-align: right; }
.orders td { padding: 7px 4px; border-bottom: 1px solid var(--border); }

.shelf-grid { display: grid; gap: 6px; }
.bin { background: var(--panel-2); border: 2px solid var(--border); border-radius: 10px; padding: 8px; text-align: center; min-height: 64px; }
.bin.active { border-color: var(--ok); background: #12361f; }
.bin.picked { border-color: var(--info); }
.bin .bn { font-size: 12px; color: var(--muted); }
.bin .bq { font-size: 22px; font-weight: 800; }
.bin .bp { font-size: 11px; color: #9cc3ff; }

.visit { font-size: 14px; line-height: 1.6; }
.insp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.insp { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); }
.insp-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.insp-v { font-weight: 700; font-size: 14px; }
.insp.sent { border-color: var(--info); }
.insp.ok { border-color: var(--ok); }
.insp.bad { border-color: var(--bad); }
.insp.off { opacity: .55; }

.frames { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.frame { display: flex; justify-content: space-between; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }

.actions { display: flex; flex-direction: column; gap: 10px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.events { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow: auto; font-size: 14px; }
.events li { display: flex; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.events .t { color: var(--muted); flex: none; width: 70px; }
.events .ok { color: #7ff0ac; } .events .bad { color: #ffb4b4; } .events .info { color: #9cc3ff; } .events .warn { color: #ffd76a; }

.overlay { position: fixed; inset: 0; background: rgba(5, 9, 14, .85); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 22px; width: 100%; max-width: 440px; }
.modal h2 { margin: 0 0 16px; font-size: 22px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin-bottom: 8px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots span.f { background: var(--text); border-color: var(--text); }
.pin-error { color: #ffb4b4; text-align: center; min-height: 22px; margin-bottom: 8px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { font-size: 28px; min-height: 70px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.settings label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.settings label input { margin-top: 4px; }
.hint { font-size: 12px; color: var(--muted); }
.hint code { color: var(--text); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--border);
  padding: 14px 22px; border-radius: 12px; font-size: 17px; font-weight: 600; z-index: 60; max-width: 90vw; }
.toast.bad { border-color: var(--bad); color: #ffb4b4; }
.toast.ok { border-color: var(--ok); color: #7ff0ac; }
