:root {
  --bg: #f3f5f8;
  --bg-soft: #f7f8fc;
  --panel: #ffffff;
  --panel-soft: rgba(255, 255, 255, 0.94);
  --text: #18212f;
  --muted: #627084;
  --line: rgba(24, 33, 47, 0.1);
  --primary: #5b21b6;
  --primary-strong: #4c1d95;
  --primary-soft: rgba(91, 33, 182, 0.08);
  --success: #0f766e;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 10px 26px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 24px 60px rgba(17, 24, 39, 0.12);
  --shadow-lg: 0 34px 80px rgba(15, 23, 42, 0.18);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --max-width: none;
  --sidebar-width: 320px;
  --topbar-h: 72px;
  --map-height: 68vh;
  --map-footer-h: 118px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at top left, rgba(124, 58, 237, 0.08), transparent 22%), linear-gradient(180deg, #f5f3ff 0%, #f8fafc 24%, #f4f7fb 100%);
  color: var(--text);
}
body { min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.app-shell { width: 100%; max-width: var(--max-width); margin: 0; padding: 0 20px 28px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 20px;
  margin: 0 -20px 22px;
  background: linear-gradient(90deg, #4b166f 0%, #6e2aa8 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(76, 29, 149, 0.16);
}
.brand { display: inline-flex; align-items: center; min-width: 0; flex: 0 0 auto; text-decoration: none; }
.brand-logo { display: block; height: 42px; max-height: 42px; width: auto; max-width: min(320px, 32vw); object-fit: contain; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.topnav a { color: rgba(255, 255, 255, 0.92); text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 10px 14px; border-radius: 12px; transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease; }
.topnav a:hover, .topnav a.is-active { background: rgba(255, 255, 255, 0.12); color: #ffffff; }
.topnav a:active { transform: translateY(1px); }
.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; }

.page { display: grid; gap: 22px; }
.auth-page { min-height: calc(100vh - var(--topbar-h) - 72px); align-items: center; }
.auth-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.74fr);
  gap: 24px;
  align-items: stretch;
}
.auth-copy,
.auth-card,
.admin-card {
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}
.auth-copy {
  min-height: 460px;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(91, 33, 182, 0.92), rgba(15, 118, 110, 0.8)),
    radial-gradient(circle at 78% 20%, rgba(255,255,255,.16), transparent 28%);
  color: #fff;
  overflow: hidden;
}
.auth-copy .eyebrow { color: #c4f4e7; }
.auth-copy h1 { margin: 12px 0 18px; font-size: clamp(2rem, 4.4vw, 4.1rem); line-height: 1.03; letter-spacing: 0; max-width: 660px; }
.auth-copy p { margin: 0; max-width: 640px; color: rgba(255,255,255,.84); font-size: 1.05rem; line-height: 1.7; }
.auth-card {
  padding: 28px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 8px; color: var(--muted); font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; }
.auth-form input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.auth-alert {
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.09);
  color: #991b1b;
  font-weight: 700;
}
.auth-setup-box { display: grid; gap: 12px; margin-bottom: 18px; }
.auth-setup-box h2 { margin: 0; font-size: 1.35rem; }
.auth-setup-box p { margin: 0; color: var(--muted); line-height: 1.55; }
.secret-box,
.recovery-grid code {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(91, 33, 182, 0.08);
}
.secret-box span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.secret-box strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.auth-setup-box details { color: var(--muted); }
.auth-setup-box details code { display: block; margin-top: 8px; white-space: normal; word-break: break-all; color: var(--text); }
.recovery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.recovery-grid code { font-weight: 800; color: var(--primary-strong); }
.auth-wide-button { display: inline-flex; justify-content: center; width: 100%; margin-top: 8px; }
.admin-page { grid-template-columns: minmax(0, 1fr); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-card { padding: 22px; }
.admin-card h2 { margin: 6px 0 8px; }
.admin-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.home-page { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); align-items: stretch; position: relative; }
.station-page { grid-template-columns: minmax(0, 1fr); align-items: start; }
.content-column, .analysis-column, .left-rail { display: grid; gap: 20px; }
.left-rail { position: sticky; top: calc(var(--topbar-h) + 18px); align-self: start; }
.home-map-column { min-width: 0; }

.sidebar-card, .map-panel, .side-summary-card, .control-card, .analysis-header, .quick-period-strip, .quick-trend-panel, .event-panel, .table-card, .alert-card, .support-card, .glossary-card, .empty-state, .modal-panel, .page-hero {
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}
.sidebar-card, .side-summary-card, .control-card, .analysis-header, .quick-period-strip, .quick-trend-panel, .event-panel, .table-card, .alert-card, .support-card, .glossary-card, .empty-state, .modal-panel, .page-hero { padding: 22px; }

.home-sidebar-card,
.map-panel,
.station-drawer {
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,250,255,.94) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.85),
    0 16px 32px rgba(255,255,255,.2),
    var(--shadow-lg);
}

.home-sidebar-card {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  height: calc(var(--map-height) + var(--map-footer-h));
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 18px;
}
.sidebar-section { display: grid; gap: 10px; }
.sidebar-section h3, .sidebar-section label, .control-card h3, .control-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 700;
}
.control-label { display: block; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap input, .filter-select, .control-card select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 12px 42px 12px 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.filter-select, .control-card select { padding-right: 14px; }
.search-wrap input:focus, .filter-select:focus, .control-card select:focus { border-color: rgba(91, 33, 182, 0.35); box-shadow: 0 0 0 4px rgba(91, 33, 182, 0.08); }
.search-wrap .search-icon { position: absolute; right: 14px; font-size: 0; color: var(--muted); pointer-events: none; }
.search-wrap .search-icon::before { content: "\1F50D"; font-size: 0.92rem; }
.sidebar-actions { display: flex; gap: 10px; }
.home-sidebar-card .sidebar-actions { align-items: stretch; }
.home-sidebar-card #reset-filters {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--primary-strong), #6d28d9);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 14px 26px rgba(91, 33, 182, 0.22);
}
.home-sidebar-card #reset-filters:hover {
  background: linear-gradient(145deg, #431787, #7c3aed);
}
.grow { flex: 1; }

.primary-button, .ghost-button, .tab-switch button, .inline-toggle button, .station-drawer__tabs button {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 15px;
  font-weight: 700;
  transition: 0.18s ease;
}
.primary-button {
  background: linear-gradient(145deg, var(--primary), #7c3aed);
  color: #fff;
  box-shadow: 0 14px 32px rgba(91, 33, 182, 0.2);
}
.primary-button:hover { color: #fff; transform: translateY(-1px); }
.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--primary-strong);
}
.ghost-button:hover { background: var(--primary-soft); border-color: rgba(91, 33, 182, 0.16); }
.ghost-button:disabled, .primary-button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.disabled-link { pointer-events: none; opacity: 0.55; }

.map-panel { position: relative; overflow: hidden; padding: 0; display: block; height: calc(var(--map-height) + var(--map-footer-h)); }
#map { width: 100%; min-height: 0; height: 100%; border-radius: var(--radius-xl); }
.map-toolbar { padding: 14px; gap: 10px; align-items: center; }
.map-help {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  width: max-content;
  max-width: min(245px, calc(100% - 92px));
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 10px 24px rgba(76, 29, 149, 0.08);
  color: rgba(24, 33, 47, 0.72);
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: center;
  backdrop-filter: blur(10px);
}
.map-type-card {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 500;
  width: min(250px, calc(100% - 40px));
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 22px 48px rgba(76, 29, 149, 0.12);
  backdrop-filter: blur(16px);
}
.map-type-card h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--primary-strong);
}
.map-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 24px;
  color: var(--muted);
  font-size: 0.92rem;
  pointer-events: none;
}
.legend-inline { display: inline-flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.station-type-list {
  display: grid;
  gap: 10px;
  width: 100%;
}
.station-type-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--primary-strong);
  font-size: 0.85rem;
}
.station-type-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.station-type-row strong {
  font-size: 0.9rem;
  color: var(--primary-strong);
  font-weight: 800;
}
.legend-pin {
  --legend-color: #64748b;
  position: relative;
  width: 15px;
  height: 15px;
  border-radius: 50% 50% 50% 3px;
  display: inline-block;
  background: var(--legend-color);
  transform: rotate(-45deg);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22), inset 0 0 0 2px rgba(255,255,255,.45);
}
.station-type-empty { color: var(--muted); font-size: 0.84rem; }
.map-overview {
  pointer-events: auto;
  width: min(780px, calc(100% - 48px));
  min-height: 66px;
  display: grid;
  grid-template-columns: max-content repeat(3, minmax(104px, 1fr));
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 18px 44px rgba(76, 29, 149, 0.12);
  backdrop-filter: blur(18px);
}
.overview-label {
  padding-right: 18px;
  border-right: 1px solid rgba(91, 33, 182, 0.18);
  color: var(--primary-strong);
  font-size: 0.76rem;
  font-weight: 800;
}
.overview-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  color: var(--primary-strong);
}
.overview-item em {
  grid-row: 1 / 3;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 4px;
  display: inline-block;
  transform: rotate(-45deg);
  background: var(--primary-strong);
  box-shadow: 0 4px 12px rgba(91,33,182,.18), inset 0 0 0 3px rgba(255,255,255,.45);
}
.overview-item strong {
  color: var(--primary-strong);
  font-size: 1.08rem;
  line-height: 1;
  font-weight: 900;
}
.overview-item small {
  display: block;
  color: var(--primary-strong);
  font-size: 0.72rem;
  line-height: 1.1;
}
.overview-active em,
.overview-maintenance em { background: var(--primary-strong); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.active { background: var(--success); }
.dot.maintenance { background: var(--warning); }
.dot.private { background: var(--danger); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { box-shadow: var(--shadow-md); }
.station-marker-wrap {
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
}
.station-marker {
  --station-type: #64748b;
  --station-status: #94a3b8;
  --station-privacy: #ffffff;
  width: 9px;
  height: 9px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 0;
  background: var(--station-type);
  border: 1px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.26), 0 0 0 1px rgba(15, 23, 42, 0.12);
  transform: rotate(-45deg);
  transform-origin: 50% 70%;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.station-marker__status {
  display: none;
}
.station-marker__type {
  display: none;
}
.leaflet-marker-icon:hover .station-marker,
.leaflet-marker-icon:focus .station-marker {
  transform: rotate(-45deg) scale(1.35);
  box-shadow: 0 4px 11px rgba(15, 23, 42, 0.32), 0 0 0 2px rgba(255, 255, 255, 0.82);
}
.station-legend {
  display: grid;
  width: 100%;
  gap: 8px;
  font-size: 0.78rem;
}
.legend-group {
  display: grid;
  grid-template-columns: minmax(165px, max-content) minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
}
.legend-group strong {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  white-space: nowrap;
}
.legend-items {
  display: flex;
  align-items: center;
  gap: 6px 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.legend-dot,
.legend-ring {
  --legend-color: #64748b;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot {
  background: var(--legend-color);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.12);
}
.legend-ring {
  background: var(--legend-color);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16);
}
.legend-ring--outer {
  background: var(--legend-color);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.26), inset 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.station-drawer {
  position: fixed;
  right: 20px;
  top: calc(var(--topbar-h) + 18px);
  width: min(420px, calc(100vw - 40px));
  height: calc(var(--map-height) + var(--map-footer-h) - 10px);
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.22s ease;
  overflow: hidden;
  z-index: 900;
}
.station-drawer.is-open { transform: translateX(0); }
.station-drawer__header, .station-drawer__actions { padding: 20px; }
.station-drawer__header { display: flex; justify-content: space-between; gap: 14px; align-items: start; border-bottom: 1px solid var(--line); }
.station-drawer__header h2 { margin: 4px 0 8px; font-size: 1.4rem; line-height: 1.05; }
.station-drawer__header p { margin: 0; color: var(--muted); }
.station-drawer__close { white-space: nowrap; }
.station-drawer__tabs { display: flex; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.station-drawer__tabs button { background: #fff; border-color: var(--line); color: var(--muted); white-space: nowrap; }
.station-drawer__tabs button.is-active { background: var(--primary); color: #fff; box-shadow: 0 10px 18px rgba(91,33,182,.2); }
.station-drawer__panel { display: none; overflow-y: auto; padding: 18px 20px; }
.station-drawer__panel.is-active { display: block; }
.station-drawer__actions { display: flex; gap: 10px; border-top: 1px solid var(--line); }
.drawer-stack { display: grid; gap: 14px; }
.drawer-card { padding: 16px; border-radius: var(--radius-lg); background: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.72); box-shadow: var(--shadow-sm); }
.drawer-card h3 { margin: 0 0 10px; font-size: 1rem; }
.drawer-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.drawer-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.drawer-kv div { padding: 12px; border-radius: 14px; background: rgba(91,33,182,.06); }
.drawer-kv.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drawer-kv.compact div { padding: 10px 12px; }
.drawer-kv.compact div:last-child { grid-column: 1 / -1; }
.drawer-kv span { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 4px; }
.drawer-kv strong { display: block; font-size: 0.95rem; }
.drawer-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.drawer-metric { padding: 14px; border-radius: 14px; background: rgba(91,33,182,.06); }
.drawer-metric span { display: block; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.drawer-metric strong { display: block; font-size: 1.15rem; }
.drawer-list { margin: 0; padding-left: 18px; color: var(--muted); }
.drawer-list li { margin: 6px 0; }

.side-summary-card h1 { margin: 6px 0 8px; font-size: 2rem; line-height: 1.05; letter-spacing: -0.03em; }
.side-summary-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.16em; font-weight: 800; color: var(--primary); }
.pill-row, .inline-actions, .sidebar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; background: rgba(15, 118, 110, 0.12); color: var(--success); }
.status-pill.maintenance { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.status-pill.private { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.status-pill.warning { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.status-pill.subtle { background: rgba(98, 112, 132, 0.12); color: var(--muted); }
.side-kv { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 18px 0; }
.side-kv div, .report-meta div, .report-kv-grid div { padding: 12px; border-radius: 14px; background: rgba(91, 33, 182, 0.06); }
.side-kv span, .report-meta span, .report-kv-grid span { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }
.side-kv strong, .report-meta strong, .report-kv-grid strong { display: block; font-size: 0.98rem; }
.cta-column { display: grid; gap: 10px; }
.cta-column.compact { margin-top: 16px; }
.inline-toggle { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--line); gap: 4px; margin-bottom: 16px; }
.inline-toggle button, .tab-switch button { background: transparent; color: var(--muted); }
.inline-toggle button.is-active, .tab-switch button.is-active { background: var(--primary); color: #fff; box-shadow: 0 10px 18px rgba(91, 33, 182, 0.2); }
.metric-selector { display: grid; gap: 8px; max-height: 260px; overflow: auto; padding-right: 4px; }
.metric-option { display: flex; align-items: start; gap: 10px; padding: 11px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.86); }
.metric-option input { margin-top: 2px; }
.small-note { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.toggle-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--text); font-weight: 500; }

.analysis-header { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.analysis-header h2 { margin: 4px 0 8px; font-size: 2rem; line-height: 1.06; letter-spacing: -0.03em; }
.analysis-header p { margin: 0; color: var(--muted); }
.station-analysis-header { align-items: stretch; overflow: visible; position: relative; z-index: 80; }
.station-heading { display: grid; gap: 8px; align-content: start; min-width: 260px; }
.station-heading h1 { margin: 0; font-size: clamp(2rem, 3vw, 3rem); line-height: 1.02; letter-spacing: -0.04em; }
.station-heading p { color: var(--muted); line-height: 1.55; }
.station-toolbar { --station-toolbar-control-height: 58px; flex: 1 1 auto; display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.period-control { display: grid; gap: 8px; justify-items: start; margin-left: -25px; }
.period-control[hidden] { display: none; }
.period-control .inline-toggle { margin-bottom: 0; }
.date-range-control { position: relative; z-index: 10000; display: grid; flex: 0 1 clamp(350px, 30vw, 540px); gap: 8px; justify-items: stretch; min-width: 340px; margin-left: auto; }
.date-range-control[hidden] { display: none; }
.date-range-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; height: var(--station-toolbar-control-height); min-height: var(--station-toolbar-control-height); padding: 4px; box-sizing: border-box; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.86); }
.date-field-button { display: grid; align-content: center; gap: 2px; min-width: 0; width: 100%; height: 100%; padding: 8px 14px; box-sizing: border-box; border-radius: 12px; background: transparent; color: var(--muted); text-align: left; white-space: nowrap; }
.date-field-button span { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.date-field-button strong { color: var(--text); font-size: 0.95rem; }
.date-field-button.is-active { background: var(--primary); color: #fff; box-shadow: 0 10px 18px rgba(91, 33, 182, 0.2); }
.date-field-button.is-active strong { color: #fff; }
.date-calendar-popover { position: absolute; z-index: 10001; top: calc(100% + 8px); right: 0; width: 360px; max-width: min(360px, calc(100vw - 28px)); padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, 0.98); box-shadow: var(--shadow-md); }
.date-calendar-popover[hidden] { display: none; }
.date-calendar-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.date-calendar-head strong { font-size: 0.98rem; }
.date-calendar-selects { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(82px, 0.65fr); gap: 8px; flex: 1; }
.date-calendar-selects select { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 800; padding: 0 10px; }
.date-calendar-head button { min-width: 38px; min-height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(91, 33, 182, 0.06); color: var(--primary-strong); font-weight: 900; }
.date-calendar-head button:disabled { opacity: 0.42; cursor: not-allowed; }
.date-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.date-calendar-grid span { padding: 6px 0; color: var(--muted); font-size: 0.68rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.date-day { min-width: 0; min-height: 40px; padding: 0; border-radius: 10px; background: rgba(91, 33, 182, 0.06); color: var(--text); font-weight: 800; }
.date-day.is-empty { visibility: hidden; }
.date-day:disabled { cursor: not-allowed; background: rgba(98, 112, 132, 0.07); color: rgba(98, 112, 132, 0.36); box-shadow: none; }
.date-day:not(:disabled):hover { background: rgba(91, 33, 182, 0.18); color: var(--primary-strong); transform: translateY(-1px); }
.date-day.is-in-range:not(:disabled) { background: rgba(91, 33, 182, 0.12); color: var(--primary-strong); }
.date-day.is-selected:not(:disabled) { background: var(--primary); color: #fff; box-shadow: 0 8px 16px rgba(91, 33, 182, 0.22); }
.date-range-empty { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.download-date-summary { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(91, 33, 182, 0.06); }
.download-date-summary strong { color: var(--text); }
.download-date-summary small { color: var(--muted); }
.tab-switch { display: inline-flex; align-items: stretch; padding: 4px; border-radius: 16px; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--line); gap: 4px; }
.station-toolbar .inline-toggle,
.station-toolbar .tab-switch,
.station-toolbar .ghost-button,
.station-toolbar .fidas-clean-toggle { height: var(--station-toolbar-control-height); min-height: var(--station-toolbar-control-height); box-sizing: border-box; }
.station-toolbar .inline-toggle button,
.station-toolbar .tab-switch button { display: inline-flex; align-items: center; justify-content: center; height: 100%; }
.station-toolbar .ghost-button { display: inline-flex; align-items: center; justify-content: center; }
.station-toolbar .fidas-clean-toggle { display: inline-flex; align-items: center; margin-top: 0; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.86); color: var(--muted); font-weight: 800; }
.station-toolbar .fidas-clean-toggle input { accent-color: var(--primary); }
.tab-panel { display: none; gap: 20px; }
.tab-panel.is-active { display: grid; }
.summary-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.status-summary-grid { display: grid; width: 100%; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.station-page .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quick-period-strip { display: flex; justify-content: space-between; align-items: center; gap: 14px; box-shadow: var(--shadow-sm); }
.quick-period-strip span { color: var(--muted); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.quick-period-strip strong { color: var(--primary-strong); font-size: 1.05rem; }
.metric-card, .summary-grid > article { padding: 18px; background: rgba(255, 255, 255, 0.86); border: 1px solid rgba(255, 255, 255, 0.72); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); display: grid; gap: 8px; }
.metric-card span, .summary-grid > article span { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.metric-card strong, .summary-grid > article strong { font-size: clamp(1.5rem, 2vw, 2.4rem); letter-spacing: -0.03em; }
.metric-card small, .summary-grid > article small { color: var(--muted); line-height: 1.45; }
.metric-card__top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.metric-card__top small { padding: 4px 8px; border-radius: 999px; background: rgba(91, 33, 182, 0.08); color: var(--primary-strong); font-weight: 800; line-height: 1; }
.metric-current { display: grid; gap: 3px; }
.metric-current small { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.metric-current strong { display: block; }
.metric-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.underwater-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-stat-grid div { padding: 10px; border-radius: 12px; background: rgba(91, 33, 182, 0.06); min-width: 0; }
.metric-stat-grid small { display: block; margin-bottom: 3px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.metric-stat-grid b { display: block; overflow-wrap: anywhere; font-size: 0.96rem; }
.advanced-layout { display: grid; grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
.advanced-layout.is-spectra-full { grid-template-columns: minmax(0, 1fr); }
.advanced-layout.is-spectra-full .advanced-left-rail { display: none; }
.advanced-left-rail { align-self: start; }
.advanced-left-rail .control-card { display: grid; gap: 18px; }
.advanced-main { display: grid; gap: 20px; width: 100%; min-width: 0; }
.advanced-subtabs { justify-self: start; }
.advanced-panel { display: grid; gap: 20px; width: 100%; min-width: 0; }
.advanced-panel[hidden] { display: none !important; }
.advanced-controls__grid { display: grid; grid-template-columns: minmax(220px, 0.7fr) minmax(340px, 1.35fr) minmax(240px, 0.75fr); gap: 18px; align-items: start; }
.advanced-control-group { display: grid; gap: 10px; align-content: start; }
.advanced-controls .metric-selector { max-height: 360px; }
.event-panel { display: grid; gap: 18px; grid-template-columns: 1.1fr 0.9fr; }
.event-panel h3, .table-card h3, .section-head h3, .glossary-card h2, .alert-card h2, .support-card h2, .page-hero h1, .page-section-head h2 { margin: 0 0 8px; letter-spacing: -0.02em; }
.page-hero h1, .page-section-head h2 { font-size: clamp(2rem, 3vw, 2.8rem); }
.page-hero.compact-hero { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.page-hero .lead, .page-section-head .lead { margin: 0; color: var(--muted); line-height: 1.6; }
.page-section-head { padding: 0 4px; }
.event-list { display: grid; gap: 10px; }
.event-chip { padding: 12px 14px; border-radius: 16px; background: rgba(91, 33, 182, 0.06); border: 1px solid rgba(91, 33, 182, 0.12); }
.event-chip strong { display: block; margin-bottom: 6px; }
.event-chip small { color: var(--muted); }
.chart-grid { display: grid; gap: 18px; width: 100%; min-width: 0; }
.chart-card { width: 100%; min-width: 0; padding: 16px; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(255, 255, 255, 0.75); box-shadow: var(--shadow-sm); }
.chart-card h3 { margin: 0 0 6px; }
.chart-card header { margin-bottom: 12px; }
.chart-card header p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }
.chart-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; color: var(--muted); font-size: 0.92rem; }
.chart-host { width: 100%; min-height: 320px; }
#advanced-view .chart-host { min-height: 420px; }
.quick-trend-panel { display: grid; gap: 16px; overflow: hidden; }
.quick-trend-panel .section-head { margin-bottom: 0; }
.quick-trend-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.quick-chart-mode { margin-bottom: 0; }
.quick-chart-mode button { min-width: 72px; }
.quick-sensor-toggle[hidden] { display: none !important; }
.quick-sensor-toggle { margin-top: 0; }
.sensor-comparison-grid[hidden] { display: none !important; }
.sensor-comparison-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sensor-comparison-card { display: grid; gap: 10px; min-width: 0; padding: 14px; border-radius: 16px; border: 1px solid rgba(91, 33, 182, 0.14); background: rgba(91, 33, 182, 0.045); color: var(--text); text-align: left; transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease; }
.sensor-comparison-card:hover, .sensor-comparison-card:focus-visible { border-color: rgba(91, 33, 182, 0.34); box-shadow: 0 12px 26px rgba(91, 33, 182, 0.12); transform: translateY(-1px); outline: none; }
.sensor-comparison-card > span { color: var(--muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.sensor-readout-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sensor-readout-row em, .sensor-comparison-card__stats em { font-style: normal; }
.sensor-readout-row em { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.74); border: 1px solid rgba(255, 255, 255, 0.82); }
.sensor-readout-row small, .sensor-comparison-card__stats em { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.sensor-readout-row b { display: block; margin-top: 4px; font-size: 1rem; overflow-wrap: anywhere; }
.sensor-comparison-card__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sensor-comparison-card__stats em { padding: 8px; border-radius: 10px; background: rgba(15, 118, 110, 0.08); }
.sensor-comparison-card__stats b { display: block; margin-top: 3px; color: var(--text); font-size: 0.9rem; letter-spacing: 0; text-transform: none; overflow-wrap: anywhere; }
.quick-trend-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.quick-trend-card { min-width: 0; transition: box-shadow 0.18s ease, border-color 0.18s ease; }
.quick-trend-card.is-focused { border-color: rgba(91, 33, 182, 0.42); box-shadow: 0 0 0 4px rgba(91, 33, 182, 0.08), var(--shadow-sm); }
.quick-trend-host { min-height: 240px; }
.empty-trend { display: grid; min-height: 180px; place-items: center; color: var(--muted); border-radius: 14px; background: rgba(91, 33, 182, 0.04); }
.spectra-chart-host { min-height: 520px; }
.spectra-time-label { color: var(--primary-strong); font-size: 0.9rem; }
.spectra-controls { display: grid; grid-template-columns: minmax(280px, max-content) minmax(260px, 1fr); gap: 16px; align-items: center; padding-top: 8px; }
.spectra-step-buttons { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.spectra-step-buttons button { min-height: 40px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 800; }
.spectra-step-buttons button:hover, .spectra-step-buttons button:focus-visible { border-color: rgba(91, 33, 182, 0.35); color: var(--primary-strong); outline: none; }
.spectra-slider-row { display: grid; gap: 8px; color: var(--muted); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.spectra-slider-row input { width: 100%; accent-color: var(--primary); }
.profile-chart-grid { display: grid; gap: 18px; }
.profile-chart-host { min-height: 430px; }
.table-card { overflow: hidden; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.94rem; vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
tbody tr:hover { background: rgba(91, 33, 182, 0.04); }
.table-meta { color: var(--muted); font-size: .85rem; }
.profile-list { display: grid; gap: 12px; }
.profile-item { padding: 14px; border-radius: 16px; background: rgba(91, 33, 182, 0.05); }
.profile-item strong { display: block; margin-bottom: 6px; }
.profile-item code { display: block; white-space: pre-wrap; color: var(--muted); }
.simple-page { display: grid; gap: 22px; }
.guide-page { display: grid; gap: 22px; }
.guide-steps, .guide-family-grid, .heat-index-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.guide-step, .guide-family-card, .heat-index-section, .glossary-explorer, .metadata-explorer, .guide-split-section {
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}
.guide-step, .guide-family-card { padding: 20px; }
.guide-step span, .guide-family-card span, .heat-index-grid span {
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.guide-step h2, .heat-index-grid h3 { margin: 10px 0 8px; }
.guide-step p, .guide-family-card p, .heat-index-grid p, .glossary-explorer p, .metadata-explorer p, .guide-split-section p {
  color: var(--muted);
  line-height: 1.6;
}
.guide-split-section, .heat-index-section, .glossary-explorer, .metadata-explorer { padding: 24px; display: grid; gap: 18px; }
.guide-family-card strong { display: block; margin: 10px 0 6px; font-size: 2rem; letter-spacing: -0.04em; }
.heat-index-section {
  background:
    linear-gradient(135deg, rgba(91, 33, 182, 0.08), rgba(15, 118, 110, 0.08)),
    var(--panel-soft);
}
.heat-index-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.heat-index-grid article { padding: 18px; border-radius: 18px; background: rgba(255, 255, 255, 0.76); border: 1px solid rgba(255, 255, 255, 0.78); }
.guide-search input {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 13px 15px;
  outline: none;
}
.guide-search input:focus { border-color: rgba(91, 33, 182, 0.35); box-shadow: 0 0 0 4px rgba(91, 33, 182, 0.08); }
.guide-filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.guide-filter-row button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}
.guide-filter-row button.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.guide-glossary-grid article[hidden] { display: none; }
.metadata-family { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: rgba(255, 255, 255, 0.82); }
.metadata-family + .metadata-family { margin-top: 12px; }
.metadata-family summary { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px; cursor: pointer; font-weight: 800; }
.metadata-family summary span { color: var(--muted); font-size: 0.9rem; }
.metadata-term-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 18px 18px; }
.metadata-term-grid article { padding: 14px; border-radius: 14px; background: rgba(91, 33, 182, 0.045); }
.metadata-term-grid span { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 800; }
.metadata-term-grid h3 { margin: 6px 0; font-size: 1rem; }
.metadata-term-grid p { margin: 0 0 8px; color: var(--muted); line-height: 1.5; }
.metadata-term-grid small { font-weight: 800; color: var(--primary-strong); }
.status-group-row th {
  padding-top: 22px;
  background: linear-gradient(90deg, rgba(91, 33, 182, 0.08), rgba(15, 118, 110, 0.05));
  border-bottom: 1px solid rgba(91, 33, 182, 0.12);
}
.status-group-row span {
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.status-group-row strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-strong);
}
.glossary-grid, .support-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.glossary-card, .support-card { padding: 24px; }
.glossary-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.12em; }
.glossary-block h3 { margin-bottom: 8px; }
.glossary-block p, .support-card p, .support-card li, .alert-card p { color: var(--muted); line-height: 1.6; }
.status-table-card .ghost-button { padding: 9px 12px; border-radius: 12px; }
.issue-list { display: grid; gap: 10px; margin-top: 2px; }
.issue-item { padding: 14px 16px; border-radius: 16px; background: rgba(91, 33, 182, 0.06); border: 1px solid rgba(91, 33, 182, 0.12); color: var(--text); }
.issue-item strong { display: block; margin-bottom: 4px; }
.issue-meta { color: var(--muted); font-size: .88rem; }
.empty-state { padding: 34px; text-align: center; }
.mobile-only { display: none; }
.desktop-only { display: grid; }
.hidden { display: none !important; }

.modal-shell { border: 0; border-radius: 24px; padding: 0; width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 40px); background: #fff; box-shadow: 0 40px 80px rgba(15, 23, 42, 0.24); }
.modal-shell::backdrop { background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); }
.modal-panel { display: grid; gap: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.modal-head h2 { margin: 0; }
.modal-head p { margin: 6px 0 0; color: var(--muted); }
.tab-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-row button { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 700; color: var(--muted); }
.tab-row button.is-active { background: var(--primary); color: #fff; }
.metadata-table { border: 1px solid var(--line); border-radius: 18px; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.download-form { display: grid; gap: 16px; }
.download-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.download-grid label { display: grid; gap: 7px; }
.download-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
}
.download-toggle { justify-content: flex-start; margin: 0; }
.download-parameter-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.download-metric-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: min(42vh, 420px); overflow: auto; padding-right: 4px; }
.download-option { display: flex; align-items: start; gap: 10px; padding: 11px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(91, 33, 182, 0.04); }
.download-option input { margin-top: 3px; }
.download-option strong, .download-option small { display: block; }
.download-option small { color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }

@media (max-width: 1320px) {
  .home-page, .station-page { grid-template-columns: 1fr; }
  .desktop-only { display: none; }
  .mobile-only { display: flex; }
  .left-rail, .home-sidebar-card { position: static; height: auto; }
  .map-panel { display: grid; grid-template-rows: auto var(--map-height); height: auto; }
  #map { height: var(--map-height); }
  .map-help { top: 82px; }
  .map-type-card { top: 84px; width: min(210px, calc(100% - 40px)); padding: 14px; }
  .map-type-card h2 { margin-bottom: 10px; font-size: 0.88rem; }
  .station-type-list { gap: 8px; }
  .station-type-row { grid-template-columns: 15px minmax(0, 1fr) auto; gap: 8px; font-size: 0.76rem; }
  .station-type-row strong { font-size: 0.8rem; }
  .legend-pin { width: 12px; height: 12px; }
  .map-overview {
    width: min(640px, calc(100% - 48px));
    min-height: 54px;
    grid-template-columns: max-content repeat(4, minmax(84px, 1fr));
    gap: 12px;
    padding: 9px 14px;
  }
  .overview-label { padding-right: 14px; font-size: 0.7rem; }
  .overview-item { grid-template-columns: 18px minmax(0, 1fr); column-gap: 6px; }
  .overview-item em { width: 14px; height: 14px; }
  .overview-item strong { font-size: 0.94rem; }
  .overview-item small { font-size: 0.64rem; }
  .map-footer { height: auto; min-height: 0; bottom: 18px; }
  .station-drawer {
    position: fixed;
    right: 14px;
    top: calc(var(--topbar-h) + 12px);
    width: min(420px, calc(100vw - 28px));
    height: calc(100vh - var(--topbar-h) - 26px);
  }
  .station-page .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .station-toolbar { justify-content: flex-start; flex-wrap: wrap; }
  .date-range-control { flex-basis: min(350px, 100%); min-width: min(320px, 100%); margin-left: 0; }
  .advanced-layout { grid-template-columns: 1fr; }
  .advanced-left-rail { position: static; }
  .advanced-controls__grid { grid-template-columns: 1fr; }
  .sensor-comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-panel, .page-hero.compact-hero { grid-template-columns: 1fr; }
  .glossary-grid, .support-grid { grid-template-columns: 1fr; }
  .guide-steps, .guide-family-grid, .heat-index-grid, .metadata-term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1320px) and (min-width: 981px) {
  .home-page { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .home-page .desktop-only { display: grid; }
  .home-page .mobile-only { display: none; }
  .home-page .home-sidebar-card {
    position: sticky;
    top: calc(var(--topbar-h) + 18px);
    height: calc(var(--map-height) + var(--map-footer-h));
  }
  .home-page .map-panel {
    display: block;
    height: calc(var(--map-height) + var(--map-footer-h));
  }
  .home-page #map { height: 100%; }
  .home-page .map-help { top: 16px; }
  .home-page .map-type-card { top: 20px; }
}

@media (max-width: 900px) {
  .auth-panel { grid-template-columns: 1fr; }
  .auth-copy { min-height: auto; }
  .topbar { height: 64px; min-height: 64px; padding: 0 14px; margin-inline: -14px; }
  .brand-logo { height: 34px; max-height: 34px; max-width: 220px; }
  .topnav a { padding: 9px 11px; font-size: 0.9rem; }
  :root { --topbar-h: 64px; --map-height: 66vh; }
}

@media (max-width: 760px) {
  .app-shell { padding-inline: 14px; }
  .topbar { gap: 10px; flex-wrap: nowrap; overflow: hidden; }
  .brand-logo { height: 30px; max-height: 30px; max-width: 170px; }
  .topnav { gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { white-space: nowrap; font-size: 0.84rem; padding: 8px 10px; }
  .side-kv, .drawer-kv, .drawer-metrics, .summary-grid { grid-template-columns: 1fr; }
  .station-page .summary-grid { grid-template-columns: 1fr; }
  .sensor-comparison-grid, .sensor-readout-row, .sensor-comparison-card__stats { grid-template-columns: 1fr; }
  .spectra-controls { grid-template-columns: 1fr; }
  .analysis-header, .section-head, .map-footer, .page-hero.compact-hero { flex-direction: column; align-items: stretch; }
  .guide-steps, .guide-family-grid, .heat-index-grid, .metadata-term-grid { grid-template-columns: 1fr; }
  .quick-trend-actions { justify-content: stretch; }
  .station-toolbar { flex-direction: column; align-items: stretch; }
  .date-range-control, .date-range-fields { width: 100%; }
  .date-field-button { min-width: 0; flex: 1; }
  .date-calendar-popover { left: 0; right: auto; width: min(360px, 100%); }
  .station-marker { width: 8px; height: 8px; }
  .map-help { max-width: calc(100% - 28px); font-size: 0.78rem; }
  .map-type-card { display: none; }
  .map-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); width: calc(100% - 28px); gap: 10px; padding: 12px; }
  .overview-label { grid-column: 1 / -1; padding: 0 0 8px; border-right: 0; border-bottom: 1px solid rgba(91, 33, 182, 0.18); }
  .station-legend { justify-content: flex-start; }
  .legend-group { grid-template-columns: 1fr; row-gap: 5px; }
  .drawer-kv.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab-switch, .inline-toggle { width: 100%; justify-content: space-between; }
  .download-grid, .download-metric-grid { grid-template-columns: 1fr; }
  .admin-grid, .recovery-grid { grid-template-columns: 1fr; }
  .auth-card, .auth-copy { padding: 20px; }
  .download-parameter-head { align-items: flex-start; flex-direction: column; }
  .station-drawer { right: 10px; width: calc(100vw - 20px); }
  :root { --map-height: 58vh; --map-footer-h: 72px; }
}
