/* Status — all styling. No CDN, no webfont; system stacks only. */

:root {
    --bg:        #0d1117;
    --bg-2:      #131a23;
    --panel:     #161d27;
    --panel-2:   #1c2531;
    --line:      #263140;
    --line-soft: #1e2733;
    --text:      #dce3ec;
    --text-dim:  #8b98a9;
    --text-mute: #5d6b7d;
    --up:        #2ecc71;
    --up-dim:    #1c7a45;
    --down:      #ff4d4f;
    --down-dim:  #8c2426;
    --pending:   #f5a623;
    --paused:    #5d6b7d;
    --accent:    #4a9eff;
    --accent-dim:#1d4b80;
    --radius:    8px;
    --mono: ui-monospace, "Cascadia Mono", "Consolas", "SF Mono", monospace;
    --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- chrome */

.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 20px;
    height: 52px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
}

.brand {
    font-weight: 700;
    letter-spacing: .5px;
    font-size: 15px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 9px;
}
.brand .dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 10px var(--up);
}
.brand:hover { text-decoration: none; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 13px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--panel-2); color: var(--text); }

.spacer { flex: 1; }

.worker-pill {
    font-family: var(--mono);
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 20px;
    border: 1px solid var(--line);
    color: var(--text-mute);
}
.worker-pill.alive { color: var(--up); border-color: var(--up-dim); }
.worker-pill.dead  { color: var(--down); border-color: var(--down-dim); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------------------------------------------------------------- bits */

h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; color: var(--text); }
.sub { color: var(--text-dim); font-size: 13px; margin: 0 0 18px; }

.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: #24303f; text-decoration: none; }
.btn.primary { background: var(--accent-dim); border-color: #2f6fb5; color: #eaf3ff; }
.btn.primary:hover { background: #245c98; }
.btn.danger { border-color: var(--down-dim); color: #ff8b8d; }
.btn.danger:hover { background: #2a1618; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--up-dim);
    background: #10241a;
    color: #9de8bd;
    font-size: 13px;
}
.flash.err { border-color: var(--down-dim); background: #241314; color: #ffb3b4; }

.empty {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 44px 20px;
    text-align: center;
    color: var(--text-dim);
}

.mono { font-family: var(--mono); }
.dim  { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- overview strip */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-mute); }
.stat .v { font-size: 24px; font-weight: 600; font-family: var(--mono); margin-top: 2px; }
.stat.up   .v { color: var(--up); }
.stat.down .v { color: var(--down); }
.stat.pend .v { color: var(--pending); }

/* ---------------------------------------------------------------- monitor cards */

.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
    display: grid;
    grid-template-columns: 4px 1fr auto;
    gap: 0;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    overflow: hidden;
}
.card .edge { background: var(--paused); }
.card.s-1 .edge { background: var(--up); }
.card.s-0 .edge { background: var(--down); }
.card.s-2 .edge { background: var(--pending); }
.card.s-3 .edge { background: var(--paused); }
.card.s-0 { border-color: #4a2225; }

.card .body { padding: 12px 14px; min-width: 0; }
.card .side {
    padding: 12px 14px;
    border-left: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    gap: 14px;
}

.card .title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.card .title .name { font-weight: 600; font-size: 14px; }
.card .title .name a { color: var(--text); }
.card .target {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card .err {
    font-family: var(--mono);
    font-size: 12px;
    color: #ff8b8d;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .7px;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    font-family: var(--mono);
}
.b-1 { background: #123723; color: var(--up); }
.b-0 { background: #3a1517; color: #ff8b8d; }
.b-2 { background: #3a2c11; color: var(--pending); }
.b-3 { background: #222b36; color: var(--text-mute); }

.tag {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--text-dim);
    border: 1px solid var(--line);
}

/* per-card controls */
.acts { display: flex; gap: 4px; align-items: center; margin-left: 4px; }
.icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-mute);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}
.icon:hover { background: var(--panel-2); color: var(--text); }
.icon.danger:hover { background: #2a1618; color: #ff8b8d; border-color: var(--down-dim); }

.metric { text-align: right; min-width: 66px; }
.metric .k { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-mute); }
.metric .v { font-family: var(--mono); font-size: 14px; }

/* heartbeat bars */
.beats { display: flex; gap: 2px; align-items: flex-end; height: 26px; }
.beat {
    width: 5px;
    height: 100%;
    border-radius: 2px;
    background: var(--line);
    flex: none;
}
.beat.s-1 { background: var(--up); }
.beat.s-0 { background: var(--down); }
.beat.s-2 { background: var(--pending); }
.beat.s-3 { background: var(--paused); }
/* Placeholder for a monitor with fewer than SM_BEATS checks so far.
   Deliberately NOT called "empty" — that class is the empty-state panel
   below, whose padding would blow every placeholder up to 42px. */
.beat.pad { background: #1b2430; }

/* ---------------------------------------------------------------- detail page */

.grid2 { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.panel {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 13px; }
.kv .k { color: var(--text-mute); }
.kv .v { font-family: var(--mono); word-break: break-all; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text-mute);
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
}
td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: none; }

canvas { display: block; width: 100%; height: 180px; }

/* ---------------------------------------------------------------- forms */

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field label { font-size: 12px; color: var(--text-dim); }
.field .hint { font-size: 11px; color: var(--text-mute); }

input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, .15);
}
textarea { font-family: var(--mono); resize: vertical; min-height: 78px; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.check input { width: auto; accent-color: var(--accent); }

fieldset {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 14px;
    margin: 0;
}
legend { font-size: 12px; color: var(--text-mute); padding: 0 6px; text-transform: uppercase; letter-spacing: .7px; }

/* ---------------------------------------------------------------- auth screens */

.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth .box {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 28px;
}
.auth h1 { text-align: center; margin-bottom: 6px; }
.auth .sub { text-align: center; }

/* ---------------------------------------------------------------- branding */

.powered {
    text-align: center;
    font-size: 12px;
    color: var(--text-mute);
    padding: 26px 0 10px;
    letter-spacing: .2px;
}
.powered a { color: var(--text-dim); }
.powered a:hover { color: var(--accent); }

.topbar .powered { padding: 0; font-size: 11px; }

/* ---------------------------------------------------------------- status page */

.status-hero { text-align: center; padding: 30px 0 26px; }
.status-hero .big { font-size: 26px; font-weight: 600; }
.status-hero .big.ok  { color: var(--up); }
.status-hero .big.bad { color: var(--down); }

.live-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--up);
    vertical-align: middle;
    margin-right: 5px;
}
.live-dot.beatnow { animation: livepulse 1.2s ease-out 1; }
@keyframes livepulse {
    0%   { box-shadow: 0 0 0 0 rgba(46, 204, 113, .6); }
    100% { box-shadow: 0 0 0 9px rgba(46, 204, 113, 0); }
}

/* operator announcements at the foot of the public page */
.notices { margin-top: 26px; }
.notices h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-mute); }
.notice {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--pending);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
}
.notice.done { border-left-color: var(--up); }

/* The public strip: one bar per check, stretched to fill the panel but never
   so wide that a handful of checks turns into giant blocks. */
.beats.wide { height: 32px; gap: 3px; }
.beats.wide .beat {
    flex: 1 1 0;
    width: auto;
    min-width: 3px;
    max-width: 13px;
    border-radius: 3px;
}
.day.ok   { background: var(--up); }
.day.part { background: var(--pending); }
.day.bad  { background: var(--down); }
