
:root {
  --bg:#ffffff; --panel:#ffffff; --panel2:#f6f6f4; --line:#e9e8e5; --line2:#f1f0ee; --text:#1c1917; --muted:#78716c; --faint:#a8a29e;
  --green:#15803d; --red:#b91c1c; --amber:#b45309; --blue:#1d4ed8; --violet:#6d28d9;
  --accent:#1c1917; --sidebar:#fafaf9; --sbw:236px;
  --radius:14px; --shadow:0 1px 2px rgba(28,25,23,.04), 0 1px 1px rgba(28,25,23,.02);
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing:border-box }
html { -webkit-text-size-adjust:100% }
body { margin:0; background:var(--bg); color:var(--text); font:14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; -webkit-font-smoothing:antialiased }

/* ---------- top bar ---------- */
header { display:flex; align-items:center; gap:14px; padding:12px 28px; min-height:60px; border-bottom:1px solid var(--line); position:sticky; top:0; background:rgba(255,255,255,.88); backdrop-filter:saturate(1.4) blur(10px); -webkit-backdrop-filter:saturate(1.4) blur(10px); z-index:20 }
header h1 { font-size:17px; margin:0; font-weight:650; letter-spacing:-.2px }
header .meta { color:var(--muted); font-size:12.5px; margin-left:auto; display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end }
header nav.top { display:none }   /* navigation lives in the sidebar */

main { padding:24px 28px 72px; max-width:1520px; margin:0 auto; overflow-x:clip }

/* ---------- sidebar ---------- */
body:has(> header nav.top), body.has-shell { padding-left:var(--sbw) }
.sidebar { position:fixed; inset:0 auto 0 0; width:var(--sbw); background:var(--sidebar); border-right:1px solid var(--line); display:flex; flex-direction:column; z-index:40; overflow:hidden }
.sb-brand { display:flex; align-items:center; gap:10px; padding:18px 20px 14px; font-weight:700; font-size:15px; letter-spacing:-.2px; color:var(--text); text-decoration:none }
.sb-mark { width:22px; height:22px; border-radius:7px; background:linear-gradient(135deg,#22c55e,#15803d); box-shadow:inset 0 0 0 1px rgba(0,0,0,.06) }
.sb-nav { flex:1; overflow-y:auto; padding:4px 12px 12px; scrollbar-width:thin }
.sb-group { margin-top:14px } .sb-group:first-child { margin-top:4px }
.sb-label { font-size:10.5px; font-weight:600; text-transform:uppercase; letter-spacing:.7px; color:var(--faint); padding:0 10px 6px }
.sb-link { display:flex; align-items:center; gap:10px; width:100%; padding:7px 10px; border-radius:8px; color:#44403c; text-decoration:none; font-size:13.5px; font-weight:500; border:0; background:none; cursor:pointer; font-family:inherit; text-align:left; line-height:1.3 }
.sb-link svg { flex:none; color:var(--faint) }
.sb-link:hover { background:#f0efed; color:var(--text) } .sb-link:hover svg { color:var(--muted) }
.sb-link.active { background:#fff; color:var(--text); box-shadow:0 1px 2px rgba(0,0,0,.06), 0 0 0 1px var(--line) } .sb-link.active svg { color:var(--text) }
.sb-link span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.sb-link:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline:2px solid #2563eb; outline-offset:2px }
.sb-badge { display:none; min-width:19px; height:19px; padding:0 6px; border-radius:999px; background:#e7e5e4; color:#44403c; font-size:11px; font-weight:600; line-height:19px; text-align:center }
.sb-badge.on { display:inline-block } .sb-badge.red { background:#fee2e2; color:#b91c1c } .sb-badge.amber { background:#fef3c7; color:#92400e }
.sb-prod { font-weight:450; font-size:13px }
.sb-dot { width:8px; height:8px; border-radius:50%; background:#d6d3d1; flex:none; margin:0 4px 0 4px } .sb-dot.up { background:#22c55e } .sb-dot.down { background:#ef4444 } .sb-dot.degraded { background:#f59e0b }
.sb-skel { height:30px; margin:2px 0; border-radius:8px; background:linear-gradient(90deg,#f2f1ef,#f8f7f5,#f2f1ef); background-size:200% 100%; animation:sbsk 1.4s infinite }
@keyframes sbsk { to { background-position:-200% 0 } }
.sb-foot { border-top:1px solid var(--line); padding:10px 12px 12px }
.sb-out { margin:0 } .sb-ver { font-size:10.5px; color:var(--faint); padding:6px 10px 0; font-family:var(--mono) }
.sb-toggle { display:none; padding:6px; border-radius:8px; background:none; border:1px solid var(--line) }
.sb-scrim { display:none }
@media (max-width:900px){
  body:has(> header nav.top), body.has-shell { padding-left:0 }
  .sidebar { transform:translateX(-102%); transition:transform .2s ease; box-shadow:0 10px 40px rgba(0,0,0,.15); width:min(280px, 84vw) }
  body.sb-open .sidebar { transform:none }
  body.sb-open .sb-scrim { display:block; position:fixed; inset:0; background:rgba(28,25,23,.3); z-index:30 }
  .sb-toggle { display:inline-flex }
  header { padding:10px 16px; flex-wrap:wrap; gap:8px 10px }
  header .meta { gap:8px }
  main { padding:16px 16px 56px }
}
@media (prefers-reduced-motion: reduce){ .sidebar { transition:none } .sb-skel { animation:none } }

/* ---------- controls ---------- */
button { background:#fff; color:var(--text); border:1px solid var(--line); border-radius:8px; padding:6px 11px; cursor:pointer; font:500 12.5px/1.2 inherit; font-family:inherit; transition:background .12s, border-color .12s }
button:hover { background:var(--panel2); border-color:#d6d3d1 }
button:disabled { opacity:.55; cursor:default }
button.primary { background:var(--accent); color:#fff; border-color:var(--accent) } button.primary:hover { background:#292524 }
input, select, textarea { font-family:inherit }
select { border:1px solid var(--line); border-radius:8px; padding:5px 8px; background:#fff; color:var(--text); font-size:12.5px }
a { color:inherit }

/* ---------- layout & cards ---------- */
.grid { display:grid; gap:16px } .grid > * { min-width:0 }
.kpis { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); margin-bottom:20px }
.kpi { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:15px 17px; box-shadow:var(--shadow) }
.kpi .label { color:var(--muted); font-size:11.5px; font-weight:500; letter-spacing:.2px }
.kpi .value { font-size:25px; font-weight:650; margin-top:4px; font-variant-numeric:tabular-nums; letter-spacing:-.4px }
.kpi .sub { color:var(--muted); font-size:12px; margin-top:3px }
.pos { color:var(--green) } .neg { color:var(--red) } .warn { color:var(--amber) }
.row2 { grid-template-columns:2fr 1fr; margin-bottom:20px }
@media (max-width:1100px){ .row2 { grid-template-columns:1fr } }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:18px; min-width:0; box-shadow:var(--shadow) }
.panel h2 { font-size:12px; font-weight:600; margin:0 0 14px; color:var(--muted); text-transform:uppercase; letter-spacing:.7px; display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap }
.panel h2 span { font-weight:400; text-transform:none; letter-spacing:0; font-size:12px }

/* ---------- tables ---------- */
table { width:100%; border-collapse:collapse; font-size:13px }
th { text-align:left; color:var(--muted); font-weight:500; font-size:11px; text-transform:uppercase; letter-spacing:.5px; padding:7px 8px; border-bottom:1px solid var(--line) }
td { padding:9px 8px; border-bottom:1px solid var(--line2); vertical-align:top; font-variant-numeric:tabular-nums }
tbody tr:hover td { background:#fbfbfa }
tr:last-child td { border-bottom:0 }
.num { text-align:right }

/* ---------- small things ---------- */
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align:middle; background:var(--faint) }
.dot.up, .dot.success, .dot.deployed { background:#16a34a } .dot.down, .dot.crashed, .dot.failed { background:#dc2626 } .dot.degraded, .dot.building, .dot.deploying, .dot.sleeping { background:#d97706 }
.tag { display:inline-block; font-size:11px; padding:1px 7px; border-radius:999px; border:1px solid var(--line); color:var(--muted); margin-left:6px }
.tag.stripe { color:#4338ca; border-color:#c7d2fe; background:#eef2ff } .tag.polar { color:#1d4ed8; border-color:#bfdbfe; background:#eff6ff }
.feed li { list-style:none; padding:9px 0; border-bottom:1px solid var(--line2) }
.feed { padding:0; margin:0 }
.feed .when { color:var(--muted); font-size:11px; font-family:var(--mono) }
.feed .txt { margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.muted { color:var(--muted) }
.src { display:flex; gap:10px; flex-wrap:wrap; font-size:11px; color:var(--muted); margin-top:20px }
.src b { font-weight:500; color:var(--text) }
.empty { color:var(--muted); font-size:13px; padding:12px 0 }
.proj-name { font-weight:600 }
.sitelist { font-size:11px; color:var(--muted); margin-top:2px }
.sitelist a { color:inherit; text-decoration:none }
canvas { max-height:260px }
.err { color:var(--red) }
.badge { display:inline-block; min-width:18px; padding:0 5px; border-radius:9px; background:#dc2626; color:#fff; font-size:11px; line-height:18px; text-align:center; margin-left:4px }
a.plain { color:inherit; text-decoration:none }
a.plain:hover { text-decoration:underline }
code { background:var(--panel2); padding:1px 5px; border-radius:5px; font-size:12px; font-family:var(--mono) }
.tabs { flex-wrap:wrap }
