:root {
  --bg: #0a120d;
  --glass: rgba(13, 22, 17, 0.6);
  --glass-2: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef3ec;
  --muted: #95a89b;
  --faint: #5f7366;
  --accent: #c8f560;
  --accent-ink: #0a120d;
  --teal: #7fd6c2;
  --green: #4fa673;
  --amber: #ffb84d;
  --radius: 22px;
  --gap: 14px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.sprite { position: absolute; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-family: var(--mono); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ---------- layout, desktop ---------- */
.app {
  position: relative;
  height: 100vh;
  min-height: 760px;
  padding: 16px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 348px;
  grid-template-rows: 62px minmax(0, 1fr) auto;
  gap: var(--gap);
  overflow: hidden;
}
.map { position: absolute; inset: 0; overflow: hidden; background: #0c1710; }
.top { grid-column: 1 / -1; grid-row: 1; z-index: 3; }
.rail { grid-column: 1; grid-row: 2 / 4; z-index: 3; align-self: start; }
.side { grid-column: 3; grid-row: 2 / 4; z-index: 3; overflow: auto; }
.detail { grid-column: 2; grid-row: 2; z-index: 3; justify-self: end; align-self: start; width: 318px; }
.dock { grid-column: 2; grid-row: 3; z-index: 3; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--gap); }

/* entrance */
.top, .rail, .side, .detail, .dock > * { animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.rail { animation-delay: 0.05s; }
.dock > :first-child { animation-delay: 0.12s; }
.dock > :last-child { animation-delay: 0.18s; }
.side { animation-delay: 0.1s; }
.detail { animation-delay: 0.22s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } }

/* ---------- map ---------- */
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-svg .bld { fill: rgba(190, 225, 195, 0.07); stroke: rgba(190, 225, 195, 0.16); stroke-width: 0.8; }
.map-svg .r-service { stroke: #24372b; stroke-width: 2; fill: none; }
.map-svg .r-minor { stroke: #36503f; stroke-width: 3.2; fill: none; }
.map-svg .r-major { stroke: #6d8f77; stroke-width: 6; fill: none; }
.map-svg .r-glow { stroke: var(--accent); stroke-width: 16; fill: none; opacity: 0; transition: opacity 0.4s; filter: blur(7px); }
.map-svg .r-major-hi { stroke: var(--accent); stroke-width: 4; fill: none; opacity: 0; transition: opacity 0.4s; }
.map.roads .r-glow { opacity: 0.32; }
.map.roads .r-major-hi { opacity: 0.9; }
.map-svg .river { stroke: #1d4a4f; stroke-width: 26; fill: none; opacity: 0.9; }
.map-svg .river-hi { stroke: #4f8f8e; stroke-width: 2; fill: none; opacity: 0.5; }
.map-svg .water { fill: #1d4a4f; }
.map-svg .heat { opacity: 0; transition: opacity 0.5s; }
.map.heat .map-svg .heat { opacity: 1; }
.map-svg .route { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 8 9; vector-effect: non-scaling-stroke; animation: dash 1.1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -34; } }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 45%, rgba(5, 10, 7, 0.75) 100%),
    linear-gradient(180deg, rgba(5, 10, 7, 0.55), transparent 22%, transparent 70%, rgba(5, 10, 7, 0.7));
}
.overlay { position: absolute; inset: 0; z-index: 1; }

.pin {
  position: absolute; left: 0; top: 0;
  border: 0; background: none; padding: 10px;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px;
  --c: var(--muted);
}
.pin .d {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent), 0 0 14px var(--c);
  flex: none;
}
.pin .tag {
  position: absolute; left: 50%; bottom: calc(100% - 4px); transform: translateX(-50%);
  white-space: nowrap; font-size: 11.5px; font-weight: 600;
  padding: 4px 10px 4px 8px; border-radius: 99px;
  background: rgba(10, 18, 13, 0.78); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; gap: 6px;
}
.pin .tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.pin .tag small { color: var(--muted); font-weight: 500; }
.pin.labeled .tag, .pin.sel .tag { display: inline-flex; }
.pin.sel .tag { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pin.sel .tag small { color: rgba(10, 18, 13, 0.65); }
.pin.sel .tag i { background: var(--accent-ink); }
.pin.dim { opacity: 0.18; }
.pin.s-scheduled { --c: #dfe9e1; }
.pin.s-enroute { --c: var(--teal); }
.pin.s-onsite { --c: var(--accent); }
.pin.s-done { --c: var(--green); }
.pin.s-late { --c: var(--amber); }
.pin.s-onsite .d, .pin.s-late .d { animation: beat 1.7s ease-in-out infinite; }
@keyframes beat { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--c) 0%, transparent), 0 0 18px var(--c); } }
.map.no-jobs .pin { opacity: 0; pointer-events: none; }

.selring {
  position: absolute; left: 0; top: 0; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  border-radius: 50%; pointer-events: none;
  border: 1.5px solid color-mix(in srgb, var(--accent) 80%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
  animation: ring 1.7s ease-out infinite;
}
@keyframes ring { 0% { transform: scale(0.55); opacity: 1; } 80%, 100% { transform: scale(1.15); opacity: 0; } }

.crew {
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-radius: 50%; display: grid; place-items: center;
  background: #0d1a12; color: var(--accent);
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 16px rgba(200, 245, 96, 0.45);
  pointer-events: none; transition: opacity 0.3s;
}
.crew .ic { width: 15px; height: 15px; }
.crew b { position: absolute; top: -9px; right: -12px; font: 600 10px var(--mono); background: var(--accent); color: var(--accent-ink); padding: 1px 5px; border-radius: 99px; }
.crew.found { animation: found 0.9s ease-out 2; }
@keyframes found { 50% { box-shadow: 0 0 0 14px rgba(200, 245, 96, 0), 0 0 30px var(--accent); transform: scale(1.25); } }
.map.no-crews .crew { opacity: 0; }

.layers {
  position: absolute; z-index: 2; top: 94px; left: 108px;
  display: flex; gap: 6px; padding: 6px; border-radius: 99px;
}
.chip {
  border: 1px solid var(--line); background: var(--glass-2);
  padding: 7px 14px; border-radius: 99px; font-size: 12.5px; font-weight: 500; color: var(--muted);
  transition: background 0.2s, color 0.2s, transform 0.12s;
}
.chip:active, .nav:active, .btn:active, .seg button:active { transform: scale(0.96); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.scale { position: absolute; z-index: 2; left: 108px; bottom: 236px; margin: 0; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.scale span { display: block; width: 0; height: 6px; border: 1.5px solid var(--muted); border-top: 0; }
.credit { position: absolute; z-index: 2; right: 378px; bottom: 6px; margin: 0; font-size: 10px; color: var(--faint); }
.credit a { color: var(--muted); }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 18px; padding: 0 12px 0 16px; border-radius: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; }
.brand .dot { color: var(--accent); }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; box-shadow: 0 0 22px rgba(200, 245, 96, 0.35); }
.logo svg { width: 22px; height: 22px; fill: none; stroke: var(--accent-ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 40px; border-radius: 99px;
  background: var(--glass-2); border: 1px solid var(--line); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); }
.search input::placeholder { color: var(--faint); }
.search:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.count { font-size: 11px; color: var(--accent); white-space: nowrap; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 12px; }
.who-text { display: grid; line-height: 1.2; }
.who-text small { color: var(--muted); font-size: 11.5px; }

/* ---------- rail ---------- */
.rail { display: grid; gap: 4px; padding: 8px; border-radius: 22px; }
.nav {
  position: relative; border: 0; background: none; color: var(--muted);
  display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 15px;
  font-size: 10.5px; font-weight: 500; transition: background 0.2s, color 0.2s, transform 0.12s;
}
.nav .ic { width: 20px; height: 20px; }
.nav.on { background: rgba(200, 245, 96, 0.13); color: var(--accent); }
.badge { position: absolute; top: 6px; right: 10px; font: 600 9.5px var(--mono); font-style: normal; background: var(--amber); color: #1a1205; border-radius: 99px; padding: 1px 5px; }
.badge:empty { display: none; }

/* ---------- cards ---------- */
.card { padding: 16px 18px; }
.card h2, .side h2, .detail h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card header p, .side .sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

.mix-body { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.ring { width: 132px; height: 132px; flex: none; }
.ring .track { fill: none; stroke: rgba(255, 255, 255, 0.06); }
.ring .arc { fill: none; stroke-linecap: round; transition: stroke-dasharray 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring text { fill: var(--text); font: 600 26px var(--sans); text-anchor: middle; }
.ring .small { fill: var(--muted); font: 500 8.5px var(--mono); letter-spacing: 0.12em; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: grid; grid-template-columns: 10px auto; column-gap: 8px; font-size: 12px; color: var(--muted); }
.legend i { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.legend b { grid-column: 2; font-size: 19px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }

.seg { display: flex; padding: 3px; border-radius: 99px; background: var(--glass-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; color: var(--muted); font-size: 11.5px; padding: 5px 11px; border-radius: 99px; transition: background 0.2s, color 0.2s, transform 0.12s; }
.seg button.on { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.bars { height: 128px; margin-top: 12px; display: flex; align-items: flex-end; gap: 7px; }
.bar { flex: 1; min-width: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 6px; border: 0; background: none; padding: 0; }
.bar .col { align-self: end; border-radius: 8px; height: 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.18)); transition: height 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s; position: relative; }
.bar .col::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: rgba(255, 255, 255, 0.05); }
.bar.hi .col { background: linear-gradient(180deg, var(--accent), rgba(200, 245, 96, 0.35)); box-shadow: 0 0 18px rgba(200, 245, 96, 0.3); }
.bar.pick .col { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.bar small { font: 10px var(--mono); color: var(--faint); text-align: center; }
.bar-tip { font: 500 11px var(--mono); color: var(--accent); min-height: 15px; margin: 6px 0 0; }

/* ---------- side panel ---------- */
.side { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.side > header { display: flex; justify-content: space-between; align-items: center; }
.side .pill { font: 500 11px var(--mono); color: var(--muted); border: 1px solid var(--line); padding: 4px 9px; border-radius: 99px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--glass-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-height: 128px; display: flex; flex-direction: column; }
.tile .k { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.tile .v { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; }
.tile .v small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.tag-up { font: 600 10px var(--mono); color: var(--accent); background: rgba(200, 245, 96, 0.12); padding: 2px 7px; border-radius: 99px; }
.tile svg { margin-top: auto; width: 100%; height: 46px; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark-area { fill: url(#sparkFill); }
.crewbars { margin-top: auto; display: flex; align-items: flex-end; gap: 7px; height: 46px; }
.crewbars span { flex: 1; border-radius: 99px 99px 4px 4px; background: rgba(255, 255, 255, 0.55); transition: height 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.crewbars span.hi { background: var(--accent); }
.gauge { width: 100%; height: 64px; margin-top: auto; }
.gauge .g-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 9; stroke-linecap: round; }
.gauge .g-val { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.2, 0.8, 0.2, 1); filter: drop-shadow(0 0 6px rgba(200, 245, 96, 0.5)); }
.gauge text { fill: var(--text); font: 600 17px var(--sans); text-anchor: middle; }

.list { display: grid; gap: 8px; }
.row {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--glass-2);
  border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
}
.row:active { transform: scale(0.985); }
.row.on { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: rgba(200, 245, 96, 0.08); }
.row .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--mono); background: rgba(255, 255, 255, 0.08); }
.row .av.acc { background: var(--accent); color: var(--accent-ink); }
.row b { display: block; font-size: 13px; font-weight: 600; }
.row small { color: var(--muted); font-size: 11.5px; }
.row .r { font: 500 11px var(--mono); color: var(--muted); text-align: right; }
.st { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px var(--mono); padding: 3px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.st i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.s-onsite { color: var(--accent); }
.st.s-enroute { color: var(--teal); }
.st.s-done { color: var(--green); }
.st.s-late { color: var(--amber); }
.st.s-scheduled { color: #dfe9e1; }
.hours { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); margin-top: 6px; overflow: hidden; }
.hours span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.8s; }

/* ---------- detail card ---------- */
.detail { padding: 14px; display: grid; gap: 12px; }
.detail .mini { position: relative; height: 116px; border-radius: 15px; overflow: hidden; border: 1px solid var(--line); background: #0c1710; }
.detail .mini svg { width: 100%; height: 100%; display: block; }
.detail .mini .mk { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(200, 245, 96, 0.25), 0 0 18px var(--accent); }
.detail .mini .st { position: absolute; left: 10px; top: 10px; background: rgba(10, 18, 13, 0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.detail .close { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: rgba(10, 18, 13, 0.7); display: grid; place-items: center; color: var(--muted); }
.detail .close .ic { width: 14px; height: 14px; }
.detail .meta { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.detail .big { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.detail .big b { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.detail .big small { color: var(--muted); font-size: 12px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.facts div { background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.facts dt { font: 500 10px var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 13px; }
.actions { display: flex; gap: 8px; }
.btn {
  flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 7px;
  border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--line); background: var(--glass-2); transition: transform 0.12s, background 0.2s;
}
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 22px rgba(200, 245, 96, 0.25); }
.btn.flash { animation: flash 0.6s ease-out; }
@keyframes flash { 30% { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(200, 245, 96, 0.25); } }
.empty { color: var(--muted); font-size: 13px; margin: 6px 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 10; left: 50%; bottom: 22px; transform: translate(-50%, 20px);
  background: rgba(10, 18, 13, 0.9); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--text); padding: 10px 16px; border-radius: 99px; font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.nojs { position: fixed; inset: auto 16px 16px; padding: 12px; background: #222; border-radius: 12px; }

/* ---------- mid widths ---------- */
@media (max-width: 1240px) {
  .app { grid-template-columns: 76px minmax(0, 1fr) 312px; }
  .dock { grid-template-columns: 1fr; }
  .dock .mix { display: none; }
  .credit { right: 340px; }
}

/* ---------- phone and tablet ---------- */
@media (max-width: 900px) {
  .app { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 12px; overflow: visible; }
  .top { order: 1; flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .who-text, .live { display: none; }
  .map { order: 2; position: relative; inset: auto; height: 62vh; min-height: 380px; border-radius: var(--radius); border: 1px solid var(--line); }
  .layers { top: 12px; left: 12px; right: 12px; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: none; padding: 7px 12px; }
  .scale { left: 14px; bottom: 26px; }
  .credit { right: 12px; bottom: 8px; left: 14px; text-align: right; }
  .rail, .detail, .side, .dock { align-self: stretch; }
  .rail { order: 3; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; border-radius: 18px; }
  .detail { order: 4; width: auto; justify-self: stretch; }
  .side { order: 5; overflow: visible; }
  .dock { order: 6; grid-template-columns: 1fr; }
  .dock .mix { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .selring { opacity: 0.8; animation: none; }
}
