:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --border: #e4e4df;
  --up: #22a06b;
  --degraded: #e0a400;
  --down: #d93f3f;
  --none: #d6d6d0;
  --accent: #1c1c1a;
  --accent-text: #ffffff;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1b1b19;
    --text: #ededea;
    --muted: #a1a19b;
    --border: #2e2e2b;
    --up: #2fbf80;
    --degraded: #f0b828;
    --down: #ef5b5b;
    --none: #3a3a36;
    --accent: #ededea;
    --accent-text: #121211;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }

.top { border-bottom: 1px solid var(--border); background: var(--surface); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.05rem; }
.mark { width: 26px; height: 26px; }
.mark circle { fill: var(--up); }
.mark path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.button {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); white-space: nowrap;
}
.button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.button:focus-visible, .bar:focus-visible, .input:focus-visible { outline: 2px solid var(--up); outline-offset: 2px; }

main { display: grid; gap: 40px; padding-top: 32px; padding-bottom: 40px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-radius: var(--radius); color: #fff; background: var(--none); }
.banner h1 { font-size: 1.15rem; font-weight: 600; }
.banner-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; opacity: 0.9; flex: none; }
.banner.tone-up { background: var(--up); }
.banner.tone-degraded { background: var(--degraded); color: #1c1c1a; }
.banner.tone-down { background: var(--down); }
.banner.tone-none { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.05rem; }
.section-head p { font-size: 0.85rem; }

.apps, .incidents { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.apps:empty, .incidents:empty { display: none; }
.app { padding: 20px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.app:last-child, .incident:last-child { border-bottom: 0; }
.app-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-name { font-size: 1rem; font-weight: 600; }
.status { font-size: 0.9rem; font-weight: 500; }
.status.tone-up { color: var(--up); }
.status.tone-degraded { color: var(--degraded); }
.status.tone-down { color: var(--down); }
.status.tone-none { color: var(--muted); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; height: 34px; }
.bar { border-radius: 2px; background: var(--none); cursor: default; }
.bar.tone-up { background: var(--up); }
.bar.tone-degraded { background: var(--degraded); }
.bar.tone-down { background: var(--down); }
.bar:hover { opacity: 0.75; }

.app-foot { display: flex; align-items: center; gap: 12px; font-size: 0.8rem; }
.range-short { display: none; }
.app-foot .uptime { flex: 1; text-align: center; color: var(--muted); position: relative; }
.app-foot .uptime::before, .app-foot .uptime::after {
  content: ""; position: absolute; top: 50%; width: calc(50% - 70px); border-top: 1px solid var(--border);
}
.app-foot .uptime::before { left: 0; }
.app-foot .uptime::after { right: 0; }

.incident { padding: 16px 20px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.incident-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.incident .muted { font-size: 0.85rem; }
.incident .note { font-size: 0.9rem; }
.pill { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--muted); }
.pill.tone-down { background: var(--down); }
.pill.tone-degraded { background: var(--degraded); color: #1c1c1a; }
.state { margin-left: auto; font-size: 0.8rem; }
.state.resolved { color: var(--up); }
.state.ongoing { color: var(--down); font-weight: 600; }

.empty { padding: 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }

.foot { padding-top: 8px; padding-bottom: 40px; font-size: 0.8rem; color: var(--muted); display: grid; gap: 4px; }

.tip {
  position: absolute; z-index: 10; max-width: 260px; padding: 6px 10px; border-radius: 6px;
  background: var(--accent); color: var(--accent-text); font-size: 0.8rem; pointer-events: none; white-space: nowrap;
}

.dialog { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.45); }
.dialog[hidden], .tip[hidden], [hidden] { display: none; }
.dialog-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: var(--radius); padding: 24px; display: grid; gap: 14px; border: 1px solid var(--border); }
.dialog-card h2 { font-size: 1.1rem; }
.copy-row { display: flex; gap: 8px; }
.input { flex: 1; min-width: 0; font: inherit; font-size: 0.85rem; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; }

/* Phones: the last 30 days, as most status pages do. */
@media (max-width: 600px) {
  .bar:nth-child(-n + 60) { display: none; }
  .range-long { display: none; }
  .range-short { display: inline; }
  .top-row .button { padding: 7px 10px; font-size: 0.85rem; }
  .app-foot .uptime::before, .app-foot .uptime::after { width: calc(50% - 60px); }
}

.sub-form { display: grid; gap: 10px; }
.sub-form > label { font-size: 0.9rem; }
.sub-apps { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.9rem; }
.sub-apps legend { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sub-message { font-size: 0.85rem; min-height: 1.2em; }
.sub-message.ok { color: var(--up); }
.sub-message.bad { color: var(--down); }
.fine { font-size: 0.75rem; color: var(--muted); }
.sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.page-card { margin-top: 48px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: grid; gap: 14px; max-width: 520px; }
.page-card h1 { font-size: 1.25rem; }
