/* WAVE Status Page - Minimal, performant CSS */
/* Target: <10KB total page size for instant loading */

:root {
  --color-bg: oklch(13% 0 0);
  --color-surface: oklch(18% 0 0);
  --color-border: oklch(25% 0 0);
  --color-text: oklch(98% 0 0);
  --color-text-muted: oklch(70% 0 0);
  --color-operational: oklch(75% 0.18 145);
  --color-degraded: oklch(75% 0.15 85);
  --color-partial: oklch(70% 0.18 50);
  --color-major: oklch(65% 0.22 25);
  --color-primary: oklch(70% 0.15 250);
  --color-maintenance: oklch(70% 0.1 260);
  /* WAVE brand gradient (6-color signature) */
  --wave-gradient: linear-gradient(90deg, oklch(78% 0.11 195), oklch(74% 0.12 168), oklch(70% 0.15 125), oklch(87% 0.14 90), oklch(70% 0.18 40), oklch(62% 0.20 5));
  --radius: 8px;
  --max-width: 800px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-text);
  margin: 0;
}

.logo svg {
  width: 32px;
  height: 32px;
}

/* WAVE Brand Gradient Line */
.brand-line {
  height: 3px;
  background: var(--wave-gradient);
  border-radius: 2px;
  margin-bottom: 2rem;
  animation: shimmer 3s ease-in-out infinite;
  background-size: 200% 100%;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--color-border);
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: oklch(65% 0.15 250);
}

.btn-icon {
  padding: 0.5rem;
  line-height: 1;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

/* Overall Status Banner */
.status-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.status-banner[data-status="operational"] { border-color: var(--color-operational); }
.status-banner[data-status="degraded"] { border-color: var(--color-degraded); }
.status-banner[data-status="partial"] { border-color: var(--color-partial); }
.status-banner[data-status="major"] { border-color: var(--color-major); }

.status-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

.status-icon[data-status="operational"] { background: var(--color-operational); }
.status-icon[data-status="degraded"] { background: var(--color-degraded); animation-duration: 1.5s; }
.status-icon[data-status="partial"] { background: var(--color-partial); animation-duration: 1s; }
.status-icon[data-status="major"] { background: var(--color-major); animation-duration: 0.75s; }

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px transparent; }
}

.status-text h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.status-text p {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Status Metrics */
.status-metrics {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.metric-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Regional Status */
.region-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.region-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.region-badges {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.region-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.region-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.region-dot[data-status="operational"] { background: var(--color-operational); }
.region-dot[data-status="degraded"] { background: var(--color-degraded); }
.region-dot[data-status="partial"] { background: var(--color-partial); }
.region-dot[data-status="major"] { background: var(--color-major); }

/* Stale Data Warning */
.stale-warning {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: oklch(30% 0.08 85);
  border: 1px solid oklch(50% 0.12 85);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  color: oklch(85% 0.1 85);
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Maintenance Section */
.maintenance-section {
  background: var(--color-surface);
  border: 1px solid var(--color-maintenance);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.maintenance-header {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  color: var(--color-maintenance);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.maintenance-card {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.maintenance-card:last-child {
  border-bottom: none;
}

.maintenance-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.maintenance-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.maintenance-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.maintenance-time {
  font-size: 0.8rem;
  color: var(--color-maintenance);
  font-weight: 500;
}

/* Service Groups */
.service-groups {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.services-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
}

.component-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.group-count {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  background: oklch(22% 0 0);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.incident-count-badge {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--color-major);
  color: var(--color-text);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 0.35rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.loading-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
}

.service-group {
  border-bottom: 1px solid var(--color-border);
}

.service-group:last-child {
  border-bottom: none;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.group-header:hover {
  background: oklch(20% 0 0);
}

.group-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.group-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--color-text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.group-chevron.expanded {
  transform: rotate(90deg);
}

.group-name {
  font-weight: 500;
}

.uptime-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: oklch(22% 0 0);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

/* Uptime History Bars */
.uptime-bars {
  display: flex;
  gap: 1px;
  padding: 0 1.5rem 0.75rem;
  align-items: flex-end;
}

.uptime-bar {
  flex: 1;
  height: 28px;
  border-radius: 2px;
  position: relative;
  min-width: 2px;
  cursor: default;
}

.uptime-bar[data-level="good"] { background: var(--color-operational); }
.uptime-bar[data-level="mild"] { background: var(--color-degraded); }
.uptime-bar[data-level="warn"] { background: var(--color-partial); }
.uptime-bar[data-level="bad"] { background: var(--color-major); }

.uptime-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: oklch(25% 0 0);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  line-height: 1.3;
  text-align: center;
}

.uptime-bar:hover .uptime-tooltip {
  display: block;
}

/* Group Components (expandable) */
.group-components {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.group-components.expanded {
  max-height: 500px;
  transition: max-height 0.3s ease-in;
}

/* Group Icons */
.group-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: color 0.2s;
}

.group-icon[data-status="operational"] { color: var(--color-operational); }
.group-icon[data-status="degraded"] { color: var(--color-degraded); }
.group-icon[data-status="partial"] { color: var(--color-partial); }
.group-icon[data-status="major"] { color: var(--color-major); }

/* Component Items (inside dropdown) */
.component-item {
  padding-left: 3rem;
  border-bottom: none;
  border-top: 1px solid oklch(22% 0 0);
  transition: background 0.15s;
}

.component-item:hover {
  background: oklch(17% 0 0);
}

.component-item:last-child {
  border-bottom: none;
}

.comp-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* Status icons in component list */
.comp-status-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.comp-status-icon[data-status="operational"] { color: var(--color-operational); }
.comp-status-icon[data-status="degraded"] { color: var(--color-degraded); }
.comp-status-icon[data-status="partial"] { color: var(--color-partial); }
.comp-status-icon[data-status="major"] { color: var(--color-major); }

.status-check {
  animation: checkPop 0.3s ease-out;
}

@keyframes checkPop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Service Item (reused in groups and flat) */
.service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
}

.service-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.service-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.service-status-text {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-dot[data-status="operational"] { background: var(--color-operational); }
.service-dot[data-status="degraded"] { background: var(--color-degraded); }
.service-dot[data-status="partial"] { background: var(--color-partial); }
.service-dot[data-status="major"] { background: var(--color-major); }

/* Affected Service Badges */
.affected-services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.affected-badge {
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  background: oklch(22% 0 0);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* Incidents */
.incidents {
  margin-bottom: 2rem;
}

.incidents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.incidents-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.incident-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.incident-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.incident-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.severity-indicator[data-severity="minor"] { background: var(--color-degraded); }
.severity-indicator[data-severity="major"] { background: var(--color-partial); }
.severity-indicator[data-severity="critical"] { background: var(--color-major); }

.incident-title {
  font-weight: 600;
}

.incident-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.incident-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
  text-transform: uppercase;
}

.incident-badge[data-status="investigating"] { background: var(--color-major); }
.incident-badge[data-status="identified"] { background: var(--color-partial); }
.incident-badge[data-status="monitoring"] { background: var(--color-degraded); }
.incident-badge[data-status="resolved"] { background: var(--color-operational); }

.incident-duration {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.incident-card .affected-services {
  margin-bottom: 0.5rem;
}

.incident-updates {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.incident-update {
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--color-border);
}

.incident-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.no-incidents {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.no-incidents-sub {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  opacity: 0.7;
}

/* Subscribe Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 80%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
}

.modal h3 {
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Subscribe Options */
.subscribe-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subscribe-option {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s;
}

.subscribe-option:hover {
  border-color: var(--color-primary);
}

.subscribe-option-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.subscribe-option-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.subscribe-form {
  display: flex;
  gap: 0.5rem;
}

.subscribe-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.85rem;
}

.subscribe-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* History Page Styles */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 2rem;
}

.calendar-day-label {
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  padding: 0.25rem;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  min-height: 24px;
  transition: opacity 0.15s;
}

.calendar-day:hover {
  opacity: 0.8;
}

.calendar-day.active {
  outline: 2px solid var(--color-text);
  outline-offset: 1px;
}

.calendar-day[data-status="operational"] { background: var(--color-operational); }
.calendar-day[data-status="degraded"] { background: var(--color-degraded); }
.calendar-day[data-status="partial"] { background: var(--color-partial); }
.calendar-day[data-status="major"] { background: var(--color-major); }
.calendar-day[data-status="none"] { background: oklch(22% 0 0); }

.calendar-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: oklch(25% 0 0);
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 10;
}

.calendar-day:hover .calendar-tooltip {
  display: block;
}

.month-group {
  margin-bottom: 2rem;
}

.month-header {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.day-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.day-detail-header {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.footer-brand {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.footer a {
  color: var(--color-text);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .status-banner {
    flex-direction: column;
    text-align: center;
  }

  .status-metrics {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .region-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .subscribe-form {
    flex-direction: column;
  }

  .service-item {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .group-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .group-header-left {
    width: 100%;
  }

  .component-item {
    padding-left: 1.5rem;
  }

  .uptime-bars {
    padding: 0 1rem 0.75rem;
  }

  .uptime-bar {
    height: 20px;
  }

  .incident-header {
    flex-direction: column;
  }

  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    min-height: 18px;
  }
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, oklch(18% 0 0) 25%, oklch(22% 0 0) 50%, oklch(18% 0 0) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

.skeleton-banner { height: 100px; margin-bottom: 1.5rem; }
.skeleton-region { height: 44px; margin-bottom: 1.5rem; }
.skeleton-group { height: 56px; margin-bottom: 1px; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Expand All Button */
.expand-all-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-muted);
  transition: color 0.15s, border-color 0.15s;
}

.expand-all-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

/* Keyboard Shortcuts Overlay */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.shortcuts-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.shortcuts-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  max-width: 360px;
  width: 90vw;
}

.shortcuts-card h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  font-size: 0.875rem;
}

.shortcut-key {
  background: oklch(25% 0 0);
  border: 1px solid oklch(35% 0 0);
  border-radius: 4px;
  padding: 0.125rem 0.5rem;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Loading state + transitions */
.loading {
  min-height: 100vh;
}

#app.loaded {
  animation: fadeIn 0.3s ease-in;
}

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

#app:not(.loading) > .loading-indicator {
  display: none;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  background: oklch(30% 0.12 145);
  border: 1px solid oklch(50% 0.15 145);
  color: oklch(90% 0.1 145);
}

.toast-error {
  background: oklch(30% 0.12 25);
  border: 1px solid oklch(50% 0.15 25);
  color: oklch(90% 0.1 25);
}

/* Light Theme - uses [data-theme] for higher specificity than :root */
html.light, html.light:root {
  --color-bg: oklch(98% 0 0) !important;
  --color-surface: oklch(100% 0 0) !important;
  --color-border: oklch(88% 0 0) !important;
  --color-text: oklch(15% 0 0) !important;
  --color-text-muted: oklch(45% 0 0) !important;
}

html.light body {
  background: oklch(98% 0 0);
  color: oklch(15% 0 0);
}

html.light .group-header:hover {
  background: oklch(95% 0 0);
}

html.light .group-count {
  background: oklch(92% 0 0);
}

html.light .component-item:hover {
  background: oklch(96% 0 0);
}

html.light .component-item {
  border-top-color: oklch(92% 0 0);
}

html.light .modal {
  background: oklch(100% 0 0);
  border-color: oklch(88% 0 0);
}

html.light .modal-overlay {
  background: oklch(0% 0 0 / 30%);
}

html.light .shortcuts-card,
html.light .cmd-palette {
  background: oklch(100% 0 0);
  border-color: oklch(88% 0 0);
}

html.light .shortcut-key {
  background: oklch(95% 0 0);
  border-color: oklch(85% 0 0);
  color: oklch(40% 0 0);
}

html.light .stale-warning {
  background: oklch(95% 0.06 85);
  border-color: oklch(80% 0.1 85);
  color: oklch(35% 0.08 85);
}

html.light .toast-success {
  background: oklch(95% 0.08 145);
  border-color: oklch(80% 0.1 145);
  color: oklch(30% 0.08 145);
}

html.light .toast-error {
  background: oklch(95% 0.08 25);
  border-color: oklch(80% 0.1 25);
  color: oklch(30% 0.08 25);
}

html.light .skeleton {
  background: linear-gradient(90deg, oklch(95% 0 0) 25%, oklch(90% 0 0) 50%, oklch(95% 0 0) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Button primary hover in light */
html.light .btn-primary:hover {
  background: oklch(60% 0.15 250);
}

/* Stale warning in light */
html.light .stale-warning {
  background: oklch(95% 0.06 85);
  border-color: oklch(85% 0.1 85);
  color: oklch(35% 0.08 85);
}

/* Uptime bars, incident badges, maintenance, service items */
html.light .incident-badge[data-status] {
  border-color: oklch(85% 0 0);
}

html.light .no-incidents {
  color: oklch(50% 0 0);
}

html.light .affected-badge {
  background: oklch(94% 0 0);
  border-color: oklch(85% 0 0);
  color: oklch(35% 0 0);
}

html.light .footer {
  color: oklch(50% 0 0);
}

html.light .footer a {
  color: oklch(45% 0.1 250);
}

/* Calendar in light */
html.light .calendar-day[data-status="none"] {
  background: oklch(94% 0 0);
}

html.light .calendar-tooltip,
html.light .uptime-tooltip {
  background: oklch(100% 0 0);
  border-color: oklch(85% 0 0);
  color: oklch(20% 0 0);
}

/* Overlays in light */
html.light .shortcuts-overlay {
  background: oklch(0% 0 0 / 30%);
}

html.light .cmd-palette-overlay {
  background: oklch(0% 0 0 / 25%);
}

html.light .cmd-palette {
  box-shadow: 0 16px 48px oklch(0% 0 0 / 15%);
}

/* Incident timeline in light */
html.light .timeline-dot {
  border-color: oklch(85% 0 0);
  background: oklch(92% 0 0);
}

html.light .timeline-track {
  background: oklch(88% 0 0);
}

/* Status banner in light */
html.light .status-banner {
  background: oklch(100% 0 0);
}

/* Service groups in light */
html.light .service-groups {
  background: oklch(100% 0 0);
}

/* Maintenance in light */
html.light .maintenance-section {
  background: oklch(100% 0 0);
}

/* Region bar in light */
html.light .region-bar {
  background: oklch(100% 0 0);
}

/* Subscribe form input */
html.light input[type="email"],
html.light input[type="url"] {
  background: oklch(98% 0 0);
  border-color: oklch(85% 0 0);
  color: oklch(15% 0 0);
}

/* Incident Timeline Progress */
.incident-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.75rem 0;
  position: relative;
  margin: 0.5rem 0;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  z-index: 1;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-border);
  transition: all 0.3s;
}

.timeline-step.active .timeline-dot {
  background: var(--color-operational);
  border-color: var(--color-operational);
}

.timeline-step.current .timeline-dot {
  background: var(--color-degraded);
  border-color: var(--color-degraded);
  box-shadow: 0 0 0 4px oklch(75% 0.15 85 / 20%);
  animation: pulse 2s ease-in-out infinite;
}

.timeline-step.active.current:last-child .timeline-dot {
  background: var(--color-operational);
  border-color: var(--color-operational);
  box-shadow: 0 0 0 4px oklch(75% 0.18 145 / 20%);
  animation: none;
}

.timeline-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.timeline-step.active .timeline-label {
  color: var(--color-text);
}

.timeline-track {
  position: absolute;
  top: calc(0.75rem + 5px);
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.timeline-progress {
  height: 100%;
  background: var(--wave-gradient);
  border-radius: 1px;
  transition: width 0.5s ease;
}

/* Deep-link highlight */
.incident-card.highlight {
  outline: 2px solid oklch(70% 0.15 250);
  outline-offset: 2px;
  animation: highlightFade 2s ease-out;
}

@keyframes highlightFade {
  0% { outline-color: oklch(70% 0.15 250); }
  100% { outline-color: transparent; }
}

/* Command Palette */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 60%);
  display: flex;
  justify-content: center;
  padding-top: 20vh;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.cmd-palette-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.cmd-palette {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  width: 90vw;
  max-width: 480px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px oklch(0% 0 0 / 40%);
  align-self: flex-start;
}

.cmd-input {
  padding: 0.875rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 1rem;
  outline: none;
  font-family: inherit;
}

.cmd-input::placeholder {
  color: var(--color-text-muted);
}

.cmd-results {
  overflow-y: auto;
  flex: 1;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.1s;
}

.cmd-item:hover, .cmd-item.selected {
  background: oklch(22% 0 0);
}

html.light .cmd-item:hover, html.light .cmd-item.selected {
  background: oklch(95% 0 0);
}

.cmd-footer {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Sparkline */
.sparkline {
  vertical-align: middle;
  margin-left: 0.375rem;
  opacity: 0.6;
}

/* Wave gradient accent on footer */
.footer::before {
  content: '';
  display: block;
  height: 2px;
  background: var(--wave-gradient);
  margin-bottom: 1.5rem;
  border-radius: 1px;
  opacity: 0.5;
}

/* Button disabled state */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Improved focus styles for accessibility */
.btn:focus-visible,
[data-group-toggle]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skip to content link for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.sr-only:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: auto;
  height: auto;
  padding: 0.75rem 1.5rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  color: var(--color-text);
  z-index: 10001;
  font-size: 0.875rem;
}
