:root {
  --ink: #062978;
  --brand: #2563eb;
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #16a34a;
  --ok-bar: #22c55e;
  --degraded: #ca8a04;
  --degraded-bar: #facc15;
  --partial: #ea580c;
  --partial-bar: #fb923c;
  --major: #dc2626;
  --major-bar: #ef4444;
  --maintenance: #2563eb;
  --maintenance-bar: #60a5fa;
  --none-bar: #e2e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --card: #121a2e;
    --text: #e5ecf8;
    --muted: #93a3bd;
    --line: #22304d;
    --ok: #4ade80;
    --degraded: #fde047;
    --partial: #fdba74;
    --major: #f87171;
    --maintenance: #93c5fd;
    --none-bar: #26324d;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pre { white-space: pre-wrap; }
h1, h2, h3, p { margin: 0; }

.top {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; white-space: nowrap; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 7px; }
.brand-sub { color: var(--muted); font-weight: 500; }

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #0a3696; }
.link-btn { font: inherit; background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 48px; display: grid; gap: 20px; }
.card, .components, .past, .incident, .banner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.notices { display: grid; gap: 8px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 14px; }
.notice-ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.notice-warn { border-color: color-mix(in srgb, var(--degraded) 55%, var(--line)); background: color-mix(in srgb, var(--degraded-bar) 12%, var(--card)); }

.banner { display: flex; align-items: center; gap: 14px; padding: 20px; }
.banner h1 { font-size: 21px; font-weight: 700; line-height: 1.3; }
.banner-icon {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px;
  background: var(--ok);
}
.banner.tone-ok { border-left: 5px solid var(--ok); }
.banner.tone-degraded { border-left: 5px solid var(--degraded); }
.banner.tone-degraded .banner-icon { background: var(--degraded); }
.banner.tone-partial { border-left: 5px solid var(--partial); }
.banner.tone-partial .banner-icon { background: var(--partial); }
.banner.tone-major { border-left: 5px solid var(--major); }
.banner.tone-major .banner-icon { background: var(--major); }
.banner.tone-maintenance { border-left: 5px solid var(--maintenance); }
.banner.tone-maintenance .banner-icon { background: var(--maintenance); }
.banner.tone-loading { border-left: 5px solid var(--line); }

.stack { display: grid; gap: 12px; }
.stack > h2, .components-head h2, .past h2 { font-size: 17px; font-weight: 700; }
.incident { padding: 16px 18px; border-left-width: 5px; display: grid; gap: 10px; }
.incident.tone-degraded { border-left-color: var(--degraded); }
.incident.tone-partial { border-left-color: var(--partial); }
.incident.tone-major { border-left-color: var(--major); }
.incident.tone-maintenance { border-left-color: var(--maintenance); }
.incident-title { font-weight: 700; font-size: 16px; color: var(--text); }
.updates { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.updates-full { margin-top: 14px; gap: 18px; }
.upd-status { font-weight: 700; }

.components { padding: 4px 0; }
.components-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px 4px; flex-wrap: wrap; }
.component { padding: 14px 18px; border-top: 1px solid var(--line); }
.components-head + .component { border-top: 0; }
.component-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.component-name { font-weight: 600; }
.component-desc { display: block; font-size: 13px; }
.component-status { font-size: 14px; font-weight: 600; white-space: nowrap; }
.text-ok { color: var(--ok); }
.text-degraded { color: var(--degraded); }
.text-partial { color: var(--partial); }
.text-major { color: var(--major); }
.text-maintenance { color: var(--maintenance); }

.bars { display: flex; gap: 2px; margin-top: 10px; height: 34px; }
.bar { flex: 1 1 0; min-width: 0; border: 0; padding: 0; border-radius: 2px; cursor: pointer; background: var(--none-bar); }
.bar:hover, .bar:focus-visible { opacity: 0.75; outline: none; }
.bar-ok { background: var(--ok-bar); }
.bar-degraded { background: var(--degraded-bar); }
.bar-partial { background: var(--partial-bar); }
.bar-major { background: var(--major-bar); }
.bar-maintenance { background: var(--maintenance-bar); }
.bars-legend { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.bars-legend .rule { flex: 1; height: 1px; background: var(--line); }
@media (max-width: 600px) {
  /* 90 bars do not fit a phone: show the last 30 days, the way the big status pages do. */
  .bar:nth-child(-n + 60) { display: none; }
  .bars-legend span:first-child::after { content: ""; }
  .bars-legend span:first-child { font-size: 0; }
  .bars-legend span:first-child::before { content: "30 days ago"; font-size: 13px; }
  .component-head { flex-direction: column; gap: 2px; }
}

.tooltip {
  position: absolute;
  z-index: 50;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
  font-size: 13px;
}
.tip-date { font-weight: 700; margin-bottom: 2px; }
.tip-incident { margin-top: 6px; color: var(--partial); font-weight: 600; }

.past { padding: 16px 18px; display: grid; gap: 4px; }
.past-day { padding: 12px 0; border-bottom: 1px solid var(--line); }
.past-day:last-of-type { border-bottom: 0; }
.past-day h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.past-item { display: grid; gap: 3px; padding: 6px 0; }
.past-title { font-weight: 700; }
.history-link { font-weight: 600; font-size: 14px; margin-top: 8px; }
.card { padding: 20px; }
.card h1 { font-size: 22px; line-height: 1.3; }
.month { font-size: 15px; margin: 18px 0 4px; }
.back { font-size: 14px; font-weight: 600; }

.foot { max-width: 880px; margin: 0 auto; padding: 8px 16px 40px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.dialog { position: relative; width: 100%; max-width: 440px; background: var(--card); color: var(--text); border-radius: 16px; padding: 24px; display: grid; gap: 12px; box-shadow: 0 20px 60px rgba(2, 6, 23, 0.3); }
.dialog h2 { font-size: 19px; }
.dialog-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.sub-form { display: flex; gap: 8px; }
.field { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
@media (max-width: 420px) { .sub-form { flex-direction: column; } .top .btn { padding: 8px 12px; font-size: 13px; } .brand { font-size: 16px; gap: 8px; } }
@media (max-width: 359px) { .btn-more { display: none; } }
