:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f6f7f9;
  --surface-active: #eff0f3;
  --text: #1d2028;
  --muted: #737b91;
  --faint: #a7adba;
  --border: #e3e5ea;
  --border-strong: #d7dae2;
  --green: #059669;
  --green-soft: #d9f1e8;
  --amber: #d97706;
  --amber-soft: #fef0d5;
  --red: #dc3f4d;
  --red-soft: #fde4e7;
  --blue: #4274d8;
  --blue-soft: #e7edfb;
  --shadow: 0 7px 24px rgba(26, 31, 44, 0.06);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #111318;
  --surface: #171a20;
  --surface-soft: #1d2027;
  --surface-active: #252932;
  --text: #f4f5f7;
  --muted: #a8afc0;
  --faint: #737b8e;
  --border: #2b2f38;
  --border-strong: #373c47;
  --green: #24b887;
  --green-soft: #163a30;
  --amber: #f3a531;
  --amber-soft: #3c2d17;
  --red: #f16670;
  --red-soft: #402128;
  --blue: #78a0ee;
  --blue-soft: #223152;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --page: #111318;
    --surface: #171a20;
    --surface-soft: #1d2027;
    --surface-active: #252932;
    --text: #f4f5f7;
    --muted: #a8afc0;
    --faint: #737b8e;
    --border: #2b2f38;
    --border-strong: #373c47;
    --green: #24b887;
    --green-soft: #163a30;
    --amber: #f3a531;
    --amber-soft: #3c2d17;
    --red: #f16670;
    --red-soft: #402128;
    --blue: #78a0ee;
    --blue-soft: #223152;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--page); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { display: block; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.shell { width: min(1080px, calc(100% - 40px)); margin-inline: auto; }

.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 14px; border-radius: 8px; background: var(--text); color: var(--page); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { border-top: 3px solid #263d48; background: var(--page); }
.header-inner { min-height: 82px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr); align-items: center; gap: 18px; }
.brand { width: 138px; justify-self: start; display: inline-flex; align-items: center; text-decoration: none; }
.brand img { display: block; width: 100%; height: auto; object-fit: contain; }
.primary-nav { justify-self: center; display: flex; align-items: center; gap: 7px; }
.nav-link { padding: 9px 12px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.nav-link:hover { color: var(--text); background: var(--surface-soft); }
.nav-link.is-active { color: var(--text); background: var(--surface-active); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 6px; }
.menu-wrap { position: relative; }
.control-button, .updates-button { min-height: 38px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer; box-shadow: 0 1px 2px rgba(25, 30, 40, 0.04); }
.control-button { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; }
.control-button > svg:first-child { width: 16px; height: 16px; color: var(--muted); }
.control-button .chevron { width: 13px; height: 13px; color: var(--faint); }
.updates-button { padding: 0 13px; }
.control-button:hover, .updates-button:hover { background: var(--surface-soft); border-color: var(--faint); }
.selection-menu { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; min-width: 176px; padding: 7px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.selection-menu[hidden] { display: none; }
.selection-menu button { width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.selection-menu button:hover, .selection-menu button[aria-checked="true"] { background: var(--surface-active); }
.selection-menu button[aria-checked="true"]::after { content: "✓"; float: right; color: var(--green); font-weight: 800; }

.page-shell { padding-bottom: 64px; }
.page-loading { min-height: 420px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-hero { min-height: 224px; display: flex; align-items: center; justify-content: center; text-align: center; }
.hero-inner { padding: 38px 20px 32px; }
.hero-state-icon { width: 50px; height: 50px; margin: 0 auto 16px; border: 5px solid var(--green-soft); border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; }
.hero-state-icon svg { width: 25px; height: 25px; stroke-width: 3; }
.status-hero[data-status="degraded"] .hero-state-icon, .status-hero[data-status="maintenance"] .hero-state-icon { background: var(--amber); border-color: var(--amber-soft); }
.status-hero[data-status="partial_outage"] .hero-state-icon, .status-hero[data-status="major_outage"] .hero-state-icon { background: var(--red); border-color: var(--red-soft); }
.status-hero h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1.1; letter-spacing: -0.04em; }
.status-hero p { margin: 15px 0 0; color: var(--muted); font-size: clamp(14px, 1.8vw, 16px); }

.current-section { max-width: 940px; margin: 30px auto 0; }
.service-groups { display: grid; gap: 16px; }
.service-group { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.group-header { min-height: 58px; padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.group-header h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--surface-active); color: var(--text); font-size: 14px; white-space: nowrap; }
.state-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: var(--faint); }
.state-up, .state-operational { background: var(--green); }
.state-maintenance, .state-degraded, .state-issue { background: var(--amber); }
.state-partial_outage, .state-major_outage { background: var(--red); }
.component { padding: 20px; }
.component + .component { border-top: 1px solid var(--border); }
.component-heading { margin-bottom: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.component-name { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 650; }
.component-description { margin: 6px 0 0 22px; color: var(--muted); font-size: 14px; }
.uptime-value { color: var(--green); font-size: 15px; font-weight: 650; white-space: nowrap; }
.uptime-chart { position: relative; }
.uptime-strip { height: 42px; display: grid; grid-template-columns: repeat(90, minmax(2px, 1fr)); gap: 2px; }
.uptime-cell { position: relative; display: block; min-width: 0; height: 100%; border: 0; border-radius: 3px; background: var(--border); padding: 0; color: inherit; cursor: help; }
.uptime-cell-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; color: inherit; cursor: pointer; }
.uptime-cell[data-status="operational"] { background: var(--green); }
.uptime-cell[data-status="maintenance"] { background: var(--blue); }
.uptime-cell[data-status="degraded"] { background: var(--amber); }
.uptime-cell[data-status="partial_outage"], .uptime-cell[data-status="major_outage"] { background: var(--red); }
.uptime-cell.is-tooltip-open, .uptime-cell:focus-visible, .uptime-cell:focus-within { z-index: 5; outline: 3px solid color-mix(in srgb, var(--text) 22%, transparent); outline-offset: 1px; }
.day-tooltip { position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 13px); width: max-content; min-width: 480px; max-width: min(560px, calc(100vw - 40px)); transform: translateX(-50%); border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-align: left; text-decoration: none; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 120ms ease, visibility 120ms ease; }
.day-tooltip.is-interactive { pointer-events: auto; cursor: pointer; }
.day-tooltip.is-interactive::after { content: ""; position: absolute; top: 100%; right: 0; left: 0; height: 14px; }
.uptime-cell.is-tooltip-open .day-tooltip, .uptime-cell:focus-visible .day-tooltip, .uptime-cell:focus-within .day-tooltip { opacity: 1; visibility: visible; }
.uptime-cell:nth-child(-n+14) .day-tooltip { left: 0; transform: none; }
.uptime-cell:nth-last-child(-n+14) .day-tooltip { right: 0; left: auto; transform: none; }
.tooltip-date { display: block; padding: 13px 17px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 14px; font-weight: 600; }
.tooltip-state { min-height: 62px; padding: 16px 17px; display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 620; }
.tooltip-state > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tooltip-state small { flex: 0 0 auto; margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.uptime-axis { margin-top: 12px; display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }

.page-heading { max-width: 940px; margin: 46px auto 26px; }
.back-link { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 28px; color: var(--muted); font-weight: 600; text-decoration: none; }
.back-link svg { width: 18px; height: 18px; }
.back-link:hover { color: var(--text); }
.page-heading h1 { margin: 0; font-size: clamp(30px, 4vw, 40px); letter-spacing: -0.04em; }
.page-heading p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.list-stack { max-width: 940px; margin: 0 auto; display: grid; gap: 15px; }
.empty-card { padding: 58px 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--muted); text-align: center; }
.empty-card .hero-state-icon { width: 48px; height: 48px; margin-bottom: 16px; border-width: 4px; }
.empty-card h2 { margin: 0; color: var(--text); font-size: 20px; }
.empty-card p { margin: 8px 0 0; }
.incident-card, .maintenance-card { padding: 24px 26px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; }
a.incident-card:hover { border-color: var(--faint); transform: translateY(-1px); }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-topline h2 { margin: 0; font-size: 20px; }
.card-meta { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 9px 18px; color: var(--muted); font-size: 14px; }
.card-message { margin: 18px 0 0; color: var(--muted); line-height: 1.65; }
.state-label { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 700; }
.state-label.active { background: var(--amber-soft); color: var(--amber); }
.state-label.scheduled { background: var(--blue-soft); color: var(--blue); }

.incident-detail { max-width: 940px; margin: 48px auto 0; }
.incident-summary { border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.incident-summary-head { padding: 40px 44px; }
.incident-summary-head h1 { margin: 14px 0 10px; font-size: clamp(32px, 5vw, 44px); letter-spacing: -0.035em; }
.incident-summary-head p { margin: 0; color: var(--muted); }
.affected-row { padding: 23px 44px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 15px; color: var(--muted); }
.affected-chip { padding: 6px 10px; border-radius: 999px; background: var(--surface-active); color: var(--text); font-size: 14px; }
.incident-timeline { padding: 42px 44px; border-top: 1px solid var(--border); background: var(--surface-soft); }
.timeline-entry { position: relative; margin-left: 12px; padding: 0 0 28px 36px; border-left: 1px solid var(--border-strong); }
.timeline-entry:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline-marker { position: absolute; top: 19px; left: -8px; width: 15px; height: 15px; border: 3px solid var(--surface-soft); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.timeline-entry:not(:first-child) .timeline-marker { background: var(--surface); box-shadow: 0 0 0 1px var(--faint); }
.timeline-box { padding: 21px 24px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: 0 3px 12px rgba(25, 30, 40, 0.04); }
.timeline-box-header { display: flex; flex-wrap: wrap; gap: 8px 14px; font-weight: 650; }
.timeline-box-header time { color: var(--muted); font-weight: 500; }
.timeline-box p { margin: 15px 0 0; color: var(--muted); line-height: 1.6; }

.connection-banner { position: fixed; z-index: 40; right: 20px; bottom: 20px; max-width: 390px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.connection-banner[hidden] { display: none; }

.subscribe-dialog { width: min(580px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 16px; background: transparent; color: var(--text); }
.subscribe-dialog::backdrop { background: rgba(10, 12, 16, 0.55); backdrop-filter: blur(2px); }
.dialog-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22); overflow: hidden; }
.dialog-header { padding: 25px 26px 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-header h2 { margin: 0; font-size: 24px; }
.dialog-header p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.dialog-close { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--muted); cursor: pointer; }
.dialog-close svg { width: 18px; height: 18px; }
.subscription-list { padding: 0 14px 14px; display: grid; gap: 8px; }
.subscription-option { min-height: 72px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; display: grid; grid-template-columns: 44px 1fr 18px; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.subscription-option:hover { background: var(--surface-soft); border-color: var(--faint); }
.email-subscription { padding: 13px; border: 1px solid var(--border); border-radius: 11px; display: grid; grid-template-columns: 44px 1fr; align-items: start; gap: 12px; }
.email-subscription-content strong, .email-subscription-content small { display: block; }
.email-subscription-content small { margin-top: 4px; color: var(--muted); line-height: 1.35; }
.email-subscription-fields { margin-top: 11px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.email-subscription-fields input { min-width: 0; height: 40px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.email-subscription-fields input:focus { outline: 2px solid color-mix(in srgb, var(--blue) 34%, transparent); outline-offset: 1px; border-color: var(--blue); }
.email-subscription-fields button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--text); color: var(--page); font-weight: 700; cursor: pointer; }
.email-subscription-fields button:disabled { opacity: .62; cursor: wait; }
.form-honeypot { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.form-status { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.subscription-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-active); color: var(--muted); }
.subscription-icon svg { width: 21px; height: 21px; }
.subscription-option strong, .subscription-option small { display: block; }
.subscription-option small { margin-top: 4px; color: var(--muted); line-height: 1.35; }
.option-arrow { width: 18px; height: 18px; color: var(--faint); }
.toast-region { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translateX(-50%); }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--text); color: var(--page); box-shadow: var(--shadow); }
.noscript-message { margin: 20px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }

@media (max-width: 980px) {
  .header-inner { min-height: 74px; grid-template-columns: 1fr auto; gap: 14px; }
  .brand { width: 130px; }
  .primary-nav { grid-row: 2; grid-column: 1 / -1; justify-self: stretch; justify-content: center; padding-bottom: 16px; overflow-x: auto; }
  .header-actions { justify-self: end; }
  .control-button span, .control-button .chevron { display: none; }
  .control-button { width: 38px; justify-content: center; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 28px, 1080px); }
  .site-header { border-top-width: 3px; }
  .header-inner { grid-template-columns: 1fr auto; min-height: 68px; }
  .brand { width: 118px; }
  .updates-button { padding-inline: 12px; font-size: 13px; }
  .header-actions { gap: 5px; }
  .primary-nav { gap: 4px; justify-content: center; }
  .nav-link { padding: 10px 13px; font-size: 14px; }
  .status-hero { min-height: 205px; }
  .hero-inner { padding: 34px 12px 28px; }
  .hero-state-icon { width: 48px; height: 48px; }
  .current-section { margin-top: 24px; }
  .group-header, .component { padding: 20px 17px; }
  .component-heading { align-items: center; }
  .component-description { display: none; }
  .uptime-strip { height: 44px; gap: 1px; }
  .day-tooltip { width: min(320px, calc(100vw - 32px)); min-width: 0; max-width: calc(100vw - 32px); }
  .page-heading, .incident-detail { margin-top: 42px; }
  .incident-summary-head, .affected-row, .incident-timeline { padding-left: 20px; padding-right: 20px; }
  .timeline-entry { padding-left: 25px; }
  .incident-card, .maintenance-card { padding: 20px; }
  .email-subscription-fields { grid-template-columns: 1fr; }
}

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

@media print {
  .site-header, .connection-banner, .subscribe-dialog { display: none !important; }
  .page-shell { width: 100%; padding: 0; }
  .status-hero { margin: 0; }
  .service-group, .incident-card, .incident-summary { box-shadow: none; }
}
