:root {
    color-scheme: light dark;
    --paper: #f2f4f7;
    --panel: #ffffff;
    --ink: #18202b;
    --muted: #5d6878;
    --rule: #dbe0e7;
    --wash: #e9edf2;
    --ok: #24855a;
    --failed: #cc3a35;
    --running: #b7791f;
    --error: #6e56cf;
    --empty: #d3d9e1;
    --log-bg: #18202b;
    --log-ink: #d9e0ea;
    --log-muted: #7d8898;
    --log-bad: #ff8f87;
    --sans: 'Instrument Sans', system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #10151c;
        --panel: #171e27;
        --ink: #e3e8ef;
        --muted: #8e99a8;
        --rule: #28323e;
        --wash: #1e2732;
        --ok: #3dbe82;
        --failed: #f0625c;
        --running: #e0a43a;
        --error: #9c88f0;
        --empty: #2c3644;
        --log-bg: #0b1016;
    }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 13px; font-variant-ligatures: none; }
.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 64px; }
.muted { color: var(--muted); }
h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }

/* Navigation */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; }
.top a { text-decoration: none; }
.top a:hover { color: var(--ink); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 99px; }
.tabs a.on { background: var(--panel); color: var(--ink); font-weight: 500; box-shadow: inset 0 0 0 1px var(--rule); }

/* The one big statement at the top of each page */
.summary { margin: 40px 0 36px; max-width: 30ch; font-size: clamp(30px, 5vw, 46px); line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.summary::before { content: ''; display: inline-block; width: 0.42em; height: 0.42em; margin: 0 0.3em 0.12em 0; border-radius: 50%; background: var(--ok); }
.summary.problems::before { background: var(--failed); }
.summary.running::before { background: var(--running); }
.summary.empty::before { background: var(--empty); }
.summary small { display: block; margin-top: 12px; font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--muted); }

/* Projects with their history strip */
.projects { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
.project { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(140px, 1fr) auto; gap: 16px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--rule); }
.project:first-child { border-top: 0; }
.project.active { background: var(--wash); }
.project-name { text-decoration: none; font-weight: 600; }
.project-name span { font-weight: 400; color: var(--muted); }
.project-name:hover { text-decoration: underline; }
.project-status { font-size: 14px; color: var(--muted); white-space: nowrap; }
.project-status .status { margin-right: 10px; }
.history { display: flex; gap: 3px; flex-direction: row-reverse; justify-content: flex-end; }
.tick { display: block; width: 7px; height: 24px; border-radius: 2px; background: var(--empty); }
.tick.ok { background: var(--ok); }
.tick.failed { background: var(--failed); }
.tick.error { background: var(--error); }
.tick.stuck { background: var(--failed); opacity: 0.5; }
.tick.running { background: var(--running); animation: pulse 1.2s ease-in-out infinite; }
.tick.selected { outline: 2px solid var(--ink); outline-offset: 2px; }
a.tick:hover { transform: scaleY(1.2); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .tick.running { animation: none; } }

/* Status dots: deployments and error log levels */
.status { white-space: nowrap; }
.status::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); }
.status.failed, .status.fatal, .status.stuck { color: var(--failed); }
.status.running, .status.warning { color: var(--running); }
.status.error { color: var(--error); }
.status.skipped, .status.notice { color: var(--muted); }

/* List on the left, details on the right */
.work { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 40px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 14px; }
.filters a { padding: 4px 11px; border: 1px solid var(--rule); border-radius: 99px; text-decoration: none; color: var(--muted); }
.filters a.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.list { list-style: none; margin: 0; padding: 0; }
.list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.list a:hover { background: var(--wash); }
.list a.selected { background: var(--panel); box-shadow: inset 0 0 0 1px var(--rule); }
.list strong { overflow-wrap: anywhere; }
.list .when { color: var(--muted); font-size: 14px; text-align: right; white-space: nowrap; }
.list .commit { font: 13px var(--mono); color: var(--muted); text-align: right; }
.list .status, .list .sub { font-size: 14px; }
.list .sub { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub.wide { grid-column: 1 / -1; }
.flash { margin: 20px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--failed); color: var(--failed); font-size: 14px; }

/* Dark log panel */
.log { position: sticky; top: 16px; border-radius: 10px; background: var(--log-bg); color: var(--log-ink); overflow: hidden; }
.log header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 16px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.log h3 { margin: 0; font-size: 17px; font-weight: 600; }
.log header p { margin: 0; color: var(--log-muted); font-size: 14px; }
.log header a { color: var(--log-muted); }
.log-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.log .button { background: transparent; border-color: rgba(255, 255, 255, 0.2); color: var(--log-ink); }
.log .button:hover { border-color: var(--log-ink); color: var(--log-ink); }
@media (max-width: 860px) { .log-actions { align-items: flex-start; } }
.log .empty-log { margin: 0; padding: 48px 20px; color: var(--log-muted); text-align: center; }
pre.lines { margin: 0; padding: 14px 0; max-height: 75vh; overflow: auto; background: var(--log-bg); color: var(--log-ink); font: 13px/1.65 var(--mono); font-variant-ligatures: none; counter-reset: line; }
pre.lines span { display: grid; grid-template-columns: 4ch minmax(0, 1fr); column-gap: 16px; padding-right: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.lines span::before { counter-increment: line; content: counter(line); text-align: right; color: var(--log-muted); opacity: 0.6; }
pre.lines span.bad { color: var(--log-bad); background: rgba(255, 90, 80, 0.1); }

/* Light panel with details */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 8px 16px; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.panel-head h3 { margin: 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.panel-empty { margin: 0; padding: 48px 20px; color: var(--muted); text-align: center; }
.panel > details { border-top: 1px solid var(--rule); }
.panel > details > summary { padding: 14px 20px; cursor: pointer; color: var(--muted); font-size: 14px; }

.button { padding: 6px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.button:hover { border-color: var(--failed); color: var(--failed); }

/* Grouped errors */
.issues { list-style: none; margin: 0; padding: 0; }
.issue { border-top: 1px solid var(--rule); }
.issue:first-child { border-top: 0; }
.issue summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 12px 20px; cursor: pointer; list-style: none; }
.issue summary::-webkit-details-marker { display: none; }
.issue summary:hover { background: var(--wash); }
.issue .message { font: 13px/1.55 var(--mono); font-variant-ligatures: none; overflow-wrap: anywhere; }
.issue .count { font-size: 14px; color: var(--muted); text-align: right; white-space: nowrap; }
.issue .count strong { color: var(--ink); font-weight: 600; }
.issue pre.lines { max-height: 50vh; border-radius: 0; }

/* Server: meters and facts */
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.meter { padding: 16px 18px; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
.meter-label { color: var(--muted); font-size: 14px; }
.meter-value { margin: 2px 0 10px; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.meter-value span { color: var(--muted); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--wash); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.meter.warn .bar span { background: var(--running); }
.meter.bad .bar span { background: var(--failed); }
.meter-note { margin-top: 8px; color: var(--muted); font-size: 13px; }

.sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; margin-top: 40px; align-items: start; }
.section-wide { margin-top: 40px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); margin: 0; }
.facts dt, .facts dd { margin: 0; padding: 9px 20px; border-top: 1px solid var(--rule); }
.facts dt { color: var(--muted); padding-right: 8px; }
.facts dd { overflow-wrap: anywhere; }
.facts dt:first-of-type, .facts dt:first-of-type + dd { border-top: 0; }

.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 16px; border-top: 1px solid var(--rule); text-align: left; vertical-align: top; }
thead th { border-top: 0; color: var(--muted); font-weight: 500; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* Login */
.login { max-width: 340px; margin: 18vh auto 0; padding: 0 16px; }
.login h1 { margin: 0 0 20px; font-size: 28px; letter-spacing: -0.02em; }
.login form { display: flex; gap: 8px; }
.login input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.login button { padding: 9px 16px; border: 0; border-radius: 8px; background: var(--ink); color: var(--paper); font: inherit; font-weight: 500; cursor: pointer; }
.login p { color: var(--failed); font-size: 14px; }

@media (max-width: 860px) {
    .work { grid-template-columns: minmax(0, 1fr); }
    .log, .work > .panel { position: static; order: -1; }
    .project { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .sections { grid-template-columns: minmax(0, 1fr); }
    .tabs a { padding: 6px 9px; }
}

/* Local changes per project on the server page */
.changes summary { cursor: pointer; }
.changes ul { margin: 8px 0 0; padding: 0; list-style: none; }
.changes li { overflow-wrap: anywhere; }
.changes p { margin: 8px 0 0; font-size: 13px; max-width: 32ch; }

/* Access logs */
.access-filters { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 0 12px; padding: 14px 20px 2px; }
.search input { width: 220px; max-width: 100%; padding: 4px 11px; border: 1px solid var(--rule); border-radius: 99px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; }
.tops { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 0 8px; border-top: 1px solid var(--rule); }
.tops table, .requests table { font-size: 13px; }
td.path { font-family: var(--mono); font-variant-ligatures: none; overflow-wrap: anywhere; }
td.path a { text-decoration: none; }
td.path a:hover { text-decoration: underline; }
.requests { border-top: 1px solid var(--rule); }
.requests td { padding: 8px 16px; }
.requests .method { color: var(--muted); }
.requests .agent { display: block; max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: var(--sans); }
.table-note { margin: 0; padding: 10px 20px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 14px; }
@media (max-width: 860px) { .tops { grid-template-columns: minmax(0, 1fr); } }
.summary + .muted { margin: -20px 0 0; font-size: 14px; }
