:root {
  color-scheme: light;
  --canvas: #ffffff;
  --surface: #fafafa;
  --surface-raised: #ffffff;
  --surface-active: #f1efff;
  --ink: #17151d;
  --muted: #68656f;
  --subtle: #908c98;
  --line: #e5e3e9;
  --line-strong: #d6d2dc;
  --brand: #6d5df6;
  --brand-strong: #5848dd;
  --brand-soft: #efedff;
  --green: #16865b;
  --green-soft: #e9f7f0;
  --amber: #b77905;
  --amber-soft: #fff8dc;
  --red: #c53f50;
  --red-soft: #fff0f2;
  --blue: #306ee8;
  --blue-soft: #edf3ff;
  --history-empty: #e8e6ec;
  --shadow: 0 8px 24px rgba(31, 26, 51, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #111113;
  --surface: #17171a;
  --surface-raised: #0c0c0e;
  --surface-active: #28233f;
  --ink: #f4f2f7;
  --muted: #aaa6b2;
  --subtle: #817d88;
  --line: #2c2a31;
  --line-strong: #3b3842;
  --brand: #8c7dff;
  --brand-strong: #a396ff;
  --brand-soft: #27213f;
  --green: #4fc390;
  --green-soft: #122c22;
  --amber: #e4ad42;
  --amber-soft: #35260f;
  --red: #ee7180;
  --red-soft: #35171d;
  --blue: #76a3ff;
  --blue-soft: #17233d;
  --history-empty: #302e35;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select { font: inherit; }

button,
select { color: inherit; }

a { color: var(--brand-strong); text-underline-offset: 3px; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--brand-strong);
  border-radius: 6px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.header-inner,
.footer-inner {
  width: min(100% - 48px, 1180px);
  margin: 0 auto;
}

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

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: 85px;
  height: auto;
  display: block;
}

:root[data-theme="dark"] .brand img {
  filter: invert(1) hue-rotate(180deg) brightness(1.12);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 22px;
}

.header-tools > a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
}

.header-tools > a:hover,
.header-tools > a:focus-visible { color: var(--ink); }

.timezone-control {
  min-height: 34px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.globe { color: var(--muted); font-size: 15px; }

.timezone-control select {
  min-height: 32px;
  padding: 0 18px 0 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 12px;
  font-weight: 600;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.status-navigation {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-tabs {
  padding: 3px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.status-tabs button {
  min-height: 35px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.status-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: 0 1px 4px rgba(26, 22, 37, 0.12);
}

.status-tabs button:hover { color: var(--ink); }

main {
  width: 1120px;
  max-width: calc(100% - 48px);
  min-height: 620px;
  margin: 0 auto;
  flex: 1;
}

.view-panel { padding-bottom: 90px; }

.page-heading {
  min-height: 132px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.page-heading.centered {
  min-height: 146px;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.services-heading {
  min-height: 180px;
  margin-bottom: 34px;
}

.services-heading p {
  font-size: 16px;
}

h1,
h2,
h3,
p { overflow-wrap: anywhere; }

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.page-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.subscribe-button {
  min-height: 36px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #ffffff;
  background: var(--brand);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(109, 93, 246, 0.2);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.subscribe-button:hover { background: var(--brand-strong); }

.content-section { margin-top: 38px; }

#overview-view .content-section { margin-top: 26px; }

.section-heading,
.service-group-heading {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.view-all {
  padding: 4px 0;
  color: var(--brand-strong);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.view-all span { margin-left: 5px; font-size: 18px; line-height: 0; }

.overall-card,
.status-row {
  width: 100%;
  min-height: 62px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.overall-card > div,
.status-row-main { min-width: 0; flex: 1; }

.overall-card strong,
.status-row-title {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
}

.overall-card p,
.status-row-copy {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.overall-card time,
.status-row time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.row-icon {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.overall-card.operational,
.status-row.operational { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 36%, var(--line)); }
.overall-card.operational .row-icon,
.status-row.operational .row-icon { color: #ffffff; background: var(--green); border-color: var(--green); }
.overall-card.degraded,
.overall-card.maintenance,
.status-row.degraded,
.status-row.maintenance { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 42%, var(--line)); }
.overall-card.degraded .row-icon,
.overall-card.maintenance .row-icon,
.status-row.degraded .row-icon,
.status-row.maintenance .row-icon { color: #ffffff; background: var(--amber); border-color: var(--amber); }
.overall-card.outage,
.status-row.outage { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 42%, var(--line)); }
.overall-card.outage .row-icon,
.status-row.outage .row-icon { color: #ffffff; background: var(--red); border-color: var(--red); }

.status-list {
  display: grid;
  gap: 9px;
}

.status-row { background: var(--surface); }
.loading-row { color: var(--muted); justify-content: center; font-size: 13px; }

.status-pill {
  min-height: 23px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-filters {
  margin: 0 0 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.status-filters button {
  min-height: 104px;
  padding: 17px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.status-filters button:hover { border-color: var(--brand); transform: translateY(-1px); }

.filter-label { font-size: 14px; font-weight: 600; }

.status-filters strong {
  color: var(--ink);
  font-size: 28px;
  font-weight: 680;
  line-height: 1;
}

.status-filters button[data-filter="operational"] strong { color: var(--green); }
.status-filters button[data-filter="degraded"] strong { color: var(--amber); }
.status-filters button[data-filter="outage"] strong { color: var(--red); }
.status-filters button[data-filter="maintenance"] strong { color: var(--blue); }

.status-filters button[aria-pressed="true"] {
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-color: var(--brand);
}

.service-search {
  min-height: 58px;
  margin-bottom: 34px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.search-mark { color: var(--subtle); font-size: 19px; }

.service-search input {
  width: 100%;
  min-height: 56px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
}

.service-search input::placeholder { color: var(--subtle); }

.service-group {
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.service-group-heading {
  min-height: 66px;
  margin: 0;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.service-group-toggle,
.service-group-meta {
  display: flex;
  align-items: center;
}

.service-group-toggle {
  min-height: 40px;
  padding: 0;
  gap: 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-size: 16px;
  font-weight: 680;
  cursor: pointer;
}

.group-chevron {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transition: transform 160ms ease;
}

.service-group-toggle[aria-expanded="false"] .group-chevron { transform: rotate(-90deg); }

.service-group-meta { gap: 18px; }
.service-group-meta span { color: var(--muted); font-size: 12px; }

.service-list { display: grid; }

.service-item {
  min-height: 126px;
  padding: 21px 20px 19px;
  border-bottom: 1px solid var(--line);
}

.service-item:last-child { border-bottom: 0; }
.service-item[hidden] { display: none; }

.service-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 680;
  line-height: 1.35;
}

.service-mainline,
.service-identity,
.service-actions {
  display: flex;
  align-items: center;
}

.service-mainline {
  justify-content: space-between;
  gap: 24px;
}

.service-identity { min-width: 0; gap: 11px; }
.service-actions { flex: none; gap: 20px; }

.service-status-mark {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: none;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.service-status-mark.operational { color: var(--green); border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.service-status-mark.degraded,
.service-status-mark.maintenance { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); }
.service-status-mark.outage { color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }

.service-description {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.service-state.operational { color: var(--green); }
.service-state.degraded,
.service-state.maintenance { color: var(--amber); }
.service-state.outage { color: var(--red); }

.service-toggle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.service-toggle:hover { color: var(--ink); background: var(--surface); }

.mini-history {
  height: 32px;
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(90, minmax(1px, 1fr));
  align-items: center;
  gap: 3px;
}

.history-bar {
  min-width: 1px;
  height: 26px;
  background: var(--history-empty);
  border-radius: 2px;
  cursor: help;
  transition: filter 100ms ease, transform 100ms ease;
}

.history-bar.operational { background: var(--green); }
.history-bar.degraded { background: var(--amber); }
.history-bar.outage { background: var(--red); }
.history-bar.maintenance { background: var(--amber); }
.history-bar:hover { filter: brightness(1.16); transform: scaleY(1.08); }

.service-detail {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.service-detail-meta { margin: 6px 0 0; color: var(--subtle); font-size: 11px; }

.empty-filter-result {
  padding: 30px 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.history-legend {
  margin: 0 0 18px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 10px;
}

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

.legend-swatch {
  width: 10px;
  height: 10px;
  display: inline-block;
  background: var(--history-empty);
  border-radius: 2px;
}

.legend-swatch.operational { background: var(--green); }
.legend-swatch.incident { background: var(--red); }
.legend-swatch.maintenance { background: var(--amber); }

.history-list {
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.history-card {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.history-card:last-child { border-bottom: 0; }

.history-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.history-card h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.history-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }

.history-bars {
  height: 30px;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(90, minmax(1px, 1fr));
  align-items: center;
  gap: 2px;
}

.history-bar { height: 24px; }

.history-tooltip {
  width: min(310px, calc(100vw - 24px));
  position: fixed;
  z-index: 100;
  overflow: visible;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.history-tooltip::after {
  width: 14px;
  height: 14px;
  position: absolute;
  left: calc(50% - 7px);
  bottom: -8px;
  content: "";
  background: var(--surface-raised);
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  transform: rotate(45deg);
}

.history-tooltip.below::after {
  top: -8px;
  bottom: auto;
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.tooltip-heading {
  padding: 14px 16px;
  display: block;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 11px 11px 0 0;
  font-size: 14px;
}

.history-tooltip.degraded .tooltip-heading,
.history-tooltip.maintenance .tooltip-heading { color: var(--amber); background: var(--amber-soft); }
.history-tooltip.outage .tooltip-heading { color: var(--red); background: var(--red-soft); }
.history-tooltip.no-data .tooltip-heading { color: var(--muted); background: var(--surface); }

.tooltip-date,
.tooltip-meta {
  padding: 13px 16px;
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.tooltip-meta { padding-top: 0; color: var(--muted); font-size: 11px; }

.tooltip-incident {
  margin: 0 16px 16px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.tooltip-arrow { color: var(--muted); font-size: 20px; }

.history-meta {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
}

.history-meta span:nth-child(2) { color: var(--ink); font-weight: 700; }
.history-meta span:last-child { text-align: right; }
.history-detail { margin: 8px 0 0; color: var(--muted); font-size: 10px; }
.history-incidents { margin-top: 46px; }
.history-incidents > h2 { margin-bottom: 15px; }

footer {
  min-height: 74px;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 11px;
}

.footer-inner nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
}

.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--ink); }

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .header-inner,
  .footer-inner,
  main {
    width: calc(100% - 28px);
    max-width: none;
  }

  .header-tools { gap: 12px; }
  .header-tools > a:first-child { display: none; }
  .page-heading { min-height: 116px; }
  .page-heading.centered { min-height: 132px; }
  .status-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-history { gap: 2px; }
}

@media (max-width: 560px) {
  .site-header,
  .header-inner { min-height: 58px; }
  .brand img { width: 85px; }
  .header-tools > a { display: none; }
  .timezone-control { min-height: 32px; }
  .theme-toggle { width: 32px; height: 32px; }

  .status-navigation { min-height: 62px; overflow-x: auto; justify-content: flex-start; padding: 0 14px; }
  .status-tabs { width: max-content; margin: 0 auto; }
  .status-tabs button { min-height: 33px; padding: 0 10px; font-size: 11px; }

  main { width: calc(100% - 24px); }
  .view-panel { padding-bottom: 62px; }
  .page-heading,
  .page-heading.centered { min-height: 116px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 12px; text-align: left; }
  h1 { font-size: 28px; }
  h2 { font-size: 18px; }
  .content-section { margin-top: 32px; }
  #overview-view .content-section { margin-top: 24px; }

  .overall-card { align-items: flex-start; flex-wrap: wrap; }
  .overall-card time { width: 100%; padding-left: 36px; }
  .status-row { align-items: flex-start; flex-wrap: wrap; }
  .status-row time { width: 100%; padding-left: 36px; }
  .status-pill { margin-left: 36px; }

  .services-heading { align-items: center; text-align: center; }
  .status-filters { gap: 10px; }
  .status-filters button { min-height: 84px; padding: 12px; }
  .status-filters strong { font-size: 24px; }
  .service-group-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .service-group-meta { width: 100%; justify-content: space-between; }
  .service-item { min-height: 116px; padding: 18px 14px 16px; }
  .service-actions { gap: 10px; }
  .service-state { font-size: 11px; }
  .mini-history { gap: 1px; }
  .history-bar { height: 22px; }
  .history-card-top { flex-direction: column; gap: 10px; }
  .history-bars { gap: 1px; }

  .footer-inner { padding: 22px 0; align-items: flex-start; flex-direction: column; }
  .footer-inner nav { gap: 12px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
