.planner-page { height: 100vh; overflow: hidden; background: #e8efec; }
.planner-header {
  height: 68px;
  padding: 10px 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  color: #fff;
  background: var(--sea-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.planner-header .brand { color: #fff; }
.planner-header .brand-mark { color: var(--sea-dark); background: var(--foam); box-shadow: none; }
.planner-header .header-link { justify-self: end; color: #fff; }
.planner-heading { display: flex; align-items: baseline; gap: 10px; }
.planner-heading strong { font-family: Georgia, serif; font-size: 1.15rem; font-weight: 500; }
.planner-heading span { color: #a9c3c6; font-size: 0.76rem; }

.planner-layout {
  height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
}
.planner-panel {
  padding: 28px 26px 42px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 7px 0 26px rgba(9, 47, 61, 0.08);
  z-index: 2;
}
.planner-intro h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 2.45rem;
  font-weight: 500;
  letter-spacing: -0.045em;
}
.planner-intro > p:last-child { margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.safety-banner {
  margin: 22px 0;
  padding: 15px 16px;
  border-left: 4px solid var(--coral);
  border-radius: 0 10px 10px 0;
  color: #61402f;
  background: #fff1e9;
  font-size: 0.8rem;
  line-height: 1.48;
}
.safety-banner strong { display: block; margin-bottom: 3px; }

.form-grid { display: grid; grid-template-columns: 1fr 112px; gap: 12px; }
.form-grid label, .search-field {
  display: grid;
  gap: 6px;
  color: #38515a;
  font-size: 0.73rem;
  font-weight: 800;
}
.form-grid .wide-field { min-width: 0; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #b8c7c5;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(12, 95, 120, 0.12); }
.input-with-unit { position: relative; display: block; }
.input-with-unit input { padding-right: 36px; }
.input-with-unit span { position: absolute; right: 11px; top: 12px; color: var(--muted); font-size: 0.8rem; }
.local-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.7rem; }

.planner-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.planner-section > summary { margin-bottom: 14px; color: var(--ink); font-weight: 850; cursor: pointer; }
.search-field { margin-bottom: 12px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.filter-grid label, .layer-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #425b63;
  font-size: 0.75rem;
}
.filter-grid input, .layer-toggle input { width: 16px; min-height: 16px; margin: 1px 0 0; accent-color: var(--sea); }
.poi-results { max-height: 230px; margin-top: 12px; overflow: auto; }
.poi-result {
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-top: 1px solid #e3e8e6;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--ink);
  background: transparent;
}
.poi-result:hover { color: var(--sea); }
.poi-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--coral); }
.poi-result span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poi-result small { color: var(--muted); text-transform: capitalize; }
.source-note { margin: 12px 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
.source-note a { text-underline-offset: 2px; }
.layer-toggle { margin: 11px 0; }
.layer-toggle span { display: grid; gap: 2px; }
.layer-toggle small { color: var(--muted); line-height: 1.4; }
.provider-ledger { margin: 14px 0 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.provider-ledger li { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf5; }
.provider-ledger p { margin: 5px 0; color: var(--muted); font-size: 0.68rem; line-height: 1.45; }
.provider-ledger a { color: var(--sea); font-size: 0.67rem; font-weight: 800; text-underline-offset: 2px; }
.provider-status { display: inline-block; padding: 2px 6px; border-radius: 999px; font-size: 0.56rem; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
.provider-status.active { color: #27624d; background: #dcefe6; }
.provider-status.restricted { color: #89462f; background: #f6dfd6; }

.conditions-card {
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #edf5f2;
}
.conditions-card strong { font-size: 0.78rem; }
.conditions-card p { margin: 3px 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.4; }
.conditions-card button {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--sea);
  border-radius: 8px;
  color: var(--sea);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.section-heading span { color: var(--sea); font-size: 0.64rem; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.section-heading h2 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 1.65rem; font-weight: 500; }
.text-button { padding: 4px 0; border: 0; color: var(--sea); background: transparent; font-size: 0.72rem; font-weight: 850; text-decoration: underline; text-underline-offset: 3px; }
.waypoint-list { margin: 13px 0 0; padding: 0; list-style: none; }
.waypoint-row {
  margin-top: 9px;
  padding: 11px;
  border: 1px solid #d9e1df;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 9px;
  background: #fff;
}
.waypoint-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--sea);
  font-size: 0.7rem;
  font-weight: 850;
}
.waypoint-fields { display: grid; gap: 5px; }
.waypoint-fields input { min-height: 34px; padding: 5px 7px; font-size: 0.76rem; }
.waypoint-fields input + input { color: var(--muted); }
.waypoint-actions { display: grid; align-content: start; grid-template-columns: 1fr 1fr; gap: 3px; }
.waypoint-actions button { width: 28px; height: 27px; padding: 0; border: 1px solid #ccd7d5; border-radius: 6px; color: var(--sea-dark); background: #f5f8f6; }
.waypoint-actions .remove-waypoint { grid-column: 1 / -1; color: #8a3f31; }
.empty-waypoints { padding: 25px 14px; text-align: center; color: var(--muted); background: #f3f6f3; border-radius: 10px; }
.empty-waypoints strong { color: var(--ink); }
.empty-waypoints p { margin: 5px 0 0; font-size: 0.75rem; }

.passage-summary {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.65fr;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}
.passage-summary div { padding: 12px 10px; border-right: 1px solid var(--line); }
.passage-summary div:last-child { border: 0; }
.passage-summary span { display: block; color: var(--muted); font-size: 0.62rem; line-height: 1.25; }
.passage-summary strong { display: block; margin-top: 4px; font-size: 0.92rem; }
.leg-table-wrap { margin-top: 12px; }
.leg-table { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.leg-table th, .leg-table td { padding: 7px 5px; border-bottom: 1px solid #e1e7e5; text-align: left; }
.leg-table th { color: var(--muted); font-size: 0.62rem; text-transform: uppercase; }
.leg-table-wrap > p { margin: 7px 0; color: var(--muted); font-size: 0.64rem; line-height: 1.4; }

.planner-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.planner-actions .button { min-height: 41px; padding: 0 10px; font-size: 0.75rem; }
.planner-actions .button-primary { grid-column: 1 / -1; border: 0; }
.secondary-button { color: var(--sea-dark); background: #fff; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.clear-local { grid-column: 1 / -1; justify-self: center; margin-top: 4px; color: var(--muted); }
.action-status { grid-column: 1 / -1; min-height: 1.2em; margin: 0; color: var(--muted); font-size: 0.72rem; text-align: center; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

.map-shell { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
.map-callout, .map-provenance {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(9, 47, 61, 0.16);
  border-radius: 11px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 8px 24px rgba(9, 47, 61, 0.14);
  backdrop-filter: blur(8px);
}
.map-callout { top: 18px; left: 18px; padding: 10px 13px; display: grid; gap: 2px; }
.map-callout strong { font-size: 0.76rem; }
.map-callout span { color: var(--muted); font-size: 0.67rem; }
.map-provenance { right: 12px; bottom: 30px; padding: 8px 10px; display: grid; gap: 2px; text-align: right; }
.map-provenance span { color: var(--muted); font-size: 0.62rem; }
.map-provenance strong { color: #934d37; font-size: 0.68rem; }
.passage-marker {
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  display: grid;
  place-items: center;
  transform: rotate(-45deg);
  color: #fff;
  background: var(--sea);
  box-shadow: 0 4px 11px rgba(9, 47, 61, 0.35);
  font-size: 0.65rem;
  font-weight: 850;
}
.passage-marker span { transform: rotate(45deg); }
.marine-popup { max-width: 240px; color: var(--ink); }
.marine-popup h3 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 1.05rem; }
.marine-popup p { margin: 4px 0; color: var(--muted); font-size: 0.7rem; line-height: 1.4; }
.marine-popup button { width: 100%; margin-top: 8px; padding: 8px; border: 0; border-radius: 7px; color: #fff; background: var(--sea); font-size: 0.72rem; font-weight: 800; }
.marine-popup a { color: var(--sea); }
.noscript-message { position: fixed; inset: auto 20px 20px; z-index: 20; padding: 14px; color: #fff; background: #8a3f31; }

@media (max-width: 900px) {
  .planner-page { height: auto; overflow: auto; }
  .planner-header { grid-template-columns: 1fr auto; }
  .planner-heading { display: none; }
  .planner-layout { height: auto; grid-template-columns: 1fr; }
  .map-shell { height: 58vh; min-height: 430px; grid-row: 1; }
  .planner-panel { grid-row: 2; overflow: visible; border-right: 0; }
}
@media (max-width: 520px) {
  .planner-header { padding-inline: 12px; }
  .planner-header .brand > span:last-child { display: none; }
  .planner-panel { padding: 24px 16px 38px; }
  .form-grid { grid-template-columns: minmax(0, 1fr) 100px; }
  .filter-grid { grid-template-columns: 1fr; }
  .map-provenance { display: none; }
}
