/* ==========================================================================
   SISMODATA PANAMÁ — MODERN ROUNDED GEOPHYSICAL OBSERVATORY
   Design System: Modern Rounded Dark · Rubik Typography · Youthful & Legible
   ========================================================================== */

/* --------------------------------------------------------------------------
   01. DESIGN TOKENS & SYSTEM VARIABLES
   -------------------------------------------------------------------------- */
:root {
  /* Fonts */
  --font-sans: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  /* Surfaces & Backgrounds (Smooth Modern Dark Slate) */
  --bg-root: #0b1117;
  --bg-surface: #131d26;
  --bg-surface-2: #1a2733;
  --bg-surface-hover: #223343;
  --bg-surface-active: #2a3e52;
  --bg-card: #131d26;
  --bg-input: #0f161e;

  /* Borders (Soft, polished, smooth) */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-default: #223241;
  --border-strong: #32475b;
  --border-highlight: #46617a;
  --border-focus: #36DDF3;

  /* Typography / Text Colors (WCAG AA Compliant) */
  --text-main: #f0f6f9;
  --text-secondary: #b6c6d4;
  --text-muted: #8295a6;
  --text-dim: #5c6f80;

  /* Scientific Telemetry & High-Saturation Controlled Palette */
  --color-cyan: #36DDF3;     /* M < 3.0 */
  --color-lime: #B9F34D;     /* M 3.0 - 3.9 */
  --color-amber: #FFC857;    /* M 4.0 - 4.9 */
  --color-coral: #FF6B62;    /* M >= 5.0 */
  --color-violet: #A784FF;   /* Reference / System */
  --color-red: #FF5068;      /* Alarm / Critical */

  /* Semantic Magnitude Classes */
  --mag-below: var(--color-cyan);
  --mag-3: var(--color-lime);
  --mag-4: var(--color-amber);
  --mag-5: var(--color-coral);

  /* Spacing Grid (4px system) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;

  /* Radii (Modern, youthful, rounded finish: 8px - 18px) */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  /* Soft Ambient Shadows */
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
  --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   02. BASE RESET & SMOOTH MODERN FINISH
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  background-color: var(--bg-root);
  color-scheme: dark;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100vw;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-root);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(54, 221, 243, 0.06), transparent 70%),
    linear-gradient(180deg, rgba(19, 29, 38, 0.4) 0%, rgba(11, 17, 23, 0.95) 450px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100vh;
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   03. SHELL & TOP NAVIGATION BAR
   -------------------------------------------------------------------------- */
.page-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--sp-6) var(--sp-8);
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  border-bottom: 1px solid var(--border-default);
  background-color: rgba(11, 17, 23, 0.88);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.identity {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.identity:hover {
  opacity: 0.9;
}

.identity-mark {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.identity-mark svg {
  width: 100%;
  height: 100%;
}

.identity-name {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.identity-name b {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-main);
}

.identity-name b span {
  color: var(--color-cyan);
}

.identity-name small {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: var(--sp-3);
}

.topnav a {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-idx {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--color-cyan);
  background: rgba(54, 221, 243, 0.1);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

.topnav a:hover {
  color: var(--text-main);
  background: var(--bg-surface-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
}

.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(54, 221, 243, 0.1);
  color: var(--color-cyan);
  border: 1px solid rgba(54, 221, 243, 0.35);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.pwa-install-btn:hover {
  background: rgba(54, 221, 243, 0.2);
  border-color: var(--color-cyan);
  color: #ffffff;
}

.pwa-btn-icon {
  width: 15px;
  height: 15px;
}

.telemetry-clock {
  display: flex;
  align-items: baseline;
  gap: 7px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
}

.clock-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--color-cyan);
  letter-spacing: 0.4px;
}

.panama-time {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-cyan);
  display: inline-block;
}

.status-pill.ok {
  border-color: rgba(185, 243, 77, 0.35);
  color: var(--color-lime);
  background: rgba(185, 243, 77, 0.1);
}
.status-pill.ok i {
  background-color: var(--color-lime);
}

.status-pill.loading {
  border-color: rgba(255, 200, 87, 0.35);
  color: var(--color-amber);
  background: rgba(255, 200, 87, 0.1);
}
.status-pill.loading i {
  background-color: var(--color-amber);
}

.status-pill.error {
  border-color: rgba(255, 107, 98, 0.35);
  color: var(--color-coral);
  background: rgba(255, 107, 98, 0.1);
}
.status-pill.error i {
  background-color: var(--color-coral);
}

/* --------------------------------------------------------------------------
   04. OBSERVATORY HEADER & LATEST EVENT PANEL
   -------------------------------------------------------------------------- */
.masthead {
  display: grid;
  grid-template-columns: 1fr minmax(360px, 440px);
  gap: var(--sp-5);
  align-items: stretch;
  padding: var(--sp-4) 0 var(--sp-3);
}

.masthead-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  padding: var(--sp-5) var(--sp-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  position: relative;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-cyan);
  letter-spacing: 0.3px;
  margin-bottom: var(--sp-2);
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-cyan);
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(54, 221, 243, 0.25);
  animation: pulse-ring 2.5s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(54, 221, 243, 0.4); }
  70% { box-shadow: 0 0 0 7px rgba(54, 221, 243, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 221, 243, 0); }
}

.masthead h1 {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.3px;
  color: var(--text-main);
  margin: 0 0 var(--sp-2);
}

.masthead-copy p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--sp-3);
  max-width: 600px;
}

.masthead-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: auto;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.meta-tag strong {
  color: var(--text-muted);
  font-weight: 600;
}

/* Latest Event Telemetry Box */
.last-event {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--color-cyan);
  padding: var(--sp-5) var(--sp-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-3);
  min-width: 0;
}

.last-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.last-header-tag {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-cyan);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(54, 221, 243, 0.25);
}

.last-top #latestState {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--color-lime);
}

.last-magnitude-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
}

.last-magnitude {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.last-prefix {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-cyan);
}

.last-magnitude strong {
  font-family: var(--font-mono);
  font-size: 50px;
  font-weight: 700;
  line-height: 0.95;
  color: var(--text-main);
  letter-spacing: -1px;
}

.last-level {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-cyan);
  background: rgba(54, 221, 243, 0.12);
  border: 1px solid rgba(54, 221, 243, 0.28);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.last-region {
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  min-height: 38px;
}

.last-time-line {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 12px;
  color: var(--text-secondary);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border-subtle);
}

.last-time-line span + span::before {
  content: '·';
  margin-right: var(--sp-3);
  color: var(--border-strong);
}

/* User Distance to Epicenter Card */
.user-distance-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.distance-unprompted {
  display: flex;
  align-items: center;
}

.geo-dist-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px dashed rgba(54, 221, 243, 0.4);
  color: var(--color-cyan);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: all 0.15s ease;
}

.geo-dist-btn:hover {
  background: rgba(54, 221, 243, 0.08);
  border-color: var(--color-cyan);
  border-style: solid;
}

.geo-dist-icon {
  font-size: 14px;
  display: inline-block;
}

.geo-dist-icon.active {
  color: var(--color-cyan);
}

.distance-active {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dist-val-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.dist-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.dist-num {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-cyan);
  letter-spacing: -0.2px;
}

.dist-note {
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--text-muted);
}

.dist-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.dist-action-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-cyan);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.15s;
}

.dist-action-link:hover {
  opacity: 0.8;
}

.dist-action-link.danger {
  color: var(--text-muted);
}

.dist-action-link.danger:hover {
  color: var(--color-coral);
}

.dist-sep {
  color: var(--border-default);
  font-size: 11px;
}

.distance-status {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--color-amber);
  margin-top: 6px;
}

.timer-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
}

.timer-label {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.live-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.counter-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}

.counter-unit strong {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.counter-unit small {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-top: 3px;
}

.counter-sep {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-cyan);
  position: relative;
  top: -6px;
}

.last-foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-2);
  font-size: 11.5px;
  color: var(--text-muted);
  padding-top: var(--sp-1);
}

/* --------------------------------------------------------------------------
   05. METRICS PANEL (5 UNIFIED TELEMETRY MODULES)
   -------------------------------------------------------------------------- */
.metrics {
  display: grid;
  grid-template-columns: 1.15fr repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.metric {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  padding: var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 122px;
  text-align: left;
  color: var(--text-main);
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.metric::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: transparent;
}

.metric.primary {
  background: var(--bg-surface);
  border-color: var(--border-strong);
}
.metric.primary::after {
  background: var(--color-cyan);
}

.m-below-btn::after { background: var(--color-cyan); }
.m-3-btn::after { background: var(--color-lime); }
.m-4-btn::after { background: var(--color-amber); }
.m-5-btn::after { background: var(--color-coral); }

.metric-button:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  background-color: var(--bg-surface-hover);
  box-shadow: var(--shadow-card);
}

.metric-button.is-selected {
  border-color: var(--border-focus);
  background-color: var(--bg-surface-2);
  box-shadow: 0 0 0 1px var(--border-focus), var(--shadow-card);
}

.metric-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.metric-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-2);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.metric strong {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
  margin: var(--sp-2) 0;
  letter-spacing: -0.5px;
}

.metric.primary strong {
  color: var(--color-cyan);
}

.metric-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.metric-pct {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.metric-mark {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-cyan);
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.indicator.gentle, .l-below { background: var(--color-cyan); }
.indicator.cyan, .l-three { background: var(--color-lime); }
.indicator.amber, .l-four { background: var(--color-amber); }
.indicator.coral, .l-five { background: var(--color-coral); }

/* --------------------------------------------------------------------------
   06. FILTER PANEL (RESPONSIVE STRUCTURED DECK)
   -------------------------------------------------------------------------- */
.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5) var(--sp-5);
  margin-bottom: var(--sp-5);
}

.filter-topline, .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.section-kicker {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--color-cyan);
  display: block;
  margin-bottom: 2px;
}

.filter-topline h2, .panel-head h2 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-main);
  margin: 0;
}

.filter-top-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.filtered-count {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-lime);
  background: rgba(185, 243, 77, 0.1);
  border: 1px solid rgba(185, 243, 77, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.text-action {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-cyan);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.text-action:hover {
  border-color: var(--color-cyan);
  background: var(--bg-surface-hover);
  color: #fff;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3) var(--sp-3);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.field select, .field input {
  width: 100%;
  height: 40px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238295a6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.field select:hover, .field input:hover {
  border-color: var(--border-highlight);
}

.field select:focus, .field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.search-field {
  grid-column: span 2;
}

.search-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding-left: 12px;
  color: var(--text-muted);
  height: 40px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.search-wrap input {
  border: none !important;
  background: transparent !important;
  height: 100% !important;
  padding-left: 8px !important;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-main) !important;
}

/* --------------------------------------------------------------------------
   07. PANELS & DATA VISUALIZATION
   -------------------------------------------------------------------------- */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0;
}

.panel-action {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.timeline-mode {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: 3px 10px;
  border-radius: var(--radius-xs);
}

.panel-mark {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
}

.chart-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.plot-area {
  height: 230px;
  padding: var(--sp-3) var(--sp-4) var(--sp-1);
  position: relative;
}

.svg-timeline {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-gridline {
  stroke: var(--border-default);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.chart-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.plot-bar {
  fill: var(--color-cyan);
  transition: fill 0.15s ease;
  rx: 3px;
  ry: 3px;
}

.plot-bar:hover {
  fill: var(--color-lime);
}

.panel-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Donut Chart Component */
.donut-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-5);
  min-height: 230px;
}

.donut {
  width: 155px;
  height: 155px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: conic-gradient(var(--border-default) 0 100%);
}

.donut-inner {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

.donut-inner span {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.donut-inner strong {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.05;
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 130px;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
}

.legend-row b {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   08. CARTOGRAPHY & LOCATION MODULES
   -------------------------------------------------------------------------- */
.location-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.badge-outline {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  padding: 3px 10px;
  border-radius: var(--radius-xs);
}

.map-wrap {
  width: 100%;
  height: 480px;
  min-height: 480px;
  position: relative;
  overflow: hidden;
  background: #111417;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
}

.map-container {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  background-color: #111417;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

@media (max-width: 900px) {
  .map-wrap {
    height: 400px;
    min-height: 400px;
  }
}

@media (max-width: 600px) {
  .map-wrap {
    height: 340px;
    min-height: 340px;
  }
}

/* Fallback styling when Leaflet is active */
.map-container .leaflet-container {
  background-color: #0b141a;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
}

.map-container .leaflet-tile-pane {
  filter: brightness(80%) contrast(110%);
}

.leaflet-control-zoom a {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-xs) !important;
}

.leaflet-control-zoom a:hover {
  background-color: var(--bg-surface-hover) !important;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-card) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-family: var(--font-sans) !important;
  font-size: 12.5px !important;
  line-height: 1.45 !important;
}

.leaflet-popup-content b {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--color-cyan);
}

.leaflet-popup-content small {
  color: var(--text-secondary);
}

.leaflet-popup-content a {
  font-family: var(--font-sans);
  color: var(--color-lime) !important;
  font-weight: 600;
}

.map-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Fallback SVG Map */
.map-placeholder {
  width: 100%;
  height: 100%;
}

.coordinate-map {
  width: 100%;
  height: 100%;
  padding: var(--sp-3);
}

.coordinates-svg text {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Localities Bar Rows */
.help-text {
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-muted);
  margin: var(--sp-3) var(--sp-5) var(--sp-3);
  line-height: 1.5;
}

.bar-rows {
  padding: 0 var(--sp-5) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.bar-labels strong {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-cyan), var(--color-lime));
  border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   09. REGIONS GRID
   -------------------------------------------------------------------------- */
.section-regions {
  margin-bottom: var(--sp-5);
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
}

.region-item {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.region-item:hover {
  border-color: var(--border-highlight);
  transform: translateY(-1px);
  box-shadow: var(--shadow-subtle);
}

.region-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.region-item-head b {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-cyan);
}

.region-progress {
  height: 6px;
  background: var(--bg-root);
  overflow: hidden;
  border-radius: var(--radius-pill);
}

.region-progress > div {
  height: 100%;
  background: var(--color-cyan);
  border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   10. RECORDS TABLE (HIGH-DENSITY EVENT LOG)
   -------------------------------------------------------------------------- */
.records-section {
  margin-bottom: var(--sp-6);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.records-head {
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.records-head h2 small {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-cyan);
  margin-left: 6px;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-secondary);
}

.sort-wrap select {
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-family: var(--font-sans);
  font-size: 12px;
}

.download-button, .refresh-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.download-button:hover, .refresh-button:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  background: var(--bg-surface-hover);
}

.download-button {
  border-color: rgba(54, 221, 243, 0.35);
  color: var(--color-cyan);
}

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
}

.desktop-only-table {
  display: block;
}

.mobile-records-list {
  display: none;
}

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

thead {
  background: var(--bg-surface-2);
}

th {
  text-align: left;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-secondary);
  padding: 12px 18px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-default);
}

td {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: var(--bg-surface-hover);
}

.cell-date strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.cell-date span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cell-place strong {
  display: block;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.cell-place span {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
}

/* Magnitude chips */
.mag-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 4px 10px;
  min-width: 46px;
  border-radius: 8px;
  border: 1px solid;
  letter-spacing: -0.2px;
}

.mag-chip.mBelow {
  background: rgba(54, 221, 243, 0.12);
  color: var(--color-cyan);
  border-color: rgba(54, 221, 243, 0.35);
}

.mag-chip.m3 {
  background: rgba(185, 243, 77, 0.12);
  color: var(--color-lime);
  border-color: rgba(185, 243, 77, 0.35);
}

.mag-chip.m4 {
  background: rgba(255, 200, 87, 0.14);
  color: var(--color-amber);
  border-color: rgba(255, 200, 87, 0.4);
}

.mag-chip.m5 {
  background: rgba(255, 107, 98, 0.16);
  color: var(--color-coral);
  border-color: rgba(255, 107, 98, 0.45);
}

/* State chips */
.state-chip {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

.state-chip.revisado {
  color: var(--color-lime);
  border-color: rgba(185, 243, 77, 0.35);
  background: rgba(185, 243, 77, 0.1);
}

.align-right {
  text-align: right;
}

th.align-right,
td.align-right {
  text-align: right;
  width: 90px;
  min-width: 84px;
  white-space: nowrap;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

.pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.pagination button {
  height: 32px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  background: var(--bg-surface-hover);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#pageNum {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0 8px;
  color: var(--text-secondary);
}

.empty-plot, .empty-table {
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 40px 16px;
}

/* --------------------------------------------------------------------------
   11. ALERT BOX & FOOTER
   -------------------------------------------------------------------------- */
.alertbox {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--color-amber);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-6);
}

.alertbox strong {
  display: block;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.alertbox p {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 var(--sp-3);
  line-height: 1.5;
}

.alertbox button {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-amber);
  border: 1px solid var(--border-default);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  transition: all 0.15s ease;
}

.alertbox button:hover {
  background: var(--bg-surface-hover);
  border-color: var(--color-amber);
}

.footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--sp-4) 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.footer-timestamp, #sourceTimestamp {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-cyan);
  letter-spacing: 0.2px;
}

.cell-distance {
  color: var(--color-cyan);
  font-size: 12.5px;
  font-weight: 600;
}

.cell-place .mobile-dist {
  display: none !important;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-cyan);
  margin-left: 4px;
}

/* PWA iOS Safari Modal */
.pwa-ios-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.pwa-ios-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 17, 22, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pwa-ios-dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: pwa-modal-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwa-modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.pwa-ios-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.pwa-ios-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-ios-badge {
  font-size: 18px;
}

.pwa-ios-header h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.pwa-ios-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.pwa-ios-close:hover {
  color: var(--text-main);
}

.pwa-ios-body {
  padding: 20px;
}

.pwa-ios-intro {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 16px;
}

.pwa-ios-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pwa-ios-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-main);
}

.pwa-ios-steps strong {
  color: var(--color-cyan);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(54, 221, 243, 0.12);
  color: var(--color-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-svg-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -2px;
  stroke: var(--color-cyan);
}

.pwa-ios-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  background: var(--bg-surface-2);
}

.pwa-ios-btn {
  background: var(--color-cyan);
  color: #0b1116;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.pwa-ios-btn:hover {
  opacity: 0.9;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   12. RESPONSIVE MEDIA QUERIES (MOBILE FIRST & PROGRESSIVE SCALING)
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .masthead {
    grid-template-columns: 1fr;
  }
  .chart-layout, .location-layout {
    grid-template-columns: 1fr;
  }
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .search-field {
    grid-column: span 3;
  }
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .metric.primary {
    grid-column: span 3;
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 0 var(--sp-4) var(--sp-6);
  }
  .topbar {
    gap: var(--sp-3);
  }
  .topnav {
    display: none;
  }
  .topbar-right {
    margin-left: auto;
  }
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .search-field {
    grid-column: span 2;
  }
  .region-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Barra inferior móvil: oculta en escritorio por defecto */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 640px) {
  .page-shell {
    padding: 0 var(--sp-3) calc(76px + env(safe-area-inset-bottom, 0px));
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 54px;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(11, 17, 23, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .telemetry-clock {
    display: none;
  }
  .masthead {
    padding: var(--sp-4) 0 var(--sp-3);
  }
  .masthead-copy {
    padding: var(--sp-4);
  }
  .masthead h1 {
    font-size: 21px;
  }
  .last-event {
    padding: var(--sp-4);
  }
  .last-magnitude strong {
    font-size: 38px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
  }
  .metric.primary {
    grid-column: span 2;
  }
  .metric {
    padding: var(--sp-3);
    min-height: 100px;
  }
  .metric strong {
    font-size: 28px;
  }
  .filter-panel {
    padding: var(--sp-4);
  }
  .filter-topline {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }
  .filter-top-actions {
    width: 100%;
    justify-content: space-between;
  }
  .filter-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }
  .search-field {
    grid-column: span 1;
  }
  .donut-body {
    flex-direction: column;
    padding: var(--sp-4);
    gap: var(--sp-4);
  }
  .map-container {
    height: 300px;
  }
  .region-grid {
    grid-template-columns: 1fr;
    padding: var(--sp-3) var(--sp-4) var(--sp-4);
  }
  .record-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .sort-wrap {
    width: 100%;
  }
  .sort-wrap select {
    flex: 1;
  }
  /* Ocultar tabla tradicional en móvil para eliminar scroll horizontal */
  .desktop-only-table {
    display: none !important;
  }

  /* Catálogo sísmico en tarjetas móviles compactas y responsivas */
  .mobile-records-list {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    padding: var(--sp-3) var(--sp-3) var(--sp-2);
    border-top: 1px solid var(--border-subtle);
  }

  .sismo-mobile-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: border-color 0.15s ease, background 0.15s ease;
  }

  .sismo-mobile-card:active {
    background: var(--bg-surface-2);
    border-color: rgba(54, 221, 243, 0.35);
  }

  .card-main-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .card-mag-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    min-width: 52px;
    height: 34px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    flex-shrink: 0;
    letter-spacing: -0.2px;
  }

  .card-mag-badge.mBelow {
    background: rgba(54, 221, 243, 0.12);
    color: var(--color-cyan);
    border-color: rgba(54, 221, 243, 0.35);
  }
  .card-mag-badge.m3 {
    background: rgba(185, 243, 77, 0.12);
    color: var(--color-lime);
    border-color: rgba(185, 243, 77, 0.35);
  }
  .card-mag-badge.m4 {
    background: rgba(255, 200, 87, 0.14);
    color: var(--color-amber);
    border-color: rgba(255, 200, 87, 0.4);
  }
  .card-mag-badge.m5 {
    background: rgba(255, 107, 98, 0.16);
    color: var(--color-coral);
    border-color: rgba(255, 107, 98, 0.45);
  }

  .card-title-box {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .card-place-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    width: 100%;
  }

  .card-place-name {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-place-line .state-chip {
    flex-shrink: 0;
  }

  .card-region-name {
    font-family: var(--font-sans);
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    width: 100%;
  }

  .card-params-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .card-param-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .card-param-lbl {
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
  }

  .card-param-txt {
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-param-txt.dist-active {
    color: var(--color-cyan);
    font-weight: 600;
  }

  .card-param-txt.dist-empty {
    color: var(--text-muted);
  }

  .card-action-row {
    padding-top: 2px;
  }

  .card-ficha-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 34px;
    min-height: 34px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-cyan);
    background: rgba(54, 221, 243, 0.08);
    border: 1px solid rgba(54, 221, 243, 0.32);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .card-ficha-btn:hover {
    background: rgba(54, 221, 243, 0.14);
    border-color: var(--color-cyan);
    color: var(--color-cyan);
  }

  .card-ficha-btn:active {
    background: rgba(54, 221, 243, 0.24);
    border-color: var(--color-cyan);
  }

  .empty-cards {
    padding: var(--sp-5) var(--sp-3);
    text-align: center;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-muted);
  }

  .table-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }
  .pagination {
    width: 100%;
    justify-content: space-between;
  }
  .footer {
    justify-content: center;
    text-align: center;
    padding: var(--sp-3) 0;
  }
  .cell-place .mobile-dist {
    display: inline-block !important;
  }
  .pwa-install-btn {
    padding: 5px 8px;
  }
  .pwa-btn-text {
    display: none;
  }
  .topbar {
    gap: var(--sp-2);
  }
  .topbar-right {
    gap: 8px;
  }
  .status-pill {
    padding: 0;
    width: 28px;
    height: 28px;
    min-width: 28px;
    justify-content: center;
    border-radius: var(--radius-pill);
    gap: 0;
  }
  .status-pill .status-text {
    display: none !important;
  }
  .status-pill i {
    width: 9px;
    height: 9px;
    margin: 0;
    box-shadow: 0 0 6px currentColor;
  }

  /* Barra inferior fija de navegación estilo Android (Material Bottom Navigation) */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 120;
    height: auto;
    min-height: 58px;
    background: rgba(13, 20, 27, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-default);
    padding: 5px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.55);
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    min-width: 48px;
    padding: 4px 2px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, transform 0.1s ease;
  }

  .mobile-nav-btn:active {
    transform: scale(0.92);
  }

  .mobile-nav-icon {
    width: 21px;
    height: 21px;
    transition: transform 0.15s ease, stroke 0.15s ease;
  }

  .mobile-nav-label {
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.15px;
    line-height: 1;
  }

  .mobile-nav-btn.active,
  .mobile-nav-btn[aria-selected="true"] {
    color: var(--color-cyan);
  }

  .mobile-nav-btn.active .mobile-nav-icon,
  .mobile-nav-btn[aria-selected="true"] .mobile-nav-icon {
    stroke: var(--color-cyan);
    filter: drop-shadow(0 0 6px rgba(54, 221, 243, 0.45));
  }

  .mobile-nav-btn.active .mobile-nav-label,
  .mobile-nav-btn[aria-selected="true"] .mobile-nav-label {
    font-weight: 600;
    color: #E2F8FB;
  }

  /* Control de visibilidad de secciones por pestaña activa en móvil */
  #dashboardView:not([data-active-tab]) > .filter-panel,
  #dashboardView:not([data-active-tab]) > .chart-layout,
  #dashboardView:not([data-active-tab]) > .location-layout,
  #dashboardView:not([data-active-tab]) > .section-regions,
  #dashboardView:not([data-active-tab]) > .section-transparency,
  #dashboardView:not([data-active-tab]) > .historico-section,
  #dashboardView[data-active-tab="sismos"] > .filter-panel,
  #dashboardView[data-active-tab="sismos"] > .chart-layout,
  #dashboardView[data-active-tab="sismos"] > .location-layout,
  #dashboardView[data-active-tab="sismos"] > .section-regions,
  #dashboardView[data-active-tab="sismos"] > .section-transparency,
  #dashboardView[data-active-tab="sismos"] > .historico-section {
    display: none !important;
  }

  #dashboardView[data-active-tab="mapa"] > .masthead,
  #dashboardView[data-active-tab="mapa"] > .metrics,
  #dashboardView[data-active-tab="mapa"] > .filter-panel,
  #dashboardView[data-active-tab="mapa"] > .chart-layout,
  #dashboardView[data-active-tab="mapa"] > .section-regions,
  #dashboardView[data-active-tab="mapa"] > .section-transparency,
  #dashboardView[data-active-tab="mapa"] > .records-section,
  #dashboardView[data-active-tab="mapa"] > .historico-section {
    display: none !important;
  }
  #dashboardView[data-active-tab="mapa"] .location-layout {
    display: flex !important;
    flex-direction: column;
    gap: var(--sp-3);
  }
  #dashboardView[data-active-tab="mapa"] .map-container {
    height: 60vh !important;
    min-height: 380px;
    max-height: 600px;
  }

  #dashboardView[data-active-tab="cerca"] > .metrics,
  #dashboardView[data-active-tab="cerca"] > .filter-panel,
  #dashboardView[data-active-tab="cerca"] > .chart-layout,
  #dashboardView[data-active-tab="cerca"] > .location-layout,
  #dashboardView[data-active-tab="cerca"] > .section-regions,
  #dashboardView[data-active-tab="cerca"] > .section-transparency,
  #dashboardView[data-active-tab="cerca"] > .historico-section {
    display: none !important;
  }
  #dashboardView[data-active-tab="cerca"] .masthead-copy {
    display: none !important;
  }
  #dashboardView[data-active-tab="cerca"] .timer-box {
    display: none !important;
  }
  #dashboardView[data-active-tab="cerca"] .user-distance-card {
    border-color: rgba(54, 221, 243, 0.45) !important;
    background: rgba(54, 221, 243, 0.08) !important;
    box-shadow: 0 0 16px rgba(54, 221, 243, 0.16) !important;
    margin-bottom: var(--sp-2);
  }

  #dashboardView[data-active-tab="historial"] > .masthead,
  #dashboardView[data-active-tab="historial"] > .metrics,
  #dashboardView[data-active-tab="historial"] > .filter-panel,
  #dashboardView[data-active-tab="historial"] > .chart-layout,
  #dashboardView[data-active-tab="historial"] > .location-layout,
  #dashboardView[data-active-tab="historial"] > .section-regions,
  #dashboardView[data-active-tab="historial"] > .section-transparency,
  #dashboardView[data-active-tab="historial"] > .records-section {
    display: none !important;
  }
  #dashboardView[data-active-tab="historial"] > .historico-section {
    display: block !important;
  }

  #dashboardView[data-active-tab="mas"] > .masthead,
  #dashboardView[data-active-tab="mas"] > .metrics,
  #dashboardView[data-active-tab="mas"] > .location-layout,
  #dashboardView[data-active-tab="mas"] > .records-section,
  #dashboardView[data-active-tab="mas"] > .historico-section {
    display: none !important;
  }
  #dashboardView[data-active-tab="mas"] > .filter-panel,
  #dashboardView[data-active-tab="mas"] > .chart-layout,
  #dashboardView[data-active-tab="mas"] > .section-regions,
  #dashboardView[data-active-tab="mas"] > .section-transparency {
    display: block !important;
  }
  #dashboardView[data-active-tab="registros"] > .masthead,
  #dashboardView[data-active-tab="registros"] > .metrics,
  #dashboardView[data-active-tab="registros"] > .filter-panel,
  #dashboardView[data-active-tab="registros"] > .chart-layout,
  #dashboardView[data-active-tab="registros"] > .location-layout,
  #dashboardView[data-active-tab="registros"] > .section-regions,
  #dashboardView[data-active-tab="registros"] > .section-transparency,
  #dashboardView[data-active-tab="registros"] > .historico-section {
    display: none !important;
  }
  #dashboardView[data-active-tab="registros"] > .records-section {
    display: block !important;
  }

  .sismo-view {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}

/* --------------------------------------------------------------------------
   14. FICHA INDIVIDUAL DE EVENTO SÍSMICO (MÓDULO A)
   -------------------------------------------------------------------------- */
.sismo-view {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.sismo-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}

.sismo-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-cyan);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.sismo-back-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--color-cyan);
  color: #fff;
}

.sismo-view-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.sismo-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.sismo-action-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-highlight);
}

.sismo-action-btn.official {
  color: var(--color-cyan);
}

.sismo-status-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
  gap: var(--sp-2);
}

.sismo-status-box.not-found {
  border-color: var(--color-amber);
}

.sismo-status-box .warning-icon {
  font-size: 32px;
  color: var(--color-amber);
}

.sismo-status-box strong {
  font-family: var(--font-sans);
  font-size: 16.5px;
  color: var(--text-main);
}

.sismo-status-box p {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0;
}

.sismo-return-btn {
  margin-top: var(--sp-3);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-cyan);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.sismo-return-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--color-cyan);
}

.pulse-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-default);
  border-top-color: var(--color-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--sp-2);
}

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

.sismo-card-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr;
  gap: var(--sp-4);
  align-items: start;
}

.sismo-tech-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  padding: var(--sp-5);
}

.sismo-tech-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--sp-4);
}

.sismo-tech-badge-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.sismo-mag-chip {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 10px;
  display: inline-block;
  letter-spacing: 0.5px;
}

.sismo-mag-chip.mBelow {
  background: rgba(54, 221, 243, 0.15);
  color: var(--color-cyan);
  border: 1px solid var(--color-cyan);
}

.sismo-mag-chip.m3 {
  background: rgba(185, 243, 77, 0.15);
  color: var(--color-lime);
  border: 1px solid var(--color-lime);
}

.sismo-mag-chip.m4 {
  background: rgba(255, 200, 87, 0.15);
  color: var(--color-amber);
  border: 1px solid var(--color-amber);
}

.sismo-mag-chip.m5 {
  background: rgba(255, 107, 98, 0.15);
  color: var(--color-coral);
  border: 1px solid var(--color-coral);
}

.sismo-state-chip {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 4px 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
}

.sismo-level-text {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.sismo-region-title {
  font-family: var(--font-sans);
  font-size: 21px;
  font-weight: 700;
  color: var(--text-main);
  margin: var(--sp-2) 0 var(--sp-1);
  line-height: 1.25;
}

.sismo-location-desc {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.sismo-params-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4) var(--sp-5);
}

.sismo-param {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.param-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--text-muted);
}

.param-val {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
}

.param-sub {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-dim);
}

.sismo-tech-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-3);
}

.sismo-uid-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.uid-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}

.sismo-uid-box code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  padding: 5px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  word-break: break-all;
}

.sismo-map-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.sismo-map-header-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.sismo-map-wrap {
  width: 100%;
  height: 400px;
  min-height: 400px;
  max-height: 400px;
  position: relative;
  overflow: hidden;
  background: #111417;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.sismo-map-canvas {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

/* Control compacto de capas geofísicas */
.sismo-layers-widget {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.sismo-layers-btn {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(20, 29, 38, 0.92);
  border: 1px solid var(--border-default);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.sismo-layers-btn:hover, .sismo-layers-btn[aria-expanded="true"] {
  background: var(--bg-surface-active);
  border-color: var(--color-cyan);
  color: #fff;
}

.sismo-layers-popover {
  margin-top: 6px;
  background: rgba(20, 29, 38, 0.96);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 215px;
}

.layers-popover-title {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 5px;
  margin-bottom: 2px;
}

.layer-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.layer-switch:hover {
  color: var(--text-main);
}

.layer-switch input[type="checkbox"] {
  accent-color: var(--color-cyan);
  cursor: pointer;
  margin: 0;
}

.layer-chip {
  display: inline-block;
  flex-shrink: 0;
}

.layer-chip.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-cyan);
}

.layer-chip.line-violet {
  width: 14px;
  height: 2px;
  background: #C68BEB;
}

.layer-chip.text-violet {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: #C68BEB;
}

.layer-chip.line-fault {
  width: 14px;
  height: 2px;
  background: #D99B69;
  border-bottom: 1px dashed #D99B69;
}

.sismo-map-note {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border-default);
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sismo-map-note .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.sismo-map-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

.sismo-map-attributions {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 4px;
  line-height: 1.3;
}

.sismo-map-attributions a {
  color: var(--text-muted);
  text-decoration: underline;
}

.sismo-map-fallback {
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-4);
  gap: var(--sp-2);
  color: var(--text-muted);
  z-index: 5;
}

/* MapLibre GL Overrides for Dark Modern Finish */
.maplibregl-ctrl-group {
  background: rgba(20, 29, 38, 0.92) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-xs) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  background: transparent !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  width: 28px !important;
  height: 28px !important;
}

.maplibregl-ctrl-group button:last-child {
  border-bottom: none !important;
}

.maplibregl-ctrl-group button:hover {
  background: var(--bg-surface-hover) !important;
}

.maplibregl-ctrl-icon {
  filter: invert(85%) contrast(150%);
}

.maplibregl-ctrl-attrib {
  background: rgba(11, 17, 23, 0.8) !important;
  color: var(--text-dim) !important;
  font-family: var(--font-sans) !important;
  font-size: 9.5px !important;
  padding: 2px 6px !important;
}

.maplibregl-ctrl-attrib a {
  color: var(--text-muted) !important;
}

.maplibregl-popup-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-card) !important;
  padding: 10px 14px !important;
  color: var(--text-main) !important;
}

.maplibregl-popup-tip {
  border-top-color: var(--bg-surface) !important;
  border-bottom-color: var(--bg-surface) !important;
}

.maplibregl-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 16px !important;
  padding: 2px 6px !important;
}

.maplibregl-popup-close-button:hover {
  color: #fff !important;
  background: transparent !important;
}

@media (max-width: 900px) {
  .sismo-card-grid {
    grid-template-columns: 1fr;
  }
  .sismo-map-wrap {
    height: 350px;
    min-height: 350px;
    max-height: 350px;
  }
}

@media (max-width: 600px) {
  .sismo-map-wrap {
    height: 300px;
    min-height: 300px;
    max-height: 300px;
  }
  .sismo-params-grid {
    grid-template-columns: 1fr;
  }
}

/* Acciones en la tabla de registros y popups */
.table-action-btn {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-cyan);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  padding: 5px 14px;
  border-radius: var(--radius-xs);
  margin-right: 0;
  display: inline-block;
  text-align: center;
  transition: all 0.15s ease;
}

.table-action-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--color-cyan);
  color: #fff;
}

.popup-card {
  font-family: var(--font-sans);
  color: var(--text-main);
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}

.popup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup-mag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  padding: 2px 8px;
  border-radius: 6px;
}

.popup-state {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.popup-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
}

.popup-meta {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.popup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-btn-epicenter {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-cyan);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   15. DASHBOARD HISTÓRICO (MÓDULO B)
   -------------------------------------------------------------------------- */
.historico-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.historico-head {
  border-bottom: 1px solid var(--border-default);
  padding-bottom: var(--sp-3);
}

.historico-head-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.coverage-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(255, 200, 87, 0.08);
  border: 1px solid rgba(255, 200, 87, 0.35);
  border-left: 4px solid var(--color-amber);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.coverage-notice-icon {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--color-amber);
  font-weight: 700;
}

.coverage-notice-text strong {
  color: var(--text-main);
  letter-spacing: 0.2px;
}

.historico-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.hist-filter-group {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.field.compact {
  gap: 4px;
}

.field.compact span {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
}

.field.compact select {
  height: 38px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  min-width: 140px;
  border-radius: var(--radius-sm);
}

.hist-status-line {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
}

.status-origin {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-cyan);
}

.hist-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-3);
}

.hist-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.hist-subcharts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.hist-mag-bars {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
}

.hist-mag-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hist-mag-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 13px;
}

.hist-mag-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-weight: 600;
}

.hist-mag-count {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

.hist-mag-pct {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: 6px;
}

.hist-mag-track {
  height: 10px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.hist-mag-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* SVG Chart Elements for Histórico */
.svg-hist-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hist-bar {
  transition: opacity 0.15s ease;
  rx: 3px;
  ry: 3px;
}

.hist-bar:hover {
  opacity: 0.8;
}

.hist-bar-no-coverage {
  fill: rgba(61, 74, 85, 0.25);
  stroke: #2B353D;
  stroke-dasharray: 2,2;
  rx: 3px;
  ry: 3px;
}

/* Responsive Overrides */
@media (max-width: 1100px) {
  .hist-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
  .sismo-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .hist-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .hist-charts-grid,
  .hist-subcharts-grid {
    grid-template-columns: 1fr;
  }
  .sismo-params-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .hist-kpis {
    grid-template-columns: 1fr;
  }
  .sismo-view-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --------------------------------------------------------------------------
   16. ACCESSIBILITY & PREFERS-REDUCED-MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   17. SECCIÓN DE TRANSPARENCIA, FUENTES Y POLÍTICA DE PRIVACIDAD
   -------------------------------------------------------------------------- */
.section-transparency {
  display: block;
  margin-top: var(--sp-4);
}

.transparency-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
}

.transparency-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(255, 200, 87, 0.08);
  border: 1px solid rgba(255, 200, 87, 0.35);
  border-left: 4px solid var(--color-amber);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.transparency-notice-icon {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--color-amber);
  font-weight: 700;
  line-height: 1.2;
}

.transparency-notice-text strong {
  color: var(--text-main);
  letter-spacing: 0.2px;
}

.sources-list {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
}

.sources-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sources-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--text-secondary);
}

.sources-items li {
  line-height: 1.45;
}

.sources-items strong {
  color: var(--text-main);
}

.source-link {
  display: inline-block;
  margin-left: var(--sp-1);
  color: var(--color-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.source-link:hover {
  color: var(--color-cyan-hover, #82EBF8);
}

.transparency-footer-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
}

.transparency-contact {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--text-dim);
}

.transparency-contact .contact-label {
  color: var(--text-muted);
}

.transparency-contact .contact-email {
  color: var(--color-cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.transparency-contact .contact-email:hover {
  color: var(--color-cyan-hover, #82EBF8);
}

.privacy-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-cyan);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: rgba(54, 221, 243, 0.08);
  border: 1px solid rgba(54, 221, 243, 0.3);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.privacy-link:hover {
  background: rgba(54, 221, 243, 0.18);
  border-color: var(--color-cyan);
}


