@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono.woff2') format('woff2');
}

:root {
  --bg:        #0a0b10;
  --surface:   #14161e;
  --line:      #232636;
  --fg:        #eef0f7;
  --muted:     #8389a0;
  --accent:    #5fb8ff;
  --accent-dim:#3a8bd0;
  --missing:   #ff7a7a;
  --ok:        #6ee7b7;
  --selection: rgba(95, 184, 255, .25);
  /* Pass 2 theme tokens — additive (no existing value changed). */
  --cyan:      #22d3ee;
  --panel:     #11141d;
  --panel2:    #151a26;
  --line2:     #2b3146;
  --glow:      rgba(95, 184, 255, .4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 12px/1.55 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fg);
  /* Deep-navy base with two faint corner glows — the mission-control feel
     from the System Metrics redesign, now site-wide. Fixed so it stays put
     while <main> scrolls. */
  background:
    radial-gradient(900px 520px at 82% -10%, rgba(34, 211, 238, .08), transparent 60%),
    radial-gradient(820px 620px at -5% -6%, rgba(95, 184, 255, .07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--selection); }
img.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
img { max-width: 100%; height: auto; }

.app {
  display: flex;
  height: 100vh;
  /* Pin the shell to the viewport so the sidebar stays static and only
     <main> scrolls — otherwise a long page (e.g. 50+ servers) scrolls
     the whole body and the nav scrolls away with it. */
  overflow: hidden;
}
main {
  flex: 1; min-width: 0;
  padding: 1.5rem 2rem 4rem;
  overflow-y: auto;
}

.standalone { max-width: 360px; margin: 0 auto; padding: 4rem 1.5rem; }

/* ---- sidebar nav ---- */
nav.side {
  width: 13rem; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0c1322, #070b15);
  font-size: .8rem;
  /* Static against the viewport; scroll internally only if the nav
     itself is taller than the screen. */
  overflow-y: auto;
}
nav.side .brand {
  display: inline-flex; align-items: center; gap: .55rem;
  line-height: 1; margin-bottom: 1.4rem;
  border-bottom: 1px solid transparent;
}
nav.side .brand img { height: 22px; width: auto; display: block; }
nav.side .brand .name { color: var(--fg); font-size: .9rem; font-weight: 700; letter-spacing: .04em; }
nav.side .brand:hover .name { border-bottom: 1px solid var(--accent); }

nav.side .nav-items { display: flex; flex-direction: column; gap: 1px; flex: 1; }
nav.side a {
  display: block; padding: .35rem .65rem;
  color: var(--muted); text-decoration: none; border: 0;
  border-radius: 5px; position: relative;
}
nav.side a:hover { color: var(--fg); background: rgba(255, 255, 255, .035); }
nav.side a.active {
  color: #eaf6ff;
  background: linear-gradient(90deg, rgba(95, 184, 255, .18), rgba(95, 184, 255, .015));
  box-shadow: inset 0 0 0 1px rgba(95, 184, 255, .2);
}
nav.side a.active::before {
  content: ""; position: absolute; left: 0; top: .28rem; bottom: .28rem; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 10px var(--glow);
}
nav.side .nav-heading {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); opacity: .65;
  padding: 1rem .65rem .25rem;
}

nav.side .sidebar-footer {
  margin-top: 1.5rem; padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .5rem;
}
nav.side form.logout { margin: 0; padding: 0 .65rem; }
nav.side .btn {
  border: 1px solid var(--line); padding: .25rem .7rem; border-radius: 4px;
  color: var(--muted); background: transparent; cursor: pointer; font: inherit; width: 100%;
}
nav.side .btn:hover { border-color: var(--accent); color: var(--accent); }

.nav-toggle-cb { display: none; }
.burger { display: none; }
.burger-scrim { display: none; }

/* ---- uniform page header ---- */
.page-header {
  display: flex;
  align-items: center;
  padding: 0 0 1rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--line);
}
.page-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
}

@media (max-width: 760px) {
  /* Burger button — lives inside the page header, inline with the H1. */
  .page-header .burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: 4px;
    color: var(--fg); cursor: pointer;
    font-size: 1rem; line-height: 1;
    margin-right: .7rem; flex-shrink: 0;
  }
  .page-header .burger:hover { border-color: var(--accent); color: var(--accent); }

  /* Sidebar slides in from the left when the checkbox is on. */
  nav.side {
    position: fixed; top: 0; left: -100%;
    height: 100vh; width: 80%; max-width: 18rem;
    transition: left .2s ease;
    z-index: 200;
    overflow-y: auto;
    box-shadow: 4px 0 12px rgba(0,0,0,.45);
  }
  .nav-toggle-cb:checked ~ nav.side { left: 0; }

  /* Scrim behind the open sidebar — tap to close. Sits above the
     burger so it disappears with the rest of the content. */
  .nav-toggle-cb:checked ~ .burger-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
  }

  main { padding: 1rem .9rem 3rem; }
}

.badge {
  display: inline-block;
  background: var(--missing); color: var(--bg);
  border-radius: 999px;
  padding: 0 .45em;
  font-size: .75em;
  font-weight: 700;
  margin-left: .2em;
  vertical-align: 1px;
}

/* ---- typography ---- */
h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 .5em; font-weight: 700; color: var(--fg); }
h1 { font-size: 1.2rem; margin-top: 0; }
h2 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  margin: 1.4em 0 .5em;
}
h2:first-child { margin-top: 0; }
p, ul, ol, blockquote, pre, table { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: var(--accent); }
strong, b { color: var(--fg); font-weight: 700; }
code {
  font: inherit; background: var(--surface); padding: 0 .35em; border-radius: 3px;
  border: 1px solid var(--line); color: var(--fg);
}
.muted { color: var(--muted); }
.footnote { font-size: .8rem; margin-top: 1.5rem; color: var(--muted); }

section { margin-bottom: 1.8rem; }

/* ---- tables (kb-style: bottom borders only, no card) ---- */
/* sections become the scroll container on narrow viewports so wide
   tables don't push the whole page sideways. */
section { overflow-x: auto; }

table.servers {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
table.servers th, table.servers td {
  text-align: left;
  padding: .4rem .7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
table.servers th {
  color: var(--accent);
  font-weight: 400;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-top: 0;
}
table.servers th:first-child,
table.servers td:first-child { padding-left: 0; }
/* The narrow 1.5rem width only applies when the first cell is *just*
   a status dot — full-text first cells (Module name, Asset name) need
   to expand to their content. */
table.servers th:first-child:empty { width: 1.5rem; }
table.servers td:first-child:has(.dot:only-child) { width: 1.5rem; }
table.servers th:last-child,
table.servers td:last-child { padding-right: 0; }
table.servers td.host { font-weight: 700; color: var(--fg); white-space: normal; }

/* ---- sortable tables ---- */
table.sortable thead th:not([data-no-sort]) {
  cursor: pointer;
  user-select: none;
}
table.sortable thead th:not([data-no-sort]):hover { color: var(--fg); }
/* A neutral ⇅ on sortable headers; the active column shows a single
   direction arrow driven by aria-sort. */
table.sortable thead th:not([data-no-sort])::after {
  content: " \2195";
  opacity: .35;
  font-size: .85em;
}
table.sortable thead th[aria-sort="ascending"]::after  { content: " \2191"; opacity: 1; }
table.sortable thead th[aria-sort="descending"]::after { content: " \2193"; opacity: 1; }
table.servers tr.stale td { color: var(--muted); }
table.servers td.actions { white-space: nowrap; }
table.servers td.actions form, table.servers td.actions a.btn { margin-left: .3rem; }

/* ---- status dot ---- */
.dot {
  display: inline-block;
  width: .55rem; height: .55rem;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px rgba(110, 231, 183, .45);
  vertical-align: middle;
}
tr.stale .dot {
  background: var(--missing);
  box-shadow: 0 0 6px rgba(255, 122, 122, .45);
}

/* ---- forms / buttons ---- */
form.inline { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
form.inline input[type=text],
form.inline input[type=password],
form.inline input[type=number],
form.inline select {
  font: inherit;
  padding: .2rem .5rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 4px;
  min-width: 8rem;
}
form.inline select { min-width: 6rem; }
/* Audit-log filter bar: breathing room above the table + wrap on mobile. */
form.audit-filters { display: flex; flex-wrap: wrap; gap: .75rem; margin: .5rem 0 1rem; }
form.audit-filters label { display: inline-flex; align-items: center; gap: .4rem; }
form.inline input:focus, form.inline select:focus { outline: none; border-color: var(--accent-dim); }
form.inline label { color: var(--muted); display: inline-flex; gap: .3rem; align-items: center; }

/* Search + per-page bar on list views (patches host pages) — roomier
   than a bare inline form so the controls don't feel cramped. */
form.inline.list-controls {
  gap: .55rem;
  flex-wrap: wrap;
  margin: .4rem 0 1.2rem;
}
form.inline.list-controls input[type=text],
form.inline.list-controls select,
form.inline.list-controls .btn { padding-top: .34rem; padding-bottom: .34rem; }
form.inline.list-controls label { gap: .45rem; margin-left: .35rem; }

.btn {
  font: inherit;
  padding: .2rem .7rem;
  border: 1px solid var(--line); background: transparent; color: var(--fg);
  border-radius: 4px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  border-color: var(--accent); background: var(--accent); color: var(--bg);
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: var(--bg); }
.btn-danger { border-color: var(--missing); color: var(--missing); }
.btn-danger:hover { background: var(--missing); color: var(--bg); }

.token-display {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: .6rem .8rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .85rem;
  word-break: break-all;
  user-select: all;
  margin: .5rem 0 1rem;
}

/* ---- empty state ---- */
.empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.empty p { margin: .4rem 0; }

/* ---- flash ---- */
.flash {
  border: 1px solid var(--accent-dim);
  background: rgba(95, 184, 255, .08);
  color: var(--accent);
  padding: .4rem .7rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: .85rem;
}

/* ---- login ---- */
.login-hero {
  display: flex; flex-direction: column; align-items: center;
  margin: 4rem auto 1.5rem; gap: 1rem;
}
.login-hero img { width: 52px; height: 52px; display: block; }
.login-hero .wordmark { font-size: 1rem; font-weight: 700; color: var(--fg); letter-spacing: .03em; }
form.login {
  max-width: 320px; margin: 0 auto;
  display: flex; flex-direction: column; gap: .9rem;
}
form.login h1 { margin: 0; text-align: center; font-size: .85rem; font-weight: 400; color: var(--muted); letter-spacing: .04em; }
form.login label { display: flex; flex-direction: column; gap: .15rem; color: var(--muted); }
form.login input {
  font: inherit; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--fg);
}
form.login input:focus { outline: none; border-color: var(--accent-dim); }
form.login button {
  font: inherit; padding: .35rem 1rem; border-radius: 4px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--bg); cursor: pointer;
}
form.login button:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
form.login .error { color: var(--missing); margin: 0; font-size: .85rem; }


/* ---- meta strip (host header info: IP / agent / uptime / OS / EOL) ---- */
/* Flex-wrap with per-chunk nowrap so each `· segment` is atomic and the
   strip falls onto multiple lines instead of overflowing the viewport. */
.meta-strip {
    display: flex;
    flex-wrap: wrap;
    column-gap: .9rem;
    row-gap: .2rem;
    align-items: baseline;
    margin: 0 0 .4rem;
}
.meta-strip > span { white-space: nowrap; }
.meta-strip + .meta-strip { margin-bottom: 1rem; }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
    margin-bottom: 2rem;
}
.metric-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .65rem .85rem;
    background: linear-gradient(180deg, var(--panel2), var(--panel));
}
.metric-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--glow), transparent);
}
.metric-card .label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}
.metric-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: .15rem;
}
.metric-card .value .sub { font-size: .65rem; color: var(--muted); margin-left: .2em; font-weight: 400; }
.metric-card .sub { font-size: .75rem; color: var(--muted); }
.metric-card svg.spark { display: block; margin-top: .4rem; width: 100%; max-width: 100%; height: 36px; }
.metric-card .chip-strip { margin-top: .4rem; }

.usage-bar {
    display: inline-block;
    height: 6px;
    width: 80px;
    background: var(--line);
    border-radius: 2px;
    vertical-align: middle;
    overflow: hidden;
    margin-right: .4rem;
}
.usage-bar .fill {
    display: block;
    height: 100%;
    background: var(--accent);
}
.usage-bar.warn .fill { background: #f6c560; }
.usage-bar.crit .fill { background: var(--missing); }

/* ---- form disclosures (Add a path / Link an asset) ---- */
.form-disclosure { margin-top: 1rem; }
.form-disclosure > summary {
    cursor: pointer;
    color: var(--accent);
    font-size: .9rem;
    user-select: none;
    width: max-content;
    list-style: none;
}
.form-disclosure > summary::-webkit-details-marker { display: none; }
.form-disclosure > summary::before {
    content: "+";
    display: inline-block;
    width: 1em;
    margin-right: .2em;
    color: var(--muted);
}
.form-disclosure[open] > summary::before { content: "−"; }
.form-disclosure > summary:hover { color: var(--accent-dim); }
.form-disclosure[open] > summary { margin-bottom: .6rem; }
/* Keep a disclosed table.form from stretching its inputs full-width. */
.form-disclosure table.form input[type=text],
.form-disclosure table.form select {
    min-width: 0;
    width: 24rem;
    max-width: 100%;
}

/* ---- per-row pop-out (key rotation form, audit detail, …) ---- */
/* A <details> in a table cell. When opened its content (whatever the
   non-summary child is) becomes an absolutely-positioned popover
   anchored under the summary — out of flow, so it never widens the
   table column or shoves a sibling out of the row. The section hosting
   such a table carries .has-popout so the popover isn't clipped by the
   section's overflow box. */
details.row-popout {
    position: relative;
    display: inline-block;
    vertical-align: top;
    margin-left: .3rem;
}
details.row-popout > summary {
    display: inline-block;
    list-style: none;
}
details.row-popout > summary::-webkit-details-marker { display: none; }
details.row-popout > summary::marker { content: ""; }
details.row-popout[open] > *:not(summary) {
    position: absolute;
    top: calc(100% + .35rem);
    right: 0;
    z-index: 30;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .55rem .65rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}
section.has-popout { overflow: visible; }

/* ---- audit-log detail row ---- */
/* The Detail cell is a [data-row-toggle] button; the JSON lives in a
   full-width .detail-row directly below the entry, shown / hidden by
   the toggle (pulse.js). Keeps the space-less JSON blob out of the
   table's column-width budget entirely. */
.audit-toggle {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: .8rem;
    color: var(--accent);
    cursor: pointer;
}
.audit-toggle::before { content: "▸ "; }
.audit-toggle.is-open::before { content: "▾ "; }
tr.detail-row { display: none; }
tr.detail-row.open { display: table-row; }
td.detail-cell {
    background: rgba(255, 255, 255, .022);
    padding: .5rem .7rem .65rem;
}
.audit-detail-body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .8rem;
    color: var(--fg);
}
/* Let the IP cell wrap instead of forcing a full IPv6 onto one nowrap line
   — that single column was the main driver of the table's horizontal
   scroll. Capped width keeps it from crowding the Action/Detail columns. */
table.audit-log td.audit-ip {
    white-space: normal;
    word-break: break-all;
    max-width: 16ch;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .78rem;
}
/* Target + role, shown as a compact key/value grid at the top of the
   expandable detail panel (they used to be their own columns). */
dl.audit-meta {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .1rem .8rem;
    font-size: .8rem;
}
dl.audit-meta:not(:last-child) { margin-bottom: .45rem; }
dl.audit-meta dt { color: var(--accent); }
dl.audit-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--fg);
}

/* ---- modules + assets ---- */
.small { font-size: .8rem; }

nav.subnav { display: flex; gap: .85rem; margin: .8rem 0 1rem; font-size: .9rem; }
nav.subnav a { color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; padding-bottom: 2px; }
nav.subnav a.active { color: var(--fg); border-bottom-color: var(--accent); }
nav.subnav a:hover { color: var(--accent); }

.user-actions { display: flex; flex-wrap: wrap; gap: .9rem 1.2rem; margin: .6rem 0 1rem; align-items: center; }
.user-actions > form { margin: 0; }
table.grants { max-width: 36rem; margin: 0 0 .6rem; }
table.grants td:nth-child(2), table.grants td:nth-child(3),
table.grants th:nth-child(2), table.grants th:nth-child(3) { text-align: center; width: 4rem; }
table.grants input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* user-card section heading: regular case + the role chip next to it */
section.user-card h2 { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--fg); margin-bottom: .15rem; }
section.user-card h2 .role-chip {
  display: inline-block; margin-left: .4rem;
  padding: 0 .45em; font-size: .65em; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  border-radius: 3px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  vertical-align: 2px;
}
section.user-card h2 .role-chip.admin { color: var(--accent); border-color: var(--accent-dim); }
section.user-card { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 1rem; background: linear-gradient(180deg, var(--panel2), var(--panel)); }
section.user-card + section.user-card { margin-top: 0; }

/* generic status chip — the account page reuses it outside a user-card */
.role-chip {
  display: inline-block; margin-left: .4rem;
  padding: 0 .45em; font-size: .65em; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  border-radius: 3px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  vertical-align: 2px;
}
.role-chip.admin { color: var(--accent); border-color: var(--accent-dim); }

/* 2FA enrollment QR (data: GIF filled in by pulse.js); keep it crisp */
.totp-qr { width: 176px; height: 176px; background: #fff; padding: 6px; border-radius: 4px; image-rendering: pixelated; }

.module-shortcuts h2 { font-size: .85rem; font-weight: 400; color: var(--muted); letter-spacing: .04em; margin: 0 0 .6rem; }
.shortcut-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.5rem; }
.shortcut {
  display: inline-flex; flex-direction: column; gap: .15rem;
  padding: .55rem .85rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: linear-gradient(180deg, var(--panel2), var(--panel)); color: var(--fg);
  text-decoration: none;
  min-width: 14rem;
}
.shortcut:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(95, 184, 255, .2), 0 6px 18px rgba(0, 0, 0, .35); }
.shortcut-name   { color: var(--fg);   font-weight: 700; font-size: .85rem; }
.shortcut-action { color: var(--accent); font-size: .8rem; }
.shortcut:hover .shortcut-action { color: var(--accent); }

.flash-error {
  border-color: var(--missing);
  background: rgba(255, 122, 122, .1);
  color: var(--missing);
}
.flash-warn {
  border-color: #f6c560;
  background: rgba(246, 197, 96, .1);
  color: #f6c560;
}

table.form { border-collapse: collapse; margin: 0 0 1rem; }
table.form th { text-align: left; padding: .3rem .8rem .3rem 0; font-weight: 400; color: var(--muted); vertical-align: top; }
table.form td { padding: .3rem 0; }
table.form input[type=text],
table.form input[type=password],
table.form input[type=number],
table.form select {
  font: inherit; padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--fg); min-width: 24rem;
}
table.form input:focus, table.form select:focus {
  outline: none; border-color: var(--accent-dim);
}

.ok   { color: var(--ok); }
.warn { color: #f6c560; }
.crit { color: var(--missing); }

tr.form-row td {
  background: rgba(255,255,255,.015);
  padding-top: .3rem; padding-bottom: .5rem;
  border-top: 0;
}
tr.form-row input[type=text], tr.form-row input[type=password] {
  font: inherit; padding: .2rem .45rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--fg); min-width: 16rem;
}

.kind-badge {
  display: inline-block; padding: 0 .45em; border-radius: 3px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  font-size: .8em; letter-spacing: .03em;
}

/* Fleet rollup chips — one per module attached to an asset, coloured
   by latest status. Hover reveals the headline via the title attr. */
.fleet-chip {
  display: inline-block;
  padding: .1em .55em;
  margin: .1em .2em .1em 0;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: .8em;
  letter-spacing: .03em;
  text-decoration: none;
  white-space: nowrap;
}
.fleet-chip.ok    { color: var(--ok); border-color: rgba(110,231,183,.4); }
.fleet-chip.warn  { color: #f6c560; border-color: rgba(246,197,96,.4); }
.fleet-chip.crit  { color: var(--missing); border-color: rgba(229,90,90,.4); }
.fleet-chip.muted { color: var(--muted); }
.fleet-chip:hover { background: rgba(255,255,255,.04); }

/* Scorecard row: a wrapping group of pass/fail chips. */
.chip-strip { display: inline-flex; flex-wrap: wrap; align-items: center; }

/* Fleet table: chip column should breathe, host column stays tight. */
table.servers.fleet td:last-child { line-height: 1.9; }

/* Per-probe stack on outbound-module index pages: one <li> per probe
   that has reported, rendered below the rollup chip in the Status
   column. Compact line-height so a 3-probe target stays readable. */
ul.probe-stack {
  list-style: none;
  margin: .3rem 0 0;
  padding: 0;
}
ul.probe-stack li { margin: .2rem 0; line-height: 1.4; }


/* SSH-key sub-row on /agent/accounts/<host>: visually nested under
   the account it belongs to. */
.account-keys-row td { padding-top: .1rem; border-top: 0; }
ul.account-keys { margin: .2rem 0 .4rem; padding-left: 1.2rem; }
ul.account-keys li { margin: .1rem 0; }

/* ---------- utility classes ----------
   Used to replace inline `style=""` attributes so we can drop
   'unsafe-inline' from the style-src CSP. */
.mt-0    { margin-top: 0; }
.mb-1    { margin-bottom: 1rem; }
.ml-1    { margin-left: 1em; }
.inline-ml-1 { display: inline; margin-left: 1em; }
.min-w-sm { min-width: 8rem; }
.min-w-md { min-width: 14rem; }
.min-w-lg { min-width: 22rem; }
.min-w-xl { min-width: 30rem; }
.kind-badge.stale { color: var(--missing); border-color: var(--missing); }

/* ---------- usage-bar fill via bucketed data-pct ----------
   The .fill width was the one remaining inline `style="width: X%"`.
   Round the value to the nearest 5% in PHP and the matching selector
   below sizes the bar. Keeps the dashboard CSP-clean without a JS
   shim. */
.usage-bar .fill[data-pct="0"]   { width: 0%; }
.usage-bar .fill[data-pct="5"]   { width: 5%; }
.usage-bar .fill[data-pct="10"]  { width: 10%; }
.usage-bar .fill[data-pct="15"]  { width: 15%; }
.usage-bar .fill[data-pct="20"]  { width: 20%; }
.usage-bar .fill[data-pct="25"]  { width: 25%; }
.usage-bar .fill[data-pct="30"]  { width: 30%; }
.usage-bar .fill[data-pct="35"]  { width: 35%; }
.usage-bar .fill[data-pct="40"]  { width: 40%; }
.usage-bar .fill[data-pct="45"]  { width: 45%; }
.usage-bar .fill[data-pct="50"]  { width: 50%; }
.usage-bar .fill[data-pct="55"]  { width: 55%; }
.usage-bar .fill[data-pct="60"]  { width: 60%; }
.usage-bar .fill[data-pct="65"]  { width: 65%; }
.usage-bar .fill[data-pct="70"]  { width: 70%; }
.usage-bar .fill[data-pct="75"]  { width: 75%; }
.usage-bar .fill[data-pct="80"]  { width: 80%; }
.usage-bar .fill[data-pct="85"]  { width: 85%; }
.usage-bar .fill[data-pct="90"]  { width: 90%; }
.usage-bar .fill[data-pct="95"]  { width: 95%; }
.usage-bar .fill[data-pct="100"] { width: 100%; }

.module-meta dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .3rem 1.2rem;
  margin: 1rem 0 1.5rem;
  font-size: .85rem;
}
.module-meta dt { color: var(--muted); }
.module-meta dd { margin: 0; color: var(--fg); }

.markdown { max-width: 70ch; line-height: 1.6; }
.markdown h2 { font-size: 1rem; margin: 1.6em 0 .5em; color: var(--fg); }
.markdown h3 { font-size: .9rem; margin: 1.3em 0 .4em; color: var(--fg); }
.markdown p { margin: 0 0 .9em; }
.markdown ul, .markdown ol { margin: 0 0 .9em 1.4em; padding: 0; }
.markdown li { margin: .15em 0; }
.markdown code {
  font: inherit; background: var(--surface); padding: 0 .35em;
  border: 1px solid var(--line); border-radius: 3px; color: var(--fg);
}
.markdown pre {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  padding: .6em .8em; overflow-x: auto; margin: 0 0 .9em;
}
.markdown pre code { background: none; border: 0; padding: 0; }

@media (max-width: 1024px) {
  /* On narrower viewports (tablet + small laptop + mobile), table rows
     become labelled cards. Each <td> shows its value next to (or under)
     its column header, drawn from the data-label attribute on the cell.
     The breakpoint sits at 1024px because the rich tables (10 columns
     on /, 9 on /probes/tls, etc.) only fit cleanly from ~1100px up.

     Tables that haven't been data-label-tagged fall back to plain
     stacked rows with no label — still readable, no sideways scroll. */
  section { overflow-x: visible; }

  table.servers,
  table.servers thead,
  table.servers tbody,
  table.servers tr,
  table.servers th,
  table.servers td {
    display: block;
    width: auto;
  }
  table.servers thead { display: none; }
  table.servers tr {
    margin: 0 0 .65rem;
    padding: .55rem .7rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
  }
  table.servers td {
    padding: .12rem 0;
    border: 0;
    white-space: normal;
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    align-items: baseline;
    font-size: .82rem;
  }
  /* The label, drawn from data-label, is only shown when present. */
  table.servers td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    flex-shrink: 0;
  }
  /* The first cell (typically a status dot or the row's primary name)
     takes the top spot full-width, no label, slightly bigger. */
  table.servers td:first-child {
    padding-top: 0;
    padding-bottom: .25rem;
    margin-bottom: .25rem;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    font-size: .95rem;
  }
  table.servers td:first-child::before { content: none; }
  /* Audit detail row: a plain full-width block, not a card-title cell. */
  table.servers tr.detail-row { display: none; }
  table.servers tr.detail-row.open { display: block; }
  table.servers tr.detail-row td.detail-cell {
    display: block;
    border: 0;
    margin: 0;
    padding: .2rem 0 0;
    font-weight: 400;
    font-size: .8rem;
  }
  /* Actions cell on its own row, buttons spread. */
  table.servers td.actions {
    flex-wrap: wrap; gap: .4rem;
    margin-top: .4rem; padding-top: .4rem;
    border-top: 1px solid var(--line);
    justify-content: flex-start;
  }
  table.servers td.actions::before { content: none; }

  /* Decorative leading cells (just a status dot, nothing else) are
     hidden on mobile — the host name takes the card title slot. */
  table.servers td:has(.dot:only-child) { display: none; }

  /* Anything explicitly tagged data-mobile-hide is dropped on mobile
     (lower-priority columns). */
  table.servers td[data-mobile-hide],
  table.servers th[data-mobile-hide] { display: none; }

  /* Form tables — stack label above input, inputs go full-width
     instead of the 24rem min-width that overflows narrow phones. */
  table.form, table.form tbody, table.form tr,
  table.form th, table.form td {
    display: block; width: auto;
  }
  table.form th {
    padding: .5rem 0 .15rem;
  }
  table.form td {
    padding: 0 0 .6rem;
  }
  table.form input[type=text],
  table.form input[type=password],
  table.form input[type=number],
  table.form select {
    min-width: 0; width: 100%;
  }

  /* Inline forms shouldn't overflow either. The form itself wraps
     so a long <select> doesn't push the button off-screen, and the
     fields shrink to fill available space. */
  form.inline {
    display: flex; flex-wrap: wrap; max-width: 100%;
  }
  form.inline > * { max-width: 100%; }
  form.inline input[type=text],
  form.inline input[type=password],
  form.inline input[type=number],
  form.inline select {
    min-width: 0; max-width: 100%; flex: 1 1 12rem;
  }

  /* User-card section on /admin/users — tighten padding. */
  section.user-card { padding: .8rem .85rem; }
  .user-actions { gap: .6rem .85rem; }
}

/* ===========================================================================
 * System Metrics redesign (Pass 1) — scoped under .sm so nothing here can
 * affect other pages. Mission-control look: glassy panels, glow accents,
 * KPI tiles, interactive SVG charts (see charts.js), gauges, status pills.
 * ======================================================================== */
.sm {
  --p-accent: #5fb8ff; --p-cyan: #22d3ee; --p-mem: #b18cff;
  --p-ok: #6ee7b7; --p-warn: #f6c560; --p-crit: #ff7a7a;
  --p-panel: #11141d; --p-panel2: #151a26; --p-line: #222637; --p-line2: #2b3146;
  --p-glow: rgba(95, 184, 255, .4); --p-okglow: rgba(110, 231, 183, .4);
  position: relative;
}

/* ---- controls: tabs + range ---- */
.sm-controls { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: 0 0 1.1rem; }
.sm-tabs, .sm-range { display: flex; gap: .15rem; background: var(--p-panel); border: 1px solid var(--p-line); border-radius: 9px; padding: .2rem; }
.sm-range { margin-left: auto; }
.sm-tabs button, .sm-range button {
  font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: .3rem .8rem; border-radius: 6px; letter-spacing: .02em;
}
.sm-range button { padding: .3rem .58rem; font-size: .92em; }
.sm-tabs button:hover, .sm-range button:hover { color: var(--fg); }
.sm-tabs button.on { color: #06121f; background: linear-gradient(135deg, var(--p-accent), var(--p-cyan)); font-weight: 700; box-shadow: 0 0 12px var(--p-glow); }
.sm-range button.on { color: var(--p-accent); background: rgba(95, 184, 255, .12); box-shadow: inset 0 0 0 1px rgba(95, 184, 255, .3); }
.sm-live { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .92em; }
.sm-live .d { width: .5rem; height: .5rem; border-radius: 50%; background: var(--p-ok); box-shadow: 0 0 8px var(--p-okglow); animation: sm-pulse 2s infinite; }
@keyframes sm-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.sm.sm-loading { opacity: .6; transition: opacity .12s; }

/* ---- pills ---- */
.sm-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .12rem .5rem; border-radius: 999px; border: 1px solid var(--p-line2); color: var(--muted); }
.sm-pill .d { width: .48rem; height: .48rem; border-radius: 50%; background: currentColor; }
.sm-pill.ok { color: var(--p-ok); border-color: rgba(110, 231, 183, .35); background: rgba(110, 231, 183, .08); }
.sm-pill.ok .d { box-shadow: 0 0 8px var(--p-okglow); }
.sm-pill.warn { color: var(--p-warn); border-color: rgba(246, 197, 96, .35); background: rgba(246, 197, 96, .08); }
.sm-pill.crit { color: var(--p-crit); border-color: rgba(255, 122, 122, .35); background: rgba(255, 122, 122, .08); }

/* ---- KPI tiles ---- */
.sm-kpis { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0 0 1rem; }
.sm-kpi { position: relative; overflow: hidden; cursor: pointer; padding: .7rem .8rem; border: 1px solid var(--p-line); border-radius: 11px; background: linear-gradient(180deg, var(--p-panel2), var(--p-panel)); transition: border-color .15s, transform .1s; }
/* No transform on hover: transform + overflow:hidden + border-radius made
   Chrome drop the rounded top corners (the embedded sparkline bled past).
   A ring + lift-shadow gives the same affordance without the glitch. */
.sm-kpi:hover { border-color: rgba(95, 184, 255, .55); box-shadow: 0 0 0 1px rgba(95, 184, 255, .25), 0 6px 18px rgba(0, 0, 0, .38); }
.sm-kpi .lbl { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sm-kpi .val { font-size: 1.5rem; font-weight: 700; line-height: 1.05; margin: .12rem 0 .04rem; }
.sm-kpi .val .u { font-size: .62rem; color: var(--muted); font-weight: 400; margin-left: .15em; }
.sm-kpi .sub { font-size: .68rem; color: var(--muted); }
.sm-kpi .sm-spark { position: absolute; right: .45rem; bottom: .35rem; width: 44%; }
.sm-kpi.alert { border-color: rgba(255, 122, 122, .45); }
.sm-kpi.alert .val { color: var(--p-crit); }

/* ---- panels + 12-col grid ---- */
.sm-cols { display: grid; gap: .9rem; grid-template-columns: repeat(12, 1fr); }
.sm .c4 { grid-column: span 4; } .sm .c5 { grid-column: span 5; } .sm .c6 { grid-column: span 6; }
.sm .c7 { grid-column: span 7; } .sm .c8 { grid-column: span 8; } .sm .c12 { grid-column: span 12; }
.sm-panel { position: relative; overflow: hidden; padding: .9rem 1rem; border: 1px solid var(--p-line); border-radius: 12px; background: linear-gradient(180deg, var(--p-panel2), var(--p-panel)); }
.sm-panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(95, 184, 255, .4), transparent); }
.sm-panel h3 { margin: 0 0 .7rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--p-accent); font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.sm-panel h3 .fl { color: var(--p-cyan); }
.sm-panel h3 .right { margin-left: auto; color: var(--muted); font-size: .92em; letter-spacing: 0; text-transform: none; font-weight: 400; }
.sm-hide { display: none !important; }

/* ---- charts ---- */
.sm-chart { position: relative; width: 100%; }
.sm-chart[data-expand] { cursor: zoom-in; }
.sm-svg { display: block; width: 100%; height: auto; overflow: visible; }
.sm-grid { stroke: var(--p-line); stroke-width: 1; }
.sm-axis { fill: var(--muted); font-size: 9px; }
.sm-band { fill: var(--p-crit); opacity: .07; }
.sm-empty::after { content: "no data for this range"; display: block; text-align: center; color: var(--muted); font-size: .8rem; padding: 1.4rem 0; }
.sm-empty svg { display: none; }
.sm-tip { position: absolute; pointer-events: none; opacity: 0; transition: opacity .08s; transform: translate(-50%, -118%); background: #070b15; border: 1px solid var(--p-line2); border-radius: 6px; padding: .32rem .5rem; font-size: .76em; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .6); z-index: 5; }
.sm-tip .k { color: var(--muted); } .sm-tip b { color: #fff; }
.sm-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78em; color: var(--muted); margin-bottom: .3rem; }
.sm-legend span { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.sm-legend span.off { opacity: .35; }
.sm-legend i { width: .7rem; height: .7rem; border-radius: 3px; }

/* ---- health rows / public surface ---- */
.sm-hrow { display: flex; align-items: center; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid var(--p-line); }
.sm-hrow:last-child { border-bottom: 0; }
.sm-hrow .nm { color: var(--fg); }
.sm-hrow .ds { color: var(--muted); font-size: .92em; }
.sm-hrow .st { margin-left: auto; }
.sm-hrow code { background: rgba(255, 255, 255, .04); }
.sm-hrow.sub { border: 0; padding-top: 0; }

/* ---- mounts (reuse usage-bar, neon-ised) + gauges ---- */
.sm-mounts { display: grid; gap: .65rem; }
.sm-mount .top { display: flex; justify-content: space-between; margin-bottom: .3rem; }
.sm-mount .top .p { color: var(--muted); }
.sm .usage-bar { width: 100%; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .06); margin: 0; }
.sm .usage-bar .fill { background: linear-gradient(90deg, var(--p-accent), var(--p-cyan)); box-shadow: 0 0 10px var(--p-glow); border-radius: 99px; }
.sm .usage-bar.warn .fill { background: linear-gradient(90deg, #e08e2e, var(--p-warn)); box-shadow: none; }
.sm .usage-bar.crit .fill { background: linear-gradient(90deg, #d1344a, var(--p-crit)); box-shadow: none; }
.sm-gauges { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-around; align-items: flex-start; }
.sm-gauge { text-align: center; }
.sm-gauge .cap { font-size: .72rem; color: var(--muted); margin-top: -.3rem; }
.sm-gauge-svg { width: 120px; max-width: 120px; display: block; margin: 0 auto; }
.sm-gauge-track { stroke: var(--p-line2); }
.sm-gauge-num { fill: #fff; font-size: 19px; font-weight: 700; }

/* ---- expand modal ---- */
.sm-ov { position: fixed; inset: 0; background: rgba(4, 7, 13, .86); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); display: none; place-items: center; z-index: 60; padding: 2rem; }
.sm-ov.on { display: grid; }
/* Solid, clearly-floating box (opaque background, accent ring + deep shadow)
   so it reads as a distinct pop-out rather than a faint overlay. */
.sm-modal { width: min(980px, 94vw); padding: 1.1rem 1.25rem 1.25rem; border: 1px solid var(--p-line2); border-radius: 14px; background: #131826; box-shadow: 0 0 0 1px rgba(95, 184, 255, .18), 0 28px 80px rgba(0, 0, 0, .72); }
.sm-modal-h { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: .6rem; }
.sm-modal-h h2 { font-size: 1.05rem; margin: 0; color: var(--fg); }
.sm-modal-range { margin-left: auto; }
.sm-modal-close { cursor: pointer; color: var(--muted); font-size: 1.2rem; background: none; border: 0; line-height: 1; padding: 0 .2rem; }
.sm-modal-close:hover { color: var(--fg); }
.sm-stats { display: flex; gap: 1.6rem; flex-wrap: wrap; margin-top: .7rem; }
.sm-stats .l { color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .07em; }
.sm-stats .v { font-size: 1.1rem; font-weight: 700; }

/* range bar hidden on the Health tab (time window is meaningless there) */
.sm-range.sm-off { display: none; }
/* brief highlight when a KPI card jumps you to its graph */
@keyframes sm-flash { 0% { box-shadow: 0 0 0 2px var(--p-accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.sm-flash { animation: sm-flash 1.3s ease-out; }

@media (max-width: 1024px) {
  .sm .c4, .sm .c5, .sm .c6, .sm .c7, .sm .c8 { grid-column: span 12; }
}

/* ---- Notifications / alerts admin ---- */
.help-text { margin-top: .5rem; }
.inline-check { display: inline-flex; align-items: center; gap: .4rem; margin-right: 1rem; font-weight: normal; }
.inline-check input { width: auto; }

/* Add-channel forms: stack each field (label above input) and wrap onto
   multiple lines so a many-field form (email) never scrolls sideways. */
.channel-form { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end; margin-top: .5rem; }
.channel-form label {
  display: flex; flex-direction: column; gap: .25rem;
  color: var(--muted); font-size: .9rem; margin: 0;
}
.channel-form input[type=text],
.channel-form input[type=email],
.channel-form input[type=password],
.channel-form input[type=number],
.channel-form select {
  font: inherit; padding: .3rem .5rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 4px; min-width: 13rem;
}
.channel-form select { min-width: 11rem; }
.channel-form input:focus, .channel-form select:focus { outline: none; border-color: var(--accent-dim); }
.channel-form .field-narrow { min-width: 5rem; width: 5rem; }
.channel-form .btn { margin-bottom: .05rem; }
/* field-narrow still used by the inline stale-rule multiplier input. */
.field-narrow { width: 6rem; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

/* Stacked rule form — used by the New Alert Rule wizard and the rule edit
   page. A fixed label column on the left, control(s) on the right; conditional
   rows (mount, duration, …) toggle VERTICALLY, so revealing one never reflows
   the line horizontally the way the old inline sentence-builder did. */
.rule-form-stack {
  display: flex; flex-direction: column; gap: .5rem;
  max-width: 40rem; margin: .6rem 0 0; font-size: .9rem;
}
/* sb-rest is revealed once a capability is chosen; display:contents lets its
   rows sit directly in the form's flex column. */
.rule-form-stack .sb-rest { display: contents; }
.rule-form-stack [hidden] { display: none !important; }
.rule-form-stack .rf-row {
  display: grid; grid-template-columns: 7rem 1fr;
  align-items: center; gap: .15rem .9rem;
}
.rule-form-stack .rf-label { color: var(--muted); }
.rule-form-stack .rf-field { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.rule-form-stack .rf-pre, .rule-form-stack .rf-unit { color: var(--muted); }
.rule-form-stack select,
.rule-form-stack input[type=text],
.rule-form-stack input[type=number] {
  font: inherit; padding: .3rem .5rem;
  border: 1px solid var(--line2); background: var(--bg); color: var(--fg);
  border-radius: 5px;
}
.rule-form-stack select:focus,
.rule-form-stack input:focus { outline: none; border-color: var(--accent); }
.rule-form-stack .sb-num { width: 5.5rem; }
.rule-form-stack .rf-name { width: 100%; max-width: 22rem; }
.rule-form-stack .rf-radios { gap: .2rem 1rem; }
.rule-form-stack .rf-actions { margin-top: .7rem; display: flex; gap: .6rem; align-items: center; }
@media (max-width: 620px) {
  .rule-form-stack .rf-row { grid-template-columns: 1fr; gap: .15rem; }
}
.rule-card {
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: .8rem 1rem;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.rule-card legend { padding: 0 .4rem; font-weight: 600; }
.rule-card label { color: var(--muted); }
.rule-card input[type=number] {
  font: inherit; padding: .3rem .5rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 4px;
}
.rule-card input[type=number]:focus { outline: none; border-color: var(--accent-dim); }
.channel-picker { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }

/* ---- Generic tabs (Alerts page; mirrors .sm-tabs visual language) ---- */
.tabnav { display: inline-flex; gap: .15rem; background: var(--p-panel, var(--card)); border: 1px solid var(--p-line, var(--line)); border-radius: 9px; padding: .2rem; margin: .2rem 0 1.1rem; }
.tabnav button {
  font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: .35rem .9rem; border-radius: 6px; letter-spacing: .02em;
}
.tabnav button:hover { color: var(--fg); }
.tabnav button.on { color: #06121f; background: linear-gradient(135deg, var(--p-accent, var(--accent)), var(--p-cyan, var(--accent))); font-weight: 700; box-shadow: 0 0 12px var(--p-glow, transparent); }
.tab-hide { display: none !important; }

/* Master alerting toggle + section header row */
.alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.master-toggle { display: inline-flex; align-items: center; gap: .5rem; }
.master-toggle .pill { font-size: .82em; padding: .1rem .5rem; border-radius: 999px; }
.master-toggle .pill.on { background: rgba(80,220,150,.16); color: #6fe3a0; }
.master-toggle .pill.off { background: rgba(255,120,120,.16); color: #ff9a9a; }

/* Per-rule status badge in the Alert rules table. Firing/error are the only
   states that should grab the eye; OK and disabled stay quiet. */
.rstat { display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .5rem; border-radius: 999px; font-size: .82em; white-space: nowrap; }
.rstat.ok { color: var(--muted); }
.rstat.off { color: var(--muted); }
.rstat.firing { background: rgba(255,120,120,.16); color: #ff9a9a; font-weight: 600; }
.rstat.err { background: rgba(240,190,90,.16); color: #f0c674; font-weight: 600; }

/* Rule detail header — a light heading row (replaces the old bordered
   summary box, which was one box too many). */
.rule-head { margin: .4rem 0 1rem; }
.rule-head .rule-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0; font-size: 1.15rem; }
.rule-head .rule-sub { margin: .3rem 0 0; }
.rule-head .rule-sub dt { display: inline; color: var(--muted); }
.rule-head .rule-sub dd { display: inline; margin: 0 1rem 0 .25rem; }
