:root {
  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-hairline: rgba(15, 23, 42, 0.06);
  --border-strong: rgba(15, 23, 42, 0.14);

  --accent: #2563EB;
  --accent-hover: #1D4ED8;

  --ok-text: #047857;
  --ok-dot: #10B981;
  --ok-bar: #10B981;
  --ok-bar-hover: #059669;
  --ok-bg: #ECFDF5;
  --ok-border: rgba(5, 150, 105, 0.22);

  --warn-text: #B45309;
  --warn-dot: #F59E0B;
  --warn-bar: #F59E0B;
  --warn-bar-hover: #D97706;
  --warn-bg: #FFFBEB;
  --warn-border: rgba(217, 119, 6, 0.24);

  --err-text: #BE123C;
  --err-dot: #F43F5E;
  --err-bar: #F43F5E;
  --err-bar-hover: #E11D48;
  --err-bg: #FFF1F2;
  --err-border: rgba(225, 29, 72, 0.24);

  --maint-text: #1D4ED8;
  --maint-dot: #3B82F6;
  --maint-bg: #EFF6FF;
  --maint-border: rgba(37, 99, 235, 0.22);

  --nodata-bar: #E2E8F0;
  --nodata-bar-hover: #CBD5E1;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-tooltip: 0 10px 28px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02" 1, "cv03" 1, "cv04" 1, "ss01" 1;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
}

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

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Half-Half horizontal logo balance: icon 32px (2x), text 16px (1x), gap 8px (0.5x) */
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
  gap: 8px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-flex;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-wordmark {
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand-divider {
  width: 1px;
  height: 16px;
  background: var(--border-strong);
  margin: 0 4px;
}

.brand-section {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 140ms var(--ease-out-expo),
              color 140ms var(--ease-out-expo),
              transform 120ms var(--ease-out-expo),
              box-shadow 140ms var(--ease-out-expo);
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn:active {
  transform: scale(0.97);
}

.seg-btn.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 150ms var(--ease-out-expo),
              color 150ms var(--ease-out-expo),
              transform 120ms var(--ease-out-expo);
}

.header-link:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.header-link:active {
  transform: scale(0.97);
}

/* Main Layout */
.main-content {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Hero Banner */
.hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-card.status-operational {
  border-top: 3px solid var(--ok-dot);
}

.hero-card.status-degraded {
  border-top: 3px solid var(--warn-dot);
}

.hero-card.status-outage {
  border-top: 3px solid var(--err-dot);
}

.hero-card.status-maintenance {
  border-top: 3px solid var(--maint-dot);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-headline-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.live-indicator {
  position: relative;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok-dot);
  position: relative;
  z-index: 1;
}

.live-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ok-dot);
  opacity: 0.28;
  animation: gentle-pulse 2.6s var(--ease-out-expo) infinite;
}

.status-degraded .live-dot,
.status-degraded .live-ping {
  background: var(--warn-dot);
}

.status-outage .live-dot,
.status-outage .live-ping {
  background: var(--err-dot);
}

.status-maintenance .live-dot,
.status-maintenance .live-ping {
  background: var(--maint-dot);
}

@keyframes gentle-pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.36;
  }
  70% {
    transform: scale(1.75);
    opacity: 0;
  }
  100% {
    transform: scale(1.75);
    opacity: 0;
  }
}

.hero-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.3vw, 1.625rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
  white-space: nowrap;
}

.status-degraded .hero-pill {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.status-outage .hero-pill {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: var(--err-border);
}

.status-maintenance .hero-pill {
  background: var(--maint-bg);
  color: var(--maint-text);
  border-color: var(--maint-border);
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border-hairline);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.hero-timestamps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hero-timestamps strong {
  font-weight: 600;
  color: var(--text-primary);
}

.meta-sep {
  color: #CBD5E1;
  user-select: none;
}

.hero-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 150ms var(--ease-out-expo),
              color 150ms var(--ease-out-expo),
              transform 120ms var(--ease-out-expo);
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.97);
}

.icon-btn.is-spinning svg {
  animation: spin 600ms linear infinite;
}

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

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.kpi-value.is-ok {
  color: var(--ok-text);
}

.kpi-value.is-warn {
  color: var(--warn-text);
}

.kpi-value.is-err {
  color: var(--err-text);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Section Headers */
.section-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.section-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Unified Components Card */
.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.components-list {
  display: flex;
  flex-direction: column;
}

.component-row {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.component-row + .component-row {
  border-top: 1px solid var(--border-hairline);
}

.component-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.component-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.component-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.component-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.domain-tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 1px 7px;
  line-height: 1.5;
}

.component-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.component-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.metric-chip {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.metric-uptime {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.is-operational {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}

.status-badge.is-degraded {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.status-badge.is-outage {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: var(--err-border);
}

.status-badge.is-maintenance {
  background: var(--maint-bg);
  color: var(--maint-text);
  border-color: var(--maint-border);
}

/* Interactive Status Bars */
.bars-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bars-track {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 30px;
  width: 100%;
}

.bars-track.is-30 {
  gap: 4px;
}

.day-bar {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0;
  border-radius: 3px;
  background: var(--nodata-bar);
  cursor: pointer;
  transition: transform 140ms var(--ease-out-expo),
              background-color 140ms var(--ease-out-expo),
              opacity 140ms var(--ease-out-expo);
}

.day-bar:hover,
.day-bar:focus-visible {
  transform: scaleY(1.12);
  outline: none;
}

.day-bar.is-operational {
  background: var(--ok-bar);
}

.day-bar.is-operational:hover,
.day-bar.is-operational:focus-visible {
  background: var(--ok-bar-hover);
}

.day-bar.is-degraded {
  background: var(--warn-bar);
}

.day-bar.is-degraded:hover,
.day-bar.is-degraded:focus-visible {
  background: var(--warn-bar-hover);
}

.day-bar.is-outage {
  background: var(--err-bar);
}

.day-bar.is-outage:hover,
.day-bar.is-outage:focus-visible {
  background: var(--err-bar-hover);
}

.day-bar.is-no_data {
  background: var(--nodata-bar);
}

.day-bar.is-no_data:hover,
.day-bar.is-no_data:focus-visible {
  background: var(--nodata-bar-hover);
}

.bars-axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Legend Bar */
.legend-bar {
  padding: 13px 24px;
  border-top: 1px solid var(--border-hairline);
  background: #FAFBFD;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 8px;
  height: 14px;
  border-radius: 2.5px;
  display: inline-block;
}

.swatch-operational {
  background: var(--ok-bar);
}

.swatch-degraded {
  background: var(--warn-bar);
}

.swatch-outage {
  background: var(--err-bar);
}

.swatch-nodata {
  background: var(--nodata-bar);
}

/* Incidents */
.incidents-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-incidents {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-secondary);
}

.empty-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empty-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.incident-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.incident-card.sev-major {
  border-left: 3px solid var(--err-dot);
}

.incident-card.sev-minor {
  border-left: 3px solid var(--warn-dot);
}

.incident-card.sev-maintenance {
  border-left: 3px solid var(--maint-dot);
}

.incident-card.is-resolved {
  border-left: 3px solid var(--ok-dot);
}

.incident-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.incident-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.incident-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.incident-body {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  white-space: pre-line;
}

.incident-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-hairline);
  font-size: 12px;
  color: var(--text-muted);
}

.affected-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.affected-tag {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
}

/* Tooltip (Emil Kowalski ease-out + scale(0.95) -> 1) */
.day-tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: #0F172A;
  color: #F8FAFC;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 196px;
  max-width: 260px;
  box-shadow: var(--shadow-tooltip);
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  transform: translate3d(0, 4px, 0) scale(0.95);
  transition: opacity 160ms var(--ease-out-expo),
              transform 160ms var(--ease-out-expo);
  visibility: hidden;
}

.day-tooltip.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  visibility: visible;
}

.tt-date {
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.tt-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 6px;
}

.tt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.tt-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #CBD5E1;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.tt-row strong {
  color: #F8FAFC;
  font-weight: 600;
}

.tt-nodata {
  color: #94A3B8;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.footer-inner {
  padding-top: 20px;
  padding-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-left,
.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-brand {
  font-weight: 600;
  color: var(--text-primary);
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 140ms var(--ease-out-expo);
}

.footer-links a:hover {
  color: var(--accent);
}

/* Responsive (mobile 390x844 and small tablets) */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .main-content {
    padding-top: 20px;
    padding-bottom: 40px;
    gap: 20px;
  }

  .hero-card {
    padding: 18px 18px;
  }

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

  .kpi-card {
    padding: 14px 16px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .component-row {
    padding: 16px 18px;
  }

  .component-header {
    flex-direction: column;
    gap: 10px;
  }

  .component-metrics {
    width: 100%;
    justify-content: space-between;
  }

  .legend-bar {
    padding: 12px 18px;
    gap: 12px;
  }

  .header-link span {
    display: none;
  }

  .header-link {
    padding: 0 9px;
  }
}

@media (max-width: 420px) {
  .brand-divider,
  .brand-section {
    display: none;
  }

  .hero-pill {
    font-size: 12px;
    padding: 5px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
