:root {
  --bg: #e9eef8;
  --ink: #142036;
  --muted: #6b7690;
  --line: rgba(20, 32, 54, .08);
  --glass: rgba(255, 255, 255, .84);
  --teal: #129d92;
  --teal-bg: #e3f6f3;
  --blue: #2563eb;
  --blue-bg: #e8efff;
  --green: #15803d;
  --green-bg: #e6f6ec;
  --amber: #b45309;
  --amber-bg: #fdf1dc;
  --red: #c2410c;
  --red-bg: #fde9e2;
  --sun: #ffc93c;
  --navy: #0b1d2e;
  --shadow: 0 10px 30px -10px rgba(30, 50, 110, .25), 0 1px 2px rgba(30, 50, 110, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 400 13px/1.4 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
svg { display: block; }
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; outline: none; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; font: 600 13px "JetBrains Mono", monospace; color: var(--muted); pointer-events: none; }
.glass { background: var(--glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border: 1px solid rgba(255, 255, 255, .9); border-radius: 14px; box-shadow: var(--shadow); }

/* top bar */
.topbar { position: fixed; top: 12px; left: 12px; right: 12px; height: 54px; display: flex; align-items: center; gap: 14px; padding: 0 10px 0 14px; z-index: 10; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 700 18px "Bricolage Grotesque", sans-serif; letter-spacing: -.02em; white-space: nowrap; }
.logo svg { width: 28px; height: 28px; }
.logo b { color: var(--teal); font-weight: 700; }
.logo em { font: 600 10px "JetBrains Mono", monospace; font-style: normal; background: var(--navy); color: #fff; padding: 3px 6px; border-radius: 6px; margin-left: 4px; vertical-align: middle; letter-spacing: .06em; }
.search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 36px; }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: inherit; color: var(--ink); }
.search kbd { font: 600 11px "JetBrains Mono", monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
#q-results { position: absolute; top: 42px; left: 0; right: 0; list-style: none; margin: 0; padding: 6px; max-height: 320px; overflow: auto; }
#q-results button { width: 100%; display: flex; justify-content: space-between; gap: 8px; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
#q-results button:hover, #q-results button.on { background: var(--blue-bg); }
#q-results small { color: var(--muted); }
.site-switch { position: relative; margin-left: auto; }
#site-btn { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px 5px 6px; cursor: pointer; text-align: left; }
#site-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.site-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--navy); color: var(--sun); display: grid; place-items: center; font: 700 11px "JetBrains Mono", monospace; flex: none; }
.site-txt b { display: block; font-weight: 600; font-size: 13px; }
.site-txt small { color: var(--muted); font-size: 11px; }
#site-menu { position: absolute; right: 0; top: 50px; width: 290px; list-style: none; margin: 0; padding: 6px; z-index: 20; }
#site-menu button { width: 100%; display: flex; gap: 10px; align-items: center; border: 0; background: none; padding: 8px; border-radius: 10px; cursor: pointer; text-align: left; }
#site-menu button:hover, #site-menu button[aria-selected="true"] { background: var(--blue-bg); }
.live { display: inline-flex; align-items: center; gap: 6px; background: var(--green-bg); color: var(--green); font-weight: 600; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); animation: blink 1.6s infinite; }
.live b { font: 600 12px "JetBrains Mono", monospace; color: var(--ink); }
.bell { position: relative; width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.bell svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell i { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; border: 2px solid #fff; display: none; }
.bell i.on { display: block; }
.user { display: flex; align-items: center; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); white-space: nowrap; }
.av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #19b3a6, #2563eb); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.who b { display: block; font-size: 13px; }
.who small { color: var(--muted); font-size: 11px; }
@keyframes blink { 50% { opacity: .35; } }

/* KPIs */
.kpis { position: fixed; top: 78px; left: 12px; display: flex; gap: 10px; z-index: 5; }
.kpi { display: flex; gap: 10px; padding: 10px 14px 10px 10px; min-width: 176px; }
.kpi .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.kpi .ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic-box { background: var(--blue-bg); color: var(--blue); } .ic-drone { background: var(--teal-bg); color: var(--teal); } .ic-time { background: var(--amber-bg); color: var(--amber); }
.kpi small { display: block; color: var(--muted); font-size: 11px; }
.kpi p { margin: 1px 0; display: flex; align-items: baseline; gap: 6px; }
.kpi p b { font: 700 22px "Bricolage Grotesque", sans-serif; letter-spacing: -.02em; }
.kpi p em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--green); background: var(--green-bg); padding: 1px 6px; border-radius: 999px; }

/* camera controls */
.ctrls { position: fixed; top: 78px; right: 372px; display: flex; flex-direction: column; padding: 4px; gap: 2px; z-index: 5; }
.ctrls button { width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.ctrls button:hover { background: var(--blue-bg); }
.ctrls svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* detail panel */
.detail { position: fixed; top: 78px; right: 12px; width: 350px; max-height: calc(100% - 330px); overflow: auto; padding: 14px; z-index: 5; }
.d-head { display: flex; gap: 10px; align-items: flex-start; }
.d-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 20px; background: var(--blue-bg); }
.d-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.d-kind { font: 600 10px "JetBrains Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); }
.d-title { font: 700 17px "Bricolage Grotesque", sans-serif; letter-spacing: -.01em; margin: 1px 0; }
.d-sub { color: var(--muted); font-size: 12px; }
.d-x { margin-left: auto; display: flex; gap: 2px; }
.d-x button { width: 28px; height: 28px; border: 0; background: none; border-radius: 7px; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.d-x button:hover { background: var(--blue-bg); color: var(--ink); }
.d-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.d-status { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 11px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.chip.green { color: var(--green); background: var(--green-bg); } .chip.blue { color: var(--blue); background: var(--blue-bg); } .chip.amber { color: var(--amber); background: var(--amber-bg); }
.chip.teal { color: var(--teal); background: var(--teal-bg); } .chip.red { color: var(--red); background: var(--red-bg); } .chip.gray { color: var(--muted); background: #eef1f6; }
.d-status span:not(.chip) { color: var(--muted); font-size: 12px; }
.bar { height: 6px; border-radius: 999px; background: #e8ecf4; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #19b3a6, #22c55e); transition: width .4s; }
.bar.blue i { background: linear-gradient(90deg, #60a5fa, #2563eb); } .bar.amber i { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bar-row .bar { flex: 1; }
.bar-row small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.d-rows { margin: 4px 0 0; }
.d-rows div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.d-rows dt { color: var(--muted); }
.d-rows dd { margin: 0; font-weight: 600; text-align: right; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.d-grid > div { background: #f5f7fb; border-radius: 10px; padding: 8px 10px; }
.d-grid small { color: var(--muted); font-size: 11px; display: block; }
.d-grid b { font: 700 16px "Bricolage Grotesque", sans-serif; }
.d-grid .bar { margin-top: 6px; }
.d-sec { font-weight: 600; margin: 12px 0 4px; display: flex; justify-content: space-between; }
.d-sec small { color: var(--muted); font-weight: 400; }
.inv { list-style: none; margin: 0; padding: 0; }
.inv li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.inv .sw { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.inv span { flex: 1; }
.inv b { font: 600 12px "JetBrains Mono", monospace; min-width: 48px; text-align: right; }

/* shipment tracking */
.track { position: fixed; left: 12px; bottom: 12px; width: min(640px, calc(100% - 420px)); padding: 12px 14px; z-index: 5; display: flex; gap: 14px; align-items: center; }
.tr-main { flex: 1; min-width: 0; }
.tr-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.tr-head b { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.tr-head b svg { width: 16px; height: 16px; fill: none; stroke: var(--blue); stroke-width: 2; }
.tr-head small { color: var(--muted); font: 500 11px "JetBrains Mono", monospace; }
.steps { display: flex; list-style: none; margin: 0; padding: 0; }
.steps li { flex: 1; position: relative; text-align: center; font-size: 11px; color: var(--muted); padding-top: 30px; }
.steps li::before { content: ''; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: #dfe5f1; }
.steps li:first-child::before { display: none; }
.steps li.done::before, .steps li.now::before { background: var(--blue); }
.steps li i { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: #eef1f6; border: 2px solid #fff; display: grid; place-items: center; box-shadow: 0 0 0 1px #dfe5f1; z-index: 1; }
.steps li i svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.steps li.done i { background: var(--blue); color: #fff; box-shadow: none; }
.steps li.now i { background: #fff; color: var(--blue); box-shadow: 0 0 0 2px var(--blue), 0 0 0 6px rgba(37, 99, 235, .15); animation: ring 1.6s infinite; }
.steps li b { display: block; color: var(--ink); font-weight: 600; font-size: 11px; white-space: nowrap; }
.steps li small { font: 500 10px "JetBrains Mono", monospace; }
@keyframes ring { 50% { box-shadow: 0 0 0 2px var(--blue), 0 0 0 9px rgba(37, 99, 235, .05); } }
.tr-card { width: 210px; flex: none; display: flex; gap: 10px; align-items: center; background: #f5f7fb; border-radius: 12px; padding: 10px; }
.tr-card .d-ic { width: 38px; height: 38px; }
.tr-card b { display: block; font-size: 12px; }
.tr-card small { color: var(--muted); font-size: 11px; display: block; }

/* fleet table */
.fleet { position: fixed; right: 12px; bottom: 12px; width: 350px; padding: 10px 12px; z-index: 5; }
.tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.tabs button { border: 0; background: none; padding: 5px 9px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12px; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(30, 50, 110, .15); }
.tabs em { font-style: normal; font-weight: 500; color: var(--muted); font-size: 11px; }
.tabs-site { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows { max-height: 176px; overflow: auto; }
.row { width: 100%; display: grid; grid-template-columns: 1fr auto 64px 46px; gap: 8px; align-items: center; border: 0; background: none; text-align: left; padding: 7px 4px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.row:hover, .row.sel { background: var(--blue-bg); }
.row b { font-size: 12px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row small { color: var(--muted); font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .eta { font: 500 11px "JetBrains Mono", monospace; color: var(--muted); text-align: right; }

/* 3D labels */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; font-weight: 600; font-size: 11px; padding: 4px 8px; border-radius: 7px; background: var(--navy); color: #fff; box-shadow: 0 4px 12px rgba(11, 29, 46, .25); will-change: transform; }
.lbl small { color: #9fe3db; font-weight: 500; margin-left: 4px; }
.lbl.hover { background: #fff; color: var(--ink); }
.lbl.hover small { color: var(--teal); }

.toast { position: fixed; left: 50%; top: 78px; transform: translateX(-50%); padding: 9px 14px; z-index: 15; display: flex; gap: 8px; align-items: center; font-weight: 500; }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex: none; }

/* embedded in the marketing page */
body.embed .user, body.embed .bell { display: none; }

@media (max-width: 1180px) {
  .user .who, .search kbd { display: none; }
  .kpi { min-width: 0; }
  .kpi:nth-child(3) { display: none; }
  .track { width: calc(100% - 386px); }
  .tr-card { display: none; }
}
@media (max-width: 820px) {
  .topbar { gap: 8px; }
  .search { display: none; }
  .live { display: none; }
  .logo span { display: none; }
  .kpis { top: 74px; left: 8px; right: 8px; overflow-x: auto; }
  .kpi:nth-child(3) { display: flex; }
  .kpi { padding: 8px 10px 8px 8px; }
  .kpi p b { font-size: 18px; }
  .ctrls { right: 8px; top: 150px; }
  .detail { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 42%; }
  .track, .fleet { display: none; }
  .topbar { left: 8px; right: 8px; top: 8px; }
  .site-txt small { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
