:root {
  color-scheme: dark;
  --bg: #061118;
  --bg-elevated: #0a1821;
  --surface: #0d1d27;
  --surface-strong: #122733;
  --surface-soft: #10212b;
  --border: #29404d;
  --border-strong: #3d5b6b;
  --text: #f5f8fa;
  --muted: #acc0ca;
  --muted-strong: #d0dce2;
  --cyan: #58d5ea;
  --green: #39da83;
  --amber: #f5c451;
  --orange: #ff8a3d;
  --red: #ff5263;
  --red-dark: #7c1d2b;
  --shadow: 0 18px 45px rgb(0 0 0 / 28%);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% -12%, rgb(34 102 125 / 26%), transparent 32rem),
    linear-gradient(180deg, #07141c 0, var(--bg) 28rem);
  color: var(--text);
  font-family: "Noto Sans Thai", "Sarabun", "Thonburi", system-ui, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

button,
input,
summary {
  font: inherit;
}

button,
summary,
a,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--cyan);
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 5000;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-160%);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--cyan);
  color: #031116;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.dashboard-grid,
.site-footer,
.app-status,
.noscript-message {
  width: min(1880px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  padding: 1.5rem 0 1rem;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  width: 58px;
  height: 58px;
  padding: 11px;
  border: 1px solid #397285;
  border-radius: 14px;
  background: linear-gradient(145deg, #0a2a37, #0c1b24);
  box-shadow: inset 0 0 0 1px rgb(88 213 234 / 10%);
}

.brand-mark span {
  display: block;
  width: 8px;
  border-radius: 4px 4px 1px 1px;
  background: var(--cyan);
}

.brand-mark span:nth-child(1) { height: 13px; opacity: 0.6; }
.brand-mark span:nth-child(2) { height: 24px; opacity: 0.82; }
.brand-mark span:nth-child(3) { height: 35px; }

.system-label,
.panel-index,
.eyebrow {
  margin: 0 0 0.22rem;
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

h1 span {
  color: var(--muted);
  font-size: 0.46em;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tagline {
  margin: 0.45rem 0 0;
  color: var(--muted-strong);
  font-size: clamp(0.92rem, 1.4vw, 1.08rem);
}

.demo-badge {
  position: fixed;
  z-index: 2000;
  top: 0.9rem;
  right: max(1rem, calc((100vw - 1880px) / 2));
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  border: 1px solid #8b7338;
  border-radius: 999px;
  background: rgb(35 30 17 / 94%);
  color: #ffe6a6;
  box-shadow: 0 10px 28px rgb(0 0 0 / 38%);
  backdrop-filter: blur(12px);
  font-size: 0.78rem;
  font-weight: 800;
}

.demo-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgb(245 196 81 / 15%);
}

.mobile-jump-nav {
  display: none;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1.3rem;
}

.kpi-card {
  position: relative;
  min-width: 0;
  padding: 0.9rem 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgb(16 36 47 / 92%), rgb(9 24 33 / 92%));
}

.kpi-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--cyan);
  content: "";
}

.kpi-severe::before { background: var(--red); }
.kpi-warning::before { background: var(--orange); }
.kpi-vulnerable::before { background: var(--amber); }
.kpi-safe::before { background: var(--green); }

.kpi-card p {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.kpi-card div {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.kpi-card strong {
  font-size: clamp(1.55rem, 2.3vw, 2.25rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.kpi-card span {
  color: var(--muted-strong);
  font-size: 0.72rem;
}

.time-control {
  display: grid;
  grid-template-columns: minmax(190px, 0.28fr) minmax(0, 0.72fr);
  gap: 0.75rem 1.2rem;
  align-items: center;
  margin-top: 0.7rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(8 24 33 / 82%);
}

.time-control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.time-control h2 {
  margin: 0;
  font-size: 1rem;
}

.time-control output {
  display: none;
  color: var(--text);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.slider-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
}

.slider-row > span {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  height: 44px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--cyan);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid #47606d;
  border-radius: 99px;
  background: linear-gradient(90deg, #216f65 0 32%, #8a762c 50%, #8c4128 70%, #752331 100%);
}

input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border: 3px solid #e9fbff;
  border-radius: 50%;
  background: #0d5d71;
  box-shadow: 0 0 0 4px rgb(88 213 234 / 20%);
  appearance: none;
}

.slider-meta {
  display: none;
  color: var(--muted);
  font-size: 0.72rem;
}

.slider-meta strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(430px, 1.16fr) minmax(350px, 0.92fr) minmax(320px, 0.82fr);
  gap: 0.8rem;
  align-items: start;
  padding-bottom: 1.5rem;
}

.panel {
  min-width: 0;
  height: min(820px, calc(100vh - 2rem));
  min-height: 660px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgb(14 31 41 / 97%), rgb(9 23 31 / 97%));
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: rgb(13 29 39 / 96%);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: -0.015em;
}

.selected-time,
.formula-label,
.channel-label {
  max-width: 48%;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.channel-label {
  color: var(--cyan);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.map-panel {
  display: flex;
  flex-direction: column;
}

.map {
  z-index: 0;
  flex: 1 1 auto;
  min-height: 400px;
  background: #122633;
}

.map-unavailable {
  display: grid;
  place-items: center;
  padding: 2rem;
  color: var(--muted-strong);
  text-align: center;
}

.leaflet-tile-pane {
  filter: saturate(0.62) brightness(0.74) contrast(1.18);
}

.leaflet-control-zoom a {
  display: grid;
  width: 44px !important;
  height: 44px !important;
  place-items: center;
  border-color: #315160 !important;
  background: #0b202b !important;
  color: var(--text) !important;
  line-height: 1 !important;
}

.leaflet-control-attribution {
  background: rgb(5 15 21 / 82%) !important;
  color: #c8d9e0 !important;
}

.leaflet-control-attribution a {
  color: #9cecff !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #f4f8fa;
  color: #10212b;
}

.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 10px 34px rgb(0 0 0 / 35%);
}

.leaflet-popup-content {
  width: min(250px, 70vw) !important;
  margin: 0.85rem;
  font-family: "Noto Sans Thai", "Sarabun", "Thonburi", system-ui, sans-serif;
}

.leaflet-popup-close-button {
  display: grid !important;
  width: 36px !important;
  height: 36px !important;
  place-items: center;
  color: #17313e !important;
  font-size: 1.4rem !important;
}

.map-popup {
  display: grid;
  gap: 0.45rem;
  font-size: 0.78rem;
}

.map-popup p,
.map-popup dl,
.map-popup small {
  margin: 0;
}

.map-popup > strong {
  padding-right: 1.25rem;
  font-size: 0.94rem;
}

.map-popup .popup-type {
  color: #41606e;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.map-popup dl {
  display: grid;
  gap: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid #ccd9df;
}

.map-popup dl div {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
}

.map-popup dt {
  color: #48626e;
}

.map-popup dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.map-popup .status-badge {
  justify-self: start;
}

.gauge-marker-wrap,
.shelter-marker-wrap {
  border: 0;
  background: transparent;
}

.gauge-marker,
.shelter-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 58px;
  height: 28px;
  border: 2px solid #f1f7f9;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgb(0 0 0 / 40%);
  color: #071219;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.marker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.shelter-marker {
  width: 46px;
  border-radius: 2px;
  background: #dffbff;
  color: #07495a;
}

.community-marker {
  cursor: pointer;
}

.community-marker.status-normal { fill: var(--green); stroke: #e9fff4; }
.community-marker.status-watch { fill: var(--amber); stroke: #fff5ce; }
.community-marker.status-warning { fill: var(--orange); stroke: #fff1e7; }
.community-marker.status-critical { fill: var(--red); stroke: #ffe8eb; }

.map-legend {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--border);
  background: #0a1a23;
}

.legend-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
}

.legend-group strong {
  width: 100%;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.legend-group span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted-strong);
  font-size: 0.68rem;
}

.legend-swatch,
.legend-community,
.legend-gauge {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 50%;
}

.legend-swatch.status-normal { background: var(--green); }
.legend-swatch.status-watch { background: var(--amber); }
.legend-swatch.status-warning { background: var(--orange); }
.legend-swatch.status-critical { background: var(--red); }

.legend-community {
  width: 13px;
  height: 13px;
  background: var(--orange);
}

.legend-gauge {
  width: 18px;
  height: 10px;
  border-radius: 3px;
  background: var(--amber);
}

.legend-shelter {
  display: inline-grid;
  min-width: 26px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--cyan);
  border-radius: 2px;
  color: var(--cyan);
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.map-note,
.panel-intro {
  margin: 0;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
}

.priority-panel,
.message-panel {
  overflow-y: auto;
  scrollbar-color: #365564 transparent;
  scrollbar-width: thin;
}

.sticky-panel-header {
  position: sticky;
  z-index: 5;
  top: 0;
}

.panel-intro {
  border-top: 0;
  border-bottom: 1px solid var(--border);
}

.priority-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0.7rem;
  list-style: none;
}

.priority-card {
  position: relative;
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #10232e, #0c1b24);
}

.priority-card.is-selected {
  border-color: var(--cyan);
  border-left-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgb(88 213 234 / 16%);
}

.priority-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: start;
}

.priority-card-head h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.priority-card-head .eyebrow {
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
}

.rank-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #091820;
  color: var(--cyan);
  font-size: 0.77rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.status-badge,
.risk-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.25rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #071219;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.status-badge.status-normal,
.gauge-marker.status-normal { background: var(--green); }
.status-badge.status-watch,
.gauge-marker.status-watch { background: var(--amber); }
.status-badge.status-warning,
.gauge-marker.status-warning { background: var(--orange); }
.status-badge.status-critical,
.gauge-marker.status-critical { background: var(--red); }

.risk-flag {
  justify-self: start;
  border-color: #a52b39;
  background: #ffe2e6;
  color: #7c1522;
}

.priority-facts {
  display: grid;
  grid-template-columns: 1.15fr 0.9fr 0.72fr;
  gap: 0.45rem;
}

.priority-facts span {
  min-width: 0;
  padding: 0.45rem;
  border: 1px solid #263d49;
  border-radius: 7px;
  background: #091820;
}

.priority-facts small,
.priority-facts strong {
  display: block;
}

.priority-facts small {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.58rem;
}

.priority-facts strong {
  color: var(--text);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.vulnerability-chip {
  padding: 0.23rem 0.4rem;
  border: 1px solid #39515d;
  border-radius: 999px;
  background: #142832;
  color: #d8e5ea;
  font-size: 0.62rem;
  white-space: nowrap;
}

.shelter-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.68rem;
}

.shelter-line > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #2b7889;
  border-radius: 5px;
  color: var(--cyan);
}

.shelter-line strong,
.shelter-line div span {
  display: block;
}

.shelter-line strong {
  color: var(--muted-strong);
}

.card-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 0.45rem;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
}

.button:hover {
  filter: brightness(1.12);
}

.button-primary {
  border-color: #58d5ea;
  background: #17687b;
  color: #f7fdff;
}

.button-secondary {
  border-color: var(--border-strong);
  background: #142832;
  color: var(--text);
}

.button-alert {
  border-color: #ff7080;
  background: #8e2533;
  color: #fff;
}

.button-wide {
  width: calc(100% - 1.4rem);
  margin: 0.75rem 0.7rem;
}

.safe-communities {
  margin: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #0a1921;
}

.safe-communities summary,
.source-panel summary,
.bulk-item summary {
  min-height: 44px;
  cursor: pointer;
  list-style-position: inside;
}

.safe-communities summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem;
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 800;
}

.safe-communities summary span {
  color: var(--green);
}

.safe-list {
  padding: 0.2rem 0.6rem 0.6rem;
}

.loading-card,
.empty-state {
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.message-panel {
  padding-bottom: 0.75rem;
}

.message-preview {
  margin: 0.7rem;
  padding: 0.85rem;
  border: 1px solid #3b5967;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #132a36, #0b1a23);
}

.message-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.message-meta span {
  color: var(--muted);
  font-size: 0.64rem;
  white-space: nowrap;
}

.message-meta h3 {
  margin: 0.15rem 0 0;
  font-size: 1rem;
}

.thai-message {
  margin: 0;
  padding: 0.9rem 0;
  color: #f7fbfc;
  font-size: 0.86rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.english-message {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.65rem;
  border: 1px solid #344c58;
  border-radius: 7px;
  background: #08161e;
}

.english-message > span {
  color: var(--cyan);
  font-size: 0.62rem;
  font-weight: 900;
}

.english-message p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.68rem;
  line-height: 1.45;
}

.message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: 0.75rem;
}

.message-footer > span {
  color: var(--muted);
  font-size: 0.65rem;
}

.copy-feedback {
  min-height: 1.2em;
  margin: 0.45rem 0 0;
  color: var(--cyan);
  font-size: 0.68rem;
  text-align: right;
}

.bulk-messages {
  display: grid;
  gap: 0.55rem;
  margin: 0 0.7rem 0.75rem;
}

.bulk-heading h3,
.bulk-heading p {
  margin: 0;
}

.bulk-heading h3 { font-size: 0.9rem; }
.bulk-heading p { color: var(--muted); font-size: 0.68rem; }

.bulk-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0a1921;
}

.bulk-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
}

.bulk-item p {
  margin: 0;
  padding: 0.65rem;
  border-top: 1px solid var(--border);
  color: var(--muted-strong);
  font-size: 0.72rem;
  line-height: 1.55;
}

.bulk-item .button {
  margin: 0 0.65rem 0.65rem;
}

.source-panel {
  margin: 0.7rem;
  border: 1px solid #51616a;
  border-radius: var(--radius-md);
  background: #101c22;
}

.source-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 850;
}

.source-panel summary span {
  color: var(--amber);
  font-size: 0.62rem;
}

.source-panel p,
.source-panel ul {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.7rem;
}

.source-panel > p {
  padding: 0 0.75rem 0.65rem;
}

.source-panel ul {
  display: grid;
  gap: 0.45rem;
  padding: 0 1.2rem 0.75rem 1.8rem;
}

.source-panel .source-warning {
  margin: 0 0.7rem 0.7rem;
  padding: 0.55rem;
  border: 1px solid #8d3945;
  border-radius: 6px;
  background: #32131a;
  color: #ffd9de;
  font-weight: 800;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0 1.7rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.site-footer strong {
  color: var(--text);
}

.app-status,
.noscript-message {
  padding: 0.8rem 1rem;
  border: 1px solid #a44250;
  border-radius: var(--radius-sm);
  background: #3b141c;
  color: #ffe6ea;
}

@media (min-width: 1500px) {
  .time-control output {
    display: inline;
  }
}

@media (max-width: 1199px) {
  .site-header,
  .dashboard-grid,
  .site-footer,
  .app-status,
  .noscript-message {
    width: min(920px, calc(100% - 1.25rem));
  }

  .mobile-jump-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-top: 1rem;
  }

  .mobile-jump-nav a {
    display: grid;
    min-height: 44px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #0c202a;
    color: var(--muted-strong);
    font-size: 0.76rem;
    font-weight: 800;
    text-decoration: none;
    min-width: 0;
  }

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

  .panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .map {
    height: 48vh;
    min-height: 360px;
    flex: none;
  }

  .priority-panel,
  .message-panel {
    overflow: visible;
  }

  .sticky-panel-header {
    position: static;
  }
}

@media (max-width: 699px) {
  html {
    scroll-behavior: auto;
  }

  .site-header {
    padding-top: 4rem;
  }

  .header-top,
  .brand-block {
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    padding: 9px;
    border-radius: 11px;
  }

  .brand-mark span:nth-child(3) { height: 29px; }

  .demo-badge {
    top: 0.6rem;
    right: 0.6rem;
    left: 0.6rem;
    justify-content: center;
    max-width: none;
  }

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

  .kpi-card {
    padding: 0.75rem 0.8rem;
  }

  .kpi-card strong {
    font-size: 1.6rem;
  }

  .time-control {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .time-control-heading output {
    display: inline;
    max-width: 58%;
    white-space: normal;
    text-align: right;
  }

  .slider-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
  }

  .dashboard-grid {
    gap: 0.65rem;
  }

  .panel {
    border-radius: 14px;
  }

  .panel-header {
    padding: 0.85rem;
  }

  .map {
    height: 42vh;
    min-height: 330px;
  }

  .map-legend {
    grid-template-columns: 1fr;
  }

  .priority-card-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .priority-card-head .status-badge {
    grid-column: 2;
    justify-self: start;
  }

  .priority-facts {
    grid-template-columns: 1fr 1fr;
  }

  .priority-facts span:first-child {
    grid-column: 1 / -1;
  }

  .card-actions {
    grid-template-columns: 1fr 1.15fr;
  }

  .selected-time,
  .formula-label {
    max-width: 45%;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.2rem;
  }
}

@media (max-width: 379px) {
  .site-header,
  .dashboard-grid,
  .site-footer,
  .app-status,
  .noscript-message {
    width: calc(100% - 0.75rem);
  }

  .brand-block {
    gap: 0.65rem;
  }

  h1 {
    font-size: 1.9rem;
  }

  .system-label {
    font-size: 0.58rem;
  }

  .kpi-card p,
  .kpi-card span {
    font-size: 0.66rem;
  }

  .slider-row {
    gap: 0.4rem;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .priority-card {
    padding: 0.7rem;
  }

  .message-footer {
    align-items: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
