:root { --ink: #10212f; --muted: #5b6b78; --line: #d8dee4; --bg: #f4f6f8; --card: #fff; --brand: #0f2a43; --accent: #1f8f74;
  --ok: #1d7a4f; --ok-bg: #e6f5ec; --warn: #8a5a00; --warn-bg: #fff4d6; --bad: #a3221b; --bad-bg: #fde8e6; --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
* { box-sizing: border-box; }
body { margin: 0; padding-bottom: env(safe-area-inset-bottom); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; gap: 10px; min-height: 52px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 1.1rem; }
.tag { color: #b9c9d8; font-size: .85rem; }
.spacer { flex: 1; }
#who { color: #dce7f0; } #who .link { color: #9fe3cf; }
.modes { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.modes a { color: #cfe0ee; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-size: .92rem; }
.modes a[aria-current=page] { background: #fff; color: var(--brand); font-weight: 600; }
main { padding-top: 16px; padding-bottom: 24px; outline: none; }
footer { padding: 16px; }
h1 { font-size: 1.6rem; margin: 0 0 6px; } h2 { font-size: 1.25rem; margin: 0 0 6px; } h3 { font-size: 1.05rem; margin: 0 0 8px; } h4 { margin: 14px 0 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.narrow { max-width: 520px; }
.hero { border-top: 4px solid var(--accent); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono, code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; word-break: break-all; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 8px 0; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
input, select, textarea { display: block; width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #b7c2cc; border-radius: 8px; background: #fff; margin-top: 4px; min-height: 44px; }
textarea.mono { font-size: .8rem; }
label.inline select, .row select, .row input { width: auto; flex: 1; min-width: 140px; margin: 0; }
button { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 10px 16px; min-height: 44px; background: var(--brand); color: #fff; cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: #e8eef3; color: var(--brand); }
button.danger { background: var(--bad); }
button.link { background: none; color: var(--accent); padding: 4px 6px; min-height: 0; text-decoration: underline; }
button.small { padding: 6px 10px; min-height: 34px; font-size: .85rem; }
button.big { width: 100%; font-size: 1.15rem; padding: 18px; background: var(--accent); margin: 8px 0; }
:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > button { flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; }
.code-input .row input { flex: 1; }
.code-input .scan-btn { margin-top: 8px; background: #e8eef3; color: var(--brand); }
.status { border-radius: var(--radius); padding: 14px; margin: 12px 0; border-left: 6px solid; display: grid; gap: 4px; }
.status.ok { background: var(--ok-bg); border-color: var(--ok); color: #0f3d27; }
.status.warn { background: var(--warn-bg); border-color: #d99a00; color: #4d3500; }
.status.bad { background: var(--bad-bg); border-color: var(--bad); color: #5a120e; }
.status .icon { font-size: 1.6rem; line-height: 1; }
.status strong { font-size: 1.05rem; }
.result .status { grid-template-columns: auto 1fr; align-items: center; font-size: 1.1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; margin: 8px 0; }
.facts div { border-bottom: 1px solid var(--line); padding: 4px 0; } .facts dt { font-size: .78rem; color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }
.chain { padding-left: 20px; font-size: .9rem; } .chain li { margin: 3px 0; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: #e8eef3; color: var(--brand); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.history, .compact { list-style: none; padding: 0; margin: 0; } .history li, .compact li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.scanlist { max-height: 220px; overflow: auto; padding-left: 22px; font-size: .88rem; }
details.shipment { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; } details summary { cursor: pointer; }
.queue { margin-top: 10px; font-size: .9rem; }
progress { width: 100%; height: 14px; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; } th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f3f6; } table.stats th { width: 45%; }
.scroll { overflow-x: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.kpi { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; } .kpi strong { font-size: 1.5rem; } .kpi span { font-size: .78rem; color: var(--muted); }
.kpi.bad strong { color: var(--bad); } .kpi.warn strong { color: var(--warn); }
.console-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; } .console-grid .card { margin-bottom: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.map { width: 100%; max-height: 560px; background: #eaf2f8; border-radius: 8px; }
.map .land { fill: #fbfcfd; stroke: #8aa0b2; stroke-width: 1.5; } .map .lake { fill: #b9d7ec; stroke: #8db7d6; stroke-width: .8; }
.map .region circle { fill-opacity: .55; stroke-width: 1.5; } .map .region text { font-size: 11px; text-anchor: middle; fill: #34495a; }
.map .region.ok circle { fill: #4fb286; stroke: var(--ok); } .map .region.warn circle { fill: #f2c14e; stroke: #b88400; } .map .region.bad circle { fill: #e2574c; stroke: var(--bad); }
.map .site { fill: var(--brand); } .map .site.pharmacy { fill: #6b4fbb; } .map .site.warehouse { fill: #0b7285; } .map .site.port { fill: #c2410c; }
.map .pulse { fill: none; stroke-width: 3; animation: pulse 2.4s ease-out forwards; } .map .pulse.ok { stroke: var(--ok); } .map .pulse.bad { stroke: var(--bad); }
@keyframes pulse { from { r: 8; opacity: 1; } to { r: 46; opacity: 0; } }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; } .dot.ok { background: #4fb286; } .dot.warn { background: #f2c14e; } .dot.bad { background: #e2574c; }
.feed { list-style: none; padding: 0; margin: 0; max-height: 560px; overflow: auto; font-size: .86rem; }
.feed li { padding: 6px 4px; border-bottom: 1px solid var(--line); animation: fadein .6s; } .feed li.bad { background: var(--bad-bg); } .feed time { font-weight: 700; color: var(--muted); }
@keyframes fadein { from { background: #fff7c2; } }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.tabs button { background: none; color: var(--muted); border-radius: 8px 8px 0 0; } .tabs button[aria-selected=true] { color: var(--brand); border-bottom: 3px solid var(--accent); }
.triage select { display: inline-block; width: auto; min-height: 30px; padding: 2px 6px; font-size: .8rem; }
dialog { border: 0; border-radius: 12px; padding: 18px; max-width: min(560px, 94vw); width: 100%; } dialog::backdrop { background: rgba(10, 20, 30, .55); }
dialog.scanner { background: #000; color: #fff; text-align: center; } dialog.scanner video { width: 100%; border-radius: 8px; } dialog.scanner { position: fixed; }
img.photo { max-width: 100%; border-radius: 8px; }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 20; width: min(480px, 92vw); }
.toast { background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.ok { background: var(--ok); } .toast.warn { background: #8a5a00; } .toast.error { background: var(--bad); }
@media (max-width: 860px) { .console-grid { grid-template-columns: 1fr; } .tag { display: none; } }
@media print { .top, footer, .actions, button { display: none !important; } .card { border: 0; } }
