/* HealthManager UI stylesheet. Tokens follow scriptmonitor: teal accent, navy background, dark default, body.light.
   No inline styles anywhere (CSP style-src 'self'). */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700.woff2") format("woff2"); }

:root {
  --bg: #06172b;
  --bg-2: #04111f;
  --card: #091e35;
  --card-2: #0c2744;
  --border: #16324f;
  --grid: #1b3a5a;
  --text: #e3e3e3;
  --muted: #93a6ba;
  --accent: #0d9488;
  --accent-2: #14b8a6;
  --accent-ink: #ffffff;
  --ok: #22c55e;
  --warn: #f59e0b;
  --fail: #ef4444;
  --grey: #64748b;
  --ok-bg: rgba(34, 197, 94, .14);
  --warn-bg: rgba(245, 158, 11, .15);
  --fail-bg: rgba(239, 68, 68, .15);
  --grey-bg: rgba(100, 116, 139, .18);
  --c1: #14b8a6; --c2: #60a5fa; --c3: #f59e0b; --c4: #f472b6; --c5: #a78bfa; --c6: #34d399; --c7: #fb7185; --c8: #facc15;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}
body.light {
  --bg: #f3f6f9;
  --bg-2: #e8eef4;
  --card: #ffffff;
  --card-2: #f5f8fb;
  --border: #d8e1ea;
  --grid: #e3e9ef;
  --text: #102233;
  --muted: #5a6b7d;
  --accent: #0d9488;
  --accent-2: #0f766e;
  --ok: #16a34a;
  --warn: #d97706;
  --fail: #dc2626;
  --grey: #64748b;
  --ok-bg: rgba(22, 163, 74, .12);
  --warn-bg: rgba(217, 119, 6, .13);
  --fail-bg: rgba(220, 38, 38, .11);
  --grey-bg: rgba(100, 116, 139, .14);
  --c1: #0d9488; --c2: #2563eb; --c3: #d97706; --c4: #db2777; --c5: #7c3aed; --c6: #059669; --c7: #e11d48; --c8: #ca8a04;
  --shadow: 0 1px 2px rgba(16, 34, 51, .08);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
body.light a { color: var(--accent-2); }
h1 { font-size: 22px; font-weight: 650; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 13px; font-weight: 600; margin: 14px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--card-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; z-index: 100; background: var(--card); padding: 6px 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warntext { color: var(--warn); }
.oktext { color: var(--ok); }
.unit { color: var(--muted); font-size: .9em; margin-left: 1px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 54px;
  background: var(--bg-2); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo { width: 24px; height: 24px; fill: none; stroke: var(--accent-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mainnav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { color: var(--muted); padding: 7px 10px; border-radius: 7px; white-space: nowrap; font-weight: 500; }
.mainnav a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.mainnav a.active { color: var(--text); background: var(--card-2); box-shadow: inset 0 -2px 0 var(--accent); }
.usermenu { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who { color: var(--muted); font-size: 13px; }
.top .navtoggle { display: none; }
.btn-icon { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon:hover { color: var(--text); border-color: var(--accent); }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 18px 20px 40px; flex: 1; }
.foot { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; padding: 14px 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child { margin-top: 0; }
.card.danger { border-color: rgba(239, 68, 68, .45); }
.narrow { max-width: 620px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.grid2, .grid3 { margin-bottom: 14px; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.pagehead h1 { margin-bottom: 8px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: inline; margin: 0; }

/* ---------- banners / flash / toast ---------- */
.banners { display: flex; flex-direction: column; }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 20px; font-weight: 500; font-size: 13px; }
.banner.fail { background: var(--fail-bg); color: var(--fail); border-bottom: 1px solid rgba(239, 68, 68, .35); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid rgba(245, 158, 11, .35); }
.login-card .banner { border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; border: 1px solid rgba(239, 68, 68, .35); }
.flash { border-radius: 8px; padding: 9px 12px; margin: 0 0 14px; border: 1px solid; font-size: 13px; }
.flash.ok { background: var(--ok-bg); border-color: rgba(34, 197, 94, .4); }
.flash.fail { background: var(--fail-bg); border-color: rgba(239, 68, 68, .45); }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; max-width: min(420px, calc(100vw - 36px)); padding: 10px 14px; border-radius: 8px;
  background: var(--card-2); border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); font-size: 13px; }
.toast.ok { border-left: 4px solid var(--ok); }
.toast.fail { border-left: 4px solid var(--fail); }

/* ---------- pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px;
  white-space: nowrap; border: 1px solid transparent; vertical-align: middle; }
.pill .i { width: 13px; height: 13px; stroke-width: 2.4; }
.pill.ok { color: var(--ok); background: var(--ok-bg); border-color: rgba(34, 197, 94, .35); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(245, 158, 11, .4); }
.pill.fail { color: var(--fail); background: var(--fail-bg); border-color: rgba(239, 68, 68, .45); }
.pill.grey { color: var(--muted); background: var(--grey-bg); border-color: rgba(100, 116, 139, .35); }
.badge { display: inline-block; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 500; line-height: 19px; background: var(--card-2); border: 1px solid var(--border);
  color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge.warn { color: var(--warn); border-color: rgba(245, 158, 11, .45); }
.badge.ok { color: var(--ok); border-color: rgba(34, 197, 94, .4); }
.badge.ghost { background: transparent; }
h1 .badge { font-size: 12px; }

/* ---------- buttons / forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-2);
  color: var(--text); font: 500 13px/1.2 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.active { border-color: var(--accent); color: var(--accent-2); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
body.light .btn-primary, body.light a.btn-primary { color: #fff; }
a.btn-primary { color: var(--accent-ink); }
.btn-danger { color: var(--fail); border-color: rgba(239, 68, 68, .45); background: transparent; }
.btn-danger:hover { background: var(--fail-bg); border-color: var(--fail); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
input, select, textarea { font: 13px/1.3 var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px; min-width: 0; max-width: 100%; }
body.light input, body.light select, body.light textarea { background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(20, 184, 166, .25); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; padding: 0; vertical-align: middle; }
textarea { width: 100%; resize: vertical; }
textarea.mono { font-family: var(--mono); font-size: 12px; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; }
.hint { font-size: 11.5px; color: var(--muted); }
.ferr { font-size: 12px; color: var(--fail); }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; align-items: start; }
.formgrid .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; min-width: 0; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.radios label { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; }
details > summary { cursor: pointer; color: var(--accent-2); font-weight: 500; padding: 4px 0; }
details.advanced { border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; margin-top: 12px; }
details.advanced[open] { padding-bottom: 12px; }
details.advanced > .formgrid { margin-top: 10px; }
.copyrow { display: flex; gap: 6px; }
.copyrow input { flex: 1; }
.filter { width: 220px; }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(127, 127, 127, .05); }
.tbl.compact td, .tbl.compact th { padding: 4px 6px; }
.tbl .num, .stats .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .wrapcell { min-width: 180px; max-width: 520px; overflow-wrap: anywhere; }
.tbl tr.dim td { opacity: .55; }
.tbl tr.lv-fail td:first-child { box-shadow: inset 3px 0 0 var(--fail); }
.tbl tr.lv-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.stats { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.stats th { text-align: left; color: var(--muted); font-weight: 500; padding: 2px 6px; }
.stats th:not(:first-child) { text-align: right; }
.stats td { padding: 2px 6px; border-top: 1px solid var(--border); }
.meterc { white-space: nowrap; }

/* ---------- kv ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 18px; margin-bottom: 8px; }
.kv > div { min-width: 0; overflow-wrap: anywhere; }
.kv .k { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.summary { font-size: 14px; overflow-wrap: anywhere; }

/* ---------- dashboard ---------- */
.counts { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 14px; margin-bottom: 14px; }
.count { display: flex; flex-direction: column; gap: 8px; color: var(--text); margin-bottom: 0; }
.count:hover { text-decoration: none; border-color: var(--accent); }
.count .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.count .row { display: flex; gap: 6px; flex-wrap: wrap; }
.count .big { font-size: 30px; font-weight: 700; line-height: 1; }
.probes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.probe { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-2); min-width: 0; }
.probe .pill { align-self: flex-start; }
.pname { font-weight: 600; }
.events { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; font-size: 13px; }
.events li { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); align-items: baseline; flex-wrap: wrap; }
.events .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.ev { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 5px; background: var(--grey-bg); text-transform: uppercase; }
.ev-open, .ev-escalate { background: var(--fail-bg); color: var(--fail); }
.ev-recover { background: var(--ok-bg); color: var(--ok); }
.plain { list-style: none; margin: 0 0 8px; padding: 0; }
.plain li { padding: 4px 0; border-bottom: 1px solid var(--border); }

/* ---------- host cards ---------- */
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }
.hgrid.mini { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.hcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
  box-shadow: var(--shadow); border-top: 3px solid var(--grey); }
.hcard.st-ok { border-top-color: var(--ok); }
.hcard.st-warn { border-top-color: var(--warn); }
.hcard.st-fail { border-top-color: var(--fail); }
.hcard.mini { padding: 9px 11px; gap: 6px; }
.hcard header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hname { font-weight: 650; font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.hcard.mini .hname { font-size: 14px; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.hmeta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 0; font-size: 12.5px; }
.hmeta div { min-width: 0; }
.hmeta dt { color: var(--muted); font-size: 11px; }
.hmeta dd { margin: 0; }
.hbars { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.hbars > div { display: grid; grid-template-columns: 34px 1fr 52px; align-items: center; gap: 6px; }
.hbars .k { color: var(--muted); }
.hbars .v { text-align: right; font-variant-numeric: tabular-nums; }
.hnet { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); gap: 8px; }
meter { width: 100%; height: 8px; border-radius: 4px; background: var(--grid); border: 0; -webkit-appearance: none; appearance: none; }
.meterc meter { width: 90px; vertical-align: middle; }
meter::-webkit-meter-bar { background: var(--grid); border-radius: 4px; border: 0; height: 8px; }
meter::-webkit-meter-optimum-value { background: var(--ok); border-radius: 4px; }
meter::-webkit-meter-suboptimum-value { background: var(--warn); border-radius: 4px; }
meter::-webkit-meter-even-less-good-value { background: var(--fail); border-radius: 4px; }
meter::-moz-meter-bar { background: var(--ok); border-radius: 4px; }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--fail); }
.ubar { display: flex; gap: 1px; height: 14px; border-radius: 3px; overflow: hidden; }
.ubar span { flex: 1 1 0; min-width: 1px; background: var(--grey-bg); }
.ubar .up { background: var(--ok); }
.ubar .partial { background: var(--warn); }
.ubar .down { background: var(--fail); }
.ubar .none { background: var(--grid); }

/* ---------- tabs / range ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 6px 0 14px; overflow-x: auto; scrollbar-width: thin; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.rangebar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.rpill { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 12.5px; font-weight: 500; background: var(--card); }
.rpill:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.rpill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rpill.disabled { opacity: .45; cursor: not-allowed; }
.range-custom { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.range-custom input { width: 190px; }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.charts > .card { margin-bottom: 0; }
.chartcard .chead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.chartcard h3 { margin: 0; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
.chart { width: 100%; height: 280px; }
.chart.tall { height: 340px; }
.chart.heat { height: 520px; }
.chart.chart-error { height: auto; padding: 20px; color: var(--fail); }
.tt { font: 12px/1.45 var(--font); min-width: 160px; }
.tt-h { font-weight: 600; margin-bottom: 4px; }
.tt-r { display: flex; align-items: center; gap: 6px; }
.tt-sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tt-n { flex: 1; overflow-wrap: anywhere; }
.tt-v { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- rules (Hetrix style) ---------- */
.rules { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
form.rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-2); font-size: 13px; }
form.rule.rule-off { opacity: .6; }
form.rule select, form.rule input { padding: 4px 6px; font-size: 12.5px; }
form.rule .rnum { width: 84px; }
form.rule .rtxt { color: var(--muted); }
form.rule .rstate { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
form.rule .resend-ack { flex-basis: 100%; color: var(--warn); font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
form.rule .rmsg:empty { display: none; }
form.rule .rhost { font-weight: 600; min-width: 70px; }
.addrule > summary { font-size: 13px; }
.addrule form.rule { margin-top: 6px; }

/* ---------- chips / toggles ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--card-2); font-size: 12.5px; cursor: pointer; }
.chip.on { border-color: var(--accent); }
.chip.ok .small { color: var(--ok); }
.chip.fail .small { color: var(--fail); }
.chip.grey { opacity: .65; }
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.toggle { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.toggle.greyed { opacity: .5; }
.caps { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.caps .k { color: var(--muted); font-size: 12px; margin-right: 4px; }
.cap { font-size: 11.5px; padding: 0 7px; border-radius: 5px; border: 1px solid var(--border); line-height: 19px; }
.cap.ok { color: var(--ok); border-color: rgba(34, 197, 94, .35); }
.cap.fail { color: var(--fail); border-color: rgba(239, 68, 68, .4); text-decoration: line-through; }
.cap.grey { color: var(--muted); }
.dots { display: inline-flex; gap: 3px; align-items: center; }
.vdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--grey); border: 1px solid transparent; }
.vdot.up { background: var(--ok); }
.vdot.fail { background: var(--fail); }
.vdot.ignored { background: transparent; border-color: var(--muted); }
.vdot.missing { background: var(--grid); }

/* ---------- raw / dialog ---------- */
.rawbox textarea { min-height: 220px; }
.rawhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.rawhead h2 { margin: 0; }
.dialog { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; width: min(560px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog h2 { margin-top: 0; }

/* ---------- site matrix ---------- */
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 11px; padding: 6px 2px; vertical-align: bottom; }
.matrix td.cell { text-align: center; padding: 3px; }
.mcell { display: inline-block; width: 18px; height: 18px; border-radius: 4px; background: var(--grid); line-height: 18px; font-size: 10px; font-weight: 700; color: #fff; }
.mcell.OK { background: var(--ok); }
.mcell.WARN { background: var(--warn); }
.mcell.FAIL { background: var(--fail); }
.mcell.SKIP, .mcell.UNKNOWN { background: var(--grey); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; margin-bottom: 8px; }
.legend .mcell { width: 12px; height: 12px; vertical-align: middle; margin-right: 3px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 4px 0 8px 10px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--grey); border: 2px solid var(--card); }
.timeline li.tl-open::before, .timeline li.tl-escalate::before { background: var(--fail); }
.timeline li.tl-recover::before, .timeline li.tl-close::before { background: var(--ok); }
.timeline li.tl-ack::before { background: var(--accent); }
.timeline .t { color: var(--muted); font-size: 12px; margin-right: 6px; }
.timeline .txt { overflow-wrap: anywhere; }

/* ---------- login ---------- */
.login-main { display: flex; align-items: center; justify-content: center; flex: 1; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 26px 26px 22px; }
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; }
.login-brand h1 { margin: 0; font-size: 20px; }
.login-brand .logo { width: 30px; height: 30px; }
.cf-turnstile { min-height: 65px; }

/* ---------- settings ---------- */
.setgroup { scroll-margin-top: 70px; }
.setrow { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.setrow:last-child { border-bottom: 0; }
.setrow .skey { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.setrow .sdesc { font-size: 12px; color: var(--muted); }
.setrow form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.setrow form input:not([type=checkbox]), .setrow form select { width: 220px; }
.setrow form textarea { width: 260px; min-height: 34px; }
.setrow .sdef { font-size: 11.5px; color: var(--muted); }
.setrow.overridden .skey::after { content: " ●"; color: var(--accent-2); }
.groupnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; font-family: var(--mono); font-size: 14px; margin: 8px 0; }
.codes span { padding: 4px 8px; border: 1px dashed var(--border); border-radius: 6px; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .counts { grid-template-columns: 1fr 1fr; }
  .counts .count:last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .top { flex-wrap: wrap; height: auto; min-height: 54px; padding: 8px 16px; gap: 8px; }
  .top .navtoggle { display: inline-flex; order: 2; margin-left: 0; }
  .usermenu { order: 1; margin-left: auto; }
  .brand { order: 0; }
  .mainnav { order: 3; flex-basis: 100%; display: none; flex-direction: column; overflow: visible; padding-bottom: 6px; }
  .mainnav.open { display: flex; }
  .setrow { grid-template-columns: minmax(0, 1fr); }
  .setrow form input:not([type=checkbox]), .setrow form select, .setrow form textarea { width: 100%; flex: 1 1 160px; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .wrap { padding: 14px 16px 32px; }
  .grid3, .counts { grid-template-columns: minmax(0, 1fr); }
  .counts .count:last-child { grid-column: auto; }
  .who { display: none; }
  .chart { height: 240px; }
  .chart.heat { height: 460px; }
  .hgrid, .hgrid.mini { grid-template-columns: minmax(0, 1fr); }
  .hgrid.mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter { width: 100%; }
  .tools { width: 100%; }
  .range-custom { width: 100%; }
  .range-custom label { flex: 1 1 150px; min-width: 0; }
  .range-custom input { width: 100%; }
  .kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  form.rule .rstate { margin-left: 0; }
  .foot { gap: 8px; }
}
.rulewrap { display: flex; gap: 8px; align-items: center; }
.rulewrap > form.rule { flex: 1; min-width: 0; }
.short { width: 100px; }
.tools .field { min-width: 140px; }
.card.focus { border-color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.tile { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--card-2); }
.tile .k { display: block; font-size: 11.5px; color: var(--muted); }
.tile .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.warnbox { background: var(--warn-bg); border: 1px solid rgba(245,158,11,.45); border-radius: 8px; padding: 8px 10px; }
.checklist li { margin-bottom: 6px; }
.hosttitle { font-size: 18px; }

.scrolly { max-height: 560px; overflow: auto; }

/* ---- audit 2026-10-15 additions ---- */
fieldset.ro { border: 0; padding: 0; margin: 0; min-width: 0; }
.theme-toggle .ic-light { display: none; }
.theme-toggle .ic-dark, body.light .theme-toggle .ic-light { display: inline-flex; }
body.light .theme-toggle .ic-dark { display: none; }
.qrbox { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin: 8px 0 12px; }
.qr { width: 200px; height: 200px; max-width: 100%; border-radius: 6px; background: #fff; flex: none; }
.daycount { display: flex; gap: 12px; flex-wrap: wrap; }
.daycount .tile { min-width: 180px; }
.rulelist td { vertical-align: middle; }
.daycount .tile > span { display: block; }
