:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #5e6b73;
  --line: #d9e2e5;
  --paper: #fbfcfb;
  --panel: #ffffff;
  --teal: #086972;
  --teal-soft: #dceff0;
  --coral: #c75146;
  --gold: #d8a029;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(8, 105, 114, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(199, 81, 70, 0.08), transparent 30%),
    var(--paper);
  font-family:
    "Segoe UI", Arial, "Helvetica Neue", Roboto, "Noto Sans", "Liberation Sans",
    sans-serif;
  line-height: 1.5;
}

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

.topbar,
main,
footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 18px;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  height: 84px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(8, 105, 114, 0.12));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.logo:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 6px 16px rgba(8, 105, 114, 0.18));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.1rem, 4vw, 4.7rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.actions,
.search-row,
.table-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: var(--teal);
}

.button.danger {
  border-color: rgba(199, 81, 70, 0.35);
  color: var(--coral);
}

.button.danger:hover,
.button.danger:focus-visible {
  background: rgba(199, 81, 70, 0.08);
}

.auth-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 430px;
}

.auth-box input {
  width: 122px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-weight: 700;
}

.auth-box .admin-password-field {
  width: 150px;
}

.auth-box .button {
  min-height: 38px;
  padding: 0 12px;
}

.auth-box small {
  flex-basis: 100%;
  color: var(--muted);
  font-weight: 700;
}

.auth-box.needs-admin-login {
  padding: 8px;
  border: 1px solid rgba(199, 81, 70, 0.35);
  border-radius: 8px;
  background: rgba(255, 247, 245, 0.92);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.role-badge.admin {
  background: var(--teal);
}

.admin-only.is-locked {
  display: none !important;
}

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.map-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}

.map-heading p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

/* Cho phep 3 o dieu khien co lai va tu xuong dong khi cot hep,
   tranh o "Lop hien thi" tran de len "Tim tren ban do" */
.map-controls .search-box {
  flex: 2 1 240px;
}

.map-controls .select-box {
  flex: 1 1 170px;
}

.map-controls .toggle-box {
  flex: 1 1 170px;
}

.map-controls .search-box,
.map-controls .select-box {
  min-width: 0;
}

.toggle-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.toggle-box input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.accuracy-panel,
.official-data-panel,
.rail-data-panel,
.flood-data-panel,
.coordinate-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

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

.accuracy-card {
  display: grid;
  gap: 5px;
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.accuracy-card strong,
.coordinate-panel strong {
  color: var(--ink);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.accuracy-card span,
.official-data-panel p,
.flood-data-panel p,
.official-status,
.coordinate-panel span {
  color: var(--muted);
}

.accuracy-card.warning {
  border-color: rgba(199, 81, 70, 0.4);
  background: #fff8f7;
}

.accuracy-card.warning strong {
  color: var(--coral);
}

.official-data-panel,
.rail-data-panel,
.flood-data-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  padding: 14px;
}

.flood-layer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  grid-column: 1 / -1;
}

.flood-layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.86rem;
  cursor: pointer;
  user-select: none;
}

.flood-layer-toggle input {
  accent-color: var(--teal);
  cursor: pointer;
}

.flood-layer-toggle:has(input:checked) {
  color: var(--teal);
  border-color: var(--teal);
  background: #f2fafa;
}

.official-data-panel h3,
.rail-data-panel h3,
.flood-data-panel h3 {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 1rem;
}

.official-data-panel p,
.rail-data-panel p,
.flood-data-panel p {
  margin-bottom: 0;
}

.official-controls,
.rail-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.file-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.file-box input {
  min-height: 46px;
  padding: 10px 12px;
}

.rail-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rail-save-actions .button {
  min-height: 40px;
  padding-inline: 14px;
}

.official-status {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.search-box.compact input {
  min-height: 46px;
}
.flood-scenario-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.flood-scenario-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: end;
}

.flood-scenario-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.flood-scenario-summary strong {
  color: var(--coral);
  font-size: 1rem;
}

.flood-scenario-summary span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #f1f5f9;
}

.flood-scenario-guidance article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(199, 81, 70, 0.28);
  border-radius: 8px;
  background: #fff8f7;
}

.flood-scenario-guidance strong {
  color: var(--coral);
}

.flood-scenario-guidance p {
  margin: 0;
}

.flood-scenario-table-wrap {
  max-height: 280px;
  background: #fff;
}

.flood-scenario-table-wrap tr.is-selected td {
  background: #fff8f7;
}

.scenario-level {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.scenario-level.is-critical { background: #991b1b; }
.scenario-level.is-high { background: #dc2626; }
.scenario-level.is-medium { background: #f97316; }
.scenario-level.is-low { background: #0f766e; }


.flood-zoning-guide { display: grid; gap: 10px; padding: 12px; border: 1px solid rgba(15, 118, 110, 0.22); border-radius: 8px; background: #f8fafc; }
.flood-guide-head strong { display: block; color: #0f766e; font-size: 1rem; }
.flood-guide-head span { color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.flood-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.flood-guide-card { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.flood-guide-card.is-primary { border-color: rgba(15, 118, 110, 0.3); background: #ecfdf5; }
.flood-guide-card strong, .flood-zone-card strong { color: #0f766e; }
.flood-guide-card p, .flood-zone-card p { margin: 0; }
.flood-guide-card ul { margin: 0; padding-left: 18px; }
.flood-guide-columns { display: grid; grid-template-columns: 1fr; gap: 18px; }
.flood-guide-table { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.flood-guide-table tr.is-selected td { background: #fff8f7; }
.flood-zone-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.flood-zone-card { display: grid; gap: 5px; padding: 10px; border: 1px solid rgba(2, 132, 199, 0.2); border-radius: 8px; background: #fff; }
@media (max-width: 920px) { .flood-guide-grid, .flood-guide-columns, .flood-zone-cards { grid-template-columns: 1fr; } }

.rail-impact-report {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.compact-heading {
  align-items: end;
}

.compact-heading h3 {
  margin: 0 0 4px;
}

.rail-impact-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.rail-page-button {
  min-height: 32px;
  padding: 0 10px;
}

.rail-page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--teal);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.compact-table {
  max-height: 350px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-table th,
.compact-table td {
  padding: 10px 12px;
  font-size: 0.86rem;
}

.map-frame {
  position: relative;
}

.map-fullscreen-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 800;
  min-height: 38px;
  padding-inline: 12px;
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.16);
}

.map-frame.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--paper);
}

.map-frame.is-fullscreen .map-canvas {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

.map-frame.is-fullscreen .map-fullscreen-toggle {
  top: 16px;
  right: 16px;
  z-index: 1000;
}

body.map-fullscreen-active {
  overflow: hidden;
}

.leaflet-interactive:focus {
  outline: none;
}

.map-canvas {
  width: 100%;
  height: min(66vh, 620px);
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef5f5;
}

.coordinate-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
}

.coordinate-panel div {
  display: grid;
  gap: 4px;
}

.coordinate-panel span {
  font-family: Consolas, "Liberation Mono", "Courier New", monospace;
}

.map-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.leaflet-popup-content {
  display: grid;
  gap: 4px;
  min-width: 190px;
  max-width: 300px;
  font-family:
    "Segoe UI", Arial, "Helvetica Neue", Roboto, "Noto Sans", "Liberation Sans",
    sans-serif;
}

.leaflet-popup-content strong {
  color: var(--ink);
}

.leaflet-popup-content span {
  color: var(--coral);
  font-weight: 800;
}

.leaflet-popup-content p {
  margin: 0;
  color: var(--muted);
}

.map-selection-panel {
  position: absolute;
  left: 12px;
  top: 84px;
  z-index: 820;
  display: grid;
  gap: 4px;
  width: min(300px, calc(100% - 24px));
  padding: 12px 40px 12px 14px;
  border: 1px solid rgba(8, 105, 114, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(23, 32, 38, 0.18);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.35;
  backdrop-filter: blur(8px);
}

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

.map-selection-panel strong {
  color: var(--ink);
}

.map-selection-panel > strong {
  font-size: 0.96rem;
}

.map-selection-panel span {
  color: var(--coral);
  font-weight: 800;
}

.map-selection-panel p {
  margin: 0;
  color: var(--muted);
}

.map-selection-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.map-selection-close:hover,
.map-selection-close:focus-visible {
  background: rgba(8, 105, 114, 0.1);
  color: var(--teal);
}

.boundary-label {
  max-width: 112px;
  padding: 2px 6px;
  pointer-events: none;
  border: 1px solid rgba(8, 105, 114, 0.24);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(23, 32, 38, 0.14);
  font:
    800 0.68rem/1.15 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  text-align: center;
  white-space: normal;
}

.boundary-label.special {
  border-color: rgba(216, 160, 41, 0.5);
  color: #7a4d00;
}

.feature-hover-label {
  padding: 7px 9px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(23, 32, 38, 0.16);
  color: var(--ink);
  font:
    800 0.82rem/1.2 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.feature-hover-label strong,
.feature-hover-label span {
  display: block;
}

.feature-hover-label span {
  margin-top: 2px;
  color: var(--coral);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.boundary-is-hovered {
  animation: boundary-pulse 0.85s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.72));
}

@keyframes boundary-pulse {
  0%,
  100% {
    stroke-opacity: 1;
  }

  50% {
    stroke-opacity: 0.42;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boundary-is-hovered {
    animation: none;
  }
}

.admin-border-tooltip {
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 6px;
  color: #0f172a;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.admin-border-legend {
  display: grid;
  gap: 7px;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  color: #263238;
  font-size: 0.82rem;
}

.flood-warning-legend {
  width: min(260px, calc(100vw - 28px));
  display: grid;
  gap: 6px;
  padding: 10px 11px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.2;
}

.flood-warning-legend strong {
  font-size: 0.86rem;
  color: #7f1d1d;
}

.flood-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 9px;
}

.flood-warning-legend span {
  display: grid;
  grid-template-columns: 13px 1fr;
  align-items: center;
  gap: 5px;
  font-weight: 800;
}

.flood-warning-legend i {
  width: 9px;
  height: 9px;
  margin-left: 2px;
  border: 1px solid rgba(15, 23, 42, 0.3);
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.86);
}

.flood-zone-label {
  min-width: 112px;
  max-width: 176px;
  padding: 5px 7px;
  border: 1px solid rgba(127, 29, 29, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
  text-align: center;
  white-space: normal;
}

.flood-zone-label strong {
  display: block;
  color: #991b1b;
  font-size: 0.72rem;
  line-height: 1.12;
}

.flood-zone-label span {
  display: block;
  color: #334155;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.15;
}

.flood-warning-legend p {
  margin: 1px 0 0;
  color: #7f1d1d;
  font-size: 0.72rem;
  font-weight: 800;
}
.admin-border-legend strong {
  color: var(--ink);
}

.admin-border-legend span {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 8px;
}

.legend-line {
  display: block;
  height: 0;
  border-top: 4px solid #7c3aed;
}

.legend-line.international {
  border-top-color: #b91c1c;
  border-top-style: double;
}

.legend-line.province {
  border-top-style: dashed;
}

.legend-line.coast {
  border-top: 3px solid #0ea5e9;
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.intro p,
footer p,
.table-heading p,
.detail-content p {
  color: var(--muted);
}

.summary {
  max-width: 740px;
  font-weight: 700;
}

.province-mark {
  width: 100%;
  min-height: 210px;
  object-fit: contain;
}

.search-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.ward-focus-button {
  min-width: 132px;
}

.search-status {
  flex: 1 1 100%;
  min-height: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.search-status.is-found {
  color: var(--teal);
}

.search-status.is-missing {
  color: var(--coral);
}

.search-box,
.select-box {
  display: grid;
  gap: 7px;
  min-width: 220px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.search-box {
  flex: 1 1 360px;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 14px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(216, 160, 41, 0.45);
  outline-offset: 2px;
}

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

.stats article,
.infrastructure,
.detail-panel,
.table-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats article {
  min-height: 112px;
  padding: 18px;
}

.stats span {
  display: block;
  color: var(--teal);
  font-size: clamp(1.35rem, 1.7vw, 2rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: normal;
}

.stats p {
  margin: 7px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.infrastructure {
  margin-bottom: 18px;
  padding: 18px;
}

.section-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.highlight {
  display: grid;
  gap: 4px;
  max-width: 880px;
  margin-bottom: 0;
  color: var(--muted);
}

.highlight strong {
  color: var(--coral);
}

.infrastructure-grid {
  column-count: 3;
  column-gap: 12px;
}

.infrastructure-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  break-inside: avoid;
}

.infrastructure-card h3 {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 1rem;
}

.infrastructure-card p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.infrastructure-card ul {
  display: grid;
  gap: 7px;
  padding-left: 18px;
  margin: 0;
  list-style: none;
}

.infrastructure-card li {
  color: #34454b;
  font-weight: 700;
}

.infrastructure-card li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 8px 1px -15px;
  border-radius: 50%;
  background: var(--gold);
}

.content-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.detail-panel,
.table-panel {
  overflow: hidden;
}

.detail-panel {
  position: sticky;
  top: 16px;
  padding: 18px;
}

.detail-content {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 8px;
  background: #f5f8f8;
}

.detail-row strong {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
}

.table-heading {
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.table-heading p {
  margin-bottom: 0;
}

.table-wrap {
  overflow: auto;
  max-height: 640px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef5f5;
  color: #34454b;
  font-size: 0.82rem;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.is-selected {
  background: var(--teal-soft);
}

.type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
}

.type-pill.commune {
  background: var(--coral);
}

.type-pill.special {
  background: #6c5d1f;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

footer {
  padding: 24px 0 34px;
}

footer p {
  margin-bottom: 0;
}

@media (max-width: 820px) {
  .overview,
  .map-heading,
  .map-controls,
  .accuracy-panel,
  .official-data-panel,
  .rail-data-panel,
  .flood-data-panel,
  .coordinate-panel,
  .content-grid,
  .table-heading {
    grid-template-columns: 1fr;
  }

  .table-heading {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    justify-content: flex-start;
  }

  .overview {
    padding: 20px;
  }

  .province-mark {
    min-height: 150px;
  }

  .map-canvas {
    height: 440px;
    min-height: 360px;
  }

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

  .infrastructure-grid {
    column-count: 1;
  }

  .content-grid {
    display: grid;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 520px) {
  .topbar,
  main,
  footer {
    width: min(100% - 20px, 1180px);
  }

  .actions,
  .search-row {
    align-items: stretch;
  }

  .search-box,
  .select-box {
    width: 100%;
  }

  .actions .button {
    flex: 1 1 0;
  }

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

  .infrastructure {
    padding: 14px;
  }
}

/* Modal Overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(23, 32, 38, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: min(440px, calc(100% - 32px));
  padding: 34px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(23, 32, 38, 0.18);
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scaleUp {
  from { transform: scale(0.9) translateY(10px); }
  to { transform: scale(1) translateY(0); }
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  margin: 12px 0 4px;
  font-size: 1.5rem;
  font-weight: 800;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-box span {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-box input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 105, 114, 0.15);
}

.primary-btn {
  width: 100%;
  background: var(--teal);
  color: #fff;
  border: 1px solid var(--teal);
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.2s;
}

.primary-btn:hover {
  filter: brightness(1.08);
}

.back-link {
  text-align: center;
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--teal);
}

.auth-error-msg {
  color: var(--coral);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.auth-status-msg {
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

/* Admin Dropdown Styles */
.admin-menu {
  position: relative;
}

.admin-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-menu-btn .chevron {
  transition: transform 0.2s ease;
}

.admin-menu.is-active .chevron {
  transform: rotate(180deg);
}

.admin-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(23, 32, 38, 0.08);
  display: none;
  flex-direction: column;
  padding: 6px 0;
  z-index: 1000;
}

.admin-menu.is-active .admin-dropdown {
  display: flex;
}

.admin-dropdown button {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-dropdown button:hover {
  background: var(--teal-soft);
  color: var(--teal);
}

/* Blinking/Pulsating animations for flood warning layers */
@keyframes pulse-very-high {
  0% { fill-opacity: 0.18; stroke-opacity: 0.45; }
  50% { fill-opacity: 0.52; stroke-opacity: 1.0; }
  100% { fill-opacity: 0.18; stroke-opacity: 0.45; }
}
@keyframes pulse-high {
  0% { fill-opacity: 0.15; stroke-opacity: 0.4; }
  50% { fill-opacity: 0.46; stroke-opacity: 0.9; }
  100% { fill-opacity: 0.15; stroke-opacity: 0.4; }
}
@keyframes pulse-medium {
  0% { fill-opacity: 0.12; stroke-opacity: 0.35; }
  50% { fill-opacity: 0.4; stroke-opacity: 0.8; }
  100% { fill-opacity: 0.12; stroke-opacity: 0.35; }
}
@keyframes pulse-low {
  0% { fill-opacity: 0.08; stroke-opacity: 0.3; }
  50% { fill-opacity: 0.32; stroke-opacity: 0.7; }
  100% { fill-opacity: 0.08; stroke-opacity: 0.3; }
}
@keyframes pulse-unknown {
  0% { fill-opacity: 0.05; stroke-opacity: 0.25; }
  50% { fill-opacity: 0.25; stroke-opacity: 0.6; }
  100% { fill-opacity: 0.05; stroke-opacity: 0.25; }
}

.blink-flood-very-high {
  animation: pulse-very-high 2.2s infinite ease-in-out;
}
.blink-flood-high {
  animation: pulse-high 2.4s infinite ease-in-out;
}
.blink-flood-medium {
  animation: pulse-medium 2.6s infinite ease-in-out;
}
.blink-flood-low {
  animation: pulse-low 2.8s infinite ease-in-out;
}
.blink-flood-unknown {
  animation: pulse-unknown 3.0s infinite ease-in-out;
}

/* Circle marker (historical flood sites) warning keyframes */
@keyframes pulse-point-very-high {
  0% { fill-opacity: 0.35; stroke-opacity: 0.5; }
  50% { fill-opacity: 0.95; stroke-opacity: 1.0; }
  100% { fill-opacity: 0.35; stroke-opacity: 0.5; }
}
@keyframes pulse-point-high {
  0% { fill-opacity: 0.3; stroke-opacity: 0.45; }
  50% { fill-opacity: 0.85; stroke-opacity: 0.95; }
  100% { fill-opacity: 0.3; stroke-opacity: 0.45; }
}
@keyframes pulse-point-medium {
  0% { fill-opacity: 0.25; stroke-opacity: 0.4; }
  50% { fill-opacity: 0.75; stroke-opacity: 0.9; }
  100% { fill-opacity: 0.25; stroke-opacity: 0.4; }
}
@keyframes pulse-point-low {
  0% { fill-opacity: 0.2; stroke-opacity: 0.35; }
  50% { fill-opacity: 0.65; stroke-opacity: 0.85; }
  100% { fill-opacity: 0.2; stroke-opacity: 0.35; }
}
@keyframes pulse-point-unknown {
  0% { fill-opacity: 0.15; stroke-opacity: 0.3; }
  50% { fill-opacity: 0.55; stroke-opacity: 0.8; }
  100% { fill-opacity: 0.15; stroke-opacity: 0.3; }
}

.blink-flood-point-very-high {
  animation: pulse-point-very-high 2.0s infinite ease-in-out;
}
.blink-flood-point-high {
  animation: pulse-point-high 2.2s infinite ease-in-out;
}
.blink-flood-point-medium {
  animation: pulse-point-medium 2.4s infinite ease-in-out;
}
.blink-flood-point-low {
  animation: pulse-point-low 2.6s infinite ease-in-out;
}
.blink-flood-point-unknown {
  animation: pulse-point-unknown 2.8s infinite ease-in-out;
}
