:root {
  color-scheme: light;
  --bg: #eef3f1;
  --ink: #18211f;
  --muted: #60706b;
  --panel: #ffffff;
  --line: #d9e2de;
  --critical: #7f1d1d;
  --risk: #ef4444;
  --warning: #d88a19;
  --normal: #1d8f5f;
  --water: #2574a9;
  --rain: #2d9ccf;
  --shadow: 0 20px 60px rgba(21, 38, 35, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  font-kerning: normal;
}

body {
  margin: 0;
  font-family: Prompt, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}

.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;
}

body.dark {
  --bg: #252524;
  --ink: #f4f4ef;
  --muted: #c3c3ba;
  --panel: #2d2d2b;
  --line: #44443f;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 34.5% minmax(0, 1fr);
}

.app-shell.risk-collapsed {
  grid-template-columns: 34.5% minmax(0, 1fr);
}

.app-shell:not(.risk-collapsed) .command-header {
  grid-template-columns: minmax(240px, 0.74fr) minmax(360px, 1.26fr);
}

.app-shell:not(.risk-collapsed) .command-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.system-footer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px clamp(18px, 4vw, 52px);
  background: #2b2f30;
  color: #f4f6f5;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.system-footer-logo {
  display: flex;
  align-items: center;
  padding-right: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.28);
}

.system-footer-logo img {
  width: 48px;
  height: 56px;
  object-fit: contain;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.system-footer-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  justify-items: center;
  text-align: center;
}

.system-footer-copy strong {
  font-size: clamp(0.9rem, 1.08vw, 1.08rem);
  line-height: 1.25;
  white-space: nowrap;
}

.system-footer-copy span {
  color: rgba(255, 255, 255, 0.68);
  font-size: clamp(0.72rem, 0.95vw, 0.84rem);
  font-weight: 400;
}

.system-footer-partners {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  width: max-content;
  max-width: min(760px, 52vw);
  min-height: 62px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.footer-logo-source {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.footer-logo-slot {
  width: 50px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  flex: 0 0 auto;
}

.footer-logo-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.footer-logo-slot-dwr {
  padding: 2px;
}

.footer-logo-slot-dwr img {
  width: 136%;
  height: 136%;
}

.footer-logo-slot-hii img {
  width: 118%;
  height: 118%;
}

.footer-logo-slot-dislog {
  width: 54px;
  background: rgba(255, 255, 255, 0.92);
}

.footer-logo-slot-dislog img {
  width: 112%;
  height: 112%;
}

.sidebar,
.risk-sidebar {
  position: relative;
  z-index: 3;
  padding: 18px;
  background: #f8fbfa;
  overflow-y: auto;
  max-height: none;
}

.sidebar {
  border-right: 1px solid var(--line);
}

.risk-sidebar {
  z-index: 40;
  border-left: 1px solid var(--line);
  background: rgba(248, 251, 250, 0.82);
  backdrop-filter: blur(10px);
  contain: layout paint;
}

.risk-sidebar.collapsed {
  padding: 10px 12px;
  overflow: hidden;
}

.risk-sidebar.collapsed .affected-panel {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.risk-sidebar.collapsed .affected-list {
  display: none;
}

.risk-sidebar-toggle {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.risk-sidebar-toggle h2 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.15;
}

.risk-sidebar-toggle span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.risk-sidebar-chevron {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  transition: transform 180ms ease;
}

.risk-sidebar.collapsed .risk-sidebar-toggle {
  min-height: calc(100vh - 20px);
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 8px;
  padding: 12px 6px;
  border: 1px solid rgba(24, 33, 31, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 26px rgba(21, 38, 35, 0.12);
}

.risk-sidebar.collapsed .risk-sidebar-toggle h2 {
  width: auto;
  max-width: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: none;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  color: #10211c;
  white-space: nowrap;
  text-align: center;
}

.risk-sidebar.collapsed .risk-sidebar-toggle span:not(.risk-sidebar-chevron) {
  display: none;
}

.risk-sidebar.collapsed .risk-sidebar-chevron {
  transform: rotate(180deg);
}

.public-alert-button,
.population-impact-button,
.rain-forecast-button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 8px 0;
  border: 1px solid rgba(201, 47, 55, 0.32);
  border-radius: 8px;
  background: #fff5f5;
  color: #a51f2a;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.population-impact-button {
  margin-top: 0;
  background: #f0f9ff;
  color: #075985;
  border-color: rgba(14, 116, 144, 0.25);
  font-size: 0.72rem;
}

.rain-forecast-button {
  margin-top: 0;
  background: #f7fee7;
  color: #3f6212;
  border-color: rgba(101, 163, 13, 0.26);
  font-size: 0.72rem;
}

.public-alert-button svg,
.population-impact-button svg,
.rain-forecast-button svg {
  width: 15px;
  height: 15px;
}

.risk-sidebar.collapsed .public-alert-button,
.risk-sidebar.collapsed .population-impact-button,
.risk-sidebar.collapsed .population-impact-panel,
.risk-sidebar.collapsed .rain-forecast-button,
.risk-sidebar.collapsed .rain-forecast-panel {
  display: none;
}

.population-impact-panel,
.rain-forecast-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.population-impact-panel[hidden],
.rain-forecast-panel[hidden] {
  display: none;
}

.visitor-counter {
  position: fixed;
  left: 14px;
  bottom: 12px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(24, 33, 31, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(21, 38, 35, 0.14);
  backdrop-filter: blur(10px);
  font-size: 0.72rem;
  font-weight: 800;
}

.visitor-counter svg {
  width: 14px;
  height: 14px;
}

.visitor-counter strong {
  font-size: 0.82rem;
  color: #173f38;
}

.visitor-counter small {
  color: var(--muted);
  font-size: 0.62rem;
}

.impact-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.impact-tab {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}

.impact-tab.active {
  background: #173f38;
  border-color: #173f38;
  color: #fff;
}

.population-impact-summary {
  display: grid;
  gap: 7px;
}

.impact-total {
  display: grid;
  gap: 1px;
  padding: 8px;
  border-radius: 8px;
  background: #f8fbfa;
  border: 1px solid var(--line);
}

.impact-total strong {
  color: #10211c;
  font-size: 1rem;
  line-height: 1.1;
}

.impact-total span,
.impact-note {
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.3;
}

.impact-list {
  display: grid;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
}

.impact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.impact-row strong {
  display: block;
  color: #10211c;
  font-size: 0.7rem;
  line-height: 1.2;
}

.impact-row small {
  display: block;
  color: var(--muted);
  font-size: 0.6rem;
  line-height: 1.25;
}

.impact-row > span {
  color: #075985;
  font-size: 0.7rem;
  font-weight: 900;
  white-space: nowrap;
}

.forecast-total strong {
  color: #3f6212;
}

.forecast-total small {
  display: block;
  margin-top: 5px;
  color: #24443d;
  font-size: 0.66rem;
  line-height: 1.35;
}

.forecast-readiness {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.forecast-readiness span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.58rem;
  font-weight: 900;
}

.forecast-readiness span.ready {
  border-color: rgba(34, 197, 94, 0.22);
  background: #ecfdf5;
  color: #166534;
}

.forecast-section-title {
  color: #173f38;
  font-size: 0.68rem;
  font-weight: 900;
}

.forecast-list .forecast-row {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.forecast-list .forecast-row:hover {
  border-color: rgba(23, 63, 56, 0.32);
  box-shadow: 0 8px 18px rgba(21, 38, 35, 0.08);
  transform: translateY(-1px);
}

.forecast-row.warning > span,
.forecast-row.watch > span {
  color: #a16207;
}

.forecast-row.risk > span {
  color: #b91c1c;
}

.forecast-row.critical > span {
  color: #7c3aed;
}

.station-forecast-list .forecast-row,
.station-forecast-list .forecast-row.warning,
.station-forecast-list .forecast-row.watch,
.station-forecast-list .forecast-row.risk,
.station-forecast-list .forecast-row.critical {
  border-color: #d1d5db;
  background: #fff;
}

.station-forecast-list .forecast-row > span {
  padding: 3px 7px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f8fafc;
}

.command-side-panel {
  display: grid;
  gap: 8px;
}

.operation-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(23, 63, 56, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(240, 253, 250, 0.98), rgba(255, 255, 255, 0.98));
}

.operation-card .situation-badge {
  justify-self: start;
  min-height: 26px;
}

.operation-card strong,
.operation-action-target {
  font-size: 0.78rem;
  line-height: 1.35;
}

.operation-action-target {
  min-width: 0;
  display: block;
  color: #173f38;
  font-weight: 900;
}

.mini-section {
  display: grid;
  gap: 7px;
}

.mini-section h3 {
  margin: 0;
  color: #173f38;
  font-size: 0.78rem;
  line-height: 1.2;
}

.top-risk-list,
.timeline-list,
.guidance-list {
  display: grid;
  gap: 6px;
}

.guidance-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 7px 8px;
  border: 1px solid rgba(29, 143, 95, 0.16);
  border-radius: 8px;
  background: #f0fdf4;
}

.guidance-item svg {
  width: 15px;
  height: 15px;
  color: #15803d;
  margin-top: 1px;
}

.guidance-item p {
  margin: 0;
  color: #14532d;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.35;
}

.top-risk-item {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.top-risk-item strong {
  font-size: 0.76rem;
  line-height: 1.2;
}

.top-risk-item span,
.top-risk-item small,
.top-risk-item em {
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.25;
  font-style: normal;
}

.top-risk-item em {
  color: #a16207;
  font-weight: 900;
}

.top-risk-item.station-attention {
  border-color: rgba(202, 138, 4, 0.24);
  background: #fffdf2;
}

.top-risk-item.action-status {
  border-left: 5px solid #0f766e;
  background: #ffffff;
}

.top-risk-item.action-status.watch {
  border-left-color: #f97316;
}

.top-risk-item.action-status.risk {
  border-left-color: #b91c1c;
}

.top-risk-item.action-status.critical {
  border-left-color: #7c3aed;
}

.top-risk-item.action-status.alert em {
  color: #b91c1c;
}

.top-risk-item.action-status.inspect em {
  color: #92400e;
}

.top-risk-item.action-status.evacuate em {
  color: #6d28d9;
}

.timeline-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-item strong {
  color: #173f38;
  font-size: 0.66rem;
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.35;
}

body[data-active-command-mode="public"] .officer-only,
body[data-active-command-mode="officer"] .public-only {
  display: none;
}

body[data-active-command-mode="public"] .public-alert-button,
body[data-active-command-mode="public"] .population-impact-button,
body[data-active-command-mode="public"] .population-impact-panel,
body[data-active-command-mode="public"] .rain-forecast-button,
body[data-active-command-mode="public"] .rain-forecast-panel {
  display: none;
}

.brand {
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px 54px 14px 14px;
  background:
    radial-gradient(circle at 10% 0%, rgba(14, 165, 233, 0.11), transparent 36%),
    radial-gradient(circle at 88% 20%, rgba(124, 58, 237, 0.09), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 249, 255, 0.94) 52%, rgba(245, 243, 255, 0.92) 100%);
  border: 1px solid rgba(217, 226, 222, 0.9);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 34, 31, 0.08);
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: block;
  object-fit: contain;
  flex: 0 0 56px;
}

.brand h1,
.brand p,
.panel h2,
.panel p {
  margin: 0;
}

.brand h1 {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 1.22rem;
  line-height: 1.12;
}

.brand-version {
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: rgba(96, 112, 107, 0.56);
  font-size: 0.48rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand p {
  color: var(--muted);
  font-size: 0.92rem;
}

.operation-switch {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
}

.operation-switch summary {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 52, 95, 0.09);
  border-radius: 10px;
  background: rgba(238, 247, 255, 0.42);
  color: rgba(17, 52, 95, 0.42);
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 800;
  opacity: 0.58;
  cursor: pointer;
  box-shadow: none;
  list-style: none;
  transition:
    opacity 0.18s ease,
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

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

.operation-switch summary:hover,
.operation-switch summary:focus-visible,
.operation-switch[open] summary {
  opacity: 0.82;
  color: rgba(17, 52, 95, 0.68);
  background: rgba(238, 247, 255, 0.72);
  border-color: rgba(17, 52, 95, 0.16);
}

.operation-switch[open] summary {
  transform: rotate(90deg);
}

.operation-menu {
  position: absolute;
  top: 42px;
  right: 0;
  width: 260px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(17, 52, 95, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(20, 34, 31, 0.16);
}

.operation-menu a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: 8px 10px;
  border: 1px solid rgba(17, 52, 95, 0.08);
  border-radius: 12px;
  background: rgba(238, 247, 255, 0.5);
  color: #173f38;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 800;
}

.operation-menu a:hover,
.operation-menu a:focus-visible {
  background: rgba(224, 242, 254, 0.85);
  border-color: rgba(14, 116, 144, 0.22);
}

.operation-menu img {
  width: 210px;
  height: 52px;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

.quick-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 9px;
}

.alert-report-button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  border: 1px solid #fb923c;
  border-radius: 8px;
  background: linear-gradient(135deg, #fb923c 0%, #f97316 48%, #ea580c 100%);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.12;
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.22);
}

.alert-report-button svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.history-event-button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  border: 1px solid rgba(37, 116, 169, 0.22);
  border-radius: 8px;
  background: #eef7ff;
  color: #185b83;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.12;
}

.history-event-button svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.report-download-button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  border: 1px solid rgba(23, 63, 56, 0.18);
  border-radius: 8px;
  background: #ffffff;
  color: #173f38;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.12;
  box-shadow: 0 5px 12px rgba(20, 34, 31, 0.05);
}

.report-download-button svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.report-download-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.top-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: stretch;
  margin-bottom: 10px;
}

.province-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 0;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.province-picker select,
.theme-toggle {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 7px;
  font-weight: 700;
}

.province-picker select {
  min-width: 0;
  font-size: 0.76rem;
}

.theme-toggle {
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 0;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 0.66rem;
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle input {
  width: 13px;
  height: 13px;
  accent-color: #1d8f5f;
}

.theme-toggle svg {
  width: 13px;
  height: 13px;
}

.theme-toggle b {
  font-weight: 900;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef5f2;
}

.mode-toggle button,
.mode-toggle a {
  min-height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

.mode-toggle button.active,
.mode-toggle a.active {
  background: #173f38;
  color: #fff;
  box-shadow: 0 6px 14px rgba(23, 63, 56, 0.16);
}

.analysis-toolbox {
  margin-bottom: 10px;
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 14px;
  background:
    radial-gradient(circle at 8% 0%, rgba(14, 165, 233, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(248, 250, 252, 0.95));
  box-shadow: 0 10px 22px rgba(14, 116, 144, 0.1);
  overflow: hidden;
}

.analysis-toolbox summary {
  position: relative;
  overflow: hidden;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 12px;
  color: #10211c;
  font-size: 0.78rem;
  font-weight: 1000;
  cursor: pointer;
  list-style: none;
  border-bottom: 0;
  background: linear-gradient(135deg, #f8fffd 0%, #eefaf8 52%, #e4f5f2 100%);
  box-shadow: inset 0 -10px 20px rgba(255, 255, 255, 0.38), 0 6px 14px rgba(23, 63, 56, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

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

.analysis-toolbox summary::after {
  content: "▾";
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  border: 1px solid rgba(23, 63, 56, 0.12);
  border-radius: 999px;
  background: rgba(23, 63, 56, 0.06);
  color: rgba(23, 63, 56, 0.72);
  font-size: 0.72rem;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.analysis-toolbox summary::before {
  content: "";
  align-self: stretch;
  width: 4px;
  margin: 6px 0 6px -6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #0ea5e9, #173f38);
  flex: 0 0 auto;
}

.analysis-toolbox[open] summary::after {
  transform: rotate(180deg);
}

.analysis-toolbox summary:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 -10px 20px rgba(255, 255, 255, 0.42), 0 10px 20px rgba(23, 63, 56, 0.1);
}

.analysis-toolbox summary:hover::after {
  border-color: rgba(23, 63, 56, 0.2);
  background: rgba(23, 63, 56, 0.1);
}

.analysis-toolbox[open] summary {
  box-shadow: inset 0 -10px 20px rgba(255, 255, 255, 0.42), 0 0 0 2px rgba(14, 165, 233, 0.1);
}

.analysis-toolbox summary svg {
  width: 21px;
  height: 21px;
  padding: 4px;
  border-radius: 9px;
  background: rgba(23, 63, 56, 0.1);
  color: #173f38;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.analysis-toolbox .command-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 8px;
  margin-top: 0;
  overflow: visible;
}

.analysis-toolbox .command-tools .public-alert-button,
.analysis-toolbox .command-tools .population-impact-button,
.analysis-toolbox .command-tools .rain-forecast-button,
.analysis-toolbox .command-tools .risk-outlook-button,
.analysis-toolbox .command-tools .risk-incident-button,
.analysis-toolbox .command-tools .disabled-tool-button {
  width: 100%;
  min-height: 31px;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.68rem;
}

.analysis-toolbox .command-tools .public-alert-button {
  grid-column: 1 / -1;
}

.analysis-toolbox .command-tool-panel {
  margin: 0 8px 8px;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 8px;
}

.river-route-tool {
  margin: 0 0 10px;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at 8% 0%, rgba(124, 58, 237, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(245, 243, 255, 0.98), rgba(248, 250, 252, 0.95));
  box-shadow: 0 10px 22px rgba(124, 58, 237, 0.1);
  overflow: hidden;
}

.river-route-heading {
  position: relative;
  overflow: hidden;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: #10211c;
  font-size: 0.76rem;
  font-weight: 1000;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(135deg, #f8fffd 0%, #eefaf8 52%, #e4f5f2 100%);
  box-shadow: inset 0 -10px 20px rgba(255, 255, 255, 0.38), 0 6px 14px rgba(23, 63, 56, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.river-route-heading::-webkit-details-marker {
  display: none;
}

.river-route-heading::after {
  content: "▾";
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  border: 1px solid rgba(23, 63, 56, 0.12);
  border-radius: 999px;
  background: rgba(23, 63, 56, 0.06);
  color: rgba(23, 63, 56, 0.72);
  font-size: 0.72rem;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.river-route-heading::before {
  content: "";
  align-self: stretch;
  width: 4px;
  margin: 6px 0 6px -6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8b5cf6, #173f38);
  flex: 0 0 auto;
}

.river-route-tool[open] .river-route-heading::after {
  transform: rotate(180deg);
}

.river-route-heading:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 -10px 20px rgba(255, 255, 255, 0.42), 0 10px 20px rgba(23, 63, 56, 0.1);
}

.river-route-heading:hover::after {
  border-color: rgba(23, 63, 56, 0.2);
  background: rgba(23, 63, 56, 0.1);
}

.river-route-tool[open] .river-route-heading {
  box-shadow: inset 0 -10px 20px rgba(255, 255, 255, 0.42), 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.river-route-heading svg {
  width: 21px;
  height: 21px;
  padding: 4px;
  border-radius: 9px;
  background: rgba(23, 63, 56, 0.1);
  color: #173f38;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.river-route-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 8px 8px;
}

.river-route-options button {
  min-height: 30px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background: #ffffff;
  color: #173f38;
  padding: 0 8px;
  font-size: 0.66rem;
  font-weight: 900;
  cursor: pointer;
}

.river-route-options button.active {
  border-color: #173f38;
  background: #173f38;
  color: #fff;
}

.river-route-options button:disabled {
  border-color: rgba(107, 114, 128, 0.28);
  background: #f3f4f6;
  color: #7a817d;
  cursor: not-allowed;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.status-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f8fbfa 0%, #eef6f3 100%);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-left: 0;
  border-radius: 9px;
  padding: 7px 8px;
  box-shadow: 0 8px 18px rgba(20, 34, 31, 0.08);
}

.status-card::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -24px;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.status-card span {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1;
}

.status-card p {
  position: relative;
  z-index: 1;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.15;
}

.status-card.danger {
  background: linear-gradient(135deg, #7c3aed 0%, #b91c1c 52%, #7f1d1d 100%);
  border-color: rgba(124, 58, 237, 0.28);
  color: #fff;
}

.status-card.risk {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #f97316 100%);
  border-color: rgba(239, 68, 68, 0.28);
  color: #fff;
}

.status-card.warning {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 52%, #ea580c 100%);
  border-color: rgba(245, 158, 11, 0.32);
  color: #fff;
}

.status-card.normal {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 52%, #166534 100%);
  border-color: rgba(22, 163, 74, 0.28);
  color: #fff;
}

.status-card.danger p,
.status-card.risk p,
.status-card.warning p,
.status-card.normal p {
  color: rgba(255, 255, 255, 0.88);
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 24px rgba(20, 34, 31, 0.06);
}

.map-panel-right .panel {
  padding: 7px;
  margin-bottom: 6px;
  border-radius: 6px;
}

.map-panel-right .panel-title {
  margin-bottom: 5px;
  gap: 6px;
}

.map-panel-right .panel-title h2 {
  font-size: 0.74rem;
}

.map-panel-right .panel-title span {
  font-size: 0.58rem;
}

.map-panel-right .controls label {
  min-height: 21px;
  gap: 5px;
  font-size: 0.66rem;
}

.map-panel-right .controls input[type="checkbox"] {
  width: 12px;
  height: 12px;
}

.layer-count {
  margin-left: auto;
  min-width: 24px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--muted);
  font-size: 0.58rem;
  text-align: center;
}

.map-panel-right .icon-button {
  width: 24px;
  height: 24px;
}

.map-panel-right .slider-row {
  grid-template-columns: 1fr 64px;
  gap: 5px;
  margin-top: 4px;
  font-size: 0.62rem;
}

.map-panel-right .search {
  height: 28px;
  font-size: 0.66rem;
  padding: 0 7px;
}

.map-panel-right .select-grid {
  gap: 5px;
  margin-top: 5px;
}

.map-panel-right .select-grid label {
  gap: 3px;
  font-size: 0.6rem;
}

.map-panel-right .select-grid select {
  min-height: 27px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 0.64rem;
}

.map-panel-right .chips {
  gap: 4px;
  margin-top: 6px;
}

.map-panel-right .chip {
  min-height: 23px;
  padding: 0 6px;
  font-size: 0.62rem;
}

.map-panel-right .mini-danger-button {
  width: 100%;
  min-height: 25px;
  margin-top: 5px;
  border: 1px solid rgba(201, 47, 55, 0.32);
  border-radius: 6px;
  background: #fff5f5;
  color: #a51f2a;
  font-size: 0.64rem;
  font-weight: 800;
  cursor: pointer;
}

.map-panel-right .mini-danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.map-panel-right label.muted-disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.map-panel-right label.muted-disabled input {
  cursor: not-allowed;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h2 {
  font-size: 1rem;
}

.panel-title span {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: #25322f;
}

.controls input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1d8f5f;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #173f38;
  cursor: pointer;
}

.icon-button.loading svg {
  animation: spin 1s linear infinite;
}

.slider-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.slider-row input {
  width: 100%;
}

.layer-status {
  margin: 6px 0 0;
  color: #52606d;
  font-size: 11px;
  line-height: 1.35;
}

.tmd-nudge-panel {
  margin-top: 8px;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px dashed rgba(23, 63, 56, 0.22);
  border-radius: 8px;
  background: rgba(248, 251, 250, 0.72);
  color: var(--muted);
  font-size: 0.68rem;
}

.tmd-nudge-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tmd-nudge-panel strong {
  color: var(--ink);
  font-size: 0.7rem;
}

.tmd-nudge-panel span,
.tmd-nudge-panel small {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.tmd-nudge-grid button {
  min-height: 30px;
  border: 1px solid rgba(23, 63, 56, 0.18);
  border-radius: 7px;
  background: #fff;
  color: #173f38;
  font-size: 0.92rem;
  font-weight: 900;
  cursor: pointer;
}

.search {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
}

.search:focus {
  border-color: #2d9ccf;
  box-shadow: 0 0 0 3px rgba(45, 156, 207, 0.15);
}

.select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.select-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.select-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.chip.active {
  color: #fff;
  background: #173f38;
  border-color: #173f38;
}

.hot-list,
.affected-list {
  display: grid;
  gap: 8px;
}

.station-browser-panel {
  max-height: 42vh;
  overflow-y: auto;
}

.station-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}

.station-tab {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.station-tab.active {
  background: #173f38;
  border-color: #173f38;
  color: #fff;
}

.station-item,
.affected-item {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 9px 1fr auto;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  cursor: pointer;
}

.affected-item {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 6px;
  padding: 6px 7px;
  align-items: center;
  background: var(--panel);
  color: var(--ink);
}

.affected-section {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.affected-section + .affected-section {
  margin-top: 8px;
}

.affected-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
  color: inherit;
  cursor: pointer;
}

.affected-section-toggle span {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.affected-section-toggle strong {
  font-size: 0.72rem;
  font-weight: 800;
}

.panel-help {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.historical-event-list {
  display: grid;
  gap: 7px;
}

body.history-bottom-mode .historical-events-panel {
  display: none;
}

.historical-event-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.historical-event-item svg {
  width: 17px;
  height: 17px;
  color: #2574a9;
}

.historical-event-item strong {
  display: block;
  font-size: 0.78rem;
  line-height: 1.25;
}

.historical-event-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.3;
}

.historical-event-item .historical-rain-context {
  color: #0f766e;
  font-weight: 700;
}

.historical-event-item em {
  padding: 3px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #185b83;
  font-size: 0.62rem;
  font-style: normal;
  white-space: nowrap;
}

body.historical-pick-mode .leaflet-container {
  cursor: crosshair !important;
}

.history-event-button.pick-active {
  box-shadow: 0 0 0 3px rgba(37, 116, 169, 0.18);
  transform: translateY(-1px);
}

.historical-snapshot-preview {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #173b57;
  font-size: 0.78rem;
  line-height: 1.45;
}

.historical-snapshot-preview strong {
  font-size: 0.82rem;
}

.historical-snapshot-preview p {
  margin: 0;
  color: #335566;
}

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

.historical-snapshot-card {
  padding: 8px;
  border: 1px solid rgba(37, 116, 169, 0.2);
  border-radius: 8px;
  background: #fff;
}

.historical-snapshot-card span {
  display: block;
  color: #64748b;
  font-size: 0.66rem;
}

.historical-snapshot-card b {
  display: block;
  margin-top: 2px;
  color: #0f3f5f;
  font-size: 0.86rem;
}

.historical-snapshot-soil {
  padding-top: 2px;
  color: #0f766e;
  font-weight: 700;
}

.historical-flash-marker {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--event-color);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25), 0 0 0 3px color-mix(in srgb, var(--event-color) 24%, transparent);
}

.historical-flash-marker svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.6;
}

.historical-flash-popup .popup-resolve-button {
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: #16a34a;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.historical-flash-popup .popup-resolve-button:hover {
  filter: brightness(0.95);
}

.historical-rain-context-detail {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  padding: 8px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.historical-rain-context-detail > strong {
  color: #0f3f5f;
  font-size: 0.76rem;
}

.historical-rain-context-detail details {
  border: 1px solid rgba(37, 116, 169, 0.16);
  border-radius: 7px;
  background: #fff;
}

.historical-rain-context-detail summary {
  padding: 6px 8px;
  color: #173b57;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.historical-rain-context-detail ol {
  display: grid;
  gap: 5px;
  max-height: 168px;
  margin: 0;
  padding: 0 8px 8px;
  overflow: auto;
  list-style: none;
}

.historical-rain-context-detail li {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 6px;
  background: #eff6ff;
}

.historical-rain-context-detail li strong {
  color: #0f172a;
  font-size: 0.68rem;
}

.historical-rain-context-detail li span,
.historical-rain-context-detail li em,
.historical-rain-context-detail p {
  margin: 0;
  color: #526173;
  font-size: 0.62rem;
  font-style: normal;
  line-height: 1.35;
}

.historical-rain-context-detail.empty {
  color: #64748b;
  font-size: 0.68rem;
}

body.dark .historical-snapshot-preview {
  border-color: rgba(125, 211, 252, 0.26);
  background: rgba(15, 23, 42, 0.78);
  color: #e5f4ff;
}

body.dark .historical-snapshot-preview p {
  color: #b9c8d7;
}

body.dark .historical-snapshot-card {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

body.dark .historical-snapshot-card span {
  color: #cbd5e1;
}

body.dark .historical-snapshot-card b {
  color: #e0f2fe;
}

body.dark .historical-snapshot-soil {
  color: #5eead4;
}

body.dark .historical-rain-context-detail {
  border-color: rgba(125, 211, 252, 0.2);
  background: rgba(15, 23, 42, 0.72);
}

body.dark .historical-rain-context-detail > strong {
  color: #e0f2fe;
}

body.dark .historical-rain-context-detail details {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.05);
}

body.dark .historical-rain-context-detail summary,
body.dark .historical-rain-context-detail li strong {
  color: #f8fafc;
}

body.dark .historical-rain-context-detail li {
  background: rgba(255, 255, 255, 0.06);
}

body.dark .historical-rain-context-detail li span,
body.dark .historical-rain-context-detail li em,
body.dark .historical-rain-context-detail p {
  color: #cbd5e1;
}

@media (max-width: 620px) {
  .historical-snapshot-grid {
    grid-template-columns: 1fr;
  }
}

.affected-section-toggle i,
.affected-section-toggle svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.affected-section.collapsed .affected-section-body {
  display: none;
}

.affected-section-risk .affected-section-toggle {
  color: #6d28d9;
}

.affected-section-watch .affected-section-toggle {
  color: #b91c1c;
}

.empty-note.compact {
  padding: 8px;
  font-size: 0.66rem;
}

.station-item.compact {
  min-height: 0;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
}

.station-item strong,
.affected-item strong {
  display: block;
  font-size: 0.82rem;
}

.affected-item strong {
  font-size: 0.74rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-item.compact strong {
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-item small,
.affected-item small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.station-item small {
  font-size: 0.68rem;
  line-height: 1.28;
}

.station-item .station-api-index-line {
  color: #0f766e;
  font-weight: 900;
}

body.dark .station-item .station-api-index-line {
  color: #5eead4;
}

.affected-item small {
  font-size: 0.6rem;
  line-height: 1.18;
}

.station-item.compact small {
  font-size: 0.64rem;
  line-height: 1.25;
}

.risk-bar {
  width: 9px;
  height: 100%;
  min-height: 48px;
  border-radius: 5px;
  background: var(--normal);
}

.affected-item .risk-bar {
  width: 8px;
  min-height: 42px;
}

.village-risk-icon {
  position: relative;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: #fff;
  color: #d88a19;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.village-risk-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.8;
}

.village-risk-icon .village-risk-wave {
  position: absolute;
  right: -3px;
  bottom: -4px;
  width: 13px;
  height: 13px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #fff;
}

.village-risk-icon .village-risk-wave svg {
  width: 8px;
  height: 8px;
  stroke-width: 3;
}

.station-item.compact .risk-bar {
  min-height: 44px;
}

.affected-item.watch .risk-bar {
  background: #ef4444;
}

.affected-item.watch .village-risk-icon {
  color: #ef4444;
  background: #fff1f2;
}

.affected-item.risk .risk-bar {
  background: #b91c1c;
}

.affected-item.risk .village-risk-icon {
  color: #b91c1c;
  background: #fff1f2;
}

.affected-item.critical .risk-bar {
  background: #7c3aed;
}

.affected-item.critical .village-risk-icon {
  color: #7c3aed;
  background: #f5f3ff;
}

.affected-item.impact .risk-bar {
  background: #991b1b;
}

.affected-item.impact .village-risk-icon {
  color: #ffffff;
  background: #991b1b;
}

.affected-item.impact .flood-impact-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.8;
}

.affected-item.watch {
  border-color: var(--line);
}

.affected-item.risk {
  border-color: var(--line);
}

.affected-item.critical {
  border-color: var(--line);
}

.affected-item.impact {
  border-color: var(--line);
}

.empty-note {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  background: #fff;
  font-size: 0.78rem;
  line-height: 1.45;
}

.station-value {
  text-align: right;
  font-weight: 800;
  white-space: nowrap;
  font-size: 0.82rem;
}

.station-item.compact .station-value {
  font-size: 0.82rem;
}

.rain-accumulation-item small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.rain-now-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  font-size: 0.62rem;
  line-height: 1;
}

.rain-now-icon.muted {
  background: #eef3f1;
  color: #8b9a96;
}

.route-radar-lightning {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 5px;
  border-radius: 999px;
  background: #facc15;
  color: #111827;
  font-size: 0.66rem;
  font-weight: 1000;
  line-height: 1;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.22), 0 6px 12px rgba(180, 83, 9, 0.28);
}

.route-radar-lightning.compact {
  width: 16px;
  height: 16px;
  margin: 0 4px 0 0;
  font-size: 0.58rem;
}

.river-map-label strong .route-radar-lightning {
  flex: 0 0 auto;
}

.map-area {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto clamp(560px, 66vh, 760px) minmax(520px, 1fr);
  gap: 10px;
  padding: 10px;
  overflow: hidden;
  background: #e7eeeb;
}

.command-header {
  display: grid;
  grid-template-columns: minmax(240px, 0.74fr) minmax(360px, 1.26fr);
  gap: 4px 10px;
  align-items: start;
  align-content: start;
  padding: 6px 10px;
  border: 1px solid rgba(217, 226, 222, 0.95);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(21, 38, 35, 0.12);
}

.command-headline {
  min-width: 0;
  display: block;
}

.command-headline h2 {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.15;
}

.command-headline p,
.command-recommendation {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.command-summary {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}

.command-summary strong {
  display: block;
  color: #10211c;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.15;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
}

#headline {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  outline: 0 !important;
}

.command-summary strong.headline-status.risk,
.command-summary strong.headline-status.critical,
.command-summary strong.headline-status.impact {
  color: #c92f37;
}

.command-summary strong.headline-status.warning {
  color: #b45309;
}

.command-summary strong.headline-status.normal {
  color: #10211c;
}

.command-summary p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.25;
}

.assessment-disclaimer {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dc2626;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.25;
}

.assessment-disclaimer svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.situation-badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 106px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.command-status-group {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: start;
}

.situation-badge.normal {
  background: linear-gradient(135deg, #22c55e 0%, #15803d 58%, #166534 100%);
}

.situation-badge.watch {
  background: linear-gradient(135deg, #fbbf24 0%, #ca8a04 56%, #a16207 100%);
}

.situation-badge.prepare {
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 56%, #c2410c 100%);
}

.situation-badge.alert {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 56%, #991b1b 100%);
}

.situation-badge.response {
  background: linear-gradient(135deg, #7c3aed 0%, #7c2d12 60%, #431407 100%);
}

.command-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 5px;
}

.command-metrics div {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid rgba(14, 116, 144, 0.12);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 253, 250, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.command-metrics div::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -22px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(14, 116, 144, 0.08);
  pointer-events: none;
}

.command-metrics strong,
.command-metrics span {
  position: relative;
  z-index: 1;
  display: block;
  line-height: 1.15;
}

.command-metrics strong {
  font-size: 0.92rem;
}

.command-metrics span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
}

.command-recommendation {
  min-width: 0;
  margin: 0;
  padding: 5px 9px 5px 10px;
  border: 1px solid rgba(23, 63, 56, 0.16);
  border-left: 3px solid #173f38;
  border-radius: 8px;
  background: #f8fbfa;
  color: #173f38;
  font-size: 0.7rem;
  line-height: 1.35;
  font-weight: 900;
}

.command-recommendation::before {
  content: "ควรทำต่อ: ";
  color: #0f766e;
  font-weight: 900;
}

.command-action-summary {
  display: inline-grid;
  gap: 5px;
  vertical-align: top;
}

.command-action-summary > strong {
  color: #173f38;
  font-size: 0.68rem;
  line-height: 1.1;
}

.command-tambon-list {
  display: grid;
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 2px;
}

.command-tambon-card {
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.88);
}

.command-tambon-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.command-tambon-card header b {
  color: #15352e;
  font-size: 0.75rem;
}

.command-tambon-card header small {
  color: #64748b;
  font-size: 0.58rem;
}

.command-tambon-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.command-tambon-metrics > span {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  column-gap: 5px;
  padding: 5px 6px;
  border-radius: 6px;
}

.command-tambon-metrics svg {
  grid-row: 1 / 3;
  width: 18px;
  height: 18px;
}

.command-tambon-metrics b {
  font-size: 0.75rem;
  line-height: 1;
}

.command-tambon-metrics small {
  font-size: 0.54rem;
  line-height: 1.15;
}

.command-tambon-metrics .food {
  background: #e0f2fe;
  color: #075985;
}

.command-tambon-metrics .evacuate {
  background: #fef2f2;
  color: #991b1b;
}

.command-tambon-villages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.command-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.command-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background: rgba(240, 253, 250, 0.92);
  color: #115e59;
  padding: 3px 8px;
  font-size: 0.62rem;
  line-height: 1.1;
}

.command-action-chip b {
  color: inherit;
  font-weight: 900;
  white-space: nowrap;
}

.command-action-chip i {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  font-style: normal;
  font-weight: 800;
  opacity: 0.9;
}

.command-action-cancel {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
}

.command-action-cancel:hover,
.command-action-cancel:focus-visible {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #ffffff;
  opacity: 1;
}

.command-action-chip.alert {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(254, 242, 242, 0.96);
  color: #b91c1c;
}

.command-action-chip.inspect {
  border-color: rgba(245, 158, 11, 0.34);
  background: rgba(255, 251, 235, 0.96);
  color: #92400e;
}

.command-action-chip.evacuate {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(245, 243, 255, 0.96);
  color: #6d28d9;
}

.command-action-chip.food {
  border-color: rgba(2, 132, 199, 0.3);
  background: rgba(240, 249, 255, 0.96);
  color: #0369a1;
}

.command-action-more {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #475569;
  padding: 3px 8px;
  font-size: 0.62rem;
  font-weight: 900;
}

.command-action-wait {
  color: #64748b;
  font-weight: 900;
}

.command-action-row {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  gap: 4px;
  overflow: visible;
  margin-top: 0;
  padding-top: 0;
}

.mission-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  overflow: visible;
}

.mission-actions-primary,
.mission-actions-quick {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mission-actions-quick {
  justify-content: flex-end;
}

.mission-actions button {
  flex: 0 1 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #173f38;
  padding: 0 17px;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
}

.mission-actions button svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.mission-actions-primary button {
  min-width: 106px;
}

.mission-actions-quick button {
  min-width: 112px;
  background: #f8fbfa;
  border-color: rgba(15, 118, 110, 0.18);
  color: #0f766e;
}

.mission-actions button.active {
  background: #173f38;
  border-color: #173f38;
  color: #fff;
}

.mission-actions .disabled-mission-button,
.mission-actions button:disabled {
  border-color: rgba(107, 114, 128, 0.28);
  background: #f3f4f6;
  color: #7a817d;
  cursor: not-allowed;
  opacity: 0.78;
}

.station-map-label,
.village-map-label {
  border: 1px solid rgba(23, 63, 56, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #173f38;
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.16);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.15;
  padding: 5px 8px;
  white-space: nowrap;
}

.summary-station-label {
  appearance: none;
  display: grid;
  gap: 2px;
  width: 220px;
  border: 2px solid currentColor;
  border-radius: 10px;
  background: rgba(12, 14, 18, 0.94);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.12);
  padding: 6px 9px;
  text-align: center;
  pointer-events: auto;
  cursor: pointer;
  font-family: inherit;
  color: #ffffff !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.summary-station-label:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.summary-station-label.expanded {
  z-index: 2;
}

.summary-station-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  line-height: 1.1;
}

.summary-station-label em {
  justify-self: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.56rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  padding: 3px 8px;
}

.summary-station-label span {
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.1;
}

.summary-station-label small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.05;
}

.impact-village-label {
  appearance: none;
  display: grid;
  gap: 2px;
  width: 168px;
  border: 2px solid #f97316;
  border-radius: 9px;
  background: rgba(12, 14, 18, 0.9);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.26);
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.08;
  padding: 5px 7px;
  pointer-events: auto;
  text-align: center;
}

.impact-village-label strong,
.impact-village-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.impact-village-label strong {
  font-size: 0.66rem;
  font-weight: 900;
}

.impact-village-label span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.56rem;
  font-weight: 800;
}

.summary-station-villages {
  max-height: 142px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 6px 0 0 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  text-align: left;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.25;
}

.summary-station-villages li {
  margin: 2px 0;
}

.summary-station-more {
  color: #cbd5e1;
}

.station-map-label::before,
.village-map-label::before {
  display: none;
}

.station-map-label.severity-impact,
.station-map-label.severity-critical,
.village-map-label.level-critical,
.village-map-label.level-impact {
  border-color: rgba(124, 58, 237, 0.54);
  color: #5b21b6;
}

.station-map-label.severity-risk,
.village-map-label.level-risk {
  border-color: rgba(185, 28, 28, 0.48);
  color: #991b1b;
}

body.dark .station-map-label,
body.dark .village-map-label {
  background: rgba(31, 31, 29, 0.92);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f8fafc;
}

body.dark .summary-station-villages {
  border-top-color: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}

body.dark .summary-station-more {
  color: #cbd5e1;
}

.command-tools {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: visible;
  margin-top: 0;
}

.command-tools .public-alert-button,
.command-tools .population-impact-button,
.command-tools .rain-forecast-button,
.command-tools .risk-outlook-button,
.command-tools .risk-incident-button,
.command-tools .disabled-tool-button {
  width: auto;
  min-height: 26px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
}

.command-tools .public-alert-button.active,
.command-tools .population-impact-button.active,
.command-tools .rain-forecast-button.active,
.command-tools .risk-outlook-button.active,
.command-tools .risk-incident-button.active {
  filter: saturate(1.12);
  outline: 2px solid rgba(23, 63, 56, 0.18);
  outline-offset: 1px;
}

.command-tools .population-impact-button {
  background: #f0f9ff;
  color: #075985;
}

.command-tools .rain-forecast-button {
  background: #f7fee7;
  color: #365314;
  border-color: rgba(101, 163, 13, 0.25);
}

.command-tools .risk-outlook-button {
  background: #fff7ed;
  color: #9a3412;
  border-color: rgba(249, 115, 22, 0.28);
}

.command-tools .risk-incident-button {
  background: #fdf2f8;
  color: #9f1239;
  border-color: rgba(225, 29, 72, 0.28);
}

.command-tools .disabled-tool-button {
  border: 1px solid rgba(107, 114, 128, 0.25);
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 0.78;
}

.command-tools .disabled-tool-button svg {
  width: 15px;
  height: 15px;
}

.command-tool-panel {
  grid-column: 1 / -1;
  margin: -1px 0 0;
  max-height: 220px;
  overflow-y: auto;
}

.risk-outlook-total {
  border-color: rgba(249, 115, 22, 0.28);
  background: #fff7ed;
}

.risk-incident-total {
  border-color: rgba(225, 29, 72, 0.28);
  background: #fff1f2;
}

.risk-analysis-loading {
  min-height: 112px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.92);
  color: #15352e;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.risk-analysis-loading.compact {
  min-height: 56px;
  padding: 10px;
}

.risk-analysis-loading strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.2;
}

.risk-analysis-loading small {
  display: block;
  color: #64748b;
  font-size: 0.74rem;
  line-height: 1.35;
  margin-top: 2px;
}

.risk-incident-list .impact-row span {
  min-width: 76px;
}

.risk-incident-section {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.risk-incident-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #15352e;
}

.risk-incident-section > header strong {
  font-size: 0.92rem;
}

.risk-incident-section > header span {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
}

.risk-incident-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.risk-incident-card-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.risk-incident-action-card {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-left: 5px solid #f97316;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #15352e;
  padding: 12px;
  display: grid;
  gap: 10px;
  cursor: pointer;
}

.risk-incident-action-card:not(.stream-area) {
  background: #ffffff;
  color: #15352e;
  box-shadow: none;
}

.risk-incident-action-card .village-action-label,
.risk-incident-action-card .village-action-buttons {
  margin-top: 2px;
}

.risk-incident-action-card.stream-area {
  padding: 8px;
  gap: 6px;
  background: #ffffff;
  color: #15352e;
  box-shadow: none;
}

.risk-incident-action-card.critical {
  border-left-color: #7c3aed;
}

.risk-incident-action-card.risk {
  border-left-color: #ef4444;
}

.risk-incident-action-card.watch {
  border-left-color: #f97316;
}

.risk-incident-action-card.monitor {
  border-left-color: #facc15;
}

.risk-incident-action-card header,
.risk-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.risk-incident-action-card header strong,
.risk-card-title strong {
  display: block;
  color: #0f172a;
  font-size: 1.05rem;
  line-height: 1.15;
}

.risk-incident-action-card header small,
.risk-card-title small {
  color: #64748b;
  font-size: 0.72rem;
}

.risk-incident-action-card header > b,
.risk-card-score {
  min-width: 68px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
  padding: 5px 7px;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1;
}

.risk-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #0f766e;
  font-weight: 900;
  font-size: 0.75rem;
}

.risk-incident-action-card.critical .risk-rank {
  background: #7c3aed;
}

.risk-incident-action-card.risk .risk-rank {
  background: #ef4444;
}

.risk-incident-action-card.watch .risk-rank {
  background: #f97316;
}

.risk-incident-action-card.monitor .risk-rank {
  background: #d97706;
}

.risk-incident-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.risk-incident-meta span {
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background: rgba(240, 253, 250, 0.92);
  color: #115e59;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 800;
}

.risk-card-primary {
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.7);
  padding: 8px 9px;
}

.risk-card-primary > b {
  display: block;
  color: #0f766e;
  font-size: 0.72rem;
  line-height: 1.2;
  margin-bottom: 5px;
}

.risk-card-primary ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 16px;
}

.risk-card-primary li {
  color: #334155;
  font-size: 0.76rem;
  line-height: 1.32;
}

.risk-action-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.risk-action-sections section {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.78);
  padding: 7px 8px;
}

.risk-action-sections section:first-child,
.risk-action-sections section:last-of-type {
  grid-column: 1 / -1;
}

.risk-action-sections b {
  display: inline-block;
  color: #0f766e;
  font-size: 0.62rem;
  letter-spacing: 0;
}

.risk-action-sections p {
  margin: 2px 0 0;
  color: #334155;
  font-size: 0.72rem;
  line-height: 1.28;
}

.risk-incident-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 5px;
  margin: 5px 0 2px;
}

.risk-incident-bars span {
  position: relative;
  min-width: 0;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 6px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  font-size: 0.62rem;
  line-height: 1;
}

.risk-incident-bars span::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--risk-width, 0%);
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.22), rgba(124, 58, 237, 0.2));
}

.risk-incident-bars b,
.risk-incident-bars i {
  position: relative;
  z-index: 1;
  font-style: normal;
}

.risk-incident-bars b {
  font-weight: 800;
}

body.dark .risk-incident-total {
  border-color: rgba(251, 113, 133, 0.32);
  background: rgba(76, 29, 43, 0.42);
}

body.dark .risk-analysis-loading {
  background: rgba(18, 18, 17, 0.96);
  border-color: rgba(94, 234, 212, 0.24);
  color: #eef7f3;
}

body.dark .risk-analysis-loading small {
  color: #cbd5d1;
}

body.dark .risk-incident-section > header {
  color: #eef7f3;
}

body.dark .risk-incident-section > header span {
  color: #cbd5d1;
}

body.dark .risk-incident-list .forecast-row,
body.dark .risk-incident-list .forecast-row.warning,
body.dark .risk-incident-list .forecast-row.watch,
body.dark .risk-incident-list .forecast-row.risk,
body.dark .risk-incident-list .forecast-row.critical {
  background: rgba(18, 18, 17, 0.96);
  border-color: rgba(251, 113, 133, 0.34);
  color: #eef7f3;
}

body.dark .risk-incident-list .forecast-row strong {
  color: #ffffff;
}

body.dark .risk-incident-list .forecast-row small {
  color: #cbd5d1;
}

body.dark .risk-incident-list .forecast-row > span {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

body.dark .risk-incident-bars span {
  background: rgba(238, 247, 243, 0.08);
  color: #eef7f3;
}

body.dark .risk-incident-action-card {
  background: rgba(18, 18, 17, 0.96);
  border-color: rgba(255, 255, 255, 0.14);
  color: #eef7f3;
}

body.dark .risk-incident-action-card:not(.stream-area) {
  background: rgba(18, 18, 17, 0.96);
  color: #eef7f3;
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark .risk-incident-action-card.critical:not(.stream-area) {
  border-left-color: #a78bfa;
}

body.dark .risk-incident-action-card.risk:not(.stream-area) {
  border-left-color: #ef4444;
}

body.dark .risk-incident-action-card.watch:not(.stream-area) {
  border-left-color: #f97316;
}

body.dark .risk-incident-action-card.monitor:not(.stream-area) {
  border-left-color: #facc15;
}

body.dark .risk-incident-action-card.stream-area {
  background: rgba(18, 18, 17, 0.96);
  color: #eef7f3;
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark .risk-incident-action-card.stream-area.watch {
  border-left-color: #f97316;
}

body.dark .risk-incident-action-card.stream-area.risk {
  border-left-color: #ef4444;
}

body.dark .risk-incident-action-card.stream-area.critical {
  border-left-color: #a78bfa;
}

body.dark .risk-incident-action-card header strong,
body.dark .risk-incident-action-card header > b,
body.dark .risk-card-title strong {
  color: #ffffff;
}

body.dark .risk-incident-action-card header small,
body.dark .risk-card-title small,
body.dark .risk-action-sections p,
body.dark .risk-card-primary li {
  color: #cbd5d1;
}

body.dark .risk-card-score {
  background: rgba(124, 58, 237, 0.2);
  color: #ffffff;
}

body.dark .risk-public-guidance {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.7);
}

body.dark .risk-public-guidance b {
  color: #f8fafc;
}

body.dark .risk-public-guidance span {
  color: rgba(226, 232, 240, 0.78);
}

body.dark .risk-card-primary,
body.dark .risk-action-sections section {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark .risk-card-primary > b {
  color: #5eead4;
}

body.dark .risk-incident-meta span {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

body.dark .village-action-label {
  background: rgba(20, 83, 45, 0.42);
  border-color: rgba(134, 239, 172, 0.24);
  color: #dcfce7;
}

body.dark .village-action-label.alert {
  background: rgba(127, 29, 29, 0.48);
  border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca;
}

body.dark .village-action-label.inspect {
  background: rgba(120, 53, 15, 0.5);
  border-color: rgba(251, 191, 36, 0.34);
  color: #fde68a;
}

body.dark .village-action-label.evacuate {
  background: rgba(76, 29, 149, 0.52);
  border-color: rgba(167, 139, 250, 0.36);
  color: #ede9fe;
}

body.dark .village-action-label.food {
  background: rgba(7, 89, 133, 0.46);
  border-color: rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}

body.dark .action-food-estimate {
  color: #bae6fd !important;
}

body.dark .action-food-estimate.unavailable {
  color: #94a3b8 !important;
}

body.dark .village-action-buttons button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f4f4ef;
}

body.dark .village-action-buttons button:hover,
body.dark .village-action-buttons button:focus-visible,
body.dark .village-action-buttons button.active {
  background: #0f766e;
  border-color: #5eead4;
  color: #ffffff;
}

body.dark .village-action-buttons .village-action-clear,
body.dark .action-status-cancel {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(127, 29, 29, 0.42);
  color: #fecaca;
}

body.dark .village-action-buttons .village-action-clear:hover,
body.dark .village-action-buttons .village-action-clear:focus-visible,
body.dark .action-status-cancel:hover,
body.dark .action-status-cancel:focus-visible {
  border-color: #f87171;
  background: #b91c1c;
  color: #ffffff;
}

body.dark .risk-action-sections b {
  color: #5eead4;
}

body.dark .popup-action-block {
  border-top-color: rgba(255, 255, 255, 0.16);
}

body.dark .popup-action-block > strong {
  color: #f4f4ef;
}

body.dark .command-tools .risk-incident-button {
  background: rgba(76, 29, 43, 0.72);
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.34);
}

.risk-outlook-circle {
  mix-blend-mode: multiply;
}

.risk-outlook-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 120px;
  padding: 3px 7px;
  border: 1.5px solid var(--outlook-color);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.86);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.24);
}

.risk-outlook-label strong {
  color: #fde68a;
  font-size: 0.66rem;
}

.risk-outlook-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecmwf-grid-label {
  max-width: 132px;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  border-radius: 10px;
  text-align: center;
  line-height: 1.12;
}

.ecmwf-grid-label strong {
  color: #ffffff;
  font-size: 0.76rem;
}

.ecmwf-grid-label span {
  max-width: 112px;
  color: #e5e7eb;
  font-size: 0.58rem;
}

.ecmwf-station-signal {
  stroke-dasharray: 4 4;
}

.mission-hint {
  grid-column: 1 / -1;
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.35;
}

.map-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  justify-self: stretch;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #dbe7e2;
  box-shadow: 0 14px 38px rgba(21, 38, 35, 0.14);
  transition: margin 180ms ease;
}

.map-area.panel-open .map-frame {
  width: 100%;
  margin-right: 0;
}

#map {
  height: 100%;
  min-height: 0;
  width: 100%;
  background: #dfeee7;
}

#map.leaflet-container,
#map .leaflet-container {
  background: #dfeee7;
}

#map .leaflet-tile {
  backface-visibility: hidden;
  transform: translateZ(0);
}

.map-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 720;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(135deg, rgba(238, 243, 241, 0.82), rgba(255, 255, 255, 0.64));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: auto;
  opacity: 1;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.map-loading-overlay.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.map-loading-overlay.is-background {
  place-items: start center;
  padding: 12px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

.map-loading-overlay.is-background .map-loading-card {
  width: min(320px, calc(100% - 24px));
  grid-template-columns: 22px minmax(0, 1fr);
  justify-items: start;
  gap: 2px 9px;
  padding: 9px 12px;
  border-radius: 8px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(21, 38, 35, 0.15);
}

.map-loading-overlay.is-background .map-loading-spinner {
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  border-width: 3px;
}

.map-loading-overlay.is-background .map-loading-card strong,
.map-loading-overlay.is-background .map-loading-card p {
  margin: 0;
  line-height: 1.25;
}

.map-loading-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(360px, 92%);
  padding: 18px 20px;
  border: 1px solid rgba(29, 143, 95, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: #173f38;
  text-align: center;
  box-shadow: 0 18px 48px rgba(21, 38, 35, 0.18);
}

.map-loading-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(29, 143, 95, 0.16);
  border-top-color: #1d8f5f;
  border-radius: 999px;
  animation: map-loading-spin 850ms linear infinite;
}

.map-loading-card strong {
  font-size: 0.94rem;
  font-weight: 900;
}

.map-loading-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.45;
}

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

#map.map-is-zooming .station-marker,
#map.map-is-zooming .station-marker.radar-confirmed,
#map.map-is-zooming .station-marker.stale-marker {
  filter: none;
}

#map.map-is-zooming .leaflet-marker-pane,
#map.map-is-zooming .leaflet-overlay-pane,
#map.map-is-zooming .leaflet-tile-pane {
  will-change: transform;
}

#map.map-is-zooming .leaflet-overlay-pane svg {
  shape-rendering: optimizeSpeed;
}

.bottom-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(21, 38, 35, 0.1);
}

.bottom-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bottom-panel-head h2 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.15;
}

.bottom-panel-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.bottom-assessment-note {
  margin: 4px 0 0;
  color: #b45309;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.25;
}

.method-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #99d4c9;
  border-radius: 999px;
  background: #ecfdf5;
  color: #0f766e;
  padding: 0 10px;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
}

.method-button svg {
  width: 14px;
  height: 14px;
}

.bottom-panel-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.bottom-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef3f1;
}

.bottom-tabs button,
.bottom-panel-controls select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #173f38;
  padding: 0 10px;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
}

#bottomDistrictFilter {
  max-width: 170px;
}

.bottom-tabs button {
  border-color: transparent;
  background: transparent;
}

.bottom-tabs button.active {
  background: #173f38;
  color: #fff;
}

.bottom-village-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: -2px;
}

.bottom-village-legend[hidden] {
  display: none;
}

.bottom-village-legend span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #44524e;
  font-size: 0.66rem;
  font-weight: 900;
  white-space: nowrap;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.village-risk-yellow {
  background: #facc15;
}

.village-risk-orange {
  background: #f97316;
}

.village-risk-red {
  background: #ef4444;
}

.village-risk-purple {
  background: #7c3aed;
}

.bottom-ops-list {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 6px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.bottom-risk-section {
  min-width: 0;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px;
  align-content: start;
}

.bottom-risk-section + .bottom-risk-section {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.bottom-risk-section h3 {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  color: #15352e;
  font-size: 0.76rem;
  line-height: 1.2;
}

.bottom-ops-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-left: 5px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.bottom-ops-item.station {
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.bottom-ops-item.action-card {
  align-items: start;
}

.bottom-ops-item.village.watch {
  border-left-color: #f97316;
  background: #fff;
}

.bottom-ops-item.village.risk {
  border-left-color: #b91c1c;
  background: #fff;
}

.bottom-ops-item.village.critical,
.bottom-ops-item.village.impact {
  border-left-color: #7c3aed;
  background: #fff;
}

.bottom-ops-item.village.impact {
  border-left-color: #991b1b;
}

.bottom-ops-item.village.stream-area {
  background: #fff;
  color: var(--ink);
}

.bottom-ops-item.village.stream-area.watch {
  border-left-color: #f97316;
}

.bottom-ops-item.village.stream-area.risk {
  border-left-color: #b91c1c;
}

.bottom-ops-item.village.stream-area.critical {
  border-left-color: #7c3aed;
}

.bottom-ops-item .village-risk-icon {
  width: 21px;
  height: 21px;
  border-width: 1.5px;
  box-shadow: none;
}

.bottom-ops-item .village-risk-icon svg {
  width: 11px;
  height: 11px;
}

.bottom-ops-item .village-risk-icon .village-risk-wave {
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
}

.bottom-ops-item .village-risk-icon .village-risk-wave svg {
  width: 6px;
  height: 6px;
}

.bottom-ops-item.village.watch .village-risk-icon {
  color: #f97316;
  background: #fff;
}

.bottom-ops-item.village.risk .village-risk-icon {
  color: #b91c1c;
  background: #fff;
}

.bottom-ops-item.village.critical .village-risk-icon {
  color: #7c3aed;
  background: #fff;
}

.bottom-ops-item.village.impact .village-risk-icon {
  color: #991b1b;
  background: #fff;
}

.bottom-ops-item strong,
.bottom-ops-item small {
  display: block;
  min-width: 0;
}

.bottom-ops-item strong {
  font-size: 0.72rem;
  line-height: 1.18;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-ops-item small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.14;
}

.bottom-ops-item em {
  color: #173f38;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.bottom-ops-item.historical-bottom-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
  border-left-color: #16a34a;
}

.bottom-ops-item.historical-bottom-item em {
  color: #15803d;
  font-size: 0.74rem;
}

.kok-route-panel {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 9px;
}

.kok-route-summary {
  padding: 9px 10px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(20, 184, 166, 0.08));
}

.kok-route-summary strong,
.kok-route-summary p,
.kok-route-summary small {
  display: block;
}

.kok-route-summary strong {
  color: #0f3f7a;
  font-size: 0.82rem;
  line-height: 1.2;
}

.kok-route-summary p {
  margin: 3px 0;
  color: #123c35;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.25;
}

.kok-route-summary small {
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.35;
}

.river-map-label {
  --route-color: #2563eb;
  width: 230px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-left: 5px solid var(--route-color);
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 7px 9px 7px 6px;
  text-align: left;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.river-map-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 14px;
  height: 14px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid rgba(15, 23, 42, 0.14);
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(17, 24, 39, 0.92);
}

.river-map-label i {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: var(--route-color);
  color: #fff;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.river-map-label strong,
.river-map-label small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.river-map-label strong {
  color: #fff;
  font-size: 0.76rem;
  line-height: 1.15;
}

.river-map-label small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.57rem;
  line-height: 1.22;
}

.river-map-segment-label {
  min-width: 136px;
  display: inline-grid;
  justify-items: center;
  gap: 1px;
  border: 1px solid rgba(248, 250, 252, 0.8);
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  padding: 5px 10px;
  box-shadow: 0 10px 24px rgba(185, 28, 28, 0.24);
}

.river-map-segment-label em {
  max-width: 128px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.54rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.river-route-direction-arrow {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

.river-route-direction-arrow span {
  display: inline-block;
  color: var(--route-color);
  font-size: 1.1rem;
  font-weight: 1000;
  line-height: 1;
  transform-origin: center;
}

.river-map-segment-label strong,
.river-map-segment-label span {
  color: #fff;
  line-height: 1;
  white-space: nowrap;
}

.river-map-segment-label strong {
  font-size: 0.68rem;
  font-weight: 900;
}

.river-map-segment-label span {
  font-size: 0.56rem;
  font-weight: 900;
}

.river-alert-label {
  width: 260px;
  display: grid;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-left: 6px solid var(--route-color);
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 8px 10px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(8px);
}

.river-alert-label strong,
.river-alert-label span {
  color: #fff;
  line-height: 1.18;
}

.river-alert-label strong {
  font-size: 0.82rem;
}

.river-alert-label span {
  font-size: 0.62rem;
  font-weight: 800;
}

.river-alert-label .route-countdown {
  width: fit-content;
  border-radius: 999px;
  background: var(--route-color);
  color: #fff;
  padding: 3px 8px;
  font-size: 0.62rem;
  font-weight: 1000;
  line-height: 1.1;
}

.route-alert-summary {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: #f8fbfa;
  color: #123c35;
  padding: 4px 9px;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.15;
}

.route-evacuation-countdown {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  border: 1px solid rgba(127, 29, 29, 0.18);
  border-left: 6px solid var(--route-color);
  border-radius: 10px;
  background: #fff7ed;
  padding: 9px 11px;
  color: #7f1d1d;
}

.route-evacuation-countdown span {
  grid-row: span 2;
  border-radius: 999px;
  background: var(--route-color);
  color: #fff;
  padding: 7px 10px;
  font-size: 0.72rem;
  font-weight: 1000;
  line-height: 1;
}

.route-evacuation-countdown strong {
  color: #7f1d1d;
  font-size: 1rem;
  font-weight: 1000;
  line-height: 1.05;
}

.route-evacuation-countdown small {
  color: #7c2d12;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
}

.route-station-panel,
.route-rain-panel,
.route-impact-panel {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 8px;
  background: #fff;
}

.route-station-panel h3,
.route-rain-panel h3,
.route-impact-panel h3 {
  margin: 0;
  color: #173f38;
  font-size: 0.7rem;
  line-height: 1.2;
}

.route-rain-grid,
.route-impact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.route-rain-chip,
.route-impact-chip {
  min-width: 0;
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-left: 4px solid #8b5cf6;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.route-rain-chip {
  border-left-color: #0ea5e9;
  background: #f0f9ff;
}

.route-rain-chip strong,
.route-rain-chip span,
.route-rain-chip small,
.route-impact-chip strong,
.route-impact-chip span,
.route-impact-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-rain-chip strong,
.route-impact-chip strong {
  font-size: 0.68rem;
  line-height: 1.15;
}

.route-rain-chip span,
.route-impact-chip span {
  color: #173f38;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1.12;
}

.route-rain-chip small,
.route-impact-chip small {
  color: var(--muted);
  font-size: 0.54rem;
  line-height: 1.22;
  white-space: normal;
}

.route-impact-village-marker {
  filter: drop-shadow(0 5px 10px rgba(15, 23, 42, 0.24));
}

.river-route-diagram {
  --route-color: #2563eb;
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.94), rgba(240, 253, 250, 0.92)),
    radial-gradient(circle at 18% 16%, rgba(96, 165, 250, 0.18), transparent 30%),
    radial-gradient(circle at 78% 22%, rgba(20, 184, 166, 0.16), transparent 28%);
  box-shadow: inset 0 -42px 0 rgba(15, 118, 110, 0.06);
}

.river-route-diagram::-webkit-scrollbar {
  height: 5px;
}

.river-route-diagram::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.24);
}

.river-route-node {
  flex: 0 0 180px;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 52px auto;
  align-items: center;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: center;
  cursor: pointer;
}

.river-route-node:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.river-node-metrics {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.river-node-metric {
  min-width: 0;
  display: grid;
  gap: 1px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 8px;
  padding: 5px 6px;
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.river-node-metric.water {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.river-node-metric.flow {
  background: linear-gradient(135deg, #047857, #16a34a);
}

.river-node-metric small {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.5rem;
  font-weight: 900;
  line-height: 1;
}

.river-node-metric strong {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.river-gauge {
  position: relative;
  width: 46px;
  height: 52px;
  display: inline-flex;
  justify-content: center;
}

.river-gauge::before {
  content: "";
  position: absolute;
  top: 0;
  width: 9px;
  height: 52px;
  border: 2px solid #111827;
  border-radius: 999px;
  background: repeating-linear-gradient(
    to bottom,
    #fde047 0 5px,
    #111827 5px 7px,
    #fde047 7px 12px
  );
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.2);
}

.river-gauge i {
  position: absolute;
  bottom: 5px;
  left: 5px;
  right: 5px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--route-color), transparent);
  opacity: 0.28;
}

.river-gauge b {
  position: absolute;
  right: 0;
  top: 16px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--route-color);
  color: #fff;
  font-size: 0.64rem;
  line-height: 1;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.18);
}

.river-node-card {
  width: 100%;
  min-height: 98px;
  display: grid;
  align-content: start;
  gap: 2px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-top: 4px solid var(--route-color);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.river-node-card strong {
  color: #123c35;
  font-size: 0.68rem;
  line-height: 1.18;
}

.river-node-card small,
.river-node-card span,
.river-node-card em {
  color: var(--muted);
  font-size: 0.54rem;
  font-style: normal;
  line-height: 1.18;
}

.river-node-card span {
  color: #173f38;
  font-weight: 900;
}

.river-route-segment {
  flex: 0 0 86px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding-top: 30px;
  color: #9a3412;
  text-align: center;
}

.river-route-arrow {
  width: 66px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(0 22%, 68% 22%, 68% 0, 100% 50%, 68% 100%, 68% 78%, 0 78%);
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
  text-indent: -3px;
  filter: drop-shadow(0 8px 12px rgba(185, 28, 28, 0.22));
}

.river-route-segment strong {
  color: #9a3412;
  font-size: 0.7rem;
  line-height: 1;
}

.river-route-segment small {
  color: #7c2d12;
  font-size: 0.56rem;
  font-weight: 900;
  line-height: 1;
}

.kok-route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 7px;
}

.kok-route-station-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid #2563eb;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.kok-route-station-card:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.kok-route-station-card i,
.kok-route-segment-index {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #173f38;
  color: #fff;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

.kok-route-station-card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.72rem;
  line-height: 1.2;
}

.kok-route-station-card small {
  display: block;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.18;
}

.kok-route-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}

.kok-route-metrics b {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef6ff;
  color: #0f3f7a;
  font-size: 0.58rem;
  line-height: 1.1;
  white-space: nowrap;
}

.kok-route-flow {
  display: grid;
  gap: 7px;
}

.kok-route-segment {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid rgba(249, 115, 22, 0.28);
  border-radius: 8px;
  background: #fffaf4;
}

.kok-route-segment-index {
  background: #f97316;
}

.kok-route-segment strong {
  display: block;
  color: #123c35;
  font-size: 0.72rem;
  line-height: 1.2;
}

.kok-route-segment p {
  margin: 2px 0;
  color: #31413e;
  font-size: 0.66rem;
  line-height: 1.2;
}

.kok-route-segment small {
  display: block;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.25;
}

.village-action-label {
  grid-column: 1 / -1;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(240, 253, 250, 0.95);
  color: #115e59;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.1;
}

.village-action-label.alert {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(254, 242, 242, 0.96);
  color: #b91c1c;
}

.village-action-label.inspect {
  border-color: rgba(245, 158, 11, 0.34);
  background: rgba(255, 251, 235, 0.96);
  color: #92400e;
}

.village-action-label.evacuate {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(245, 243, 255, 0.96);
  color: #6d28d9;
}

.village-action-label.food {
  border-color: rgba(2, 132, 199, 0.3);
  background: rgba(240, 249, 255, 0.96);
  color: #0369a1;
}

.village-action-buttons {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.village-action-buttons button {
  min-height: 24px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #15352e;
  padding: 3px 8px;
  font-size: 0.6rem;
  font-weight: 900;
  cursor: pointer;
}

.village-action-buttons button:hover,
.village-action-buttons button:focus-visible,
.village-action-buttons button.active {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}

.village-action-buttons .village-action-clear,
.action-status-cancel {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fff7f7;
  color: #b91c1c;
}

.village-action-buttons .village-action-clear:hover,
.village-action-buttons .village-action-clear:focus-visible,
.action-status-cancel:hover,
.action-status-cancel:focus-visible {
  border-color: #dc2626;
  background: #dc2626;
  color: #ffffff;
}

.action-cancel-only {
  justify-content: flex-end;
}

.action-planning-buttons {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(120px, 1fr) minmax(80px, 0.62fr);
  gap: 7px;
}

.action-planning-buttons button {
  min-height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.25;
  font-size: 0.68rem;
}

.action-planning-buttons button small {
  font-size: 0.58rem;
  opacity: 0.82;
}

.action-planning-buttons button[data-village-action="evacuate"].active {
  background: #b91c1c;
  border-color: #b91c1c;
}

.action-planning-buttons button[data-village-action="remove"] {
  border-color: rgba(100, 116, 139, 0.3);
  color: #475569;
}

.action-food-estimate {
  color: #075985 !important;
  line-height: 1.4;
}

.action-food-estimate.unavailable {
  color: #64748b !important;
}

.restore-removed-action {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .action-planning-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .action-planning-buttons button[data-village-action="food"] {
    grid-column: 1 / -1;
  }
}

.action-status-cancel {
  justify-self: start;
  min-height: 26px;
  margin-top: 4px;
  padding: 4px 9px;
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-radius: 999px;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  cursor: pointer;
}

.bottom-group-heading {
  grid-column: 1 / -1;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  border: 1px solid rgba(23, 63, 56, 0.14);
  border-radius: 7px;
  background: #eaf5ef;
  color: #173f38;
  font-size: 0.66rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.bottom-group-heading::after {
  content: "ซูม";
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 900;
}

.bottom-show-more {
  width: 100%;
  min-height: 34px;
  grid-column: 1 / -1;
  border: 1px dashed rgba(23, 63, 56, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #173f38;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.bottom-risk-dot {
  width: 8px;
  height: 100%;
  min-height: 36px;
  border-radius: 999px;
  display: block;
}

.bottom-station-list {
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 31%);
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.toolbar {
  position: absolute;
  z-index: 10020;
  top: 152px;
  left: 20px;
  right: 122px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(217, 226, 222, 0.95);
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(21, 38, 35, 0.12);
}

.map-area.panel-open .toolbar {
  right: 242px;
}

.map-panel {
  position: absolute;
  z-index: 10030;
  top: 84px;
  width: min(390px, calc(50vw - 28px));
  max-height: calc(100% - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
}

.map-panel-right {
  right: 12px;
  width: 220px;
  transition: transform 180ms ease, opacity 180ms ease;
}

.map-panel-right.collapsed {
  transform: translateX(calc(100% + 18px));
  opacity: 0;
  pointer-events: none;
}

.panel-toggle {
  position: absolute;
  z-index: 10040;
  top: 48px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(217, 226, 222, 0.95);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  color: #173f38;
  font-size: 0.68rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(21, 38, 35, 0.12);
  cursor: pointer;
}

.map-fullscreen-toggle {
  position: absolute;
  z-index: 10040;
  top: 12px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(217, 226, 222, 0.95);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  color: #173f38;
  font-size: 0.68rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(21, 38, 35, 0.12);
  cursor: pointer;
}

.panel-toggle svg,
.map-fullscreen-toggle svg {
  width: 17px;
  height: 17px;
}

.panel-toggle.open {
  right: 230px;
}

.map-fullscreen-toggle.fullscreen-active {
  background: #173f38;
  color: #fff;
  border-color: #173f38;
}

.map-area:fullscreen,
.map-area.fullscreen-fallback {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background: #e7eeeb;
}

.map-area:fullscreen .command-header,
.map-area.fullscreen-fallback .command-header,
.map-area:fullscreen .bottom-panel,
.map-area.fullscreen-fallback .bottom-panel,
.map-area:fullscreen .toolbar,
.map-area.fullscreen-fallback .toolbar {
  display: none !important;
}

.map-area:fullscreen .map-fullscreen-toggle,
.map-area.fullscreen-fallback .map-fullscreen-toggle {
  top: 10px;
  right: 10px;
  z-index: 100000;
}

.map-area:fullscreen .panel-toggle,
.map-area.fullscreen-fallback .panel-toggle {
  display: inline-flex !important;
  top: 48px;
  right: 10px;
  z-index: 100000;
}

.map-area:fullscreen .panel-toggle.open,
.map-area.fullscreen-fallback .panel-toggle.open {
  right: 244px;
}

.map-area:fullscreen .map-panel,
.map-area.fullscreen-fallback .map-panel {
  top: 10px;
  right: 10px;
  z-index: 99999;
  max-height: calc(100vh - 20px);
}

.map-area:fullscreen .map-frame,
.map-area.fullscreen-fallback .map-frame {
  min-height: 0;
  margin-right: 0;
  grid-column: 1 / -1;
  grid-row: 1 / -1 !important;
}

.map-area.fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 99990;
}

.hot-panel {
  max-height: 36vh;
  overflow-y: auto;
}

.affected-panel {
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: #fff;
  color: #10211c;
}

.toolbar strong {
  font-size: 0.82rem;
  line-height: 1.15;
}

.toolbar p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
}

.criteria-stack {
  position: absolute;
  z-index: 700;
  left: 12px;
  right: 12px;
  bottom: 12px;
  min-width: 0;
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 6px 8px;
  border: 1px solid rgba(217, 226, 222, 0.94);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(21, 38, 35, 0.12);
  pointer-events: auto;
}

.criteria-row {
  max-width: min(100%, 820px);
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  color: var(--muted);
  font-size: 0.6rem;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.criteria-row::-webkit-scrollbar {
  display: none;
}

.criteria-row strong {
  color: #25322f;
  font-size: 0.62rem;
  font-weight: 900;
}

.legend {
  font-size: 0.66rem;
}

.rain-scale {
  font-size: 0.6rem;
}

.legend span,
.rain-scale span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.rain-scale i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(24, 33, 31, 0.18);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 3px;
}

.critical {
  background: var(--critical);
}

.risk {
  background: var(--risk);
}

.warning {
  background: var(--warning);
}

.normal {
  background: var(--normal);
}

.forecast-list .forecast-row,
.forecast-list .forecast-row.warning,
.forecast-list .forecast-row.watch,
.forecast-list .forecast-row.risk,
.forecast-list .forecast-row.critical {
  border-color: #d1d5db;
  background: #fff;
}

.forecast-list .forecast-row > span {
  padding: 3px 7px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f8fafc;
}

.forecast-list .forecast-row.warning,
.forecast-list .forecast-row.watch {
  border-color: #d88a19;
}

.forecast-list .forecast-row.risk {
  border-color: #ef4444;
}

.forecast-list .forecast-row.critical {
  border-color: #7c3aed;
}

.station-forecast-list .forecast-row,
.station-forecast-list .forecast-row.warning,
.station-forecast-list .forecast-row.watch,
.station-forecast-list .forecast-row.risk,
.station-forecast-list .forecast-row.critical {
  border-color: #d1d5db;
}

.station-marker {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: transparent;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 1)) drop-shadow(0 2px 3px rgba(255, 255, 255, 0.9)) drop-shadow(0 6px 11px rgba(12, 24, 20, 0.36));
}

.station-marker svg {
  width: 34px;
  height: 34px;
  display: block;
  overflow: visible;
}

.station-marker.rid-nan-primary-marker {
  width: 46px;
  height: 46px;
  z-index: 5;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 1)) drop-shadow(0 0 10px rgba(124, 58, 237, 0.42)) drop-shadow(0 8px 16px rgba(12, 24, 20, 0.42));
}

.station-marker.rid-nan-primary-marker svg {
  width: 42px;
  height: 42px;
}

.rid-priority-badge {
  position: absolute;
  right: -1px;
  top: -2px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #7c3aed;
  color: #fff;
  border: 2px solid #fff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.rain-marker {
  width: 34px;
  height: 34px;
}

.rain-marker svg {
  width: 30px;
  height: 30px;
}

.rain-marker svg path {
  paint-order: stroke fill;
  stroke-linejoin: round;
  stroke: #ffffff;
  stroke-width: 1.65px;
}

.station-marker.radar-confirmed {
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.98)) drop-shadow(0 0 9px rgba(250, 204, 21, 0.7)) drop-shadow(0 7px 12px rgba(12, 24, 20, 0.35));
}

.station-marker.radar-confirmed svg {
  width: 32px;
  height: 32px;
}

.station-marker.stale-marker {
  filter: drop-shadow(0 2px 2px rgba(255, 255, 255, 0.85)) drop-shadow(0 4px 8px rgba(12, 24, 20, 0.22));
}

.station-marker.stale-marker > svg {
  opacity: 0.46;
}

.station-stale-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(15, 23, 42, 0.36);
  border-radius: 999px;
  background: #ffffff;
  color: #7c2d12;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}

body.dark .station-stale-badge {
  border-color: rgba(253, 230, 138, 0.46);
  background: #17231f;
  color: #fde68a;
}

.station-trend-badge {
  position: absolute;
  right: -7px;
  bottom: -5px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1.5px solid #ffffff;
  border-radius: 999px;
  background: #64748b;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.28);
}

.station-trend-badge.trend-up {
  background: #dc2626;
}

.station-trend-badge.trend-down {
  background: #0ea5e9;
}

.station-trend-badge.trend-flat {
  background: #64748b;
}

body.dark .station-trend-badge {
  border-color: rgba(255, 255, 255, 0.9);
}

.rain-marker {
  color: inherit;
}

.water-marker {
  color: inherit;
}

.floodboy-marker {
  color: inherit;
}

.floodboy-marker .floodboy-badge {
  position: absolute;
  right: -5px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 6px;
  background: #0f172a;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.36);
}

.risk-circle {
  stroke: #fff;
  stroke-width: 1;
}

.action-village-map-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--action-marker-color, #0f766e);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
}

.action-village-map-icon.food {
  background: #0284c7;
}

.action-village-map-icon.evacuate {
  background: #dc2626;
}

.action-village-map-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.6;
}

.popup h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.popup p {
  margin: 3px 0;
}

.popup .pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.popup-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 7px;
}

.popup-action-block {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(100, 116, 139, 0.2);
}

.popup-action-block > strong {
  color: #173f38;
  font-size: 0.68rem;
  letter-spacing: 0;
}

.popup .village-action-label {
  grid-column: auto;
  font-size: 0.58rem;
}

.popup .village-action-buttons {
  display: flex;
  gap: 4px;
}

.popup .village-action-buttons button {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 0.56rem;
}

.popup .popup-status-badge {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.14);
}

.popup-primary-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: #173f38;
  font-weight: 900;
  line-height: 1;
}

.popup-primary-metric strong {
  font-size: 1.08rem;
}

.popup-primary-metric span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.water-fill-meter {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
  padding: 8px;
  border: 1px solid rgba(37, 116, 169, 0.2);
  border-radius: 8px;
  background: rgba(239, 246, 255, 0.82);
}

.water-fill-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.water-fill-meter-head strong {
  color: #0f4f7a;
  font-size: 1rem;
  font-weight: 950;
}

.water-fill-meter-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.water-fill-meter-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
}

.water-fill-meter-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2f8fca;
}

.water-fill-meter.warning .water-fill-meter-track i {
  background: #f59e0b;
}

.water-fill-meter.risk .water-fill-meter-track i {
  background: #ef4444;
}

.water-fill-meter.critical .water-fill-meter-track i {
  background: #7c3aed;
}

.popup-trend-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 6px;
  background: #ffffff;
}

.popup-trend-line span {
  font-weight: 900;
}

.popup-trend-line.trend-up {
  border-color: rgba(220, 38, 38, 0.38);
  color: #991b1b;
}

.popup-trend-line.trend-down {
  border-color: rgba(14, 165, 233, 0.38);
  color: #075985;
}

.popup-trend-line.trend-flat {
  border-color: rgba(100, 116, 139, 0.36);
  color: #334155;
}

body.dark .popup-trend-line {
  background: #20201e;
  border-color: rgba(255, 255, 255, 0.18);
}

.popup-danger-button {
  min-height: 28px;
  margin-top: 8px;
  border: 1px solid rgba(201, 47, 55, 0.35);
  border-radius: 6px;
  background: #fff5f5;
  color: #a51f2a;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.risk-public-guidance {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: #f8fafc;
}

.risk-public-guidance b {
  color: #0f172a;
  font-size: 0.94rem;
  line-height: 1.15;
}

.risk-public-guidance span {
  color: #475569;
  font-size: 0.82rem;
  font-weight: 700;
}

.risk-public-guidance.normal { border-color: rgba(34, 197, 94, 0.35); background: #f0fdf4; }
.risk-public-guidance.watch { border-color: rgba(234, 179, 8, 0.38); background: #fefce8; }
.risk-public-guidance.risk { border-color: rgba(249, 115, 22, 0.38); background: #fff7ed; }
.risk-public-guidance.critical { border-color: rgba(239, 68, 68, 0.38); background: #fef2f2; }
.risk-public-guidance.impact { border-color: rgba(124, 58, 237, 0.38); background: #f5f3ff; }

.flood-report-marker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #c92f37;
  color: #fff;
  box-shadow: 0 8px 18px rgba(89, 12, 19, 0.35);
}

.flood-report-marker.flood {
  background: #f97316;
}

.flood-report-marker.help {
  background: #dc2626;
}

.flood-report-marker.help.in-progress {
  background: #f97316;
}

.flood-report-marker.help-history,
.flood-report-marker.flood-history {
  background: #16a34a;
}

.flood-report-marker svg {
  width: 21px;
  height: 21px;
}

.public-report-code {
  margin-left: 4px;
  background: #0f172a !important;
}

.public-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.public-report-actions.compact {
  grid-column: 1 / -1;
}

.popup-progress-button,
.popup-muted-button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.popup-progress-button {
  background: #f97316;
}

.popup-muted-button {
  background: #64748b;
}

.public-help-card.new {
  border-left-color: #dc2626;
}

.public-help-card.in-progress {
  border-left-color: #f97316;
}

.report-photo {
  width: 180px;
  max-width: 100%;
  margin-top: 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.report-dialog {
  width: min(440px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(13, 28, 25, 0.25);
}

.public-alert-dialog {
  width: min(760px, calc(100vw - 28px));
}

.historical-event-dialog {
  width: min(620px, calc(100vw - 28px));
}

.risk-method-dialog {
  width: min(820px, calc(100vw - 28px));
}

.risk-method-content {
  display: grid;
  gap: 12px;
  max-height: min(66vh, 680px);
  overflow: auto;
  padding-right: 4px;
}

.risk-method-content section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfa;
  padding: 12px;
}

.risk-method-content h3 {
  margin: 0 0 7px;
  font-size: 0.95rem;
}

.risk-method-content p,
.risk-method-content li {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.risk-method-content p {
  margin: 0 0 8px;
}

.risk-method-content ul {
  margin: 0;
  padding-left: 20px;
}

.public-alert-text {
  max-height: min(62vh, 620px);
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Prompt, Inter, system-ui, sans-serif;
  font-size: 0.86rem;
  line-height: 1.55;
}

.public-alert-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.public-alert-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.public-alert-controls select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.location-check-summary {
  display: grid;
  gap: 8px;
}

.location-check-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.location-check-card strong {
  color: #173f38;
  font-size: 0.86rem;
}

.location-check-card span,
.location-check-card small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.location-check-card.alert {
  border-color: rgba(220, 38, 38, 0.25);
  background: #fff5f5;
}

.location-check-card.watch {
  border-color: rgba(202, 138, 4, 0.28);
  background: #fffdf2;
}

.report-dialog::backdrop {
  background: rgba(12, 22, 20, 0.34);
}

.report-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
}

.report-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.report-head strong {
  font-size: 1.05rem;
}

.report-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.coord-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.coord-grid label,
.report-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.coord-grid input,
.select-grid input,
.select-grid select,
.report-field textarea,
.report-field input[type="text"],
.report-field input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.report-field textarea {
  resize: vertical;
  min-height: 96px;
}

.report-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.secondary-button,
.submit-report-button {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #173f38;
}

.submit-report-button {
  border: 1px solid #9f1f2b;
  background: #c92f37;
  color: #fff;
}

body.dark .sidebar,
body.dark .brand,
body.dark .panel,
body.dark .bottom-panel,
body.dark .bottom-tabs,
body.dark .bottom-tabs button,
body.dark .bottom-panel-controls select,
body.dark .bottom-ops-item,
body.dark .station-tab,
body.dark .status-card,
body.dark .province-picker,
body.dark .theme-toggle,
body.dark .station-item,
body.dark .affected-item,
body.dark .population-impact-panel,
body.dark .rain-forecast-panel,
body.dark .command-header,
body.dark .command-metrics div,
body.dark .command-recommendation,
body.dark .operation-card,
body.dark .top-risk-item,
body.dark .guidance-item,
body.dark .impact-total,
body.dark .impact-row,
body.dark .impact-tab,
body.dark .empty-note,
body.dark .toolbar,
body.dark .panel-toggle,
body.dark .icon-button,
body.dark .search,
body.dark .select-grid select,
body.dark .chip,
body.dark .coord-grid input,
body.dark .report-field textarea,
body.dark .report-field input[type="text"],
body.dark .report-field input[type="file"],
body.dark .report-form,
body.dark .secondary-button,
body.dark .report-download-button,
body.dark .history-event-button,
body.dark .historical-event-item,
body.dark .province-picker select {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

body.dark .brand-version {
  color: rgba(195, 195, 186, 0.46);
}

body.dark .brand {
  border-color: rgba(238, 247, 243, 0.12);
  background:
    radial-gradient(circle at 10% 0%, rgba(14, 165, 233, 0.12), transparent 36%),
    radial-gradient(circle at 88% 20%, rgba(124, 58, 237, 0.13), transparent 34%),
    linear-gradient(135deg, rgba(45, 45, 43, 0.96) 0%, rgba(31, 41, 55, 0.92) 52%, rgba(30, 27, 75, 0.82) 100%);
}

body.dark .command-metrics div {
  border-color: rgba(125, 211, 252, 0.16);
  background: linear-gradient(135deg, rgba(45, 45, 43, 0.92), rgba(15, 23, 42, 0.72));
}

body.dark .status-card.danger {
  background: linear-gradient(135deg, #7c3aed 0%, #b91c1c 52%, #7f1d1d 100%);
  color: #fff;
}

body.dark .status-card.risk {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #f97316 100%);
  color: #fff;
}

body.dark .status-card.warning {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 52%, #ea580c 100%);
  color: #fff;
}

body.dark .status-card.normal {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 52%, #166534 100%);
  color: #fff;
}

body.dark .kok-route-summary {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(96, 165, 250, 0.22);
}

body.dark .kok-route-summary strong,
body.dark .kok-route-summary p,
body.dark .kok-route-segment strong,
body.dark .kok-route-segment p {
  color: var(--ink);
}

body.dark .river-route-diagram {
  background:
    linear-gradient(180deg, rgba(31, 41, 55, 0.96), rgba(24, 24, 27, 0.96)),
    radial-gradient(circle at 18% 16%, rgba(96, 165, 250, 0.16), transparent 30%),
    radial-gradient(circle at 78% 22%, rgba(20, 184, 166, 0.13), transparent 28%);
  border-color: rgba(226, 232, 240, 0.1);
  box-shadow: inset 0 -42px 0 rgba(255, 255, 255, 0.03);
}

body.dark .river-map-label,
body.dark .river-map-label::after {
  background: rgba(12, 12, 11, 0.94);
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark .river-route-tool,
body.dark .route-station-panel,
body.dark .route-rain-panel,
body.dark .route-rain-chip,
body.dark .route-impact-panel,
body.dark .route-impact-chip {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

body.dark .river-route-heading,
body.dark .route-station-panel h3,
body.dark .route-rain-panel h3,
body.dark .route-impact-panel h3,
body.dark .route-alert-summary {
  color: var(--ink);
}

body.dark .river-route-tool {
  border-color: rgba(167, 139, 250, 0.22);
  background:
    radial-gradient(circle at 8% 0%, rgba(124, 58, 237, 0.14), transparent 36%),
    linear-gradient(135deg, rgba(45, 45, 43, 0.96), rgba(30, 27, 75, 0.72));
}

body.dark .river-route-heading {
  background: linear-gradient(135deg, #f8fffd 0%, #eefaf8 52%, #dff1ee 100%);
  color: #10211c;
}

body.dark .river-route-heading svg {
  color: #173f38;
}

body.dark .river-route-options button {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--ink);
}

body.dark .river-route-options button.active {
  background: #f8fafc;
  border-color: #f8fafc;
  color: #173f38;
}

body.dark .route-alert-summary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark .route-evacuation-countdown {
  background: rgba(127, 29, 29, 0.16);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fecaca;
}

body.dark .route-evacuation-countdown strong,
body.dark .route-evacuation-countdown small {
  color: #fee2e2;
}

body.dark .river-node-card {
  background: rgba(32, 32, 30, 0.96);
  border-color: rgba(226, 232, 240, 0.1);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

body.dark .river-node-card strong,
body.dark .river-node-card span {
  color: var(--ink);
}

body.dark .river-route-segment strong,
body.dark .river-route-segment small {
  color: #fed7aa;
}

body.dark .kok-route-station-card {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  border-left-color: #60a5fa;
}

body.dark .kok-route-metrics b {
  background: rgba(96, 165, 250, 0.16);
  color: #bfdbfe;
}

body.dark .route-rain-chip span,
body.dark .route-impact-chip span {
  color: var(--ink);
}

body.dark .kok-route-segment {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(251, 146, 60, 0.28);
}

body.dark .operation-switch summary {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(226, 232, 240, 0.08);
  color: rgba(226, 232, 240, 0.34);
  opacity: 0.55;
}

body.dark .operation-switch summary:hover,
body.dark .operation-switch summary:focus-visible,
body.dark .operation-switch[open] summary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(226, 232, 240, 0.16);
  color: rgba(226, 232, 240, 0.62);
  opacity: 0.82;
}

body.dark .operation-menu {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(17, 52, 95, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

body.dark .operation-menu a {
  background: rgba(238, 247, 255, 0.7);
  border-color: rgba(17, 52, 95, 0.08);
  color: #173f38;
}

body.dark .operation-menu a:hover,
body.dark .operation-menu a:focus-visible {
  background: rgba(224, 242, 254, 0.92);
  border-color: rgba(14, 116, 144, 0.22);
}

body.dark .map-panel-right,
body.dark .map-panel-right .panel,
body.dark .map-panel-right .panel-title h2,
body.dark .map-panel-right .panel-title span,
body.dark .map-panel-right .controls label,
body.dark .map-panel-right .slider-row,
body.dark .legend,
body.dark .rain-scale,
body.dark .toolbar strong,
body.dark .toolbar p,
body.dark .command-recommendation,
body.dark .mini-section h3,
body.dark .timeline-item strong,
body.dark .search::placeholder,
body.dark .select-grid label {
  color: #eef7f3;
}

body.dark .command-action-summary > strong {
  color: #f4f4ef;
}

body.dark .command-tambon-card {
  background: rgba(15, 23, 42, 0.58);
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark .command-tambon-card header b {
  color: #f8fafc;
}

body.dark .command-tambon-card header small {
  color: #cbd5e1;
}

body.dark .command-tambon-metrics .food {
  background: rgba(7, 89, 133, 0.5);
  color: #bae6fd;
}

body.dark .command-tambon-metrics .evacuate {
  background: rgba(127, 29, 29, 0.46);
  color: #fecaca;
}

body.dark .operation-action-target,
body.dark .command-action-wait {
  color: #cbd5d1;
}

body.dark .command-action-chip {
  background: rgba(20, 83, 45, 0.42);
  border-color: rgba(134, 239, 172, 0.24);
  color: #dcfce7;
}

body.dark .command-action-chip.alert {
  background: rgba(127, 29, 29, 0.48);
  border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca;
}

body.dark .command-action-chip.inspect {
  background: rgba(120, 53, 15, 0.5);
  border-color: rgba(251, 191, 36, 0.34);
  color: #fde68a;
}

body.dark .command-action-chip.evacuate {
  background: rgba(76, 29, 149, 0.52);
  border-color: rgba(167, 139, 250, 0.36);
  color: #ede9fe;
}

body.dark .command-action-chip.food {
  background: rgba(7, 89, 133, 0.46);
  border-color: rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}

body.dark .command-action-more {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

body.dark .map-panel-right .panel-title span,
body.dark .map-panel-right .slider-row,
body.dark .toolbar p,
body.dark .legend,
body.dark .rain-scale {
  color: #cfe0da;
}

body.dark .criteria-row strong {
  color: #eef7f3;
}

body.dark .criteria-stack {
  background: rgba(37, 37, 36, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark .sidebar {
  background: #252524;
}

body.dark .risk-sidebar {
  background: rgba(37, 37, 36, 0.88);
}

body.dark .affected-section {
  background: rgba(37, 37, 36, 0.8);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark .affected-panel,
body.dark .affected-item {
  background: var(--panel) !important;
  color: var(--ink) !important;
}

body.dark .affected-item.watch,
body.dark .affected-item.risk,
body.dark .affected-item.critical,
body.dark .affected-item.impact,
body.dark .bottom-ops-item.village.watch,
body.dark .bottom-ops-item.village.risk,
body.dark .bottom-ops-item.village.critical,
body.dark .bottom-ops-item.village.impact,
body.dark .bottom-ops-item.village.stream-area {
  background: rgba(45, 45, 43, 0.92) !important;
  color: #f4f4ef !important;
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark .bottom-ops-item.village.stream-area.watch {
  border-left-color: #f97316;
}

body.dark .bottom-ops-item.village.stream-area.risk {
  border-left-color: #ef4444;
}

body.dark .bottom-ops-item.village.stream-area.critical {
  border-left-color: #a78bfa;
}

body.dark .bottom-risk-section + .bottom-risk-section {
  border-top-color: rgba(255, 255, 255, 0.12);
}

body.dark .bottom-risk-section h3 {
  color: #f4f4ef;
}

body.dark .affected-item small,
body.dark .bottom-ops-item small {
  color: #c3c3ba;
}

body.dark .bottom-ops-item em {
  color: #a7f3d0;
}

body.dark .bottom-village-legend span {
  background: rgba(45, 45, 43, 0.92);
  color: #eef7f3;
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark .legend-dot {
  box-shadow: 0 0 0 2px rgba(37, 37, 36, 0.95);
}

body.dark .risk-sidebar.collapsed .risk-sidebar-toggle h2 {
  color: var(--ink);
}

body.dark .village-risk-icon {
  background: #2d2d2b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark .village-risk-icon .village-risk-wave {
  background: #0c2a38;
  color: #7dd3fc;
  border-color: #17231f;
}

body.dark .risk-sidebar-toggle {
  color: var(--ink);
}

body.dark .command-summary strong.headline-status.risk,
body.dark .command-summary strong.headline-status.critical,
body.dark .command-summary strong.headline-status.impact {
  color: #ff6b6b;
  text-shadow: none;
}

body.dark .command-summary strong.headline-status.warning {
  color: #fbbf24;
}

body.dark .command-summary strong.headline-status.normal {
  color: #f4f4ef;
}

body.dark .assessment-disclaimer {
  border-color: transparent;
  background: transparent;
  color: #ff6b6b;
}

body.dark .bottom-assessment-note {
  color: #fcd34d;
}

body.dark .method-button {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(20, 83, 75, 0.55);
  color: #ccfbf1;
}

body.dark .risk-sidebar.collapsed .risk-sidebar-toggle {
  border-color: rgba(238, 247, 243, 0.14);
  background: rgba(45, 45, 43, 0.84);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

body.dark .analysis-toolbox {
  border-color: rgba(125, 211, 252, 0.24);
  background:
    radial-gradient(circle at 8% 0%, rgba(14, 165, 233, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(38, 51, 50, 0.98), rgba(45, 45, 43, 0.94));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

body.dark .analysis-toolbox summary {
  background: linear-gradient(135deg, #f8fffd 0%, #eefaf8 52%, #dff1ee 100%);
  color: #10211c;
  border-bottom-color: transparent;
}

body.dark .analysis-toolbox summary svg {
  color: #173f38;
}

body.dark .visitor-counter {
  border-color: rgba(238, 247, 243, 0.14);
  background: rgba(45, 45, 43, 0.88);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

body.dark .visitor-counter strong {
  color: #a7f3d0;
}

body.dark .toolbar,
body.dark .panel-toggle,
body.dark .map-fullscreen-toggle,
body.dark .panel {
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

body.dark .tmd-nudge-panel {
  background: rgba(45, 45, 43, 0.72);
  border-color: rgba(238, 247, 243, 0.16);
  color: var(--muted);
}

body.dark .tmd-nudge-panel strong {
  color: var(--ink);
}

body.dark .tmd-nudge-grid button {
  background: #2d2d2b;
  color: var(--ink);
  border-color: rgba(238, 247, 243, 0.16);
}

body.dark .map-area {
  background: #252524;
}

body.dark .map-frame {
  border-color: var(--line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.34);
}

body.dark .map-loading-overlay {
  background: linear-gradient(135deg, rgba(37, 37, 36, 0.84), rgba(20, 20, 19, 0.7));
}

body.dark .map-loading-card {
  border-color: rgba(62, 205, 152, 0.24);
  background: rgba(45, 45, 43, 0.94);
  color: #f4f4ef;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

body.dark .map-loading-card p {
  color: #c3c3ba;
}

body.dark .map-panel-right .mini-danger-button,
body.dark .popup-danger-button,
body.dark .public-alert-button {
  background: #31171a;
  color: #ffb8bd;
  border-color: rgba(248, 113, 113, 0.35);
}

body.dark .population-impact-button {
  background: #10283a;
  color: #bae6fd;
  border-color: rgba(125, 211, 252, 0.24);
}

body.dark .rain-forecast-button {
  background: #1d2a12;
  color: #d9f99d;
  border-color: rgba(190, 242, 100, 0.22);
}

body.dark .command-tools .disabled-tool-button {
  background: #343431;
  color: #9ca3af;
  border-color: rgba(209, 213, 219, 0.16);
}

body.dark .impact-tab.active {
  background: #d9f4ec;
  border-color: #d9f4ec;
  color: #10211c;
}

body.dark .impact-total strong,
body.dark .impact-row strong {
  color: var(--ink);
}

body.dark .impact-row > span {
  color: #7dd3fc;
}

body.dark .forecast-total strong {
  color: #d9f99d;
}

body.dark .forecast-total small {
  color: #d8efe8;
}

body.dark .forecast-readiness span {
  border-color: rgba(203, 213, 225, 0.16);
  background: #111f1b;
  color: #94a3b8;
}

body.dark .forecast-readiness span.ready {
  border-color: rgba(74, 222, 128, 0.24);
  background: #10251c;
  color: #bbf7d0;
}

body.dark .forecast-section-title {
  color: var(--ink);
}

body.dark .forecast-list .forecast-row:hover {
  border-color: rgba(167, 243, 208, 0.24);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

body.dark .station-forecast-list .forecast-row,
body.dark .station-forecast-list .forecast-row.warning,
body.dark .station-forecast-list .forecast-row.watch,
body.dark .station-forecast-list .forecast-row.risk,
body.dark .station-forecast-list .forecast-row.critical {
  border-color: rgba(148, 163, 184, 0.28);
  background: var(--panel);
}

body.dark .station-forecast-list .forecast-row > span {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.04);
}

body.dark .guidance-item {
  background: #10251c;
  border-color: rgba(74, 222, 128, 0.18);
}

body.dark .guidance-item p {
  color: #bbf7d0;
}

body.dark .top-risk-item.station-attention {
  background: #2b220f;
  border-color: rgba(250, 204, 21, 0.22);
}

body.dark .top-risk-item.action-status {
  background: rgba(45, 45, 43, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark .top-risk-item.action-status.watch {
  border-left-color: #f97316;
}

body.dark .top-risk-item.action-status.risk {
  border-left-color: #ef4444;
}

body.dark .top-risk-item.action-status.critical {
  border-left-color: #a78bfa;
}

body.dark .public-alert-text {
  background: #101916;
  color: var(--ink);
  border-color: var(--line);
}

body.dark .public-alert-controls select {
  background: #252524;
  color: var(--ink);
  border-color: rgba(238, 247, 243, 0.14);
}

body.dark .risk-method-content section {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.62);
}

body.dark .risk-method-content p,
body.dark .risk-method-content li {
  color: #cbd5e1;
}

body.dark .popup-primary-metric {
  color: #d9f4ec;
}

body.dark .popup-primary-metric span {
  color: var(--muted);
}

body.dark .water-fill-meter {
  border-color: rgba(125, 211, 252, 0.26);
  background: rgba(15, 23, 42, 0.78);
}

body.dark .water-fill-meter-head strong {
  color: #bae6fd;
}

body.dark .water-fill-meter-head span {
  color: #cbd5e1;
}

body.dark .water-fill-meter-track {
  background: rgba(148, 163, 184, 0.24);
}

body.dark .location-check-card {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

body.dark .location-check-card strong {
  color: var(--ink);
}

body.dark .location-check-card.alert {
  background: #31171a;
  border-color: rgba(248, 113, 113, 0.35);
}

body.dark .location-check-card.watch {
  background: #2b220f;
  border-color: rgba(250, 204, 21, 0.22);
}

body.dark .chip.active {
  background: #d9f4ec;
  border-color: #d9f4ec;
  color: #10211c;
}

body.dark .station-tab.active {
  background: #d9f4ec;
  border-color: #d9f4ec;
  color: #10211c;
}

body.dark .bottom-tabs button.active {
  background: #d9f4ec;
  color: #10211c;
}

body.dark .bottom-ops-item em {
  color: #d9f4ec;
}

body.dark .bottom-show-more {
  border-color: rgba(238, 247, 243, 0.2);
  background: rgba(45, 45, 43, 0.78);
  color: var(--ink);
}

body.dark .bottom-group-heading {
  border-color: rgba(238, 247, 243, 0.16);
  background: #263332;
  color: var(--ink);
}

body.dark .leaflet-tile {
  filter: brightness(0.78) saturate(0.85) contrast(1.08);
}

body.dark .leaflet-control-zoom a,
body.dark .leaflet-popup-content-wrapper,
body.dark .leaflet-popup-tip {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

body.dark .leaflet-control-attribution {
  background: rgba(23, 35, 31, 0.82);
  color: var(--muted);
}

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

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 300px 1fr;
  }

  .app-shell.risk-collapsed {
    grid-template-columns: 300px 1fr;
  }

  .sidebar,
  .risk-sidebar {
    padding: 12px;
  }

  .risk-sidebar {
    grid-column: 1 / -1;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .risk-sidebar.collapsed {
    padding: 12px;
  }

  .risk-sidebar.collapsed .affected-panel {
    padding: 16px;
    background: var(--panel);
    border-color: var(--line);
    box-shadow: 0 10px 24px rgba(20, 34, 31, 0.06);
  }

  .risk-sidebar.collapsed .affected-list {
    display: none;
  }

  .risk-sidebar.collapsed .risk-sidebar-toggle {
    min-height: 36px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: none;
    place-items: initial;
    align-content: initial;
    text-align: left;
  }

  .risk-sidebar.collapsed .risk-sidebar-toggle h2,
  .risk-sidebar.collapsed .risk-sidebar-toggle span:not(.risk-sidebar-chevron) {
    width: min(260px, calc(100% - 16px));
    height: auto;
    overflow: visible;
    opacity: 1;
    font-size: 0.72rem;
  }

  .risk-sidebar.collapsed .risk-sidebar-toggle h2 {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    transform: none;
    white-space: normal;
  }

  .risk-sidebar.collapsed .risk-sidebar-toggle span:not(.risk-sidebar-chevron) {
    display: none;
  }

  .risk-sidebar.collapsed .risk-sidebar-chevron {
    transform: rotate(180deg);
  }

  .affected-panel {
    max-height: 280px;
  }

  .map-area {
    padding: 8px;
    gap: 8px;
  }

  .command-header {
    grid-template-columns: 1fr;
  }

  .command-action-row {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .command-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bottom-station-list {
    grid-auto-columns: minmax(230px, 42%);
  }

  .toolbar {
    left: 8px;
    right: 104px;
    top: 190px;
    min-height: 0;
  }

  .map-area.panel-open .toolbar {
    right: 104px;
  }

  .map-area.panel-open .map-frame {
    width: auto;
    margin-right: 0;
    grid-row: auto;
  }

  .map-panel {
    position: absolute;
    top: 84px;
    left: auto;
    right: 8px;
    width: min(260px, calc(100% - 16px));
    max-height: calc(100% - 96px);
    overflow-y: auto;
  }

  .map-panel-right {
    right: 8px;
    transform: none;
  }

  .map-panel-right.collapsed {
    display: none;
  }

  .panel-toggle {
    top: 48px;
    right: 8px;
  }

  .map-fullscreen-toggle {
    top: 12px;
    right: 8px;
  }

  .panel-toggle.open {
    right: 8px;
  }

  .map-area.panel-open {
    grid-template-rows: auto clamp(560px, 66vh, 760px) minmax(520px, 1fr);
  }
}

@media (max-width: 720px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    width: 100%;
    overflow-x: hidden;
  }

  .sidebar {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .risk-sidebar {
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .quick-action-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-action-row button {
    font-size: 0.58rem;
    padding: 0 3px;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
    right: 104px;
  }

  .map-area.panel-open .toolbar {
    right: 104px;
  }

  .map-area.panel-open .map-frame {
    width: auto;
    margin-right: 0;
  }

  .map-panel {
    position: absolute;
    top: 84px;
    left: auto;
    right: 8px;
    width: min(260px, calc(100% - 16px));
    max-height: calc(100% - 96px);
    margin: 0;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
  }

  .map-panel-right {
    right: 8px;
    transform: none;
  }

  .map-panel-right.collapsed {
    display: none;
  }

  .panel-toggle,
  .panel-toggle.open {
    position: absolute;
    top: 48px;
    right: 8px;
  }

  .map-fullscreen-toggle {
    position: absolute;
    top: 12px;
    right: 8px;
  }

  .map-area {
    display: grid;
    width: 100%;
    max-width: 100vw;
    min-height: 68vh;
    overflow-x: hidden;
    grid-template-rows: auto clamp(470px, 62vh, 620px) minmax(220px, auto);
  }

  .map-area.panel-open {
    grid-template-rows: auto clamp(470px, 62vh, 620px) minmax(220px, auto);
  }

  .command-header,
  .bottom-panel,
  .map-frame {
    width: 100%;
    max-width: calc(100vw - 16px);
  }

  .assessment-disclaimer {
    font-size: 0.58rem;
  }

  .bottom-assessment-note {
    white-space: normal;
  }

  .map-area.panel-open .map-frame {
    grid-row: auto;
  }

  .bottom-panel-head {
    display: grid;
    align-items: start;
  }

  .bottom-panel-controls {
    justify-content: flex-start;
  }

  .bottom-ops-list {
    grid-template-columns: 1fr;
    max-height: 260px;
  }

  .risk-incident-card-grid,
  .risk-incident-card-grid.compact,
  .risk-action-sections {
    grid-template-columns: 1fr;
  }

  .risk-incident-action-card header,
  .risk-card-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .risk-card-score {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .command-header {
    grid-template-columns: 1fr;
  }

  .command-action-row {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .command-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .visitor-counter {
    left: 10px;
    bottom: 10px;
    padding: 5px 8px;
    font-size: 0.66rem;
  }

  .bottom-station-list {
    grid-auto-columns: minmax(228px, 82%);
  }

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

  .system-footer {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 14px;
  }

  .system-footer-logo img {
    width: 42px;
    height: 48px;
  }

  .system-footer-copy {
    justify-items: start;
    text-align: left;
  }

  .system-footer-copy strong {
    white-space: normal;
    font-size: 0.84rem;
  }

  .system-footer-copy span {
    font-size: 0.7rem;
  }

  .system-footer-partners {
    width: max-content;
    max-width: min(430px, 46vw);
    min-height: 48px;
    justify-content: flex-start;
    gap: 4px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
  }

  .footer-logo-source {
    font-size: 0.62rem;
  }

  .footer-logo-slot {
    width: 34px;
    height: 34px;
    padding: 4px;
  }

  .footer-logo-slot-dislog {
    width: 38px;
  }

  #map {
    height: 100%;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  .system-footer {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 8px 10px;
  }

  .system-footer-logo {
    padding-right: 8px;
  }

  .system-footer-logo img {
    width: 30px;
    height: 36px;
  }

  .system-footer-copy {
    gap: 1px;
  }

  .system-footer-copy strong {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .system-footer-copy span {
    font-size: 0.6rem;
    line-height: 1.25;
  }

  .system-footer-partners {
    grid-column: 1 / -1;
    width: auto;
    max-width: none;
    justify-content: flex-start;
    gap: 3px;
    min-height: 0;
    padding: 6px 0 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
  }

  .footer-logo-source {
    width: 100%;
    font-size: 0.56rem;
    line-height: 1;
  }

  .footer-logo-slot {
    width: 26px;
    height: 24px;
    padding: 2px;
    border-radius: 4px;
  }

  .footer-logo-slot-dislog {
    width: 28px;
  }

  .footer-logo-slot-dwr img {
    width: 142%;
    height: 142%;
  }

  .map-area {
    padding: 6px;
    grid-template-rows: auto clamp(430px, 60vh, 560px) minmax(220px, auto);
  }

  .map-area.panel-open {
    grid-template-rows: auto clamp(430px, 60vh, 560px) minmax(220px, auto);
  }

  .command-header,
  .bottom-panel,
  .map-frame {
    max-width: calc(100vw - 12px);
  }

  .map-panel {
    width: calc(100vw - 12px);
    right: 6px;
  }

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

  .mission-actions-quick {
    justify-content: flex-start;
  }

  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    min-width: 0;
    flex: 1 1 calc(50% - 7px);
  }
}

.map-area:fullscreen,
.map-area.fullscreen-fallback {
  grid-template-rows: minmax(0, 1fr) !important;
}

.map-area:fullscreen .map-frame,
.map-area.fullscreen-fallback .map-frame,
.map-area:fullscreen #map,
.map-area.fullscreen-fallback #map {
  height: 100%;
}

.map-area:fullscreen .map-frame,
.map-area.fullscreen-fallback .map-frame {
  grid-row: 1 !important;
  width: auto !important;
  margin-right: 0 !important;
}

@media (max-width: 720px) {
  body {
    background: var(--panel);
  }

  .sidebar {
    padding: 10px;
    background: var(--panel);
  }

  .map-panel-left {
    display: grid;
    gap: 10px;
  }

  .brand {
    align-items: center;
    gap: 8px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .brand h1 {
    font-size: 1rem;
    line-height: 1.05;
  }

  .brand p {
    font-size: 0.68rem;
  }

  .operation-switch {
    margin-left: auto;
  }

  .operation-menu {
    right: 0;
    left: auto;
    min-width: min(280px, calc(100vw - 22px));
  }

  .top-control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .province-picker,
  .theme-toggle {
    min-height: 40px;
  }

  .province-picker select {
    min-width: 0;
    width: 100%;
  }

  .theme-toggle {
    width: 74px;
    justify-content: center;
    padding-inline: 8px;
  }

  .analysis-toolbox,
  .station-browser-panel,
  .command-side-panel,
  .historical-events-panel {
    border-radius: 10px;
  }

  .analysis-toolbox summary {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .analysis-toolbox .command-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .analysis-toolbox .command-tools button {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.64rem;
    line-height: 1.15;
  }

  .quick-action-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .quick-action-row::-webkit-scrollbar {
    display: none;
  }

  .quick-action-row button {
    flex: 0 0 auto;
    min-width: 112px;
    min-height: 34px;
    padding: 0 8px;
    font-size: 0.64rem;
  }

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

  .status-card {
    min-height: 54px;
    padding: 7px 4px;
    border-radius: 9px;
  }

  .status-card span {
    font-size: 1.06rem;
  }

  .status-card p {
    font-size: 0.58rem;
  }

  .station-browser-panel,
  .historical-events-panel {
    display: none;
  }

  .command-side-panel {
    padding: 10px;
  }

  .command-side-panel .mini-section.officer-only,
  .command-side-panel .mini-section.public-only {
    display: none;
  }

  .operation-card {
    min-height: 0;
    padding: 8px;
  }

  .operation-action-target {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .map-area {
    padding: 8px 6px 10px;
    gap: 8px;
    grid-template-rows: auto minmax(440px, 58vh) auto;
  }

  .command-header {
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
  }

  .command-headline > div,
  .command-status-group {
    gap: 7px;
  }

  .situation-badge {
    min-height: 30px;
    padding: 0 11px;
    font-size: 0.76rem;
  }

  .command-summary strong {
    font-size: 1rem;
    line-height: 1.16;
  }

  .command-summary p {
    font-size: 0.7rem;
    line-height: 1.28;
  }

  .assessment-disclaimer {
    gap: 4px;
    padding: 5px 0 0;
    font-size: 0.58rem;
    line-height: 1.25;
  }

  .command-metrics {
    gap: 5px;
  }

  .command-metrics div {
    min-height: 58px;
    padding: 7px 5px;
    border-radius: 9px;
  }

  .command-metrics strong {
    font-size: 1.03rem;
  }

  .command-metrics span {
    font-size: 0.56rem;
    line-height: 1.14;
  }

  .command-recommendation {
    padding: 8px;
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .mission-actions {
    gap: 6px;
  }

  .mission-actions-primary,
  .mission-actions-quick {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .mission-actions-primary::-webkit-scrollbar,
  .mission-actions-quick::-webkit-scrollbar {
    display: none;
  }

  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    flex: 0 0 auto;
    min-width: 96px;
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.69rem;
    white-space: nowrap;
  }

  .mission-actions-quick button {
    min-width: 112px;
  }

  .mission-hint {
    margin-top: 0;
    font-size: 0.66rem;
    line-height: 1.3;
  }

  .map-frame {
    min-height: 440px;
    border-radius: 10px;
  }

  #map {
    min-height: 440px;
  }

  .map-loading-card {
    width: min(270px, calc(100vw - 42px));
    padding: 14px;
  }

  .panel-toggle,
  .map-fullscreen-toggle {
    min-height: 34px;
    border-radius: 999px;
    font-size: 0.64rem;
  }

  .map-panel {
    top: 88px;
    max-height: calc(100% - 104px);
  }

  .map-panel-right .panel {
    padding: 9px;
  }

  .map-panel-right .controls label {
    min-height: 32px;
    font-size: 0.68rem;
  }

  .criteria-stack {
    left: 8px;
    right: 8px;
    bottom: 8px;
    justify-items: start;
    padding: 5px 7px;
  }

  .criteria-row {
    justify-content: flex-start;
    width: 100%;
    font-size: 0.55rem;
  }

  .criteria-row strong {
    font-size: 0.56rem;
  }

  .bottom-panel {
    padding: 10px;
    border-radius: 10px;
  }

  .bottom-panel-head {
    gap: 8px;
  }

  .bottom-panel-head h2 {
    font-size: 0.96rem;
    line-height: 1.2;
  }

  .bottom-panel-head span,
  .bottom-assessment-note {
    font-size: 0.64rem;
  }

  .bottom-panel-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .method-button,
  .bottom-tabs,
  .bottom-panel-controls select {
    width: 100%;
    min-width: 0;
  }

  .method-button {
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 34px;
    font-size: 0.66rem;
  }

  .bottom-tabs {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-tabs button,
  .bottom-panel-controls select {
    min-height: 34px;
    font-size: 0.64rem;
  }

  .bottom-village-legend {
    gap: 5px;
    padding: 6px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .bottom-village-legend span {
    flex: 0 0 auto;
    font-size: 0.58rem;
  }

  .bottom-ops-list {
    max-height: none;
    overflow: visible;
    gap: 7px;
  }

  .bottom-ops-item {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
    border-radius: 9px;
  }

  .bottom-ops-item strong {
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .bottom-ops-item small {
    font-size: 0.66rem;
    line-height: 1.32;
  }

  .bottom-ops-item em {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 2px;
    font-size: 0.64rem;
  }

  .popup {
    max-width: min(270px, calc(100vw - 50px));
  }

  .popup h3 {
    font-size: 0.88rem;
    line-height: 1.22;
  }

  .popup p {
    font-size: 0.72rem;
    line-height: 1.3;
  }

  .popup .popup-status-badge {
    min-height: 28px;
    font-size: 0.74rem;
  }

  .popup-primary-metric strong {
    font-size: 1rem;
  }

  .system-footer {
    margin-top: 0;
  }
}

@media (max-width: 420px) {
  .system-footer {
    gap: 6px;
    padding: 7px 8px;
  }

  .system-footer-logo img {
    width: 26px;
    height: 32px;
  }

  .system-footer-copy strong {
    font-size: 0.66rem;
  }

  .system-footer-copy span {
    font-size: 0.55rem;
  }

  .footer-logo-slot {
    width: 23px;
    height: 22px;
    padding: 2px;
  }

  .footer-logo-slot-dislog {
    width: 25px;
  }

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

  .analysis-toolbox .command-tools {
    grid-template-columns: 1fr;
  }

  .command-metrics {
    grid-template-columns: 1fr;
  }

  .map-area {
    grid-template-rows: auto minmax(420px, 56vh) auto;
  }

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

  .bottom-panel-controls {
    grid-template-columns: 1fr;
  }

  .bottom-tabs,
  .method-button {
    grid-column: auto;
  }

  .river-route-options,
  .route-rain-grid,
  .route-impact-grid {
    grid-template-columns: 1fr;
  }

  .kok-route-grid {
    grid-template-columns: 1fr;
  }

  .river-route-diagram {
    padding: 10px;
    scroll-snap-type: x proximity;
  }

  .river-route-node,
  .river-route-segment {
    scroll-snap-align: center;
  }

  .river-route-node {
    flex-basis: 170px;
  }

  .river-map-label {
    width: 200px;
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 6px 8px 6px 6px;
  }

  .river-map-label i {
    width: 24px;
    height: 24px;
    font-size: 0.64rem;
  }

  .river-map-label strong {
    font-size: 0.68rem;
  }

  .river-map-label small {
    font-size: 0.52rem;
  }

  .river-route-segment {
    flex-basis: 72px;
  }

  .kok-route-metrics b {
    white-space: normal;
  }
}

@media (max-width: 720px) {
  .brand {
    gap: 7px;
    margin-bottom: 7px;
    padding: 8px 42px 8px 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .brand h1 {
    font-size: 0.98rem;
  }

  .brand-version {
    right: 8px;
    bottom: 7px;
    font-size: 0.44rem;
  }

  .brand p {
    font-size: 0.64rem;
    line-height: 1.2;
  }

  .operation-switch {
    top: 8px;
    right: 8px;
  }

  .operation-switch summary {
    width: 29px;
    height: 29px;
    border-radius: 8px;
    font-size: 1.18rem;
  }

  .operation-menu {
    top: 34px;
    width: min(252px, calc(100vw - 24px));
    gap: 6px;
    padding: 8px;
  }

  .operation-menu a {
    min-height: 54px;
    padding: 6px;
  }

  .operation-menu img {
    width: 192px;
    height: 44px;
  }

  .top-control-row {
    gap: 5px;
    margin-bottom: 7px;
  }

  .province-picker {
    gap: 5px;
    padding: 4px 6px;
    font-size: 0.6rem;
  }

  .province-picker,
  .theme-toggle,
  .province-picker select {
    min-height: 30px;
  }

  .province-picker select {
    padding: 0 5px;
    font-size: 0.68rem;
  }

  .theme-toggle {
    width: 44px;
    gap: 0;
    padding: 0;
  }

  .theme-toggle b {
    display: none;
  }

  .theme-toggle input,
  .theme-toggle svg {
    width: 13px;
    height: 13px;
  }

  .analysis-toolbox,
  .river-route-tool {
    margin-bottom: 7px;
  }

  .analysis-toolbox summary,
  .river-route-heading {
    min-height: 34px;
    padding: 0 9px;
    gap: 6px;
    font-size: 0.68rem;
    border-radius: 0;
  }

  .analysis-toolbox summary svg,
  .river-route-heading svg {
    width: 20px;
    height: 20px;
    padding: 4px;
    border-radius: 8px;
  }

  .analysis-toolbox summary::before,
  .river-route-heading::before {
    content: "";
    width: 3px;
    margin: 6px 0 6px -4px;
  }

  .analysis-toolbox summary::after,
  .river-route-heading::after {
    width: 21px;
    height: 21px;
    font-size: 0.62rem;
  }

  .analysis-toolbox .command-tools,
  .river-route-options {
    gap: 5px;
    padding: 6px;
  }

  .analysis-toolbox .command-tools .public-alert-button,
  .analysis-toolbox .command-tools .population-impact-button,
  .analysis-toolbox .command-tools .rain-forecast-button,
  .analysis-toolbox .command-tools .risk-outlook-button,
  .analysis-toolbox .command-tools .risk-incident-button,
  .analysis-toolbox .command-tools .disabled-tool-button,
  .river-route-options button {
    min-height: 29px;
    padding: 0 6px;
    font-size: 0.58rem;
    line-height: 1.12;
  }

  .analysis-toolbox .command-tools .public-alert-button {
    grid-column: auto;
  }

  .quick-action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 7px;
    overflow: visible;
    padding-bottom: 0;
  }

  .quick-action-row button {
    min-width: 0;
    min-height: 31px;
    padding: 0 4px;
    border-radius: 8px;
    font-size: 0.56rem;
  }

  .quick-action-row button svg {
    width: 12px;
    height: 12px;
  }

  .status-strip {
    gap: 5px;
    margin-bottom: 7px;
  }

  .status-card {
    min-height: 48px;
    padding: 6px 3px;
  }

  .status-card span {
    font-size: 0.98rem;
  }

  .status-card p {
    font-size: 0.54rem;
    line-height: 1.1;
  }

  .map-area {
    padding-top: 6px;
    gap: 7px;
  }

  .command-header {
    gap: 6px;
    padding: 7px;
  }

  .command-headline > div,
  .command-status-group {
    gap: 5px;
  }

  .situation-badge {
    min-width: 0;
    min-height: 27px;
    padding: 0 10px;
    font-size: 0.68rem;
  }

  .command-summary {
    margin-top: 2px;
  }

  .command-summary strong {
    font-size: 0.9rem;
  }

  .command-summary p {
    font-size: 0.62rem;
  }

  .assessment-disclaimer {
    margin-top: 2px;
    font-size: 0.52rem;
  }

  .command-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .command-metrics div {
    min-height: 48px;
    padding: 5px 3px;
  }

  .command-metrics strong {
    font-size: 0.9rem;
  }

  .command-metrics span {
    font-size: 0.5rem;
  }

  .command-recommendation {
    padding: 6px 7px;
    font-size: 0.62rem;
  }

  .mission-actions {
    gap: 5px;
  }

  .mission-actions-primary,
  .mission-actions-quick {
    gap: 5px;
  }

  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    min-width: 0;
    min-height: 33px;
    padding: 0 10px;
    font-size: 0.63rem;
  }
}

@media (max-width: 420px) {
  .sidebar {
    padding: 8px;
  }

  .brand {
    padding-right: 38px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .brand h1 {
    font-size: 0.9rem;
  }

  .brand p {
    font-size: 0.58rem;
  }

  .operation-switch summary {
    width: 27px;
    height: 27px;
  }

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

  .province-picker span {
    font-size: 0.54rem;
  }

  .analysis-toolbox .command-tools,
  .river-route-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-toolbox .command-tools .public-alert-button,
  .analysis-toolbox .command-tools .population-impact-button,
  .analysis-toolbox .command-tools .rain-forecast-button,
  .analysis-toolbox .command-tools .risk-outlook-button,
  .analysis-toolbox .command-tools .risk-incident-button,
  .analysis-toolbox .command-tools .disabled-tool-button,
  .river-route-options button {
    font-size: 0.54rem;
  }

  .quick-action-row button {
    font-size: 0.52rem;
  }

  .command-header {
    padding: 6px;
  }

  .command-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .command-metrics div {
    min-height: 44px;
  }

  .command-metrics strong {
    font-size: 0.82rem;
  }

  .command-metrics span {
    font-size: 0.47rem;
  }

  .mission-actions-primary,
  .mission-actions-quick {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    width: 100%;
  }

  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    width: 100%;
    min-height: 32px;
    padding: 0 5px;
    font-size: 0.56rem;
  }
}

@media (max-width: 720px) {
  .command-header {
    grid-template-columns: 1fr !important;
    align-content: start;
    padding: 7px;
    gap: 6px;
  }

  .command-headline > div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 6px;
  }

  .situation-badge {
    min-height: 26px;
    padding: 0 9px;
    font-size: 0.64rem;
  }

  .command-summary {
    min-width: 0;
    margin: 0;
  }

  .command-summary strong {
    font-size: 0.82rem;
    line-height: 1.15;
  }

  .command-summary p {
    font-size: 0.56rem;
    line-height: 1.2;
  }

  .assessment-disclaimer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 4px;
    margin-top: 3px;
    font-size: 0.49rem;
    line-height: 1.18;
  }

  .assessment-disclaimer svg {
    width: 10px;
    height: 10px;
  }

  .command-status-group {
    gap: 5px;
  }

  .command-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px;
  }

  .command-metrics div {
    min-height: 40px;
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 4px 3px;
    text-align: center;
  }

  .command-metrics strong {
    font-size: 0.74rem;
    line-height: 1.05;
  }

  .command-metrics span {
    margin-top: 1px;
    font-size: 0;
    line-height: 1;
  }

  #commandHighRiskVillages + span::after {
    content: "เสี่ยง";
    font-size: 0.48rem;
  }

  #commandWatchVillages + span::after {
    content: "ติดตาม";
    font-size: 0.48rem;
  }

  #commandFloodReports + span::after {
    content: "รายงาน";
    font-size: 0.48rem;
  }

  .command-recommendation {
    padding: 5px 6px;
    border-left-width: 2px;
    border-radius: 7px;
    font-size: 0.54rem;
    line-height: 1.22;
  }

  .command-action-row {
    gap: 4px;
  }

  .mission-actions {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .mission-actions-primary,
  .mission-actions-quick {
    display: grid;
    gap: 4px;
    overflow: visible;
    padding-bottom: 0;
    width: 100%;
  }

  .mission-actions-primary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    width: 100%;
    min-width: 0;
    min-height: 28px;
    padding: 0 3px;
    border-radius: 8px;
    font-size: 0.52rem;
    line-height: 1.05;
  }

  .mission-hint {
    display: none;
  }
}

@media (max-width: 360px) {
  .command-header {
    padding: 6px;
  }

  .command-headline > div {
    gap: 5px;
  }

  .situation-badge {
    padding: 0 7px;
    font-size: 0.58rem;
  }

  .command-summary strong {
    font-size: 0.76rem;
  }

  .command-summary p,
  .command-recommendation {
    font-size: 0.5rem;
  }

  .assessment-disclaimer {
    font-size: 0.45rem;
  }

  .command-metrics div {
    min-height: 38px;
  }

  .command-metrics strong {
    font-size: 0.66rem;
  }

  #commandHighRiskVillages + span::after,
  #commandWatchVillages + span::after,
  #commandFloodReports + span::after,
  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    font-size: 0.46rem;
  }
}

@media (max-width: 720px) {
  .map-panel-left {
    gap: 7px;
  }

  .quick-action-row,
  .status-strip {
    display: none;
  }

  .command-header {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .command-headline,
  .command-status-group,
  .mission-hint {
    display: none;
  }

  .command-action-row {
    display: block;
  }

  .mission-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

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

  .mission-actions-quick {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    min-height: 34px;
    border-radius: 9px;
    padding: 0 4px;
    font-size: 0.57rem;
  }

  .mission-actions button svg {
    width: 12px;
    height: 12px;
  }

  .map-area {
    grid-template-rows: auto minmax(460px, 62vh) auto;
    padding-top: 0;
  }

  .map-frame,
  #map {
    min-height: 460px;
  }
}

@media (max-width: 420px) {
  .app-shell,
  .app-shell.risk-collapsed {
    gap: 0;
  }

  .sidebar {
    padding-bottom: 6px;
  }

  .analysis-toolbox,
  .river-route-tool {
    margin-bottom: 5px;
  }

  .mission-actions button,
  .mission-actions-primary button,
  .mission-actions-quick button {
    min-height: 32px;
    font-size: 0.52rem;
  }

  .mission-actions button svg {
    width: 11px;
    height: 11px;
  }

  .map-area {
    grid-template-rows: auto minmax(450px, 64vh) auto;
  }

  .map-frame,
  #map {
    min-height: 450px;
  }
}
