:root {
  --bg: #f2f6fa;
  --surface: #fff;
  --line: #d8e1ea;
  --text: #111827;
  --muted: #5f6f82;
  --blue: #1458d4;
  --water: #0f6fde;
  --dam: #0f9f8f;
  --weather: #e08700;
  --tide: #0b8fb3;
  --danger: #dc2626;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 1180px;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

.topbar {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto minmax(545px, 1fr);
  align-items: center;
  gap: 16px;
  height: 62px;
  padding: 0 18px;
  background: linear-gradient(105deg, #195fd9 0%, #1354cc 55%, #0f48ba 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(13, 55, 135, 0.2);
}

.brand {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand > div {
  min-width: 0;
}

.brand__mark {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
}

.brand__mark span {
  position: absolute;
  left: 7px;
  width: 22px;
  height: 7px;
  border: 2px solid #fff;
  border-top: 0;
  border-left-color: transparent;
  border-radius: 0 0 50% 50%;
  transform: rotate(-3deg);
}

.brand__mark span:nth-child(1) { top: 7px; }
.brand__mark span:nth-child(2) { top: 14px; opacity: 0.82; }
.brand__mark span:nth-child(3) { top: 21px; opacity: 0.64; }

.topbar h1 {
  margin: 0 0 2px;
  overflow: hidden;
  font-size: 1.03rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-mobile {
  display: none;
}

.topbar p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-tabs {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 9px;
  background: rgba(7, 37, 105, 0.22);
  transform: translateX(-50%);
}

.view-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 31px;
  padding: 0 15px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
}

.view-tabs a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.view-tabs a.is-active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 3px 8px rgba(6, 37, 105, 0.2);
}

.topbar__actions {
  grid-column: 3;
  justify-self: end;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: max-content;
}

.auto-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.auto-control input[type="number"] {
  width: 64px;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
}

.auto-control--toggle input {
  width: 16px;
  height: 16px;
}

.countdown-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.range-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.range-control select {
  height: 22px;
  padding: 0 6px;
  border: 1px solid #c8d6e4;
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 13px;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid #fff;
  background: #fff;
  color: var(--blue);
}

.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
}

.notification-center {
  position: relative;
  flex: 0 0 auto;
}

.notification-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.notification-btn:hover,
.notification-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.22);
}

.notification-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #1458d4;
  border-radius: 999px;
  background: #f04438;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

.notification-count[hidden] {
  display: none;
}

.notification-count--info {
  background: #2f80ed;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 100;
  width: min(390px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid #d5e0ea;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 48px rgba(9, 30, 66, 0.28);
}

.notification-panel[hidden] {
  display: none;
}

.notification-panel::before {
  position: absolute;
  top: -7px;
  right: 11px;
  width: 12px;
  height: 12px;
  border-top: 1px solid #d5e0ea;
  border-left: 1px solid #d5e0ea;
  background: #f7faff;
  content: "";
  transform: rotate(45deg);
}

.notification-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 11px 12px 10px 15px;
  border-bottom: 1px solid #e3eaf1;
  background: #f7faff;
}

.notification-panel__header span,
.notification-panel__header strong {
  display: block;
}

.notification-panel__header span {
  margin-bottom: 2px;
  color: var(--blue);
  font-size: 0.66rem;
  font-weight: 900;
}

.notification-panel__header strong {
  font-size: 0.9rem;
}

.notification-panel__header button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.notification-panel__header button:hover {
  background: #eaf1f8;
  color: #1e293b;
}

.notification-list {
  max-height: min(440px, calc(100vh - 96px));
  overflow-y: auto;
  padding: 8px;
}

.notification-item {
  --notice-color: #2463c7;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 10px;
  border-radius: 9px;
}

.notification-item + .notification-item {
  border-top: 1px solid #edf1f5;
  border-radius: 0 0 9px 9px;
}

.notification-item--warning { --notice-color: #c67500; }
.notification-item--error { --notice-color: #d92d20; }

.notification-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--notice-color) 12%, white);
  color: var(--notice-color);
  font-size: 0.8rem;
  font-weight: 950;
}

.notification-item__content {
  min-width: 0;
}

.notification-item__content strong {
  display: block;
  margin-bottom: 3px;
  color: #1e293b;
  font-size: 0.78rem;
}

.notification-item__content p {
  margin: 0;
  color: #526277;
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
}

.notification-item__content time {
  display: block;
  margin-top: 5px;
  color: #8996a8;
  font-size: 0.62rem;
  font-weight: 700;
}

.notification-empty {
  padding: 28px 18px;
  color: #7a899d;
  font-size: 0.74rem;
  font-weight: 750;
  text-align: center;
}

.page {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: 128px 198px minmax(0, 1fr);
  grid-auto-rows: minmax(220px, 1fr);
  gap: 8px;
  height: calc(100vh - 62px);
  padding: 8px 12px 10px;
  overflow: auto;
}

.section {
  display: flex;
  min-height: 0;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 22px rgba(20, 37, 54, 0.06);
  overflow: auto;
}

.section--resizable {
  min-width: 260px;
  min-height: 52px;
  resize: both;
}

.section--closed {
  display: none;
}

.section--collapsed {
  align-self: start;
  min-height: 44px;
  max-height: 44px;
  resize: none;
}

.section--collapsed > :not(.section__header) {
  display: none;
}

.section__tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.section__tools p {
  min-width: 0;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-control-btn {
  height: 24px;
  padding: 0 7px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.section-control-btn:hover {
  border-color: #9fb8d1;
  background: #f8fbff;
  color: var(--blue);
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 9px;
  border: 1px solid #b9d8ff;
  border-radius: 6px;
  background: #eef6ff;
  color: var(--water);
  font-size: 0.68rem;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.source-link:hover {
  background: #dff0ff;
}

.source-link:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.source-link--dam {
  border-color: #b9e7df;
  background: #ecfbf8;
  color: var(--dam);
}

.source-link--dam:hover {
  background: #d9f7f1;
}

.source-link--weather {
  border-color: #efc777;
  background: #fff8e8;
  color: var(--weather);
}

.source-link--weather:hover {
  background: #fff0cf;
}

.source-link--tide {
  border-color: #a7e3f2;
  background: #e8fbff;
  color: var(--tide);
}

.source-link--tide:hover {
  background: #d6f5fd;
}

.source-link--muted {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.source-link--muted:hover {
  background: #eef2f7;
}

.section--status {
  grid-column: span 3;
  min-height: 0;
}

.section--controls {
  grid-column: span 3;
  min-height: 0;
}

.section--dam {
  grid-column: span 2;
  min-width: 0;
  min-height: 0;
}

.section--tide {
  grid-column: span 4;
  min-width: 0;
  min-height: 0;
}

.panel-grid {
  display: contents;
}

.section--weather {
  grid-column: span 3;
  min-height: 0;
}

.section--weather .section__header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.section--weather .section__header h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section--weather .section__tools {
  flex: 0 0 auto;
}

.section--water {
  grid-column: span 2;
  min-width: 0;
  min-height: 0;
}

.panel-controls {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding: 10px 12px;
}

.closed-section-list {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.closed-section-list:empty {
  display: none;
}

.closed-section-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 850;
  cursor: pointer;
}

.closed-section-btn:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--blue);
}

.panel-controls .range-control {
  min-width: 176px;
  justify-content: space-between;
}

.panel-controls .range-control select {
  min-width: 104px;
}

.section__eyebrow--control {
  background: #f1f5f9;
  color: #475569;
}

.remove-panel {
  width: 30px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.remove-panel:hover {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #dc2626;
}

.section__header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px 7px;
  border-bottom: 1px solid var(--line);
}

.section__header h2 {
  margin: 3px 0 0;
  font-size: 0.9rem;
}

.section__header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.section__eyebrow {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff3db;
  color: var(--weather);
  font-size: 0.66rem;
  font-weight: 900;
}

.section__eyebrow--water {
  background: #e6f0ff;
  color: var(--water);
}

.section__eyebrow--dam {
  background: #def8f4;
  color: var(--dam);
}

.section__eyebrow--tide {
  background: #dbf7ff;
  color: var(--tide);
}

.record-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(190px, 0.82fr);
  gap: 6px;
  min-height: 0;
  flex: 1;
  padding: 6px;
  overflow: hidden;
}

.chart-panel {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}

.chart-panel--water {
  display: grid;
  grid-template-rows: 86px minmax(0, 1fr);
}

.latest-water {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 18px 9px 14px;
  border-bottom: 1px solid #c9dcf3;
  border-left: 4px solid var(--water);
  background: linear-gradient(105deg, #edf5ff 0%, #f8fbff 58%, #fff 100%);
}

.latest-water__meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.latest-water__meta > span {
  color: #1458a6;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.latest-water__meta time {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #0c477f;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.latest-water__basis {
  flex: 0 0 auto;
  color: #315f8e;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.latest-water__clock {
  font-size: clamp(2.35rem, 2.8vw, 3rem);
  font-weight: 950;
  letter-spacing: -0.06em;
  line-height: 1.08;
}

.latest-water__reading {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 5px;
  color: var(--water);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.latest-water__reading strong {
  font-size: clamp(2.35rem, 2.8vw, 3rem);
  font-weight: 950;
  letter-spacing: -0.06em;
  line-height: 1.08;
}

.latest-water__reading span {
  color: #245b91;
  font-size: 1rem;
  font-weight: 900;
}

.main-forecast-stepper {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 3px 6px;
  min-width: 104px;
  padding: 5px 7px;
  border: 1px solid #d5dced;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.main-forecast-stepper > span {
  grid-column: 1 / -1;
  color: #52637c;
  font-size: 0.58rem;
  font-weight: 850;
  text-align: center;
}

.main-forecast-stepper > div {
  display: grid;
  grid-template-columns: 21px minmax(38px, auto) 21px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cbd7e8;
  border-radius: 6px;
  background: #fff;
}

.main-forecast-stepper button {
  display: grid;
  width: 21px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 0;
  background: #edf4ff;
  color: #2766ad;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 950;
}

.main-forecast-stepper button:hover:not(:disabled) { background: #dceaff; }
.main-forecast-stepper button:disabled { color: #aab5c4; cursor: default; opacity: 0.55; }
.main-forecast-stepper strong { color: #214f83; font-size: 0.62rem; font-variant-numeric: tabular-nums; font-weight: 950; text-align: center; white-space: nowrap; }
.main-forecast-stepper > small { padding: 3px 5px; border-radius: 999px; background: #e6f5ec; color: #14723b; font-size: 0.5rem; font-weight: 950; text-align: center; white-space: nowrap; }
.main-forecast-stepper--reference { border-color: #f1d39b; background: #fffaf0; }
.main-forecast-stepper--reference > small { background: #fff0cc; color: #a45b00; }

.latest-water--empty {
  border-left-color: #94a3b8;
  background: #f8fafc;
}

.latest-water--empty .latest-water__reading,
.latest-water--empty .latest-water__meta > span {
  color: #64748b;
}

.chart-plot {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chart-panel svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chart-grid {
  stroke: #dfe7ef;
  stroke-width: 1;
}

.chart-axis {
  stroke: #b9c7d6;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  opacity: 0.18;
}

.chart-forecast-zone {
  fill: rgba(91, 54, 214, 0.035);
}

.chart-forecast-band {
  fill: rgba(91, 54, 214, 0.14);
  stroke: none;
}

.chart-forecast-line {
  fill: none;
  stroke: #5b36d6;
  stroke-width: 3;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-forecast-point {
  fill: #fff;
  stroke: #5b36d6;
  stroke-width: 2.5;
}

.chart-now-line {
  stroke: #64748b;
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
}

.chart-now-label {
  fill: #475569;
  font-size: 10px;
  font-weight: 900;
}

.chart-forecast-label {
  fill: #5b36d6;
  font-size: 10px;
  font-weight: 900;
}

.chart-forecast-label--reference { fill: #a45b00; }

.chart-label--forecast { fill: #5b36d6; }

.chart-threshold {
  stroke-width: 2;
  stroke-dasharray: 5 5;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.chart-title {
  fill: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.chart-summary {
  fill: #334155;
  font-size: 12px;
  font-weight: 850;
}

.chart-panel--water .chart-label {
  font-size: 16px;
  font-weight: 800;
}

.chart-panel--water .chart-title,
.chart-panel--water .chart-summary {
  font-size: 18px;
  font-weight: 900;
}

.chart-point {
  stroke: #fff;
  stroke-width: 1.5;
}

.chart-point--latest {
  stroke-width: 2.4;
}

.chart-hit {
  fill: transparent;
  cursor: crosshair;
}

.chart-hit:hover {
  fill: rgba(20, 88, 212, 0.08);
}

.chart-hit--forecast:hover { fill: rgba(91, 54, 214, 0.08); }

.chart-tooltip {
  position: absolute;
  z-index: 8;
  max-width: calc(100% - 20px);
  padding: 9px 12px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transform: translateY(2px);
  transition: opacity 0.08s ease, transform 0.08s ease;
}

.chart-tooltip--visible {
  opacity: 1;
  transform: translateY(0);
}

.chart-tooltip--forecast {
  min-width: 176px;
  padding: 0;
  overflow: hidden;
  border-color: #c4b5fd;
  border-radius: 8px;
  white-space: normal;
}

.chart-tooltip__forecast-time {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0 7px;
  padding: 8px 10px 7px;
  border-bottom: 1px solid #e6e1fb;
  background: #f7f5ff;
}

.chart-tooltip__forecast-time > span {
  grid-column: 1 / -1;
  color: #6d5db2;
  font-size: 0.58rem;
  font-weight: 850;
}

.chart-tooltip__forecast-time > strong {
  color: #2f2466;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.chart-tooltip__forecast-time > em {
  color: #7158bb;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
}

.chart-tooltip__forecast-central {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 6px;
}

.chart-tooltip__forecast-central > span {
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 850;
}

.chart-tooltip__forecast-central > strong {
  color: #4c2fc4;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 1;
}

.chart-tooltip__forecast-central > strong small {
  margin-left: 2px;
  font-size: 0.62rem;
  letter-spacing: 0;
}

.chart-tooltip__forecast-range {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 8px;
  padding: 6px 10px 8px;
  background: #fafafa;
}

.chart-tooltip__forecast-range > span { display: grid; gap: 1px; }
.chart-tooltip__forecast-range > span:last-child { text-align: right; }
.chart-tooltip__forecast-range small { color: #8791a3; font-size: 0.52rem; font-weight: 800; }
.chart-tooltip__forecast-range strong { color: #536078; font-size: 0.66rem; font-variant-numeric: tabular-nums; font-weight: 900; }
.chart-tooltip__forecast-range > i { width: 1px; background: #e2e8f0; }

.chart-tooltip--metric {
  --metric-accent: #0f6fde;
  --metric-dark: #164b83;
  --metric-soft: #f2f7ff;
  --metric-border: #a9c9ee;
  min-width: 190px;
  padding: 0;
  overflow: hidden;
  border-color: var(--metric-border);
  border-radius: 8px;
  white-space: normal;
}

.chart-tooltip--dam {
  --metric-accent: #0f8f83;
  --metric-dark: #11635c;
  --metric-soft: #effaf8;
  --metric-border: #99d5ce;
}

.chart-tooltip__metric-time {
  display: grid;
  gap: 1px;
  padding: 8px 10px 7px;
  border-bottom: 1px solid var(--metric-border);
  background: var(--metric-soft);
}

.chart-tooltip__metric-time > span {
  color: var(--metric-dark);
  font-size: 0.58rem;
  font-weight: 850;
  opacity: 0.82;
}

.chart-tooltip__metric-time > strong {
  color: var(--metric-dark);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.chart-tooltip__metric-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 6px;
}

.chart-tooltip__metric-main > span {
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 850;
}

.chart-tooltip__metric-main > strong {
  color: var(--metric-accent);
  font-size: 1.22rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 1;
}

.chart-tooltip__metric-main > strong small {
  margin-left: 3px;
  font-size: 0.56rem;
  letter-spacing: 0;
}

.chart-tooltip__metric-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
  gap: 7px;
  padding: 6px 10px 8px;
  background: #fafafa;
}

.chart-tooltip__metric-details > span { display: grid; min-width: 0; gap: 1px; }
.chart-tooltip__metric-details > span:last-child { text-align: right; }
.chart-tooltip__metric-details small { color: #8791a3; font-size: 0.52rem; font-weight: 800; }
.chart-tooltip__metric-details strong { overflow: hidden; color: #536078; font-size: 0.61rem; font-variant-numeric: tabular-nums; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.chart-tooltip__metric-details > i { width: 1px; background: #e2e8f0; }

.tide-card {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  padding: 6px;
  background: #f5fbfd;
  overflow: hidden;
}

.tide-headline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  background: linear-gradient(90deg, #0d7795, #12a9c9);
  color: #fff;
}

.tide-headline span:first-child {
  flex: 0 0 auto;
  font-size: 1.08rem;
  font-weight: 900;
}

.tide-headline strong {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.45rem;
  line-height: 1;
}

.tide-headline span:last-child {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.78rem;
  font-weight: 850;
}

.chart-panel--tide {
  border-top: 0;
  background: #25384c;
}

.tide-chart-bg {
  fill: url("#tideSky");
}

.tide-grid {
  stroke: rgba(224, 242, 254, 0.46);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.tide-grid--vertical {
  stroke: rgba(224, 242, 254, 0.34);
}

.tide-axis-label,
.tide-axis-title {
  fill: #d9f3ff;
  font-size: 12px;
  font-weight: 850;
}

.tide-axis-title {
  fill: #ffffff;
}

.tide-area {
  fill: rgba(190, 225, 231, 0.28);
}

.tide-line {
  fill: none;
  stroke: rgba(229, 245, 250, 0.86);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tide-now-line {
  stroke: #ffffff;
  stroke-width: 3;
}

.tide-now-badge rect {
  fill: #ffffff;
}

.tide-now-badge text {
  fill: #0b6380;
  font-size: 13px;
  font-weight: 900;
}

.tide-extreme circle {
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 3;
  filter: drop-shadow(0 5px 8px rgba(15, 23, 42, 0.32));
}

.tide-extreme text {
  fill: #fff;
  font-size: 14px;
  font-weight: 950;
  pointer-events: none;
}

.tide-extreme--high circle {
  fill: #ff5b46;
}

.tide-extreme--low circle {
  fill: #0ba9e8;
}

.tide-extreme__label {
  font-size: 12px !important;
  font-weight: 900 !important;
}

.table-panel {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.66rem;
}

.record-table {
  table-layout: fixed;
  min-width: 0;
}

.record-table th,
.record-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-table th:first-child,
.record-table td:first-child {
  width: 35%;
}

.record-table th:not(:first-child),
.record-table td:not(:first-child) {
  width: 21.666%;
}

.record-table--dam {
  font-size: 0.64rem;
}

.record-table--dam th,
.record-table--dam td {
  padding-right: 4px;
  padding-left: 4px;
}

.record-table--dam th:first-child,
.record-table--dam td:first-child {
  width: 37%;
}

.record-table--dam th:not(:first-child),
.record-table--dam td:not(:first-child) {
  width: 21%;
}

th,
td {
  padding: 5px 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: center;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf2f7;
  font-weight: 900;
}

tbody tr:nth-child(even) {
  background: #f6f9fc;
}

.record-table--water .record-row--latest {
  background: #edf6ff;
  box-shadow: inset 3px 0 0 var(--water);
}

.record-table--water .record-row--latest .record-table__water-value {
  color: #075db8;
  font-size: 0.76rem;
  font-weight: 950;
}

.weather-detail {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.weather-detail__labels {
  display: grid;
  grid-template-rows: 20px repeat(6, 15px);
  align-items: center;
  padding: 4px 0 4px 8px;
  background: #f7fafc;
  border-right: 1px solid var(--line);
  color: var(--text);
  font-size: 0.64rem;
  font-weight: 900;
}

.weather-detail__scroll {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.weather-detail__col {
  display: grid;
  grid-template-rows: 20px repeat(6, 15px);
  align-items: center;
  justify-items: center;
  min-width: 48px;
  padding: 4px 3px;
  border-right: 1px dotted #cbd5e1;
  font-size: 0.63rem;
  white-space: nowrap;
}

.weather-detail__col:hover {
  background: #eef6ff;
}

.weather-detail__time {
  font-weight: 900;
}

.weather-detail__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.weather-symbol {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 28px;
}

.weather-symbol__sun {
  position: absolute;
  left: 4px;
  top: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ffc928;
  box-shadow: 0 0 0 4px rgba(255, 201, 40, 0.2), 0 0 14px rgba(255, 168, 0, 0.55);
}

.weather-symbol__moon {
  display: none;
  position: absolute;
  left: 4px;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #7aa7e8;
  box-shadow: 0 0 0 4px rgba(122, 167, 232, 0.16), 0 0 12px rgba(79, 126, 196, 0.35);
}

.weather-symbol__moon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: -3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
}

.weather-symbol__cloud {
  position: absolute;
  left: 10px;
  top: 12px;
  width: 24px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eef4fb, #9fb1c4);
  box-shadow: -8px 3px 0 -1px #c9d5df, 7px 1px 0 -2px #dbe5ed;
}

.weather-symbol__cloud::before,
.weather-symbol__cloud::after {
  content: "";
  position: absolute;
  bottom: 7px;
  border-radius: 50%;
  background: inherit;
}

.weather-symbol__cloud::before {
  left: 4px;
  width: 11px;
  height: 11px;
}

.weather-symbol__cloud::after {
  right: 4px;
  width: 9px;
  height: 9px;
}

.weather-symbol__cloud--small {
  display: none;
}

.weather-symbol__rain {
  display: none;
  position: absolute;
  left: 12px;
  top: 23px;
  width: 4px;
  height: 7px;
  border-radius: 999px;
  background: #1597ff;
  box-shadow: 10px 1px 0 #1597ff, 20px 0 0 #1597ff;
  transform: rotate(14deg);
}

.weather-symbol__bolt {
  display: none;
  position: absolute;
  left: 17px;
  top: 18px;
  width: 9px;
  height: 14px;
  background: #ffd12a;
  clip-path: polygon(45% 0, 100% 0, 62% 42%, 100% 42%, 25% 100%, 45% 55%, 8% 55%);
}

.weather-symbol__snow,
.weather-symbol__fog {
  display: none;
}

.weather-symbol--sun .weather-symbol__cloud,
.weather-symbol--sun .weather-symbol__cloud--small,
.weather-symbol--moon .weather-symbol__cloud {
  display: none;
}

.weather-symbol--moon .weather-symbol__sun,
.weather-symbol--night-partly .weather-symbol__sun {
  display: none;
}

.weather-symbol--moon .weather-symbol__moon,
.weather-symbol--night-partly .weather-symbol__moon {
  display: block;
}

.weather-symbol--cloud .weather-symbol__sun,
.weather-symbol--fog .weather-symbol__sun,
.weather-symbol--rain .weather-symbol__sun,
.weather-symbol--drizzle .weather-symbol__sun,
.weather-symbol--storm .weather-symbol__sun,
.weather-symbol--snow .weather-symbol__sun {
  display: none;
}

.weather-symbol--partly .weather-symbol__cloud {
  background: linear-gradient(180deg, #f8fbff, #b8c7d6);
}

.weather-symbol--night-partly .weather-symbol__cloud {
  background: linear-gradient(180deg, #eef3fa, #9eafc2);
}

.weather-symbol--drizzle .weather-symbol__rain,
.weather-symbol--rain .weather-symbol__rain {
  display: block;
}

.weather-symbol--drizzle .weather-symbol__rain {
  opacity: 0.7;
  height: 7px;
}

.weather-symbol--storm .weather-symbol__rain,
.weather-symbol--storm .weather-symbol__bolt {
  display: block;
}

.weather-symbol--snow .weather-symbol__snow {
  display: block;
  position: absolute;
  left: 14px;
  top: 24px;
  color: #3aa7ff;
  font-size: 19px;
  font-weight: 900;
  text-shadow: 13px 1px 0 #3aa7ff;
}

.weather-symbol--fog .weather-symbol__fog {
  display: block;
  position: absolute;
  left: 5px;
  top: 24px;
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: #9aa8b5;
  box-shadow: 0 7px 0 #c1ccd6;
}

.weather-detail__temp {
  color: #008bd2;
  font-weight: 900;
}

.weather-detail__rain {
  background: #eef2f7;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b5f9e;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.weather-detail__cell {
  font-weight: 700;
}

.empty {
  display: flex;
  min-height: 0;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 800;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
  flex: 1;
  padding: 6px 8px;
}

.status-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #f7fafc;
}

.status-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.status-card strong {
  font-size: 1.05rem;
  line-height: 1.1;
  word-break: keep-all;
}

.status-note {
  margin: 0 8px 8px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Four-panel dashboard: one focused view per quadrant. */
.page--four-panels {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "trend weather"
    "water bottom";
  gap: 10px;
  height: calc(100vh - 62px);
  padding: 10px 12px 12px;
  overflow: hidden;
}

.page--four-panels .section {
  min-width: 0;
  min-height: 0;
  resize: none;
  border-radius: 8px;
  overflow: hidden;
}

.page--four-panels .section--status { grid-area: trend; }
.page--four-panels .section--weather { grid-area: weather; }
.page--four-panels .section--water { grid-area: water; }
.page--four-panels .panel-grid { display: contents; }

.bottom-panel {
  grid-area: bottom;
  min-width: 0;
  min-height: 0;
}

.bottom-panel > .section {
  width: 100%;
  height: 100%;
}

.bottom-panel > .section.is-hidden { display: none; }

.page--four-panels .section__header {
  min-height: 58px;
  padding: 9px 12px;
  align-items: center;
}

.page--four-panels .section__header h2 {
  margin-top: 4px;
  font-size: 1rem;
}

.page--four-panels .section__tools {
  flex-wrap: wrap;
  row-gap: 5px;
}

.quick-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f1f5f9;
}

.quick-switch button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.quick-switch button:hover {
  background: #fff;
  color: var(--blue);
}

.quick-switch button.is-active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 4px rgba(20, 88, 212, 0.25);
}

.quick-switch--weather button.is-active {
  background: var(--weather);
  box-shadow: 0 1px 4px rgba(224, 135, 0, 0.25);
}

.quick-switch--bottom button.is-active {
  background: var(--tide);
  box-shadow: 0 1px 4px rgba(11, 143, 179, 0.25);
}

.section--dam .quick-switch--bottom button.is-active { background: var(--dam); }

.page--four-panels .status-board {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
}

.status-group {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 7px;
  padding: 9px 10px 10px;
  border: 1px solid #9ac7f8;
  border-radius: 9px;
  background: linear-gradient(135deg, #eaf4ff 0%, #f6faff 100%);
}

.status-group--tide {
  border-color: #8fd3e4;
  background: linear-gradient(135deg, #e9faff 0%, #f5fcfe 100%);
}

.status-group__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.status-group__heading strong {
  color: #164e84;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.status-group--tide .status-group__heading strong {
  color: #075b72;
}

.status-group__heading span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #d8eaff;
  color: #285f91;
  font-size: 0.7rem;
  font-weight: 900;
}

.status-group--tide .status-group__heading span {
  background: #d2f0f7;
  color: #12687d;
}

.status-group__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.status-metric {
  --status-color: #64748b;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--status-color);
  border-left-width: 5px;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.07);
}

.status-metric__marker {
  grid-row: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--status-color);
  color: #fff;
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
}

.status-metric__label {
  align-self: end;
  overflow: hidden;
  color: #334155;
  font-size: clamp(0.78rem, 0.82vw, 0.9rem);
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-metric__value {
  align-self: start;
  min-width: 0;
  overflow: hidden;
  color: var(--status-color);
  font-size: clamp(1.55rem, 1.8vw, 2.15rem);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-metric__badge {
  grid-column: 3;
  grid-row: 1 / -1;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--status-color);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.status-metric--rising {
  --status-color: #b42318;
  background: #fff8f5;
}

.status-metric--falling {
  --status-color: #075b9c;
  background: #f2f9ff;
}

.status-metric--stable {
  --status-color: #18733a;
  background: #f2fbf5;
}

.status-metric--unknown {
  --status-color: #64748b;
  background: #f8fafc;
}

.page--four-panels .status-card span { font-size: 0.75rem; }
.page--four-panels .status-card strong { font-size: 1.25rem; }

.page--four-panels .status-note {
  margin: 0 12px 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
}

.page--four-panels .weather-detail__labels,
.page--four-panels .weather-detail__col {
  grid-template-rows: 32px repeat(6, minmax(28px, 1fr));
  font-size: 0.7rem;
}

.page--four-panels .weather-detail__labels {
  grid-template-columns: 64px;
  padding-left: 10px;
}

.page--four-panels .weather-detail__col { min-width: 66px; }

.page--four-panels .record-layout {
  padding: 8px;
  gap: 8px;
}

/* Separate short-term water-level forecast workspace. */
.section--water .section__header > div:first-child,
.section--water .section__tools {
  flex: 0 0 auto;
}

.section__forecast-action {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-start;
  padding-left: 12px;
}

.forecast-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: linear-gradient(135deg, #5b36d6 0%, #3156d9 100%);
  color: #fff;
  box-shadow: 0 4px 13px rgba(42, 42, 125, 0.28);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.forecast-toggle:hover,
.forecast-toggle[aria-expanded="true"] {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(42, 42, 125, 0.4);
}

.forecast-toggle:focus-visible { outline: 2px solid #a99af3; outline-offset: 2px; }

.forecast-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.forecast-toggle small {
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
}

.forecast-panel {
  position: fixed;
  z-index: 79;
  left: 14px;
  bottom: 14px;
  display: grid;
  grid-template-rows: auto auto auto minmax(250px, 1fr) auto;
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  border: 1px solid #bfc9e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(18, 30, 76, 0.32);
}

.forecast-panel[hidden] { display: none; }

.forecast-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  border-bottom: 1px solid #dbe2f3;
  background: linear-gradient(105deg, #f2f0ff 0%, #f7f9ff 55%, #eef7ff 100%);
}

.forecast-panel__header > div:first-child { min-width: 0; }

.forecast-panel__eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #5b36d6;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.forecast-panel__header h2 {
  margin: 0;
  color: #172554;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.forecast-panel__header p {
  margin: 3px 0 0;
  overflow: hidden;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forecast-panel__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.forecast-panel__actions button {
  height: 31px;
  padding: 0 10px;
  border: 1px solid #b9c5e4;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.forecast-panel__actions button:hover { border-color: #5b36d6; color: #4b2fc1; }
.forecast-panel__actions button:disabled { cursor: wait; opacity: 0.55; }

.forecast-panel__actions .forecast-panel__close {
  width: 31px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.forecast-status {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 16px;
  border-bottom: 1px solid #e4e9f5;
  background: #f8fafc;
  color: #475569;
  font-size: 0.72rem;
}

.forecast-status__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.12);
}

.forecast-status strong { color: #334155; font-weight: 950; }
.forecast-status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forecast-status--normal .forecast-status__dot { background: #16803d; box-shadow: 0 0 0 4px rgba(22, 128, 61, 0.13); }
.forecast-status--watch .forecast-status__dot { background: #d97706; box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.13); }
.forecast-status--danger .forecast-status__dot { background: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.13); }
.forecast-status--error .forecast-status__dot { background: #dc2626; }
.forecast-status--loading .forecast-status__dot { animation: forecast-pulse 1.15s ease-in-out infinite; }

@keyframes forecast-pulse {
  50% { opacity: 0.35; transform: scale(0.76); }
}

.forecast-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 4px;
  background: #fff;
}

.forecast-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #d6def1;
  border-left: 4px solid #5b36d6;
  border-radius: 8px;
  background: #fafaff;
}

.forecast-metric > span {
  color: #5b36d6;
  font-size: 0.68rem;
  font-weight: 950;
}

.forecast-metric > strong {
  justify-self: end;
  color: #172554;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.forecast-metric > small {
  grid-column: 1 / -1;
  margin-top: 3px;
  overflow: hidden;
  color: #64748b;
  font-size: 0.63rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forecast-metric--summary {
  border-left-color: #0f6fde;
  background: #f3f8ff;
}

.forecast-metric--summary > span { color: #0f6fde; }
.forecast-metric--loading { opacity: 0.62; }
.forecast-metric--watch { border-left-color: #d97706; background: #fffaf0; }
.forecast-metric--danger { border-left-color: #dc2626; background: #fff6f5; }

.forecast-chart {
  position: relative;
  min-height: 250px;
  padding: 2px 10px 4px;
  background: #fff;
}

.forecast-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 250px;
  overflow: visible;
}

.forecast-chart__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 100%;
  min-height: 250px;
  border: 1px dashed #cbd5e1;
  border-radius: 9px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
}

.forecast-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid #c7d2fe;
  border-top-color: #5b36d6;
  border-radius: 50%;
  animation: forecast-spin 0.8s linear infinite;
}

@keyframes forecast-spin { to { transform: rotate(360deg); } }

.forecast-svg__rain-bg { fill: #f5f7fb; }
.forecast-svg__rain-bar { fill: #4b87db; opacity: 0.75; }
.forecast-svg__grid { stroke: #dfe5ef; stroke-width: 1; stroke-dasharray: 3 4; }
.forecast-svg__axis { stroke: #9aa8bc; stroke-width: 1; }
.forecast-svg__label { fill: #64748b; font-size: 11px; font-weight: 700; }
.forecast-svg__title { fill: #334155; font-size: 11px; font-weight: 900; }
.forecast-svg__past-note { fill: #7158bb; font-size: 9px; font-weight: 850; }
.forecast-svg__observed-area { fill: rgba(15, 111, 222, 0.11); }
.forecast-svg__observed { fill: none; stroke: #0f6fde; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.forecast-svg__band { fill: rgba(91, 54, 214, 0.14); stroke: none; }
.forecast-svg__predicted { fill: none; stroke: #5b36d6; stroke-dasharray: 8 6; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.forecast-svg__point { fill: #fff; stroke: #5b36d6; stroke-width: 2.5; }
.forecast-svg__past-band { fill: rgba(139, 116, 224, 0.14); stroke: none; }
.forecast-svg__past-predicted { fill: none; stroke: #8068c9; stroke-dasharray: 4 3; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.2; }
.forecast-svg__now { stroke: #334155; stroke-dasharray: 4 4; stroke-width: 1.5; }
.forecast-svg__now-badge { fill: #334155; }
.forecast-svg__now-text { fill: #fff; font-size: 10px; font-weight: 900; }
.forecast-svg__threshold { stroke-width: 1.5; stroke-dasharray: 5 5; }
.forecast-svg__threshold-label { font-size: 10px; font-weight: 900; }
.forecast-svg__hover-target { pointer-events: none; }
.forecast-svg__interaction { fill: transparent; cursor: crosshair; pointer-events: all; }
.forecast-svg__hover-indicator { pointer-events: none; }
.forecast-svg__hover-indicator line { stroke: #0f6fde; stroke-width: 1.5; stroke-dasharray: 4 3; }
.forecast-svg__hover-indicator circle { fill: #fff; stroke: #0f6fde; stroke-width: 3; }
.forecast-svg__hover-indicator.is-predicted line { stroke: #5b36d6; }
.forecast-svg__hover-indicator.is-predicted circle { stroke: #5b36d6; }
.forecast-svg__hover-indicator.is-past-predicted line { stroke: #8068c9; stroke-dasharray: 2 3; }
.forecast-svg__hover-indicator.is-past-predicted circle { stroke: #8068c9; }

.forecast-chart svg:focus {
  outline: 2px solid rgba(15, 111, 222, 0.65);
  outline-offset: -3px;
}

.forecast-chart__tooltip {
  position: absolute;
  z-index: 5;
  display: grid;
  min-width: 144px;
  max-width: 220px;
  padding: 8px 11px;
  pointer-events: none;
  border: 1px solid #b8c9e7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  color: #172554;
  box-shadow: 0 8px 22px rgba(15, 35, 79, 0.2);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.forecast-chart__tooltip[hidden] { display: none; }
.forecast-chart__tooltip[data-placement="above"] { transform: translate(-50%, -100%); }
.forecast-chart__tooltip[data-placement="below"] { transform: translate(-50%, 0); }
.forecast-chart__tooltip > span { color: #0f6fde; font-size: 0.64rem; font-weight: 950; }
.forecast-chart__tooltip.is-predicted > span { color: #5b36d6; }
.forecast-chart__tooltip.is-past-predicted > span { color: #7158bb; }
.forecast-chart__tooltip > strong { margin-top: 1px; font-size: 1.06rem; font-weight: 950; }
.forecast-chart__tooltip > time { color: #64748b; font-size: 0.65rem; font-weight: 750; }
.forecast-chart__tooltip > small { margin-top: 3px; color: #5b36d6; font-size: 0.62rem; font-weight: 850; }

.forecast-panel__footer {
  max-height: min(390px, 44vh);
  padding: 8px 13px 10px;
  overflow-y: auto;
  border-top: 1px solid #e3e9f3;
  background: #f8fafc;
  scrollbar-width: thin;
}

.forecast-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: #475569;
  font-size: 0.65rem;
  font-weight: 800;
}

.forecast-legend span { display: inline-flex; align-items: center; gap: 5px; }
.forecast-legend__line { width: 21px; border-top: 3px solid #0f6fde; }
.forecast-legend__line--predicted { border-color: #5b36d6; border-top-style: dashed; }
.forecast-legend__line--past { border-color: #8068c9; border-top-width: 2px; border-top-style: dashed; }
.forecast-legend__band { width: 21px; height: 9px; border-radius: 3px; background: rgba(91, 54, 214, 0.18); }
.forecast-legend__band--past { background: rgba(139, 116, 224, 0.14); box-shadow: inset 0 0 0 1px rgba(112, 87, 204, 0.24); }
.forecast-legend__rain { width: 9px; height: 12px; border-radius: 2px 2px 0 0; background: #4b87db; }

.forecast-rationale {
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid #d7def0;
  border-radius: 9px;
  background: #fff;
}

.forecast-rationale > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 10px;
  cursor: pointer;
  color: #24345d;
  list-style: none;
  user-select: none;
}

.forecast-rationale > summary::-webkit-details-marker { display: none; }
.forecast-rationale > summary::before {
  content: "?";
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #ece8ff;
  color: #5b36d6;
  font-size: 0.68rem;
  font-weight: 950;
}

.forecast-rationale > summary::after {
  content: "+";
  margin-left: auto;
  color: #5b36d6;
  font-size: 1rem;
  font-weight: 900;
}

.forecast-rationale[open] > summary::after { content: "−"; }
.forecast-rationale > summary:hover { background: #f8f7ff; }
.forecast-rationale > summary:focus-visible { outline: 2px solid #7c5ce2; outline-offset: -2px; }
.forecast-rationale > summary span { font-size: 0.72rem; font-weight: 950; }
.forecast-rationale > summary small { color: #718096; font-size: 0.63rem; font-weight: 750; }

.forecast-rationale__body {
  padding: 10px;
  border-top: 1px solid #e5e9f3;
  color: #475569;
  font-size: 0.68rem;
  line-height: 1.45;
}

.forecast-rationale__lead {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border-left: 4px solid #5b36d6;
  border-radius: 7px;
  background: linear-gradient(100deg, #f4f1ff, #f4f8ff);
}

.forecast-rationale__lead > span { color: #5b36d6; font-size: 0.62rem; font-weight: 950; }
.forecast-rationale__lead > strong { color: #25345e; font-size: 0.72rem; font-weight: 850; line-height: 1.5; }

.forecast-rationale__signals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.forecast-rationale__signals > span {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid #dde4ef;
  border-radius: 7px;
  background: #fbfcfe;
}

.forecast-rationale__signals small { color: #718096; font-size: 0.57rem; font-weight: 800; }
.forecast-rationale__signals strong { color: #1e3a5f; font-size: 0.74rem; font-variant-numeric: tabular-nums; font-weight: 950; }

.forecast-rationale__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.forecast-rationale__steps article {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px;
  border-radius: 7px;
  background: #f8fafc;
}

.forecast-rationale__steps b {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: #dfeaff;
  color: #0f5fb9;
  font-size: 0.62rem;
}

.forecast-rationale__steps h3 { margin: 0 0 2px; color: #334155; font-size: 0.66rem; }
.forecast-rationale__steps p { margin: 0; color: #64748b; font-size: 0.61rem; font-weight: 650; line-height: 1.45; }

.forecast-rationale__validation {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 9px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #d9e2ef;
  border-radius: 7px;
  background: #f5f9ff;
}

.forecast-rationale__validation > div:first-child { display: grid; align-content: center; }
.forecast-rationale__validation > div:first-child > span { color: #0f6fde; font-size: 0.58rem; font-weight: 950; }
.forecast-rationale__validation > div:first-child > strong { color: #25345e; font-size: 0.69rem; }
.forecast-rationale__validation > div:first-child > small { color: #718096; font-size: 0.56rem; font-weight: 700; }
.forecast-rationale__validation-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.forecast-rationale__validation-cards > span { display: grid; padding: 5px 7px; border-radius: 6px; background: #fff; }
.forecast-rationale__validation-cards small { color: #64748b; font-size: 0.56rem; font-style: normal; font-weight: 800; }
.forecast-rationale__validation-cards strong { color: #172554; font-size: 0.66rem; }
.forecast-rationale__validation-cards em { color: #16803d; font-size: 0.55rem; font-style: normal; font-weight: 850; }

.forecast-rationale__terms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0 0;
}

.forecast-rationale__terms > div { padding: 7px 8px; border-top: 2px solid #c9d4e5; background: #fbfcfe; }
.forecast-rationale__terms dt { color: #334155; font-size: 0.62rem; font-weight: 950; }
.forecast-rationale__terms dd { margin: 2px 0 0; color: #64748b; font-size: 0.59rem; font-weight: 650; }
.forecast-rationale__body .forecast-rationale__limit { margin: 8px 1px 0; color: #92400e; font-size: 0.6rem; font-weight: 700; }

.forecast-evidence-link {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-top: 7px;
  padding: 6px 9px;
  border: 1px solid #cec8f5;
  border-radius: 9px;
  background: linear-gradient(105deg, #f4f1ff 0%, #f8faff 58%, #eef7ff 100%);
  color: #24345d;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.forecast-evidence-link:hover {
  border-color: #8067dc;
  box-shadow: 0 6px 18px rgba(68, 54, 146, 0.13);
  transform: translateY(-1px);
}

.forecast-evidence-link:focus-visible { outline: 2px solid #6d52d9; outline-offset: 2px; }

.forecast-evidence-link__icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #5b36d6, #3156d9);
  color: #fff;
  box-shadow: 0 4px 10px rgba(72, 55, 173, 0.25);
}

.forecast-evidence-link__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.forecast-evidence-link > span:nth-child(2) { display: grid; gap: 1px; min-width: 0; }
.forecast-evidence-link strong { font-size: 0.72rem; font-weight: 950; }
.forecast-evidence-link small { overflow: hidden; color: #64748b; font-size: 0.62rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.forecast-evidence-link__cta { color: #5239b7; font-size: 0.66rem; font-weight: 950; white-space: nowrap; }
.forecast-evidence-link__cta b { font-size: 0.78rem; }

.forecast-panel__footer p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.35;
}

.forecast-panel__footer .forecast-disclaimer { color: #92400e; }

.forecast-tracking {
  --tracking-color: #3760a5;
  --tracking-soft: #eef4ff;
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid #ccd8eb;
  border-radius: 9px;
  background: #fff;
}

.forecast-tracking--on-track { --tracking-color: #16803d; --tracking-soft: #edf9f1; }
.forecast-tracking--off-track { --tracking-color: #c24132; --tracking-soft: #fff1ef; }

.forecast-tracking > summary {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 5px 9px;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(100deg, var(--tracking-soft), #fff 76%);
  user-select: none;
}

.forecast-tracking > summary::-webkit-details-marker { display: none; }
.forecast-tracking > summary::after {
  content: "+";
  color: var(--tracking-color);
  font-size: 1rem;
  font-weight: 950;
  text-align: center;
}

.forecast-tracking[open] > summary::after { content: "−"; }
.forecast-tracking > summary:hover { filter: brightness(0.985); }
.forecast-tracking > summary:focus-visible { outline: 2px solid #5f7fd1; outline-offset: -2px; }

.forecast-tracking__icon {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--tracking-color);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 950;
}

.forecast-tracking__copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.forecast-tracking__copy strong { overflow: hidden; color: #24345d; font-size: 0.72rem; font-weight: 950; text-overflow: ellipsis; white-space: nowrap; }
.forecast-tracking__copy small { overflow: hidden; color: #64748b; font-size: 0.61rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }

.forecast-tracking__grade {
  padding: 4px 7px;
  border-radius: 999px;
  background: #e8eef8;
  color: #50637f;
  font-size: 0.58rem;
  font-weight: 950;
  white-space: nowrap;
}

.forecast-tracking__grade--good { background: #dff6e7; color: #137037; }
.forecast-tracking__grade--caution { background: #fff0cc; color: #a45b00; }
.forecast-tracking__grade--poor { background: #ffe1dd; color: #b42318; }

.forecast-tracking__body {
  display: grid;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid #dde5f1;
  color: #475569;
  font-size: 0.66rem;
}

.forecast-trust {
  display: grid;
  grid-template-columns: minmax(210px, 0.9fr) minmax(0, 1.1fr);
  gap: 8px 12px;
  padding: 9px;
  border: 1px solid #d9e2ef;
  border-left: 4px solid #6882aa;
  border-radius: 8px;
  background: #f8fafc;
}

.forecast-trust--good { border-left-color: #16803d; background: #f3fbf6; }
.forecast-trust--caution { border-left-color: #d97706; background: #fffaf0; }
.forecast-trust--poor { border-left-color: #dc2626; background: #fff5f4; }

.forecast-trust__verdict { display: grid; align-content: center; }
.forecast-trust__verdict > span { color: #64748b; font-size: 0.58rem; font-weight: 900; }
.forecast-trust__verdict > strong { color: #1e3157; font-size: 0.88rem; font-weight: 950; }
.forecast-trust__verdict p { margin: 3px 0 0; color: #53647e; font-size: 0.61rem; font-weight: 700; line-height: 1.45; }

.forecast-trust__metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.forecast-trust__metrics > span {
  display: grid;
  gap: 2px;
  padding: 7px;
  border-radius: 7px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e1e7f0;
}

.forecast-trust__metrics small { color: #718096; font-size: 0.54rem; font-weight: 800; }
.forecast-trust__metrics strong { color: #172554; font-size: 0.72rem; font-variant-numeric: tabular-nums; font-weight: 950; }
.forecast-trust .forecast-trust__backtest { grid-column: 1 / -1; margin: 0; padding-top: 5px; border-top: 1px solid #dde5ef; color: #52637c; font-size: 0.58rem; font-weight: 750; }

.forecast-tracking-progress {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.25fr);
  gap: 7px 12px;
  padding: 9px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #f8fafc;
}

.forecast-tracking-progress--hit { border-color: #b9dfc5; background: #f2fbf5; }
.forecast-tracking-progress--miss { border-color: #f1b9b2; background: #fff5f3; }
.forecast-tracking-progress > div:first-child { display: grid; align-content: center; }
.forecast-tracking-progress > div:first-child span { color: #64748b; font-size: 0.57rem; font-weight: 900; }
.forecast-tracking-progress > div:first-child strong { color: #25345e; font-size: 0.68rem; font-weight: 950; }
.forecast-tracking-progress > p { grid-column: 1 / -1; margin: 0; color: #52637c; font-size: 0.6rem; font-weight: 750; }
.forecast-tracking-progress--hit > p { color: #137037; }
.forecast-tracking-progress--miss > p { color: #b42318; }

.forecast-tracking-progress__values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.forecast-tracking-progress__values > span { display: grid; gap: 1px; padding: 6px 7px; border-radius: 6px; background: #fff; }
.forecast-tracking-progress__values small { color: #718096; font-size: 0.53rem; font-weight: 800; }
.forecast-tracking-progress__values strong { color: #172554; font-size: 0.68rem; font-variant-numeric: tabular-nums; font-weight: 950; }

.forecast-comparison {
  overflow: hidden;
  border: 1px solid #d9e0f2;
  border-radius: 8px;
  background: #fff;
}

.forecast-comparison > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid #e1e6f1;
  background: linear-gradient(100deg, #f4f1ff, #fafcff);
}

.forecast-comparison > header > div { display: grid; }
.forecast-comparison > header strong { color: #2d3363; font-size: 0.7rem; font-weight: 950; }
.forecast-comparison > header small { color: #68758d; font-size: 0.56rem; font-weight: 700; }
.forecast-comparison > header label { display: flex; align-items: center; gap: 6px; color: #59677e; font-size: 0.56rem; font-weight: 850; white-space: nowrap; }
.forecast-comparison > header select { min-width: 210px; height: 28px; padding: 0 25px 0 8px; border: 1px solid #cbd5e6; border-radius: 6px; background: #fff; color: #26365c; font-size: 0.58rem; font-weight: 800; }
.forecast-comparison__headline { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 2px; }
.forecast-comparison__headline > div { display: grid; }
.forecast-comparison__headline > div strong { color: #26365c; font-size: 0.66rem; }
.forecast-comparison__headline > div span { color: #758197; font-size: 0.54rem; font-weight: 700; }
.forecast-comparison__rate { padding: 5px 8px; border-radius: 999px; background: #edf8f1; color: #277443; font-size: 0.55rem; font-weight: 800; white-space: nowrap; }
.forecast-comparison__rate strong { margin-left: 3px; color: #126235; font-size: 0.63rem; }
.forecast-comparison__canvas { padding: 0 6px; }
.forecast-compare-svg { display: block; width: 100%; height: auto; min-height: 210px; }
.forecast-compare-svg__grid { stroke: #dbe3ef; stroke-width: 1; stroke-dasharray: 4 5; }
.forecast-compare-svg__ylabel { fill: #66758d; font-size: 11px; font-weight: 750; text-anchor: end; }
.forecast-compare-svg__xlabel { fill: #637087; font-size: 11px; font-weight: 800; text-anchor: middle; }
.forecast-compare-svg__band { fill: #ddd6fe; fill-opacity: 0.7; }
.forecast-compare-svg__central { fill: none; stroke: #5b36d6; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.forecast-compare-svg__predicted { fill: #fff; stroke: #5b36d6; stroke-width: 3; }
.forecast-compare-svg__actual-line { fill: none; stroke: #16803d; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 7 4; }
.forecast-compare-svg__actual { fill: #16803d; stroke: #fff; stroke-width: 2.5; }
.forecast-compare-svg__actual--miss { fill: #dc2626; }
.forecast-compare-svg__badge { fill: #5941bc; font-size: 11px; font-weight: 900; }
.forecast-comparison__legend { display: flex; flex-wrap: wrap; gap: 7px 14px; padding: 3px 10px 8px; color: #59677e; font-size: 0.55rem; font-weight: 800; }
.forecast-comparison__legend span { display: inline-flex; align-items: center; gap: 5px; }
.forecast-comparison__key { display: inline-block; width: 19px; height: 3px; border-radius: 4px; background: #5b36d6; }
.forecast-comparison__key--band { height: 9px; background: #ddd6fe; }
.forecast-comparison__key--actual { border-top: 2px dashed #16803d; background: transparent; }
.forecast-comparison__dot { width: 8px; height: 8px; border-radius: 50%; background: #16803d; }
.forecast-comparison__dot--miss { background: #dc2626; }
.forecast-comparison__results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 9px 9px; }
.forecast-comparison-result { display: grid; gap: 3px; padding: 7px; border: 1px solid #dce4ef; border-top: 3px solid #8a94a6; border-radius: 7px; background: #fafcff; }
.forecast-comparison-result--hit { border-top-color: #16803d; background: #f4fbf6; }
.forecast-comparison-result--miss { border-top-color: #dc2626; background: #fff6f5; }
.forecast-comparison-result--pending { border-top-color: #7c63dc; }
.forecast-comparison-result header { display: flex; justify-content: space-between; gap: 5px; }
.forecast-comparison-result header strong { color: #4432a4; font-size: 0.61rem; }
.forecast-comparison-result header span { color: #65738a; font-size: 0.52rem; font-weight: 850; }
.forecast-comparison-result--hit header span { color: #137037; }
.forecast-comparison-result--miss header span { color: #b42318; }
.forecast-comparison-result p { display: flex; justify-content: space-between; gap: 6px; margin: 0; color: #6c788d; font-size: 0.54rem; font-weight: 750; }
.forecast-comparison-result p strong { color: #26365c; font-variant-numeric: tabular-nums; font-weight: 950; }
.forecast-comparison__probability-note { margin: 0; padding: 8px 10px; border-top: 1px solid #e1e6f1; background: #fffaf0; color: #74551b; font-size: 0.56rem; font-weight: 700; line-height: 1.45; }
.forecast-comparison__probability-note strong { color: #9a5b00; }
.forecast-comparison__empty { padding: 22px; color: #718096; font-size: 0.62rem; font-weight: 750; text-align: center; }

.forecast-history {
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.forecast-history > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-bottom: 1px solid #dbe3ef;
  background: #f3f6fb;
}

.forecast-history > header > div { display: grid; }
.forecast-history > header strong { color: #25345e; font-size: 0.68rem; font-weight: 950; }
.forecast-history > header small { color: #718096; font-size: 0.56rem; font-weight: 700; }
.forecast-history > header > span { color: #64748b; font-size: 0.55rem; font-weight: 850; white-space: nowrap; }
.forecast-history__list { display: grid; gap: 7px; max-height: 310px; padding: 7px; overflow-y: auto; scrollbar-width: thin; }
.forecast-history__empty { padding: 16px; color: #718096; font-size: 0.63rem; font-weight: 750; text-align: center; }

.forecast-history-record {
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
  background: #fff;
}

.forecast-history-record > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #e4e9f1;
  background: #fafcff;
}

.forecast-history-record > header > div { display: grid; }
.forecast-history-record > header strong { color: #25345e; font-size: 0.64rem; font-weight: 950; }
.forecast-history-record > header small { color: #718096; font-size: 0.53rem; font-weight: 700; }
.forecast-history-record > header > span { padding: 3px 5px; border-radius: 5px; background: #edf3fc; color: #4f6380; font-size: 0.53rem; font-weight: 850; white-space: nowrap; }

.forecast-history-record__points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: #e4e9f1;
}

.forecast-history-point { display: grid; gap: 3px; min-width: 0; padding: 7px; background: #fff; }
.forecast-history-point__head { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.forecast-history-point__head strong { color: #5b36d6; font-size: 0.61rem; font-weight: 950; }
.forecast-history-point__head time { color: #64748b; font-size: 0.54rem; font-weight: 800; }
.forecast-history-point > p { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0; font-size: 0.56rem; }
.forecast-history-point > p span { color: #718096; font-weight: 750; }
.forecast-history-point > p strong { color: #24345d; font-variant-numeric: tabular-nums; font-weight: 950; }

.forecast-history-point__result {
  display: grid;
  gap: 1px;
  margin-top: 2px;
  padding: 5px 6px;
  border-radius: 5px;
  background: #f1f5f9;
}

.forecast-history-point__result strong { color: #475569; font-size: 0.58rem; }
.forecast-history-point__result span { color: #64748b; font-size: 0.51rem; font-weight: 750; }
.forecast-history-point__result--hit { background: #eaf8ef; }
.forecast-history-point__result--hit strong,
.forecast-history-point__result--hit span { color: #137037; }
.forecast-history-point__result--miss { background: #fff0ee; }
.forecast-history-point__result--miss strong,
.forecast-history-point__result--miss span { color: #b42318; }
.forecast-history-point__result--pending { background: #f2efff; }
.forecast-history-point__result--pending strong { color: #5b36d6; }
.forecast-history-point__result--missing { background: #f1f5f9; opacity: 0.8; }
.forecast-tracking__body .forecast-tracking__note { margin: 0 2px; color: #64748b; font-size: 0.56rem; font-weight: 700; line-height: 1.4; }

@media (max-width: 1450px) {
  .topbar {
    grid-template-columns: minmax(325px, 1fr) auto minmax(510px, 1fr);
    gap: 11px;
    padding-inline: 12px;
  }

  .brand__mark,
  .auto-control--toggle {
    display: none;
  }

  .topbar__actions { gap: 7px; }

  .page--four-panels .section__tools p { display: none; }

  .section__forecast-action {
    justify-content: center;
    padding-inline: 4px;
  }

  .section__forecast-action .forecast-toggle {
    gap: 5px;
    padding-inline: 8px;
    font-size: 0.69rem;
  }

  .section__forecast-action .forecast-toggle small { display: none; }

  .page--four-panels .source-link {
    height: 26px;
    padding: 0 7px;
  }

  .page--four-panels .record-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(170px, 0.65fr);
  }

  .forecast-panel {
    width: min(920px, calc(100vw - 28px));
  }
}

@media (max-width: 760px) {
  .forecast-panel {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .forecast-panel__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 10px;
    padding: 11px 12px;
  }

  .forecast-panel__header > div:first-child {
    min-width: 0;
  }

  .forecast-panel__eyebrow,
  .forecast-panel__header h2,
  .forecast-panel__header p {
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .forecast-panel__header p {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .forecast-panel__actions {
    width: auto;
    align-self: center;
    justify-content: flex-end;
  }

  .forecast-status {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px 8px;
    padding: 8px 12px;
  }

  .forecast-status > span:last-child {
    grid-column: 2;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .forecast-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 9px 10px 5px;
  }

  .forecast-metric {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 74px;
    padding: 8px 9px;
  }

  .forecast-metric > span,
  .forecast-metric > strong {
    min-width: 0;
    white-space: nowrap;
    word-break: keep-all;
  }

  .forecast-metric > strong {
    font-size: clamp(1rem, 5.2vw, 1.18rem);
  }

  .forecast-metric > small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .forecast-chart {
    height: clamp(250px, 68vw, 360px);
    min-height: 250px;
    padding: 2px 6px 4px;
  }

  .forecast-chart svg {
    height: 100%;
    min-height: 0;
  }

  .forecast-panel__footer {
    max-height: none;
    overflow: visible;
    padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
  }

  .forecast-legend {
    gap: 9px 11px;
    line-height: 1.35;
  }

  .forecast-legend span {
    min-width: 0;
    white-space: normal;
    word-break: keep-all;
  }

  .forecast-evidence-link {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 9px;
  }

  .forecast-evidence-link strong,
  .forecast-evidence-link small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .forecast-evidence-link__cta {
    grid-column: 2;
    white-space: normal;
    word-break: keep-all;
  }

  .forecast-panel__footer p {
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .forecast-rationale > summary small { display: none; }
  .forecast-rationale__signals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .forecast-rationale__steps,
  .forecast-rationale__terms { grid-template-columns: 1fr; }
  .forecast-rationale__validation { grid-template-columns: 1fr; }
  .forecast-tracking > summary { grid-template-columns: 24px minmax(0, 1fr) 18px; }
  .forecast-tracking__grade { display: none; }
  .forecast-trust,
  .forecast-tracking-progress { grid-template-columns: 1fr; }
  .forecast-trust__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .forecast-tracking-progress__values,
  .forecast-history-record__points { grid-template-columns: 1fr; }
  .forecast-comparison > header,
  .forecast-comparison__headline { align-items: stretch; flex-direction: column; }
  .forecast-comparison > header label { justify-content: space-between; }
  .forecast-comparison > header select { min-width: 0; width: 70%; }
  .forecast-comparison__results { grid-template-columns: 1fr; }
}

/* Web app: phone and small-tablet layouts */
@media (max-width: 1024px) {
  body {
    min-width: 0;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
    overscroll-behavior-y: contain;
  }

  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand tabs"
      "actions actions";
    gap: 8px 10px;
    height: auto;
    min-height: 58px;
    padding: 8px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  }

  .brand {
    grid-area: brand;
    grid-column: auto;
  }

  .brand__mark {
    display: grid;
    width: 32px;
    height: 32px;
  }

  .topbar h1 { font-size: 0.9rem; }
  .topbar p { display: none; }

  .view-tabs {
    position: static;
    grid-area: tabs;
    left: auto;
    transform: none;
  }

  .view-tabs a {
    min-width: 54px;
    height: 36px;
    padding: 0 10px;
  }

  .topbar__actions {
    grid-area: actions;
    grid-column: auto;
    justify-self: stretch;
    justify-content: flex-start;
    width: 100%;
    padding-bottom: 1px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar__actions::-webkit-scrollbar { display: none; }
  .auto-control { min-width: max-content; }
  .auto-control--toggle,
  .countdown-pill,
  .ghost-btn { display: none; }

  .primary-btn,
  .notification-btn {
    min-width: 44px;
    min-height: 40px;
  }

  .page--four-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(330px, auto));
    height: auto;
    min-height: calc(100dvh - 104px);
    padding: 8px max(8px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: visible;
  }

  .page--four-panels .section {
    min-height: 330px;
    overflow: hidden;
  }

  .page--four-panels .section__header {
    flex-wrap: wrap;
    min-height: 64px;
    gap: 7px;
  }

  .page--four-panels .section__tools {
    max-width: 100%;
    justify-content: flex-start;
  }

  .page--four-panels .status-board {
    overflow-y: auto;
  }

  .status-group__metrics {
    gap: 7px;
  }

  .status-metric {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 8px;
  }

  .status-metric__marker {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .status-metric__badge {
    display: none;
  }

  .record-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(220px, 1fr) minmax(130px, 0.55fr);
  }

  .bottom-panel,
  .bottom-panel > .section {
    min-height: 330px;
  }

  /* 모바일에서는 핵심 수위 그래프만 남기고 상세 관측 표는 생략합니다. */
  .section--water .record-layout {
    display: block;
    padding: 6px;
  }

  .section--water .chart-panel {
    width: 100%;
    height: 100%;
  }

  .section--water .table-panel {
    display: none;
  }

  /* 댐 선택 시에도 모바일에서는 그래프만 표시합니다. */
  .section--dam .record-layout {
    display: block;
    padding: 6px;
  }

  .section--dam .chart-panel {
    width: 100%;
    height: 100%;
  }

  .section--dam .table-panel {
    display: none;
  }

  .forecast-panel {
    inset: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    width: auto;
    max-height: none;
    border-radius: 11px;
  }

  .forecast-panel__header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .forecast-panel__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .brand__mark { display: none; }
  .topbar h1 {
    max-width: 190px;
    font-size: 0.82rem;
  }

  .topbar__actions .auto-control,
  .topbar__actions .ghost-btn {
    display: none;
  }

  .page--four-panels {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "trend"
      "weather"
      "water"
      "bottom";
    gap: 9px;
  }

  .page--four-panels .section--status { min-height: 390px; }
  .page--four-panels .section--weather { min-height: 365px; }
  .page--four-panels .section--water { min-height: 390px; }
  .bottom-panel,
  .bottom-panel > .section { min-height: 390px; }

  .page--four-panels .section__header {
    align-items: flex-start;
    min-height: 56px;
    padding-block: 7px;
  }

  .page--four-panels .section--water .section__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px 8px;
  }

  .page--four-panels .section--water .section__header > div:first-child {
    min-width: 0;
  }

  .page--four-panels .section--water .section__header h2 {
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .page--four-panels .section--water .section__tools {
    grid-column: 1 / -1;
    max-width: 100%;
  }

  .forecast-panel__header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .forecast-panel__actions {
    width: auto;
  }

  .page--four-panels .status-board {
    grid-template-rows: auto auto;
    gap: 6px;
    padding: 7px 8px;
  }

  .status-group__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .status-group {
    gap: 5px;
    padding: 7px;
  }

  .status-group__heading {
    min-height: 19px;
  }

  .status-group__heading strong {
    font-size: 0.78rem;
  }

  .status-group__heading span {
    padding: 2px 5px;
    font-size: 0.6rem;
  }

  .status-metric {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 72px;
    column-gap: 6px;
    padding: 7px 6px;
  }

  .status-metric__marker {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }

  .status-metric__label {
    font-size: 0.67rem;
    white-space: normal;
  }

  .status-metric__value {
    font-size: 1.12rem;
  }

  .page--four-panels .status-note {
    margin: 0 8px 7px;
    padding: 5px 7px;
    font-size: 0.63rem;
  }

  .status-note {
    white-space: normal;
  }

  .section__forecast-action {
    justify-content: flex-end;
    padding: 0;
  }

  .section__forecast-action .forecast-toggle {
    max-width: 100%;
    height: 32px;
    padding-inline: 8px;
    font-size: clamp(0.64rem, 3.1vw, 0.72rem);
  }

  .latest-water {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .weather-detail {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .weather-detail__col {
    min-width: 68px;
  }

  .tide-headline {
    gap: 7px;
    padding-inline: 9px;
  }

  .tide-headline span:first-child { font-size: 0.9rem; }
  .tide-headline strong { font-size: 1.18rem; }
  .tide-headline span:last-child { font-size: 0.68rem; }

  .notification-panel {
    position: fixed;
    inset: 102px 8px auto;
    width: auto;
    max-height: calc(100dvh - 116px);
  }
}

@media (max-width: 360px) {
  .forecast-panel__header {
    grid-template-columns: minmax(0, 1fr);
  }

  .forecast-panel__actions {
    width: 100%;
  }

  .forecast-metric {
    grid-template-columns: minmax(0, 1fr);
  }

  .forecast-metric > strong {
    justify-self: start;
    margin-top: 2px;
  }
}

@media (max-width: 1024px) and (orientation: landscape) {
  .topbar {
    grid-template-columns: minmax(220px, 1fr) auto auto;
    grid-template-areas: "brand tabs actions";
    min-height: 54px;
    padding-block: 6px;
  }

  .topbar__actions {
    justify-self: end;
    width: auto;
  }

  .topbar__actions .auto-control,
  .topbar__actions .countdown-pill,
  .topbar__actions .ghost-btn {
    display: none;
  }

  .page--four-panels {
    min-height: calc(100dvh - 54px);
    grid-template-rows: repeat(2, minmax(300px, auto));
  }

  .page--four-panels .section,
  .bottom-panel,
  .bottom-panel > .section {
    min-height: 300px;
  }
}

/* Mobile top bar and compact latest-water summary */
@media (max-width: 1024px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand actions";
    gap: 8px;
    height: 58px;
    min-height: 58px;
    padding-block: 0;
  }

  .title-desktop {
    display: none;
  }

  .title-mobile {
    display: inline;
  }

  .brand {
    grid-area: brand;
  }

  .brand__mark {
    display: none;
  }

  .topbar h1 {
    max-width: 110px;
    font-size: 0.8rem;
  }

  .view-tabs {
    position: absolute;
    left: 50%;
    grid-area: auto;
    transform: translateX(-50%);
  }

  .topbar__actions {
    grid-area: actions;
    justify-self: end;
    width: auto;
    padding: 0;
    overflow: visible;
  }

  .topbar__actions > * {
    display: none !important;
  }

  .topbar__actions #refresh-btn {
    display: inline-flex !important;
    width: auto;
    min-width: 68px;
    height: 40px;
    padding: 0 9px;
    border-radius: 8px;
    font-size: 0.7rem;
  }

  .page--four-panels {
    min-height: calc(100dvh - 58px);
  }

  .section--water .chart-panel--water {
    grid-template-rows: 82px minmax(0, 1fr);
  }

  .section--water .latest-water {
    display: grid;
    grid-template-columns: minmax(74px, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
  }

  .latest-water__meta {
    overflow: hidden;
  }

  .latest-water__meta > span {
    overflow: hidden;
    font-size: 0.66rem;
    text-overflow: ellipsis;
  }

  .latest-water__meta time {
    gap: 4px;
  }

  .latest-water__clock,
  .latest-water__reading strong {
    font-size: clamp(1.25rem, 5vw, 1.72rem);
    letter-spacing: -0.04em;
  }

  .latest-water__basis,
  .latest-water__reading span {
    font-size: 0.68rem;
  }

  .main-forecast-stepper {
    min-width: 84px;
    gap: 2px 4px;
    padding: 3px 4px;
  }

  .main-forecast-stepper > span {
    font-size: 0.5rem;
  }

  .main-forecast-stepper > div {
    grid-template-columns: 19px minmax(32px, auto) 19px;
  }

  .main-forecast-stepper button {
    width: 19px;
    height: 20px;
  }

  .main-forecast-stepper strong {
    font-size: 0.56rem;
  }

  .main-forecast-stepper > small {
    padding: 2px 4px;
    font-size: 0.46rem;
  }
}

@media (max-width: 360px) {
  .topbar h1 {
    max-width: 90px;
    font-size: 0.72rem;
  }

  .view-tabs a {
    min-width: 45px;
    padding-inline: 6px;
  }

  .topbar__actions #refresh-btn {
    min-width: 58px;
    padding-inline: 6px;
    font-size: 0.64rem;
  }

  .section--water .latest-water {
    grid-template-columns: minmax(68px, 1fr) auto;
  }

  .section--water .main-forecast-stepper {
    display: none;
  }
}
