:root {
  --ink: #14212b;
  --muted: #64717d;
  --paper: #f5f7f9;
  --panel: #ffffff;
  --line: #d7dfe6;
  --blue: #1d5f84;
  --green: #1f8a5b;
  --yellow: #f4c430;
  --orange: #e67e22;
  --amber: #c7771d;
  --red: #be3d36;
  --shadow: 0 14px 34px rgba(20, 33, 43, 0.09);

  /* ITD EMU brand identity */
  --brand-navy: #17324d;
  --brand-navy-2: #234965;
  --brand-teal: #2e7186;
  --brand-amber: #e7b95e;
}

.pagasa-alert-banner {
  position: sticky;
  top: 0;
  z-index: 2000;
  background: linear-gradient(90deg, #8f1f1f, #be3d36 55%, #8f1f1f);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  animation: pagasaAlertSlideDown 0.35s ease-out;
}

.pagasa-alert-banner.watch {
  background: linear-gradient(90deg, #8a5410, #c7771d 55%, #8a5410);
}

@keyframes pagasaAlertSlideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.pagasa-alert-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 44px);
  padding-left: max(clamp(16px, 4vw, 44px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 44px), env(safe-area-inset-right));
}

.pagasa-alert-badge {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.pagasa-alert-body {
  flex: 1 1 260px;
  min-width: 0;
}

.pagasa-alert-body strong {
  display: block;
  font-size: 0.95rem;
}

.pagasa-alert-body p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  opacity: 0.92;
}

.pagasa-alert-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.pagasa-alert-actions .button {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.pagasa-alert-actions .button.primary {
  background: #fff;
  color: #8f1f1f;
  border-color: #fff;
  font-weight: 800;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(16px, 4vw, 44px);
  padding-left: max(clamp(16px, 4vw, 44px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 44px), env(safe-area-inset-right));
  padding-top: max(20px, env(safe-area-inset-top));
  color: #fff;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-navy-2) 55%, var(--brand-teal));
}

.hub-link {
  position: absolute;
  top: 10px;
  left: clamp(16px, 4vw, 44px);
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  opacity: 0.75;
}

.hub-link:hover {
  opacity: 1;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px clamp(16px, 4vw, 44px) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.68rem;
}

.app-footer .footer-sep {
  opacity: 0.4;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: "Libre Franklin", "DM Sans", sans-serif;
  font-weight: 800;
  font-size: clamp(1.4rem, 2.4vw, 2.15rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 5px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.74;
}

.header-actions,
.panel-title,
.alarm-head,
.button-row,
.inline-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.lang-btn {
  min-height: 30px;
  border: none;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.lang-btn:hover {
  color: #fff;
}

.lang-btn.active {
  color: #17324d;
  background: #fff;
}

.online-now-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  min-height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.online-now-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 rgba(61, 220, 132, 0.6);
  animation: onlineNowPulse 2s infinite;
}

@keyframes onlineNowPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(61, 220, 132, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0);
  }
}

.button {
  min-height: 40px;
  border: 1px solid rgba(20, 33, 43, 0.18);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.button.small {
  min-height: 34px;
  padding-inline: 12px;
}

.button.small.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.day-selector {
  margin: 10px 0 12px;
  justify-content: flex-start;
}

.shell {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(430px, 1.45fr);
  align-items: start;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 44px) 42px;
  padding-left: max(clamp(16px, 4vw, 44px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 44px), env(safe-area-inset-right));
  padding-bottom: max(42px, calc(env(safe-area-inset-bottom) + 24px));
}

.shell > * {
  min-width: 0;
}

.control-panel,
.source-panel,
.pagasa-panel,
.typhoon-panel,
.advisory-panel,
.alignment-panel,
.history-panel,
.rules-panel,
.site-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.panel-block,
.source-panel,
.pagasa-panel,
.typhoon-panel,
.advisory-panel,
.alignment-panel,
.history-panel,
.rules-panel,
.forecast-card {
  padding: 16px;
}

.line-panel {
  border: 1px solid rgba(31, 138, 91, 0.28);
  border-radius: 8px;
  background: #f5fbf7;
}

.line-panel p {
  margin-bottom: 0;
  line-height: 1.45;
}

.line-pin-gate {
  display: flex;
  align-items: center;
  gap: 10px;
}

.line-pin-gate input {
  max-width: 140px;
  letter-spacing: 0.3em;
  text-align: center;
}

#linePinError {
  color: #b3261e;
  font-weight: 700;
}

.line-unlocked-body .panel-title {
  margin-bottom: 8px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fbfcfd;
}

.coord-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.72fr;
  gap: 10px;
  margin-block: 12px;
}

/* Native <details> disclosure for the rarely-used KMZ/quick-lookup block —
   collapsed by default so it stops eating the .control-panel's fixed
   480px height budget. Everything below reuses .panel-block's own 16px
   padding; only the <summary> toggle affordance is custom-styled. */
.collapsible-summary {
  cursor: pointer;
  font-weight: 750;
  font-size: 0.85rem;
  color: var(--muted);
  list-style: none;
}

.collapsible-summary::-webkit-details-marker {
  display: none;
}

.collapsible-summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  transition: transform 0.15s ease;
}

.collapsible-panel[open] .collapsible-summary::before {
  transform: rotate(90deg);
}

.collapsible-panel[open] .collapsible-summary {
  display: block;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* Vertical table, all remaining hours of today at once — a fixed max-height
   with its own scroll (not the .control-panel's 480px column scroll) keeps
   the rest of the sidebar (the collapsed disclosure, the message box)
   reachable without having to scroll past two dozen hourly rows first. */
.hourly-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.hourly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.hourly-table th,
.hourly-table td {
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.hourly-table th {
  position: sticky;
  top: 0;
  background: #f8fafb;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 1;
}

.hourly-table tbody tr:hover {
  background: #fbfcfd;
}

.hourly-table tbody tr:last-child td {
  border-bottom: none;
}

.hourly-cell-time {
  font-weight: 700;
}

.hourly-emoji {
  font-size: 1.05rem;
  line-height: 1;
  margin-right: 2px;
}

.hourly-cell-precip {
  color: var(--blue);
}

.hourly-footnote {
  margin-top: 4px;
  font-size: 0.76rem;
}

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

.schedule-item {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafb;
}

.schedule-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.forecast-card {
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
}

.forecast-card.dry {
  background: var(--green);
}

.forecast-card.light {
  color: var(--ink);
  background: #56945b;
}

.forecast-card.moderate {
  color: var(--ink);
  background: #56945b;
}

.forecast-card.heavy {
  color: var(--ink);
  background: var(--yellow);
}

.forecast-card.intense {
  color: var(--ink);
  background: var(--orange);
}

.forecast-card.torrential {
  background: var(--red);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #fff;
  background: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.badge.watch {
  background: var(--green);
}

.badge.dry {
  background: var(--green);
}

/* Neutral state for unavailable/unverified official data — never green.
   A failed fetch or unknown alarm must read as "needs checking", not "clear"
   (P1-4). Uses the muted grey so it is visually distinct from dry/watch. */
.badge.unknown,
.badge.verify {
  background: var(--muted);
}

.badge.light {
  color: var(--ink);
  background: #56945b;
}

.badge.moderate {
  color: var(--ink);
  background: #56945b;
}

.badge.heavy {
  color: var(--ink);
  background: var(--yellow);
}

.badge.intense {
  color: var(--ink);
  background: var(--orange);
}

.badge.torrential {
  background: var(--red);
}

.badge.caution {
  background: var(--amber);
}

.badge.stop {
  background: var(--red);
}

/* Site weather chatbot */
/* Chain 2026-07-12: the chat lives at the TOP of both pages so everyone
   sees they can ask — green brand border + soft glow + pulsing live dot
   to catch the eye without screaming like an alert banner. */
/* section.chat-panel (not bare .chat-panel): public.html's own <style>
   block declares .public-panel AFTER this sheet loads, so an equal-
   specificity .chat-panel would lose its border/background there. */
section.chat-panel {
  border: 2px solid var(--green);
  background: linear-gradient(135deg, #f2fbf6 0%, #eef6fc 100%);
  box-shadow: 0 4px 18px rgba(31, 138, 91, 0.16);
}
.chat-panel .eyebrow {
  color: var(--green);
  font-weight: 800;
}
.chat-live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3ddc84;
  margin-right: 6px;
  animation: onlineNowPulse 2s infinite;
}
@media (prefers-reduced-motion: reduce) {
  .chat-live-dot {
    animation: none;
  }
}
.chat-thread {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  max-height: 320px;
  overflow-y: auto;
}
.chat-thread:empty {
  display: none;
}
.chat-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
  max-width: 85%;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.user {
  justify-self: end;
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg.ai {
  justify-self: start;
  background: #eef3f7;
  color: inherit;
  border: 1px solid var(--line);
  border-bottom-left-radius: 3px;
}
.chat-msg.ai.pending {
  color: var(--muted);
  font-style: italic;
}
.chat-input-row {
  display: flex;
  gap: 8px;
}
.chat-input-row input {
  flex: 1;
  min-width: 0;
}

/* 7-day forecast day cards are only ~90px wide, but weather descriptions
   like "Thunderstorm with hail" are too long for the shared .badge's
   nowrap — let them wrap onto a second line instead of spilling into the
   neighboring card. Chain caught this 2026-07-12. */
.forecast-day-card .badge {
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  padding: 4px 8px;
}

#messageBox {
  min-height: 185px;
  margin-top: 12px;
  resize: vertical;
  line-height: 1.45;
}

.map-panel {
  position: relative;
  min-height: 480px;
  max-height: 90vh;
  overflow: hidden;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dce6eb;
  box-shadow: var(--shadow);
}

#map {
  min-height: 480px;
  height: 100%;
}

.map-toolbar-stack {
  position: absolute;
  z-index: 500;
  right: 14px;
  top: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: calc(100% - 28px);
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}

.map-layer-switcher {
  position: absolute;
  z-index: 700;
  left: 54px;
  top: 14px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.map-layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #52606d;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.map-layer-toggle:hover,
.map-layer-toggle:focus-visible {
  color: var(--ink);
  border-color: #9fb3c3;
  outline: none;
}

.map-layer-toggle.active {
  color: #102a43;
  border-color: #8ba6bb;
  background: #edf5fa;
  box-shadow: 0 1px 2px rgba(15, 35, 50, 0.16);
}

.map-layer-symbol {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-sizing: border-box;
}

.map-layer-symbol.forecast {
  border: 2px solid #2e8b57;
  background: rgba(46, 139, 87, 0.18);
}

.map-layer-symbol.live {
  border: 2px solid #fff;
  background: #d32f2f;
  box-shadow: 0 0 0 1px #a91f1f;
}

.map-live-count {
  min-width: 19px;
  padding: 1px 5px;
  border-radius: 999px;
  color: #fff;
  background: #263238;
  font-size: 0.68rem;
  line-height: 1.35;
  text-align: center;
}

/* Ground-observation markers live in Leaflet's z=690 pane. The pin center is
   the station's exact latitude/longitude; the label extends right so the
   coordinate itself stays visually unambiguous. */
.live-observation-icon {
  border: 0;
  background: transparent;
}

.live-station-marker {
  position: relative;
  display: flex;
  align-items: center;
  min-width: max-content;
  height: 34px;
  filter: drop-shadow(0 2px 3px rgba(9, 24, 35, 0.38));
}

.live-station-pin {
  position: relative;
  z-index: 2;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--live-band);
  box-shadow: 0 0 0 2px #23313d;
}

.live-station-copy {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: -2px;
  padding: 2px 5px 2px 6px;
  border: 1.5px solid var(--live-band);
  border-left-width: 4px;
  border-radius: 0 5px 5px 0;
  color: #13212c;
  background: rgba(255, 255, 255, 0.97);
  white-space: nowrap;
  font-size: 0.58rem;
  line-height: 1;
}

.live-station-copy strong {
  color: #b71c1c;
  font-size: 0.52rem;
  letter-spacing: 0.06em;
}

.live-station-copy span {
  font-weight: 800;
}

.live-station-marker.strong .live-station-pin {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  box-shadow: 0 0 0 2px #1f2933, 0 0 0 5px rgba(255, 255, 255, 0.82);
}

.live-station-marker.strong .live-station-copy {
  padding-block: 3px;
  border-width: 2px 2px 2px 5px;
  font-size: 0.64rem;
}

.live-station-marker.strong .live-station-copy strong {
  font-size: 0.58rem;
}

.map-legend-stack {
  position: absolute;
  z-index: 500;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: calc(100% - 28px);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  max-width: 100%;
  padding: 6px 8px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  font-size: 0.7rem;
  line-height: 1.3;
}

/* The legend + corridor-strip are reference info, not controls — on a small
   map (phone) they can stack up and cover most of the tiles, so wrap them
   in a native <details> the crew can collapse. Desktop starts open (the
   `open` attribute in the HTML) since there's room to spare there; JS
   closes it by default on narrow screens only, on load (Chain, iPhone
   screenshot 2026-08-01 — the legend was covering nearly the whole map). */
.map-legend-toggle {
  max-width: 100%;
}

.map-legend-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.map-legend-summary::-webkit-details-marker {
  display: none;
}

.map-legend-summary::before {
  content: "▸";
  font-size: 0.62rem;
  transition: transform 0.15s ease;
}

.map-legend-toggle[open] .map-legend-summary::before {
  transform: rotate(90deg);
}

/* The corridor-radar strip's per-area breakdown (e.g. "A1 -- . A5 4 . A2 4 ...")
   reads as a wall of text at full toolbar width — cap it narrow so it wraps
   into a short, scannable block instead of one long cluttered line. */
#radarCorridorStrip.corridor-strip {
  max-width: 230px;
  padding: 6px 8px;
  font-size: 0.64rem;
  line-height: 1.35;
  white-space: normal;
}

.legend-group-label {
  font-weight: 600;
  color: var(--muted, #64748b);
  margin-right: 2px;
}
.legend-group-label:not(:first-child) {
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border: 1px solid #53606b;
  border-radius: 50%;
  box-sizing: border-box;
}

.legend-dot.dry {
  background: #90a4ae;
}

.legend-dot.light {
  background: #7ec98f;
}

.legend-dot.moderate {
  background: #2e8b57;
}

.legend-dot.heavy {
  background: var(--yellow);
}

.legend-dot.intense {
  background: var(--orange);
}

.legend-dot.torrential {
  background: #d32f2f;
}

.legend-line {
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 4px;
  border-radius: 99px;
  background: #263238;
}

.legend-line.typhoon {
  background: #7a2ed6;
}

.legend-ring {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  vertical-align: -1px;
}

.legend-ring.solid {
  border: 2px solid #1f8ac9;
}

.legend-ring.dashed {
  border: 2px dashed #1f8ac9;
}

.legend-dot.radar {
  background: #1f8ac9;
  opacity: 0.75;
}

.legend-dot.live-station {
  border: 2px solid #fff;
  background: #d32f2f;
  box-shadow: 0 0 0 1px #263238;
}

.site-grid,
.rain-ops-panel,
.outlook-panel,
.wind-panel,
.habagat-panel,
.alignment-panel,
.source-panel,
.pagasa-panel,
.typhoon-panel,
.advisory-panel,
.history-panel,
.rules-panel {
  grid-column: 1 / -1;
}

/* Chain 2026-07-12: the monthly rainfall/wind history chart reused
   .typhoon-panel's full-width span but only needed half the screen; the
   Visitors card then left a blank half-row below it. On desktop the two
   now share one row — History in column 1, Site Usage beside it in
   column 2. Below 1080px both fall back to full width so the daily bars
   stay legible on a phone. Scoped under .shell: public.html also has a
   .visit-panel, and unscoped this forced it into column 2 there, growing
   an implicit second column in the public page's one-column grid. */
@media (min-width: 1081px) {
  .shell .history-chart-panel {
    grid-column: 1;
  }
  .shell .visit-panel {
    grid-column: 2;
  }
}

/* control-panel and map-panel share row 1's two columns. A shared grid row
   always sizes to its tallest item regardless of align-items, and the
   control column is routinely much taller than the compact map — so
   either stacking wastes the map's whole side (blank strip beside a
   narrower control panel) or leaving them side by side leaves a gap below
   the shorter map. Capping control-panel's own height to match the map's
   and scrolling its overflow internally keeps both compact, side by side,
   with no dead space either direction. */
.control-panel {
  max-height: 480px;
  overflow-y: auto;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.site-card {
  padding: 16px;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafb;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.recommendation,
.muted {
  color: var(--muted);
}

.recommendation {
  margin-bottom: 0;
  line-height: 1.5;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.source-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: inherit;
  background: #f8fafb;
  text-decoration: none;
}

.source-card strong {
  color: var(--blue);
}

.source-card span {
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
}

.alignment-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.alignment-table th,
.alignment-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
}

.alignment-table th {
  color: var(--muted);
  background: #f8fafb;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.alignment-table tbody tr:hover {
  background: #fbfcfd;
}

.table-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.table-pill.dry {
  background: var(--green);
}

.table-pill.light {
  color: var(--ink);
  background: #56945b;
}

.table-pill.moderate {
  color: var(--ink);
  background: #56945b;
}

.table-pill.heavy {
  color: var(--ink);
  background: var(--yellow);
}

.table-pill.intense {
  color: var(--ink);
  background: var(--orange);
}

.table-pill.torrential {
  background: var(--red);
}

.claim-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.claim-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
}

.claim-file:hover {
  border-color: var(--brand-teal);
  background: #fff;
}

.claim-file-arrow {
  color: var(--brand-teal);
  font-weight: 800;
}

.map-label {
  width: max-content !important;
  height: auto !important;
  border: 1px solid rgba(20, 33, 43, 0.18);
  border-radius: 5px;
  padding: 3px 7px;
  color: #14212b;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 16px rgba(20, 33, 43, 0.16);
  font-size: 0.74rem;
  font-weight: 850;
  white-space: nowrap;
}

.station-label {
  color: #1d5f84;
}

.start-label,
.end-label {
  color: #111827;
}

.pagasa-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.pagasa-card {
  display: grid;
  gap: 7px;
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: inherit;
  background: #f8fafb;
  text-decoration: none;
}

.pagasa-card strong {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.pagasa-card span,
.pagasa-card small {
  color: var(--muted);
}

.outlook-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.outlook-interval-selector {
  margin-top: 12px;
  justify-content: flex-start;
}

.visit-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.visit-chart-meta {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.visit-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 130px;
  margin-top: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.visit-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  position: relative;
  cursor: default;
}

/* #1b6fa8 rather than var(--blue): same brand family, but validated to
   read as a color (not gray) at bar-fill size on the white panel. */
.visit-bar {
  width: 100%;
  max-width: 26px;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: #1b6fa8;
}

.visit-bar-col .visit-value {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
  white-space: nowrap;
}

.visit-bar-col .visit-day {
  position: absolute;
  bottom: -20px;
  font-size: 0.64rem;
  color: var(--muted);
  white-space: nowrap;
}

.visit-bar-col.is-today .visit-day {
  font-weight: 700;
  color: var(--ink);
}

.crosscheck-line {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--ink);
}

.agree-badge {
  display: inline-block;
  padding: 2px 10px;
  margin-right: 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
}

.agree-wet,
.agree-dry {
  background: var(--green);
}

.agree-split {
  background: var(--amber);
}

.verification-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.verify-chip {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--line);
  cursor: default;
}

.verify-good {
  color: var(--green);
  border-color: var(--green);
}

.verify-bad {
  color: var(--red);
  border-color: var(--red);
}

.station-list-title {
  margin: 16px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.station-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
}

.station-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.station-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
  align-self: center;
}

.station-dot-rain {
  background: var(--blue);
}

.station-name a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.station-name a:hover {
  text-decoration: underline;
}

.station-name small {
  color: var(--muted);
  font-weight: 400;
}

.station-readings {
  color: var(--muted);
  margin-left: auto;
}

.station-raining {
  color: var(--blue);
}

/* Inside the site-grid card the rows are narrower than the old full-width
   panel — let readings wrap under the station name, aligned with it. */
.reliability-card .station-readings {
  margin-left: 0;
  width: 100%;
  padding-left: 16px;
}

.station-dot-alert {
  background: var(--red);
}

.station-row.pampanga-active {
  border-color: var(--red);
  background: rgba(190, 61, 54, 0.06);
}

.site-card.pampanga-card-active {
  border: 1px solid var(--red);
  background: rgba(190, 61, 54, 0.04);
}

.pampanga-alert-text {
  color: var(--red);
}

.pagasa-live {
  margin-bottom: 14px;
}

.pagasa-live-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 10px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  font-size: 0.8rem;
}

.pagasa-live-row.pagasa-live-cyclone {
  border-left-color: var(--amber);
  background: rgba(199, 119, 29, 0.05);
}

.pagasa-live-row.pagasa-live-alert {
  border-left-color: var(--red);
  background: rgba(190, 61, 54, 0.06);
}

.pagasa-live-tag {
  flex: none;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.outlook-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 150px;
  margin-top: 34px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.outlook-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  position: relative;
}

.outlook-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  cursor: default;
}

.outlook-bar-col .outlook-time {
  position: absolute;
  bottom: -20px;
  font-size: 0.64rem;
  color: var(--muted);
  white-space: nowrap;
}

.outlook-bar-col .outlook-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
  white-space: nowrap;
  text-align: center;
  line-height: 1.25;
}

.outlook-chance {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
}

/* Day-boundary divider: a thin vertical rule through the bars with the
   date it introduces labeled above the chart, so a 48h/7-day strip of
   bare hour labels (5 PM, 9 PM, 1 AM...) doesn't leave the viewer to work
   out which hours belong to which day. */
.outlook-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 100%;
  background: var(--line);
  position: relative;
}

.outlook-divider-label {
  position: absolute;
  top: -22px;
  left: 0;
  transform: translateX(-2px);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

/* "We are here" marker: the forecast strip always starts at the current
   moment, so this anchors that instant instead of leaving it implicit. */
.outlook-now-line {
  flex: 0 0 auto;
  width: 2px;
  height: 100%;
  background: var(--red);
  position: relative;
}

.outlook-now-label {
  position: absolute;
  top: -22px;
  left: 0;
  transform: translateX(-2px);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--red);
  white-space: nowrap;
}

/* Mobile-only compact outlook: emoji cards grouped by day, shown in place
   of the 24-bar strip which is unreadable at phone width. */
.outlook-compact {
  display: none;
}

.outlook-compact-day {
  margin-top: 14px;
}

.outlook-compact-day-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 6px;
}

.outlook-compact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.outlook-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f2f7f4;
}

.outlook-cell.light {
  background: #e8f4ea;
  border-color: #bddbc2;
}

.outlook-cell.moderate {
  background: #e8f4ea;
  border-color: #bddbc2;
}

.outlook-cell.heavy {
  background: #fff6cc;
  border-color: #ead375;
}

.outlook-cell.intense {
  background: #ffead8;
  border-color: #efb47e;
}

.outlook-cell.torrential {
  background: #fde3e3;
  border-color: #f2bcbc;
}

.outlook-cell-time {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--muted);
}

.outlook-cell-emoji {
  font-size: 1.15rem;
  line-height: 1.2;
}

.outlook-cell-value {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.outlook-cell-chance {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .outlook-chart {
    display: none;
  }

  .outlook-compact {
    display: block;
  }

  /* Keep the interval picker as one compact row instead of four
     stacked full-width buttons. */
  .outlook-interval-selector {
    flex-direction: row !important;
    flex-wrap: wrap;
  }

  .outlook-interval-selector .button {
    flex: 1 1 auto;
  }
}

.outlook-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.74rem;
  color: var(--muted);
}

.outlook-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border: 1px solid #53606b;
  border-radius: 3px;
  box-sizing: border-box;
  display: inline-block;
}

.legend-swatch.dry {
  background: #1f8a5b;
}

.legend-swatch.light {
  background: #56945b;
}

.legend-swatch.moderate {
  background: #56945b;
}

.legend-swatch.heavy {
  background: var(--yellow);
}

.legend-swatch.intense {
  background: var(--orange);
}

.legend-swatch.torrential {
  background: #d32f2f;
}

/* 16-day rolling program day chips */
.extended-days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 6px;
  margin: 14px 0;
}

.ext-day {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  border-top: 3px solid #1f8a5b;
  background: #f8fafb;
}

.ext-day.caution {
  border-top-color: #f57c00;
  background: #fff7ef;
}

.ext-day.severe {
  border-top-color: #d32f2f;
  background: #fdf1f1;
}

.ext-day.unknown {
  border-top-color: #64748b;
  background: #f1f5f9;
}

.ext-day-name,
.ext-day-date,
.ext-day-gust {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 700;
}

.ext-day strong {
  display: block;
  font-size: 0.95rem;
  margin: 2px 0;
}

.ext-day strong small {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}

.ext-risk-low {
  color: #1f8a5b;
}

.ext-risk-moderate {
  color: #f57c00;
}

.ext-risk-high {
  color: #d32f2f;
}

.ext-risk-unknown {
  color: #64748b;
}

/* Shared by the Himawari satellite card and the model-track comparison
   card — a full-width proxied snapshot image with a caption link below it. */
.proxied-image-card {
  display: block;
  margin: 10px 0 4px;
  text-decoration: none;
}

.proxied-image-card img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
}

.proxied-image-card span {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
}

/* PAGASA's own signal/track tarpaulin posters for the active storm, top of page */
.pagasa-tarpaulin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 8px 16px;
  background: #eef4f9;
  border-bottom: 1px solid var(--line);
}

/* This class's own `display: flex` has the same specificity as the browser's
   default `[hidden]{display:none}` and, being author CSS, wins the tie — so
   `el.hidden = true` was setting the attribute but never actually hiding
   anything. That's why the bar/broken-image cards kept showing no matter how
   many times the JS-side "hide it" logic was fixed (Chain screenshot, 2026-08-11). */
.pagasa-tarpaulin-bar[hidden],
.pagasa-tarpaulin-item[hidden] {
  display: none;
}

.pagasa-tarpaulin-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #45566b;
  margin-right: 4px;
}

.pagasa-tarpaulin-item {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px 4px 4px;
}

.pagasa-tarpaulin-item img {
  height: 46px;
  width: auto;
  border-radius: 4px;
  display: block;
}

.pagasa-tarpaulin-item span {
  font-size: 0.72rem;
  font-weight: 600;
  color: #17324d;
}

/* West Pacific mini-map in the rolling program panel */
#extendedMap {
  height: 280px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  z-index: 0;
}

.ext-invest-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 3px solid #64717d;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.ext-invest-label {
  position: absolute;
  top: 27px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.66rem;
  font-weight: 800;
  color: #14212b;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  white-space: nowrap;
}

/* Dated forecast-track waypoints on the rolling-program map */
.ext-track-marker {
  width: 14px;
  height: 14px;
  border: 3px solid #64717d;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.ext-track-label {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  color: #14212b;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  white-space: nowrap;
}

.storm-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.storm-group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafb;
}

.storm-group-card.current {
  border-color: var(--brand-amber);
  background: #fdf6e8;
}

.storm-group-card.archive {
  border-style: dashed;
  opacity: 0.85;
}

.storm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.storm-group-head strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.storm-series {
  border-top: 1px solid var(--line);
  padding: 6px 0;
}

.storm-series summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--blue);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.storm-series summary::-webkit-details-marker {
  display: none;
}

.storm-series summary .count {
  color: var(--muted);
  font-weight: 500;
}

.storm-series-list {
  display: grid;
  gap: 4px;
  margin: 8px 0 2px;
}

.storm-series-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: 5px;
}

.storm-series-list a:hover {
  background: #fff;
}

.storm-series-list a span:first-child {
  overflow-wrap: anywhere;
}

.storm-series-list a small {
  color: var(--muted);
  white-space: nowrap;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fafb;
}

.history-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.history-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.history-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.history-metrics span {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 0.76rem;
}

.history-metrics strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.rules-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  align-items: center;
  gap: 16px;
}

@media (max-width: 1080px) {
  .shell,
  .rules-panel,
  .site-grid {
    grid-template-columns: 1fr;
  }

  /* Single column now — no shared row to compact against, so let the
     control panel flow at its natural height instead of scrolling inside
     a small box. */
  .control-panel {
    max-height: none;
    overflow-y: visible;
  }

  .map-panel,
  #map {
    min-height: 420px;
  }

  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pagasa-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-header,
  .header-actions,
  .panel-title,
  .alarm-head,
  .button-row,
  .inline-control,
  .line-pin-gate {
    align-items: stretch;
    flex-direction: column;
  }

  .coord-grid,
  .schedule-grid,
  .source-grid,
  .pagasa-grid,
  .history-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .line-pin-gate input {
    max-width: none;
  }
}

/* iPhone-class phones (e.g. iPhone 17 Pro, ~390-430px wide) */
@media (max-width: 480px) {
  .app-header {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: 16px;
    gap: 12px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .eyebrow {
    font-size: 0.68rem;
  }

  .shell {
    gap: 14px;
    padding-top: 14px;
  }

  .control-panel {
    gap: 12px;
    padding: 10px;
  }

  .panel-block,
  .source-panel,
  .pagasa-panel,
  .typhoon-panel,
.advisory-panel,
  .alignment-panel,
  .history-panel,
  .rules-panel,
  .forecast-card,
  .rain-ops-panel,
  .site-card {
    padding: 14px;
  }

  .button,
  input,
  textarea,
  select {
    font-size: 16px;
  }

  .button {
    min-height: 44px;
  }

  .button.small {
    min-height: 40px;
  }

  .map-panel,
  #map {
    min-height: 320px;
  }

  .map-legend-stack {
    left: 8px;
    bottom: 8px;
    gap: 4px;
  }

  .map-legend {
    gap: 4px 6px;
    padding: 5px 7px;
    font-size: 0.62rem;
    max-height: 45vh;
    overflow-y: auto;
  }

  .map-legend-summary {
    padding: 5px 9px;
    font-size: 0.68rem;
  }

  #radarCorridorStrip.corridor-strip {
    max-width: 190px;
    font-size: 0.58rem;
    padding: 5px 7px;
  }

  .map-toolbar-stack {
    right: 8px;
    top: 8px;
    gap: 6px;
  }

  .map-toolbar {
    gap: 6px;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .map-layer-switcher {
    left: 8px;
    top: 62px;
    max-width: calc(100% - 16px);
  }

  .map-layer-toggle {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .live-station-copy {
    font-size: 0.54rem;
  }

  .schedule-item {
    min-height: auto;
  }

  #messageBox {
    min-height: 140px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- Operational rain summary ---- */
.rain-ops-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.rain-ops-head-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  text-align: right;
}

.rain-ops-body {
  margin-top: 12px;
}

.rain-ops-peak {
  display: grid;
  gap: 3px;
  border-left: 5px solid var(--green);
  padding: 2px 0 2px 12px;
}

.rain-ops-panel[data-intensity="light"] .rain-ops-peak {
  border-left-color: #56945b;
}

.rain-ops-panel[data-intensity="moderate"] .rain-ops-peak {
  border-left-color: #56945b;
}

.rain-ops-panel[data-intensity="heavy"] .rain-ops-peak {
  border-left-color: var(--yellow);
}

.rain-ops-panel[data-intensity="intense"] .rain-ops-peak {
  border-left-color: var(--orange);
}

.rain-ops-panel[data-intensity="torrential"] .rain-ops-peak {
  border-left-color: var(--red);
}

.rain-ops-peak-label,
.rain-ops-peak small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.rain-ops-peak strong {
  font-size: 1.05rem;
}

.rain-ops-count {
  margin-top: 14px;
  padding-bottom: 7px;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 850;
}

.rain-ops-area-list {
  border-top: 1px solid var(--line);
}

.rain-ops-row {
  --rain-row-color: var(--green);
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(360px, 2fr) minmax(100px, auto);
  align-items: center;
  gap: 12px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  color: var(--rain-row-color);
  font-size: 0.84rem;
}

.rain-ops-row.light {
  --rain-row-color: #56945b;
}

.rain-ops-row.moderate {
  --rain-row-color: #56945b;
}

.rain-ops-row.heavy {
  --rain-row-color: #9a7100;
}

.rain-ops-row.intense {
  --rain-row-color: #b8540f;
}

.rain-ops-row.torrential {
  --rain-row-color: var(--red);
}

.rain-ops-location,
.rain-ops-detail,
.rain-ops-wind {
  min-width: 0;
}

.rain-ops-location small {
  font-size: 0.78rem;
  font-weight: 650;
}

.rain-ops-detail {
  color: var(--ink);
}

.rain-ops-wind {
  justify-self: end;
  white-space: nowrap;
  font-weight: 850;
}

.rain-ops-ground {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rain-ops-ground-line {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.rain-ops-ground-line strong {
  color: var(--ink);
}

@media (max-width: 820px) {
  .rain-ops-row {
    grid-template-columns: minmax(170px, 0.8fr) minmax(0, 1.6fr);
    gap: 3px 10px;
    padding-block: 7px;
  }

  .rain-ops-wind {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .rain-ops-head-meta {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
  }

  .rain-ops-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
  }

  .rain-ops-location {
    grid-column: 1;
    grid-row: 1;
  }

  .rain-ops-detail {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .rain-ops-wind {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
}

/* ---- Live wind monitor (per-pier) ---- */
.wind-panel,
.habagat-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

/* The live badge (and season line) stay visible at all times; the three
   source cards + quote box + notes are the bulky part and are collapsed
   into <details> by default (Chain 2026-08-13: "so big and bulky"). */
.habagat-summary-row {
  align-items: flex-start;
}

.habagat-season-inline {
  margin-top: 4px;
  font-size: 0.82rem;
}

.habagat-details[open] {
  margin-top: 10px;
}

.habagat-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.habagat-source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
  display: grid;
  gap: 6px;
  align-content: start;
}

.habagat-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.habagat-source-card p {
  margin: 0;
  font-size: 0.82rem;
}

.habagat-quote {
  max-height: 160px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  padding-top: 6px;
  display: grid;
  gap: 6px;
}

.habagat-quote p {
  font-size: 0.78rem;
  color: var(--muted);
}

.habagat-source-link {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--blue);
  text-decoration: none;
  margin-top: 2px;
}

.habagat-source-link:hover {
  text-decoration: underline;
}

.habagat-footnote {
  margin-top: 6px;
  font-size: 0.78rem;
}

.wind-obs-row,
.wind-lg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.wind-obs-chip,
.wind-lg-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  background: var(--panel);
}

.wind-area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.wind-card {
  border: 1px solid var(--line);
  border-left: 5px solid #2e9e5b;
  border-radius: 8px;
  padding: 10px 12px;
}

.wind-card-head {
  font-weight: 700;
  font-size: 0.85rem;
}

.wind-card-head small {
  font-weight: 400;
  color: var(--muted);
}

.wind-card-now {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 4px;
}

.wind-card-now small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

.wind-card-peak {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.wind-card.ok { border-left-color: #2e9e5b; }
.wind-card.caution { border-left-color: #e0a300; background: rgba(224, 163, 0, 0.07); }
.wind-card.stop { border-left-color: #d5453c; background: rgba(213, 69, 60, 0.08); }
.wind-card-peak.caution { color: #a97b00; font-weight: 600; }
.wind-card-peak.stop { color: #c0362d; font-weight: 700; }
.wind-obs-chip.caution, .wind-lg-chip.caution { border-color: #e0a300; background: rgba(224, 163, 0, 0.1); }
.wind-obs-chip.stop, .wind-lg-chip.stop { border-color: #d5453c; background: rgba(213, 69, 60, 0.1); }
