:root {
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --text: #202123;
  --muted: #8e8f97;
  --border: #e5e7eb;
  --green: #24c19a;
  --green-soft: #d6f5ed;
  --amber: #fbbf24;
  --red: #f5785c;
  --purple: #7f56d9;
  --empty: #f2f4f7;
  --shadow: 0 2px 5px rgb(16 24 40 / 6%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #12161b;
  --text: #f2f4f7;
  --muted: #98a2b3;
  --border: #29313a;
  --green: #31c49d;
  --green-soft: #0d241e;
  --empty: #202832;
  --shadow: 0 12px 34px rgb(0 0 0 / 24%);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, a { font: inherit; }
.shell { width: min(720px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 50px; }
.site-header { min-height: 42px; margin-bottom: 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 27px; letter-spacing: -.035em; }
.brand-mark { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; background: var(--green); box-shadow: inset 0 0 0 8px #d1fae5; }
.utilities { display: flex; align-items: center; gap: 10px; }
.subscribe, .theme-toggle { min-height: 38px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; text-decoration: none; font-weight: 650; }
.subscribe { padding: 0 14px; border-color: #29292e; background: #29292e; color: #fff; }
.theme-toggle { gap: 7px; padding: 0 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.toggle-track { width: 30px; height: 18px; padding: 2px; display: flex; align-items: center; border-radius: 999px; background: #d0d5dd; }
.toggle-track::after { width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(16 24 40 / 22%); content: ""; transition: transform 140ms ease; }
:root[data-theme="dark"] .toggle-track { background: var(--green); }
:root[data-theme="dark"] .toggle-track::after { transform: translateX(12px); }
.overall { margin-bottom: 24px; overflow: hidden; border: 1px solid var(--green); border-radius: 9px; background: var(--surface); }
.overall-head { padding: 17px 16px; display: flex; align-items: center; gap: 10px; background: var(--green-soft); font-size: 16px; font-weight: 650; }
.overall-detail { padding: 16px; border-top: 1px solid color-mix(in srgb, var(--green) 18%, transparent); }
.overall.warning { border-color: var(--amber); }
.overall.warning .overall-head { background: color-mix(in srgb, var(--amber) 16%, var(--surface)); }
.overall.down { border-color: var(--red); }
.overall.down .overall-head { background: color-mix(in srgb, var(--red) 15%, var(--surface)); }
.status-icon { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; }
.status-icon.warning, .status-icon.pending { background: var(--amber); }
.status-icon.down { background: var(--red); }
.status-icon.maintenance { background: var(--purple); }
.status-icon.unknown { background: var(--muted); }
.warning .status-icon { background: var(--amber); }
.down .status-icon { background: var(--red); }
.system-card { border: 1px solid var(--border); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.system-heading { padding: 17px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 650; }
.system-heading h2 { margin: 0; font: inherit; }
.system-heading-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.system-heading h2, .system-heading > .text-link { white-space: nowrap; }
.system-heading > .text-link { margin-left: auto; }
.text-link { color: var(--text); font-size: 12px; font-weight: 550; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.range-controls { display: flex; align-items: center; gap: 10px; }
.date-navigation { display: flex; align-items: center; gap: 2px; }
.window-select { max-width: 100px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface); font: inherit; font-size: 11px; font-weight: 500; }
.range-arrow { width: 28px; height: 30px; border: 0; border-radius: 5px; color: var(--text); background: transparent; font-size: 22px; cursor: pointer; }
.range-arrow:disabled { color: var(--border); cursor: default; }
.date-picker { position: relative; border-radius: 6px; font-size: 12px; font-weight: 500; }
.date-picker > summary { padding: 7px 3px; border-radius: 6px; cursor: pointer; list-style: none; white-space: nowrap; }
.date-picker > summary::-webkit-details-marker { display: none; }
.date-picker > summary:hover, .range-arrow:not(:disabled):hover { background: var(--empty); }
.calendar { position: absolute; z-index: 40; top: 40px; left: 50%; transform: translateX(-50%); width: 280px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 36px rgb(16 24 40 / 15%); }
.calendar-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; }
.calendar-arrow { border: 0; background: transparent; color: var(--text); font-size: 22px; width: 26px; height: 28px; border-radius: 5px; cursor: pointer; }
.calendar-arrow:disabled { opacity: .25; cursor: default; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.weekday { padding: 6px 0; text-align: center; color: var(--muted); font-size: 10px; font-weight: 600; }
.calendar-day { border: 0; border-radius: 6px; background: transparent; color: var(--text); height: 30px; font-size: 11px; cursor: pointer; }
.calendar-day.in-range { background: var(--green-soft); }
.calendar-day:disabled { color: var(--muted); opacity: .45; cursor: default; }
.calendar-day.outside-month { opacity: .2; }
.calendar-day.selected { background: var(--green); color: #0b3026; font-weight: 750; opacity: 1; }
.calendar-day:not(:disabled):hover { outline: 1px solid var(--green); }
.calendar-hint { text-align: center; color: var(--muted); font-size: 11px; margin: 14px 0 10px; }
.calendar-live { width: 100%; padding: 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 12px; cursor: pointer; }
.calendar-live:hover { background: var(--empty); }
.history-legend { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 0 16px 12px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.info { position: relative; display: inline-block; flex: 0 0 auto; font-weight: 400; }
.info summary { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--muted); border-radius: 50%; color: var(--muted); font-size: 10px; font-weight: 600; cursor: pointer; list-style: none; }
.info summary::-webkit-details-marker { display: none; }
.info-content { position: absolute; left: 0; top: 24px; z-index: 30; width: min(300px, calc(100vw - 90px)); padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 12px; line-height: 1.6; }
.history-legend .info-content { left: auto; right: 0; }
.group { border-bottom: 1px solid var(--border); }
.group:last-child { border-bottom: 0; }
.group-button { width: 100%; padding: 15px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 0; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.group-button:hover { background: color-mix(in srgb, var(--surface) 88%, var(--border)); }
.group-name { font-size: 15px; font-weight: 650; }
.component-count { color: var(--muted); font-size: 12px; }
.chevron { color: #98a2b3; font-size: 21px; line-height: 1; transition: transform 140ms ease; }
.group.expanded .chevron { transform: rotate(90deg); }
.history { width: 100%; display: grid; grid-template-columns: repeat(90, minmax(1px, 1fr)); gap: 2px; order: 10; }
.group > .history { width: auto; margin: 0 16px 15px; }
.beat { height: 15px; min-width: 0; background: var(--empty); }
.beat.up { background: var(--green); }
.beat.warning, .beat.pending { background: var(--amber); }
.beat.down { background: var(--red); }
.beat.maintenance { background: var(--purple); }
.beat.partial { background-image: repeating-linear-gradient(135deg, transparent, transparent 3px, rgb(255 255 255 / 35%) 3px, rgb(255 255 255 / 35%) 5px); }
.beat:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, select:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.components { display: none; border-top: 1px solid var(--border); }
.group.expanded .components { display: block; }
.component { padding: 17px 16px 18px 40px; border-bottom: 1px solid var(--border); }
.component:last-child { border-bottom: 0; }
.component-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.component-head strong { font-size: 14px; }
.component-head .reason { margin-left: auto; color: var(--muted); font-size: 12px; }
.component-detail { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; }
.latency { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.component .history { margin-top: 12px; }
.empty-state, .loading { min-height: 320px; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); text-align: center; }
.loading span { width: 21px; height: 21px; border: 3px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tooltip { position: fixed; z-index: 100; min-width: 225px; max-width: calc(100vw - 24px); padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 10px 30px rgb(16 24 40 / 14%); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity 100ms ease, transform 100ms ease; }
.tooltip.visible { opacity: 1; transform: translateY(0); }
.tooltip time { display: block; color: var(--muted); font-size: 13px; }
.tooltip strong { margin-top: 9px; display: block; }
.tooltip p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
footer { margin-top: 56px; padding-top: 25px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.footer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; line-height: 1.5; }
.footer-about { display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
#history-note { display: flex; align-items: center; gap: 7px; }
.timezone-select { appearance: none; max-width: 290px; margin: 0; padding: 0; border: 0; border-radius: 2px; color: var(--muted); background: transparent; font: inherit; line-height: inherit; cursor: pointer; text-overflow: ellipsis; }
.timezone-select:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.timezone-select option { color: var(--text); background: var(--surface); }
#refresh-countdown { font-variant-numeric: tabular-nums; }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 25px; }
.history-heading h1 { font-size: 27px; margin: 0; }
.history-heading select { max-width: 55%; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); padding: 9px; font: inherit; }
.history-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.month-heading { margin-top: 32px; padding-bottom: 12px; border-bottom: 1px solid var(--border); font-size: 17px; }
.incident { border-bottom: 1px solid var(--border); }
.incident summary { display: flex; align-items: center; gap: 16px; padding: 18px 0; list-style: none; cursor: pointer; }
.incident summary::-webkit-details-marker { display: none; }
.incident-date { font-size: 21px; color: var(--muted); min-width: 28px; }
.incident strong { font-size: 14px; font-weight: 550; }
.incident-state { margin-left: auto; border-radius: 12px; padding: 4px 8px; font-size: 11px; background: var(--green-soft); }
.incident-state.open { background: color-mix(in srgb, var(--amber) 20%, var(--surface)); }
.incident p { margin: 0 0 18px 44px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty-history { padding: 50px 0; color: var(--muted); }

@media (max-width: 720px) {
  .shell { width: min(100% - 28px, 720px); padding-top: 24px; }
  .brand { gap: 8px; font-size: 20px; }
  .brand-mark { width: 22px; height: 22px; flex-basis: 22px; box-shadow: inset 0 0 0 6px #d1fae5; }
  .subscribe { padding: 0 10px; font-size: 0; }
  .subscribe::after { content: "Subscribe"; font-size: 12px; }
  .theme-toggle span:last-child { display: none; }
  .history { gap: 1px; }
  .component-count { display: none; }
  .group-button { padding: 18px 16px; }
  .component { padding-left: 28px; }
  .system-heading { flex-wrap: wrap; }
  .system-heading-left { display: contents; }
  .system-heading .range-controls { order: 3; flex-basis: 100%; justify-content: center; }
  .history-legend { justify-content: center; }
  .history-legend .info-content { right: -20px; }
  .component-detail { flex-basis: 100%; align-items: flex-start; margin-left: 31px; }
  .component-head .reason { margin-left: 0; }
  .component .info-content { left: auto; right: -80px; }
  footer { align-items: center; flex-direction: column; gap: 12px; }
  .footer-meta { align-items: center; text-align: center; }
  .footer-about { align-items: center; }
}

@media (max-width: 390px) {
  .range-controls { gap: 4px; }
  .range-arrow { width: 22px; }
  .date-picker { font-size: 11px; }
  .window-select { max-width: 80px; padding: 5px 2px; }
}

