html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, sans-serif;
}

#windy {
  height: 100vh;
  width: 100vw;
}

/* Windy's own UI chrome (timeline/calendar, overlay-picker badge, zoom
   controls) is hidden in favor of our own layer panel and Leaflet's default
   zoom control — everything here is display:none except #logo-wrapper,
   which their terms require to stay visible and clickable. */
#windy #bottom,
#windy #mobile-ovr-select,
#windy #embed-zoom,
#windy #plugins {
  display: none !important;
}

/* Windy redraws its particle/overlay canvases every animation frame and
   resets their inline style each time, so toggling display via JS gets
   clobbered almost immediately — an !important stylesheet rule wins over
   that regardless of how often they re-set the inline style. */
#windy.wind-hidden .particles-layer,
#windy.wind-hidden .overlay-layer {
  display: none !important;
}

.panel {
  position: absolute;
  z-index: 1000;
  background: white;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  max-height: 85vh;
  overflow-y: auto;
}

#auth-panel {
  top: 10px;
  right: 10px;
  max-width: 220px;
}

#auth-panel input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 4px;
}

#register-invite {
  margin-top: 8px;
}

/* A button that reads as a text link (Forgot password?, Resend). */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #0b5cad;
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
}

/* Layers and Waypoints sit side-by-side, not stacked — with the layer
   panel now 13+ rows tall and waypoints carrying GPX import + trip brief
   controls, stacking them (as before) meant one could grow into the
   other. Side-by-side has no such failure mode regardless of how tall
   either one gets. */
#toolbar {
  top: 10px;
  left: 60px;
  display: flex;
  gap: 6px;
  padding: 6px 8px;
}

#toolbar button {
  margin: 0;
}

#toolbar button.active,
.panel button.active {
  background: #d97706;
  color: white;
  border-color: #d97706;
}

.measure-label div {
  background: white;
  border: 1px solid #d97706;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
}

#layer-panel {
  top: 54px;
  left: 60px;
}

#waypoints-panel {
  top: 54px;
  left: 370px; /* clears #layer-panel's actual width (~295px incl. the SST filter row) with margin */
  width: 220px;
}

#planner-panel {
  top: 54px;
  left: 620px; /* clears #waypoints-panel's width+padding with margin */
  width: 300px;
}

/* Opposite side from the other panels (top-right, below #auth-panel)
   rather than continuing the left-to-right row — that row is already at
   4 panels' worth of width, and this one doesn't need to sit next to
   the map-interaction panels since it's just a reference lookup. */
#regulations-panel {
  top: 100px;
  right: 10px;
  width: 260px;
}

/* A table wants width the narrow side panels don't have, and the top row
   is already full left-to-right regardless of which combination of those
   happen to be open — anchoring this one to the bottom instead avoids
   collision with all of them without having to track their widths. */
#waypoint-list-panel {
  bottom: 10px;
  left: 60px;
  width: 620px;
  max-height: 320px;
}

#waypoint-search {
  width: 100% !important;
  box-sizing: border-box;
  margin: 4px 0 8px !important;
}

.wpt-table-wrap {
  overflow-x: auto;
}

#waypoint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

#waypoint-table th,
#waypoint-table td {
  text-align: left;
  padding: 5px 8px 5px 0;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

#waypoint-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  color: #555;
}

#waypoint-table th[data-sort]:hover {
  color: #111;
}

#waypoint-table td.wpt-notes-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#waypoint-table td.wpt-actions-cell {
  white-space: nowrap;
}

#waypoint-table td.wpt-actions-cell button {
  font-size: 11px;
  margin: 0 4px 0 0;
  padding: 2px 6px;
}

.regulation-row {
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}

.regulation-row:last-child {
  border-bottom: none;
}

.planner-card {
  border-top: 1px solid #ddd;
  padding-top: 8px;
  margin-top: 8px;
}

.planner-card:first-child {
  border-top: none;
  margin-top: 0;
}

.planner-card h4 {
  margin: 0 0 4px 0;
}

.planner-meta {
  font-size: 12px;
  color: #444;
}

.planner-rationale {
  font-size: 12px;
  margin: 4px 0;
  padding-left: 18px;
}

.planner-species {
  font-size: 13px;
  margin-top: 6px;
}

.planner-species-cue {
  font-size: 11px;
  color: #666;
  margin: 1px 0 1px 4px;
}

.planner-species-reg {
  font-size: 11px;
  color: #7c2d12;
  font-style: italic;
  margin: 1px 0 4px 4px;
}

.planner-buoy {
  margin-top: 4px;
}

/* Evidence grades on planner reasons (brief 14.7, principle 3). */
.grade {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 4px;
  margin-right: 4px;
  border-radius: 3px;
  vertical-align: 1px;
}

.grade-strong {
  background: #15803d;
  color: #fff;
}

.grade-moderate {
  background: #b45309;
  color: #fff;
}

.grade-heuristic {
  background: #e5e7eb;
  color: #374151;
}

.planner-species-reasons {
  font-size: 11px;
  margin: 1px 0 2px 0;
  padding-left: 18px;
  list-style: none;
}

.planner-species-reasons .against {
  color: #6b7280;
}

.planner-advice {
  font-size: 11px;
  margin: 2px 0 4px 4px;
  color: #1e3a8a;
}

/* className:"planner-marker" on the divIcon replaces Leaflet's default
   white-box styling entirely, so the badge look below is the only styling
   the marker gets. */
.planner-marker div {
  background: #d97706;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* className:"wpt-marker" on the divIcon (frontend/src/waypoints/waypoints.js) —
   badge look copied from .planner-marker above, but background-color is set
   per-instance inline (it varies by matched symbol) rather than fixed here. */
.wpt-marker div {
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-header h3 {
  margin: 0;
}

.panel-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 0 2px;
}

.panel-close-btn:hover {
  color: #333;
}

.hint {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
}

.file-label {
  display: block;
  margin-top: 8px;
  cursor: pointer;
}

#waypoint-count {
  margin-top: 8px;
  font-size: 12px;
  color: #555;
}

.wpt-popup {
  min-width: 160px;
}

.wpt-popup input,
.wpt-popup textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 4px 0;
}

.wpt-notes {
  font-style: italic;
  margin-top: 4px;
}

.wpt-source {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

.wpt-actions {
  margin-top: 6px;
}

.wpt-actions button {
  font-size: 12px;
}

.panel input {
  display: block;
  margin: 4px 0;
  width: 160px;
}

/* Overrides the block/fixed-width rule above, which was written for text
   inputs (email, password, lat/lon...) and had the side effect of forcing
   a line break between every checkbox and its label text — checkboxes sit
   inline with their label instead, one row per layer rather than two. */
.panel input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin: 0 6px 0 0;
  vertical-align: middle;
}

/* Layer row: checkbox+label on the left, an age label and (for raster/
   image-overlay layers only) a compact opacity slider pinned to the
   right. Vector layers (eddies/buoys/ATON/waypoints) skip the slider —
   Leaflet's per-marker fillOpacity is already tuned for legibility
   rather than being a single "how see-through is this layer" knob — but
   still get the age label, since "how old is this data" applies
   regardless of how the layer is rendered. Waypoints is the one
   exception to the age label too: it's the user's own created-on-demand
   data, not something with a publish cadence to show the age of. */
.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.layer-row label {
  margin: 0;
  flex-shrink: 0;
}

/* Empty until a fetch populates it (textContent + title) — an empty span
   takes no visible width, so a layer that's never been turned on shows
   no gap. margin-left:auto (rather than the row's own justify-content)
   pushes this and everything after it — the opacity slider, when there
   is one — to the right edge as a group, regardless of how many
   right-side elements a given row has. */
.layer-age {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
  margin-left: auto;
  cursor: default;
}

.opacity-slider {
  width: 64px !important;
  margin: 0 !important;
  display: inline-block !important;
  accent-color: #d97706;
}

.opacity-slider:disabled {
  opacity: 0.4;
}

.panel button {
  margin: 4px 4px 0 0;
  cursor: pointer;
}

.panel label {
  display: block;
  margin: 4px 0;
}

/* !important is deliberate: "hidden" is a utility class meant to always
   win, regardless of any other component rule's specificity — without it,
   a toggled element that also happens to match a more specific selector
   (e.g. a <label> inside .panel, where ".panel label { display: block }"
   otherwise outranks this) silently stays visible. */
.hidden {
  display: none !important;
}

.sst-filter {
  margin: 2px 0 6px 20px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.sst-filter input {
  width: 60px !important;
  margin: 0 !important;
  display: inline-block !important;
}

.sst-filter button {
  font-size: 12px;
  padding: 2px 6px;
}

.error {
  color: #b00020;
  font-size: 12px;
  max-width: 200px;
}

#vessel-manager {
  margin: 6px 0;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fafafa;
}

#vessel-manager h5 {
  margin: 8px 0 2px 0;
}

.vessel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid #eee;
}

.vessel-row button {
  font-size: 11px;
  margin: 0;
  flex-shrink: 0;
}

#planner-range-estimate {
  padding: 6px 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 4px;
}

.vessel-disclaimer {
  font-style: italic;
  margin-top: 4px;
  color: #7c2d12;
}

/* Standalone pages opened from email links (verify.html,
   reset-password.html): a single centered card, no map. */
.standalone-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background: #e8eef3;
}

.standalone-card {
  position: static;
  max-width: 340px;
  width: calc(100% - 32px);
}

.standalone-card input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
}

.attribution {
  max-width: 560px;
  line-height: 1.4;
}

.attribution h4 {
  margin: 14px 0 4px;
}

.attribution ul {
  padding-left: 18px;
  margin: 4px 0;
}

.attribution-link {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #555;
}

/* Federal Register rule changes in the Regulations panel (brief 14.3 Phase B). */
.regulation-change a {
  font-size: 12px;
}

.regulation-change.recreational {
  border-left: 3px solid #b45309;
  padding-left: 6px;
}

.reg-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 3px;
  background: #fde68a;
  color: #78350f;
}

.reg-tag.open {
  background: #bfdbfe;
  color: #1e3a8a;
}
