:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --hairline: #eef0f3;
  --up: #16a34a;
  --down: #dc2626;
  --warning: #d97706;
  --idle: #9ca3af;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --card: #161a21;
    --text: #e7eaee;
    --muted: #98a1ae;
    --border: #262b35;
    --hairline: #1f242d;
    --up: #22c55e;
    --down: #f05252;
    --warning: #f59e0b;
    --idle: #6b7280;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  background: var(--hairline);
  padding: 1px 5px;
  border-radius: 5px;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 40px 20px 56px; }

/* ---------------------------------------------------------------- masthead */

.masthead h1 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -.02em;
}

.masthead p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 60ch;
}

/* ---------------------------------------------------------------- summary */

.summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent, var(--idle));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 22px;
}

.summary-text { flex: 1; min-width: 0; }
.summary h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.summary p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.summary .stamp { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; }

.beacon {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent, var(--idle));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--idle)) 18%, transparent);
  flex: none;
}

.status-up      { --accent: var(--up); }
.status-down    { --accent: var(--down); }
.status-warning { --accent: var(--warning); }
.status-unknown,
.status-paused  { --accent: var(--idle); }

.status-down .beacon { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 26%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--down) 6%, transparent); }
}

/* ---------------------------------------------------------------- site cards */

.site {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}

.site-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 4%, transparent), transparent);
}

.site-head h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }

.badge {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.site-uptime {
  margin-left: auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.site-uptime small { font-size: 11px; opacity: .8; }

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent, var(--idle));
  flex: none;
}

.status-paused .dot { background: transparent; border: 2px solid var(--idle); }

/* ---------------------------------------------------------------- monitor rows */

.monitors { list-style: none; margin: 0; padding: 0; }

.monitor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--hairline);
}

.monitor:last-child { border-bottom: none; }

.ident { min-width: 0; display: flex; flex-direction: column; }

.ident .label {
  font-size: 14px;
  text-decoration: none;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ident .label:hover { text-decoration: underline; }

.ident .url {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ident .reason {
  font-size: 11.5px;
  color: var(--down);
  margin-top: 2px;
}

.status-warning .ident .reason { color: var(--warning); }

.bars { display: flex; gap: 2px; align-items: flex-end; }

.bar {
  width: 4px;
  height: 20px;
  border-radius: 1px;
  background: var(--up);
  opacity: .85;
}

.bar.bad { background: var(--down); opacity: 1; }
.bar.empty { background: var(--hairline); height: 8px; }

.metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 78px;
}

.metric { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.metric.primary { font-size: 13px; color: var(--text); font-weight: 500; }
.metric.muted { font-size: 11px; opacity: .8; }

.status-down .metric.primary { color: var(--down); }

/* ---------------------------------------------------------------- misc */

.empty-state {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .wrap { padding: 28px 14px 40px; }
  .monitor { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 8px; }
  .bars { grid-column: 2 / -1; order: 3; }
  .metrics { order: 2; }
  .summary .stamp { display: none; }
  .bar { width: 3px; }
}
