:root {
  --bg: #07111d;
  --panel: rgba(11, 22, 35, 0.94);
  --panel-2: rgba(15, 31, 48, 0.90);
  --line: rgba(93, 188, 220, 0.24);
  --text: #e8f5fb;
  --muted: #89a7b7;
  --accent: #44c1e6;
  --green: #77d69a;
  --warn: #f0bd68;
  --danger: #ec6571;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  background:
    radial-gradient(900px 500px at 30% -20%, rgba(68, 193, 230, 0.20), transparent 62%),
    linear-gradient(145deg, #06101b, #0c2234 58%, #143447);
}

.planner-panel {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(6, 14, 24, 0.98), rgba(9, 24, 39, 0.95));
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto auto auto auto 1fr;
  gap: 8px;
  min-height: 0;
}

.brand-row,
.top-bar,
.map-toolbar,
.button-row,
.control-pair,
.telemetry-strip,
.mode-stack {
  display: flex;
  align-items: center;
}

.brand-ident {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid rgba(93, 188, 220, 0.42);
  background: rgba(4, 11, 19, 0.82);
  object-fit: cover;
  flex-shrink: 0;
}

.brand-row {
  justify-content: space-between;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 25, 40, 0.72);
}

.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

h1 {
  margin: 1px 0 0;
  font-size: 20px;
  line-height: 1;
}

.sim-badge,
.state-chip,
.mini-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(68, 193, 230, 0.10);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.panel-section,
.rail-card,
.metric-card,
.map-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.panel-section {
  padding: 8px;
  display: grid;
  gap: 6px;
}

.section-title,
.rail-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

input[type="text"],
select {
  width: 100%;
  min-height: 28px;
  border: 1px solid rgba(93, 188, 220, 0.28);
  border-radius: 7px;
  padding: 4px 8px;
  background: rgba(4, 12, 21, 0.70);
  color: var(--text);
  outline: none;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.inline-value {
  float: right;
  color: var(--text);
  font-size: 11px;
}

.hint-line {
  color: #86a9b8;
  font-size: 10px;
  line-height: 1.25;
}

.hidden {
  display: none !important;
}

.compact-grid {
  grid-template-columns: 1fr 1fr;
  column-gap: 9px;
  row-gap: 6px;
}

.compact-grid.no-count {
  grid-template-columns: 1fr;
}

.route-section,
.controls-section {
  align-self: start;
}

.button-row {
  gap: 7px;
}

.button-row button,
.map-actions button {
  flex: 1;
  min-height: 29px;
  border: 1px solid rgba(93, 188, 220, 0.34);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(46, 142, 168, 0.92), rgba(26, 88, 116, 0.92));
  color: #ecfbff;
  font-weight: 800;
  cursor: pointer;
}

.button-row button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.vehicle-tools button {
  min-height: 27px;
}

.ghost-button,
.map-actions button {
  background: rgba(6, 18, 30, 0.80) !important;
}

.ghost-button.active {
  color: #06111d;
  background: var(--warn) !important;
  border-color: rgba(240, 189, 104, 0.8);
}

.control-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mission-console {
  min-width: 0;
  min-height: 0;
  padding: 8px;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  gap: 8px;
}

.top-bar {
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 18, 30, 0.82);
}

.state-chip.running {
  color: var(--green);
}

.state-chip.stopped {
  color: var(--warn);
}

.mode-stack {
  gap: 6px;
  min-width: 0;
}

.mini-chip {
  color: #a9c6d3;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-strip {
  gap: 7px;
}

.telemetry-strip div {
  min-width: 82px;
  padding: 4px 8px;
  border: 1px solid rgba(93, 188, 220, 0.18);
  border-radius: 8px;
  background: rgba(6, 17, 29, 0.72);
}

.telemetry-strip span,
.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.telemetry-strip strong,
.metric-card strong {
  color: var(--text);
  font-size: 14px;
}

.workspace-grid {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 8px;
}

.map-card {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr) 5px;
  overflow: hidden;
}

.map-toolbar {
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 29, 0.80);
}

.map-toolbar strong {
  display: block;
  font-size: 12px;
}

.map-toolbar span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 720px;
}

.map-actions {
  display: flex;
  gap: 6px;
}

.map-actions button {
  min-width: 86px;
  font-size: 11px;
}

#map {
  min-height: 0;
  background: #07111d;
}

.timeline-bar {
  background: rgba(255, 255, 255, 0.07);
}

#timelineFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.right-rail {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 78px minmax(0, 1fr) minmax(96px, 118px);
  gap: 8px;
}

.right-rail > * {
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric-card {
  padding: 8px;
}

.rail-card {
  min-height: 0;
  overflow: hidden;
  padding: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
}

.vehicle-list,
.event-log {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(93, 188, 220, 0.35) transparent;
}

.vehicle-row {
  display: grid;
  grid-template-columns: 54px 1fr 48px;
  align-items: center;
  gap: 7px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(93, 188, 220, 0.10);
  font-size: 11px;
}

.vehicle-row strong {
  font-size: 11px;
}

.vehicle-row span {
  color: var(--muted);
  font-size: 10px;
}

.battery-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}

.battery-bar div {
  height: 100%;
  background: var(--green);
}

.event-log {
  color: #93b2c0;
  font-family: "IBM Plex Mono", "Cascadia Mono", monospace;
  font-size: 10px;
  line-height: 1.35;
}

.event-line {
  padding: 2px 0;
  border-bottom: 1px solid rgba(93, 188, 220, 0.08);
}

.leaflet-trail-pane {
  z-index: 420;
}

.leaflet-waypoint-pane {
  z-index: 610;
}

.leaflet-vehicle-pane {
  z-index: 690;
}

.boat-icon {
  background: transparent;
  border: 0;
  z-index: 690 !important;
}

.boat-wrap {
  width: 28px;
  height: 28px;
  transform-origin: 50% 50%;
}

.boat-hull {
  width: 12px;
  height: 24px;
  margin: 2px auto;
  clip-path: polygon(50% 0%, 92% 30%, 76% 100%, 50% 82%, 24% 100%, 8% 30%);
  border: 1px solid rgba(238, 250, 255, 0.92);
  background: var(--accent);
  box-shadow: 0 0 12px rgba(68, 193, 230, 0.56);
}

.waypoint-label {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: var(--warn);
  color: #0b1520;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  z-index: 610;
}

.leaflet-control-attribution {
  display: none;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 285px;
  }
}
