/* Nexera Warehouse Intelligence — light enterprise theme matched to the concept boards */
:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #0d1b33;
  --ink-2: #44526b;
  --ink-3: #7a879c;
  --line: #e3e8f1;
  --blue: #1554e6;
  --blue-2: #0f3fb0;
  --blue-soft: #e8efff;
  --rail: #e9f1fd;
  --red: #e2263c;
  --red-soft: #fdecee;
  --orange: #f78a16;
  --orange-soft: #fff3e3;
  --amber: #f5c518;
  --green: #1ea672;
  --green-soft: #e4f6ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(13, 27, 51, .05), 0 4px 16px rgba(13, 27, 51, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f8fafd; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td b, td .sev, td .pill { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ── layout ─────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.side {
  width: 220px; flex: none; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; flex-direction: column; padding: 18px 22px 16px; text-decoration: none !important; }
.brand-word { font-weight: 800; font-size: 26px; letter-spacing: .02em; color: var(--blue); line-height: 1; }
.brand-sub { font-size: 12.5px; color: var(--ink); margin-top: 3px; }
.side nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px; }
.nav-i {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px;
  color: var(--ink); font-weight: 500; text-decoration: none !important;
}
.nav-i:hover { background: var(--blue-soft); }
.nav-i.active { background: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(21, 84, 230, .3); }
.nav-i .badge { margin-left: auto; background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.demo-note { margin: auto 12px 14px; background: #f1f4fa; border-radius: 10px; padding: 12px; font-size: 11.5px; color: var(--ink-2); }
.demo-note b { display: inline-block; font-size: 11px; color: var(--blue-2); background: var(--blue-soft); padding: 2px 8px; border-radius: 5px; letter-spacing: .04em; }
.demo-note p { margin: 8px 0 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.menu { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--ink); }
.site-pick { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; height: 40px; }
.site-pick svg { width: 18px; color: var(--blue); }
.site-pick select { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ink); height: 38px; cursor: pointer; outline: none; }
.top-search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; height: 40px; background: #fbfcfe; }
.top-search svg { width: 18px; color: var(--ink-3); }
.top-search input { border: 0; outline: none; background: transparent; font: inherit; width: 100%; color: var(--ink); }
.bell { position: relative; margin-left: auto; color: var(--ink); }
.bell svg { width: 24px; height: 24px; }
.bell em { position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; }
.me { display: flex; align-items: center; gap: 10px; }
.me b { display: block; font-size: 13.5px; }
.me small { color: var(--ink-3); font-size: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--blue-2); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.demo-chip { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--blue-2); background: var(--blue-soft); padding: 6px 10px; border-radius: 7px; white-space: nowrap; }

.body { display: flex; flex: 1; min-width: 0; }
.content { flex: 1; min-width: 0; padding: 22px 24px 40px; }
.page-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h h1 { font-size: 30px; font-weight: 800; }
.page-h p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.page-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--ink-2); font-size: 13px; }
.ok-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }

.helps { width: 330px; flex: none; background: linear-gradient(180deg, #eaf2fe, #e3edfc); padding: 26px 24px; border-left: 1px solid var(--line); }
.helps h2 { color: var(--blue-2); text-transform: uppercase; font-size: 19px; font-weight: 800; letter-spacing: .01em; padding-bottom: 12px; border-bottom: 2px solid #c9d9f6; }
.helps ol { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.helps li { display: flex; gap: 14px; }
.helps .n { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.helps b { font-size: 16px; color: var(--ink); }
.helps li p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
.tagline { margin: 28px 0 0; padding-top: 18px; border-top: 1px solid #c9d9f6; font-weight: 600; color: var(--ink); font-size: 15px; }
.helps-foot { margin-top: 20px; display: flex; flex-direction: column; }
.helps-foot b { color: var(--blue-2); letter-spacing: .05em; font-size: 20px; }
.helps-foot span { color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }

/* ── grid + cards ───────────────────────────────────────── */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h3 { font-size: 16px; font-weight: 700; }
.card-r { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.kpi { display: flex; align-items: center; gap: 14px; }
.kpi .ico { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.kpi .ico svg { width: 26px; height: 26px; color: #fff; stroke-width: 2.2; }
.kpi .v { font-size: 28px; font-weight: 800; line-height: 1; }
.kpi .l { font-weight: 600; font-size: 15px; margin-top: 4px; }
.kpi .s { color: var(--ink-3); font-size: 12.5px; }
.bg-red { background: var(--red); } .bg-orange { background: var(--orange); } .bg-blue { background: var(--blue); } .bg-green { background: var(--green); }
.t-red { color: var(--red); } .t-orange { color: var(--orange); } .t-green { color: var(--green); } .t-blue { color: var(--blue); }

/* ── banners, pills, buttons ────────────────────────────── */
.banner { display: flex; align-items: center; gap: 16px; background: var(--red-soft); border: 1px solid #f6c3ca; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; flex-wrap: wrap; }
.banner.warn { background: var(--orange-soft); border-color: #f8d6a8; }
.banner .b-ico { width: 40px; height: 40px; color: var(--red); }
.banner.warn .b-ico { color: var(--orange); }
.banner b { color: var(--red); font-size: 17px; }
.banner.warn b { color: var(--ink); }
.banner p { margin: 2px 0 0; color: var(--ink-2); }
.sev { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 6px; color: #fff; min-width: 64px; text-align: center; }
.sev-critical { background: var(--red); }
.sev-high { background: var(--orange); }
.sev-medium { background: var(--amber); color: var(--ink); }
.sev-info, .sev-low { background: #dfe5ee; color: var(--ink-2); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: #eef1f6; color: var(--ink-2); white-space: nowrap; }
.pill-new, .pill-open, .pill-held, .pill-escort-missing, .pill-safety-stop, .pill-route-blocked, .pill-exception, .pill-critical { background: var(--red-soft); color: var(--red); }
.pill-investigating, .pill-in-progress, .pill-assigned, .pill-en-route, .pill-scheduled, .pill-unloading { background: var(--blue-soft); color: var(--blue-2); }
.pill-acknowledged, .pill-authorized, .pill-escorted, .pill-checked-in, .pill-resolved, .pill-healthy, .pill-available { background: var(--green-soft); color: var(--green); }
.pill-review, .pill-warning, .pill-pending, .pill-loading, .pill-visitor { background: var(--orange-soft); color: #c26a05; }
.btn { font: inherit; font-weight: 600; font-size: 13.5px; border-radius: 8px; padding: 8px 14px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(.95); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-ghost { background: #fff; color: var(--blue); border-color: #bfd0f5; }
.btn-danger { background: var(--red); color: #fff; }
.btn-warn { background: var(--orange); color: #fff; }
.btn-outline-danger { background: #fff; color: var(--red); border-color: #f3b2bb; }
.btn-lg { padding: 12px 18px; font-size: 15px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn.done { background: var(--green); color: #fff; border-color: var(--green); }

/* ── camera tile ────────────────────────────────────────── */
.cam { position: relative; margin: 0; border-radius: 10px; overflow: hidden; background: #0d1522; aspect-ratio: 16 / 9; max-width: 100%; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-missing { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #c8d3e6; background: repeating-linear-gradient(45deg, #122036 0 12px, #16263f 12px 24px); }
.cam-missing small { color: #7f8ea8; }
.cam-head { position: absolute; top: 0; left: 0; right: 0; padding: 8px 12px 20px; color: #fff; font-size: 13px; background: linear-gradient(180deg, rgba(0,0,0,.6), transparent); display: flex; flex-direction: column; font-family: ui-monospace, "SF Mono", Menlo, monospace; pointer-events: none; }
.cam-head b { font-family: Inter, system-ui, sans-serif; font-size: 14px; }
.rec-sample {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  font: 700 10.5px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em;
  color: #fff; background: rgba(226, 38, 60, .88); padding: 5px 8px; border-radius: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,.35);
}
.rec-sample::first-letter { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { color: transparent; } }
.cam-tag { position: absolute; top: 34px; right: 8px; font-size: 12px; font-weight: 700; color: #fff; padding: 4px 9px; border-radius: 5px; background: var(--red); text-transform: uppercase; z-index: 2; }
.cam-tag.warn { background: var(--orange); }
.cam-tag.ok { background: var(--green); }
.cam-caption { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-size: 14px; font-weight: 600; color: #fff; padding: 5px 12px; border-radius: 6px; background: var(--red); white-space: nowrap; z-index: 2; }
.cam-caption.warn { background: var(--orange); }
.cam-caption.ok { background: rgba(10, 20, 30, .7); }
.ai-toggle { position: absolute; left: 8px; bottom: 8px; z-index: 3; font: 600 11px/1 Inter, sans-serif; color: #fff; background: rgba(10, 20, 30, .6); border: 1px solid rgba(255,255,255,.35); border-radius: 5px; padding: 5px 8px; cursor: pointer; }
.ai-toggle.on { background: rgba(21, 84, 230, .85); border-color: transparent; }
.cam-caption ~ .ai-toggle { bottom: 46px; }
.cam.sm .cam-caption { font-size: 12px; bottom: 6px; }
.cam.sm .cam-head { font-size: 11px; }
.cam.sm .rec-sample { font-size: 9px; padding: 4px 6px; }
.cam.click { cursor: pointer; }
.cam.sel { outline: 3px solid var(--blue); outline-offset: -3px; }

/* ── misc widgets ───────────────────────────────────────── */
.bar { height: 8px; border-radius: 4px; background: #e8edf5; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.bar.orange > i { background: var(--orange); } .bar.red > i { background: var(--red); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 24px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 17px; bottom: 0; width: 2px; background: #d6e0f0; }
.timeline li:last-child::after { display: none; }
.timeline li.bad::before { background: var(--red); }
.timeline li.ok::before { background: var(--green); }
.timeline time { font-weight: 700; margin-right: 10px; }
.steps { display: flex; align-items: flex-start; margin: 6px 0 14px; }
.step { flex: 1; text-align: center; position: relative; font-size: 12.5px; color: var(--ink-3); }
.step::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 3px; background: #dbe3ef; z-index: 0; }
.step:first-child::before { display: none; }
.step i { position: relative; z-index: 1; display: grid; place-items: center; margin: 0 auto 6px; width: 24px; height: 24px; border-radius: 50%; background: #dbe3ef; color: #fff; font-style: normal; font-size: 13px; }
.step.done::before, .step.cur::before { background: var(--green); }
.step.done i { background: var(--green); }
.step.cur i { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.step.cur { color: var(--blue); font-weight: 700; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.map { position: relative; border-radius: 10px; overflow: hidden; background: #f4f6fa; border: 1px solid var(--line); }
.map svg { width: 100%; height: auto; display: block; stroke-width: 1; }
.map img { display: block; width: 100%; }
.pin { position: absolute; transform: translate(-50%, -50%); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }
.stat-big { font-size: 26px; font-weight: 800; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: 13px; border: 0; background: none; padding: 8px 12px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.searchbar { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow); }
.searchbar svg { width: 22px; height: 22px; color: var(--ink-3); }
.searchbar input { flex: 1; border: 0; outline: none; font: inherit; font-size: 17px; min-width: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.chip { font: inherit; font-size: 12.5px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); padding: 6px 12px; border-radius: 16px; cursor: pointer; }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.result-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; font-size: 12px; margin-top: 12px; }
.result-meta b { display: block; font-size: 13.5px; color: var(--ink); }
.skeleton { background: linear-gradient(90deg, #eef2f8, #f7f9fc, #eef2f8); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 1400px) {
  .helps { width: 280px; }
}
@media (max-width: 1200px) {
  .body { flex-direction: column; }
  .helps { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .helps ol { display: grid; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .side { position: fixed; left: -240px; z-index: 40; transition: left .2s; box-shadow: 0 0 30px rgba(0,0,0,.15); }
  .side.open { left: 0; }
  .menu { display: block; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2, .g-3-2 { grid-template-columns: minmax(0, 1fr); }
  .demo-chip, .me span:last-child { display: none; }
}
@media (max-width: 640px) {
  .top { gap: 10px; padding: 0 16px; }
  .site-pick { display: none; }
  .content { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .helps ol { grid-template-columns: 1fr; }
  .page-h h1 { font-size: 24px; }
  .page-meta { align-items: flex-start; }
  .result-meta { grid-template-columns: 1fr 1fr; }
}
