:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --ink: #17201f;
  --muted: #687371;
  --line: #dfe7e4;
  --teal: #0f6c60;
  --teal-dark: #084d45;
  --teal-soft: #dcefeb;
  --coral: #f1604d;
  --amber: #d8942a;
  --shadow: 0 14px 40px rgba(22, 42, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  padding-top: 72px;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: block;
  min-height: 100vh;
  overflow-x: hidden;
}

.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--teal);
}

.brand-mark svg,
.nav-links svg,
.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.nav-links {
  display: flex;
  gap: 6px;
  max-width: 100%;
  margin-top: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: #293432;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}

.nav-links a.active,
.nav-links a:hover {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.nav-links span[data-icon] {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.source-card {
  display: none;
  gap: 14px;
  margin: auto 4px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(22, 42, 38, 0.04);
}

.source-card div + div {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

dt,
.source-card dt,
label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

dd {
  margin: 0;
}

.source-card dd {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.main-content {
  min-width: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 28px;
  overflow-x: hidden;
}

.topbar {
  position: static;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  margin: 0 0 20px;
  padding: 18px 0 14px;
}

.date-line {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.icon-button.small {
  width: 34px;
  height: 34px;
}

.icon-button.small svg {
  width: 19px;
  height: 19px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(340px, 0.82fr);
  gap: 20px;
  align-items: start;
}

.left-column,
.right-column {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.panel-heading.compact {
  padding-bottom: 0;
}

.panel-note {
  margin: 9px 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 145px;
  gap: 18px;
  padding: 16px 18px 18px;
}

.chart-wrap {
  min-height: 300px;
  min-width: 0;
  overflow: hidden;
}

#tideChart {
  display: block;
  width: 100%;
  height: 330px;
  overflow: visible;
}

.axis-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.point-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.low-label {
  fill: var(--coral);
}

.chart-stats {
  display: grid;
  align-content: center;
  gap: 22px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.chart-stats div {
  min-width: 0;
}

.chart-stats dd {
  margin-top: 8px;
  font-size: 23px;
  font-weight: 800;
}

.window-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
}

.next-panel,
.photo-panel,
.conditions-panel {
  padding: 18px;
}

.next-content,
.photo-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.big-time {
  margin-top: 7px;
  font-size: 46px;
  line-height: 0.95;
  font-weight: 800;
}

.date-kicker {
  margin-top: 18px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: lowercase;
}

.next-content p:not(.big-time) {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
}

.next-content dl {
  display: grid;
  gap: 16px;
  min-width: 120px;
}

.next-content dd {
  margin-top: 6px;
  color: var(--coral);
  font-size: 20px;
  font-weight: 800;
}

.photo-window {
  margin-top: 7px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 800;
}

#windowReason {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.opportunity-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.factor-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.factor-chip.caution {
  background: #fff1ee;
  color: #b74335;
}

.confidence-box {
  display: grid;
  place-items: center;
  min-width: 102px;
  min-height: 118px;
  border: 1px solid #bad5cf;
  border-radius: 8px;
  background: #f2faf8;
  color: var(--teal);
}

.confidence-box span {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

.confidence-box strong {
  font-size: 28px;
  line-height: 1;
}

.table-panel {
  overflow: hidden;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.table-scroll {
  overflow-x: auto;
  padding: 14px 0 0;
  max-width: 100%;
}

table {
  width: 100%;
  min-width: 690px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:hover,
tbody tr.is-next {
  background: #edf6f4;
}

.height-low {
  color: var(--coral);
  font-weight: 800;
}

.map-card {
  position: relative;
  margin: 16px 18px 0;
  overflow: hidden;
  aspect-ratio: 1.52;
  border-radius: 8px;
  background: #d9e3df;
}

.interactive-map {
  width: 100%;
  height: 100%;
  min-height: 390px;
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-popup-content {
  margin: 10px 12px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.leaflet-popup-content strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.zone-map-label {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.zone-map-label::before {
  display: none;
}

.map-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: inherit;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.zone-list {
  display: grid;
  gap: 0;
  margin: 8px 0 0;
  padding: 0 18px 16px;
  list-style: none;
}

.zone-detail {
  display: grid;
  gap: 10px;
  margin: 12px 18px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.zone-detail h3 {
  margin: 0;
  font-size: 14px;
}

.zone-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.zone-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.zone-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.zone-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.zone-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.zone-list button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.zone-list li.is-active {
  background: #edf6f4;
}

.zone-list li:last-child {
  border-bottom: 0;
}

.zone-number {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.zone-status {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.conditions-panel {
  background:
    linear-gradient(120deg, rgba(8, 77, 69, 0.86), rgba(9, 34, 36, 0.78)),
    url("assets/povoa-low-tide.png") center / cover;
  color: #fff;
}

.conditions-panel h2 {
  margin-bottom: 18px;
}

.conditions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.conditions-grid div {
  min-height: 72px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.conditions-grid span {
  display: block;
  opacity: 0.78;
  font-size: 12px;
  font-weight: 700;
}

.conditions-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.15;
}

.tomorrow-panel {
  overflow: hidden;
}

.tomorrow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 14px 18px 18px;
}

.tomorrow-grid div {
  min-height: 64px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.tomorrow-grid div:nth-child(odd) {
  padding-right: 12px;
}

.tomorrow-grid div:nth-child(even) {
  padding-left: 12px;
}

.tomorrow-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tomorrow-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 17px;
  line-height: 1.2;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 108, 96, 0.22);
  outline-offset: 2px;
}

@media (max-width: 1180px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .side-nav {
    min-height: auto;
    padding: 12px 18px;
  }

  .nav-links {
    padding-bottom: 2px;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 134px;
  }

  body {
    padding-top: 124px;
  }

  .side-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nav-links {
    width: 100%;
  }

  .main-content {
    padding: 0 14px 22px;
  }

  .topbar {
    padding-block: 14px;
  }

  h1 {
    font-size: 21px;
  }

  .brand strong {
    font-size: 16px;
  }

  .nav-links a {
    min-height: 40px;
    font-size: 14px;
  }

  .chart-layout,
  .window-grid,
  .next-content,
  .photo-panel {
    grid-template-columns: 1fr;
  }

  .chart-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .chart-stats dd {
    font-size: 18px;
  }

  .chart-stats dt,
  .chart-stats dd {
    overflow-wrap: anywhere;
  }

  #tideChart {
    height: 260px;
  }

  .big-time {
    font-size: 40px;
  }

  .photo-window {
    font-size: 26px;
  }

  .tomorrow-grid {
    grid-template-columns: 1fr;
  }

  .tomorrow-grid div:nth-child(odd),
  .tomorrow-grid div:nth-child(even) {
    padding-right: 0;
    padding-left: 0;
  }

  .interactive-map {
    min-height: 330px;
  }
}

@media (max-width: 460px) {
  .panel-heading {
    align-items: flex-start;
  }

  .panel-heading span,
  .text-button {
    font-size: 11px;
  }

  .chart-layout {
    padding: 12px;
  }

  .chart-wrap {
    margin-inline: -8px;
  }

  .chart-stats {
    gap: 8px;
  }

  .chart-stats dd {
    font-size: 16px;
  }

  th,
  td {
    padding-inline: 12px;
  }
}
