/* AUTO-GENERATED FILE. DO NOT EDIT DIRECTLY. */
/* Source modules: css/src/*.css */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Unbounded:wght@500;700&display=swap");

/* =========================================================
   Design Tokens
   ========================================================= */
:root {
  color-scheme: dark;

  --bg: #0b0f1a;
  --panel: #0f1629;
  --panel-glow: rgba(56, 189, 248, 0.15);
  --ink: #e2e8f0;
  --muted: #9aa7c2;
  --accent: #38bdf8;
  --accent-strong: #f8fafc;
  --grid: rgba(226, 232, 240, 0.12);
  --shadow: 0 28px 60px rgba(8, 12, 22, 0.5);
  --border: rgba(148, 163, 184, 0.2);

  --controls-bg: rgba(15, 23, 42, 0.6);
  --menu-panel-bg: rgba(15, 23, 42, 0.97);
  --menu-item-bg: rgba(2, 10, 24, 0.55);
  --menu-subpanel-bg: rgba(56, 189, 248, 0.12);
  --menu-toggle-active-bg: rgba(56, 189, 248, 0.3);
  --menu-toggle-active-text: #f8fafc;

  --stat-bg: rgba(15, 23, 42, 0.7);
  --stat-border: rgba(56, 189, 248, 0.2);
  --select-bg: rgba(15, 23, 42, 0.65);
  --risk-action-bg: rgba(15, 23, 42, 0.72);

  --empty-bg: rgba(6, 12, 24, 0.82);
  --empty-text: #f4fbff;
  --empty-text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 0 14px rgba(186, 230, 253, 0.42);

  --table-wrap-bg: rgba(11, 18, 32, 0.45);
  --table-head-bg: rgba(15, 23, 42, 0.55);

  --panel-sheen-start: rgba(56, 189, 248, 0.12);
  --panel-sheen-end: rgba(15, 23, 42, 0.3);

  --chart-bg: rgba(11, 18, 32, 0.85);
  --chart-border: rgba(148, 163, 184, 0.18);
  --chart-midnight-line: rgba(148, 163, 184, 0.35);
  --chart-brush-fill: rgba(56, 189, 248, 0.18);
  --chart-brush-stroke: rgba(56, 189, 248, 0.8);
  --chart-capacity-hit: #d7263d;
  --chart-anomaly: #f97316;

  --trunk-1: #22d3ee;
  --trunk-2: #60a5fa;
  --trunk-3: #a78bfa;
  --trunk-4: #34d399;
  --trunk-5: #2dd4bf;
  --trunk-6: #38bdf8;

  --ui-scale: 0.8;
  --stat-panel-height: 210px;
}

.theme-light {
  color-scheme: light;

  --bg: #eef4fb;
  --panel: #ffffff;
  --panel-glow: rgba(14, 116, 144, 0.12);
  --ink: #0f172a;
  --muted: #475569;
  --accent: #0284c7;
  --accent-strong: #0b1325;
  --grid: rgba(15, 23, 42, 0.16);
  --shadow: 0 20px 42px rgba(15, 23, 42, 0.14);
  --border: rgba(15, 23, 42, 0.16);

  --controls-bg: rgba(255, 255, 255, 0.9);
  --menu-panel-bg: rgba(248, 250, 252, 0.98);
  --menu-item-bg: rgba(226, 232, 240, 0.62);
  --menu-subpanel-bg: rgba(186, 230, 253, 0.38);
  --menu-toggle-active-bg: #0284c7;
  --menu-toggle-active-text: #f8fafc;

  --stat-bg: rgba(241, 245, 249, 0.88);
  --stat-border: rgba(14, 116, 144, 0.2);
  --select-bg: rgba(255, 255, 255, 0.92);
  --risk-action-bg: rgba(241, 245, 249, 0.95);

  --empty-bg: rgba(255, 255, 255, 0.96);
  --empty-text: #0f172a;
  --empty-text-shadow: none;

  --table-wrap-bg: rgba(241, 245, 249, 0.86);
  --table-head-bg: rgba(226, 232, 240, 0.78);

  --panel-sheen-start: rgba(14, 165, 233, 0.1);
  --panel-sheen-end: rgba(255, 255, 255, 0);

  --chart-bg: rgba(255, 255, 255, 0.96);
  --chart-border: rgba(15, 23, 42, 0.2);
  --chart-midnight-line: rgba(71, 85, 105, 0.35);
  --chart-brush-fill: rgba(2, 132, 199, 0.16);
  --chart-brush-stroke: rgba(2, 132, 199, 0.75);
  --chart-capacity-hit: #dc2626;
  --chart-anomaly: #ea580c;

  --trunk-1: #0284c7;
  --trunk-2: #2563eb;
  --trunk-3: #7c3aed;
  --trunk-4: #059669;
  --trunk-5: #0d9488;
  --trunk-6: #0f766e;
}


/* =========================================================
   Base
   ========================================================= */
* {
  box-sizing: border-box;
}

html,
body {
  background-color: var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

main {
  max-width: 1150px;
  margin: 0 auto;
  padding: 48px 20px 16px;
  zoom: var(--ui-scale);
}

h1 {
  font-family: "Unbounded", "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(2.1rem, 3.4vw, 3.2rem);
  margin: 0;
  letter-spacing: 0.4px;
}

svg {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
}

/* Enable transitions only after JS marks theme-ready */
html.theme-ready,
html.theme-ready body {
  transition: background-color 0.4s ease, color 0.4s ease;
}

html.theme-ready .panel,
html.theme-ready .stat,
html.theme-ready .controls-card,
html.theme-ready .menu-panel,
html.theme-ready .menu-subpanel,
html.theme-ready .risk-badge,
html.theme-ready .risk-action,
html.theme-ready .events-table-wrap,
html.theme-ready .events-table th,
html.theme-ready .events-table td {
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

/* =========================================================
   Header
   ========================================================= */
header {
  display: grid;
  align-items: start;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) auto;
  grid-template-areas:
    "title badge"
    "subtitle updated";
  margin-bottom: 12px;
}

.header-title {
  grid-area: title;
  margin: 0;
}

.header-subtitle {
  grid-area: subtitle;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 500;
}

.meta {
  grid-area: updated;
  margin: 0;
  justify-self: end;
  text-align: right;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: none;
}

.meta strong {
  color: var(--accent-strong);
  font-weight: 600;
}

.risk-badge {
  grid-area: badge;
  justify-self: end;
  align-self: start;
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0b1220;
}

.risk-badge strong {
  color: inherit;
}

.risk-action {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: var(--accent-strong);
  background: var(--risk-action-bg);
  font-size: 0.92rem;
}

.risk-action.hidden {
  display: none;
}

/* =========================================================
   Controls + Menu
   ========================================================= */
.controls-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--controls-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  width: 100%;
}

.controls-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-right: 6px;
}

.sub-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 0;
}

.controls-row .sub-row,
.utility-menu {
  margin-left: auto;
}

.range-select {
  min-width: 144px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 0 30px 0 10px;
  background: var(--select-bg);
  color: var(--ink);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aa7c2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}

.control-button {
  height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--select-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.control-button:hover {
  border-color: rgba(56, 189, 248, 0.6);
}

.utility-menu {
  position: relative;
}

.utility-menu summary {
  list-style: none;
}

.utility-menu summary::-webkit-details-marker {
  display: none;
}

.hamburger-button {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(56, 189, 248, 0.05);
  color: var(--muted);
  line-height: 1;
  font-size: 1.8rem;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hamburger-button:hover {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.utility-menu.is-open .hamburger-button {
  color: var(--accent-strong);
  background: var(--accent);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 300px;
  min-width: 220px;
  max-width: min(92vw, 300px);
  display: none;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--menu-panel-bg);
  box-shadow: 0 18px 30px rgba(8, 12, 22, 0.4);
  z-index: 30;
}

.utility-menu[open] > .menu-panel,
.utility-menu.is-open > .menu-panel {
  display: grid;
  animation: menu-panel-in 220ms ease-out;
}

.menu-item {
  width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  border: none;
  border-radius: 8px;
  padding: 8px 10px 8px 30px;
  background: var(--menu-item-bg);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: none;
}

.menu-item::before {
  content: "";
  position: absolute;
  left: 10px;
  width: 12px;
  text-align: center;
}

.menu-item.has-submenu::before {
  content: "▸";
  display: inline-block;
  color: var(--accent-strong);
  font-size: 0.78rem;
  transform-origin: center;
  transition: transform 220ms ease;
}

.submenu-toggle.is-open::before {
  transform: rotate(90deg);
}

.menu-item:hover {
  color: var(--ink);
  background: rgba(56, 189, 248, 0.2);
}

.menu-item.is-active {
  color: #071018;
  background: var(--accent);
}

#dark-mode-toggle.is-active {
  color: var(--menu-toggle-active-text);
  background: var(--menu-toggle-active-bg);
}

.menu-subpanel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  background: var(--menu-subpanel-bg);
}

.menu-subpanel[hidden] {
  display: none !important;
}

.menu-subpanel:not([hidden]) {
  animation: submenu-in 220ms ease-out;
}

.utility-menu:not(.is-open) .menu-subpanel {
  display: none !important;
}

@keyframes menu-panel-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes submenu-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   Panels + Chart
   ========================================================= */
.panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px 24px 28px;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, var(--panel-sheen-start), transparent 45%, var(--panel-sheen-end));
}

.chart-wrap {
  position: relative;
  z-index: 1;
}

.chart-overlay {
  pointer-events: none;
}

.chart-overlay-offhours {
  fill: rgba(99, 102, 241, 0.12);
}

.chart-overlay-holiday {
  fill: rgba(249, 115, 22, 0.24);
}

.chart-overlay-weekend {
  fill: rgba(56, 189, 248, 0.2);
}

.theme-light .chart-overlay-offhours {
  fill: rgba(79, 70, 229, 0.08);
}

.theme-light .chart-overlay-holiday {
  fill: rgba(249, 115, 22, 0.22);
}

.theme-light .chart-overlay-weekend {
  fill: rgba(14, 116, 144, 0.18);
}

.panel-empty-state {
  display: none;
  position: absolute;
  inset: 16px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: var(--empty-bg);
  backdrop-filter: blur(3px);
  color: var(--empty-text);
  text-shadow: var(--empty-text-shadow);
  font-size: clamp(1.16rem, 2.1vw, 1.46rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.panel-empty-state.is-visible {
  display: flex;
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.legend span {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25);
}

.legend .legend-swatch-accent {
  background: var(--accent);
}

.legend .legend-swatch-tone-1 {
  background: var(--trunk-1);
}

.legend .legend-swatch-tone-2 {
  background: var(--trunk-2);
}

.legend .legend-swatch-tone-3 {
  background: var(--trunk-3);
}

.legend .legend-swatch-tone-4 {
  background: var(--trunk-4);
}

.legend .legend-swatch-tone-5 {
  background: var(--trunk-5);
}

.legend .legend-swatch-tone-6 {
  background: var(--trunk-6);
}

.panel > #trunk-legend {
  margin-top: 14px;
  padding-left: 30px;
}

#trunk-legend {
  align-items: flex-start;
  gap: 8px 16px;
}

#trunk-legend-series {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.legend-help {
  color: var(--muted);
  font-size: 0.86rem;
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.glossary-term {
  border-bottom: 1px dotted rgba(226, 232, 240, 0.7);
  cursor: help;
}

.overlay-key-label {
  margin-left: 6px;
  color: var(--accent-strong);
  font-weight: 600;
}

.overlay-key-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
}

.overlay-key-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.overlay-key-holiday {
  background: rgba(249, 115, 22, 0.65);
}

.overlay-key-weekend {
  background: rgba(56, 189, 248, 0.55);
}

.overlay-key-offhours {
  background: rgba(99, 102, 241, 0.5);
}

.theme-light .overlay-key-item {
  background: rgba(255, 255, 255, 0.7);
}

/* =========================================================
   Stats Cards
   ========================================================= */
.stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.stat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: var(--stat-panel-height);
  padding: 18px;
  background: var(--stat-bg);
  border: 1px solid var(--stat-border);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 24px rgba(8, 12, 22, 0.35);
}

.stat h2 {
  margin: 0 0 6px;
  text-align: center;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stat p {
  margin: 0;
  text-align: center;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.stat-list {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.stat-list--single {
  margin-top: 0;
}

.stat-list--tight {
  margin-top: 4px;
}

.stat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.95rem;
}

.stat-line span {
  color: var(--ink);
  opacity: 0.92;
}

.stat-line strong {
  font-size: 1.05rem;
  font-weight: 700;
}

.stat-value-focus {
  margin: 0;
  text-align: center;
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.08;
  color: #fbbf24;
}

.stat-entry,
.peak-window-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  overflow: hidden;
}

.stat-entry--more {
  justify-content: center;
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.stat-entry--more .stat-entry-subject {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-light .stat-entry,
.theme-light .peak-window-card {
  background: rgba(226, 232, 240, 0.5);
  border-color: rgba(15, 23, 42, 0.08);
}

.stat-entry-subject,
.peak-window-time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Unbounded", "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.stat-entry-subject-wrap {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding-right: 8px;
}

.stat-entry-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.stat-tone-accent {
  color: var(--accent);
}

.stat-tone-1 {
  color: var(--trunk-1);
}

.stat-tone-2 {
  color: var(--trunk-2);
}

.stat-tone-3 {
  color: var(--trunk-3);
}

.stat-tone-4 {
  color: var(--trunk-4);
}

.stat-tone-5 {
  color: var(--trunk-5);
}

.stat-tone-6 {
  color: var(--trunk-6);
}

.peak-window-status-pill.status-stable {
  border-color: var(--trunk-4);
}

.peak-window-status-pill.status-at-risk {
  border-color: var(--chart-anomaly);
}

.peak-window-status-pill.status-blocked-calls {
  border-color: var(--chart-capacity-hit);
}

.peak-window-status-pill.status-stable .stat-entry-value {
  color: var(--trunk-4);
}

.peak-window-status-pill.status-at-risk .stat-entry-value {
  color: var(--chart-anomaly);
}

.peak-window-status-pill.status-blocked-calls .stat-entry-value {
  color: var(--chart-capacity-hit);
}

.stat-entry-badge,
.peak-window-status {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.theme-light .stat-entry-badge,
.theme-light .peak-window-status {
  background: rgba(255, 255, 255, 0.7);
}

.stat-entry-value,
.peak-window-label {
  font-family: "Unbounded", "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.peak-window-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-entry-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.peak-window-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
}

.peak-window-status-pill {
  justify-self: end;
  min-width: fit-content;
  white-space: nowrap;
}

.peak-window-icon,
.stat-entry-icon {
  font-size: 0.8rem;
  line-height: 1;
}

/* =========================================================
   Buttons
   ========================================================= */
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: var(--select-bg);
  color: var(--ink);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border 0.15s ease;
}

.pill-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(56, 189, 248, 0.18);
}


   Events Panel
   ========================================================= */
.events-panel {
  margin-top: 16px;
  padding: 18px 20px 20px;
}

.events-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.events-title {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.events-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.events-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.events-select {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 6px 28px 6px 8px;
  background: var(--select-bg);
  color: var(--ink);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aa7c2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px 8px;
}

.events-table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  background: var(--table-wrap-bg);
}

.events-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
}

.events-table th,
.events-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.92rem;
}

.events-table th {
  background: var(--table-head-bg);
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.events-table tbody tr:last-child td {
  border-bottom: 0;
}

.events-empty,
.events-page-info {
  color: var(--muted);
}

.events-page-info {
  font-size: 0.9rem;
}

.events-pagination {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pulse-alert {
  animation: alert-pulse 1.1s ease-out;
}

@keyframes alert-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.48);
    border-color: rgba(248, 113, 113, 0.75);
  }
  100% {
    box-shadow: 0 0 0 22px rgba(248, 113, 113, 0);
    border-color: var(--border);
  }
}

/* =========================================================
   Modal + About + Instructions Frame
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.65);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(560px, calc(100vw - 28px));
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.modal-backdrop.is-wide .modal-card {
  width: min(980px, calc(100vw - 28px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--accent-strong);
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--menu-item-bg);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
}

.modal-backdrop.is-diagnostics .modal-body {
  max-height: min(68vh, 620px);
  overflow-y: auto;
}

.modal-body p {
  margin: 0 0 8px;
}

.modal-body strong {
  color: var(--accent-strong);
}

.instructions-frame {
  width: 100%;
  height: min(72vh, 760px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.about-hero {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: linear-gradient(140deg, rgba(56, 189, 248, 0.16), rgba(15, 23, 42, 0.58));
}

.about-kicker {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.about-hero h3 {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 1rem;
}

.about-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.about-item {
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
}

.about-item .label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.about-item .value {
  color: var(--accent-strong);
  font-size: 0.86rem;
  line-height: 1.35;
  word-break: break-word;
}

.about-actions {
  margin-top: 10px;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 0.82rem;
}

.about-link:hover {
  background: rgba(56, 189, 248, 0.22);
}

.theme-light .about-item {
  background: rgba(241, 245, 249, 0.92);
}

.theme-light .about-link {
  background: rgba(255, 255, 255, 0.92);
}

/* =========================================================
   Accessibility
   ========================================================= */
:where(
  button,
  [role="button"],
  a,
  select,
  summary,
  .menu-item,
  .control-button,
  .pill-button,
  .range-select,
  .events-select,
  .hamburger-button,
  .modal-close
):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.pill-button--small {
  min-width: 78px;
  padding: 8px 10px;
}

.pill-button--compact {
  min-width: 96px;
  padding: 5px 10px;
}

.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.export-buttons a {
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: var(--select-bg);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (min-width: 720px) {
  .meta {
    white-space: nowrap;
  }
}

@media (min-width: 901px) {
  .menu-subpanel {
    position: static;
    right: auto;
    top: auto;
    min-width: 0;
    margin-top: 8px;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: var(--menu-subpanel-bg);
    box-shadow: none;
    z-index: auto;
  }
}

@media (max-width: 980px) {
  .controls-card {
    position: sticky;
    top: 8px;
    z-index: 25;
    flex-direction: column;
    align-items: flex-start;
    backdrop-filter: blur(10px);
  }
}

@media (max-width: 900px) {
  :root {
    --stat-panel-height: 162px;
  }

  main {
    padding: 20px 12px 12px;
  }

  header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    grid-template-areas:
      "title badge"
      "subtitle updated";
    margin-bottom: 8px;
  }

  .risk-badge {
    margin-top: 0;
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .hamburger-button {
    min-width: 40px;
    height: 40px;
    padding: 2px 4px;
    color: var(--accent-strong);
    font-size: 1.45rem;
  }

  .meta {
    font-size: 0.82rem;
  }

  .range-select {
    min-width: 108px;
    width: 108px;
    max-width: 108px;
    border-color: rgba(148, 163, 184, 0.5);
  }

  .control-button {
    padding: 0 10px;
    font-size: 0.85rem;
  }

  .controls-card {
    top: 4px;
    margin-top: 8px;
    margin-bottom: 10px;
    padding: 8px 9px;
    gap: 8px 10px;
  }

  .controls-row {
    gap: 8px 10px;
  }

  .controls-title {
    font-size: 0.72rem;
    margin-right: 2px;
  }

  .events-select {
    border-color: rgba(148, 163, 184, 0.5);
  }

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

  .stat {
    padding: 10px 9px;
    border-radius: 12px;
  }

  .stat h2 {
    font-size: 0.72rem;
    margin-bottom: 6px;
  }

  .stat-list {
    gap: 5px;
  }

  .stat-entry,
  .peak-window-card {
    padding: 4px 6px;
    margin-bottom: 4px;
    border-radius: 10px;
    align-items: center;
    flex-wrap: nowrap;
    row-gap: 0;
    white-space: nowrap;
    overflow: hidden;
  }

  .stat-entry-subject,
  .peak-window-time {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.05;
    font-size: 0.7rem;
  }

  .stat-entry-value,
  .peak-window-label {
    font-size: 0.7rem;
  }

  .stat-entry-badge,
  .peak-window-status {
    max-width: none;
  }

  .stat-entry-badges {
    flex: 0 0 auto;
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .stat-entry-value,
  .peak-window-label {
    white-space: nowrap;
  }

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

@media (max-width: 520px) {
  :root {
    --stat-panel-height: 154px;
  }

  main {
    padding: 14px 10px 10px;
  }

  header {
    grid-template-areas:
      "title badge"
      "updated badge";
    margin-bottom: 6px;
  }

  .header-subtitle {
    display: none;
  }

  .meta {
    font-size: 0.76rem;
  }

  .controls-title {
    display: none;
  }

  .stats {
    gap: 6px;
  }

  .stat {
    padding: 9px 8px;
    border-radius: 10px;
  }

  .stat h2 {
    font-size: 0.68rem;
    margin-bottom: 5px;
  }
}

