:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1b1f24; --muted: #5b6573; --line: #dde1e7;
  --accent: #2457d6; --accent-text: #ffffff; --ok: #1a7f37; --ok-bg: #dcf5e3; --warn: #8a5a00; --warn-bg: #fff0c7;
  --bad: #b3261e; --bad-bg: #fde0de; --off: #4a5361; --off-bg: #e6e9ee;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #e1e0d9; --axis: #c3c2b7; --chart: #fcfcfb;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --panel: #181c22; --text: #e8ebf0; --muted: #98a2b3; --line: #2a303a;
    --accent: #6e93ff; --accent-text: #0b1020; --ok: #5fd07f; --ok-bg: #12301c; --warn: #f0b84a; --warn-bg: #3a2c08;
    --bad: #ff8a80; --bad-bg: #3d1512; --off: #aab3c2; --off-bg: #232932;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --grid: #2c2c2a; --axis: #383835; --chart: #1a1a19;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.bar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar h1 { font-size: 18px; margin: 0; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.pad { padding: 16px; margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 16px 0; }
.card.narrow { max-width: 360px; margin: 48px auto; display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
input:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; min-height: 36px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
button.ghost { background: transparent; }
.error, .banner { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: 6px; margin: 0 0 12px; }
.banner.info { color: var(--warn); background: var(--warn-bg); }
.summary { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 130px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.table-wrap { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
.node-id { font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
/* A long second line in a cell (the bandwidth column's box figures) wraps instead of widening the table. */
td .sub.wrap { white-space: normal; max-width: 16em; margin-left: auto; }
.chip, .badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--off-bg); color: var(--off); }
.badge.ready, .chip.ok { background: var(--ok-bg); color: var(--ok); }
.badge.draining, .badge.stopping, .badge.unresponsive { background: var(--warn-bg); color: var(--warn); }
.badge.unready, .chip.bad { background: var(--bad-bg); color: var(--bad); }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.actions { display: flex; gap: 6px; }
.checks-grid { display: grid; gap: 8px; margin-top: 8px; }
.check-node { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); max-width: 440px; padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog form { display: grid; gap: 12px; }
[hidden] { display: none !important; }
@media (max-width: 640px) { main { padding: 8px; } th, td { padding: 8px; } }

label.inline { display: flex; align-items: center; gap: 8px; }
select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); min-height: 36px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-bottom: 12px; }
.chart { background: var(--chart); border: 1px solid var(--line); border-radius: 8px; padding: 12px; position: relative; }
.chart h3 { margin: 0 0 6px; font-size: 14px; }
.chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .dot { stroke: var(--chart); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: baseline; }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.25); white-space: nowrap; z-index: 2; }
.tip b { display: block; margin-bottom: 2px; }
.badge.critical { background: var(--bad-bg); color: var(--bad); }
.badge.warning { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--ok-bg); color: var(--ok); }
td.wrap { white-space: normal; min-width: 240px; }

.panel { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0 0 14px; background: var(--panel); }
.panel h3 { margin: 0; font-size: 1rem; }
.steps { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
select { font: inherit; padding: 7px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); max-width: 100%; }
.plain-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.plain-list li { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.plain-list li .spacer { flex: 1; }
code { font-family: ui-monospace, monospace; font-size: 0.92em; }
.hosts { display: grid; gap: 12px; margin-bottom: 16px; }
.host { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.host header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.host h3 { margin: 0; font-size: 1.05rem; }
.host .meters { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.meter { min-width: 120px; }
.meter b { display: block; }
.meter .track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.meter .fill { height: 100%; background: var(--ok); }
.meter .fill.warn { background: var(--warn); }
.meter .fill.bad { background: var(--bad); }
/* Per-core load, with the node pinned to each core under it. */
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px 12px; margin: 4px 0 8px; }
.core b { display: block; font-size: 13px; }
.core .track { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 3px 0 2px; }
.core .fill { height: 100%; background: var(--ok); }
.core .fill.warn { background: var(--warn); }
.core .fill.bad { background: var(--bad); }
.core .sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host .os { margin: 6px 0; }
.host table { width: 100%; }
.host .result { margin: 6px 0 0; }
.chip.warn, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad, .badge.bad { background: var(--bad-bg); color: var(--bad); }
.host .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.host td:last-child { min-width: 180px; }
.host td:nth-child(4) { max-width: 260px; white-space: normal; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#alerts-table td:nth-child(3) { white-space: normal; min-width: 220px; }
tr.alert-open td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.logbox { font-family: ui-monospace, monospace; font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 360px; overflow: auto; }
.logline { display: grid; grid-template-columns: auto auto auto 1fr; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.logline .lvl-40 { color: var(--warn); }
.logline .lvl-50, .logline .lvl-60 { color: var(--bad); font-weight: 600; }
.logline .msg { white-space: pre-wrap; word-break: break-word; }
.logline .ctx { grid-column: 4; color: var(--off); white-space: pre-wrap; word-break: break-all; }
#errors-table td:nth-child(3) { white-space: normal; min-width: 240px; }
label.inline input[type="search"] { width: 9em; }

/* Security scans in the Hosts section: Lynis, docker-bench and image vulnerabilities. */
textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); resize: vertical; width: 100%; }
textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.host .hardening { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 6px 0; }
.host details { margin: 6px 0; }
.host summary { cursor: pointer; padding: 6px 0; line-height: 1.8; }
.host summary .chip { margin-left: 6px; }
.findings { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.finding { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: var(--bg); min-width: 0; }
.finding .fid { font-weight: 600; font-family: ui-monospace, monospace; font-size: 13px; overflow-wrap: anywhere; }
.finding .fpkg { overflow-wrap: anywhere; min-width: 0; }
.finding .spacer { flex: 1; }
.finding.ignored { opacity: .55; }
.finding.ignored .fid { text-decoration: line-through; }
.finding .why { flex-basis: 100%; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.vulns { display: flex; flex-wrap: wrap; gap: 4px; }
#ignore-dialog { width: min(440px, calc(100vw - 32px)); }

/* The web name's boxes. */
.web-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.web-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--panel); }
.web-box.active { border-color: var(--ok); }
.web-box .sub { flex-basis: 100%; }
.web-box.bad { border-color: var(--bad); }
.web-box { align-content: flex-start; }

/* Reports */
#report-detail { margin-top: 12px; }
.report-context { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.report-context li { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); }
.report-context li.report-reported { border-color: var(--bad); background: var(--bad-bg); }
.report-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.report-actions input[type="text"] { flex: 1 1 14em; min-width: 10em; }
.report-suspend { display: inline-flex; align-items: center; gap: 6px; }
.report-suspend input { width: 5em; }

/* Young people */
.minor-row { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 8px 0; }
.minor-row label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.minor-row input[type="text"], .minor-row input[type="email"] { min-width: 12em; }
td.minor-row { align-items: center; }

.tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: inherit; opacity: .75; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { border-bottom-color: currentColor; opacity: 1; }
.tabs button:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.report-csea { display: flex; align-items: center; gap: 6px; max-width: 24rem; }
.report-csea input { flex: none; }
.history { margin: 10px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.history h4 { margin: 0 0 4px; }
.history p { margin: 3px 0; }
