/* Kestrel Planning Studio — Phase 1 interaction demo
   Plain CSS, no framework, no external assets. */

:root {
  --bg: #0a0f15;
  --panel: #101821;
  --panel-2: #141f2a;
  --panel-3: #1a2733;
  --line: #1f2d3b;
  --line-2: #2a3b4d;
  --text: #dce7f1;
  --muted: #8fa2b6;
  --dim: #62788c;
  --accent: #58a6ff;
  --accent-2: #7cc0ff;
  --accent-soft: rgba(88, 166, 255, .12);
  --pass: #3ddc97;
  --pass-soft: rgba(61, 220, 151, .12);
  --warn: #ffc857;
  --warn-soft: rgba(255, 200, 87, .12);
  --conflict: #ff6b6b;
  --conflict-soft: rgba(255, 107, 107, .13);
  --unknown: #b394ff;
  --unknown-soft: rgba(179, 148, 255, .13);
  --planned: #58a6ff;
  --unplanned: #7d8fa1;
  --radius: 7px;
  --radius-sm: 4px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 12px 32px rgba(0, 0, 0, .48);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  min-width: 1120px;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.42 var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(88, 166, 255, .32); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------------- top bar ---------------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  height: 54px; flex: 0 0 54px;
  padding: 0 14px;
  background: linear-gradient(180deg, #121b25, #0e151d);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 0 0 auto; }
.logo { width: 26px; height: 26px; color: var(--accent); }
.brand-text { display: flex; align-items: baseline; gap: 7px; letter-spacing: .2px; }
.brand-text strong { font-size: 15px; font-weight: 650; }
.brand-text span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }

.day-chip { display: flex; align-items: center; gap: 9px; padding-left: 16px; border-left: 1px solid var(--line); }
.day-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 200, 87, .14); }
.day-chip b { display: block; font-weight: 600; font-size: 12.5px; }
.day-chip em { display: block; font-style: normal; font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }

.top-stats { display: flex; gap: 18px; margin-left: 4px; flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; }
.top-stat { display: flex; align-items: baseline; gap: 6px; font-size: 11.5px; color: var(--muted); }
.top-stat b { font-size: 13px; font-family: var(--mono); color: var(--text); font-weight: 600; }
.top-stat.danger b { color: var(--conflict); }
.top-stat.unknown b { color: var(--unknown); }
.top-stat.good b { color: var(--pass); }

.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text);
  font-size: 12px; font-weight: 550; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: #3a5164; }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 650; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--conflict); border-color: rgba(255, 107, 107, .4); background: transparent; }
.btn.danger:hover:not(:disabled) { background: var(--conflict-soft); }
.btn.tiny { height: 24px; padding: 0 8px; font-size: 11px; }
.btn.icon { width: 30px; padding: 0; font-weight: 700; }
.btn kbd { font-size: 10px; opacity: .6; }

.menu-wrap { position: relative; }
.menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  width: 340px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.menu-pop .mp-head { padding: 7px 9px 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .11em; color: var(--dim); }
.menu-pop button.mp-item {
  display: flex; width: 100%; gap: 9px; align-items: flex-start; text-align: left;
  padding: 8px 9px; border: 0; border-radius: var(--radius-sm); background: transparent;
}
.menu-pop button.mp-item:hover { background: var(--panel-3); }
.menu-pop button.mp-item.active { background: var(--accent-soft); }
.menu-pop .mp-id { font-family: var(--mono); font-size: 10.5px; color: var(--accent); padding-top: 1px; }
.menu-pop .mp-body b { display: block; font-size: 12px; font-weight: 600; }
.menu-pop .mp-body span { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.menu-pop .mp-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* ---------------- task banner ---------------- */
.task-banner {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(88, 166, 255, .13), rgba(88, 166, 255, .04) 60%, transparent);
  border-bottom: 1px solid var(--line);
}
.task-banner .tb-id { font-family: var(--mono); font-size: 11px; color: var(--accent); border: 1px solid rgba(88, 166, 255, .35); padding: 2px 6px; border-radius: 3px; }
.task-banner .tb-title { font-weight: 600; font-size: 12.5px; }
.task-banner .tb-steps { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; }
.task-banner .tb-steps b { color: var(--text); font-weight: 550; }
.task-banner .tb-actions { display: flex; gap: 6px; }

/* ---------------- grid ---------------- */
.grid {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 402px minmax(0, 1fr) 566px;
  gap: 8px; padding: 8px;
}
.panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 38px; flex: 0 0 38px; padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.head-title { display: flex; align-items: baseline; gap: 7px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .11em; color: var(--muted); }
.head-title .count { font-family: var(--mono); font-size: 10.5px; color: var(--dim); text-transform: none; letter-spacing: 0; }
.head-tools { display: flex; align-items: center; gap: 6px; }

/* ---------------- demand ---------------- */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 8px; width: 14px; height: 14px; color: var(--dim); pointer-events: none; }
.search-wrap input {
  width: 214px; height: 26px; padding: 0 26px 0 27px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 12px; outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap kbd { position: absolute; right: 7px; font-family: var(--mono); font-size: 10px; color: var(--dim); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 8px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: transparent; color: var(--muted);
  font-size: 11px; font-weight: 500;
}
.chip:hover { border-color: #3a5164; color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: rgba(88, 166, 255, .5); color: var(--accent-2); }
.chip .n { font-family: var(--mono); font-size: 10px; opacity: .75; }
.chip.unknown.on { background: var(--unknown-soft); border-color: rgba(179, 148, 255, .5); color: var(--unknown); }
.chip.cold.on { background: rgba(120, 200, 255, .12); border-color: rgba(120, 200, 255, .5); color: #9fd8ff; }
.chip.danger.on { background: var(--conflict-soft); border-color: rgba(255, 107, 107, .5); color: var(--conflict); }
.chip.clear { border-style: dashed; }

.list-head, .demand-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1.05fr) minmax(0, .7fr) 106px 36px 70px;
  align-items: center; gap: 6px;
}
.list-head {
  padding: 0 10px; height: 26px; flex: 0 0 26px;
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim);
  border-bottom: 1px solid var(--line);
}
.list-head .num { text-align: right; }
.demand-list { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; outline: none; }
.demand-row {
  position: relative;
  height: 46px; padding: 0 10px 0 8px;
  border-bottom: 1px solid rgba(31, 45, 59, .65);
  cursor: pointer;
  contain: layout style;
}
.demand-row:hover { background: var(--panel-2); }
.demand-row.sel { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.demand-row.focus { background: rgba(88, 166, 255, .07); }
.demand-row.dim { opacity: .5; }
.demand-row .cell { min-width: 0; }
.demand-row .sid { display: flex; align-items: center; gap: 5px; }
.demand-row .sid b { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: -.15px; }
.demand-row .sub { display: block; font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.demand-row .lane { font-size: 10px; color: var(--muted); line-height: 1.3; }
.demand-row .lane span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demand-row .lane span + span::before { content: "→ "; color: var(--dim); }
.demand-row .win { font-family: var(--mono); font-size: 9px; color: var(--muted); line-height: 1.4; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; }
.demand-row .win .later { color: var(--warn); }
.demand-row .cap { text-align: right; font-family: var(--mono); font-size: 11px; }
.demand-row .cap.unk { color: var(--unknown); }
.demand-row .cap .u { font-size: 9px; color: var(--dim); display: block; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px; border-radius: 9px;
  font-size: 9.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.pill.planned { background: rgba(88, 166, 255, .14); color: var(--accent-2); }
.pill.partial { background: var(--warn-soft); color: var(--warn); }
.pill.unplanned { background: rgba(125, 143, 161, .14); color: #9fb0c0; }
.pill.unknown { background: var(--unknown-soft); color: var(--unknown); }
.pill.cold { background: rgba(120, 200, 255, .13); color: #9fd8ff; }
.pill.conflict { background: var(--conflict-soft); color: var(--conflict); }
.pill.pass { background: var(--pass-soft); color: var(--pass); }
.pill.na { background: var(--warn-soft); color: var(--warn); }
.pill.draft { background: rgba(255, 200, 87, .16); color: var(--warn); }
.tick {
  width: 14px; height: 14px; border: 1px solid var(--line-2); border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 9px; color: transparent;
}
.demand-row.sel .tick { background: var(--accent); border-color: var(--accent); color: #06121f; }

.selection-bar {
  flex: 0 0 auto; min-height: 0;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  padding: 0 10px;
}
.selection-bar:empty { display: none; }
.sel-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.sel-row .sel-count { font-size: 12px; font-weight: 600; }
.sel-row .sel-sum { font-size: 11px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-actions { display: flex; gap: 6px; }
.hidden-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--warn);
  padding: 6px 0 8px; border-top: 1px dashed rgba(255, 200, 87, .3);
}
.hidden-note button { margin-left: auto; }
.empty-list { padding: 28px 16px; text-align: center; color: var(--dim); font-size: 12px; }

/* ---------------- center: map ---------------- */
.center { display: flex; flex-direction: column; min-height: 0; gap: 0; }
.map-panel { flex: 1 1 auto; min-height: 160px; }
.map-tools { display: flex; align-items: center; gap: 6px; }
.toggle {
  height: 23px; padding: 0 8px; border-radius: 12px;
  border: 1px solid var(--line-2); background: transparent; color: var(--dim); font-size: 10.5px;
}
.toggle.on { color: var(--accent-2); border-color: rgba(88, 166, 255, .45); background: var(--accent-soft); }
.map-zoom { display: flex; gap: 2px; margin-left: 4px; }
.map-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; background: radial-gradient(120% 90% at 40% 0%, #0f1a24 0%, #0b131b 60%, #090f15 100%); }
.map { flex: 1 1 auto; min-width: 0; height: 100%; display: block; cursor: grab; }

/* hub rail */
.hub-rail {
  flex: 0 0 268px; min-height: 0; overflow-y: auto;
  border-left: 1px solid var(--line);
  background: rgba(13, 20, 27, .72);
  padding: 8px 8px 10px;
}
.hub-rail h4 { margin: 2px 4px 7px; font-size: 9.5px; text-transform: uppercase; letter-spacing: .11em; color: var(--dim); font-weight: 600; }
.hub-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  width: 100%; padding: 5px 6px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; text-align: left;
}
.hub-row:hover { background: var(--panel-2); border-color: var(--line); }
.hub-row.on { background: var(--accent-soft); border-color: rgba(88, 166, 255, .4); }
.hub-row .hn { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-row .hc { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.hub-row .hbar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.hub-row .hbar i { display: block; height: 100%; background: linear-gradient(90deg, #58a6ff, #3ddc97); }
.hub-row .hsub { grid-column: 1 / -1; font-size: 9.5px; color: var(--dim); }
.hub-foot { margin: 8px 4px 0; font-size: 9.5px; color: var(--dim); line-height: 1.45; }
.map.dragging { cursor: grabbing; }
.map .grid-line { stroke: rgba(46, 66, 85, .35); stroke-width: 1; }
.map .hub-halo { fill: rgba(88, 166, 255, .07); stroke: rgba(88, 166, 255, .28); }
.map .site-dot { fill: #24384a; stroke: #3d566c; stroke-width: 1.2; transition: fill .12s; }
.map .site-dot.hot { fill: #2e4a62; stroke: var(--accent); }
.map .site-dot.sel { fill: var(--accent); stroke: #d9ecff; }
.map .site-label { fill: #7e93a6; font-size: 9.5px; font-family: var(--sans); pointer-events: none; }
.map .site-label.major { fill: #a9bece; font-size: 10.5px; font-weight: 600; }
.map .site-count { fill: #bcd0e0; font-family: var(--mono); font-size: 9px; pointer-events: none; }
.map .route { fill: none; stroke-width: 1.6; opacity: .55; }
.map .route.sel { stroke-width: 2.6; opacity: .95; }
.map .route.conflict { stroke-dasharray: 5 4; }
.map .route-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.map .sel-arc { fill: none; stroke: var(--warn); stroke-width: 2; stroke-dasharray: 6 4; }
.map .arc-arrow { fill: var(--warn); }
.map .action-tick { stroke: var(--warn); stroke-width: 1.6; }
.map .sweep { fill: rgba(88, 166, 255, .05); }
.map-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 12px; pointer-events: none; }
.map-legend {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; flex-direction: column; gap: 3px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  background: rgba(10, 16, 22, .82); border: 1px solid var(--line);
  font-size: 10px; color: var(--muted); pointer-events: none;
}
.map-legend .lg-row { display: flex; align-items: center; gap: 6px; }
.map-legend i { width: 14px; height: 2px; display: inline-block; border-radius: 1px; }
.map-legend i.dot { width: 7px; height: 7px; border-radius: 50%; }
.map-pop {
  position: absolute; z-index: 30; width: 300px; max-height: 340px;
  display: flex; flex-direction: column;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.map-pop header { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.map-pop header b { font-size: 12px; display: block; }
.map-pop header span { font-size: 10.5px; color: var(--muted); }
.map-pop header .x { margin-left: auto; background: none; border: 0; color: var(--dim); font-size: 14px; line-height: 1; padding: 0 2px; }
.map-pop ul { list-style: none; margin: 0; padding: 4px; overflow-y: auto; }
.map-pop li button {
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  padding: 5px 6px; border: 0; border-radius: 3px; background: none; font-size: 11px;
}
.map-pop li button:hover { background: var(--panel-3); }
.map-pop li .mid { flex: 1; font-family: var(--mono); }
.map-pop li .mroute { color: var(--dim); font-size: 10px; }
.map-pop footer { padding: 6px 8px; border-top: 1px solid var(--line); font-size: 10px; color: var(--dim); }

.splitter {
  flex: 0 0 7px; position: relative; cursor: row-resize;
}
.splitter::after {
  content: ""; position: absolute; left: 50%; top: 3px; width: 46px; height: 2px; margin-left: -23px;
  border-radius: 2px; background: var(--line-2);
}
.splitter:hover::after { background: var(--accent); }

/* ---------------- timeline ---------------- */
.timeline-panel { flex: 0 0 auto; height: 470px; }
.tl-tools { display: flex; align-items: center; gap: 12px; }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { height: 24px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-family: var(--mono); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent-2); }
.tl-key { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--dim); }
.tl-key i { width: 12px; height: 7px; border-radius: 2px; display: inline-block; }
.tl-key .k-band { background: rgba(88, 166, 255, .18); border: 1px solid rgba(88, 166, 255, .5); }
.tl-key .k-service { background: rgba(61, 220, 151, .5); }
.tl-key .k-late { background: rgba(255, 107, 107, .55); }
.timeline { flex: 1 1 auto; overflow: auto; position: relative; }
.tl-inner { position: relative; min-width: 100%; }
.tl-axis { position: sticky; top: 0; z-index: 5; height: 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tl-axis span { position: absolute; top: 5px; font-family: var(--mono); font-size: 9.5px; color: var(--dim); transform: translateX(-50%); }
.tl-grid { position: absolute; top: 22px; bottom: 0; width: 1px; background: rgba(31, 45, 59, .75); }
.tl-lane { position: relative; height: 44px; border-bottom: 1px solid rgba(31, 45, 59, .7); }
.tl-lane:hover { background: rgba(20, 31, 42, .55); }
.tl-lane.sel { background: var(--accent-soft); }
.tl-lane-name {
  position: sticky; left: 0; z-index: 4;
  display: inline-flex; align-items: center; gap: 6px;
  height: 100%; width: 118px; padding: 0 8px;
  background: linear-gradient(90deg, var(--panel) 82%, rgba(16, 24, 33, 0));
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
.tl-lane-name .dot { width: 6px; height: 6px; border-radius: 50%; }
.tl-lane-name .st { font-family: var(--sans); font-size: 9px; }
.tl-band { position: absolute; top: 7px; height: 4px; border-radius: 3px; background: rgba(88, 166, 255, .13); border: 1px solid rgba(88, 166, 255, .32); }
.tl-band.conflict { background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .42); }
.tl-block {
  position: absolute; top: 16px; height: 22px; border-radius: 3px;
  background: rgba(61, 220, 151, .3); border: 1px solid rgba(61, 220, 151, .55);
  font-family: var(--mono); font-size: 9px; color: #d7ffee;
  padding: 0 4px; line-height: 20px; overflow: hidden; white-space: nowrap;
  cursor: pointer;
}
.tl-block.unload { background: rgba(88, 166, 255, .26); border-color: rgba(88, 166, 255, .55); color: #e3f1ff; }
.tl-block.hook { background: rgba(179, 148, 255, .28); border-color: rgba(179, 148, 255, .55); color: #efe7ff; }
.tl-block.late { background: rgba(255, 107, 107, .34); border-color: var(--conflict); }
.tl-block.sel { outline: 1.5px solid var(--warn); outline-offset: 1px; z-index: 3; }
.tl-block .bl { pointer-events: none; }
.tl-travel { position: absolute; top: 26px; height: 2px; background: rgba(143, 162, 182, .35); }
.tl-wait { position: absolute; top: 25px; height: 4px; background: repeating-linear-gradient(90deg, rgba(255, 200, 87, .55) 0 3px, transparent 3px 6px); }
.tl-cont { position: absolute; right: 6px; top: 18px; font-size: 9px; color: var(--warn); }
.tl-empty { padding: 20px; color: var(--dim); font-size: 12px; }

/* ---------------- trips panel ---------------- */
.trip-chips { display: flex; gap: 5px; overflow-x: auto; padding: 7px 9px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.trip-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border-radius: 13px;
  border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  font-family: var(--mono); font-size: 10.5px; white-space: nowrap;
}
.trip-chip .ci { width: 6px; height: 6px; border-radius: 50%; }
.trip-chip.on { background: var(--panel-3); color: var(--text); border-color: #3d566c; }
.trip-chip.draft { border-style: dashed; }
.trip-detail { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.trip-footer { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--panel-2); }

.tr-head { padding: 10px 11px 8px; border-bottom: 1px solid var(--line); }
.tr-title { display: flex; align-items: center; gap: 8px; }
.tr-title h2 { margin: 0; font-size: 14px; font-weight: 650; font-family: var(--mono); letter-spacing: -.2px; }
.tr-title .grow { flex: 1; }
.tr-sub { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.tr-sub .sep { color: var(--line-2); }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.res-field label { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--dim); margin-bottom: 3px; }
.res-field select {
  width: 100%; height: 27px; padding: 0 5px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 11px; outline: none;
}
.res-field select:focus { border-color: var(--accent); }
.res-field select.unset { color: var(--warn); border-style: dashed; }
.res-note { padding: 0 11px 8px; font-size: 10px; color: var(--dim); }
.start-row { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-bottom: 1px solid var(--line); }
.start-row .lbl { font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--dim); white-space: nowrap; }
.start-row .stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.start-row .stepper button { width: 24px; height: 26px; border: 0; background: var(--bg); color: var(--muted); font-size: 13px; }
.start-row .stepper button:hover { background: var(--panel-3); color: var(--text); }
.start-row .stepper .val { min-width: 122px; text-align: center; font-family: var(--mono); font-size: 10.5px; padding: 0 6px; white-space: nowrap; letter-spacing: -.2px; }
.start-row .hint { font-size: 10px; color: var(--dim); margin-left: auto; }
@media (max-width: 1600px) { .start-row .hint { display: none; } .start-row { flex-wrap: wrap; } }
.actions-head { display: flex; align-items: center; gap: 6px; padding: 8px 11px 4px; }
.actions-head h3 { margin: 0; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
.actions-head .grow { flex: 1; }
.act-list { padding: 2px 7px 8px; }
.act-row {
  display: grid; grid-template-columns: 18px 52px minmax(0, 1fr) 96px 30px;
  align-items: center; gap: 6px;
  min-height: 44px; padding: 3px 4px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 11px;
}
.act-row:hover { background: var(--panel-2); }
.act-row.sel { background: var(--accent-soft); border-color: rgba(88, 166, 255, .35); }
.act-row.late { background: var(--conflict-soft); }
.act-row .seq { font-family: var(--mono); font-size: 9.5px; color: var(--dim); text-align: center; }
.act-row .type { font-size: 9.5px; font-weight: 650; letter-spacing: .04em; }
.act-row .type.load { color: var(--pass); }
.act-row .type.unload { color: var(--accent-2); }
.act-row .type.hook { color: var(--unknown); }
.act-row .who { min-width: 0; }
.act-row .who b { font-family: var(--mono); font-size: 10.5px; font-weight: 600; display: block; }
.act-row .who span { font-size: 9.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.act-row .timing { font-family: var(--mono); font-size: 10px; color: var(--muted); line-height: 1.3; text-align: right; }
.act-row .shift { display: inline-flex; gap: 2px; justify-content: flex-end; margin-top: 2px; }
.act-row .shift button { height: 16px; padding: 0 3px; font-family: var(--sans); font-size: 8.5px; color: var(--dim); border: 1px solid var(--line-2); background: transparent; border-radius: 2px; }
.act-row .shift button:hover { color: var(--text); border-color: #3d566c; background: var(--panel-3); }
.act-row .timing .lt { color: var(--conflict); }
.act-row .timing .wt { color: var(--warn); }
.act-row .move { display: flex; gap: 1px; justify-content: flex-end; }
.act-row .move button { width: 15px; height: 20px; padding: 0; border: 1px solid var(--line-2); background: transparent; color: var(--dim); border-radius: 3px; font-size: 9px; line-height: 1; }
.act-row .move button:hover:not(:disabled) { color: var(--text); border-color: #3d566c; }
.act-row .move button:disabled { opacity: .25; cursor: not-allowed; }
.act-empty { padding: 18px 12px; color: var(--dim); font-size: 11.5px; text-align: center; }

.checks { padding: 6px 9px 8px; border-top: 1px solid var(--line); }
.checks-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 6px; }
.checks-head h3 { margin: 0; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
.checks-head .grow { flex: 1; }
.chk { display: flex; gap: 7px; padding: 5px 3px; border-top: 1px dashed rgba(31, 45, 59, .9); }
.chk:first-of-type { border-top: 0; }
.chk .ico { width: 13px; height: 13px; border-radius: 50%; flex: 0 0 13px; margin-top: 2px; display: inline-flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 800; }
.chk.pass .ico { background: var(--pass-soft); color: var(--pass); border: 1px solid rgba(61, 220, 151, .5); }
.chk.conflict .ico { background: var(--conflict-soft); color: var(--conflict); border: 1px solid rgba(255, 107, 107, .55); }
.chk.na .ico { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(255, 200, 87, .5); }
.chk .body { min-width: 0; }
.chk .body b { font-size: 11px; font-weight: 600; }
.chk .body b .tag { font-weight: 500; font-size: 9.5px; color: var(--dim); margin-left: 4px; }
.chk .body p { margin: 1px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.peak-bar { display: flex; align-items: center; gap: 6px; padding: 4px 3px 2px; font-size: 10px; color: var(--muted); }
.peak-bar .track { flex: 1; height: 5px; background: var(--panel-3); border-radius: 3px; overflow: hidden; position: relative; }
.peak-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #3ddc97, #58a6ff); }
.peak-bar .fill.over { background: linear-gradient(90deg, #ffc857, #ff6b6b); }
.peak-bar .fill.unk { background: repeating-linear-gradient(90deg, rgba(179, 148, 255, .7) 0 4px, transparent 4px 8px); }
.peak-bar .val { font-family: var(--mono); font-size: 10px; }

.trip-footer .tf-row { display: flex; align-items: center; gap: 7px; padding: 8px 10px; }
.trip-footer .tf-row .grow { flex: 1; }
.trip-footer .tf-note { font-size: 10px; color: var(--dim); padding: 0 10px 8px; line-height: 1.35; }
.trip-footer .tf-note.warn { color: var(--warn); }
.draft-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: rgba(255, 200, 87, .08); border-bottom: 1px solid rgba(255, 200, 87, .22); font-size: 11px; }
.draft-bar b { color: var(--warn); }
.draft-bar .grow { flex: 1; }
.empty-trip { padding: 26px 16px; text-align: center; color: var(--dim); font-size: 12px; }
.empty-trip b { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }

/* ---------------- status bar ---------------- */
.statusbar {
  flex: 0 0 26px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; border-top: 1px solid var(--line);
  background: #0c131a; color: var(--dim); font-size: 10.5px;
}
.status-left { display: flex; gap: 14px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1 1 auto; }
.status-left .keys { flex: 0 1 auto; overflow: hidden; }
@media (max-width: 2100px) { .status-left .keys { display: none; } }
.status-left b { color: var(--muted); font-weight: 600; }
.status-left .keys { display: flex; gap: 10px; }
.status-left kbd { font-family: var(--mono); font-size: 9.5px; border: 1px solid var(--line-2); border-radius: 3px; padding: 0 3px; color: var(--muted); }
.status-right { display: flex; align-items: center; gap: 10px; }
.sim-badge { border: 1px dashed rgba(255, 200, 87, .4); color: var(--warn); padding: 1px 6px; border-radius: 3px; font-size: 9.5px; }
#clock { font-family: var(--mono); }

/* ---------------- modal ---------------- */
.modal-root:empty { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 8, 12, .62);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  width: min(920px, 92vw); max-height: 82vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px;
  box-shadow: var(--shadow);
}
.modal header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 14px; font-weight: 650; }
.modal header .grow { flex: 1; }
.modal .body { padding: 14px 16px; overflow-y: auto; font-size: 12.5px; line-height: 1.5; }
.modal footer { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.modal footer .grow { flex: 1; }
.diff-block { margin-bottom: 12px; }
.diff-block h3 { margin: 0 0 5px; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.diff-block ul { margin: 0; padding-left: 16px; font-size: 11.5px; color: var(--muted); }
.diff-block li { margin: 2px 0; }
.diff-block li b { color: var(--text); font-weight: 600; }
.diff-trip { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 8px; background: var(--panel-2); }
.diff-trip .dt-head { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.diff-trip .dt-head b { font-family: var(--mono); }
.diff-trip ul { margin: 5px 0 0; padding-left: 16px; }
.diff-trip ul li { font-size: 11.8px; }
.diff-trip .order { font-family: var(--mono); font-size: 11px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 7px; margin-top: 6px; line-height: 1.5; }
.diff-none { color: var(--pass); font-size: 12px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; font-size: 11.5px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; color: var(--text); }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.help-cols h3 { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin: 0 0 6px; }
.help-cols p, .help-cols li { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.help-cols ul { margin: 0; padding-left: 16px; }
.sc {
  display: inline-block; min-width: 18px; text-align: center;
  font-family: var(--mono); font-size: 10px; color: var(--text);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; margin-right: 4px;
}
.legend-list { display: flex; flex-direction: column; gap: 6px; }
.legend-list .ll { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); }
.legend-list .ll b { color: var(--text); font-weight: 600; min-width: 118px; }

/* ---------------- toast ---------------- */
.toast-root { position: fixed; right: 18px; bottom: 104px; z-index: 200; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }
.toast {
  max-width: 420px; padding: 9px 12px; border-radius: var(--radius);
  background: #1b2733; border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font-size: 11.5px; color: var(--text); animation: toastIn .16s ease-out;
}
.toast.warn { border-color: rgba(255, 200, 87, .45); }
.toast.error { border-color: rgba(255, 107, 107, .5); }
.toast b { font-weight: 650; }
@keyframes toastIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #24313f; border-radius: 5px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: #31465a; }

/* tighter screens (real 2560×1440 browser with chrome, or 1920) */
@media (max-width: 2200px) {
  .grid { grid-template-columns: 366px minmax(0, 1fr) 520px; }
  .top-stats { gap: 13px; }
  .top-stat.optional { display: none; }
  .brand-text span { display: none; }
}
@media (max-width: 1780px) {
  .grid { grid-template-columns: 340px minmax(0, 1fr) 490px; }
  .top-stats .top-stat.optional { display: none; }
  .tl-key { display: none; }
}

/* compact fallback below the review viewport: drop the windows column and the hub rail */
@media (max-width: 1600px) {
  .grid { grid-template-columns: 306px minmax(0, 1fr) 440px; }
  .hub-rail { display: none; }
  .list-head, .demand-row { grid-template-columns: 16px minmax(0, 1.5fr) minmax(0, .9fr) 34px 60px; }
  .list-head span:nth-child(4), .demand-row .cell:nth-child(4) { display: none; }
  .timeline-panel { height: 356px; }
  .tl-lane { height: 40px; }
  .tl-lane.demand { height: 34px; }
  .head-tools .search-wrap input { width: 132px; }
  .brand-text span { display: none; }
}
@media (max-width: 1380px) {
  .grid { grid-template-columns: 276px minmax(0, 1fr) 410px; }
  .demand-row .cap .u { display: none; }
}

@media (max-height: 900px) {
  .timeline-panel { height: 320px; }
  .demand-row { height: 42px; }
}

/* timeline: selected demand lanes + divider */
.tl-divider {
  position: sticky; left: 0; display: inline-block;
  padding: 3px 10px; width: 100%;
  font-size: 9px; text-transform: uppercase; letter-spacing: .11em; color: var(--dim);
  background: rgba(20, 31, 42, .9); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.tl-lane.demand { height: 38px; background: rgba(255, 200, 87, .025); }
.tl-lane.demand .tl-lane-name { width: 118px; color: var(--muted); }
.tl-band.load { background: rgba(61, 220, 151, .16); border-color: rgba(61, 220, 151, .45); }
.tl-band.unload { background: rgba(179, 148, 255, .16); border-color: rgba(179, 148, 255, .45); }

/* map focus card */
.map-focus {
  position: absolute; left: 12px; bottom: 58px; width: 318px; z-index: 6;
  background: rgba(18, 27, 36, .94); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 9px 10px 8px;
}
.map-focus .mf-head { display: flex; align-items: center; gap: 7px; }
.map-focus .mf-head b { font-family: var(--mono); font-size: 12.5px; }
.map-focus .mf-head .grow { flex: 1; }
.map-focus dl { display: grid; grid-template-columns: 62px 1fr; gap: 2px 8px; margin: 7px 0 6px; font-size: 10.5px; }
.map-focus dt { color: var(--dim); }
.map-focus dd { margin: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-focus .mf-foot { display: flex; gap: 5px; border-top: 1px solid var(--line); padding-top: 6px; }
.map-focus .mf-goods { font-size: 10px; color: var(--dim); margin: 0 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* timeline demand profile */
.tl-profile { position: relative; height: 34px; border-bottom: 1px solid var(--line); background: rgba(16, 24, 33, .6); }
.tl-profile .ptitle { position: sticky; left: 10px; z-index: 3; display: inline-block; padding-top: 10px; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); background: linear-gradient(90deg, var(--panel) 70%, transparent); padding-right: 8px; }
.tl-profile .pbar { position: absolute; bottom: 3px; width: 3px; background: rgba(88, 166, 255, .55); border-radius: 1px 1px 0 0; }
.tl-profile .pbar.hot { background: rgba(255, 200, 87, .7); }
.tl-profile .pbar:hover { background: var(--accent-2); }
