:root {
  color-scheme: light;
  --ink: #153139;
  --muted: #678087;
  --deep: #073c4a;
  --deep-2: #0a5361;
  --teal: #168f91;
  --mint: #dff4f0;
  --line: #d7e4e6;
  --panel: #ffffff;
  --canvas: #eef4f5;
  --shadow: 0 16px 38px rgba(16, 54, 63, 0.1);
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(29, 173, 173, 0.28);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: 72px 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 24px;
  color: white;
  background: linear-gradient(105deg, #062f3b 0%, #075365 68%, #08747a 100%);
  box-shadow: 0 7px 22px rgba(4, 35, 43, 0.18);
  z-index: 900;
}

.brand, .topbar-actions, .profile-button, .role-picker { display: flex; align-items: center; }
.brand { gap: 12px; min-width: 0; }
.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
}
.brand-copy { display: grid; gap: 2px; min-width: 0; }
.brand-name { font-weight: 750; line-height: 1.12; white-space: nowrap; }
.brand-name-zh { color: white; font-size: .92rem; }
.brand-name-en { color: #a9d9dd; font-size: .69rem; letter-spacing: .035em; }
.topbar-actions { gap: 16px; }
.data-badge { font-size: .78rem; padding: 6px 10px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; }
.data-badge i, .map-status i, .system-status i { display: inline-block; width: 7px; height: 7px; background: #65dfbd; border-radius: 50%; margin-right: 6px; }
.role-picker { gap: 8px; font-size: .75rem; color: #b4d5d9; }
.role-picker select { color: white; background: rgba(0,0,0,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 8px; padding: 7px 28px 7px 10px; }
.language-switch { display: flex; padding: 3px; border: 1px solid rgba(255,255,255,.24); border-radius: 9px; background: rgba(0,0,0,.13); }
.language-switch button { min-width: 34px; padding: 4px 7px; border: 0; border-radius: 6px; color: #b7dadd; background: transparent; font-size: .7rem; font-weight: 800; }
.language-switch button.active { color: #073c4a; background: #e5f6f3; }
.profile-button { gap: 9px; padding: 0; border: 0; color: white; background: transparent; text-align: left; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--deep); background: #bcebe5; font-weight: 800; }
.profile-copy { display: grid; }
.profile-copy strong { font-size: .78rem; }
.profile-copy small { color: #aad1d5; font-size: .68rem; }
.icon-button { border: 0; color: inherit; background: transparent; }
.menu-button { display: none; font-size: 1.25rem; }

.sidebar {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px 18px;
  background: rgba(255,255,255,.97);
  border-right: 1px solid var(--line);
  z-index: 800;
}
.sidebar nav { display: grid; gap: 7px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-radius: 10px;
  color: #547077;
  background: transparent;
  text-align: left;
  font-weight: 650;
}
.nav-item span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; color: #3d6e76; background: #edf6f6; }
.nav-item.active { color: #075761; background: #def3f0; }
.nav-item.active span { color: white; background: #158f91; }
.nav-item:disabled { opacity: .42; cursor: not-allowed; }
.system-status { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfb; }
.system-status > span { display: block; font-size: .72rem; color: var(--muted); }
.system-status strong { display: block; margin: 4px 0 2px; font-size: .82rem; }
.system-status small { color: #819499; font-size: .7rem; }

.workspace { grid-column: 2; grid-row: 2; min-width: 0; padding: 26px 30px 34px; overflow: auto; }
.view { display: none; max-width: 1540px; margin: 0 auto; }
.view.active { display: block; }
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.kicker { margin: 0 0 2px; color: #168989; font-size: .7rem; letter-spacing: .16em; font-weight: 800; }
h1 { margin: 0; color: #123b45; font-size: clamp(1.55rem, 2.3vw, 2.1rem); line-height: 1.25; letter-spacing: -.02em; }
.view-heading p:last-child { margin: 5px 0 0; color: var(--muted); }
.button { min-height: 40px; padding: 8px 15px; border-radius: 9px; border: 1px solid transparent; font-weight: 750; }
.button.primary { color: white; background: var(--teal); box-shadow: 0 8px 18px rgba(22,143,145,.2); }
.button.secondary { color: #24525a; background: white; border-color: var(--line); }
.button.wide { width: 100%; }
.text-button { padding: 4px; border: 0; color: #167f82; background: transparent; font-weight: 700; font-size: .78rem; }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 8px 25px rgba(23,66,76,.05); }
.stat-strip article { position: relative; padding: 16px 19px; }
.stat-strip article + article::before { content: ""; position: absolute; top: 18px; bottom: 18px; left: 0; width: 1px; background: var(--line); }
.stat-strip span, .stat-strip small { display: block; }
.stat-strip span { color: var(--muted); font-size: .75rem; }
.stat-strip strong { display: block; margin: 1px 0; color: #0c5963; font-size: 1.45rem; }
.stat-strip small { color: #8a9ba0; font-size: .68rem; }

.map-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: stretch; }
.filter-panel, .map-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.filter-panel { padding: 17px; }
.panel-title { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.panel-title span, .panel-title small { display: block; }
.panel-title span { font-weight: 800; }
.panel-title small { color: #88a0a5; font-size: .62rem; letter-spacing: .12em; }
.filter-panel > label { display: grid; gap: 5px; margin-bottom: 12px; color: #58747a; font-size: .76rem; font-weight: 650; }
input, select { width: 100%; min-height: 40px; padding: 8px 10px; color: #24444a; background: white; border: 1px solid #ccdbdd; border-radius: 8px; }
fieldset { margin: 3px 0 15px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; }
legend { padding: 0 5px; color: #58747a; font-size: .76rem; font-weight: 700; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: #3c5d63; font-size: .76rem; }
.check-row input { width: 16px; min-height: auto; accent-color: var(--teal); }
.map-card { position: relative; min-width: 0; overflow: hidden; }
.map-toolbar { height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: #edf4f5; }
.segmented button { padding: 7px 11px; border: 0; border-radius: 7px; color: #557078; background: transparent; font-size: .76rem; font-weight: 700; }
.segmented button.active { color: #0a5d64; background: white; box-shadow: 0 2px 7px rgba(20,67,77,.12); }
.map-status { color: #59747a; font-size: .72rem; }
#map { height: clamp(470px, 61vh, 700px); min-height: 430px; background: #dceff1; }
/* Leaflet layout fallback: keeps tiles aligned if the CDN stylesheet is delayed or unavailable. */
#map.leaflet-container { position: relative; overflow: hidden; outline: 0; }
#map .leaflet-pane,
#map .leaflet-tile,
#map .leaflet-marker-icon,
#map .leaflet-marker-shadow,
#map .leaflet-tile-container,
#map .leaflet-pane > svg,
#map .leaflet-pane > canvas { position: absolute; top: 0; left: 0; }
#map .leaflet-tile { visibility: hidden; width: 258px !important; height: 258px !important; border: 0 !important; outline: 0; }
#map .leaflet-tile-loaded { visibility: inherit; }
#map .leaflet-tile-pane { z-index: 200; background: #aad3df; }
#map .leaflet-overlay-pane { z-index: 400; }
#map .leaflet-shadow-pane { z-index: 500; }
#map .leaflet-marker-pane { z-index: 600; }
#map .leaflet-tooltip-pane { z-index: 650; }
#map .leaflet-popup-pane { z-index: 700; }
#map .leaflet-zoom-animated { transform-origin: 0 0; }
.google-map-base { position: absolute; inset: 0; z-index: 0; visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .18s ease, visibility 0s linear .18s; }
.google-map-base.active { visibility: visible; opacity: 1; transition-delay: 0s; }
.google-map-base .gm-style-cc,
.google-map-base a { pointer-events: auto; }
#map .leaflet-map-pane { z-index: 1; }
#map.google-basemap { background: transparent; }
#map.google-basemap .leaflet-tile-pane { display: none; }
#map.google-basemap .leaflet-control-attribution { display: none !important; }
.segmented button:disabled { cursor: progress; opacity: .52; }
.map-overlay-stack { position: absolute; z-index: 520; right: 14px; bottom: 14px; left: 14px; display: flex; pointer-events: none; }
.map-card-primary.google-active .map-overlay-stack { bottom: 38px; }
.map-card-primary:has(.bathymetry-credit:not([hidden])) .map-overlay-stack { bottom: 82px; }
.map-info-panel { display: grid; width: min(470px, calc(100% - 74px)); max-height: min(56vh, 430px); overflow: hidden; color: #36585f; border: 1px solid rgba(163,189,193,.9); border-radius: 10px; background: rgba(255,255,255,.94); box-shadow: 0 7px 24px rgba(13,53,62,.17); pointer-events: auto; backdrop-filter: blur(9px); transition: width .18s ease; }
.map-info-panel.collapsed { width: min(190px, calc(100% - 48px)); }
.map-info-panel-toggle { display: flex; align-items: center; justify-content: space-between; gap: 15px; width: 100%; min-height: 43px; padding: 7px 10px; color: #244b54; border: 0; background: rgba(247,251,251,.98); text-align: left; cursor: pointer; }
.map-info-panel-toggle:hover { background: #e9f5f3; }
.map-info-panel-toggle > span:first-child { display: grid; gap: 1px; }
.map-info-panel-toggle strong { font-size: .7rem; }
.map-info-panel-toggle small { color: #71878c; font-size: .56rem; font-weight: 600; line-height: 1.35; }
.map-panel-chevron { flex: 0 0 auto; color: #187d82; font-size: .76rem; transform: rotate(0deg); transition: transform .16s ease; }
.map-info-panel-toggle[aria-expanded="true"] .map-panel-chevron { transform: rotate(180deg); }
.map-info-panel-body { min-height: 0; overflow: auto; border-top: 1px solid rgba(207,222,224,.92); }
.map-info-panel-body[hidden] { display: none; }
.map-info-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; min-height: 31px; padding: 6px 10px; }
.map-info-row + .map-info-row { border-top: 1px solid rgba(207,222,224,.92); }
.map-info-label { flex: 0 0 68px; color: #42636a; font-size: .66rem; font-weight: 800; }
.map-symbol-key { display: inline-flex; align-items: center; gap: 5px; color: #50676d; }
.map-symbol-key b { font-size: .62rem; font-weight: 680; }
.map-symbol-key i { display: inline-block; flex: 0 0 auto; }
.event-location-key i { width: 11px; height: 11px; border: 2px solid white; border-radius: 50%; background: #0b7782; box-shadow: 0 0 0 1px #0b7782; }
.statistical-cell-key i { width: 13px; height: 13px; border: 1px solid rgba(255,255,255,.9); border-radius: 2px; background: #35b6a8; box-shadow: 0 0 0 1px #317a83; }
.map-control-key { display: inline-flex; align-items: center; gap: 4px; color: #50676d; }
.map-control-key i { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; color: #244b54; border: 1px solid #a8c2c6; border-radius: 4px; background: #fff; box-shadow: 0 1px 3px rgba(13,53,62,.1); font-size: .64rem; font-style: normal; font-weight: 800; line-height: 1; }
.map-control-key b { font-size: .6rem; font-weight: 680; }
.scale-control-key i { min-width: 42px; border-width: 0 0 2px 2px; border-radius: 0; box-shadow: none; font-size: .5rem; }
.map-days-row { display: grid; grid-template-columns: 68px minmax(0, 1fr); padding: 0 10px; }
.map-legend-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 31px; padding: 6px 10px; color: inherit; border: 0; background: transparent; cursor: pointer; }
.map-legend-toggle:hover { background: rgba(222,240,239,.72); }
.map-legend-toggle .map-info-label { flex-basis: auto; }
.map-legend-chevron { color: #187d82; font-size: .72rem; transform: rotate(0deg); transition: transform .16s ease; }
.map-legend-toggle[aria-expanded="true"] .map-legend-chevron { transform: rotate(180deg); }
.map-days-scale { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; padding: 6px 0; }
.map-days-scale[hidden] { display: none; }
.map-days-row b { display: inline-flex; align-items: center; gap: 4px; color: #50676d; font-size: .62rem; font-weight: 650; }
.map-days-row b i { width: 11px; height: 11px; border-radius: 3px; background: var(--c); }
.map-display-check { display: inline-flex; align-items: center; gap: 5px; color: #50676d; cursor: pointer; }
.map-display-check input { width: 14px; min-height: 14px; margin: 0; padding: 0; accent-color: var(--teal); }
.map-display-check i { width: 12px; height: 12px; border-radius: 3px; }
.map-display-check b { font-size: .62rem; font-weight: 680; }
.map-display-check.boundary-key i { border: 1.15px solid #4967c6; background: rgba(73,103,198,.08); }
.map-display-check.graticule-key i { height: 7px; border-radius: 0; background: repeating-linear-gradient(90deg, #147985 0 4px, transparent 4px 7px); }
.map-display-check.grid-key i { border-radius: 1px; background: repeating-linear-gradient(90deg, #637784 0 1px, transparent 1px 4px); }
.map-conservation-legend { align-items: flex-start; }
.map-conservation-legend > span:not(.map-info-label) { display: inline-flex; align-items: center; gap: 4px; color: #50676d; }
.map-conservation-legend > span:not(.map-info-label) i { width: 10px; height: 10px; flex: 0 0 10px; border: 1.15px solid var(--layer-color); border-radius: 3px; background: color-mix(in srgb, var(--layer-color) 10%, transparent); }
.map-conservation-legend b { font-size: .58rem; font-weight: 650; }
.map-readout-row { display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; }
.coordinate-readout, .depth-readout { min-width: 0; overflow: hidden; color: #244b54; font: 650 .64rem/1.3 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; white-space: nowrap; text-overflow: ellipsis; }
.coordinate-readout { flex: 0 1 auto; }
.depth-readout { flex: 0 0 auto; color: #0b6e75; }
.map-settings-shortcut { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 27px; padding: 0; color: #315f67; border: 1px solid #c4d7d9; border-radius: 7px; background: #f6fbfa; font-size: .88rem; line-height: 1; cursor: pointer; }
.map-settings-shortcut:hover { color: white; border-color: var(--teal); background: var(--teal); }
.basemap-name-badge { position: absolute; z-index: 535; right: 16px; bottom: 68px; max-width: min(290px, calc(100% - 32px)); padding: 8px 11px; color: white; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(7,60,74,.9); box-shadow: 0 7px 20px rgba(5,39,47,.25); font-size: .7rem; font-weight: 750; letter-spacing: .01em; pointer-events: none; opacity: 0; transform: translateY(5px); transition: opacity .18s ease, transform .18s ease; backdrop-filter: blur(7px); }
.basemap-name-badge.visible { opacity: 1; transform: translateY(0); }
.basemap-name-badge[hidden] { display: none; }
.bathymetry-credit { position: absolute; z-index: 530; bottom: 14px; left: 50%; max-width: min(560px, calc(100% - 180px)); margin: 0; padding: 4px 8px; color: #294e56; border: 1px solid rgba(164,190,194,.82); border-radius: 6px; background: rgba(255,255,255,.9); box-shadow: 0 3px 12px rgba(13,53,62,.13); font-size: .58rem; font-weight: 650; line-height: 1.35; text-align: center; pointer-events: none; transform: translateX(-50%); backdrop-filter: blur(6px); }
.bathymetry-credit[hidden] { display: none; }
.map-card-primary.google-active .bathymetry-credit { bottom: 38px; }
#map .north-arrow-control { display: grid; justify-items: center; min-width: 34px; padding: 5px 6px 4px; color: #123f49; background: rgba(255,255,255,.94); border: 1px solid rgba(107,139,146,.65); border-radius: 7px; box-shadow: 0 2px 8px rgba(13,53,62,.18); pointer-events: none; }
#map .north-arrow-control strong { font-size: .63rem; line-height: 1; letter-spacing: .08em; }
#map .north-arrow-control i { width: 0; height: 0; margin-top: 3px; border-right: 6px solid transparent; border-bottom: 13px solid #0a7078; border-left: 6px solid transparent; filter: drop-shadow(0 1px 1px rgba(8,54,62,.2)); }
#map .leaflet-control-scale { margin-right: 10px; margin-bottom: 24px; }
#map .leaflet-control-scale-line { padding: 1px 5px 2px; color: #244b54; background: rgba(255,255,255,.9); border-color: #48676d; border-top: 0; font-size: .6rem; font-weight: 700; line-height: 1.2; text-align: center; }
.noise-cell { stroke: #fff; stroke-width: 1; }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.popup-title { margin: 0 0 6px; color: #0d5862; font-weight: 800; }
.popup-meta { margin: 2px 0; color: #637a7f; font-size: .76rem; }
.popup-events { display: grid; gap: 7px; max-width: 280px; margin: 9px 0 0; padding: 9px 0 0 17px; border-top: 1px solid #dce9e8; }
.popup-events li { color: #355b62; font-size: .7rem; }
.popup-events strong, .popup-events span, .popup-events a { display: block; }
.popup-events span { color: #7b9094; }
.popup-events a, .source-link { color: #087f89; text-decoration: underline; text-underline-offset: 2px; }
.conservation-stat-marker { width: 0 !important; height: 0 !important; border: 0 !important; background: transparent !important; }
.conservation-stat-card { display: grid; gap: 2px; width: max-content; max-width: 190px; padding: 6px 8px; color: #223e45; border: 2px solid var(--layer-color); border-radius: 8px; background: rgba(255,255,255,.94); box-shadow: 0 4px 13px rgba(14,45,56,.22); text-align: center; transform: translate(-50%, -50%); backdrop-filter: blur(5px); }
.conservation-stat-card strong { max-width: 174px; overflow: hidden; font-size: .64rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.conservation-stat-card span { color: #4a656b; font-size: .59rem; font-weight: 750; line-height: 1.25; white-space: nowrap; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 2000; }
.toast { max-width: 340px; margin-top: 8px; padding: 11px 14px; border-radius: 10px; color: white; background: #123f49; box-shadow: 0 10px 28px rgba(0,0,0,.2); font-size: .82rem; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .menu-button { display: block; }
  .sidebar { position: fixed; top: 72px; bottom: 0; left: 0; width: 260px; transform: translateX(-105%); transition: transform .24s ease; box-shadow: 16px 0 38px rgba(13,43,50,.16); }
  .sidebar.open { transform: translateX(0); }
  .workspace { grid-column: 1; padding: 22px; }
  .map-layout { grid-template-columns: 1fr; }
  .filter-panel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
  .filter-panel .panel-title, .filter-panel fieldset { grid-column: 1 / -1; }
  .filter-panel > label { margin: 0; }
  .filter-panel .wide { height: 40px; }
}

@media (max-width: 720px) {
  .topbar { padding: 0 13px; }
  .data-badge, .role-picker > span, .profile-copy { display: none; }
  .topbar-actions { gap: 8px; }
  .role-picker select { max-width: 126px; }
  .workspace { padding: 17px 12px 26px; }
  .view-heading { align-items: flex-start; }
  .view-heading .button { display: none; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip article:nth-child(3)::before { display: none; }
  .stat-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .map-toolbar { height: auto; align-items: flex-start; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding-inline: 5px; }
  .map-status { display: none; }
  #map { height: 58vh; min-height: 430px; }
  .map-legend { right: 10px; left: 10px; bottom: 10px; gap: 5px; }
}

@media (max-width: 460px) {
  .topbar .brand-logo { display: none; }
  .brand-name-zh { font-size: .82rem; }
  .brand-name-en { font-size: .61rem; }
  .filter-panel { grid-template-columns: 1fr; }
  .filter-panel .panel-title, .filter-panel fieldset { grid-column: 1; }
  .stat-strip strong { font-size: 1.2rem; }
  .map-legend b { font-size: .58rem; }
}

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

.role-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 13px 16px;
  color: white;
  background: linear-gradient(100deg, #073c4a, #126976);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(5, 56, 67, .13);
}
.role-banner > div:first-child { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 10px; }
.role-banner span { color: #a9d4d9; font-size: .72rem; }
.role-banner strong { font-size: .9rem; }
.role-banner small { grid-column: 1 / -1; color: #b8d7da; font-size: .7rem; }
.permission-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.permission-chips span { padding: 4px 8px; color: white; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; }

.data-card, .form-card, .consent-card, .permission-overview article, .help-content {
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.data-card { overflow: hidden; }
.table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}
.table-tools h2 { margin: 0 auto 0 0; font-size: 1rem; }
.table-tools > label:not(.search-field) { width: 145px; }
.table-tools select { min-height: 39px; font-size: .76rem; }
.search-field { position: relative; flex: 1 1 360px; max-width: 520px; }
.search-field span { position: absolute; left: 12px; top: 8px; color: #789097; font-size: 1.05rem; }
.search-field input { padding-left: 34px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid #e5edef; text-align: left; vertical-align: middle; }
th { color: #70868b; background: #f7fafb; font-size: .7rem; letter-spacing: .03em; white-space: nowrap; }
td { color: #36545a; font-size: .76rem; }
tbody tr:hover { background: #f7fbfb; }
.record-id { color: #0b6e76; font-weight: 800; white-space: nowrap; }
.record-title { display: grid; gap: 1px; }
.record-title strong { color: #29484f; font-size: .79rem; }
.record-title small, .user-cell small { color: #829499; font-size: .68rem; }
.record-evidence { display: grid; gap: 4px; margin-top: 14px; padding: 12px 14px; color: #557177; background: #f1f8f7; border: 1px solid #d6e9e6; border-radius: 10px; font-size: .74rem; }
.record-evidence strong { color: #0d626b; }
.record-evidence a { width: max-content; color: #087f89; font-weight: 750; }
.inventory-note { margin: 0; padding: 9px 11px; color: #335d65; background: rgba(239,249,247,.98); border: 1px solid rgba(174,218,211,.9); border-radius: 9px; font-size: .67rem; line-height: 1.45; }
.category-tag, .status-tag { display: inline-flex; align-items: center; gap: 5px; width: max-content; padding: 4px 8px; border-radius: 999px; font-size: .68rem; font-weight: 750; white-space: nowrap; }
.category-tag.engineering { color: #a15416; background: #fff1df; }
.category-tag.survey { color: #08746c; background: #ddf4ef; }
.category-tag.military { color: #744e22; background: #efe7dc; }
.category-tag.shipping { color: #3f5d9c; background: #e8eefb; }
.status-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-tag.published { color: #1b8268; background: #e3f4ed; }
.status-tag.review { color: #b07818; background: #fff4d8; }
.status-tag.draft { color: #5b7180; background: #ecf1f3; }
.status-tag.returned { color: #b54851; background: #fce9eb; }
.align-right { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-button { min-width: 34px; padding: 5px 8px; border: 1px solid #d5e1e3; border-radius: 6px; color: #30616a; background: white; font-size: .68rem; font-weight: 700; }
.row-button:hover { background: #eaf6f5; }
.row-button.danger { color: #b34e56; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; color: #73888d; font-size: .72rem; }
.table-footer > div { display: flex; align-items: center; gap: 9px; }
.page-button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: #536f75; background: white; font-size: .7rem; }
.page-button:disabled { opacity: .45; cursor: default; }
.button.danger { color: white; background: #bf4d55; }

.step-badge { padding: 7px 10px; color: #0e7b7e; background: #dff4f0; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.upload-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 17px; align-items: start; }
.form-card, .consent-card { padding: 21px; }
.consent-card { position: sticky; top: 0; }
.section-number { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.section-number.compact { margin-top: 24px; }
.section-number > span { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; color: #097379; background: #ddf3f0; font-size: .74rem; font-weight: 850; }
.section-number div { display: grid; }
.section-number strong { color: #294a51; font-size: .9rem; }
.section-number small { color: #819499; font-size: .68rem; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid label { display: grid; gap: 6px; color: #4a686e; font-size: .76rem; font-weight: 700; }
.span-two { grid-column: 1 / -1; }
.drop-zone { position: relative; display: grid; place-items: center; min-height: 150px; padding: 20px; border: 1.5px dashed #a9c8ca; border-radius: 11px; color: #48686e; background: #f6fbfb; text-align: center; cursor: pointer; }
.drop-zone.dragging { border-color: #178f91; background: #e9f8f5; }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone strong, .drop-zone small { display: block; }
.drop-zone small { color: #82969b; font-size: .7rem; }
.upload-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 4px; border-radius: 50%; color: white; background: #168f91; font-size: 1.15rem; }
.text-link { margin-top: 8px; padding: 4px 0; border: 0; color: #0b7c80; background: transparent; font-size: .74rem; font-weight: 750; }
.consent-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid #e4edef; cursor: pointer; }
.consent-row input { flex: 0 0 auto; width: 17px; min-height: 17px; margin-top: 2px; accent-color: var(--teal); }
.consent-row span { display: grid; gap: 2px; }
.consent-row strong { color: #33575e; font-size: .78rem; }
.consent-row small { color: #758a8f; font-size: .69rem; line-height: 1.55; }
.consent-note { margin: 16px 0; padding: 11px; border-radius: 9px; color: #537178; background: #edf6f6; font-size: .71rem; }
.form-actions, .dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

.permission-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 17px; }
.permission-overview.three { grid-template-columns: repeat(3, 1fr); }
.permission-overview.four { grid-template-columns: repeat(4, 1fr); }
.permission-overview article { padding: 19px; }
.permission-overview article > div:first-child { display: flex; align-items: center; justify-content: space-between; }
.permission-icon { display: grid; place-items: center; width: 33px; height: 33px; color: white; background: #168f91; border-radius: 9px; font-size: .75rem; font-weight: 850; }
.role-code { color: #8da0a4; font-size: .65rem; letter-spacing: .12em; }
.permission-overview h2 { margin: 13px 0 4px; color: #284a51; font-size: 1rem; }
.permission-overview p { min-height: 43px; margin: 0 0 11px; color: #71868b; font-size: .74rem; }
.permission-overview article > div:last-child { display: flex; gap: 5px; flex-wrap: wrap; }
.permission-overview article > div:last-child span { padding: 4px 7px; border-radius: 6px; color: #3c7479; background: #e9f5f4; font-size: .66rem; }
.user-cell { display: grid; }
.user-cell strong { color: #34545a; }

.governance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 17px; }
.governance-grid[hidden] { display: none; }
.mini-form { display: grid; gap: 13px; padding-bottom: 16px; overflow: visible; }
.mini-form .table-tools { margin: -1px -1px 0; }
.mini-form > label { display: grid; gap: 6px; margin: 0 16px; color: #4a686e; font-size: .76rem; font-weight: 700; }
.mini-form .form-actions { margin: 0 16px; }
.mini-form textarea { resize: vertical; }
.organisation-contact { display: grid; gap: 10px; margin: 0 16px; padding: 12px; border: 1px solid #cfe1e3; border-radius: 10px; background: #f4faf9; }
.organisation-contact[hidden] { display: none; }
.organisation-contact > div:first-child { display: flex; align-items: center; gap: 9px; }
.organisation-contact > div:first-child > div { display: grid; gap: 2px; }
.organisation-contact strong { color: #31585f; font-size: .78rem; }
.organisation-contact small { color: #71888e; font-size: .68rem; }
.organisation-admin-list { display: grid; gap: 7px; }
.organisation-admin { display: grid; gap: 2px; padding: 9px 10px; border-radius: 8px; background: white; }
.organisation-admin a { color: #0c7078; font-size: .72rem; overflow-wrap: anywhere; }
.request-status { display: inline-flex; width: fit-content; margin-top: 3px; padding: 3px 7px; border-radius: 999px; color: #526c72; background: #e8f0f1; font-size: .63rem; font-weight: 800; }
.request-status.pending { color: #875c08; background: #fff2cf; }
.request-status.approved { color: #176545; background: #dff3e9; }
.request-status.rejected { color: #963c43; background: #f8e2e4; }
.request-list { display: grid; gap: 10px; padding: 15px; }
.request-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfd; }
.request-item > div:first-child { display: grid; gap: 2px; }
.request-item strong { color: #31545c; font-size: .8rem; }
.request-item small { color: #71888e; font-size: .69rem; }
.empty-state { margin: 8px; color: #74898e; font-size: .76rem; text-align: center; }

.help-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 17px; align-items: start; }
.help-nav { position: sticky; top: 0; display: grid; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 8px 24px rgba(19,55,64,.06); }
.help-nav a { padding: 9px 10px; border-radius: 7px; color: #58747a; text-decoration: none; font-size: .76rem; font-weight: 700; }
.help-nav a:hover { color: #0b7177; background: #e8f5f3; }
.help-content { padding: 6px 28px; }
.help-content section { position: relative; padding: 24px 0 26px 52px; scroll-margin-top: 16px; }
.help-content section + section { border-top: 1px solid var(--line); }
.help-index { position: absolute; left: 0; top: 27px; color: #1a9a99; font-size: .72rem; font-weight: 900; letter-spacing: .08em; }
.help-content h2 { margin: 0 0 9px; color: #284a52; font-size: 1.08rem; }
.help-content p { margin: 8px 0; color: #5b747a; font-size: .82rem; line-height: 1.8; }
.help-content details { margin-top: 9px; border: 1px solid var(--line); border-radius: 9px; background: #fafcfc; }
.help-content summary { padding: 11px 13px; color: #365b62; cursor: pointer; font-size: .78rem; font-weight: 750; }
.help-content details p { padding: 0 13px 11px; margin: 0; font-size: .76rem; }
.info-callout { display: grid; gap: 2px; margin-top: 14px; padding: 12px 14px; border-left: 4px solid #21a2a0; border-radius: 0 8px 8px 0; background: #edf7f6; }
.info-callout strong { font-size: .77rem; }
.info-callout span { color: #617a80; font-size: .72rem; }
.contact-line { color: #0b7379 !important; font-weight: 700; }
.site-footer { display: flex; justify-content: space-between; max-width: 1540px; margin: 22px auto 0; color: #809399; font-size: .68rem; }

dialog { padding: 0; border: 0; color: var(--ink); background: transparent; }
dialog::backdrop { background: rgba(4, 30, 37, .58); backdrop-filter: blur(3px); }
.record-dialog { width: min(680px, calc(100vw - 28px)); }
.record-dialog form, .confirm-dialog form { padding: 23px; border-radius: 15px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.dialog-controls { display: flex; align-items: center; gap: 8px; }
.auth-locale { border-color: #cadbdd; background: #edf5f5; }
.auth-locale button { color: #698087; }
.auth-locale button.active { color: white; background: #157f84; }
.dialog-head h2, .confirm-dialog h2 { margin: 0; color: #244850; font-size: 1.18rem; }
.dialog-close { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #587177; background: #edf3f4; font-size: 1.3rem; }
.dialog-actions { margin-top: 21px; }
.confirm-dialog { width: min(390px, calc(100vw - 28px)); text-align: center; }
.confirm-dialog p { color: #6d8388; font-size: .78rem; }
.warning-mark { display: grid; place-items: center; width: 45px; height: 45px; margin: 0 auto 12px; border-radius: 50%; color: white; background: #c34e57; font-size: 1.2rem; font-weight: 900; }
.confirm-dialog .dialog-actions { justify-content: center; }
.compact-dialog { width: min(470px, calc(100vw - 28px)); }
.auth-dialog { width: min(490px, calc(100vw - 28px)); }
.auth-shell { padding: 24px; border-radius: 16px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.26); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 18px; padding: 4px; border-radius: 10px; background: #edf4f4; }
.auth-tabs button { padding: 8px; border: 0; border-radius: 7px; color: #648087; background: transparent; font-size: .78rem; font-weight: 800; }
.auth-tabs button.active { color: #075c66; background: white; box-shadow: 0 3px 10px rgba(13,63,72,.1); }
.auth-view { display: none; gap: 14px; }
.auth-view.active { display: grid; }
.auth-view > label { display: grid; gap: 6px; color: #45656d; font-size: .76rem; font-weight: 750; }
.auth-view input, .mini-form input, .mini-form select, .mini-form textarea { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid #cbdadd; border-radius: 8px; color: #26474e; background: white; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.text-button { padding: 5px 0; border: 0; color: #0d7a80; background: transparent; font-size: .74rem; font-weight: 750; }
.auth-divider { display: flex; align-items: center; gap: 11px; color: #87999d; font-size: .68rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #dce6e8; }
.consent-inline { display: flex !important; grid-template-columns: auto 1fr; align-items: flex-start; gap: 8px !important; color: #687f84 !important; font-size: .69rem !important; font-weight: 600 !important; line-height: 1.55; }
.consent-inline input { width: 16px; min-height: 16px; margin-top: 2px; accent-color: var(--teal); }
.google-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; border: 1px solid #cbd9dc; border-radius: 9px; color: #334f56; background: white; font-size: .78rem; font-weight: 750; }
.google-button:hover { background: #f6fafa; }
.google-button span { display: grid; place-items: center; width: 24px; height: 24px; color: #4285f4; font-size: 1rem; font-weight: 900; }
.google-button:disabled { opacity: .55; cursor: not-allowed; }
.auth-message { min-height: 20px; margin: 14px 0 0; color: #b64c55; font-size: .72rem; text-align: center; }
.auth-message.success { color: #16765f; }
.auth-note { margin: 0; color: #6b8187; font-size: .74rem; line-height: 1.65; }
.account-summary { display: flex; align-items: center; gap: 13px; padding: 14px; border-radius: 11px; background: #edf7f6; }
.account-summary .avatar.large { width: 48px; height: 48px; }
.account-summary > div { display: grid; gap: 3px; }
.account-summary small { color: #6e858a; font-size: .7rem; }
.account-summary .status-tag { margin-top: 3px; }

@media (max-width: 980px) {
  .upload-grid { grid-template-columns: 1fr; }
  .consent-card { position: static; }
  .permission-overview.three { grid-template-columns: 1fr; }
  .permission-overview.four { grid-template-columns: 1fr 1fr; }
  .governance-grid { grid-template-columns: 1fr; }
  .help-layout { grid-template-columns: 1fr; }
  .help-nav { position: static; display: flex; overflow-x: auto; }
  .help-nav a { white-space: nowrap; }
}

@media (max-width: 720px) {
  .table-tools { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; max-width: none; }
  .table-tools > label:not(.search-field) { flex: 1; width: auto; min-width: 135px; }
  .role-banner { align-items: flex-start; }
  .permission-overview { grid-template-columns: 1fr; }
  .permission-overview.four { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .span-two { grid-column: 1; }
  .help-content { padding: 3px 18px; }
  .help-content section { padding-left: 0; padding-top: 48px; }
  .help-index { top: 20px; }
  .site-footer { display: grid; gap: 3px; }
}

@media (max-width: 480px) {
  .role-banner { display: grid; }
  .permission-chips { justify-content: flex-start; }
  .form-card, .consent-card { padding: 16px; }
  .table-tools .button { width: 100%; }
  .record-dialog form, .confirm-dialog form { padding: 18px; }
}

/* Map-first home */
body.map-home { overflow: hidden; background: #062f3b; }
body.map-home .app-shell { display: block; min-height: 100vh; }
body.map-home .topbar,
body.map-home .sidebar,
body.map-home .site-footer { display: none; }
body.map-home .workspace { width: 100%; height: 100vh; padding: 0; overflow: hidden; }
body.map-home .map-home-view.active {
  display: grid;
  grid-template-columns: clamp(370px, 28vw, 440px) minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  max-width: none;
}

.map-primary { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; height: 100vh; padding: 14px 14px 14px 0; overflow: hidden; background: #dbe9ea; }
.map-card-primary { height: calc(100vh - 28px); border-radius: 0 18px 18px 0; border-left: 0; box-shadow: 0 18px 48px rgba(5, 36, 43, .22); }
.map-card-primary #map { height: 100%; min-height: 520px; }
.map-title-reset { display: flex; align-items: center; gap: 12px; padding: 4px 6px; color: inherit; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.map-title-reset:hover { background: rgba(117,229,215,.1); }
.map-title-reset:focus-visible { outline: 3px solid rgba(29,173,173,.28); outline-offset: 1px; }
.map-title-reset .brand-logo { width: 42px; height: 42px; }
.map-brand-copy { gap: 2px; }

.map-control-rail {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100vh;
  padding: 16px 18px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  color: white;
  background:
    radial-gradient(circle at 12% 4%, rgba(47, 183, 176, .3), transparent 31%),
    linear-gradient(165deg, #073d4b 0%, #062f3b 54%, #052832 100%);
  border-right: 1px solid rgba(255,255,255,.11);
  scrollbar-width: thin;
  scrollbar-color: rgba(118,234,220,.38) transparent;
}
.map-control-rail > * { flex-shrink: 0; }
.map-control-rail::-webkit-scrollbar { width: 7px; }
.map-control-rail::-webkit-scrollbar-track { background: transparent; }
.map-control-rail::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: rgba(118,234,220,.42); background-clip: padding-box; }
.map-control-rail::-webkit-scrollbar-thumb:hover { background: rgba(118,234,220,.68); background-clip: padding-box; }

.rail-brand { padding: 0 1px 9px; border-bottom: 1px solid rgba(255,255,255,.12); }
.rail-brand h1 { margin: 0; }
.rail-brand .map-title-reset { width: 100%; padding: 6px 7px; }

.rail-utility-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.rail-utility { min-width: 0; min-height: 56px; margin: 0; padding: 7px 6px; color: #def3f1; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(255,255,255,.065); }
.rail-utility.nav-item { justify-content: center; gap: 7px; color: #def3f1; text-align: center; font-size: .69rem; }
.rail-utility.nav-item:hover, .rail-account:hover { background: rgba(111,226,211,.13); }
.rail-utility.nav-item span { width: 23px; height: 23px; flex: 0 0 23px; color: #8ce3d8; background: rgba(117,229,215,.12); }
.rail-language { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 5px; }
.rail-language > strong { font-size: .67rem; }
.rail-language .language-switch { min-width: 0; padding: 2px; }
.rail-language .language-switch button { min-width: 27px; padding-inline: 4px; }
.rail-account { display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.rail-account .avatar { width: 25px; height: 25px; flex: 0 0 25px; font-size: .68rem; }
.rail-account .utility-fixed-label { color: #def3f1; font-size: .69rem; }
.rail-account .profile-copy { display: none; }

.rail-panel-suite {
  overflow: hidden;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  background: #f8fbfb;
  box-shadow: 0 12px 30px rgba(0,20,28,.16);
}
.rail-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 5px; background: #e7eff0; border-bottom: 1px solid #d8e4e5; }
.rail-tab { min-width: 0; padding: 8px 4px; color: #657c81; border: 0; border-radius: 8px; background: transparent; font-size: .68rem; font-weight: 750; white-space: nowrap; transition: color .16s ease, background .16s ease, box-shadow .16s ease; }
.rail-tab:hover { color: #0a6e75; background: rgba(255,255,255,.58); }
.rail-tab.active { color: #075d66; background: white; box-shadow: 0 2px 8px rgba(13,67,76,.12); }
.rail-tab-panel[hidden] { display: none; }
.rail-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 51px; padding: 10px 14px; border-bottom: 1px solid #e1eaeb; background: white; }
.rail-panel-heading > div { display: grid; gap: 1px; }
.rail-panel-heading strong { color: #244b53; font-size: .78rem; }
.rail-panel-heading small { color: #8ba0a4; font-size: .55rem; font-weight: 700; letter-spacing: .11em; }
.rail-panel-heading .text-button { flex: 0 0 auto; font-size: .64rem; }
.rail-panel-body { display: grid; gap: 10px; padding: 12px 14px 14px; }
.rail-panel-body label.rail-field,
.rail-date-grid label { display: grid; gap: 5px; color: #58747a; font-size: .68rem; font-weight: 700; }
.rail-date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rail-panel-body input,
.rail-panel-body select { min-height: 36px; padding: 6px 8px; font-size: .72rem; }
.rail-panel-note { margin: -1px 0 0; color: #71888d; font-size: .6rem; line-height: 1.45; }
.rail-panel-body .button { min-height: 36px; padding-block: 6px; font-size: .73rem; }
.rail-filter-action-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.rail-filter-action-row .rail-field { min-width: 0; }
.rail-filter-action-row .button { min-width: 96px; white-space: nowrap; }
.basemap-settings { display: grid; gap: 6px; }
.basemap-settings > span { color: #58747a; font-size: .68rem; font-weight: 750; }
.basemap-settings .segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 3px; }
.basemap-settings .segmented button { min-width: 0; padding: 7px 5px; font-size: .66rem; }
.period-mode-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; padding: 3px; border-radius: 8px; background: #e9f0f1; }
.period-mode-tabs button { min-width: 0; padding: 6px 2px; color: #687f84; border: 0; border-radius: 6px; background: transparent; font-size: .63rem; font-weight: 750; white-space: nowrap; }
.period-mode-tabs button.active { color: #07666d; background: white; box-shadow: 0 1px 5px rgba(15,67,76,.12); }
.period-control[hidden] { display: none; }
.rail-period-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.setting-groups { gap: 9px; }
.setting-section { overflow: hidden; border: 1px solid #dce7e8; border-radius: 10px; background: white; }
.setting-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: #f1f6f6; border-bottom: 1px solid #e1eaeb; }
.setting-section-heading strong { color: #345b62; font-size: .68rem; }
.setting-section-heading small { color: #82979b; font-size: .56rem; font-weight: 650; white-space: nowrap; }
.layer-toggle { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 43px; margin: 0; padding: 7px 10px; color: #365860; border-bottom: 1px solid #edf2f2; cursor: pointer; }
.layer-toggle:last-child { border-bottom: 0; }
.layer-toggle:has(.layer-symbol) { grid-template-columns: 14px minmax(0, 1fr) auto; }
.layer-toggle:hover { background: #f7fbfb; }
.layer-toggle-copy { display: grid; gap: 1px; min-width: 0; }
.layer-toggle-copy strong { overflow: hidden; color: #365860; font-size: .66rem; line-height: 1.35; text-overflow: ellipsis; }
.layer-toggle-copy small { color: #84979b; font-size: .55rem; font-weight: 600; line-height: 1.35; }
.layer-toggle > input { position: absolute; width: 1px; min-height: 1px; opacity: 0; pointer-events: none; }
.layer-toggle > i { position: relative; width: 30px; height: 18px; border-radius: 999px; background: #c6d3d5; box-shadow: inset 0 0 0 1px rgba(63,91,97,.09); transition: background .18s ease; }
.layer-toggle > i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(18,52,59,.28); transition: transform .18s ease; }
.layer-toggle > input:checked + i { background: #168f91; }
.layer-toggle > input:checked + i::after { transform: translateX(12px); }
.layer-toggle > input:focus-visible + i { outline: 3px solid rgba(29,173,173,.25); outline-offset: 2px; }
.layer-symbol { width: 11px; height: 11px; border-radius: 3px; }
.grid-symbol { border: .8px solid #637784; background: repeating-linear-gradient(90deg, rgba(99,119,132,.16) 0 2px, transparent 2px 4px); }
.graticule-symbol { background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(20,121,133,.9) 3px 4px), repeating-linear-gradient(90deg, transparent 0 3px, rgba(20,121,133,.9) 3px 4px); }
.coordinate-format-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; align-items: center; gap: 8px; min-height: 43px; padding: 7px 10px; color: #365860; font-size: .66rem; font-weight: 750; }
.coordinate-format-row select { min-height: 31px; padding-block: 4px; }

.layer-search { position: relative; display: block; }
.layer-search > span { position: absolute; top: 50%; left: 10px; color: #789095; font-size: .9rem; transform: translateY(-50%); pointer-events: none; }
.layer-search input { padding-left: 29px; background: white; }
.conservation-picker { min-width: 0; }
.conservation-options { display: grid; max-height: 238px; overflow-y: auto; }
.conservation-option > .layer-symbol { border: 1.15px solid var(--layer-color); background: color-mix(in srgb, var(--layer-color) 10%, transparent); }
.conservation-option[hidden] { display: none; }
.conservation-option input:disabled ~ * { opacity: .55; }
.conservation-option.loading .layer-toggle-copy strong::after { content: " …"; color: #118584; }
.conservation-note { margin: 0; color: #6c8388; font-size: .57rem; line-height: 1.45; }

.rail-feature-section { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rail-feature-card { min-width: 0; overflow: hidden; color: var(--ink); border: 1px solid rgba(255,255,255,.18); border-radius: 11px; background: rgba(255,255,255,.97); box-shadow: 0 8px 22px rgba(0,20,28,.11); }
.data-overview-card { grid-column: 1 / -1; }
.rail-feature-heading { display: flex; justify-content: space-between; min-height: 38px; padding: 8px 11px; color: #24515a; border-radius: 0; border-bottom: 1px solid #e2ebec; font-size: .72rem; }
.rail-feature-heading:hover { background: #f0f7f6; }
.rail-feature-heading > span { width: auto; height: auto; color: #168f91; background: transparent; font-size: 1.05rem; }
.rail-metrics { display: grid; grid-template-columns: repeat(3, 1fr); }
.rail-metrics div { min-width: 0; padding: 7px 9px; border-right: 1px solid #e7eeee; border-bottom: 1px solid #e7eeee; }
.rail-metrics div:nth-child(3n) { border-right: 0; }
.rail-metrics div:nth-last-child(-n+3) { border-bottom: 0; }
.rail-metrics span { display: block; overflow: hidden; color: #768b90; font-size: .55rem; white-space: nowrap; text-overflow: ellipsis; }
.rail-metrics strong { display: block; margin-top: 1px; color: #08656d; font-size: .92rem; line-height: 1.2; }
.upload-feature-card { padding: 9px 10px; }
.rail-feature-title { display: block; margin-bottom: 7px; color: #315860; font-size: .7rem; }
.rail-feature-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.rail-feature-actions .nav-item { justify-content: center; min-height: 30px; padding: 5px 7px; color: #087078; border: 1px solid #cfe2e3; border-radius: 7px; background: #eef7f6; font-size: .63rem; text-align: center; }
.rail-feature-actions .nav-item:hover { background: #dff2ef; }
.permission-feature { display: flex; flex-wrap: wrap; align-content: center; gap: 4px; padding: 9px 10px; color: #315860; border-radius: 11px; }
.permission-feature > strong { flex-basis: 100%; font-size: .7rem; }
.permission-feature > span { width: auto; height: auto; padding: 2px 5px; color: #51747a; border-radius: 5px; background: #edf4f4; font-size: .52rem; }
.simple-feature { justify-content: space-between; min-height: 39px; padding: 8px 10px; color: #315860; border-radius: 11px; font-size: .68rem; }
.simple-feature > span { width: auto; height: auto; color: #168f91; background: transparent; font-size: 1rem; }
.rail-feature-card.nav-item:hover { background: #eff7f6; }
.rail-copyright { margin-top: auto; padding-top: 2px; color: #86aeb2; font-size: .68rem; letter-spacing: .08em; }

html[lang="zh-Hant"] .kicker,
html[lang="zh-Hant"] .role-code { display: none; }

@media (max-width: 1180px) and (min-width: 901px) {
  body.map-home .map-home-view.active { grid-template-columns: 350px minmax(0, 1fr); }
  .map-control-rail { padding-inline: 14px; }
}

@media (min-width: 901px) and (max-height: 900px) {
  .map-control-rail { gap: 8px; padding: 10px 14px 8px; }
  .rail-brand { padding-bottom: 5px; }
  .rail-brand .map-title-reset { padding-block: 3px; }
  .map-title-reset .brand-logo { width: 36px; height: 36px; }
  .rail-utility { min-height: 48px; padding-block: 5px; }
  .rail-tabs { padding: 4px; }
  .rail-tab { padding-block: 6px; }
  .rail-panel-heading { min-height: 40px; padding: 7px 12px; }
  .rail-panel-body { gap: 7px; padding: 8px 12px 10px; }
  .period-mode-tabs button { padding-block: 4px; }
  .rail-panel-body input,
  .rail-panel-body select,
  .rail-panel-body .button { min-height: 32px; }
  .rail-feature-section { gap: 6px; }
  .rail-feature-heading { min-height: 32px; padding: 5px 9px; }
  .rail-metrics div { padding: 4px 7px; }
  .rail-metrics strong { font-size: .82rem; }
  .upload-feature-card,
  .permission-feature { padding: 6px 8px; }
  .rail-feature-title { margin-bottom: 4px; }
  .simple-feature { min-height: 34px; padding: 6px 8px; }
  .rail-copyright { font-size: .6rem; }
}

@media (max-width: 900px) {
  body.map-home { overflow: auto; }
  body.map-home .workspace { height: auto; min-height: 100vh; overflow: visible; }
  body.map-home .map-home-view.active { grid-template-columns: 1fr; grid-template-rows: minmax(580px, 70vh) auto; height: auto; min-height: 100vh; }
  .map-primary { grid-column: 1; grid-row: 1; height: max(580px, 70vh); padding: 8px; }
  .map-card-primary { height: calc(max(580px, 70vh) - 16px); border: 1px solid var(--line); border-radius: 15px; }
  .map-card-primary #map { height: 100%; min-height: 500px; }
  .map-control-rail { grid-column: 1; grid-row: 2; height: auto; min-height: 0; padding: 20px; overflow: visible; border-right: 0; border-top: 1px solid rgba(255,255,255,.12); }
  .rail-copyright { margin-top: 12px; }
}

@media (max-width: 620px) {
  body.map-home .map-home-view.active { grid-template-rows: minmax(560px, 72svh) auto; }
  .map-primary { height: max(560px, 72svh); }
  .map-card-primary { height: calc(max(560px, 72svh) - 16px); }
  .map-card-primary #map { height: 100%; min-height: 490px; }
  .map-overlay-stack { right: 8px; left: 8px; }
  .map-info-panel { width: calc(100% - 48px); max-height: min(48vh, 330px); }
  .map-info-panel.collapsed { width: min(250px, calc(100% - 48px)); }
  .map-info-row { gap: 5px 7px; padding: 5px 8px; }
  .map-info-label { flex-basis: 100%; }
  .map-days-row { grid-template-columns: 1fr; }
  .map-days-scale { padding: 0 8px 7px; }
  .map-readout-row { display: flex; flex-wrap: wrap; }
  .coordinate-readout { flex: 0 1 auto; }
  .depth-readout { flex: 0 1 auto; }
  .coordinate-readout, .depth-readout { font-size: .58rem; }
  .map-card-primary:has(.bathymetry-credit:not([hidden])) .map-overlay-stack { bottom: 82px; }
  .basemap-name-badge { right: 10px; bottom: 142px; }
  .bathymetry-credit { bottom: 20px; max-width: calc(100% - 36px); font-size: .52rem; }
  .map-card-primary.google-active .bathymetry-credit { bottom: 45px; }
  .rail-date-grid { grid-template-columns: 1fr; }
  .rail-period-pair { grid-template-columns: 1fr; }
  .rail-filter-action-row { grid-template-columns: 1fr; }
}
