:root {
  --bg: #dfe4df;
  --panel: #f4f6f3;
  --ink: #0e1410;
  --muted: #4d5a52;
  --line: rgba(14, 20, 16, 0.1);
  --accent: #c45c12;
  --accent-hot: #e8923a;
  --accent-soft: rgba(196, 92, 18, 0.14);
  --secure: #1a6b43;
  --secure-bright: #3ecf8e;
  --secure-soft: rgba(26, 107, 67, 0.14);
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.14);
  --sidebar: #0a0e0b;
  --map: #121a15;
  --font: "Outfit", "Outfit Fallback", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(196, 92, 18, 0.08), transparent 50%),
    var(--bg);
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; }
a { color: inherit; text-decoration: none; }
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.demo-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1.2rem;
  background: #050705;
  color: #d7ddd7;
  font-size: 0.82rem;
}
.demo-bar-links { display: flex; gap: 1rem; align-items: center; }
.demo-bar a { color: #f0a46a; font-weight: 700; }

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: calc(100vh - 38px);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(196, 92, 18, 0.12) 0%, transparent 28%),
    var(--sidebar);
  color: #dce3dc;
  padding: 1.55rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 1.35rem;
  padding: 0.15rem 0.5rem;
}
.brand-title {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}
.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent-hot), var(--accent));
  box-shadow:
    0 0 0 4px rgba(196, 92, 18, 0.2),
    0 8px 18px rgba(196, 92, 18, 0.35);
}
#nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav-btn {
  text-align: left;
  padding: 0.78rem 0.85rem;
  border-radius: 12px;
  background: transparent;
  color: #8b968c;
  font-weight: 650;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e8eee8;
}
.nav-btn.is-active {
  background: rgba(196, 92, 18, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(232, 146, 58, 0.28);
}
.side-meta { margin-top: auto; display: grid; gap: 0.75rem; }
.link-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.82rem;
  font-weight: 650;
  color: #b8c2b8;
  font-variant-numeric: tabular-nums;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.dot.live {
  background: var(--secure-bright);
  box-shadow: 0 0 0 4px rgba(62, 207, 142, 0.18);
  animation: pulse-dot 1.6s var(--ease) infinite;
}
.dot.warn {
  background: var(--accent-hot);
  box-shadow: 0 0 0 4px rgba(232, 146, 58, 0.18);
  animation: none;
}
.dot.off { background: #94a3b8; box-shadow: none; animation: none; }
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
.side-foot {
  padding: 0 0.85rem;
  color: #667066;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.workspace {
  padding: 1.5rem clamp(1.1rem, 3vw, 2.2rem) 2.2rem;
}
.bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.35rem;
}
.bar-copy { min-width: 0; }
.bar h2 {
  margin: 0;
  font-size: clamp(2.1rem, 4.2vw, 3.15rem);
  letter-spacing: -0.04em;
  font-weight: 800;
  line-height: 0.95;
}
.seal {
  display: inline-flex;
  margin-top: 0.55rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--secure-soft);
  color: var(--secure);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}
.seal.is-warn {
  background: var(--accent-soft);
  color: #9a4a10;
}
.seal.is-off {
  background: rgba(100, 116, 139, 0.16);
  color: var(--muted);
}
.bar-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.ghost, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  border-radius: 12px;
  font-weight: 750;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.ghost {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}
.ghost:hover { transform: translateY(-1px); }
.ghost.danger {
  color: var(--danger);
  background: #fff;
  box-shadow:
    inset 0 0 0 1.5px rgba(180, 35, 24, 0.45),
    0 10px 24px rgba(180, 35, 24, 0.08);
}
.ghost.danger:hover { background: var(--danger-soft); }
.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 28px rgba(14, 20, 16, 0.18);
}
.primary:hover { transform: translateY(-1px); }
.primary:disabled, .action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.view { display: none; }
.view.is-active {
  display: block;
  animation: rise 0.34s var(--ease);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.15rem 1.2rem;
  box-shadow: 0 18px 40px rgba(14, 20, 16, 0.04);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 0.95rem;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.chip {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--secure-soft);
  color: var(--secure);
  font-size: 0.74rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.chip.warn {
  background: var(--accent-soft);
  color: #9a4a10;
}
.linkish {
  background: transparent;
  color: var(--accent);
  font-weight: 750;
  font-size: 0.85rem;
}
.hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.9rem 0 0;
  line-height: 1.45;
}

.live-grid {
  display: grid;
  grid-template-columns: 1.55fr 0.85fr;
  gap: 1rem;
  align-items: stretch;
}
.live-side { display: grid; gap: 1rem; align-content: start; }

.map-panel { overflow: hidden; }
.map {
  position: relative;
  height: min(58vh, 520px);
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 32% 42%, rgba(232, 146, 58, 0.28), transparent 36%),
    radial-gradient(ellipse at 70% 55%, rgba(62, 207, 142, 0.16), transparent 34%),
    linear-gradient(165deg, #2a3530 0%, var(--map) 48%, #070b08 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.map-atmos {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 50% 120%, rgba(196, 92, 18, 0.16), transparent 42%);
  pointer-events: none;
}
.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 55%, #000 35%, transparent 78%);
  opacity: 0.7;
  pointer-events: none;
}
.map-road {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.map-road.r1 { left: 6%; top: 48%; width: 88%; height: 11px; transform: rotate(-8deg); }
.map-road.r2 { left: 38%; top: 10%; width: 11px; height: 80%; transform: rotate(12deg); }
.map-road.r3 { left: 16%; top: 68%; width: 66%; height: 9px; transform: rotate(18deg); }

.map-trails {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.map-trails path {
  fill: none;
  stroke: rgba(62, 207, 142, 0.55);
  stroke-width: 0.7;
  stroke-linecap: round;
}

.map-scan {
  position: absolute;
  left: -10%;
  right: -10%;
  height: 28%;
  top: -30%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(232, 146, 58, 0.07),
    transparent
  );
  animation: scan 5.5s var(--ease) infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes scan {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translateY(420%); opacity: 0; }
}

.map-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 0.45rem;
  z-index: 3;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.map-hud span {
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(7, 11, 8, 0.72);
  color: #e8eee8;
  backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums;
}
#hud-seal { color: var(--secure-bright); }
#hud-lat { color: var(--accent-hot); }

.marker {
  position: absolute;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  transition: left 0.9s linear, top 0.9s linear, opacity 0.25s ease, transform 0.25s ease;
  z-index: 2;
}
.marker.you {
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  background: var(--accent-hot);
  animation: gps-ping-you 2.4s var(--ease) infinite;
}
.marker.peer {
  background: var(--secure-bright);
  animation: gps-ping 2s var(--ease) infinite;
}
@keyframes gps-ping {
  0%, 100% { box-shadow: 0 0 0 6px rgba(62, 207, 142, 0.18), 0 0 18px rgba(62, 207, 142, 0.35); }
  50% { box-shadow: 0 0 0 14px rgba(62, 207, 142, 0.08), 0 0 28px rgba(62, 207, 142, 0.45); }
}
@keyframes gps-ping-you {
  0%, 100% { box-shadow: 0 0 0 7px rgba(232, 146, 58, 0.22), 0 0 24px rgba(232, 146, 58, 0.45); }
  50% { box-shadow: 0 0 0 16px rgba(232, 146, 58, 0.1), 0 0 32px rgba(232, 146, 58, 0.55); }
}
.marker.poi {
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 2px;
  background: #dce3dc;
  border: 0;
  box-shadow: none;
  animation: none;
}
.marker.is-gone { opacity: 0; transform: scale(0.35); }
.marker-label {
  position: absolute;
  transform: translate(-50%, 12px);
  margin-top: 6px;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(7, 11, 8, 0.78);
  color: #e8eee8;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
}
.you-label {
  position: absolute;
  left: 50%;
  top: calc(58% + 16px);
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 1;
  pointer-events: none;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.95rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}
.map-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.lg {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.lg.you { background: var(--accent-hot); }
.lg.peer { background: var(--secure-bright); }
.lg.poi { background: #647066; border-radius: 2px; }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 250px;
  overflow: auto;
}
.feed li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.78rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.feed strong { font-weight: 750; }
.feed span {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.actions-grid { display: grid; gap: 0.55rem; }
.action {
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #e8ece8;
  border: 1px solid transparent;
  font-weight: 700;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.action:hover:not(:disabled) {
  background: #fff4eb;
  border-color: rgba(196, 92, 18, 0.28);
  transform: translateY(-1px);
}
.action.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.buffer { margin-top: 1rem; }
.buffer-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}
.meter {
  height: 9px;
  border-radius: 999px;
  background: #d5dcd5;
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(var(--fill, 0));
  background: linear-gradient(90deg, var(--accent), var(--accent-hot));
  border-radius: inherit;
  transition: transform 0.28s var(--ease);
  will-change: transform;
}

.kpis {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.kpis article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.2rem 1.25rem;
  box-shadow: 0 18px 40px rgba(14, 20, 16, 0.04);
}
.kpis span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}
.kpis strong {
  display: block;
  margin: 0.45rem 0 0.3rem;
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  letter-spacing: -0.04em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.kpi-hero {
  background:
    linear-gradient(145deg, rgba(26, 107, 67, 0.14), transparent 55%),
    var(--panel) !important;
}
.kpi-hero strong {
  font-size: clamp(2.4rem, 4.5vw, 3.4rem);
  color: var(--secure);
  line-height: 0.92;
}
.kpis em {
  font-style: normal;
  color: var(--secure);
  font-size: 0.85rem;
  font-weight: 650;
}
.kpis em.warn { color: var(--accent); }
.kpis em.danger { color: var(--danger); }

.split {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 1rem;
}
.proto {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.proto li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: #e8ece8;
  font-size: 0.92rem;
}
.proto .pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--secure-bright);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.18);
}
.proto li.bad .pip {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16);
}
.proto li.bad { background: var(--danger-soft); }
.proto strong { font-weight: 750; }
.proto span { color: var(--muted); text-align: right; }

.route-list, .mod-list, .gear-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.route-item, .mod-item, .gear-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background: #e8ece8;
  border: 1px solid transparent;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.route-item:hover, .mod-item:hover, .gear-item:hover {
  transform: translateY(-1px);
  border-color: rgba(196, 92, 18, 0.18);
}
.route-item strong, .mod-item strong, .gear-item strong {
  display: block;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}
.route-item span, .mod-item span, .gear-item span {
  color: var(--muted);
  font-size: 0.82rem;
}
.route-actions, .mod-actions { display: flex; gap: 0.35rem; }
.mini {
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 750;
}
.mini.ok { color: var(--secure); }
.mini.warn { color: var(--accent); }
.mini.danger { color: var(--danger); }
.mod-item.flagged {
  border-color: rgba(180, 35, 24, 0.22);
  background: var(--danger-soft);
}
.mod-item.approved {
  border-color: rgba(26, 107, 67, 0.22);
  background: var(--secure-soft);
}

.tag {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
}
.tag.ok { background: var(--secure-soft); color: var(--secure); }
.tag.warn { background: var(--accent-soft); color: #9a4a10; }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

.vehicle-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.15rem;
}
.vehicle-head strong {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.vehicle-head span {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.gauge-grid { display: grid; gap: 1rem; }
.gauge { display: grid; gap: 0.4rem; }
.gauge-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
}
.gauge-top em {
  font-style: normal;
  color: var(--muted);
  font-weight: 650;
}
.gauge .meter i.ok { background: linear-gradient(90deg, var(--secure), var(--secure-bright)); }
.gauge .meter i.warn { background: linear-gradient(90deg, var(--accent), var(--accent-hot)); }
.gauge .meter i.danger { background: linear-gradient(90deg, #911c14, #d6453a); }

.gear-item .wear { grid-column: 1 / -1; }
.gear-item .meter { margin-top: 0.2rem; }

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  background: var(--sidebar);
  color: #fff;
  padding: 0.8rem 1.1rem;
  border-radius: 14px;
  font-weight: 700;
  z-index: 40;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  max-width: min(92vw, 320px);
  animation: rise 0.28s var(--ease);
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.8rem;
    overflow: visible;
    background: var(--sidebar);
  }
  .brand { padding: 0; flex: 0 0 auto; }
  .brand-title { font-size: 1.05rem; }
  #nav {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .nav-btn {
    text-align: center;
    padding: 0.65rem 0.5rem;
    font-size: 0.82rem;
  }
  .side-meta { display: none; }
  .live-grid, .split, .kpis { grid-template-columns: 1fr; }
  .map { height: 320px; }
  .bar h2 { font-size: clamp(1.85rem, 8vw, 2.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .view.is-active, .toast, .map-scan, .dot.live, .marker { animation: none; transition: none; }
}
