:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-strong: #f0f2f5;
  --text: #101828;
  --muted: #667085;
  --border: #dfe3e8;
  --ok: #138a5b;
  --ok-bg: #e7f6ef;
  --warn: #a36400;
  --warn-bg: #fff2d6;
  --down: #bf2d2d;
  --down-bg: #fee7e7;
  --maint: #3d67b1;
  --maint-bg: #e8effc;
  --info: #53606a;
  --blue: #1677ff;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.07);
}

.status-unknown { background: #364152; }
.badge-unknown { background: #eef0f3; color: #53606a; }
.monitor-note { color: var(--muted); }
.monitor-note a { color: #1677ff; text-decoration: underline; }
.check-summary { margin: 16px 0; font-size: 0.9rem; line-height: 1.6; }
.check-pending { color: var(--warn); font-size: 0.85rem; }
.check-details { margin: 16px 0; font-size: 0.85rem; }
.check-details summary { cursor: pointer; font-weight: 600; }
.check-details ul { list-style: none; padding: 0; }
.check-details li { padding: 14px 0; border-top: 1px solid var(--border); }
.check-heading { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.entry-results { margin-top: 20px; }
.entry-result { padding: 12px 0; border-top: 1px solid var(--border); }
.entry-result .check-heading { justify-content: space-between; }
.entry-result .entry-reason { font-size: 0.85rem; margin: 8px 0 0; }
.check-details li { display: grid; gap: 4px; padding: 9px 0; }
.service-card-head { flex-wrap: wrap; }
.service-card { min-width: 0; }
.service-grid { align-items: start; }
.service-card .customer-route { color: var(--text); font-weight: 600; margin-top: 18px; }
.service-card .home-note { color: var(--warn); font-size: 0.9rem; }
.check-details p { margin: 8px 0; }
.check-details small { color: var(--muted); }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid var(--border);
  background: rgba(247, 248, 250, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--blue);
  color: #ffffff;
  font-size: 0.9rem;
}

.topbar nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

main {
  width: 100%;
}

.status-hero {
  color: #ffffff;
}

.status-hero .hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 74px 0 54px;
}

.status-ok {
  background: #106a4a;
}

.status-warn {
  background: #84530a;
}

.status-down {
  background: #932929;
}

.status-maint {
  background: #2c518f;
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-hero h1,
.admin-heading h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5.5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.status-hero p {
  max-width: 720px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
}

.hero-state {
  align-self: end;
  min-width: 220px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-state span {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
}

.hero-state time {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.92rem;
}

.page-section,
.admin-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.page-section {
  padding: 42px 0 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

h2 {
  margin: 0;
  font-size: 1.08rem;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

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

.service-card,
.incident-row,
.timeline-item,
.admin-card,
.admin-panel,
.incident-admin,
.notice-row {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.service-card {
  min-height: 170px;
  padding: 22px;
}

.service-card-head,
.incident-admin-head,
.admin-card-head,
.incident-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.service-card p,
.timeline-item p,
.incident-row p,
.notice-row p {
  margin: 12px 0 0;
  color: var(--muted);
  white-space: pre-line;
}

.service-card time,
.timeline-meta,
.update-list time {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.service-card time {
  margin-top: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 800;
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-down {
  background: var(--down-bg);
  color: var(--down);
}

.badge-maint {
  background: var(--maint-bg);
  color: var(--maint);
}

.badge-info {
  background: var(--surface-strong);
  color: var(--info);
}

.incident-list,
.timeline-list,
.incident-admin-list,
.notice-list {
  display: grid;
  gap: 12px;
}

.incident-row {
  padding: 18px;
}

.incident-main {
  min-width: 0;
}

.incident-kicker {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #cbd6dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
}

.timeline-item {
  padding: 18px;
}

.timeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-weight: 800;
}

.admin-shell {
  padding: 34px 0 54px;
}

.admin-shell.narrow {
  width: min(460px, calc(100% - 40px));
}

.admin-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.admin-heading .eyebrow {
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.admin-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

.admin-card,
.admin-panel,
.incident-admin {
  padding: 18px;
}

.admin-section {
  margin-top: 30px;
}

.admin-section h2,
.admin-column h2 {
  margin-bottom: 10px;
}

.stack-form {
  display: grid;
  gap: 14px;
}

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

label,
.check-group {
  display: grid;
  gap: 7px;
}

label span,
.check-group > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd9df;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

input,
select {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 92px;
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #3d67b1;
  outline: 3px solid rgba(61, 103, 177, 0.18);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.check-row span {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}

.check-group {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid #14674b;
  background: #14674b;
  color: #ffffff;
}

.secondary-button {
  border: 1px solid #20313b;
  background: #20313b;
  color: #ffffff;
}

.ghost-button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--muted);
}

.icon-button {
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row button {
  flex: 1 1 180px;
}

.update-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding-left: 20px;
}

.update-list p {
  margin: 4px 0 0;
  color: var(--muted);
  white-space: pre-line;
}

.notice-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.notice {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-strong);
}

.notice.danger {
  border: 1px solid #f2b8b8;
  background: var(--down-bg);
  color: var(--down);
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.06);
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100% - 40px));
  margin: 48px auto 0;
  padding: 28px 0 38px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
}

.page-footer div {
  display: flex;
  gap: 22px;
}

.page-footer a:hover {
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1017;
    --surface: #111821;
    --surface-strong: #171f2a;
    --text: #eef2f7;
    --muted: #97a3b2;
    --border: #27313e;
    --ok-bg: #102c23;
    --warn-bg: #302511;
    --down-bg: #321716;
    --maint-bg: #14233c;
    --info: #aab4c0;
    --shadow: none;
  }

  .topbar {
    background: rgba(11, 16, 23, 0.92);
  }

  input,
  select,
  textarea,
  .ghost-button,
  .icon-button {
    background: var(--surface);
  }

  .empty-state {
    border-color: var(--border);
    background: rgba(17, 24, 33, 0.64);
  }
}

@media (max-width: 780px) {
  .topbar {
    padding: 0 18px;
  }

  .topbar nav .nav-link:first-child {
    display: none;
  }

  .status-hero .hero-inner,
  .admin-grid,
  .form-grid,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .hero-state {
    align-self: stretch;
  }

  .admin-heading,
  .incident-row,
  .notice-row {
    align-items: stretch;
    flex-direction: column;
  }

  .status-hero .hero-inner,
  .page-section,
  .admin-shell,
  .admin-shell.narrow {
    width: min(100% - 28px, 1120px);
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
    width: calc(100% - 28px);
  }
}
