/*
 * DataReel System Monitor (DRSM) Web interface styles.
 * No external fonts or frameworks, so pages work on private networks.
 * Site overrides go in ${WWWdir}/site/custom.css
 */

/* ---------- Tokens ---------- */

:root {
  --bg: #0b1120;
  --bg-2: #0f172a;
  --surface: #131c31;
  --surface-2: #1a2540;
  --surface-3: #22304f;
  --border: #26334f;
  --border-strong: #34446a;
  --text: #e6ebf5;
  --text-2: #a7b2c8;
  --muted: #7d89a3;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-ink: #04121c;

  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, .14);
  --ok-ink: #4ade80;
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, .15);
  --warn-ink: #fbbf24;
  --err: #ef4444;
  --err-bg: rgba(239, 68, 68, .16);
  --err-ink: #f87171;
  --stale: #a855f7;
  --stale-bg: rgba(168, 85, 247, .16);
  --stale-ink: #c084fc;
  --unk: #64748b;
  --unk-bg: rgba(100, 116, 139, .2);
  --unk-ink: #94a3b8;
  --standby: #0ea5e9;
  --standby-bg: rgba(14, 165, 233, .15);
  --standby-ink: #7dd3fc;
  --poweredoff: #6366f1;
  --poweredoff-bg: rgba(99, 102, 241, .16);
  --poweredoff-ink: #a5b4fc;
  --decom: #6b7280;
  --decom-bg: rgba(107, 114, 128, .18);
  --decom-ink: #9ca3af;
  --none: #1b2640;

  --h0: #134e4a;
  --h1: #15803d;
  --h2: #65a30d;
  --h3: #ca8a04;
  --h4: #ea580c;
  --h5: #dc2626;
  --h-ink: #f8fafc;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: 16px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f6fb;
  --bg-2: #eaf0f8;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --surface-3: #e9eef6;
  --border: #dde4ef;
  --border-strong: #c5d0e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-2: #4f46e5;
  --accent-ink: #ffffff;
  --ok-ink: #15803d;
  --ok-bg: rgba(34, 197, 94, .13);
  --warn-ink: #b45309;
  --warn-bg: rgba(245, 158, 11, .16);
  --err-ink: #b91c1c;
  --err-bg: rgba(239, 68, 68, .12);
  --stale-ink: #7e22ce;
  --stale-bg: rgba(168, 85, 247, .12);
  --unk-ink: #475569;
  --unk-bg: rgba(100, 116, 139, .14);
  --standby-ink: #0369a1;
  --standby-bg: rgba(14, 165, 233, .12);
  --poweredoff-ink: #4338ca;
  --poweredoff-bg: rgba(99, 102, 241, .12);
  --decom-ink: #4b5563;
  --decom-bg: rgba(107, 114, 128, .14);
  --none: #edf1f7;
  --h0: #99f6e4;
  --h1: #4ade80;
  --h2: #a3e635;
  --h3: #facc15;
  --h4: #fb923c;
  --h5: #ef4444;
  --h-ink: #0f172a;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f6fb;
    --bg-2: #eaf0f8;
    --surface: #ffffff;
    --surface-2: #f5f8fc;
    --surface-3: #e9eef6;
    --border: #dde4ef;
    --border-strong: #c5d0e1;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --accent: #0284c7;
    --accent-2: #4f46e5;
    --accent-ink: #ffffff;
    --ok-ink: #15803d;
    --ok-bg: rgba(34, 197, 94, .13);
    --warn-ink: #b45309;
    --warn-bg: rgba(245, 158, 11, .16);
    --err-ink: #b91c1c;
    --err-bg: rgba(239, 68, 68, .12);
    --stale-ink: #7e22ce;
    --stale-bg: rgba(168, 85, 247, .12);
    --unk-ink: #475569;
    --unk-bg: rgba(100, 116, 139, .14);
    --standby-ink: #0369a1;
    --standby-bg: rgba(14, 165, 233, .12);
    --poweredoff-ink: #4338ca;
    --poweredoff-bg: rgba(99, 102, 241, .12);
    --decom-ink: #4b5563;
    --decom-bg: rgba(107, 114, 128, .14);
    --none: #edf1f7;
    --h0: #99f6e4;
    --h1: #4ade80;
    --h2: #a3e635;
    --h3: #facc15;
    --h4: #fb923c;
    --h5: #ef4444;
    --h-ink: #0f172a;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .06);
    color-scheme: light;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(56, 189, 248, .08), transparent 60%),
    radial-gradient(900px 400px at -10% 0%, rgba(129, 140, 248, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-3); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.strong { font-weight: 650; }
.grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .topbar { background: var(--bg); }
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 32px; width: auto; max-width: 120px; object-fit: contain; }
.brand-mark { display: inline-flex; align-items: flex-end; gap: 3px; width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.brand-mark span { flex: 1; border-radius: 2px; background: rgba(255, 255, 255, .92); }
.brand-mark span:nth-child(1) { height: 45%; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 70%; }
.brand-mark.warn { background: linear-gradient(135deg, var(--warn), #f97316); }
.brand-mark.err { background: linear-gradient(135deg, var(--err), #f97316); }
.brand-mark.stale { background: linear-gradient(135deg, var(--stale), var(--accent-2)); }
.nav { display: flex; gap: 4px; flex: 1 1 auto; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.tools { display: flex; align-items: center; gap: 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: .85rem; cursor: pointer;
}
.tool:hover { color: var(--text); border-color: var(--border-strong); }
.tool.icon-only { width: 36px; padding: 0; justify-content: center; }
.tool .ring { width: 18px; height: 18px; transform: rotate(-90deg); }
.tool .ring circle { fill: none; stroke: var(--border-strong); stroke-width: 3; }
.tool .ring .ring-fill { stroke: var(--ok); stroke-dasharray: 56.55; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
.tool[aria-pressed="false"] .ring .ring-fill { stroke: var(--muted); }
:root[data-theme="light"] [data-action="theme"] .icon:first-of-type,
:root:not([data-theme="light"]) [data-action="theme"] .icon:last-of-type { display: none; }

/* ---------- Page ---------- */

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px var(--gutter) 40px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.footer {
  max-width: 1440px; width: 100%; margin: 0 auto;
  padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  color: var(--text-2); font-size: .82rem; border-top: 1px solid var(--border);
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-head p { margin-top: 4px; }
.scope-note { color: var(--muted); }
.scope-note .link { margin-left: 6px; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 550; }

/* ---------- Panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; }
.panel-head h2 .icon { color: var(--muted); }
.panel-head.wrap { flex-wrap: wrap; }
.panel-head .link { font-size: .85rem; font-weight: 600; }
.count { min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .8rem; font-weight: 700; text-align: center; }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h1 { font-size: 1.3rem; color: var(--text); }
.empty .icon { width: 30px; height: 30px; }
.empty.ok .icon { color: var(--ok); }
.pad { padding: 12px 16px; }

/* ---------- Hero ---------- */

.hero {
  --tone: var(--ok);
  --tone-bg: var(--ok-bg);
  position: relative;
  overflow: hidden;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    linear-gradient(110deg, var(--tone-bg), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow);
}
.hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--tone); }
.hero.warn { --tone: var(--warn); --tone-bg: var(--warn-bg); }
.hero.err { --tone: var(--err); --tone-bg: var(--err-bg); }
.hero.stale { --tone: var(--stale); --tone-bg: var(--stale-bg); }
.hero.unk { --tone: var(--unk); --tone-bg: var(--unk-bg); }
.hero-status { display: flex; align-items: center; gap: 16px; min-width: 0; }
.hero-status h1 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); overflow-wrap: anywhere; }
.hero-status p { color: var(--text-2); margin-top: 3px; }
.hero-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.hero.compact .hero-meta { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.pulse { position: relative; width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 4px var(--tone-bg); }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--tone); animation: pulse 2s ease-out infinite; }
.hero.ok .pulse::after { animation-duration: 3.5s; }
@keyframes pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(3); opacity: 0; } }

/* ---------- KPIs ---------- */

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpis.small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  --tone: var(--accent);
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
}
a.kpi:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--border-strong); }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tone); opacity: .85; }
.kpi.ok { --tone: var(--ok); }
.kpi.warn { --tone: var(--warn); }
.kpi.err { --tone: var(--err); }
.kpi.stale { --tone: var(--stale); }
.kpi.unk { --tone: var(--unk); }
.kpi-label { color: var(--text-2); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.9rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { color: var(--muted); font-size: .8rem; }

/* ---------- Status pieces ---------- */

.badge {
  --tone: var(--unk); --tone-bg: var(--unk-bg); --tone-ink: var(--unk-ink);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--tone-bg); color: var(--tone-ink);
  font-size: .76rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.ok { --tone: var(--ok); --tone-bg: var(--ok-bg); --tone-ink: var(--ok-ink); }
.warn { --tone: var(--warn); --tone-bg: var(--warn-bg); --tone-ink: var(--warn-ink); }
.err { --tone: var(--err); --tone-bg: var(--err-bg); --tone-ink: var(--err-ink); }
.stale { --tone: var(--stale); --tone-bg: var(--stale-bg); --tone-ink: var(--stale-ink); }
.unk { --tone: var(--unk); --tone-bg: var(--unk-bg); --tone-ink: var(--unk-ink); }
.dot-lg { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--tone); box-shadow: 0 0 0 3px var(--tone-bg); }
.seg .dot, .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: .75rem; font-weight: 600; }
.chip-id { display: inline-block; margin-right: 8px; padding: 0 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); font-family: var(--mono); font-size: .75rem; }
.callout { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--tone-bg); color: var(--tone-ink); border: 1px solid var(--tone); font-weight: 550; }

/* ---------- Attention list ---------- */

.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 1001px) {
  .alerts { max-height: 520px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
}
.alert { flex: none; border: 1px solid var(--border); border-left: 4px solid var(--tone); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.alert-host { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); }
.alert-host:hover { text-decoration: none; background: var(--surface-3); }
.alert-host .muted { font-size: .85rem; }
.alert-lines { list-style: none; margin: 0; padding: 0 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.alert-lines li { font-size: .86rem; }
.alert-lines li a, .alert-lines li > span { display: block; padding: 5px 10px; border-radius: 7px; background: var(--tone-bg); color: var(--text); overflow-wrap: anywhere; }
.alert-lines li a:hover { text-decoration: none; filter: brightness(1.15); }
.alert-lines li.more a { background: transparent; color: var(--accent); padding-left: 10px; }
.alert-lines.flat { padding: 0; }

/* ---------- Group checks ---------- */

.group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.group-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.group-list a:hover { text-decoration: none; border-color: var(--border-strong); }
.group-list .muted { font-size: .8rem; }

/* ---------- Host matrix ---------- */

.matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(22px, 1fr)); gap: 5px; }
.matrix .cell { position: relative; aspect-ratio: 1; border-radius: 5px; background: var(--tone); opacity: .9; transition: transform .12s ease, opacity .12s ease; }
.matrix .cell:hover { transform: scale(1.18); opacity: 1; }
.matrix .cell.ok { opacity: .7; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; color: var(--text-2); font-size: .78rem; }
.legend.pad { margin: 0; border-top: 1px solid var(--border); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--tone); }
.legend i.none { width: auto; height: auto; background: none; color: var(--muted); font-style: normal; }
.legend i.none::before { content: "\2013"; }
.legend.scale { gap: 4px; }
.legend.scale i { width: 26px; }
.legend.scale .muted { margin-left: 12px; }

/* ---------- Filters ---------- */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input, .select select {
  height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: .88rem;
}
.search input { width: 220px; padding: 0 12px 0 32px; }
.select select { padding: 0 10px; }
.search input:focus, .select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, .2); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.seg button, .seg a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 8px; border: 0; background: transparent;
  color: var(--text-2); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.seg button:hover, .seg a:hover { color: var(--text); text-decoration: none; }
.seg .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .2), inset 0 0 0 1px var(--border-strong); }
.button {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  font: inherit; font-size: .86rem; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.button:hover { text-decoration: none; filter: brightness(1.08); }
.button.ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.button.ghost:hover { border-color: var(--border-strong); }
.button.small { height: 30px; padding: 0 10px; font-size: .8rem; }

/* ---------- Login ---------- */

.signout { display: contents; }
.login-tools { position: absolute; top: 12px; right: max(var(--gutter), env(safe-area-inset-right)); }
.login { flex: 1 0 auto; display: grid; place-items: center; padding: 48px var(--gutter); }
.login-card { width: 100%; max-width: 400px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-size: 1.45rem; }
.login-card h1 + p { margin-top: 6px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.field input {
  height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, .2); }
.button.block { width: 100%; height: 42px; justify-content: center; margin-top: 4px; }
.button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.login-foot { text-align: center; overflow-wrap: anywhere; }
.login-body .footer { justify-content: center; }

/* ---------- Host cards ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.card {
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--tone);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  min-width: 0;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); border-top-color: var(--tone); }
.card-link { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 14px; color: var(--text); }
.card-link:hover { text-decoration: none; }
.card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .desc { color: var(--text-2); font-size: .86rem; min-height: 1.3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .note { color: var(--tone-ink); font-size: .84rem; }
.card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; font-size: .78rem; }
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar { display: grid; grid-template-columns: 52px 1fr 40px; align-items: center; gap: 8px; font-size: .76rem; }
.bar-label { color: var(--muted); }
.bar-track { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 6px; background: var(--hc); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 6px; background: var(--tone-bg); color: var(--tone-ink); font-size: .74rem; font-weight: 600; }
.chip.ok { background: var(--surface-3); color: var(--text-2); }

/* Heat colors used by bars, gauges and the metric map */
.h0 { --hc: var(--h0); } .h1 { --hc: var(--h1); } .h2 { --hc: var(--h2); }
.h3 { --hc: var(--h3); } .h4 { --hc: var(--h4); } .h5 { --hc: var(--h5); }
.legend.scale i.h0, .legend.scale i.h1, .legend.scale i.h2, .legend.scale i.h3, .legend.scale i.h4, .legend.scale i.h5 { background: var(--hc); }

/* ---------- Heat map ---------- */

.heat-wrap { overflow: auto; max-height: calc(100vh - 210px); -webkit-overflow-scrolling: touch; }
.heat { width: 100%; border-collapse: separate; border-spacing: 4px; padding: 6px 10px 6px 0; font-size: .82rem; }
.heat tbody th, .heat .corner { width: 1%; }
.heat th { font-weight: 600; color: var(--text-2); }
.heat thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 8px 2px 6px; vertical-align: bottom; min-width: 46px; }
.heat thead th .col-cat { display: block; font-size: .66rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.heat thead th .col-name { display: block; white-space: nowrap; }
.heat tbody th, .heat tfoot th, .heat .corner {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  text-align: left; padding: 0 10px 0 14px; max-width: 220px; min-width: 120px;
}
.heat .corner { z-index: 3; vertical-align: bottom; padding-bottom: 6px; }
.heat tbody th a { display: flex; align-items: center; gap: 8px; color: var(--text); }
.heat td { position: relative; padding: 0; text-align: center; }
.hcell {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-width: 42px; height: 36px; border-radius: 9px;
  background: var(--tone-bg); color: var(--tone);
  transition: transform .1s ease, box-shadow .1s ease, background .1s ease;
}
.hcell.ok { background: transparent; }
a.hcell:hover { text-decoration: none; transform: scale(1.06); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); }
.hcell.small { height: 26px; background: transparent; }
.hcell.small .sicon { width: 16px; height: 16px; }
.sicon { width: 22px; height: 22px; flex: none; color: var(--tone); }
.sicon.ok { color: var(--ok); }
.sicon.warn { color: var(--warn); }
.sicon.err { color: var(--err); }
.sicon.stale { color: var(--stale); }
.sicon.unk { color: var(--unk); }
.hcell.err .sicon, .hcell.warn .sicon { filter: drop-shadow(0 0 6px var(--tone-bg)); }
.heat td.none::before { content: "\2013"; display: flex; align-items: center; justify-content: center; min-width: 42px; height: 36px; color: var(--muted); opacity: .6; }
.legend .sicon { width: 15px; height: 15px; }
.heat tfoot th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.heat.metrics thead th { min-width: 80px; }
.heat.metrics td.none::before { display: none; }
.mcell { display: flex; align-items: center; justify-content: center; min-width: 76px; height: 34px; border-radius: 7px; background: var(--hc); color: var(--h-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.mcell.none { background: var(--none); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); font-weight: 500; }
.h0 .mcell, .mcell.h0 { color: var(--text); }
:root[data-theme="light"] .mcell.h0 { color: var(--h-ink); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; white-space: nowrap; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th.sorted-asc::after { content: " \25B2"; font-size: .65rem; }
.table th.sorted-desc::after { content: " \25BC"; font-size: .65rem; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.row-err td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.table tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.table tr.row-stale td:first-child { box-shadow: inset 3px 0 0 var(--stale); }
.table .num { text-align: right; }
.mval { display: inline-block; min-width: 48px; padding: 2px 8px; border-radius: 6px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; background: var(--hc); color: var(--h-ink); }
.mval.h0 { background: var(--surface-3); color: var(--text-2); }
.tally { display: inline-flex; gap: 4px; }
.tally span { min-width: 24px; padding: 1px 7px; border-radius: 6px; text-align: center; font-weight: 700; font-size: .8rem; background: var(--tone-bg); color: var(--tone-ink); }
.show-sm { display: none; }

/* ---------- Host detail ---------- */

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .9rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.gauge { position: relative; max-width: 130px; width: 100%; margin: 0 auto; aspect-ratio: 1; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 3.2; }
.g-track { stroke: var(--surface-3); }
.g-fill { stroke: var(--hc); stroke-linecap: round; }
.gauge.h0 .g-fill { stroke: var(--ok); }
.g-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.g-text strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.g-text span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sections { display: flex; flex-direction: column; gap: 8px; }
.section { border: 1px solid var(--border); border-left: 4px solid var(--tone); border-radius: var(--radius-sm); background: var(--surface-2); scroll-margin-top: 80px; }
.section:target { box-shadow: 0 0 0 2px var(--accent); }
.section summary, .raw summary { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; list-style: none; }
.section summary::-webkit-details-marker, .raw summary::-webkit-details-marker { display: none; }
.section summary::after, .raw summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s ease; margin-left: 4px; }
.section[open] summary::after, .raw[open] summary::after { transform: rotate(45deg); }
.raw summary { padding: 0; justify-content: space-between; }
.sec-id { font-family: var(--mono); font-weight: 650; font-size: .86rem; white-space: nowrap; }
.sec-sum { flex: 1 1 auto; color: var(--text-2); font-size: .86rem; }
.sec-meta { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.section pre { margin: 0 14px 14px; }

pre.report {
  margin: 12px 0 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  font: .8rem/1.6 var(--mono);
  overflow: auto;
  max-height: 70vh;
  white-space: pre;
  tab-size: 8;
}
.section pre.report { margin-top: 0; }
pre.report span { display: inline-block; min-width: 100%; padding: 0 6px; margin: 0 -6px; border-radius: 4px; }
.l-err { background: var(--err-bg); color: var(--err-ink); font-weight: 650; }
.l-warn { background: var(--warn-bg); color: var(--warn-ink); font-weight: 650; }
.l-unk { background: var(--unk-bg); color: var(--unk-ink); }
.l-info { color: var(--text); }
.l-metric { color: var(--accent-2); }
.l-head { color: var(--text); font-weight: 700; background: var(--surface-3); margin-top: 6px !important; }

/* ---------- Wall display ---------- */

:root.wall .topbar .nav, :root.wall .footer, :root.wall .filters { display: none; }
:root.wall .page { max-width: none; }
:root.wall .kpi-value { font-size: 2.4rem; }

/* ---------- Trends ---------- */

.host-pick select {
  height: 36px; padding: 0 30px 0 12px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; font-size: .86rem;
}
.trend-table td, .trend-table th { vertical-align: top; }
.trend-table tbody th { font-weight: 650; white-space: nowrap; }
.trend-table .badge { vertical-align: middle; white-space: nowrap; }
.trend-table .num, .trend-table thead th { white-space: nowrap; }
.trend-table td.small { min-width: 200px; }
.notes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: .9rem; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 18px; }
.trend-card .panel-head { margin-bottom: 6px; }
.trend-card h2 { font-size: 1rem; }
.trend-now { font-size: 1.25rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.trend-plot { position: relative; }
.trend-svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend-svg .grid { stroke: var(--border); stroke-width: 1; }
.trend-svg .ax { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.trend-svg .band rect { fill: var(--accent); opacity: .14; }
.trend-svg .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-svg .anom { stroke: var(--surface); stroke-width: 2; }
.trend-svg .anom.hi { fill: var(--warn); }
.trend-svg .anom.lo { fill: var(--unk-ink); }
.trend-svg .xhair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.trend-plot.hover .xhair { opacity: .7; }
.trend-tip {
  position: absolute; top: 0; z-index: 5; pointer-events: none; padding: 6px 9px; border-radius: 8px;
  background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: .78rem; line-height: 1.35; white-space: nowrap; color: var(--text);
}
.trend-tip .muted { display: block; }
.trend-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .8rem; color: var(--text-2); }
.trend-foot strong { color: var(--text); font-variant-numeric: tabular-nums; }
.key-band, .key-anom { display: inline-block; vertical-align: -1px; margin-right: 5px; }
.key-band { width: 14px; height: 10px; border-radius: 2px; background: var(--accent); opacity: .3; }
.key-anom { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }

/* ---------- Organizations and sites ---------- */

.org { display: flex; flex-direction: column; gap: 12px; }
.org-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.org-head h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.site-card {
  position: relative; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 14px 12px 19px; border-radius: var(--radius);
  background: linear-gradient(110deg, var(--tone-bg), transparent 55%), var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.site-card.ok { background: var(--surface); }
.site-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--tone); }
.site-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.site-title { min-width: 0; }
.site-card h3 { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-card h3 a { color: var(--text); }
.site-title p { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; color: var(--text-2); }
.site-counts li { display: inline-flex; align-items: center; gap: 5px; }
.site-counts li[class] { color: var(--tone-ink); font-weight: 600; }
.site-counts li.ok { color: var(--text-2); font-weight: 500; }
/* Menus: <details> drop downs with nested <details> submenus, so they
   open by click, tap or keyboard without the script */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; user-select: none; }
.menu > summary::-webkit-details-marker, .menu-sub > summary::-webkit-details-marker { display: none; }
.menu > summary .icon:last-child { width: 14px; height: 14px; transition: transform .15s ease; }
.menu[open] > summary .icon:last-child { transform: rotate(180deg); }
.menu-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); right: 0;
  min-width: 230px; max-width: min(340px, calc(100vw - 2 * var(--gutter))); max-height: min(70vh, 560px); overflow: auto;
  padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow);
}
.menu-head { margin: 6px 8px 4px; color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.menu-panel nav + nav { margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--border); }
.menu-tree { list-style: none; margin: 0; padding: 0; }
.menu-tree .menu-tree { margin-left: 10px; padding-left: 8px; border-left: 1px solid var(--border); }
.menu-tree a, .menu-sub > summary {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px;
  color: var(--text); font-size: .88rem; font-weight: 500; overflow-wrap: anywhere;
}
.menu-tree a:hover, .menu-sub > summary:hover { background: var(--surface-2); text-decoration: none; }
.menu-tree a:focus-visible, .menu summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.menu-tree a .icon { width: 13px; height: 13px; margin-left: auto; flex: none; color: var(--muted); }
.menu-sub > summary { list-style: none; cursor: pointer; font-weight: 600; }
.menu-sub > summary .icon { width: 14px; height: 14px; margin-left: auto; flex: none; color: var(--muted); transform: rotate(-90deg); transition: transform .15s ease; }
.menu-sub[open] > summary .icon { transform: none; }
/* Site cards: the menu opens inside the card */
.card-links > summary.menu-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: .8rem; font-weight: 600; }
.card-links > summary .icon { width: 15px; height: 15px; }
.card-links .menu-panel { position: static; max-width: none; min-width: 0; max-height: none; margin-top: 6px; box-shadow: none; background: var(--surface-2); }
/* Main menu items with views */
.nav-item { display: inline-flex; align-items: center; border-radius: 10px; }
.nav-item > a { padding-right: 6px; }
.nav-item.active { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); }
.nav-item.active > a.active { background: none; box-shadow: none; }
.nav-menu > summary { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 34px; margin-right: 2px; border-radius: 8px; color: var(--muted); }
.nav-menu > summary:hover { background: var(--surface-2); color: var(--text); }
.nav-menu .menu-panel { left: -120px; right: auto; min-width: 200px; }
.nav .menu-tree a { white-space: normal; color: var(--text); }
.tools .tool { white-space: nowrap; flex: none; }

/* Tiers: outlined so they never read as a host state */
.tier { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid currentColor; border-radius: 5px; color: var(--text-2); font-size: .66rem; font-weight: 700; letter-spacing: .04em; line-height: 1.45; vertical-align: 1px; }
.tier.tier-dev { color: var(--accent-2); }
.tier.tier-qa { color: var(--accent); }
.tier-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--text-2); }
.tier-counts li { display: inline-flex; align-items: center; gap: 4px; }
.tier-counts .tier { margin-left: 0; }
.tier-counts li.active { color: var(--text); font-weight: 700; }
td > .tier:first-child { margin-left: 0; }
.show-md-inline { display: none; }
.matrix.tiles { grid-template-columns: repeat(auto-fill, minmax(24px, 1fr)); }
.matrix.metric .cell { background: var(--hc); opacity: .95; }
.matrix .cell.none { background: var(--none); box-shadow: inset 0 0 0 1px var(--border); opacity: 1; }
.site-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; margin-top: auto; font-size: .78rem; }
.site-card footer .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; }
.site-links { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 8px; border-top: 1px solid var(--border); font-size: .8rem; font-weight: 600; }
.callout.small { padding: 7px 10px; font-size: .82rem; }
.callout.small .icon { width: 16px; height: 16px; flex: none; }
.scope-line { display: flex; align-items: center; gap: 6px; margin-bottom: -6px; font-size: .85rem; font-weight: 600; }
.scope-line .icon { width: 16px; height: 16px; }
.site-picker select { max-width: 210px; }
.site-pick { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.site-tag { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-site { padding: 12px 16px 0; display: flex; align-items: center; gap: 10px; }
.trend-table .site-row th { padding-top: 16px; background: var(--surface-2); color: var(--text); font-weight: 700; text-align: left; }
.trend-table .site-row .icon { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; color: var(--muted); }
.trend-table .site-total th, .trend-table .site-total td { border-top: 2px solid var(--border-strong); font-weight: 650; }
.heat-site h2 { font-size: 1rem; }

/* ---------- Status messages (drsm_messages.php) ---------- */
.msgbar { --tone: var(--accent); display: flex; align-items: stretch; gap: 0; border-bottom: 1px solid var(--border); background: var(--surface); overflow: hidden; font-size: .9rem; }
.msgbar-warning { --tone: var(--warn); }
.msgbar-critical { --tone: var(--err); }
.msgbar::before { content: ""; flex: none; width: 5px; background: var(--tone); }
.msg-pinned { display: flex; flex: none; max-width: 60%; border-right: 1px solid var(--border); }
.msg-scroll { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.msg-track { display: flex; width: max-content; animation: msg-scroll linear infinite; }
.msg-scroll:hover .msg-track, .msg-scroll:focus-within .msg-track { animation-play-state: paused; }
@keyframes msg-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.msg-run { display: flex; align-items: center; padding-right: 40px; }
.msg { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; color: var(--text); white-space: nowrap; }
.msg:hover { text-decoration: none; background: var(--surface-2); }
.msg .icon { width: 16px; height: 16px; flex: none; }
.msg-level { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.msg-info .icon { color: var(--accent); } .msg-info .msg-level { color: var(--accent); background: var(--surface-3); }
.msg-warning .icon { color: var(--warn); } .msg-warning .msg-level { color: var(--warn-ink); background: var(--warn-bg); }
.msg-critical .icon { color: var(--err); } .msg-critical .msg-level { color: var(--err-ink); background: var(--err-bg); }
.msg-text { font-weight: 600; }
.msg-level.msg-info { color: var(--accent); background: var(--surface-3); } .msg-level.msg-warning { color: var(--warn-ink); background: var(--warn-bg); } .msg-level.msg-critical { color: var(--err-ink); background: var(--err-bg); }
.msg-pinned .msg { white-space: normal; }
.msg-sep { color: var(--muted); padding: 0 6px; }
:root.wall .msgbar { font-size: 1.35rem; }
:root.wall .msg { padding: 14px 24px; }
:root.wall .msg .icon { width: 24px; height: 24px; }
@media (prefers-reduced-motion: reduce) {
  .msg-track { animation: none; width: auto; }
  .msg-run { flex-wrap: wrap; }
  .msg-run[aria-hidden] { display: none; }
  .msg { white-space: normal; }
}
/* ---------- Clusters (clusters.php) ---------- */

.cl-diagram { margin: 4px 0 14px; overflow-x: auto; }
.cl-svg { display: block; width: 100%; max-width: 980px; height: auto; margin: 0 auto; }
.cl-node rect { fill: var(--surface-2); stroke: var(--tone, var(--unk)); stroke-width: 2; }
.cl-node circle { fill: var(--tone, var(--unk)); }
.cl-node.ok { --tone: var(--ok); }
.cl-node.warn { --tone: var(--warn); }
.cl-node.err { --tone: var(--err); }
.cl-node.err rect { fill: var(--err-bg); }
.cl-svg a:hover rect { fill: var(--surface-3); }
.cl-name { fill: var(--text); font-size: 15px; font-weight: 700; font-family: var(--font); }
.cl-sub { fill: var(--text-2); font-size: 11.5px; font-family: var(--font); }
.cl-link { stroke: var(--unk); stroke-width: 3; stroke-linecap: round; }
.cl-link.ok { stroke: var(--ok); }
.cl-link.warn { stroke: var(--warn); stroke-dasharray: 8 5; }
.cl-link.err { stroke: var(--err); stroke-dasharray: 3 5; }
.cl-ltext { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.cl-strip-row { margin: 10px 0 16px; }
.cl-strip-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.cl-strip { display: block; width: 100%; height: 40px; }
.cl-strip .tick { stroke: var(--border-strong); }
.cl-strip .ax, .cl-hist .ax { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.s-ok, .cl-legend .s-ok { fill: var(--ok); background: var(--ok); }
.s-miss, .cl-legend .s-miss { fill: var(--warn); background: var(--warn); }
.s-down, .cl-legend .s-down { fill: var(--err); background: var(--err); }
.s-stby, .cl-legend .s-stby { fill: var(--accent-2); background: var(--accent-2); }
.s-iso, .cl-legend .s-iso { fill: var(--stale); background: var(--stale); }
.s-none, .cl-legend .s-none { fill: var(--surface-3); background: var(--surface-3); }
.cl-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); }
.cl-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cl-hist .h-ok { fill: var(--ok); opacity: .7; }
.cl-hist .h-miss { fill: var(--warn); }
.cl-hist .h-down { fill: var(--err); opacity: .75; }
.cl-hist .h-none { fill: var(--surface-3); }
.cl-cm { border-top: 1px solid var(--border); padding: 10px 0; }
.cl-cm summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cl-cm pre.report { margin-top: 10px; }
.cl-tag { white-space: nowrap; }
.heat.clusters td { min-width: 120px; }
.hcell.wide { gap: 8px; padding: 0 12px; justify-content: flex-start; white-space: nowrap; }
.hcell.wide .hcell-text { color: var(--text); font-size: .8rem; font-weight: 600; }
.cl-tag .icon { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }

@media print { .msgbar { display: none; } }

/* ---------- Responsive ---------- */

@media (max-width: 1640px) {
  .links-menu .menu-label { display: none; }
  .site-picker select { max-width: 180px; }
}
@media (max-width: 1320px) {
  .nav-menu > summary { width: 18px; }
  .nav a { padding-left: 9px; padding-right: 9px; }
}
/* Icons only: the labels stay for screen readers */
@media (max-width: 1440px) and (min-width: 721px) {
  .nav a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav a { padding: 8px 10px; }
}
/* Extra menu items ($NAVextra, other reports): the top bar uses the
   full width. Below 1800px the menu gets its own row and keeps its
   names (icons alone were not seen as a menu on Windows screens,
   which are 1280 to 1800 CSS pixels wide at 125 to 150% scaling). */
.topbar.nav-wide .topbar-inner { max-width: none; }
@media (max-width: 1800px) and (min-width: 721px) {
  .topbar.nav-wide .topbar-inner { flex-wrap: wrap; row-gap: 2px; padding-bottom: 6px; }
  .topbar.nav-wide .brand { flex: 1 1 auto; }
  .topbar.nav-wide .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: 2px; }
  .topbar.nav-wide .nav a span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .topbar.nav-wide .nav a { padding: 7px 10px; }
  .topbar.nav-wide .links-menu .menu-label { display: inline; }
  .topbar.nav-wide .brand-text, .topbar.nav-wide .nav-menu { display: revert; }
}
@media (max-width: 1000px) and (min-width: 721px) {
  .site-picker select { max-width: 150px; }
  .tools .refresh-label { display: none; }
  .topbar-inner { gap: 12px; }
}
@media (max-width: 880px) and (min-width: 721px) {
  .brand-text, .nav-menu { display: none; }
}
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .split, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none; }
  .show-md-inline { display: inline; }
}
@media (max-width: 720px) {
  .nav-menu { display: none; }
  .nav-item { flex: 1 1 0; }
  .nav-item > a { flex: 1 1 auto; padding-right: 4px; }
  .nav-item.active { background: none; box-shadow: none; }
  .nav-item.active > a.active { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); }
  .links-menu .menu-label { display: none; }
  .links-menu .menu-panel { position: fixed; top: auto; left: var(--gutter); right: var(--gutter); max-width: none; margin-top: 6px; }
  body { font-size: 14px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .brand { flex: 1 1 auto; }
  .nav { order: 3; flex-basis: 100%; justify-content: space-between; gap: 2px; }
  .nav a { flex: 1 1 0; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .7rem; }
  .nav a span { display: inline; }
  .tools .refresh-label { display: none; }
  .tool { height: 34px; }
  .page { padding-top: 14px; gap: 14px; }
  .hero { padding: 16px 16px 16px 20px; }
  .hero-meta, .hero.compact .hero-meta { align-items: flex-start; justify-content: flex-start; text-align: left; width: 100%; }
  .hero.compact .hero-meta { flex-direction: row; }
  .kpis, .kpis.small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 1.6rem; }
  .panel { padding: 14px; }
  .filters, .head-actions { width: 100%; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .site-grid { grid-template-columns: minmax(0, 1fr); }
  .site-picker select { max-width: 140px; }
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .table th, .table td { padding: 10px; }
  .heat-wrap { max-height: none; }
  .heat tbody th, .heat tfoot th, .heat .corner { min-width: 96px; max-width: 130px; padding-left: 10px; }
  .hcell, .heat td.none::before { min-width: 34px; height: 32px; }
  .sicon { width: 20px; height: 20px; }
  .heat thead th { min-width: 38px; }
  .mcell { min-width: 58px; }
  .heat.metrics thead th { min-width: 60px; }
  .sec-sum { display: none; }
  .meta { gap: 6px 14px; }
  .gauges { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login { padding: 56px var(--gutter) 24px; place-items: start center; }
  .login-card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .footer, .filters, .head-actions { display: none; }
  body { background: #fff; color: #000; }
  .panel, .hero, .kpi, .card { box-shadow: none; }
  pre.report { max-height: none; white-space: pre-wrap; }
}

/* Help page guide tabs */
.help-tabs { margin-bottom: 14px; width: max-content; max-width: 100%; }
.help-page { line-height: 1.55; }
.help-page h1 { margin-bottom: 4px; }
.help-page h2 { margin: 26px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 1.15rem; }
.help-page h3 { margin: 16px 0 4px; font-size: 1rem; }
.help-page p, .help-page ul, .help-page ol { margin: 6px 0 10px; }
.help-page pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; overflow-x: auto; margin: 8px 0 12px; }
.help-page pre code { background: none; padding: 0; font-size: .85rem; white-space: pre; }
.help-page .table td:first-child { white-space: nowrap; }
@media (max-width: 700px) { .help-page .table td:first-child { white-space: normal; } }

/* ---------- Meters layout (drsm_meters.php) ---------- */

.layout-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.layout-bar .scope-line { margin-bottom: 0; }
.layout-bar .head-actions { margin-left: auto; }
.m-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.m-tile { position: relative; --tone: var(--unk); --tone-bg: var(--unk-bg); }
.m-tile.ok { --tone: var(--ok); --tone-bg: var(--ok-bg); }
.m-tile.warn { --tone: var(--warn); --tone-bg: var(--warn-bg); }
.m-tile.err { --tone: var(--err); --tone-bg: var(--err-bg); }
.m-tile.stale { --tone: var(--stale); --tone-bg: var(--stale-bg); }
.m-tile > summary {
  list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 12px; height: 100%;
  padding: 14px 16px 16px; border: 1px solid var(--border); border-top: 4px solid var(--tone); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--tone-bg), transparent 55%), var(--surface); box-shadow: var(--shadow);
}
.m-tile > summary::-webkit-details-marker { display: none; }
.m-tile > summary:hover, .m-tile[open] > summary { border-color: var(--tone); }
.m-tile.err > summary { animation: m-glow 2.4s ease-in-out infinite; }
@keyframes m-glow { 50% { box-shadow: 0 0 0 3px var(--err-bg), var(--shadow); } }
/* Errors that are a small part of a tile: red top line, badge and ring slice only */
.m-tile.minor > summary { animation: none; background: var(--surface); }
.t-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.02rem; }
.t-head .icon { width: 18px; height: 18px; color: var(--tone); flex: none; }
.t-head .icon:last-child { margin-left: auto; color: var(--muted); width: 16px; height: 16px; }
.t-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-body { display: flex; align-items: center; gap: 14px; }
.t-sum { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.t-counts { display: inline-flex; flex-wrap: wrap; gap: 8px; font-weight: 700; font-size: .85rem; }
.cnt { display: inline-flex; align-items: center; gap: 4px; }
.cnt i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.cnt.ok i { background: var(--ok); } .cnt.warn i { background: var(--warn); } .cnt.err i { background: var(--err); } .cnt.stale i { background: var(--stale); } .cnt.unk i { background: var(--unk); }
.m-gauge { position: relative; display: inline-grid; place-items: center; flex: none; }
.m-gauge svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.m-gauge .m-track { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.m-gauge .seg, .m-g .seg { fill: none; stroke-width: 9; }
.seg.ok { stroke: var(--ok); } .seg.warn { stroke: var(--warn); } .seg.stale { stroke: var(--stale); } .seg.err { stroke: var(--err); } .seg.unk { stroke: var(--unk); }
.m-gauge .m-val { position: relative; font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.m-gauge .m-val small { font-size: .65em; font-weight: 700; color: var(--muted); }
.t-panel { left: 0; right: 0; max-width: none; min-width: 300px; max-height: min(70vh, 620px); }
.t-items, .t-hosts { list-style: none; margin: 0; padding: 0; }
.t-items > li > a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px; border-radius: 7px; color: var(--text); font-size: .88rem; }
.t-items > li > a:hover { background: var(--surface-2); text-decoration: none; }
.t-items > li + li { border-top: 1px solid var(--border); }
.t-it { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.t-items .icon { width: 14px; height: 14px; color: var(--muted); flex: none; }
.t-hosts { margin: 0 8px 8px 14px; padding-left: 8px; border-left: 2px solid var(--border); }
.t-hosts a { display: flex; align-items: center; gap: 8px; padding: 3px 6px; font-size: .82rem; color: var(--text); border-radius: 6px; }
.t-hosts a:hover { background: var(--surface-2); text-decoration: none; }
.t-hosts .muted { margin-left: auto; }
.t-hosts i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.t-hosts .ok i { background: var(--ok); } .t-hosts .warn i { background: var(--warn); } .t-hosts .err i { background: var(--err); } .t-hosts .stale i { background: var(--stale); }
.t-hosts .more a { color: var(--accent); }
/* Host resource meters: small rings filled to the percent used */
.m-uses { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 2px; }
.m-use { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 62px; height: 62px; }
.m-use svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.m-use circle { fill: none; stroke-width: 3.4; }
.m-use.h0 .g-fill { stroke: var(--ok); }
.m-use-v { position: relative; font-weight: 800; font-size: .86rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.m-use-l { position: relative; font-size: .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.m-use.none .m-use-v { color: var(--muted); }
/* Heat map mosaic: meters across the top, then every check */
.m-gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.m-g { --tone: var(--unk); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; min-width: 0; text-align: center;
       background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--tone); border-radius: 10px; color: var(--text); box-shadow: var(--shadow); }
.m-g:hover { text-decoration: none; border-color: var(--tone); }
.m-g.ok { --tone: var(--ok); } .m-g.warn { --tone: var(--warn); } .m-g.err { --tone: var(--err); } .m-g.stale { --tone: var(--stale); }
.m-g.err:not(.minor) { animation: m-gglow 1.6s ease-in-out infinite; }
@keyframes m-gglow { 50% { box-shadow: 0 0 16px -2px var(--err); } }
.m-g .m-gauge .m-val { font-size: 1rem; }
.m-g .name { display: block; max-width: 100%; font-size: .78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-g .bad { display: block; font-size: .72rem; color: var(--tone); min-height: 1em; }
.m-field { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; }
.m-grp { --tone: var(--unk); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px 8px; scroll-margin-top: 90px; box-shadow: var(--shadow); }
.m-grp:target { box-shadow: 0 0 0 2px var(--accent); }
.m-grp.ok { --tone: var(--ok); } .m-grp.warn { --tone: var(--warn); } .m-grp.err { --tone: var(--err); } .m-grp.stale { --tone: var(--stale); }
.m-grp h2 { margin: 0 0 6px; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.m-grp h2 i { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.m-grp h2 .muted { font-weight: 500; }
.m-cells { display: flex; flex-wrap: wrap; gap: 3px; max-width: var(--w); }
.m-c { --tone: var(--unk); position: relative; width: var(--cell); height: var(--cell); border-radius: 4px; background: var(--tone); opacity: .82; overflow: hidden; display: block; }
.m-c.ok { --tone: var(--ok); opacity: .6; } .m-c.warn { --tone: var(--warn); } .m-c.err { --tone: var(--err); } .m-c.stale { --tone: var(--stale); }
.m-c::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
              transform: translateX(-120%); animation: m-flow 6s linear infinite; animation-delay: calc(var(--i) * 18ms); }
@keyframes m-flow { 0% { transform: translateX(-120%); } 22%, 100% { transform: translateX(120%); } }
.m-c.err { opacity: 1; animation: m-beat 1.2s ease-in-out infinite; box-shadow: 0 0 10px var(--err); }
.m-c.warn { opacity: .95; animation: m-beat 2.4s ease-in-out infinite; }
.m-c.stale { opacity: .9; }
@keyframes m-beat { 50% { filter: brightness(1.4); transform: scale(1.12); } }
.m-c:hover, .m-c:focus-visible { outline: 2px solid var(--text); z-index: 2; }
.m-legend { margin-top: 4px; }
.m-legend i.ok { background: var(--ok); } .m-legend i.warn { background: var(--warn); } .m-legend i.err { background: var(--err); } .m-legend i.stale { background: var(--stale); } .m-legend i.unk { background: var(--unk); }
.m-hosts { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.m-host { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); }
.m-host:hover { text-decoration: none; border-color: var(--accent); }
.m-host-name { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; }
@media (prefers-reduced-motion: reduce) {
  .m-c::after, .m-c.err, .m-c.warn, .m-g.err, .m-tile.err > summary { animation: none; }
}
@media (max-width: 560px) {
  .m-tiles { grid-template-columns: 1fr; }
  .m-gauges { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m-hosts { grid-template-columns: 1fr; }
  .t-panel { min-width: 0; }
}
.m-foot { margin-top: 14px; }
/* Organizations page, meters layout: a ring per organization, a tile per site */
.org-head .m-gauge .m-val { font-size: .9rem; }
.org-head .m-gauge .m-track, .org-head .m-gauge .seg { stroke-width: 10; }
.m-res .m-uses { gap: 8px 12px; }
.m-res-u { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; max-width: 76px; }
.m-res-h { max-width: 100%; font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-res summary > .badge { align-self: flex-start; }
.m-grp h2 a { color: inherit; } .m-grp h2 a:hover { color: var(--accent); }

/* ---------- Host status: standby, powered off, decommissioned ---------- */

.standby { --tone: var(--standby); --tone-bg: var(--standby-bg); --tone-ink: var(--standby-ink); }
.poweredoff { --tone: var(--poweredoff); --tone-bg: var(--poweredoff-bg); --tone-ink: var(--poweredoff-ink); }
.decom { --tone: var(--decom); --tone-bg: var(--decom-bg); --tone-ink: var(--decom-ink); }
.hstatus {
  display: inline-flex; align-items: center; margin-left: 6px;
  padding: 2px 8px; border-radius: 999px; border: 1px dashed var(--tone);
  background: var(--tone-bg); color: var(--tone-ink);
  font-size: .72rem; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.kpi.standby { --tone: var(--standby); } .kpi.poweredoff { --tone: var(--poweredoff); }
.hero.decom { --tone: var(--decom); --tone-bg: var(--decom-bg); }
.card.decom, .alert.decom { opacity: .75; }
.cell.decom, .m-c.decom { --tone: var(--decom); background: var(--decom); opacity: .5; }
.sicon.decom { color: var(--decom); }
.m-legend i.decom { background: var(--decom); }
.decom-toggle { align-self: center; font-size: .8rem; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.decom-toggle:hover { color: var(--accent); }
.decom-toggle[aria-pressed="true"] { color: var(--accent); }
.trend-svg .mark line { stroke: var(--decom-ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.trend-svg .mark.reused line { stroke: var(--standby); }
.trend-svg .mark text { fill: var(--text-2); font-size: 10px; font-family: var(--font); }
