:root {
  --ink: #17212b;
  --muted: #62707e;
  --navy: #102638;
  --water: #b9dce7;
  --water-deep: #84bdcc;
  --land: #e8eee1;
  --reef: #d63a2f;
  --optional: #138a9e;
  --troll: #e88f25;
  --paper: #f5f7f8;
  --line: #d9e1e7;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  color: var(--white);
  background: var(--navy);
}

.eyebrow {
  margin: 0 0 5px;
  color: #bcd0dc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 31px;
  line-height: 1;
}

.topbar__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12px;
}

.topbar__meta span {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  padding: 7px 9px;
  color: #d8e7ee;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.planner-panel,
.result-panel,
.decision-card,
.schedule-card,
.intel-card,
.waypoint-card,
.why-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.planner-panel {
  align-self: start;
  padding: 18px;
}

.planner-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #31424f;
  font-size: 12px;
  font-weight: 800;
}

.location-status {
  min-height: 17px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.location-status[data-state="good"] {
  color: #16765c;
}

.location-status[data-state="warn"] {
  color: #9a5a08;
}

.location-status[data-state="bad"] {
  color: #b53029;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd7df;
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--white);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(19, 138, 158, 0.24);
  outline-offset: 2px;
}

.primary-action,
.result-actions button,
.quick-presets button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  margin-top: 4px;
  color: var(--white);
  background: var(--reef);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.7;
}

.quick-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.quick-presets button {
  min-height: 36px;
  color: #17384a;
  background: #e8f3f6;
}

.decision-card {
  padding: 14px;
}

.decision-card h2 {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 15px;
}

.decision-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.result-panel {
  min-width: 0;
  padding: 16px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.result-header h2 {
  font-size: 24px;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.result-actions button {
  padding: 0 13px;
  color: #143041;
  background: #eaf1f5;
}

.result-actions button:first-child {
  color: var(--white);
  background: var(--optional);
}

.map-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #b7cbd6;
  border-radius: 8px;
  background: var(--water);
}

#routeMap {
  display: block;
  width: 100%;
  height: 430px;
}

.leaflet-container {
  font: inherit;
  background: var(--water);
}

.leaflet-control-attribution {
  font-size: 10px;
}

.route-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 3px 9px rgba(16, 38, 56, 0.25);
}

.route-marker--launch {
  background: var(--navy);
}

.route-marker--primary {
  background: var(--reef);
}

.route-marker--optional {
  background: var(--optional);
}

.map-popup {
  display: grid;
  gap: 3px;
  min-width: 180px;
  color: var(--ink);
}

.map-popup b {
  color: var(--navy);
}

.map-popup span {
  color: var(--muted);
  font-size: 12px;
}

.map-notice {
  position: absolute;
  z-index: 500;
  top: 18px;
  left: 18px;
  max-width: min(480px, calc(100% - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  color: #17384a;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 20px rgba(16, 38, 56, 0.12);
}

.map-notice b {
  display: block;
  margin-bottom: 4px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.summary-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfd;
}

.summary-strip span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-strip strong {
  font-size: 15px;
}

.call-sheet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  gap: 12px;
}

.why-card {
  margin-bottom: 12px;
  padding: 13px 14px;
  background: #fbfcfd;
}

.why-card h3 {
  margin-bottom: 6px;
  color: var(--navy);
  font-size: 15px;
}

.why-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.schedule-card,
.intel-card,
.waypoint-card {
  padding: 14px;
}

.schedule-card h3,
.intel-card h3,
.waypoint-card h3 {
  margin-bottom: 11px;
  color: var(--navy);
  font-size: 15px;
}

.schedule-rows {
  display: grid;
  gap: 8px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 54px minmax(110px, 0.7fr) minmax(0, 1.2fr);
  gap: 9px;
  border: 1px solid #e1e7ec;
  border-radius: 7px;
  padding: 9px;
  background: #fbfcfd;
}

.schedule-row strong {
  color: var(--reef);
  font-size: 13px;
}

.schedule-row b {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.schedule-row p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.36;
}

.intel-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intel-card li {
  border-left: 4px solid var(--optional);
  padding: 0 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.38;
}

.waypoint-card {
  margin-top: 12px;
}

.waypoint-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
}

.waypoint-row {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid #e1e7ec;
  border-radius: 7px;
  padding: 8px;
  font-size: 12px;
  background: #fbfcfd;
}

.waypoint-row b {
  color: var(--reef);
}

.waypoint-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.waypoint-row small {
  color: #6b7784;
  font-size: 11px;
  font-weight: 700;
}

.map-label {
  font: 700 13px Inter, ui-sans-serif, system-ui;
}

@media (max-width: 900px) {
  .workspace,
  .call-sheet-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__meta {
    justify-content: flex-start;
  }

  .summary-strip,
  .waypoint-rows {
    grid-template-columns: 1fr;
  }

  #routeMap {
    height: 360px;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar__meta,
  .planner-panel,
  .result-actions {
    display: none;
  }

  .workspace {
    display: block;
    padding: 0;
  }

  .result-panel {
    border: 0;
  }
}
