:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --text: #142033;
  --muted: #667085;
  --line: #d9e2ec;
  --primary: #1a73e8;
  --primary-2: #155e75;
  --accent: #c2410c;
  --warning: #b45309;
  --ok: #15803d;
  --shadow: 0 16px 42px rgba(20, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", "Sarabun", "TH Sarabun New", "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.risk-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(5px);
}

.risk-loading-overlay[hidden] {
  display: none;
}

.risk-loading-dialog {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(440px, 100%);
  border: 1px solid rgba(191, 219, 254, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 64px rgba(15, 23, 42, 0.24);
  padding: 22px;
  text-align: center;
}

.risk-loading-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #1a73e8;
}

.risk-loading-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.risk-loading-dialog strong {
  color: #0f172a;
  font-size: 17px;
  line-height: 1.45;
}

.risk-loading-dialog p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.6;
}

.risk-loading-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.risk-loading-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1a73e8, #38bdf8, #0f766e);
  animation: risk-loading-progress 12000ms ease-in-out forwards;
}

@keyframes risk-loading-progress {
  0% {
    width: 0%;
  }
  72% {
    width: 86%;
  }
  100% {
    width: 100%;
  }
}

.app-shell {
  display: block;
  min-height: calc(100vh - 80px);
  padding: 12px 18px 18px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 22px;
  min-height: 66px;
  padding: 8px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 26px rgba(20, 32, 51, 0.06);
  backdrop-filter: blur(12px);
}

.header-brand {
  min-width: 0;
}

.home-link {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.home-link:focus-visible {
  outline: 3px solid rgba(26, 115, 232, 0.22);
  outline-offset: 4px;
  border-radius: 10px;
}

.brand-block {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d7e3ef;
}

.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-block h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  white-space: nowrap;
}

.brand-block p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.tab-button,
.reset-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.tab-button {
  position: relative;
  background: transparent;
  color: #333333;
  text-align: center;
  padding: 0 12px;
  white-space: nowrap;
  font-weight: 800;
  transition: color 160ms ease, background 160ms ease;
}

.tab-button:hover,
.tab-button.active {
  background: transparent;
  border-color: transparent;
  color: #1a73e8;
}

.tab-button::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 1px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: #1a73e8;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 160ms ease;
}

.tab-button.active::after {
  transform: scaleX(1);
}

.login-button {
  min-height: 40px;
  border: 1px solid #1a73e8;
  border-radius: 999px;
  background: #ffffff;
  color: #1a73e8;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.login-button:hover {
  background: #eff6ff;
  box-shadow: 0 8px 18px rgba(26, 115, 232, 0.14);
}

.hamburger-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-content: center;
  gap: 5px;
  border: 1px solid #d9e2ec;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20, 32, 51, 0.08);
}

.hamburger-button span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #1a73e8;
}

.hamburger-button:hover,
.hamburger-button.active {
  border-color: #1a73e8;
  background: #eff6ff;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 900;
  width: 320px;
  max-width: calc(100vw - 28px);
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid #d9e2ec;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.18);
  transform: translateX(105%);
  transition: transform 180ms ease;
  pointer-events: none;
}

.side-menu.is-open {
  transform: translateX(0);
  pointer-events: auto;
}

.side-menu-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #d9e2ec;
}

.side-menu-header strong {
  color: #0056b3;
  font-size: 18px;
}

.side-menu-close {
  width: 34px;
  height: 34px;
  border: 1px solid #d9e2ec;
  border-radius: 50%;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.side-menu-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
}

.side-menu-list button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #333333;
  cursor: pointer;
  padding: 0 14px;
  text-align: left;
  font-weight: 900;
}

.side-menu-list .menu-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #eef5ff;
  color: #1a73e8;
}

.side-menu-list .menu-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.side-menu-list .menu-icon path,
.side-menu-list .menu-icon circle,
.side-menu-list .menu-icon line,
.side-menu-list .menu-icon polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-menu-list button:hover,
.side-menu-list button.active {
  border-color: #1a73e8;
  background: #eff6ff;
  color: #1a73e8;
}

.side-menu-list button:hover .menu-icon,
.side-menu-list button.active .menu-icon {
  background: #1a73e8;
  color: #ffffff;
}

.advanced-filter {
  position: fixed;
  top: 124px;
  right: 112px;
  z-index: 760;
  width: 364px;
  max-width: calc(100vw - 152px);
  max-height: calc(100vh - 148px);
  overflow: auto;
  background: #ffffff;
  color: #172033;
  border: 1px solid #d7e3ef;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 36px));
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.advanced-filter.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.filter-heading {
  position: relative;
  margin: 0;
  padding: 14px 46px 14px 16px;
  background: #1d4ed8;
  color: #fff;
  border-radius: 8px 8px 0 0;
}

.filter-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.filter-heading > span {
  display: block;
  margin-top: 6px;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.filter-heading .eyebrow {
  color: #bfdbfe;
  margin-bottom: 3px;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  background: #f8fafc;
}

.filter-panel label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.filter-panel span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.filter-panel select,
.filter-panel input {
  width: 100%;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  padding: 0 10px;
  min-width: 0;
}

.filter-panel select:focus,
.filter-panel input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.22);
  border-color: #1d4ed8;
}

.filter-wide {
  grid-column: 1 / -1;
}

.reset-button {
  margin-top: 4px;
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #ffffff;
  font-weight: 700;
}

.apply-filter-button {
  margin-top: 4px;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  font-weight: 900;
  min-height: 38px;
  cursor: pointer;
}

.apply-filter-button:hover {
  background: #0d9488;
  border-color: #0d9488;
}

.workspace {
  min-width: 0;
  padding: 0;
}

.toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.toolbar h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.status-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

.map-control-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 860;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  width: 312px;
  max-width: min(312px, calc(100% - 24px));
  overflow: hidden;
  padding: 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 14px 0 36px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(12px);
  transition: width 160ms ease, transform 160ms ease, background 160ms ease;
}

.map-control-strip.is-collapsed {
  top: 12px;
  bottom: auto;
  left: 12px;
  width: 48px;
  height: 48px;
  overflow: visible;
  background: transparent;
  border-color: transparent;
  border-right: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.map-control-toggle {
  min-height: 42px;
  border: 1px solid #1d4ed8;
  border-radius: 9px;
  background: #1d4ed8;
  color: #fff;
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
}

.map-control-strip.is-collapsed .map-control-toggle {
  width: 48px;
  height: 48px;
  justify-content: center;
  padding: 0;
}

.map-control-strip.is-collapsed .toggle-text {
  display: none;
}

.map-control-toggle .toggle-icon {
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.map-control-toggle .toggle-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.map-control-content {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.map-control-strip.is-collapsed .map-control-content {
  display: none;
}

.layer-category {
  position: relative;
  overflow: visible;
  border: 1px solid #d7e3ef;
  border-radius: 10px;
  background: #fff;
}

.layer-category[open] {
  z-index: 2;
}

.layer-category summary {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 16px;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  list-style: none;
  background: #eef5ff;
  color: #1e3a8a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

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

.layer-category summary > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
}

.category-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.layer-category summary i {
  color: #64748b;
  font-style: normal;
  text-align: center;
}

.layer-category summary i::before {
  content: "v";
}

.layer-category[open] summary i::before {
  content: "⌃";
}

.layer-category-body {
  display: grid;
  gap: 8px;
  padding: 8px;
  background: #fff;
}

.layer-select-row {
  display: grid;
  gap: 4px;
}

.layer-select-row span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.layer-select-row select {
  width: 100%;
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #172033;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.layer-option-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.layer-option-list button {
  min-height: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  padding: 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.layer-option-list button.active {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.control-section {
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid rgba(203, 213, 225, 0.84);
  border-radius: 9px;
  background: rgba(248, 250, 252, 0.88);
}

.control-section.featured {
  border-color: rgba(15, 118, 110, 0.22);
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.96), rgba(255, 255, 255, 0.92));
}

.control-section-title {
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.segmented-control,
.quick-filter-group {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: auto;
}

.map-type-control-panel {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-x: auto;
}

.map-type-control-panel button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eaf0f6;
  color: #334155;
  padding: 0 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.map-type-control-panel button.active {
  background: #172033;
  color: #fff;
}

.hazard-control-panel button[data-gis-hazard="flood"] {
  color: #1d4ed8;
}

.hazard-control-panel button[data-gis-hazard="drought"] {
  color: #c2410c;
}

.hazard-control-panel button.active[data-gis-hazard="flood"] {
  background: #1d4ed8;
  color: #fff;
}

.hazard-control-panel button.active[data-gis-hazard="drought"] {
  background: #c2410c;
  color: #fff;
}

.boundary-control-panel button.active {
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.risk-level-control-panel button[data-gis-risk-level="high"] {
  color: #b91c1c;
}

.risk-level-control-panel button[data-gis-risk-level="medium"] {
  color: #c2410c;
}

.risk-level-control-panel button[data-gis-risk-level="low"] {
  color: #a16207;
}

.risk-level-control-panel button.active[data-gis-risk-level="high"] {
  background: #dc2626;
  color: #fff;
}

.risk-level-control-panel button.active[data-gis-risk-level="medium"] {
  background: #f97316;
  color: #fff;
}

.risk-level-control-panel button.active[data-gis-risk-level="low"] {
  background: #eab308;
  color: #172033;
}

.external-layer-control-panel button.active {
  background: #155e75;
  color: #fff;
}

.gis-drill-path {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  padding: 8px 10px;
}

.external-data-panel {
  position: absolute;
  right: 16px;
  top: 154px;
  z-index: 780;
  width: 310px;
  max-width: calc(100% - 32px);
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
}

.external-data-panel.is-empty {
  display: none;
}

.external-panel-toggle {
  display: none;
}

.external-panel-body {
  display: grid;
  gap: 7px;
}

.external-source-card {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.external-source-card .source-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
}

.external-source-card strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.external-source-card span {
  display: block;
  margin-top: 2px;
  color: #475569;
  font-size: 11px;
  line-height: 1.35;
}

.external-source-card em {
  color: #0f766e;
  font-style: normal;
  font-weight: 800;
}

.external-source-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 6px 8px;
  text-decoration: none;
}

.external-source-link:hover {
  background: #dbeafe;
}

.rainviewer-control-card {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(186, 230, 253, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.96), rgba(255, 255, 255, 0.96));
}

.rainviewer-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rainviewer-control-header strong {
  color: #0c4a6e;
  font-size: 11px;
}

.rainviewer-control-header a {
  color: #0284c7;
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.rainviewer-control-card label {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.rainviewer-control-card small {
  color: #475569;
  font-size: 10px;
  font-weight: 800;
}

.rainviewer-control-card input[type="range"] {
  width: 100%;
  accent-color: #0284c7;
}

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

.rainviewer-actions button {
  min-height: 28px;
  border: 1px solid rgba(14, 165, 233, 0.24);
  border-radius: 7px;
  background: #e0f2fe;
  color: #075985;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.rainviewer-actions button:hover:not(:disabled) {
  background: #0284c7;
  color: #fff;
}

.rainviewer-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.storm-track-marker {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid #7c3aed;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.storm-track-marker span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
}

.storm-track-marker.low {
  border-color: #f97316;
}

.storm-track-marker.low span {
  background: #f97316;
}

.storm-track-marker::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: #7c3aed;
  opacity: 0.32;
}

.storm-track-marker.low::after {
  color: #f97316;
}

.segmented-control button,
.quick-filter-group button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eaf0f6;
  color: #334155;
  padding: 0 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.segmented-control button.active,
.quick-filter-group button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.quick-filter-group.severity button[data-readiness="watch"] {
  color: #b45309;
}

.quick-filter-group.severity button[data-readiness="support"] {
  color: #b91c1c;
}

.quick-filter-group.severity button.active {
  color: #fff;
}

.kpi-card,
.panel,
.map-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 16px;
  min-height: 118px;
  display: grid;
  align-content: space-between;
}

.kpi-card span,
.kpi-card em {
  color: var(--muted);
  font-style: normal;
}

.kpi-card strong {
  font-size: 32px;
  line-height: 1;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.analysis-grid.compact {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
}

.map-section,
.panel {
  min-width: 0;
  padding: 16px;
}

#overview {
  position: relative;
}

#overview .analysis-grid,
#overview .analysis-grid.compact {
  display: block;
  margin: 0;
}

#overview .map-section {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

#overview .map-section > .section-heading {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 510;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  display: block;
  align-items: start;
  max-width: min(560px, calc(100% - 112px));
}

#overview .map-section > .section-heading.marker-legend-panel {
  left: auto;
  right: 16px;
  top: 58px;
  bottom: auto;
  max-width: min(520px, calc(100% - 32px));
  transition: opacity 160ms ease, transform 160ms ease;
}

#overview .map-section > .section-heading.marker-legend-panel.is-collapsed {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.legend-title {
  margin: 0 0 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
}

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

.job-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-start;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  padding: 2px 5px 2px 3px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  white-space: nowrap;
  max-width: 168px;
}

.legend-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: normal;
  font-size: 10px;
  color: var(--marker-color);
  font-weight: 900;
}

.legend-item b {
  color: var(--marker-color);
  font-size: 10px;
  font-weight: 900;
}

.panel.full {
  min-height: calc(100vh - 116px);
}

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

.section-heading h3,
.panel h3 {
  margin: 0;
  font-size: 16px;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-export-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.table-export-control label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-export-control span {
  color: #475569;
  font-size: 11px;
  font-weight: 900;
}

.table-export-control select {
  height: 32px;
  min-width: 92px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 0 9px;
}

.table-export-control button {
  height: 32px;
  border: 1px solid #1a73e8;
  border-radius: 8px;
  background: #1a73e8;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 0 12px;
}

.table-export-control button:hover {
  background: #0f5fc6;
  border-color: #0f5fc6;
}

.map-wrap {
  position: relative;
  height: calc(100vh - 98px);
  min-height: 700px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #dff3f7 0%, #eef7f2 100%);
}

.map-plan-year-badge {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 522;
  max-width: min(760px, calc(100% - 360px));
  transform: translateX(-50%);
  border: 1px solid rgba(209, 213, 219, 0.96);
  border-radius: 999px;
  background: rgba(243, 244, 246, 0.95);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  color: #374151;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.35;
  padding: 9px 16px;
  text-align: center;
  white-space: nowrap;
}

.map-info-toggle {
  position: absolute;
  left: auto;
  right: 16px;
  top: 16px;
  bottom: auto;
  z-index: 790;
  width: 38px;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  font-weight: 900;
  font-style: italic;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
}

.map-info-toggle.active,
.map-info-toggle:hover {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
}

.marker-category-menu .map-info-toggle {
  position: static;
  inset: auto;
  order: 2;
  flex: 0 0 auto;
}

.marker-category-menu {
  position: absolute;
  left: auto;
  right: 16px;
  top: 16px;
  bottom: auto;
  z-index: 790;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.marker-category-menu-toggle {
  display: none;
  order: 3;
}

.marker-category-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  order: 1;
  max-width: min(360px, calc(100% - 108px));
}

.marker-category-controls button,
.marker-category-menu-toggle,
.marker-category-menu .map-info-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: #334155;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.marker-category-controls button:hover,
.marker-category-menu-toggle:hover,
.marker-category-menu .map-info-toggle:hover {
  transform: translateY(-1px);
  border-color: #1a73e8;
}

.marker-category-controls button.active,
.marker-category-menu.is-open .marker-category-menu-toggle {
  border-color: #1a73e8;
  background: #eff6ff;
  box-shadow: 0 8px 22px rgba(26, 115, 232, 0.18);
}

.marker-category-menu-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.marker-category-controls .legend-icon {
  width: 24px;
  height: 24px;
  border-width: 0;
  background: transparent;
  box-shadow: none;
}

.map-boundary-quick-controls {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 790;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 32px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 6px;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.15);
  scrollbar-width: none;
}

.map-boundary-quick-controls::-webkit-scrollbar {
  display: none;
}

.map-boundary-quick-controls button {
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.map-boundary-quick-controls button:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  color: #1a73e8;
}

.map-boundary-quick-controls button.active {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
}

.map-boundary-quick-controls {
  overflow: hidden;
  transition: width 300ms cubic-bezier(0.22, 1, 0.36, 1), max-width 300ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease;
}

.boundary-toolbar-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.boundary-toolbar-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.boundary-toolbar-toggle .boundary-toolbar-map-icon {
  width: 18px;
  height: 18px;
}

.boundary-toolbar-list {
  display: flex;
  gap: 6px;
  overflow: hidden;
  max-width: 252px;
  opacity: 1;
  transition: max-width 300ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease, margin 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.map-boundary-quick-controls.is-collapsed .boundary-toolbar-list {
  max-width: 0;
  opacity: 0;
  margin-left: -6px;
  pointer-events: none;
}

.map-boundary-quick-controls.is-open .boundary-toolbar-toggle svg {
  transform: rotate(180deg);
}

.risk-criteria-panel {
  position: absolute;
  left: 16px;
  bottom: 68px;
  z-index: 792;
  width: 238px;
  max-width: calc(100% - 32px);
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  color: #334155;
  overflow: hidden;
  transform: translateY(0);
  transition: opacity 160ms ease, transform 160ms ease;
}

.risk-criteria-panel.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.risk-criteria-toggle {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  padding: 8px 10px;
  text-align: left;
}

.risk-criteria-toggle::after {
  content: "⌃";
  color: #64748b;
  font-size: 12px;
  line-height: 1;
}

.risk-criteria-panel.is-collapsed .risk-criteria-toggle::after {
  content: "⌄";
}

.risk-criteria-body {
  border-top: 1px solid #e2e8f0;
  padding: 9px 10px 10px;
}

.risk-criteria-panel.is-collapsed .risk-criteria-body {
  display: none;
}

.risk-criteria-body strong {
  display: block;
  margin-bottom: 7px;
  color: #1f2937;
  font-size: 12px;
  font-weight: 950;
}

.risk-criteria-grid {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 5px 7px;
  align-items: center;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.risk-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.16);
}

.risk-swatch.flood-high { background: #075985; }
.risk-swatch.flood-medium { background: #0284c7; }
.risk-swatch.flood-low { background: #38bdf8; }
.risk-swatch.drought-high { background: #dc2626; }
.risk-swatch.drought-medium { background: #f97316; }
.risk-swatch.drought-low { background: #facc15; }

.risk-criteria-body small {
  display: block;
  margin-top: 8px;
  color: #64748b;
  font-size: 10px;
  line-height: 1.35;
}

.map-quick-layer-controls {
  position: absolute;
  z-index: 800;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
}

.hazard-quick-controls {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.external-quick-controls {
  left: 16px;
  top: 58%;
  transform: translateY(-50%);
  display: grid;
}

.external-quick-controls button {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 42px;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
}

.external-quick-controls button span {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  width: max-content;
  max-width: 190px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  padding: 8px 10px;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.external-quick-controls button:hover span,
.external-quick-controls button:focus-visible span {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.map-quick-layer-controls button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid #d7e3ef;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 8px 12px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.map-quick-layer-controls button:hover {
  transform: translateY(-1px);
  border-color: #1a73e8;
  color: #1a73e8;
}

.hazard-quick-controls button[data-quick-hazard="flood"] {
  border-color: #bfdbfe;
  background: rgba(239, 246, 255, 0.96);
  color: #1d4ed8;
}

.hazard-quick-controls button[data-quick-hazard="drought"] {
  border-color: #fed7aa;
  background: rgba(255, 247, 237, 0.96);
  color: #c2410c;
}

.hazard-quick-controls button[data-quick-hazard="flood"]:hover {
  border-color: #1d4ed8;
  color: #1d4ed8;
}

.hazard-quick-controls button[data-quick-hazard="drought"]:hover {
  border-color: #c2410c;
  color: #c2410c;
}

.map-quick-layer-controls button.active {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(26, 115, 232, 0.24);
}

.hazard-quick-controls button[data-quick-hazard="flood"].active {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(29, 78, 216, 0.25);
}

.hazard-quick-controls button[data-quick-hazard="drought"].active {
  border-color: #ea580c;
  background: #ea580c;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(234, 88, 12, 0.25);
}

.map-quick-layer-controls svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  flex: 0 0 auto;
}

.map-icon-dock {
  position: absolute;
  top: 220px;
  right: 14px;
  z-index: 790;
  display: grid;
  gap: 8px;
}

.map-icon-dock button {
  --dock-color: #1a73e8;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: var(--dock-color);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  padding: 0;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.map-icon-dock button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.map-icon-dock .dock-filter {
  --dock-color: #1a73e8;
}

.map-icon-dock .dock-summary {
  --dock-color: #0f766e;
}

.map-icon-dock .dock-jobs {
  --dock-color: #f97316;
}

.map-icon-dock .dock-agency {
  --dock-color: #7c3aed;
}

.map-icon-dock .dock-personnel {
  --dock-color: #dc2626;
}

.map-icon-dock .dock-reset {
  --dock-color: #334155;
}

.map-icon-dock .dock-menu-toggle {
  --dock-color: #1a73e8;
  display: none;
}

.map-icon-dock button.active,
.map-icon-dock button:hover {
  transform: translateY(-1px);
  background: var(--dock-color);
  color: #fff;
  border-color: var(--dock-color);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.floating-info-panel {
  position: fixed;
  z-index: 640;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity 160ms ease, transform 160ms ease;
}

.floating-info-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.floating-panel-close {
  width: 30px;
  height: 30px;
  display: none;
  place-items: center;
  border: 1px solid #d7e3ef;
  border-radius: 50%;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

#kpiPanel {
  left: 50%;
  right: auto;
  bottom: 18px;
  z-index: 835;
  width: min(560px, calc(100% - 220px));
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  transform: translateX(-50%) translateY(10px) scale(0.98);
}

#kpiPanel.is-open {
  transform: translateX(-50%) translateY(0) scale(1);
}

#kpiPanel .kpi-card {
  min-height: 74px;
  padding: 10px 14px;
  border-color: rgba(203, 213, 225, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

#kpiPanel .kpi-card strong {
  font-size: clamp(20px, 2.1vw, 30px);
}

#kpiPanel .kpi-card:hover,
#kpiPanel .kpi-card:focus-visible,
#kpiPanel .kpi-card.is-selected {
  transform: translateY(-3px) scale(1.03);
  border-color: #1a73e8;
  background: rgba(239, 246, 255, 0.94);
  box-shadow: 0 16px 34px rgba(26, 115, 232, 0.22);
  outline: none;
}

#jobPanel,
#agencyPanel,
#personnelPanel {
  right: 78px;
  top: 162px;
  width: 360px;
  max-width: calc(100vw - 120px);
  max-height: calc(100vh - 190px);
  overflow: auto;
}

#agencyPanel {
  top: 242px;
}

#personnelPanel {
  top: 322px;
}

.readiness-alert-box {
  position: absolute;
  left: 14px;
  top: 92px;
  z-index: 500;
  width: min(216px, calc(100% - 28px));
  display: grid;
  gap: 4px;
}

.risk-alert-accordion {
  display: grid;
  gap: 4px;
}

.risk-alert-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  padding: 7px 9px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.13);
}

.risk-alert-toggle em {
  color: #64748b;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.risk-alert-toggle::after {
  content: "⌃";
  color: #64748b;
  font-size: 12px;
}

.risk-alert-accordion.is-collapsed .risk-alert-toggle::after {
  content: "⌄";
}

.risk-alert-list {
  display: grid;
  gap: 4px;
}

.risk-alert-accordion.is-collapsed .risk-alert-list {
  display: none;
}

.alert-card {
  border-radius: 7px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 226, 236, 0.95);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
}

.alert-card strong {
  display: grid;
  gap: 1px;
  margin-bottom: 3px;
  font-size: 11px;
}

.alert-card strong small {
  color: #64748b;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
}

.alert-card span {
  color: var(--muted);
  font-size: 11px;
}

.risk-card {
  border-left-width: 4px;
  border-left-style: solid;
}

.risk-high {
  border-left-color: #dc2626;
  background: rgba(254, 242, 242, 0.96);
}

.risk-medium {
  border-left-color: #f97316;
  background: rgba(255, 247, 237, 0.96);
}

.risk-low {
  border-left-color: #eab308;
  background: rgba(254, 252, 232, 0.96);
}

.risk-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  gap: 3px;
  align-items: baseline;
  min-height: 15px;
}

.risk-row b {
  text-align: right;
  font-size: 11px;
  color: #0f172a;
}

.risk-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 9px;
}

.hazard {
  font-weight: 800;
  font-size: 10px;
}

.hazard.flood {
  color: #2563eb;
}

.hazard.drought {
  color: #c2410c;
}

#mapCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 760px), (pointer: coarse) {
  #mapCanvas {
    touch-action: pan-y pinch-zoom;
  }

  #mapCanvas.is-two-finger-map {
    touch-action: none;
  }

  .leaflet-control-zoom {
    display: none !important;
  }
}

.leaflet-container {
  font-family: "Noto Sans Thai", "Sarabun", "TH Sarabun New", "Segoe UI", Tahoma, sans-serif;
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.5;
  min-width: 240px;
  color: #333333;
}

.leaflet-popup-content strong {
  display: block;
  margin-bottom: 4px;
  color: #0056b3;
}

.operation-popup {
  min-width: 260px;
  color: #333333;
}

.operation-popup header {
  padding-bottom: 8px;
  border-bottom: 1px solid #d9e2ec;
  margin-bottom: 8px;
}

.operation-popup h3 {
  margin: 0;
  color: #0056b3;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 900;
}

.operation-popup p {
  margin: 3px 0 0;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.operation-popup dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.operation-popup dl div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.operation-popup dt {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.operation-popup dd {
  margin: 0;
  color: #333333;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.operation-popup a {
  color: #007bff;
  font-weight: 900;
  text-decoration: none;
}

.operation-popup a:hover {
  text-decoration: underline;
}

.gis-risk-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 6px;
  align-items: center;
  margin-top: 5px;
  min-width: 210px;
}

.gis-risk-row b {
  color: #0f172a;
}

.gis-risk-row em {
  color: var(--muted);
  font-style: normal;
}

.gis-aggregate-breakdown {
  margin-top: 6px;
  padding-top: 2px;
}

.gis-sheet-title {
  display: block;
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.gis-sheet-summary {
  display: block;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  margin-top: 4px;
}

.gis-sheet-divider {
  height: 1px;
  background: #dbeafe;
  margin: 10px 0 8px;
}

.gis-sheet-total {
  color: #0056b3;
  font-size: 13px;
  font-weight: 900;
  margin-top: 8px;
}

.map-tooltip .gis-aggregate-breakdown {
  margin-top: 4px;
}

.map-tooltip .gis-risk-row {
  min-width: 260px;
  margin-top: 4px;
}

.gis-risk-row .flood {
  color: #1d4ed8;
  font-weight: 800;
}

.gis-risk-row .drought {
  color: #c2410c;
  font-weight: 800;
}

.risk-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.risk-dot.high {
  background: #dc2626;
}

.risk-dot.medium {
  background: #f97316;
}

.risk-dot.low {
  background: #facc15;
}

.gis-popup-total {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  padding-top: 6px;
}

.gis-detail-heading {
  margin-top: 8px;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.gis-detail-list {
  display: grid;
  gap: 0;
  margin-top: 5px;
  max-height: 260px;
  min-width: 260px;
  overflow: auto;
  border: 1px solid #dbeafe;
  border-radius: 8px;
}

.gis-detail-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #dbeafe;
  border-radius: 0;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
  text-align: left;
}

.gis-detail-row:nth-child(even) {
  background: #f8fbff;
}

.gis-detail-row:last-child {
  border-bottom: 0;
}

.gis-detail-row:hover {
  background: #eff6ff;
}

.gis-detail-row span {
  font-weight: 800;
}

.gis-detail-row em {
  color: #64748b;
  font-style: normal;
  white-space: nowrap;
}

.gis-detail-row b {
  color: #075985;
  white-space: nowrap;
}

.gis-detail-more {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  margin-top: 5px;
}

.gis-detail-empty {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
}

.map-marker-icon,
.legend-icon {
  color: var(--marker-color);
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid #fff;
  box-shadow: 0 2px 9px rgba(15, 23, 42, 0.32);
}

.leaflet-dwrMarkerPane-pane {
  z-index: 690 !important;
  pointer-events: auto;
}

.leaflet-dwrMarkerPane-pane .leaflet-marker-icon {
  opacity: 1;
  filter: saturate(1.28) contrast(1.12) drop-shadow(0 2px 6px rgba(15, 23, 42, 0.32));
}

.map-marker-icon {
  width: 20px;
  height: 20px;
}

.legend-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-width: 1px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
}

.map-marker-icon svg,
.legend-icon svg {
  width: 72%;
  height: 72%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.map-marker-icon svg circle,
.legend-icon svg circle {
  fill: currentColor;
  stroke: currentColor;
}

.map-tooltip {
  position: absolute;
  display: none;
  width: max-content;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
  color: #fff;
  pointer-events: none;
  font-size: 12px;
  line-height: 1.45;
  z-index: 1200;
}

.map-tooltip strong,
.map-tooltip span,
.map-tooltip em {
  display: block;
}

.map-tooltip strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.map-tooltip span {
  color: #475569;
}

.map-tooltip em {
  color: #0056b3;
  font-style: normal;
  font-weight: 800;
}

.map-tooltip-list {
  display: grid;
  gap: 4px;
  margin: 7px 0;
  min-width: 220px;
}

.map-tooltip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.map-tooltip-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-tooltip-row b {
  color: #0056b3;
  font-size: 11px;
  white-space: nowrap;
}

.map-detail-sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 910;
  display: block;
  height: min(52vh, 430px);
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.96);
  border-radius: 16px 16px 12px 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -18px 42px rgba(15, 23, 42, 0.22);
  color: #172033;
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(100% + 24px));
  transition: height 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.map-detail-sheet.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.map-detail-sheet.is-handle-only {
  height: 28px;
  overflow: hidden;
}

.map-detail-sheet.is-handle-only .map-detail-sheet-content,
.map-detail-sheet.is-handle-only .map-detail-sheet-close {
  display: none;
}

.map-detail-sheet.is-handle-only .map-detail-sheet-handle {
  margin-top: 11px;
}

.map-detail-sheet.is-peek {
  height: 118px;
}

.map-detail-sheet.is-half {
  height: min(52vh, 430px);
}

.map-detail-sheet.is-full {
  top: 14px;
  height: auto;
  border-radius: 18px 18px 0 0;
}

.map-detail-sheet.is-dragging {
  transition-duration: 120ms;
}

.map-detail-sheet-handle {
  width: 42px;
  height: 4px;
  margin: 8px auto 4px;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: grab;
  touch-action: none;
}

.map-detail-sheet-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid #d7e3ef;
  border-radius: 50%;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.map-detail-sheet-content {
  max-height: calc(100% - 26px);
  overflow: auto;
  padding: 6px 16px 16px;
  overscroll-behavior: contain;
}

.map-detail-sheet.is-peek .map-detail-sheet-content {
  max-height: 76px;
  overflow: hidden;
  padding-bottom: 10px;
}

.map-detail-sheet-content .operation-popup,
.map-detail-sheet-content .leaflet-popup-content {
  min-width: 0;
  margin: 0;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 5px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bar-track {
  height: 10px;
  background: #e7edf3;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.agency-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.agency-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
  min-height: 84px;
}

.agency-card strong {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.agency-card-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid !important;
  place-items: center;
  background: #eff6ff;
  color: #1a73e8 !important;
  font-size: 13px !important;
  line-height: 1;
}

.agency-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.operation-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.operation-filter-bar label {
  display: grid;
  gap: 4px;
}

.operation-filter-bar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.operation-filter-bar select,
.operation-filter-bar input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
}

.operation-filter-bar button {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #e2e8f0;
  color: #334155;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 0 14px;
}

.operation-filter-bar button:hover {
  background: #cbd5e1;
}

.personnel-filter-bar {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) auto;
}

.risk-filter-bar {
  grid-template-columns: 180px 110px 150px 150px 150px minmax(190px, 1fr) auto;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: min(64vh, 620px);
  background: #fff;
  scrollbar-gutter: stable;
}

.data-table,
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  background: #fff;
}

.data-table {
  table-layout: fixed;
  min-width: 1120px;
  font-size: 13px;
}

.operation-table {
  min-width: 1240px;
}

.personnel-table {
  min-width: 1120px;
}

.risk-table {
  --risk-header-row-height: 38px;
  min-width: 1320px;
}

.operation-table .col-agency,
.personnel-table .col-agency {
  width: 92px;
}

.operation-table .col-time {
  width: 128px;
}

.operation-table .col-place {
  width: 380px;
}

.operation-table .col-province {
  width: 130px;
}

.operation-table .col-job {
  width: 190px;
}

.operation-table .col-pump {
  width: 150px;
}

.operation-table .col-owner {
  width: 220px;
}

.personnel-table .col-name {
  width: 220px;
}

.personnel-table .col-area {
  width: 260px;
}

.personnel-table .col-phone {
  width: 150px;
}

.personnel-table .col-section {
  width: 320px;
}

.personnel-table .col-note {
  width: 240px;
}

.risk-table .col-level {
  width: 90px;
}

.risk-table .col-area-name {
  width: 220px;
}

.risk-table .col-agency {
  width: 95px;
}

.risk-table .col-province,
.risk-table .col-amphoe {
  width: 150px;
}

.risk-table .col-tambon {
  width: 150px;
}

.risk-table .col-count {
  width: 100px;
}

.risk-table .col-risk {
  width: 112px;
}

.risk-table .col-total {
  width: 124px;
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eaf2fb;
  box-shadow: 0 1px 0 #cbd5e1;
  font-size: 12px;
  color: #1f3f66;
  font-weight: 900;
  white-space: nowrap;
}

th[data-sort-table] {
  cursor: pointer;
  user-select: none;
}

th[data-sort-table]::after {
  content: "↕";
  margin-left: 6px;
  color: #94a3b8;
  font-size: 10px;
}

th[data-sort-table].is-sorted::after {
  content: "↑";
  color: #1a73e8;
}

th[data-sort-table].is-sorted[data-sort-direction="desc"]::after {
  content: "↓";
}

.table-link-row {
  cursor: zoom-in;
}

.table-link-row:hover td {
  background: #eaf2ff !important;
}

.risk-table thead tr:first-child th {
  top: 0;
  z-index: 6;
  height: var(--risk-header-row-height);
  vertical-align: middle;
}

.risk-table .risk-group-heading {
  text-align: center;
}

.risk-table thead tr:nth-child(2) th {
  text-align: center;
}

.risk-table thead tr:nth-child(2) th {
  top: var(--risk-header-row-height);
  z-index: 5;
}

.risk-table thead th[rowspan="2"] {
  z-index: 7;
  vertical-align: middle;
}

td {
  color: #243145;
  font-size: 13px;
}

.data-table tbody tr:nth-child(even) td {
  background: #f8fbff;
}

.data-table tbody tr:hover td {
  background: #eef6ff;
}

.cell-center {
  text-align: center;
}

.cell-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-total {
  color: #0f172a;
  font-weight: 900;
}

.flood-risk-high,
.flood-risk-medium,
.flood-risk-low {
  background: #eff6ff;
  color: #075985;
}

.drought-risk-high,
.drought-risk-medium,
.drought-risk-low {
  background: #fff7ed;
  color: #9a3412;
}

.cell-nowrap {
  white-space: nowrap;
}

.cell-primary {
  color: #0f172a;
  font-weight: 700;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-footer button {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 12px;
}

.table-footer button:hover {
  background: #dbeafe;
}

.table-footer button[hidden] {
  display: none;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e6f3f1;
  color: #0f766e;
  font-weight: 700;
  font-size: 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.42fr);
  gap: 10px;
  align-items: start;
}

.admin-panel {
  position: relative;
  overflow: visible;
}

.admin-section-heading {
  align-items: flex-start;
}

.admin-filter-toggle {
  min-height: 38px;
  border: 1px solid #1a73e8;
  border-radius: 8px;
  background: #ffffff;
  color: #1a73e8;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 8px 14px;
}

.admin-quick-filter {
  position: sticky;
  top: 78px;
  z-index: 6;
  display: none;
  margin: 0 0 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  padding: 14px;
}

.admin-quick-filter.is-open {
  display: block;
}

.dashboard-page {
  background: #f8fafc;
}

.dashboard-heading {
  align-items: flex-start;
}

.dashboard-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard-role-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-role-switch button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
}

.dashboard-role-switch button.active {
  border-color: #1a73e8;
  background: #eff6ff;
  color: #1a73e8;
}

.dashboard-role-switch span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-filter-bar label {
  display: grid;
  gap: 5px;
}

.dashboard-filter-bar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.dashboard-filter-bar select,
.dashboard-filter-bar button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
}

.dashboard-filter-bar button {
  background: #e2e8f0;
  cursor: pointer;
  font-weight: 900;
}

.dashboard-slider-filter input {
  width: 100%;
  accent-color: #1a73e8;
}

.dashboard-slider-filter em {
  color: #1a73e8;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.dashboard-page[data-role="executive"] .operational-only,
.dashboard-page[data-role="operations"] .executive-only {
  display: none;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.dashboard-kpi,
.dashboard-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.dashboard-kpi {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.dashboard-kpi span,
.dashboard-kpi em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.dashboard-kpi strong {
  color: #0f172a;
  font-size: 25px;
  line-height: 1;
}

.dashboard-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-quality-list,
.dashboard-notification-list {
  display: grid;
  gap: 8px;
}

.dashboard-quality-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 10px;
}

.dashboard-quality-list article.good {
  border-left-color: #16a34a;
}

.dashboard-quality-list article.watch {
  border-left-color: #f59e0b;
}

.dashboard-quality-list article.bad {
  border-left-color: #dc2626;
}

.dashboard-quality-list strong,
.dashboard-notification-list strong {
  display: block;
}

.dashboard-quality-list span,
.dashboard-notification-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dashboard-quality-list b {
  color: #1a73e8;
  font-size: 20px;
  white-space: nowrap;
}

.dashboard-workflow-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-workflow-kanban article {
  display: grid;
  gap: 4px;
  min-height: 76px;
  align-content: start;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px;
}

.dashboard-workflow-kanban b {
  color: #1a73e8;
  font-size: 22px;
  line-height: 1;
}

.dashboard-workflow-kanban span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-workflow-kanban .draft {
  background: #f1f5f9;
}

.dashboard-workflow-kanban .submitted {
  background: #eff6ff;
}

.dashboard-workflow-kanban .returned {
  background: #fff7ed;
}

.dashboard-workflow-kanban .approved {
  background: #ecfdf5;
}

.dashboard-workflow-kanban .locked {
  background: #eef2ff;
}

.dashboard-notification-list article {
  display: grid;
  gap: 3px;
  border-left: 4px solid #1a73e8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.dashboard-notification-list article.warning {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.dashboard-notification-list article.success {
  border-left-color: #16a34a;
  background: #f0fdf4;
}

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

.dashboard-card {
  padding: 10px;
}

.dashboard-card.wide {
  grid-column: span 1;
}

.dashboard-map-card {
  grid-column: span 2;
  overflow: visible;
}

.dashboard-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.dashboard-card-heading h3 {
  margin: 0;
  font-size: 13px;
}

.dashboard-card-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.dashboard-card-note {
  margin: -2px 0 8px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

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

.dashboard-traffic {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-height: 150px;
}

.dashboard-traffic article {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: end;
  gap: 4px;
  min-height: 150px;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.dashboard-traffic article i {
  position: absolute;
  inset: auto 0 0;
  opacity: 0.22;
}

.dashboard-traffic article.ready i {
  background: #16a34a;
}

.dashboard-traffic article.watch i {
  background: #f59e0b;
}

.dashboard-traffic article.support i {
  background: #dc2626;
}

.dashboard-traffic strong {
  position: relative;
  z-index: 1;
  font-size: 28px;
}

.dashboard-traffic span {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-weight: 900;
}

.dashboard-risk-bar {
  display: grid;
  gap: 5px;
}

.dashboard-risk-bar div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-risk-group {
  display: grid;
  gap: 7px;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px;
}

.dashboard-risk-group > strong {
  color: #0f172a;
  font-size: 13px;
}

.dashboard-risk-group.flood {
  background: #eff6ff;
}

.dashboard-risk-group.drought {
  background: #fff7ed;
}

.dashboard-risk-bar span,
.dashboard-risk-bar b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.dashboard-risk-bar b {
  color: #0f172a;
  white-space: nowrap;
}

.dashboard-risk-bar i {
  height: 9px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.dashboard-risk-bar em {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.dashboard-agency-risk-map {
  position: relative;
  min-height: 430px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f8fafc),
    radial-gradient(circle at 62% 18%, rgba(226, 232, 240, 0.42), transparent 32%);
  overflow: visible;
}

.dashboard-agency-risk-map::before {
  content: none;
}

.dashboard-agency-risk-map::after {
  content: none;
}

.agency-map-region {
  position: absolute;
  z-index: var(--risk-z, 1);
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  height: calc(var(--h) * 1%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
  background: var(--risk-color, #e2e8f0);
  cursor: pointer;
  font: inherit;
  font-size: var(--region-font, 11px);
  font-weight: 900;
  padding: 5px 8px;
  transform: translate(-50%, -50%);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
}

.agency-map-region.dimmed {
  opacity: 0.22;
  filter: grayscale(0.45);
}

.agency-map-region.dimmed:hover {
  opacity: 0.86;
  filter: none;
}

.agency-map-region:hover,
.agency-map-region.active {
  z-index: 140;
  border-color: #1a73e8;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.22);
  transform: translate(-50%, -50%) scale(1.08);
}

.agency-map-region strong,
.agency-map-region span {
  position: relative;
  z-index: 1;
  color: #0f172a;
  line-height: 1;
}

.agency-map-region strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.agency-map-region span {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  min-width: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 4px 6px;
  font-size: 10px;
}

.agency-map-region span b {
  color: #0f172a;
  font-size: var(--metric-font, 15px);
  font-weight: 950;
}

.agency-map-region span small {
  color: #334155;
  font-size: 10px;
  font-weight: 950;
}

.agency-map-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 6;
  display: none;
  min-width: 176px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  font-style: normal;
  padding: 8px 10px;
  text-align: left;
  transform: translateX(-50%);
}

.agency-map-region:hover .agency-map-tooltip {
  display: grid;
  gap: 3px;
}

.agency-map-tooltip b {
  color: #0f172a;
  font-size: 12px;
}

.agency-map-tooltip small {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.agency-map-source {
  display: none;
}

.agency-map-region.none {
  background: #e2e8f0;
}

.dashboard-map-detail {
  display: grid;
  gap: 6px;
  min-height: 72px;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px;
}

.dashboard-map-detail strong {
  font-size: 17px;
}

.dashboard-map-detail div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.dashboard-map-detail b {
  min-width: 58px;
}

.dashboard-map-detail .flood {
  color: #1d4ed8;
}

.dashboard-map-detail .drought {
  color: #c2410c;
}

.dashboard-map-detail span,
.dashboard-map-detail em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.dashboard-donut-chart {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.dashboard-donut-chart.wide {
  grid-template-columns: 112px minmax(0, 1fr);
}

.donut-ring {
  width: 98px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.dashboard-donut-chart.wide .donut-ring {
  width: 108px;
}

.donut-ring::after {
  content: "";
  position: absolute;
  inset: 23px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.donut-ring strong,
.donut-ring span {
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1.05;
}

.donut-ring strong {
  color: #0f172a;
  font-size: 17px;
  font-weight: 950;
}

.donut-ring span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.donut-legend {
  display: grid;
  gap: 5px;
}

.donut-legend div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.donut-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.donut-legend span {
  color: #334155;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-legend b {
  color: #0f172a;
  font-size: 11px;
}

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

.dashboard-priority-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.dashboard-priority-toggle button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  padding: 8px 10px;
}

.dashboard-priority-toggle button.active {
  background: #1a73e8;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(26, 115, 232, 0.18);
}

.dashboard-priority-list,
.dashboard-agency-list,
.dashboard-gap-list {
  display: grid;
  gap: 8px;
}

.dashboard-priority-list article,
.dashboard-agency-list div,
.dashboard-gap-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.dashboard-priority-list span,
.dashboard-agency-list span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-priority-list b {
  color: #1d4ed8;
  white-space: nowrap;
}

.dashboard-heatmap {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-heatmap button {
  display: grid;
  align-content: space-between;
  gap: 8px;
  min-height: 82px;
  border: 1px solid rgba(220, 38, 38, calc(0.18 + var(--heat) * 0.48));
  border-radius: 8px;
  background: rgba(254, 226, 226, calc(0.22 + var(--heat) * 0.52));
  color: #7f1d1d;
  cursor: pointer;
  font: inherit;
  padding: 10px;
  text-align: left;
}

.dashboard-heatmap span,
.dashboard-gap-list span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-gap-list b {
  color: #0f766e;
  white-space: nowrap;
}

.faq-accordion {
  display: grid;
  gap: 8px;
  max-width: 980px;
}

.faq-item {
  overflow: hidden;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.faq-question {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  border: 0;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 950;
  padding: 13px 16px;
  text-align: left;
}

.faq-question:hover,
.faq-question[aria-expanded="true"] {
  background: #f8fbff;
  color: #1a73e8;
}

.faq-question svg {
  width: 20px;
  height: 20px;
  justify-self: center;
  transition: transform 180ms ease;
}

.faq-question path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.faq-question[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  border-top: 1px solid transparent;
  background: #ffffff;
  opacity: 0;
  transition: max-height 220ms ease, opacity 160ms ease, border-color 160ms ease;
}

.faq-answer.is-open {
  border-color: #e2e8f0;
  opacity: 1;
}

.faq-answer p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.75;
  padding: 0 16px 15px;
}

.about-panel {
  display: grid;
  gap: 18px;
}

.about-hero {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 56%, #eef7ff 100%);
}

.about-emblem,
.about-card-icon,
.about-source-icon {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eaf2ff;
  color: #1a73e8;
}

.about-emblem {
  width: 64px;
  height: 64px;
  color: #0f766e;
  background: #e6fffb;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
}

.about-emblem svg,
.about-card-icon svg,
.about-source-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.about-kicker {
  display: inline-flex;
  margin-bottom: 4px;
  color: #1a73e8;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.about-hero h3 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  line-height: 1.25;
}

.about-hero p {
  margin: 5px 0 0;
  color: #475569;
  font-size: 14px;
  font-weight: 850;
}

.about-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
}

.about-story {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.about-story p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.85;
}

.about-owner-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 100%;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  color: #334155;
}

.about-card-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 4px;
}

.about-card-icon svg {
  width: 23px;
  height: 23px;
}

.about-owner-card small,
.about-source-card small {
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
}

.about-owner-card strong {
  color: #1d4ed8;
  font-size: 18px;
  line-height: 1.35;
}

.about-owner-card span:last-child {
  color: #475569;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.65;
}

.about-source-section {
  display: grid;
  gap: 10px;
}

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

.about-source-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-height: 86px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.about-source-card:hover {
  border-color: #1a73e8;
  background: #f8fbff;
  box-shadow: 0 12px 28px rgba(26, 115, 232, 0.11);
}

.about-source-icon {
  grid-row: span 2;
  width: 38px;
  height: 38px;
}

.about-source-icon svg {
  width: 22px;
  height: 22px;
}

.about-source-card strong {
  min-width: 0;
  color: #1d4ed8;
  font-size: 14px;
  line-height: 1.35;
}

.about-source-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-trend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 180px;
}

.dashboard-trend div {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  text-align: center;
}

.dashboard-trend i {
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 118px;
  border-radius: 8px;
  background: #eef2ff;
  overflow: hidden;
}

.dashboard-trend b {
  display: block;
  width: 100%;
  background: #1a73e8;
}

.dashboard-trend strong {
  color: #1d4ed8;
  font-size: 12px;
}

.dashboard-resource-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-resource-groups article {
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.dashboard-resource-groups strong {
  display: block;
  font-size: 24px;
}

.dashboard-resource-groups span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-resource-groups .blue {
  background: #eff6ff;
  color: #1d4ed8;
}

.dashboard-resource-groups .orange {
  background: #fff7ed;
  color: #c2410c;
}

.dashboard-resource-groups .green {
  background: #ecfdf5;
  color: #047857;
}

.dashboard-resource-groups .gray {
  background: #f1f5f9;
  color: #475569;
}

.admin-post-login {
  display: block;
  position: relative;
  min-width: 0;
}

.admin-content-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.admin-drawer-toggle {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 20px;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(26, 115, 232, 0.12);
}

.admin-drawer-toggle:hover,
.admin-drawer-toggle[aria-expanded="true"] {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
}

.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 79;
  border: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(1px);
  cursor: pointer;
}

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: min(310px, calc(100vw - 28px));
  height: 100svh;
  max-height: 100svh;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 0;
  border-right: 1px solid #dbeafe;
  border-radius: 0 14px 14px 0;
  background: #ffffff;
  padding: 14px;
  box-shadow: 18px 0 38px rgba(15, 23, 42, 0.22);
  transform: translateX(calc(-100% - 18px));
  transition: transform 0.22s ease;
}

.admin-post-login.is-sidebar-open .admin-sidebar {
  transform: translateX(0);
}

.admin-sidebar-group {
  display: grid;
  gap: 6px;
}

.admin-sidebar-group + .admin-sidebar-group {
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.admin-sidebar-group strong {
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.35;
}

.admin-sidebar button {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  padding: 6px 8px;
}

.admin-sidebar button::before {
  content: attr(data-admin-icon);
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 7px;
  border-radius: 7px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 10px;
  font-weight: 900;
  vertical-align: middle;
}

.admin-sidebar button:hover,
.admin-sidebar button.active {
  border-color: #1a73e8;
  background: #eaf2ff;
  color: #1a73e8;
}

.admin-sidebar button.active::before {
  background: #1a73e8;
  color: #ffffff;
}

.admin-panel:not(.is-authenticated) .admin-filter-toggle,
.admin-panel:not(.is-authenticated) .admin-drawer-toggle,
.admin-panel:not(.is-authenticated) .admin-section-heading,
.admin-panel:not(.is-authenticated) .admin-quick-filter,
.admin-panel:not(.is-authenticated) .admin-sidebar,
.admin-panel:not(.is-authenticated) .admin-data-dashboard,
.admin-panel:not(.is-authenticated) [data-admin-section="tables"],
.admin-panel:not(.is-authenticated) [data-admin-section="external"],
.admin-panel:not(.is-authenticated) .admin-layout > :not(.admin-login-card) {
  display: none;
}

.admin-panel:not(.is-authenticated) .admin-post-login,
.admin-panel:not(.is-authenticated) .admin-content-stack,
.admin-panel:not(.is-authenticated) .admin-layout {
  display: block;
}

.admin-panel:not(.is-authenticated) .admin-layout {
  max-width: 520px;
  margin: 24px auto 0;
}

.admin-panel.is-authenticated .admin-login-card {
  display: none;
}

.admin-panel.is-authenticated[data-admin-view="status"] .admin-filter-toggle,
.admin-panel.is-authenticated[data-admin-view="status"] .admin-quick-filter,
.admin-panel.is-authenticated[data-admin-view="status"] [data-admin-section="datasets"],
.admin-panel.is-authenticated[data-admin-view="status"] [data-admin-section="tables"],
.admin-panel.is-authenticated[data-admin-view="status"] [data-admin-section="external"],
.admin-panel.is-authenticated[data-admin-view="datasets"] [data-admin-section="status"],
.admin-panel.is-authenticated[data-admin-view="datasets"] [data-admin-section="tables"],
.admin-panel.is-authenticated[data-admin-view="datasets"] [data-admin-section="external"],
.admin-panel.is-authenticated[data-admin-view="tables"] [data-admin-section="status"],
.admin-panel.is-authenticated[data-admin-view="tables"] [data-admin-section="datasets"],
.admin-panel.is-authenticated[data-admin-view="tables"] [data-admin-section="external"],
.admin-panel.is-authenticated[data-admin-view="external"] [data-admin-section="status"],
.admin-panel.is-authenticated[data-admin-view="external"] [data-admin-section="datasets"],
.admin-panel.is-authenticated[data-admin-view="external"] [data-admin-section="tables"] {
  display: none;
}

.admin-panel.is-authenticated[data-admin-view="datasets"] .admin-notification-card,
.admin-panel.is-authenticated[data-admin-view="datasets"] .admin-kanban-card,
.admin-panel.is-authenticated[data-admin-view="tables"] .admin-filter-toggle,
.admin-panel.is-authenticated[data-admin-view="tables"] .admin-quick-filter,
.admin-panel.is-authenticated[data-admin-view="external"] .admin-filter-toggle,
.admin-panel.is-authenticated[data-admin-view="external"] .admin-quick-filter {
  display: none;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.admin-card h3 {
  margin: 0;
  color: #1d4ed8;
  font-size: 15px;
  line-height: 1.25;
}

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

.admin-kicker {
  color: #1a73e8;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid #e2e8f0;
}

.admin-login-card,
.admin-control-card,
.admin-actions-card,
.admin-import-card,
.admin-table-card,
.admin-review-card,
.admin-notification-card,
.admin-kanban-card,
.admin-audit-card {
  grid-column: span 1;
}

.admin-form-card {
  grid-column: span 2;
}

.admin-login-grid,
.admin-control-grid,
.admin-form-grid {
  display: grid;
  gap: 8px;
}

.admin-login-grid {
  margin-top: 10px;
}

.admin-year-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.admin-year-tool-card,
.admin-sync-readiness-card {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
}

.admin-year-tool-card {
  display: grid;
  gap: 9px;
}

.admin-year-tool-card strong,
.admin-sync-check-grid strong {
  color: #0f3f86;
  font-size: 13px;
}

.admin-year-tool-card span,
.admin-sync-check-grid span,
.admin-public-year-summary span {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 11.5px;
  line-height: 1.45;
}

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

.admin-mini-form-grid label:last-child {
  grid-column: 1 / -1;
}

.admin-inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.admin-inline-actions button,
.admin-sync-readiness-card button {
  min-height: 30px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #ffffff;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.admin-inline-actions button.primary {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
}

.admin-public-year-summary {
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  box-shadow: inset 0 0 0 1px #e0ecff;
}

.admin-public-year-summary strong {
  display: block;
  margin-top: 3px;
  color: #1a73e8;
  font-size: 22px;
  line-height: 1;
}

.admin-public-year-summary em,
.admin-sync-check-grid em {
  display: block;
  margin-top: 5px;
  color: #475569;
  font-size: 11px;
  font-style: normal;
  line-height: 1.45;
}

.admin-sync-readiness-card {
  margin: 9px 0 12px;
}

.admin-sync-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.admin-sync-check-grid article {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px;
}

@media (max-width: 900px) {
  .admin-year-tool-grid,
  .admin-sync-check-grid {
    grid-template-columns: 1fr;
  }

  .admin-mini-form-grid {
    grid-template-columns: 1fr;
  }
}

.password-input-wrap {
  position: relative;
  display: block;
}

.password-input-wrap input {
  width: 100%;
  padding-right: 44px;
}

.password-input-wrap button {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
}

.password-input-wrap button:hover,
.password-input-wrap button.active {
  background: #eaf2ff;
  color: #1a73e8;
}

.password-input-wrap svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.admin-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-form-grid .wide {
  grid-column: span 2;
}

.admin-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.admin-stepper button {
  justify-content: center;
  min-height: 34px;
  border-color: #dbeafe;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}

.admin-stepper button.active {
  border-color: #1a73e8;
  background: #eaf2ff;
  color: #1a73e8;
}

.admin-step-panel {
  display: none;
}

.admin-step-panel.active {
  display: block;
}

.admin-card label {
  display: grid;
  gap: 4px;
}

.admin-card label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.admin-card input,
.admin-card select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
}

.admin-card label.is-invalid input,
.admin-card label.is-invalid select {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.field-hint.is-invalid {
  color: #dc2626;
}

.field-hint.is-valid {
  color: #047857;
}

.admin-card button {
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 7px 10px;
}

.admin-card button:hover {
  border-color: #1a73e8;
  background: #eff6ff;
  color: #1a73e8;
}

.admin-external-sync-workspace {
  display: grid;
  gap: 12px;
}

.admin-external-hero {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.admin-external-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.admin-external-flow article {
  display: grid;
  gap: 5px;
  min-height: 104px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.admin-external-flow b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1a73e8;
  color: #ffffff;
  font-size: 13px;
}

.admin-external-flow strong,
.admin-external-guard-list strong {
  color: #0f172a;
  font-size: 13px;
}

.admin-external-flow span,
.admin-external-guard-list span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.admin-external-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.admin-external-control-grid label {
  display: grid;
  gap: 5px;
}

.admin-external-control-grid .wide {
  grid-column: 1 / -1;
}

.admin-external-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.admin-external-metrics article {
  display: grid;
  gap: 3px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 11px;
}

.admin-external-metrics span {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.admin-external-metrics strong {
  color: #0f172a;
  font-size: 24px;
  line-height: 1;
}

.admin-external-metrics em {
  color: #64748b;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.admin-external-guard-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-external-guard-list article {
  display: grid;
  gap: 5px;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #1a73e8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.admin-login-grid button,
.admin-form-actions .primary,
.admin-card button.primary {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #fff;
}

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

.admin-actions-card button {
  display: grid;
  gap: 4px;
  min-height: 66px;
  text-align: left;
}

.admin-actions-card span,
.admin-review-list span,
.admin-dropzone span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.admin-form-actions {
  order: 30;
  position: sticky;
  bottom: 10px;
  z-index: 25;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
  padding: 10px;
  backdrop-filter: blur(10px);
}

.admin-dropzone {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 118px;
  border: 1px dashed #93c5fd;
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
  text-align: center;
}

.admin-table-preview {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.admin-table-preview table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-table-preview th,
.admin-table-preview td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 9px;
  text-align: left;
  vertical-align: middle;
}

.admin-table-preview th {
  position: sticky;
  top: 0;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 950;
}

.admin-table-preview tr:nth-child(even) td {
  background: #f8fafc;
}

.admin-tables-workspace {
  display: grid;
  gap: 10px;
}

.admin-editable-table-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-table-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-relation-note {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  margin: -2px 0 0;
  align-items: stretch;
}

.admin-relation-note article {
  position: relative;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: linear-gradient(180deg, #eff6ff, #ffffff);
  padding: 9px 10px;
}

.admin-relation-note .admin-tech-note {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  cursor: help;
}

.admin-relation-note .admin-tech-note strong {
  font-size: 0;
}

.admin-relation-note .admin-tech-note strong::before {
  content: "i";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #1a73e8;
  color: #ffffff;
  font-size: 13px;
  font-weight: 950;
  font-family: Georgia, serif;
}

.admin-relation-note .admin-tech-note span {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 60;
  display: block;
  width: min(320px, 72vw);
  margin: 0;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.admin-relation-note .admin-tech-note:hover span,
.admin-relation-note .admin-tech-note:focus-within span {
  opacity: 1;
  transform: translateY(0);
}

.admin-relation-note strong {
  display: block;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.25;
}

.admin-relation-note span {
  display: block;
  margin-top: 3px;
  color: #475569;
  font-size: 11px;
  line-height: 1.45;
}

.admin-edit-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 0.7fr) minmax(160px, 0.9fr) auto auto;
  gap: 10px;
  align-items: end;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
}

.admin-edit-filter-bar label {
  display: grid;
  gap: 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
}

.admin-edit-filter-bar input,
.admin-edit-filter-bar select {
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
}

.admin-edit-filter-bar button {
  min-height: 34px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #ffffff;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 10px;
}

.admin-edit-filter-bar > span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.admin-table-tabs button {
  min-height: 36px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 10px;
}

.admin-table-tabs button:hover,
.admin-table-tabs button.active {
  border-color: #1a73e8;
  background: #eaf2ff;
  color: #1a73e8;
}

.admin-section-label {
  display: grid;
  gap: 3px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.admin-section-label strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
}

.admin-section-label span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.admin-section-label.line-items {
  background: #ffffff;
}

.admin-master-accordion {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  overflow: hidden;
}

.admin-master-accordion summary {
  cursor: pointer;
  list-style: none;
}

.admin-master-accordion summary::-webkit-details-marker {
  display: none;
}

.admin-master-accordion summary::after {
  content: "v";
  position: absolute;
  right: 12px;
  top: 50%;
  color: #1a73e8;
  font-size: 18px;
  font-weight: 950;
  transform: translateY(-50%) rotate(180deg);
  transition: transform 160ms ease;
}

.admin-master-accordion:not([open]) summary::after {
  transform: translateY(-50%) rotate(0deg);
}

.admin-master-accordion .admin-section-label {
  position: relative;
  border: 0;
  border-radius: 0;
  padding-right: 38px;
}

.admin-row-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.admin-row-toolbar button {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
}

.admin-row-toolbar span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.admin-table-control-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  border: 0;
  border-top: 1px solid #dbeafe;
  border-radius: 0;
  background: #f8fbff;
  padding: 10px;
}

.admin-table-control-bar label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-table-control-bar input[type="file"] {
  padding: 6px 8px;
}

.admin-table-control-bar input,
.admin-table-control-bar select {
  min-height: 34px;
  min-width: 0;
}

.admin-table-control-bar .wide {
  grid-column: span 2;
}

.admin-table-control-bar > button {
  min-width: 0;
  min-height: 38px;
}

.admin-month-range {
  display: grid;
  grid-template-columns: minmax(124px, 1fr) auto minmax(124px, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 292px;
}

.admin-month-range span {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.admin-review-summary {
  order: 20;
  display: grid;
  gap: 5px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 10px;
  font-size: 12px;
}

.admin-review-summary[hidden] {
  display: none;
}

.admin-review-summary strong {
  font-size: 13px;
}

.admin-edit-panel {
  display: none;
}

.admin-edit-panel.active {
  display: block;
}

.admin-edit-table-wrap {
  max-height: min(62vh, 620px);
}

.admin-edit-table {
  min-width: 1180px;
  table-layout: auto;
}

.admin-risk-edit-table {
  min-width: 1180px;
}

.admin-edit-table th {
  z-index: 4;
}

.admin-edit-table th:first-child,
.admin-edit-table td:first-child {
  width: 92px;
  min-width: 92px;
  text-align: center;
}

.admin-edit-table th:nth-child(2),
.admin-edit-table td:nth-child(2) {
  min-width: 128px;
}

.admin-edit-table td:first-child input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1a73e8;
  padding: 0;
}

.admin-edit-table th:nth-child(3),
.admin-edit-table td:nth-child(3) {
  min-width: 318px;
}

.admin-edit-table th:nth-child(4),
.admin-edit-table td:nth-child(4) {
  min-width: 210px;
}

.admin-edit-table th:nth-child(5),
.admin-edit-table td:nth-child(5) {
  min-width: 280px;
}

.admin-edit-table th:nth-child(14),
.admin-edit-table td:nth-child(14) {
  min-width: 230px;
}

.admin-edit-table th:nth-child(15),
.admin-edit-table td:nth-child(15) {
  min-width: 150px;
}

.admin-risk-edit-table thead tr:first-child th {
  top: 0;
  z-index: 6;
  height: 34px;
}

.admin-risk-edit-table th[colspan] {
  text-align: center;
}

.admin-risk-edit-table thead tr:nth-child(2) th {
  top: 34px;
  z-index: 5;
}

.admin-edit-table input,
.admin-edit-table select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f1f5f9;
  color: #94a3b8;
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.admin-table-control-bar {
  grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
  gap: 7px;
  padding: 8px;
}

.admin-month-range {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  min-width: 0;
}

.admin-edit-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.admin-edit-table,
.admin-risk-edit-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.admin-edit-table th,
.admin-edit-table td {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
}

.admin-edit-table th:first-child,
.admin-edit-table td:first-child {
  width: 48px;
  min-width: 48px;
}

.admin-edit-table th:nth-child(2),
.admin-edit-table td:nth-child(2) {
  width: 78px;
  min-width: 0;
}

.admin-edit-table th:nth-child(3),
.admin-edit-table td:nth-child(3) {
  width: 136px;
  min-width: 0;
}

.admin-edit-table th:nth-child(4),
.admin-edit-table td:nth-child(4),
.admin-edit-table th:nth-child(5),
.admin-edit-table td:nth-child(5),
.admin-edit-table th:nth-child(6),
.admin-edit-table td:nth-child(6),
.admin-edit-table th:nth-child(7),
.admin-edit-table td:nth-child(7) {
  width: 104px;
  min-width: 0;
}

.admin-edit-table th:nth-child(8),
.admin-edit-table td:nth-child(8) {
  width: 150px;
  min-width: 0;
}

.admin-edit-table.is-readonly td:not(:first-child) input,
.admin-edit-table.is-readonly td:not(:first-child) select,
.admin-edit-table.is-readonly td:not(:first-child) textarea {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.admin-cell-display {
  display: block;
  min-width: 78px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
}

.admin-edit-row-button {
  display: inline-grid;
  place-items: center;
  margin-left: 5px;
  min-width: 42px;
  min-height: 26px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #ffffff;
  color: #1a73e8;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 7px;
}

.admin-cell-invalid {
  box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.55);
  background: #fff1f2 !important;
}

.admin-cell-error {
  display: block;
  margin-top: 4px;
  color: #dc2626;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.25;
}

.admin-edit-table input:focus,
.admin-edit-table select:focus {
  border-color: #1a73e8;
  background: #ffffff;
  color: #0f172a;
  outline: 3px solid rgba(26, 115, 232, 0.12);
}

.admin-edit-table input::placeholder {
  color: #aeb9c8;
  opacity: 1;
}

.admin-edit-table input.is-preview-empty {
  color: #94a3b8;
}

.admin-table-control-bar {
  gap: 12px;
  padding: 12px;
  background: #ffffff;
}

.admin-table-control-bar label {
  gap: 6px;
  align-content: start;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
}

.admin-table-control-bar label:nth-child(1),
.admin-table-control-bar label:nth-child(3),
.admin-table-control-bar label:nth-child(4) {
  border-left: 3px solid #1a73e8;
}

.admin-table-control-bar label:nth-child(5) {
  border-left: 3px solid #0f766e;
}

.admin-table-control-bar label:nth-child(2),
.admin-table-control-bar label:nth-child(6),
.admin-table-control-bar label:nth-child(7),
.admin-table-control-bar label:nth-child(8),
.admin-table-control-bar label:nth-child(9) {
  border-left: 3px solid #f97316;
}

.admin-table-control-bar > button {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #ffffff;
  color: #1d4ed8;
}

.admin-form-actions button {
  border: 1px solid #bfdbfe;
  background: #ffffff;
  color: #1d4ed8;
}

.admin-form-actions button.primary {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(26, 115, 232, 0.22);
}

.admin-edit-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #eaf2ff;
}

.admin-edit-table td {
  background: #ffffff;
}

.admin-edit-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.admin-edit-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.admin-edit-table,
.admin-risk-edit-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

[data-admin-table-panel="operations"] .admin-edit-table {
  min-width: 1860px;
}

[data-admin-table-panel="personnel"] .admin-edit-table {
  min-width: 1120px;
}

[data-admin-table-panel="risk"] .admin-edit-table {
  min-width: 1320px;
}

.admin-edit-table th,
.admin-edit-table td {
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.admin-cell-display {
  min-width: 0;
  overflow-wrap: anywhere;
}

[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(1),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(1) { width: 92px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(2) { width: 92px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(3),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(3) { width: 178px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(4),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(4),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(5),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(5),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(6),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(6) { width: 126px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(7),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(7) { width: 70px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(8),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(8) { width: 220px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(9),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(9) { width: 190px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(10),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(10),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(11),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(11),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(12),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(12),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(13),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(13),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(14),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(14),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(15),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(15) { width: 118px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(16),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(16),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(17),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(17) { width: 118px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(18),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(18) { width: 180px; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(19),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(19) { width: 130px; }

[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(1),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(1) { width: 92px; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(2) { width: 92px; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(3),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(3) { width: 190px; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(4),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(4) { width: 170px; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(5),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(5) { width: 140px; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(6),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(6) { width: 260px; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(7),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(7) { width: 190px; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(8),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(8) { width: 130px; }

[data-admin-table-panel="risk"] .admin-edit-table th,
[data-admin-table-panel="risk"] .admin-edit-table td {
  width: 110px;
  text-align: center;
}

[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(1),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(1) { width: 92px; }
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(2) { width: 92px; }
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(3),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(3),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(4),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(4),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(5),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(5) {
  width: 150px;
  text-align: left;
}

.admin-saved-preview {
  order: 10;
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
}

.admin-saved-preview .admin-table-preview {
  background: #ffffff;
}

.admin-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-preview-actions button {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #ffffff;
  color: #1a73e8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 11px;
}

.admin-preview-actions button:hover {
  border-color: #1a73e8;
  background: #eaf2ff;
}

.admin-saved-preview table {
  min-width: 860px;
}

.admin-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.admin-preview-modal[hidden] {
  display: none;
}

.admin-preview-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  width: min(1040px, 100%);
  height: min(88vh, 780px);
  max-height: 88vh;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.admin-preview-modal-heading {
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.admin-preview-modal-heading h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
}

.admin-preview-modal-heading span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.admin-preview-modal-heading button {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.admin-preview-modal-body {
  display: grid;
  gap: 10px;
  overflow: auto;
  min-height: 0;
  padding: 12px 16px 0;
}

.admin-row-modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px 10px;
  min-height: 100%;
}

.admin-row-modal-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-row-modal-form label[hidden] {
  display: none;
}

.admin-row-modal-form label.wide {
  grid-column: 1 / -1;
}

.admin-row-modal-form span {
  color: #334155;
  font-size: 12px;
  font-weight: 950;
}

.admin-row-modal-form input,
.admin-row-modal-form select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
}

.admin-row-modal-section {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 9px 0 2px;
  border-top: 1px solid #e2e8f0;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 950;
}

.admin-row-modal-section:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.admin-coordinate-helper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1a73e8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 0 10px;
}

.admin-coordinate-helper:hover {
  border-color: #1a73e8;
  background: #dbeafe;
}

.admin-row-modal-form input:focus,
.admin-row-modal-form select:focus {
  border-color: #1a73e8;
  outline: 3px solid rgba(26, 115, 232, 0.12);
}

.admin-row-modal-form .is-invalid input,
.admin-row-modal-form .is-invalid select {
  border-color: #dc2626;
  background: #fff1f2;
}

.admin-row-modal-actions {
  position: sticky;
  bottom: 0;
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 8px -16px 0;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 10px 16px;
  box-shadow: 0 -12px 24px rgba(15, 23, 42, 0.08);
}

.admin-row-modal-actions button.primary {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
}

.admin-modal-table-wrap {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.admin-modal-table-wrap table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-modal-table-wrap th,
.admin-modal-table-wrap td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

.admin-modal-table-wrap th {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 950;
}

@media (max-width: 1320px) {
  .admin-table-control-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.admin-map-preview-box {
  display: grid;
  gap: 5px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(26, 115, 232, 0.12), rgba(20, 184, 166, 0.08)),
    repeating-linear-gradient(45deg, rgba(148, 163, 184, 0.14) 0 1px, transparent 1px 16px);
  padding: 12px;
}

.admin-map-preview-box strong {
  color: #1d4ed8;
  font-size: 14px;
}

.admin-map-preview-box span,
.admin-map-preview-box em {
  color: #475569;
  font-size: 12px;
  font-style: normal;
}

.admin-map-preview-toast {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 1400;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  max-width: min(460px, calc(100vw - 32px));
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  padding: 12px;
}

.admin-map-preview-toast[hidden] {
  display: none;
}

.admin-map-preview-toast strong {
  color: #1a73e8;
  font-size: 13px;
}

.admin-map-preview-toast span {
  color: #64748b;
  font-size: 12px;
}

.admin-map-preview-toast button {
  grid-row: span 2;
  min-height: 34px;
  border: 1px solid #1a73e8;
  border-radius: 8px;
  background: #1a73e8;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 10px;
}

.admin-inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.admin-mini-map {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 92px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(26, 115, 232, 0.12), rgba(20, 184, 166, 0.08)),
    repeating-linear-gradient(45deg, rgba(148, 163, 184, 0.14) 0 1px, transparent 1px 16px);
  padding: 10px;
}

.admin-mini-map span,
.admin-note-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.admin-note-list {
  display: grid;
  gap: 8px;
}

.admin-note-list article {
  display: grid;
  gap: 4px;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  padding: 8px 10px;
}

.admin-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-kanban article {
  display: grid;
  gap: 4px;
  min-height: 82px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px;
}

.admin-kanban article:nth-child(1) {
  background: #f8fafc;
}

.admin-kanban article:nth-child(2) {
  background: #eff6ff;
}

.admin-kanban article:nth-child(3) {
  background: #ecfdf5;
}

.admin-kanban article:nth-child(4) {
  background: #eef2ff;
}

.admin-kanban b {
  color: #1a73e8;
  font-size: 24px;
  line-height: 1;
}

.admin-kanban span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.admin-review-list {
  display: grid;
  gap: 8px;
}

.admin-review-list div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.admin-review-list em {
  color: #b45309;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

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

.schema-list,
.roadmap {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.schema-list li,
.roadmap li {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.schema-list span,
.roadmap span {
  color: var(--muted);
}

.workflow-grid {
  display: grid;
}

.workflow-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.workflow-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
  min-height: 166px;
}

.workflow-step.done {
  border-color: rgba(21, 128, 61, 0.32);
  background: #effaf2;
}

.workflow-step.active {
  border-color: rgba(180, 83, 9, 0.35);
  background: #fff7ed;
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  margin-bottom: 12px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
}

.workflow-step strong {
  display: block;
  margin-bottom: 8px;
}

.workflow-step p,
.workflow-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

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

.workflow-card h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

.workflow-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.workflow-card dl div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
}

.workflow-card dt {
  color: var(--muted);
}

.workflow-card dd {
  margin: 0;
  font-weight: 700;
}

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

.weblink-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon title action"
    "icon url action";
  align-items: center;
  gap: 3px 10px;
  min-height: 78px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  color: #333333;
  padding: 11px;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.weblink-card:hover {
  border-color: #1a73e8;
  background: #f8fbff;
  box-shadow: 0 12px 28px rgba(26, 115, 232, 0.11);
}

.weblink-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #eaf2ff;
  color: #1a73e8;
}

.weblink-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.weblink-card strong {
  grid-area: title;
  min-width: 0;
  color: #1d4ed8;
  font-size: 14px;
  line-height: 1.3;
}

.weblink-card small {
  grid-area: url;
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weblink-card em {
  grid-area: action;
  align-self: center;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1a73e8;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  padding: 5px 8px;
  white-space: nowrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2ff;
  color: #3730a3;
}

.status-chip.warning {
  background: #fff7ed;
  color: #b45309;
}

.status-chip.ready {
  background: #ecfdf5;
  color: #047857;
}

.status-chip.danger {
  background: #fef2f2;
  color: #b91c1c;
}

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

.check-list li {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

.check-list .pass {
  color: var(--ok);
}

.check-list .warn {
  color: var(--warning);
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.action-row button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 700;
}

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

.section-heading.lower {
  margin-top: 18px;
}

.status-flow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-flow span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1120px) {
  .app-header {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .nav-tabs {
    display: none;
  }

  .brand-block h1 {
    white-space: normal;
  }

  .app-shell {
    display: block;
  }

  .advanced-filter {
    top: 92px;
    right: 58px;
    max-width: calc(100vw - 72px);
  }

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

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

  .map-control-strip {
    top: 0;
    bottom: 0;
    left: 0;
    width: min(312px, calc(100% - 28px));
  }

  .map-control-strip.is-collapsed {
    top: 14px;
    bottom: auto;
    left: 14px;
    width: 48px;
  }

  .hazard-quick-controls {
    top: 62px;
    max-width: min(560px, calc(100% - 32px));
    flex-wrap: wrap;
    justify-content: center;
  }

  .map-info-toggle {
    top: 12px;
    right: 12px;
  }

  .marker-category-controls {
    top: 12px;
    right: 54px;
    max-width: min(330px, calc(100% - 106px));
    overflow-x: auto;
    scrollbar-width: none;
  }

  .marker-category-controls::-webkit-scrollbar {
    display: none;
  }

  .marker-category-controls button {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
  }

  #overview .map-section > .section-heading.marker-legend-panel {
    top: 52px;
    right: 12px;
    max-width: min(420px, calc(100% - 24px));
  }

  .map-boundary-quick-controls {
    left: 12px;
    bottom: 12px;
    max-width: min(430px, calc(100% - 24px));
  }

  .risk-criteria-panel {
    left: 12px;
    bottom: 64px;
    width: min(238px, calc(100% - 24px));
  }

  .analysis-grid,
  .analysis-grid.compact,
  .admin-post-login,
  .admin-layout,
  .dashboard-ops-grid,
  .blueprint-grid,
  .weblink-grid,
  .about-content,
  .about-source-grid,
  .workflow-board,
  .workflow-columns {
    grid-template-columns: 1fr;
  }

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

  .dashboard-filter-bar,
  .dashboard-role-switch,
  .dashboard-traffic,
  .dashboard-heatmap,
  .dashboard-trend,
  .dashboard-resource-groups,
  .dashboard-donut-chart,
  .dashboard-donut-chart.wide {
    grid-template-columns: 1fr;
  }

  .dashboard-agency-risk-map {
    min-height: 360px;
  }

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

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-post-login {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .admin-post-login:not(.is-sidebar-collapsed) {
    grid-template-columns: minmax(190px, 0.34fr) minmax(0, 1fr);
  }

  .admin-relation-note {
    grid-template-columns: 1fr;
  }

  .admin-form-card {
    grid-column: span 1;
  }

  .admin-control-grid,
  .admin-form-grid,
  .admin-actions-card,
  .admin-stepper,
  .admin-table-tabs,
  .admin-table-control-bar,
  .admin-kanban {
    grid-template-columns: 1fr;
  }

  .admin-form-grid .wide,
  .admin-table-control-bar .wide {
    grid-column: span 1;
  }

  .map-plan-year-badge {
    max-width: calc(100% - 192px);
    font-size: 12px;
    padding: 8px 12px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0;
  }

  .app-header {
    padding: 12px 14px;
  }

  .tab-panel#overview.active {
    min-height: calc(100svh - 64px);
  }

  .advanced-filter {
    inset: auto 0 0 0;
    top: auto;
    right: auto;
    width: 100%;
    max-width: none;
    max-height: min(82svh, 680px);
    border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% + 18px));
  }

  .advanced-filter.is-open {
    transform: translateY(0);
  }

  .filter-heading {
    border-radius: 18px 18px 0 0;
    padding-top: 16px;
  }

  .filter-panel {
    gap: 12px;
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  }

  .filter-panel select,
  .filter-panel input {
    height: 44px;
    font-size: 15px;
  }

  .about-hero {
    grid-template-columns: 1fr;
  }

  .about-emblem {
    width: 54px;
    height: 54px;
  }

  .about-hero h3 {
    font-size: 21px;
  }

  .login-button {
    display: none;
  }

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

  .admin-sidebar {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 0;
  }

  .filter-panel,
  .kpi-grid,
  .operation-filter-bar,
  .agency-list {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .table-export-control {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }

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

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

  .dashboard-priority-toggle,
  .admin-row-modal-form {
    grid-template-columns: 1fr;
  }

  .dashboard-map-card {
    grid-column: span 1;
  }

  .map-wrap {
    height: calc(100svh - 64px);
    min-height: calc(100svh - 64px);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .map-plan-year-badge {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    transform: none;
    white-space: normal;
  }

  .hazard-quick-controls {
    left: 12px;
    right: 12px;
    top: 58px;
    transform: none;
    max-width: none;
    gap: 6px;
  }

  .map-quick-layer-controls button {
    min-height: 42px;
    font-size: 12px;
    padding: 9px 12px;
  }

  .map-quick-layer-controls svg {
    width: 16px;
    height: 16px;
  }

  .map-info-toggle {
    width: 44px;
    height: 44px;
  }

  .marker-category-controls {
    right: 50px;
    max-width: calc(100% - 62px);
  }

  .marker-category-controls button {
    width: 44px;
    height: 44px;
  }

  .marker-category-controls .legend-icon {
    width: 20px;
    height: 20px;
  }

  #overview .map-section > .section-heading.marker-legend-panel {
    left: 12px;
    right: 12px;
    top: 102px;
    max-width: none;
  }

  .map-boundary-quick-controls {
    left: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
    border-radius: 14px;
  }

  .map-boundary-quick-controls button {
    min-width: 54px;
    min-height: 40px;
    font-size: 12px;
    padding: 7px 10px;
  }

  .external-quick-controls {
    left: 12px;
    top: auto;
    bottom: 64px;
    transform: none;
  }

  .external-quick-controls button {
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
  }

  .map-control-strip {
    width: min(300px, calc(100% - 24px));
    padding: 10px;
  }

  .map-control-strip.is-collapsed {
    padding: 0;
  }

  .layer-option-list {
    grid-template-columns: 1fr;
  }

  .map-icon-dock {
    top: 220px;
    right: 12px;
    gap: 10px;
  }

  .map-icon-dock button {
    width: 48px;
    height: 48px;
  }

  #jobPanel,
  #agencyPanel,
  #personnelPanel {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 14px;
    width: auto;
    max-width: none;
  }

  #kpiPanel {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: min(420px, calc(100% - 24px));
    max-width: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    transform: translateX(-50%) translateY(10px) scale(0.98);
  }

  #kpiPanel.is-open {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  #kpiPanel .kpi-card {
    min-height: 58px;
    padding: 7px 8px;
    border-radius: 10px;
  }

  #kpiPanel .kpi-card span,
  #kpiPanel .kpi-card em {
    font-size: 10px;
    line-height: 1.15;
  }

  #kpiPanel .kpi-card strong {
    font-size: clamp(18px, 7vw, 24px);
  }

  #overview .map-section > .section-heading {
    max-width: calc(100% - 28px);
  }

  .external-data-panel {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 64svh;
    overflow: hidden;
    border-radius: 16px 16px 12px 12px;
    padding: 0;
  }

  .external-panel-toggle {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    background: rgba(255, 255, 255, 0.98);
    color: #0f172a;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 950;
    padding: 10px 14px;
  }

  .external-panel-toggle::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    transform: translateX(-50%);
  }

  .external-panel-toggle em {
    color: #64748b;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
  }

  .external-panel-body {
    max-height: calc(64svh - 48px);
    overflow: auto;
    padding: 0 10px 10px;
  }

  .external-data-panel.is-collapsed .external-panel-body {
    display: none;
  }

  .readiness-alert-box {
    left: 12px;
    top: 112px;
    width: min(226px, calc(100% - 24px));
  }

  .risk-alert-toggle {
    display: flex;
  }

  .map-tooltip {
    display: none !important;
  }

  .job-legend {
    justify-content: flex-start;
    margin-top: 8px;
  }

  .schema-list li,
  .roadmap li {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px), (pointer: coarse) {
  .map-plan-year-badge {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .map-wrap {
    height: calc(100svh - 62px);
    min-height: calc(100svh - 62px);
  }

  .hazard-quick-controls {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .hazard-quick-controls::-webkit-scrollbar {
    display: none;
  }

  .hazard-quick-controls button {
    flex: 0 0 auto;
  }

  .marker-category-controls button {
    width: 42px;
    height: 42px;
  }

  .map-info-toggle {
    width: 42px;
    height: 42px;
  }

  .marker-category-controls {
    right: auto;
  }

  .marker-category-menu:not(.is-open) .marker-category-controls {
    max-width: 0;
    max-height: 0;
  }

  .marker-category-menu.is-open .marker-category-controls {
    max-width: 100%;
    max-height: 46px;
  }

  #overview .map-section > .section-heading.marker-legend-panel {
    top: 98px;
    padding: 6px;
  }

  .job-legend {
    gap: 2px;
  }

  .legend-item {
    font-size: 10px;
    padding: 2px 5px;
  }

  .map-boundary-quick-controls {
    gap: 4px;
    padding: 5px;
  }

  .map-boundary-quick-controls button {
    min-width: 50px;
    font-size: 11px;
  }
}

.admin-post-login,
.admin-post-login.is-sidebar-collapsed,
.admin-post-login:not(.is-sidebar-collapsed) {
  display: block;
  grid-template-columns: none;
}

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  grid-template-columns: 1fr;
  width: min(310px, calc(100vw - 28px));
  height: 100svh;
  max-height: 100svh;
  transform: translateX(calc(-100% - 18px));
}

.admin-post-login.is-sidebar-open .admin-sidebar {
  transform: translateX(0);
}

.admin-content-stack {
  width: 100%;
}

@media (max-width: 760px) {
  .admin-section-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .admin-filter-toggle {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .admin-edit-filter-bar {
    grid-template-columns: 1fr;
  }

  .admin-edit-filter-bar > span {
    white-space: normal;
  }
}

/* Final admin table fit: keep editable tables inside the page frame without horizontal scrolling. */
.admin-edit-table-wrap {
  max-width: 100%;
  overflow-x: hidden !important;
  overflow-y: auto;
}

.admin-edit-table,
.admin-risk-edit-table,
[data-admin-table-panel="operations"] .admin-edit-table,
[data-admin-table-panel="personnel"] .admin-edit-table,
[data-admin-table-panel="risk"] .admin-edit-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-edit-table th,
.admin-edit-table td {
  box-sizing: border-box;
  padding: 6px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.admin-edit-table th {
  font-size: 10px;
  line-height: 1.22;
}

.admin-cell-display {
  display: -webkit-box;
  min-width: 0 !important;
  max-height: 3.35em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #0f172a;
  font-size: 11px;
  line-height: 1.35;
}

.admin-edit-row-button {
  min-width: 34px;
  min-height: 24px;
  margin-left: 2px;
  padding: 2px 5px;
  font-size: 10px;
}

.admin-edit-table td:first-child,
.admin-edit-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 7;
  background: #ffffff;
  box-shadow: 1px 0 0 #dbeafe;
}

.admin-edit-table th:first-child {
  z-index: 9;
  background: #eaf2ff;
}

.admin-edit-table tbody tr:nth-child(even) td:first-child {
  background: #f8fafc;
}

.admin-edit-table td:nth-child(2),
.admin-edit-table th:nth-child(2) {
  position: sticky;
  left: 5%;
  z-index: 6;
  background: #ffffff;
  box-shadow: 1px 0 0 #dbeafe;
}

.admin-edit-table th:nth-child(2) {
  z-index: 8;
  background: #eaf2ff;
}

.admin-edit-table tbody tr:nth-child(even) td:nth-child(2) {
  background: #f8fafc;
}

[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(1),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(1) { width: 5% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(2) { width: 5% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(2) { left: 5%; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(3),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(3) { width: 8% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(4),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(4),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(5),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(5),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(6),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(6) { width: 6% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(7),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(7) { width: 4% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(8),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(8) { width: 9% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(9),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(9) { width: 8% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(10),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(10),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(11),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(11),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(12),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(12),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(13),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(13),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(14),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(14),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(15),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(15) { width: 4% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(16),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(16),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(17),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(17),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(18),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(18) { width: 5% !important; }
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(19),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(19) { width: 4% !important; }

[data-admin-table-panel="operations"] .admin-edit-table .admin-col-select { width: 5%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-agency { width: 5%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-timeframe { width: 8%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-province,
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-district,
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-tambon { width: 6%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-village { width: 4%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-place { width: 9%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-job { width: 8%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-small { width: 4%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-coordinate,
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-contact { width: 5%; }
[data-admin-table-panel="operations"] .admin-edit-table .admin-col-phone { width: 4%; }

[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(16),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(16),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(17),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(17),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(18),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(18),
[data-admin-table-panel="operations"] .admin-edit-table th:nth-child(19),
[data-admin-table-panel="operations"] .admin-edit-table td:nth-child(19) {
  text-align: left;
}

[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(1),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(1) { width: 7% !important; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(2) { width: 8% !important; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(2) { left: 7%; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(3),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(3) { width: 15% !important; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(4),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(4) { width: 14% !important; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(5),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(5) { width: 12% !important; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(6),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(6) { width: 21% !important; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(7),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(7) { width: 16% !important; }
[data-admin-table-panel="personnel"] .admin-edit-table th:nth-child(8),
[data-admin-table-panel="personnel"] .admin-edit-table td:nth-child(8) { width: 7% !important; }

[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(1),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(1) { width: 6% !important; }
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(2) { width: 7% !important; }
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(2),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(2) { left: 6%; }
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(3),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(3),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(4),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(4),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(5),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(5) { width: 11% !important; text-align: left; }
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(6),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(6),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(7),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(7),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(8),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(8),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(9),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(9),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(10),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(10),
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(11),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(11) { width: 7% !important; text-align: center; }
[data-admin-table-panel="risk"] .admin-edit-table th:nth-child(12),
[data-admin-table-panel="risk"] .admin-edit-table td:nth-child(12) { width: 12% !important; text-align: center; }

.map-wrap .hazard-quick-controls {
  z-index: 820;
  display: flex !important;
  opacity: 1;
  visibility: visible;
}

.map-wrap .external-quick-controls {
  z-index: 820;
  display: grid !important;
  opacity: 1;
  visibility: visible;
}

.map-wrap .external-data-panel:not(.is-empty) {
  z-index: 810;
  display: grid;
}

.layer-activation-popup .leaflet-popup-content-wrapper {
  border: 1px solid rgba(26, 115, 232, 0.28);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.layer-activation-popup .leaflet-popup-content {
  min-width: 190px;
  margin: 10px 12px;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
}

.layer-activation-popup .leaflet-popup-content strong {
  margin: 0 0 2px;
  color: #0056b3;
  font-size: 13px;
}

@media (min-width: 761px) and (pointer: fine) {
  .marker-category-menu-toggle {
    display: none !important;
  }

  .marker-category-controls {
    max-width: min(360px, calc(100% - 108px));
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
}

/* Final map responsive controls: collapsible boundary toolbar, mobile FAB menus, and touch-safe overlays. */
.map-boundary-quick-controls .boundary-toolbar-toggle {
  min-width: 46px;
  width: 46px;
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
}

@media (max-width: 760px), (pointer: coarse) {
  .map-detail-sheet {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .map-detail-sheet.is-peek {
    height: 108px;
  }

  .map-detail-sheet.is-half {
    height: auto;
    min-height: 172px;
    max-height: min(64svh, 480px);
  }

  .map-detail-sheet.is-full {
    top: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    height: auto;
  }

  .marker-category-menu {
    left: 12px;
    right: 12px;
    top: calc(64px + env(safe-area-inset-top));
    max-width: none;
    justify-content: flex-end;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .marker-category-menu-toggle {
    display: grid !important;
    order: 1;
    margin-left: auto;
    width: 40px;
    height: 40px;
  }

  .marker-category-controls {
    order: 3;
    flex: 1 0 100%;
    justify-content: flex-end;
    max-width: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: max-width 280ms cubic-bezier(0.22, 1, 0.36, 1), max-height 280ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease, transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .marker-category-menu .map-info-toggle {
    order: 2;
    width: 36px;
    height: 36px;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateX(8px);
    transition: max-width 280ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease, transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .marker-category-menu.is-open .marker-category-controls {
    max-width: 100%;
    max-height: 44px;
    opacity: 1;
    overflow-x: auto;
    overflow-y: hidden;
    pointer-events: auto;
    transform: translateY(0);
  }

  .marker-category-menu.is-open .map-info-toggle {
    max-width: 36px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }

  .marker-category-controls button {
    width: 36px;
    height: 36px;
  }

  .map-boundary-quick-controls {
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: calc(100% - 24px);
    width: auto;
    border-radius: 999px;
  }

  .map-boundary-quick-controls .boundary-toolbar-list {
    max-width: min(236px, calc(100vw - 120px));
  }

  .map-boundary-quick-controls.is-collapsed .boundary-toolbar-list {
    max-width: 0;
  }

  .map-boundary-quick-controls button {
    min-height: 38px;
  }

  .map-icon-dock {
    top: auto;
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    gap: 7px;
  }

  .map-icon-dock .dock-menu-toggle {
    display: grid;
  }

  .map-icon-dock button {
    width: 40px;
    height: 40px;
    transition: opacity 180ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1), background 140ms ease, border-color 140ms ease, color 140ms ease;
  }

  .map-icon-dock button:not(.dock-menu-toggle) {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.92);
  }

  .map-icon-dock.is-open button:not(.dock-menu-toggle) {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .external-quick-controls {
    left: 12px;
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 1120px) {
  .admin-external-flow,
  .admin-external-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-external-flow,
  .admin-external-metrics,
  .admin-external-control-grid,
  .admin-external-guard-list {
    grid-template-columns: 1fr;
  }
}

/* Interaction polish: desktop keeps circular controls; mobile promotes drawers above map tools. */
@media (min-width: 761px) and (pointer: fine) {
  .map-icon-dock button,
  .marker-category-controls button,
  .marker-category-menu-toggle,
  .map-info-toggle {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    aspect-ratio: 1 / 1;
    border-radius: 50% !important;
    padding: 0 !important;
  }

  .map-info-toggle,
  .marker-category-controls button {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .advanced-filter,
  .advanced-filter.is-open,
  .floating-info-panel,
  .floating-info-panel.is-open {
    z-index: 980 !important;
  }

  .advanced-filter {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-height: min(78svh, 640px);
  }

  .hazard-quick-controls {
    left: 64px !important;
    right: auto !important;
    top: calc(12px + env(safe-area-inset-top)) !important;
    width: max-content;
    max-width: calc(100vw - 76px) !important;
    transform: none !important;
    gap: 8px !important;
    z-index: 830 !important;
    flex-wrap: nowrap;
  }

  .hazard-quick-controls button {
    width: auto !important;
    min-width: 104px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 999px !important;
    padding: 0 10px !important;
    justify-content: center;
  }

  .hazard-quick-controls button span,
  .hazard-quick-controls button .button-label {
    display: inline !important;
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hazard-quick-controls button svg {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
  }

  .risk-criteria-panel {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    max-width: none !important;
    z-index: 970 !important;
    border-radius: 16px;
  }

  .risk-criteria-panel.is-collapsed .risk-criteria-body {
    display: none;
  }

  .risk-criteria-panel {
    transform: translateY(calc(100% + 18px));
    opacity: 0;
    pointer-events: none;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
  }

  .risk-criteria-panel:not(.is-hidden) {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .risk-criteria-toggle {
    min-height: 44px;
  }

  .map-detail-sheet.sheet-collapsed {
    height: 108px;
  }

  .map-detail-sheet.is-handle-only,
  .map-detail-sheet.sheet-collapsed.is-handle-only {
    height: 28px !important;
    min-height: 0;
  }

  .map-detail-sheet.is-handle-only .map-detail-sheet-content,
  .map-detail-sheet.is-handle-only .map-detail-sheet-close {
    display: none !important;
  }

  .map-detail-sheet-content {
    max-height: min(54svh, 420px);
  }

  .map-detail-sheet.sheet-expanded {
    box-shadow: 0 -20px 48px rgba(15, 23, 42, 0.26);
  }

  #jobPanel .section-heading,
  #agencyPanel .section-heading,
  #personnelPanel .section-heading {
    padding-right: 38px;
    position: relative;
  }

  #jobPanel .floating-panel-close,
  #agencyPanel .floating-panel-close,
  #personnelPanel .floating-panel-close {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
  }

  .apply-filter-button {
    min-height: 44px;
    font-size: 15px;
  }

  .map-icon-dock,
  .marker-category-menu,
  .external-quick-controls,
  .map-boundary-quick-controls {
    z-index: 820;
  }

  .map-control-strip {
    display: grid !important;
    z-index: 850;
  }

  .map-control-strip.is-collapsed {
    top: calc(12px + env(safe-area-inset-top));
    left: 12px;
    width: 44px;
    height: 44px;
  }

  .map-control-strip.is-collapsed .map-control-toggle {
    width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .map-control-strip:not(.is-collapsed) {
    top: calc(8px + env(safe-area-inset-top));
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    width: min(312px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    border-radius: 14px;
    border-right: 1px solid var(--line);
  }

  .external-quick-controls,
  .map-boundary-quick-controls {
    display: none !important;
  }

  .map-wrap .external-quick-controls,
  .map-wrap .map-boundary-quick-controls {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .readiness-alert-box,
  .risk-criteria-panel {
    display: none !important;
  }
}
