:root {
  color-scheme: dark;
  --bg: #0a1114;
  --panel: #0d171b;
  --panel-2: #111e23;
  --line: #24343b;
  --muted: #75878e;
  --text: #e8f0ee;
  --lime: #c8f65a;
  --cyan: #4ee6d4;
  --orange: #ff9158;
  --danger: #ff5f6d;
  --sidebar-width: 385px;
  --topbar-height: 74px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow: 0 24px 80px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  height: 100vh;
  min-height: 640px;
  background: var(--bg);
}

.topbar {
  position: relative;
  z-index: 20;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 16, 19, .96);
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  color: var(--text);
  text-decoration: none;
  border-right: 0;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: end;
  gap: 3px;
  padding: 5px;
  border: 1px solid #3f535a;
  transform: rotate(45deg);
}

.brand-mark span {
  width: 4px;
  background: var(--lime);
  transform: rotate(-45deg) translateY(-1px);
  transform-origin: bottom;
}
.brand-mark span:nth-child(1) { height: 7px; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 10px; }

.brand strong { display: block; font-size: 14px; letter-spacing: .18em; line-height: 1.1; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font: 400 9px/1 "Inter", sans-serif; letter-spacing: .22em; text-transform: uppercase; }

.topbar-center {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #93a4aa;
  font: 500 9px/1 "DM Mono", monospace;
  letter-spacing: .16em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: pulse 2s infinite;
}

@keyframes pulse { 50% { opacity: .35; box-shadow: 0 0 2px var(--lime); } }
.divider { width: 1px; height: 12px; background: #34464d; }

.top-actions { justify-self: end; display: flex; align-items: center; gap: 10px; padding-right: 0; }
.icon-button, .ghost-button {
  height: 38px;
  border: 1px solid #2a3c43;
  background: #101b20;
  cursor: pointer;
  transition: .2s ease;
  border-radius: var(--radius-sm);
}
.import-button { color: var(--lime); border-color: #3c4e3c; background: #162226; }
.import-button:hover { border-color: var(--lime); }
.icon-button:hover, .ghost-button:hover { border-color: #52666c; background: #15242a; }
.icon-button { width: 38px; display: grid; place-items: center; }
.ghost-button { padding: 0 14px; display: flex; align-items: center; gap: 8px; color: #9aabad; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.icon-button svg, .ghost-button svg, .map-controls svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

main { height: calc(100vh - var(--topbar-height)); display: grid; grid-template-columns: var(--sidebar-width) 1fr; }

.sidebar {
  position: relative;
  z-index: 10;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.sidebar-heading { padding: 27px 27px 17px; }
.eyebrow { margin: 0 0 10px; color: var(--lime); font: 500 9px/1 "DM Mono", monospace; letter-spacing: .18em; }
.sidebar-heading h1 { margin: 0; font-size: 32px; line-height: 1; letter-spacing: -.045em; }
.sidebar-heading h1 span { color: #74868c; font-weight: 400; }
.sidebar-heading > p:last-child { max-width: 310px; margin: 13px 0 0; color: #75868c; font-size: 11px; line-height: 1.65; }

.search-box {
  margin: 0 27px 14px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  background: #111e23;
  border: 1px solid #25363c;
  border-radius: 14px;
  transition: border-color .2s;
}
.search-box:focus-within { border-color: #65797e; }
.search-box svg { width: 15px; flex: 0 0 auto; fill: none; stroke: #667980; stroke-width: 1.7; }
.search-box input { width: 100%; min-width: 0; color: #cbd7d5; background: transparent; border: 0; outline: 0; font-size: 11px; }
.search-box input::placeholder { color: #5e7076; }
kbd { padding: 3px 6px; color: #566970; border: 1px solid #31434a; border-radius: 7px; font: 400 9px "DM Mono", monospace; }

.filter-row { display: flex; gap: 6px; padding: 0 27px 17px; border-bottom: 1px solid #1f2e34; overflow-x: auto; }
.filter-chip {
  flex: 0 0 auto;
  padding: 7px 9px;
  color: #7a8c92;
  border: 1px solid #283940;
  border-radius: 999px;
  background: transparent;
  font: 500 8px/1 "DM Mono", monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}
.filter-chip span { color: #52646a; margin-left: 3px; }
.filter-chip.active { color: #dce5e3; border-color: #566a70; background: #17262b; }

.route-list { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #304249 transparent; }
.route-list-empty { padding: 35px 27px; color: #687a80; font-size: 11px; line-height: 1.6; }

.route-card {
  --route-color: var(--lime);
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px 22px 16px 27px;
  color: inherit;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #1f2e34;
  background: transparent;
  cursor: pointer;
  transition: .2s ease;
}
.route-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--route-color); opacity: 0; box-shadow: 0 0 12px var(--route-color); }
.route-card:hover { background: rgba(255,255,255,.018); }
.route-card.active { background: linear-gradient(90deg, color-mix(in srgb, var(--route-color) 9%, transparent), transparent 75%); }
.route-card.active::before { opacity: 1; }

.route-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--route-color);
  border: 1px solid color-mix(in srgb, var(--route-color) 35%, #26373d);
  background: color-mix(in srgb, var(--route-color) 6%, #101c20);
  border-radius: 14px;
}
.route-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.route-card h3 { margin: 0 0 5px; font-size: 14px; letter-spacing: .015em; }
.route-meta { display: flex; align-items: center; gap: 7px; color: #65777d; font: 400 8px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.risk { padding: 2px 6px; color: var(--danger); border: 1px solid currentColor; border-radius: 999px; }
.risk.medium { color: #e4b451; }
.route-card-controls { position: relative; width: 62px; height: 30px; display: grid; place-items: center end; }
.card-arrow { position: absolute; right: 0; color: #4f6268; font-size: 17px; transform: translateX(0); transition: .2s; }
.route-card.active .card-arrow { color: var(--route-color); transform: translateX(3px); }
.route-actions { position: absolute; right: 0; display: flex; gap: 4px; opacity: 0; visibility: hidden; transform: translateX(5px); transition: .18s ease; }
.route-card:hover .route-actions, .route-card:focus-within .route-actions { opacity: 1; visibility: visible; transform: translateX(0); }
.route-card:hover .card-arrow, .route-card:focus-within .card-arrow { opacity: 0; visibility: hidden; }
.route-action { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; color: #8ca0a5; border: 1px solid #30434a; border-radius: 9px; background: #101c20; cursor: pointer; }
.route-action:hover { color: var(--lime); border-color: color-mix(in srgb, var(--lime) 55%, #30434a); background: #17252a; }
.route-action.danger:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, #30434a); }
.route-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-footer {
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 27px;
  color: #53666c;
  border-top: 1px solid #24353b;
  background: #0c161a;
  font: 400 8px "DM Mono", monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.security-line { display: flex; align-items: center; gap: 7px; }
.security-line span { width: 5px; height: 5px; border-radius: 50%; background: #5d796c; }

.map-panel { position: relative; min-width: 0; overflow: hidden; background: #101a1f; cursor: grab; }
.map-panel.dragging { cursor: grabbing; }
.map-grid { position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0; background-image: linear-gradient(#8ba0a7 1px, transparent 1px), linear-gradient(90deg, #8ba0a7 1px, transparent 1px); background-size: 42px 42px; }
.route-map { width: 100%; height: 100%; display: block; user-select: none; touch-action: none; }
#baseMapImage { display: block; filter: brightness(.84) contrast(1.05) saturate(.9); }
.base-map-shade { fill: #081015; opacity: .1; pointer-events: none; }
#importedMapImage { display: none; opacity: .76; filter: saturate(.72) brightness(.62) contrast(1.15); }
.map-panel.scan-layer-active #importedMapImage { display: block; }
.map-panel.scan-layer-active .terrain,
.map-panel.scan-layer-active .roads,
.map-panel.scan-layer-active .districts,
.map-panel.scan-layer-active .poi-layer { opacity: .1; }

.terrain, .roads, .districts, .poi-layer { opacity: 0; }

.terrain .water { fill: #0b1519; }
.terrain .coast { fill: none; stroke: #31454c; stroke-width: 8; opacity: .7; }
.terrain .mountain { fill: #142329; opacity: .78; }
.terrain .mountain-line, .terrain .park-line { fill: none; stroke: #2a3f45; stroke-width: 2; opacity: .65; }
.terrain .park { fill: #142721; stroke: #294339; stroke-width: 3; opacity: .65; }
.roads { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.roads-minor { stroke: #293a40; stroke-width: 10; }
.roads-minor path { vector-effect: non-scaling-stroke; }
.roads-major { stroke: #364950; stroke-width: 18; }
.roads-major path { vector-effect: non-scaling-stroke; }
.roads-major path::after { stroke: #0e181c; }
.districts text { fill: #4e6269; font: 500 12px "DM Mono", monospace; letter-spacing: .14em; }
.poi-layer circle { fill: #31474e; }

.route-path-back { fill: none; stroke: #0b1114; stroke-width: 14; stroke-linecap: round; stroke-dasharray: 1 19; opacity: .9; }
.route-path { fill: none; stroke: var(--active-route); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 5 16; filter: url(#routeGlow); opacity: .92; animation: routeMove 1.15s linear infinite; }
@keyframes routeMove { to { stroke-dashoffset: -21; } }

.marker { cursor: pointer; transform-box: fill-box; transform-origin: center; transition: opacity .16s ease, filter .16s ease; }
.marker .marker-pulse { fill: none; stroke: var(--marker-color); stroke-width: 2; opacity: .2; }
.marker.active .marker-pulse { animation: markerPulse 2s infinite; }
@keyframes markerPulse { 0% { r: 25; opacity: .45; } 70%,100% { r: 47; opacity: 0; } }
.marker .marker-outer { fill: #0b1418; stroke: var(--marker-color); stroke-width: 3; filter: url(#softGlow); }
.marker .marker-inner { fill: var(--marker-color); opacity: .12; }
.marker .marker-number { fill: var(--marker-color); font: 800 17px "Inter", sans-serif; text-anchor: middle; dominant-baseline: central; }
.marker .marker-label-bg { fill: #0b1418; stroke: #304249; stroke-width: 1; }
.marker .marker-label { fill: #d5dfdd; font: 600 10px "Inter", sans-serif; letter-spacing: .035em; text-anchor: middle; }
.marker .marker-stage { fill: #73868c; font: 500 8px "DM Mono", monospace; letter-spacing: .06em; text-anchor: middle; text-transform: uppercase; }
.marker:hover, .marker:active { opacity: .12 !important; filter: none; }

.map-topline { position: absolute; z-index: 4; top: 18px; left: 21px; right: 21px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; pointer-events: none; }
.coordinate-box, .active-route-box, .stage-legend { display: flex; align-items: center; background: rgba(10,18,21,.88); border: 1px solid #2a3d43; backdrop-filter: blur(12px); }
.coordinate-box, .active-route-box { height: 32px; gap: 8px; padding: 0 11px; color: #b8cacd; border-radius: 999px; font: 400 9px "DM Mono", monospace; letter-spacing: .06em; }
.active-route-box { color: #91a4a8; text-transform: uppercase; }
.crosshair { color: var(--lime); font-size: 15px; }
.scan-layer-badge {
  height: 32px;
  align-items: center;
  gap: 7px;
  margin-left: 8px;
  padding: 0 5px 0 10px;
  color: #a5b5b7;
  background: rgba(10,18,21,.9);
  border: 1px solid #31524c;
  border-radius: 999px;
  font: 500 8px "DM Mono", monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
  pointer-events: auto;
}
.scan-layer-badge:not([hidden]) { display: flex; }
.scan-layer-badge > span { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.scan-layer-badge button { width: 23px; height: 23px; margin-left: 3px; color: #6f8388; border: 0; background: #14242a; cursor: pointer; font-size: 15px; }
.scan-layer-badge button:hover { color: var(--text); }
.stage-legend { height: 38px; gap: 8px; padding: 0 11px; color: #9cadb0; border-radius: 999px; font: 500 8px "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; transition: .2s; }
.stage-dot { width: 19px; height: 19px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--text); border: 1px solid #496067; font: 700 8px "Inter", sans-serif; font-style: normal; }
.stage-dot.one { border-color: var(--lime); color: var(--lime); }
.stage-dot.two { border-color: var(--cyan); color: var(--cyan); }
.stage-dot.three { border-color: var(--orange); color: var(--orange); }
.legend-line { width: 15px; height: 1px; background: #394d53; }

.map-controls { position: absolute; z-index: 4; left: 21px; bottom: 22px; display: flex; flex-direction: column; overflow: hidden; background: rgba(10,18,21,.92); border: 1px solid #2a3d43; border-radius: var(--radius-md); backdrop-filter: blur(12px); }
.map-controls button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: #899a9f; border: 0; background: transparent; cursor: pointer; font: 400 20px/1 "DM Mono", monospace; }
.map-controls button:hover { color: var(--lime); background: #18272c; }
.map-controls span { height: 1px; background: #2a3d43; }

.map-tip { position: absolute; z-index: 4; bottom: 23px; left: 72px; color: #5e7278; font: 400 8px "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; pointer-events: none; }
.map-tip span { color: #899b9f; }

.route-detail {
  --detail-color: var(--lime);
  position: absolute;
  z-index: 5;
  right: 21px;
  bottom: 22px;
  width: min(430px, calc(100% - 120px));
  background: rgba(10, 18, 21, .94);
  border: 1px solid #2b3d43;
  border-top: 3px solid var(--detail-color);
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow);
  border-radius: 20px;
  overflow: hidden;
  transition: .25s ease;
}

.drop-overlay {
  position: absolute;
  z-index: 15;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px;
  opacity: 0;
  visibility: hidden;
  background: rgba(6, 13, 16, .84);
  backdrop-filter: blur(8px);
  transition: opacity .18s ease, visibility .18s ease;
  pointer-events: none;
}
.drop-overlay.visible { opacity: 1; visibility: visible; }
.drop-target {
  position: relative;
  width: min(560px, 90%);
  height: 290px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed #52766e;
  background: rgba(18, 35, 39, .66);
  box-shadow: inset 0 0 70px rgba(78, 230, 212, .035);
}
.drop-target::before, .drop-target::after { content: ""; position: absolute; width: 34px; height: 34px; border-color: var(--cyan); opacity: .8; }
.drop-target svg { width: 35px; margin-bottom: 17px; fill: none; stroke: var(--cyan); stroke-width: 1.3; filter: drop-shadow(0 0 8px rgba(78,230,212,.45)); }
.drop-target strong { font-size: 17px; }
.drop-target span { margin-top: 8px; color: #70858a; font: 400 8px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }

.detail-head { display: flex; align-items: start; justify-content: space-between; padding: 16px 17px 13px; border-bottom: 1px solid #26383e; }
.detail-kicker { margin: 0 0 5px; color: var(--detail-color); font: 500 8px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.detail-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.risk-badge { padding: 5px 8px; color: var(--danger); border: 1px solid color-mix(in srgb, currentColor 40%, #25363c); border-radius: 999px; background: color-mix(in srgb, currentColor 7%, transparent); font: 500 7px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.risk-badge.medium { color: #e4b451; }

.detail-route { display: grid; grid-template-columns: 1fr 18px 1fr 18px 1fr; align-items: center; padding: 13px 12px 15px; }
.stage-item { min-width: 0; text-align: center; }
.stage-item .stage-dot { margin: 0 auto 7px; }
.stage-item strong { display: block; overflow: hidden; color: #d5dedd; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.stage-item small { display: block; margin-top: 3px; color: #61747a; font: 400 7px "DM Mono", monospace; text-transform: uppercase; }
.stage-arrow { color: #43565c; text-align: center; font-size: 13px; }
.detail-foot { min-height: 36px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; color: #60747a; border-top: 1px solid #26383e; background: rgba(255,255,255,.012); font: 400 8px "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.detail-foot strong { color: #90a2a5; font-weight: 500; }

.legend-modal[hidden] { display: none; }
.legend-modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,8,10,.72); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(440px, calc(100% - 36px)); padding: 27px; overflow: hidden; background: #101b20; border: 1px solid #33474e; border-radius: var(--radius-lg); box-shadow: 0 30px 100px #000; }
.modal-card h2 { margin: 0 0 23px; font-size: 23px; }
.modal-close { position: absolute; top: 13px; right: 13px; width: 30px; height: 30px; color: #788b91; border: 1px solid #2b3e45; border-radius: 10px; background: transparent; cursor: pointer; font-size: 21px; line-height: 1; }
.modal-stages { display: grid; gap: 9px; }
.modal-stages > div { display: flex; align-items: center; gap: 12px; padding: 11px; border: 1px solid #26383e; background: #0d171b; }
.modal-stages strong, .modal-stages small { display: block; }
.modal-stages strong { font-size: 11px; }
.modal-stages small { margin-top: 3px; color: #66797f; font-size: 9px; }
.modal-note { margin: 18px 0 0; color: #63767c; font-size: 9px; line-height: 1.55; }

.scan-modal[hidden] { display: none; }
.scan-modal { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 22px; }
.scan-card {
  position: relative;
  width: min(1080px, 100%);
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  background: #0d171b;
  border: 1px solid #354a51;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 35px 120px rgba(0,0,0,.75);
}
.scan-header { flex: 0 0 auto; display: flex; align-items: start; justify-content: space-between; padding: 20px 22px 17px; border-bottom: 1px solid #26383e; }
.scan-header .eyebrow { margin-bottom: 7px; }
.scan-header h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.scan-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(400px, .96fr); overflow: auto; }
.scan-visual-column { padding: 19px; border-right: 1px solid #26383e; background: #0a1317; }
.scan-preview { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #071014; border: 1px solid #2d4148; border-radius: var(--radius-md); cursor: crosshair; }
.scan-preview::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(78,230,212,.025) 50%, transparent 50%); background-size: 100% 4px; mix-blend-mode: screen; }
.scan-preview img { width: 100%; height: 100%; display: block; object-fit: contain; background: #071014; }
.scan-line { position: absolute; z-index: 3; left: 0; right: 0; top: -2px; height: 2px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); box-shadow: 0 0 15px var(--cyan); opacity: 0; }
.scan-modal.scanning .scan-line { opacity: .75; animation: scanLine 2.2s ease-in-out infinite; }
@keyframes scanLine { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }
.preview-pin { position: absolute; z-index: 5; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; transform: translate(-50%, -50%); border-radius: 50%; background: #0a1418; cursor: pointer; box-shadow: 0 0 0 5px rgba(10,20,24,.55); }
.preview-pin span { font: 800 10px "Inter", sans-serif; }
.preview-pin.pin-one { color: var(--lime); border: 1px solid var(--lime); }
.preview-pin.pin-two { color: var(--cyan); border: 1px solid var(--cyan); }
.preview-pin.pin-three { color: var(--orange); border: 1px solid var(--orange); }
.preview-pin.selected { box-shadow: 0 0 0 5px rgba(200,246,90,.14), 0 0 18px currentColor; }

.scan-progress-wrap { padding: 12px 0 5px; }
.scan-progress-copy { display: flex; justify-content: space-between; color: #71858b; font: 400 8px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.scan-progress-copy strong { color: var(--cyan); font-weight: 500; }
.scan-progress { height: 2px; margin-top: 8px; overflow: hidden; background: #213239; }
.scan-progress span { width: 0; height: 100%; display: block; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); transition: width .2s ease; }

.placement-help { margin-top: 10px; padding: 12px; border: 1px solid #283b42; border-radius: var(--radius-md); background: #0e191e; }
.local-badge { display: inline-flex; align-items: center; gap: 6px; color: #7f9599; font: 500 7px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.local-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--lime); }
.placement-help p { margin: 8px 0 11px; color: #70848a; font-size: 9px; line-height: 1.5; }
.placement-help p strong { color: #b5c3c2; font-weight: 600; }
.placement-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.placement-buttons button { min-width: 0; height: 35px; display: flex; align-items: center; justify-content: center; gap: 6px; color: #71858a; border: 1px solid #293c43; border-radius: 10px; background: #0b1519; cursor: pointer; font-size: 8px; }
.placement-buttons button.active { color: #d7e2e0; border-color: #587078; background: #15252a; }
.placement-buttons .stage-dot { width: 17px; height: 17px; }

.scan-form-column { padding: 19px 21px; overflow: auto; }
.scan-form-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.scan-form-heading > div span, .scan-form-heading > div small { display: block; }
.scan-form-heading > div span { font-size: 11px; font-weight: 700; }
.scan-form-heading > div small { margin-top: 3px; color: #63777d; font-size: 8px; }
.confidence-badge { padding: 5px 7px; color: #e4b451; border: 1px solid #5d512f; background: #211e14; font: 500 7px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.confidence-badge.done { color: var(--lime); border-color: #41552e; background: #172014; }
.confidence-badge.manual { color: var(--orange); border-color: #5d3c2d; background: #241712; }

.scan-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.scan-form-grid label, .extracted-stage label, .coordinate-inputs label { color: #6d8187; font: 500 7px "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.scan-form-grid .wide-field { grid-column: 1 / -1; }
.scan-form-grid input, .extracted-stage input {
  width: 100%;
  height: 36px;
  display: block;
  margin-top: 5px;
  padding: 0 10px;
  color: #d6e0de;
  border: 1px solid #2b3e45;
  border-radius: 0;
  outline: 0;
  background: #0a1418;
  border-radius: 10px;
  font: 500 10px "Inter", sans-serif;
  text-transform: none;
}
.scan-form-grid input:focus, .extracted-stage input:focus { border-color: #5e767c; }
.extracted-stages { display: grid; gap: 7px; margin-top: 14px; }
.extracted-stage { display: grid; grid-template-columns: 24px minmax(0, 1fr) 180px; align-items: center; gap: 9px; padding: 9px; border: 1px solid #273a40; border-radius: 14px; background: #0b1519; transition: .2s; }
.extracted-stage.active { border-color: #566e74; background: #101f24; }
.extracted-stage.postal-resolved { border-color: #415c3a; box-shadow: inset 0 0 0 1px rgba(200,246,90,.04); }
.extracted-stage.postal-pending { border-color: #654a2f; }
.extracted-stage > .stage-dot { width: 22px; height: 22px; }
.extracted-stage label > span { display: block; }
.extracted-stage input { height: 31px; margin-top: 4px; padding: 0 8px; font-size: 9px; }
.coordinate-inputs { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 5px; }
.coordinate-inputs input { text-align: center; padding: 0 3px; font-family: "DM Mono", monospace; font-size: 8px; }
.postal-field input { color: var(--lime); border-color: #3b5135; }
.postal-field input::placeholder { color: #4e6550; }
.ocr-raw { margin-top: 11px; overflow: hidden; color: #6c8086; border: 1px solid #26383e; border-radius: 12px; background: #0a1418; font-size: 8px; }
.ocr-raw summary { padding: 9px; cursor: pointer; font: 500 7px "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.ocr-raw pre { max-height: 90px; margin: 0; padding: 9px; overflow: auto; color: #788c91; border-top: 1px solid #26383e; font: 400 8px/1.5 "DM Mono", monospace; white-space: pre-wrap; }

.scan-footer { flex: 0 0 auto; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 22px; border-top: 1px solid #26383e; background: #0a1418; }
.scan-footer p { max-width: 390px; margin: 0; color: #576b71; font: 400 7px/1.45 "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.scan-footer p span { color: var(--cyan); }
.scan-footer > div { display: flex; gap: 8px; }
.scan-secondary, .scan-primary { height: 37px; padding: 0 14px; border: 1px solid #30434a; border-radius: 12px; cursor: pointer; font: 600 8px "Inter", sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.scan-secondary { color: #84969a; background: transparent; }
.scan-primary { min-width: 155px; display: flex; align-items: center; justify-content: space-between; color: #111a13; border-color: var(--lime); background: var(--lime); }
.scan-primary:hover { filter: brightness(1.06); }
.scan-primary .scan-arrow { font-size: 14px; }

@media (max-width: 1000px) {
  :root { --sidebar-width: 320px; }
  .topbar-center { display: none; }
  .topbar { grid-template-columns: var(--sidebar-width) 1fr; }
  .top-actions { justify-self: end; }
  .ghost-button { font-size: 0; width: 38px; justify-content: center; padding: 0; }
  .route-detail { width: min(355px, calc(100% - 110px)); }
  .scan-card { max-height: calc(100vh - 24px); }
  .scan-body { grid-template-columns: minmax(0, .9fr) minmax(380px, 1.1fr); }
}

@media (max-width: 720px) {
  body { overflow: auto; }
  .app-shell { min-height: 100vh; height: auto; }
  .topbar { position: sticky; top: 0; grid-template-columns: 1fr auto; }
  .brand { border-right: 0; padding-left: 18px; }
  main { height: auto; display: flex; flex-direction: column; }
  .sidebar { height: 390px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading { padding: 20px 20px 13px; }
  .sidebar-heading h1 { font-size: 26px; }
  .sidebar-heading > p:last-child { display: none; }
  .search-box { margin: 0 20px 10px; }
  .filter-row { padding: 0 20px 12px; }
  .route-card { padding-left: 20px; }
  .route-actions { opacity: 1; visibility: visible; transform: none; }
  .card-arrow { display: none; }
  .sidebar-footer { display: none; }
  .map-panel { height: 650px; }
  .stage-legend { display: none; }
  .route-detail { right: 12px; left: 64px; bottom: 12px; width: auto; }
  .map-controls { left: 12px; bottom: 12px; }
  .map-tip { display: none; }
  .scan-modal { padding: 0; }
  .scan-card { width: 100%; height: 100vh; max-height: none; border: 0; }
  .scan-body { display: block; overflow: auto; }
  .scan-visual-column { border-right: 0; border-bottom: 1px solid #26383e; }
  .scan-form-column { overflow: visible; }
  .scan-footer { align-items: stretch; flex-direction: column; }
  .scan-footer > div { justify-content: flex-end; }
  .scan-footer p { max-width: none; }
}
