/* ==========================================================================
   GuardApp console — components & layout
   No inline styles anywhere (strict CSP); everything is a class here.
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; flex: none; }
.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 20px; height: 20px; }
.icon--xl { width: 24px; height: 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-4); top: -48px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--sp-3); }

/* ---------- Text helpers ---------- */
.muted { color: var(--text-3); }
.secondary { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.eyebrow {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-3);
}

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.row--top { align-items: flex-start; }
.gap-1 { gap: var(--sp-1); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.stack > * + * { margin-top: var(--sp-2); }
.stack-3 > * + * { margin-top: var(--sp-3); }
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-6 > * + * { margin-top: var(--sp-6); }
.grow { flex: 1 1 auto; min-width: 0; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }

.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
html[data-sidebar="collapsed"] .app { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--nav-bg); color: var(--nav-text);
  border-right: 1px solid var(--nav-border);
  overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--nav-border);
  color: var(--nav-active-text);
}
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 7px; background: var(--accent); color: #fff;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand__name { font-weight: 650; font-size: var(--fs-md); letter-spacing: -0.01em; }
.brand__by { font-size: 11px; color: var(--nav-text-muted); }

.nav { flex: 1; overflow-y: auto; padding: var(--sp-3) var(--sp-2) var(--sp-4); scrollbar-width: thin; }
.nav__section + .nav__section { margin-top: var(--sp-4); }
.nav__heading {
  padding: 0 var(--sp-3) var(--sp-1);
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--nav-text-muted);
}
.nav__link {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 34px; padding: 0 var(--sp-3);
  border-radius: var(--radius);
  color: var(--nav-text); font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav__link:hover { background: var(--nav-hover); color: var(--nav-active-text); text-decoration: none; }
.nav__link[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active-text); }
.nav__link[aria-current="page"]::before {
  content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--nav-indicator);
}
.nav__link .icon { opacity: 0.9; }
.nav__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__badge {
  min-width: 20px; padding: 0 6px; border-radius: 10px;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
  background: #24314f; color: #dbe5ff;
}
.nav__badge--alert { background: #5a1d22; color: #ffd4d4; }
.nav__soon { font-size: 10px; color: var(--nav-text-muted); border: 1px solid #2a3449; border-radius: 4px; padding: 0 4px; }

.sidebar__foot { border-top: 1px solid var(--nav-border); padding: var(--sp-2); }

html[data-sidebar="collapsed"] .brand__text,
html[data-sidebar="collapsed"] .nav__heading,
html[data-sidebar="collapsed"] .nav__label,
html[data-sidebar="collapsed"] .nav__badge,
html[data-sidebar="collapsed"] .nav__soon { display: none; }
html[data-sidebar="collapsed"] .brand { justify-content: center; padding: 0; }
html[data-sidebar="collapsed"] .nav__link { justify-content: center; padding: 0; }
html[data-sidebar="collapsed"] .nav__section + .nav__section { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--nav-border); }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-6) 0 var(--sp-3);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.scope-switch {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; font-weight: 550; font-size: var(--fs-sm);
  max-width: 320px;
}
.scope-switch:hover { background: var(--surface-2); }
.scope-switch__kind { color: var(--text-3); font-weight: 500; }
.search-trigger {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  flex: 0 1 420px; height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-3); cursor: pointer; font-size: var(--fs-sm);
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger__hint { margin-left: auto; }
.kbd {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 0 5px; min-height: 20px; border-radius: 4px;
  border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface);
  font-family: var(--font-sans); font-size: 11px; font-weight: 500; color: var(--text-3);
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-1); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 36px; height: 36px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn__dot {
  position: absolute; top: 5px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger-dot); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px;
}
.user-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-2) 0 4px; border: 0; border-radius: var(--radius);
  background: transparent; cursor: pointer;
}
.user-btn:hover { background: var(--surface-3); }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-text);
  font-size: 11px; font-weight: 700; border: 1px solid var(--accent-soft-border);
}
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.user-btn__text { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-btn__name { font-size: var(--fs-sm); font-weight: 600; }
.user-btn__role { font-size: 11px; color: var(--text-3); }

.env-banner {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 26px; background: #b91c1c; color: #fff; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em;
}

/* ---------- Content ---------- */
.content { flex: 1; padding: var(--sp-6); min-width: 0; }
.content--narrow { max-width: 1080px; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--sp-2); }
.breadcrumbs a { color: var(--text-3); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .icon { width: 12px; height: 12px; }

.page-head { display: flex; align-items: flex-end; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head__title { font-size: var(--fs-2xl); font-weight: 650; }
.page-head__sub { margin-top: 4px; color: var(--text-3); font-size: var(--fs-sm); }
.page-head__actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }
/* a long subtitle wraps inside its column instead of pushing the actions onto their own row */
.page-head > div:first-child:not(:last-child) { flex: 1 1 420px; min-width: 0; }
.page-head > div:first-child + .page-head__actions { flex: none; }

.app-foot {
  display: flex; gap: var(--sp-4); justify-content: space-between; flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-3);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: 550; white-space: nowrap; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--danger { background: var(--surface); border-color: var(--border-strong); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--danger-solid { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn--danger-solid:hover { background: #991b1b; border-color: #991b1b; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }
.btn--sm { min-height: 28px; padding: 0 var(--sp-2); font-size: var(--fs-xs); }
.btn--lg { min-height: 42px; padding: 0 var(--sp-5); font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn--icon { width: 34px; padding: 0; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* Segmented control: a radio group shown as one row of options (keyboard: arrow keys, native radios). */
.seg {
  display: inline-flex; align-self: flex-start; flex-wrap: wrap; gap: 2px; padding: 2px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
}
.seg__opt {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 var(--sp-3);
  border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 550; color: var(--text-2); white-space: nowrap; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.seg__opt input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.seg__opt:hover { color: var(--text); background: var(--surface-3); }
.seg__opt:has(input:checked) { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-soft-border); }
.seg__opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg__opt .icon { width: 14px; height: 14px; color: var(--text-3); }
.seg__opt:has(input:checked) .icon { color: currentColor; }
.seg__opt--important:has(input:checked) .icon { color: var(--warn); }
.seg__opt--critical:has(input:checked) .icon { color: var(--danger); }
.seg__opt .count { margin-left: 2px; }
.seg--sm .seg__opt { min-height: 26px; padding: 0 var(--sp-2); font-size: var(--fs-xs); }
/* Link variant (pager "rows per page"): the current option carries aria-current. */
a.seg__opt { text-decoration: none; }
.seg__opt[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-soft-border); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--sp-4); }
.label { font-size: var(--fs-sm); font-weight: 550; color: var(--text); }
.label__opt { font-weight: 400; color: var(--text-3); }
.help { font-size: var(--fs-xs); color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: var(--fs-base);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.textarea { padding: var(--sp-2) var(--sp-3); min-height: 88px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-border);
}
.input--mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.input--sm, .select--sm { min-height: 30px; font-size: var(--fs-sm); }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.input-wrap > .icon + .input { padding-left: 32px; }
.input-wrap > .input:has(+ .input-wrap__btn) { padding-right: 40px; }
.input-wrap__btn {
  position: absolute; right: 4px; display: grid; place-items: center;
  width: 30px; height: 28px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-3); cursor: pointer;
}
.input-wrap__btn:hover { color: var(--text); background: var(--surface-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-grid .field + .field { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--sp-6); padding: var(--sp-5) 0; border-top: 1px solid var(--border); }
.form-row:first-child { border-top: 0; padding-top: 0; }
.form-row__intro h3 { font-size: var(--fs-md); }
.form-row__intro p { margin-top: 4px; font-size: var(--fs-sm); color: var(--text-3); }

.check { display: inline-flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-sm); }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; flex: none; }

.switch { display: flex; align-items: flex-start; gap: var(--sp-3); cursor: pointer; }
.switch input {
  appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 1px 0 0;
  border-radius: 10px; background: var(--border-strong); cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease);
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch__text { display: flex; flex-direction: column; font-size: var(--fs-sm); }
.switch__text .help { margin-top: 2px; }

.otp {
  width: 100%; height: 52px; text-align: center; letter-spacing: 0.5em; padding-left: 0.5em;
  font-family: var(--font-mono); font-size: 24px; font-weight: 500;
}

/* ==========================================================================
   Cards & panels
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card__head {
  display: flex; align-items: center; gap: var(--sp-2); min-height: 48px;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
}
.card__title { font-size: var(--fs-base); font-weight: 600; }
.card__title-icon { color: var(--text-3); }
.card__meta { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; gap: var(--sp-2); }
.card__body { padding: var(--sp-4); }
.card__body--flush { padding: 0; }
.card__foot {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border);
  font-size: var(--fs-sm); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card__foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: 550; }

/* ---------- Stat tiles ---------- */
.stat { padding: var(--sp-4); display: flex; flex-direction: column; gap: 6px; }
.stat__label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.stat__label .icon { color: var(--text-3); }
.stat__value { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.stat__value small { font-size: var(--fs-base); font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.stat__foot { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-3); min-height: 18px; }
.stat__spark { margin-left: auto; width: 96px; height: 28px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.delta--good { color: var(--ok-text); }
.delta--bad { color: var(--danger-text); }
.stat--link:hover { border-color: var(--border-strong); text-decoration: none; }
.stat--link { color: inherit; }

/* ---------- Callouts (attention strip) ---------- */
.callouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.callout {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.callout:hover { text-decoration: none; border-color: var(--border-strong); }
.callout__icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius); flex: none; }
.callout__title { font-weight: 600; font-size: var(--fs-sm); }
.callout__text { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.callout__go { margin-left: auto; align-self: center; color: var(--text-3); }
.callout--danger .callout__icon { background: var(--danger-soft); color: var(--danger); }
.callout--warn .callout__icon { background: var(--warn-soft); color: var(--warn); }
.callout--info .callout__icon { background: var(--accent-soft); color: var(--accent-text); }

.notice {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
  border: 1px solid var(--accent-soft-border); background: var(--accent-soft); font-size: var(--fs-sm);
}
.notice .icon { color: var(--accent-text); margin-top: 2px; }
.notice--warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.notice--warn .icon { color: var(--warn); }
.notice--danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); }
.notice--danger .icon { color: var(--danger); }
.notice--ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.notice--ok .icon { color: var(--ok); }

/* ==========================================================================
   Status pills & badges (colour + icon/dot + text, never colour alone)
   ========================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--neutral-dot); flex: none; }
.pill--plain::before { display: none; }
.pill--ok { background: var(--ok-soft); color: var(--ok-text); }
.pill--ok::before { background: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn-text); }
.pill--warn::before { background: var(--warn-dot); }
.pill--serious { background: var(--serious-soft); color: var(--serious); }
.pill--serious::before { background: var(--serious-dot); }
.pill--danger { background: var(--danger-soft); color: var(--danger-text); }
.pill--danger::before { background: var(--danger-dot); }
.pill--info { background: var(--accent-soft); color: var(--accent-text); }
.pill--info::before { background: var(--accent); }
.pill--off { background: var(--surface-3); color: var(--text-3); }
.pill--off::before { background: transparent; border: 1.5px solid var(--neutral-dot); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 550; color: var(--text-2); background: var(--surface-2); white-space: nowrap;
}
.tag .icon { width: 12px; height: 12px; }
.tag--accent { border-color: var(--accent-soft-border); background: var(--accent-soft); color: var(--accent-text); }
.tag--danger { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); color: var(--danger-text); }
.tag--warn { border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); color: var(--warn-text); }
.tag--ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: var(--ok-soft); color: var(--ok-text); }

.sev { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; color: var(--text-2); }
.sev .icon { width: 14px; height: 14px; }
.sev--critical .icon { color: var(--danger-dot); }
.sev--high .icon { color: var(--serious-dot); }
.sev--medium .icon { color: var(--warn-dot); }
.sev--low .icon { color: var(--neutral-dot); }

.score {
  display: inline-grid; place-items: center; min-width: 38px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums;
}
.score--good { background: var(--ok-soft); color: var(--ok-text); }
.score--mid { background: var(--warn-soft); color: var(--warn-text); }
.score--bad { background: var(--danger-soft); color: var(--danger-text); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 0 var(--sp-3); height: 36px; text-align: left; white-space: nowrap;
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); letter-spacing: 0.02em;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: var(--sp-2) var(--sp-3); height: 44px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr.is-selected td { background: var(--accent-soft); }
.table .col-check { width: 40px; padding-right: 0; }
.table .col-actions { width: 48px; text-align: right; }
.table th.text-right { text-align: right; } /* numeric column headers line up with their right-aligned values */
.table--compact td { height: 36px; padding-top: 6px; padding-bottom: 6px; }
.table--kv td:first-child { width: 38%; color: var(--text-3); }
.th-sort { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.th-sort .icon { width: 12px; height: 12px; }
.cell-main { display: flex; flex-direction: column; min-width: 0; }
.cell-main__title { font-weight: 600; color: var(--text); }
.cell-main__title:hover { color: var(--accent-text); }
.cell-main__sub { font-size: var(--fs-xs); color: var(--text-3); }
.cell-icon { display: flex; align-items: center; gap: var(--sp-3); }
.os-chip {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: var(--radius); background: var(--surface-3); color: var(--text-2);
}

.toolbar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.toolbar .input-wrap { flex: 0 1 300px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--sp-2) 0 var(--sp-3);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
  font-size: var(--fs-sm); color: var(--text-2); cursor: pointer;
}
.filter-chip:hover { border-color: var(--text-3); color: var(--text); }
.filter-chip--set { border-style: solid; border-color: var(--accent-soft-border); background: var(--accent-soft); color: var(--accent-text); }
.filter-chip .icon { width: 14px; height: 14px; }

.bulkbar {
  display: none; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4);
  background: var(--accent-soft); border-bottom: 1px solid var(--accent-soft-border); font-size: var(--fs-sm);
}
.bulkbar.is-visible { display: flex; }
.bulkbar__count { font-weight: 600; color: var(--accent-text); margin-right: var(--sp-2); }

.pager { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); }
.pager span { white-space: nowrap; }
.help.row--between > .num:last-child { flex: none; white-space: nowrap; } /* "0 / 80" counters never break */
.pager .select, .toolbar .select { width: auto; }
/* bare inputs in a filter toolbar (dates, prefixes) sit inline like the search box, not full width */
.toolbar > .input { width: auto; flex: 0 1 220px; }
.toolbar > .input[type="date"] { flex: 0 0 auto; }

/* ---------- View tabs (saved views / segmented) ---------- */
.views { display: flex; gap: 2px; padding: 0 var(--sp-4); border-bottom: 1px solid var(--border); overflow-x: auto; }
.views a, .tabs [role="tab"] {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 var(--sp-3); white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 550; color: var(--text-3);
  background: none; border: 0; cursor: pointer;
}
.views a:hover, .tabs [role="tab"]:hover { color: var(--text); text-decoration: none; }
.views a[aria-current="true"], .tabs [role="tab"][aria-selected="true"] { color: var(--text); }
.views a[aria-current="true"]::after, .tabs [role="tab"][aria-selected="true"]::after {
  content: ""; position: absolute; left: var(--sp-2); right: var(--sp-2); bottom: -1px; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--accent);
}
.count { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 9px; background: var(--surface-3); color: var(--text-3); line-height: 18px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
[role="tabpanel"][hidden] { display: none; }

/* ==========================================================================
   Key-value lists, timeline, meters
   ========================================================================== */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px var(--sp-4); font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--text-3); }
p + .kv { margin-top: var(--sp-3); } /* a key/value list right after a paragraph needs air */
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv--wide { grid-template-columns: 160px minmax(0, 1fr); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.list > li:first-child { border-top: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 550; }
.list__sub { font-size: var(--fs-xs); color: var(--text-3); }
.list__side { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; text-align: right; }

.timeline { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-4) var(--sp-3); }
.timeline li { position: relative; display: grid; grid-template-columns: 64px 18px minmax(0, 1fr); gap: var(--sp-2); padding: 6px 0; font-size: var(--fs-sm); }
.timeline li::before { content: ""; position: absolute; left: 80px; top: 22px; bottom: -8px; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline__time { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); padding-top: 2px; }
.timeline__dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); }
.timeline__dot .icon { width: 11px; height: 11px; }
.timeline__dot--ok { background: var(--ok-soft); color: var(--ok); }
.timeline__dot--warn { background: var(--warn-soft); color: var(--warn); }
.timeline__dot--danger { background: var(--danger-soft); color: var(--danger); }
.timeline__dot--info { background: var(--accent-soft); color: var(--accent-text); }

.meter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--sp-3); align-items: center; font-size: var(--fs-sm); }
.meter-row + .meter-row { margin-top: var(--sp-3); }
.meter-row__label { display: flex; align-items: center; gap: 6px; }
.meter-row__value { font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-row progress { grid-column: 1 / -1; }
progress.meter {
  appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; overflow: hidden;
  background: var(--meter-track); color: var(--accent);
}
progress.meter::-webkit-progress-bar { background: var(--meter-track); border-radius: 3px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
progress.meter--ok::-webkit-progress-value { background: var(--ok); }
progress.meter--ok::-moz-progress-bar { background: var(--ok); }
progress.meter--warn::-webkit-progress-value { background: var(--warn-dot); }
progress.meter--warn::-moz-progress-bar { background: var(--warn-dot); }
progress.meter--danger::-webkit-progress-value { background: var(--danger-dot); }
progress.meter--danger::-moz-progress-bar { background: var(--danger-dot); }

/* ---------- Status rows (posture checks) ---------- */
.checkrow { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.checkrow:first-child { border-top: 0; padding-top: 0; }
.checkrow:last-child { padding-bottom: 0; }
.checkrow__icon { flex: none; }
.checkrow__icon--ok { color: var(--ok); }
.checkrow__icon--warn { color: var(--warn); }
.checkrow__icon--danger { color: var(--danger); }
.checkrow__icon--off { color: var(--text-3); }
.checkrow__main { flex: 1; min-width: 0; }
.checkrow__sub { font-size: var(--fs-xs); color: var(--text-3); }

/* ==========================================================================
   Node page header
   ========================================================================== */
.entity {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-4); align-items: center;
  padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4);
}
.entity__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent-text); }
.entity__title { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.entity__name { font-size: var(--fs-xl); font-weight: 650; font-family: var(--font-mono); letter-spacing: -0.02em; }
.entity__name--person { font-family: inherit; letter-spacing: -0.01em; } /* people are not identifiers */
.entity__meta { display: flex; flex-wrap: wrap; gap: 4px var(--sp-4); margin-top: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.entity__meta span { display: inline-flex; align-items: center; gap: 6px; }
.entity__meta .icon { color: var(--text-3); width: 14px; height: 14px; }
.entity__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: flex-end; }
.entity__facts {
  grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--border); margin: var(--sp-1) calc(var(--sp-5) * -1) calc(var(--sp-4) * -1);
}
.fact { padding: var(--sp-3) var(--sp-5); border-left: 1px solid var(--border); min-width: 0; }
.fact:first-child { border-left: 0; }
.fact__label { font-size: var(--fs-xs); color: var(--text-3); }
.fact__value { margin-top: 2px; font-weight: 600; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }

.unavailable {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4);
  color: var(--text-3); font-size: var(--fs-sm); background: var(--surface-2); border-radius: var(--radius);
}

/* ==========================================================================
   Menus, dialogs, toasts, tooltip, command palette
   ========================================================================== */
.menu-anchor { position: relative; }
.menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; min-width: 220px;
  padding: var(--sp-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); display: none;
}
.menu--left { left: 0; right: auto; }
.menu.is-open { display: block; }
.menu__item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: 34px; padding: 0 var(--sp-3);
  border: 0; border-radius: var(--radius); background: none; color: var(--text); font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.menu__item:hover { background: var(--surface-3); text-decoration: none; }
.menu__item .icon { color: var(--text-3); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger .icon { color: var(--danger); }
.menu__sep { height: 1px; margin: var(--sp-1) 0; background: var(--border); }
.menu__label { padding: var(--sp-2) var(--sp-3) var(--sp-1); font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.menu__check { margin-left: auto; color: var(--accent-text); }

dialog.modal {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal--wide { width: min(720px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(8, 12, 21, 0.55); }
dialog.modal[open] { animation: modal-in var(--dur) var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-lg); flex: none; background: var(--accent-soft); color: var(--accent-text); }
.modal__icon--danger { background: var(--danger-soft); color: var(--danger); }
.modal__title { font-size: var(--fs-lg); font-weight: 650; }
.modal__sub { margin-top: 4px; font-size: var(--fs-sm); color: var(--text-3); }
.modal__body { padding: 0 var(--sp-5) var(--sp-5); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 10px 10px; }
.modal__close { margin-left: auto; }

.toast-stack { position: fixed; z-index: 90; right: var(--sp-6); bottom: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); }
.toast {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 280px; max-width: 420px; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg); background: #131a2a; color: #f1f4f9; box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
  animation: modal-in var(--dur) var(--ease);
}
.toast .icon { color: #6fd29a; }

.chart-tip {
  position: fixed; z-index: 80; pointer-events: none; padding: 6px 10px; border-radius: var(--radius);
  background: #131a2a; color: #f1f4f9; font-size: var(--fs-xs); box-shadow: var(--shadow-md);
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; display: none;
}
.chart-tip.is-visible { display: block; }
.chart-tip strong { font-size: var(--fs-sm); }

dialog.cmdk { width: min(640px, calc(100vw - 32px)); margin-top: 12vh; }
.cmdk__input { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-4); border-bottom: 1px solid var(--border); }
.cmdk__input input { flex: 1; height: 52px; border: 0; background: none; font-size: var(--fs-md); outline: none; }
.cmdk__list { max-height: 50vh; overflow-y: auto; padding: var(--sp-2); }
.cmdk__group { padding: var(--sp-2) var(--sp-3) var(--sp-1); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.cmdk__item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); color: var(--text); font-size: var(--fs-sm); }
.cmdk__item:hover, .cmdk__item.is-active { background: var(--accent-soft); text-decoration: none; }
.cmdk__item .icon { color: var(--text-3); }
.cmdk__item small { margin-left: auto; color: var(--text-3); font-size: var(--fs-xs); }
.cmdk__foot { display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }
.cmdk__empty { padding: var(--sp-6); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }

/* ==========================================================================
   Charts (inline SVG; colours from tokens)
   ========================================================================== */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--chart-axis); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-size: 11px; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .label-text { fill: var(--text-2); font-size: 12px; font-family: var(--font-sans); }
.chart .value-text { fill: var(--text); font-size: 12px; font-weight: 600; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .series-line { fill: none; stroke: var(--chart-series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { fill: var(--chart-area); stroke: none; }
.chart .series-dot { fill: var(--chart-series); stroke: var(--surface); stroke-width: 2; }
.chart .series-bar { fill: var(--chart-series); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover + .hover-dot, .chart .hover-dot.is-active { opacity: 1; }
.chart .hover-dot { opacity: 0; fill: var(--chart-series); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.chart .bar-track { fill: var(--meter-track); }
.spark .spark-line { fill: none; stroke: var(--chart-muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark-now { fill: var(--chart-series); }
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--text-2); }
.legend__key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.sevbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.sevbar__seg--critical { background: var(--danger-dot); }
.sevbar__seg--high { background: var(--serious-dot); }
.sevbar__seg--medium { background: var(--warn-dot); }
.sevbar__seg--low { background: var(--neutral-dot); }
/* segment widths as classes (CSP: no inline style) */
.w-6 { flex: 0 0 6%; } .w-12 { flex: 0 0 12%; } .w-29 { flex: 0 0 29%; } .w-53 { flex: 0 0 53%; }

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  background: var(--surface);
}
.auth__aside {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 48px; background: var(--nav-bg); color: var(--nav-text); overflow: hidden;
}
.auth__aside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(107, 155, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 155, 255, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 70% 40%, #000 0%, transparent 70%);
}
.auth__aside > * { position: relative; z-index: 1; }
.auth__headline { max-width: 460px; font-size: 30px; font-weight: 650; line-height: 1.2; letter-spacing: -0.02em; color: #fff; }
.auth__lead { max-width: 440px; margin-top: var(--sp-4); color: var(--nav-text); font-size: var(--fs-md); }
.auth__points { list-style: none; margin: var(--sp-8) 0 0; padding: 0; display: grid; gap: var(--sp-3); max-width: 440px; }
.auth__points li { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-sm); }
.auth__points .icon { color: var(--nav-indicator); margin-top: 2px; }
.auth__legal { font-size: var(--fs-xs); color: var(--nav-text-muted); }
.auth__main { display: flex; flex-direction: column; justify-content: center; padding: 48px; }
.auth__form { width: 100%; max-width: 380px; margin: 0 auto; }
.auth__title { font-size: var(--fs-2xl); font-weight: 650; }
.auth__sub { margin-top: 6px; color: var(--text-3); font-size: var(--fs-sm); }
.auth__foot { max-width: 380px; margin: var(--sp-8) auto 0; width: 100%; font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: var(--sp-2); align-items: flex-start; }
.auth .brand { border: 0; padding: 0; height: auto; }
.divider { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-3); font-size: var(--fs-xs); margin: var(--sp-5) 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ==========================================================================
   Preview-only helpers (not part of the product)
   ========================================================================== */
.preview-role {
  position: fixed; z-index: 70; left: 50%; bottom: var(--sp-4); transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-2); padding: 6px 6px 6px var(--sp-3);
  border-radius: 999px; background: #131a2a; color: #e7ecf5; box-shadow: var(--shadow-lg); font-size: var(--fs-xs);
}
.preview-role__tag { font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #ffcf70; }
.preview-role select {
  height: 28px; padding: 0 26px 0 10px; border-radius: 999px; border: 1px solid #2c3750; background-color: #1b2336; color: #fff;
  font-size: var(--fs-xs);
}
html[data-role="hod"] .perm-admin, html[data-role="auditor"] .perm-admin,
html[data-role="admin"] .perm-super, html[data-role="hod"] .perm-super, html[data-role="auditor"] .perm-super { display: none !important; }
html[data-role="auditor"] .perm-write { display: none !important; }

.stub { max-width: 560px; margin: 10vh auto; text-align: center; }
.stub__icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: var(--sp-4); }
.stub .row { justify-content: center; }

.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-3); }
.index-card { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); color: var(--text); }
.index-card:hover { border-color: var(--accent-soft-border); text-decoration: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .entity__facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fact:nth-child(4) { border-left: 0; }
  .fact:nth-child(n + 4) { border-top: 1px solid var(--border); }
}
@media (max-width: 1100px) {
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .callouts { grid-template-columns: minmax(0, 1fr); }
  .entity { grid-template-columns: auto minmax(0, 1fr); }
  .entity__actions { grid-column: 1 / -1; justify-content: flex-start; }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__aside { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  html[data-nav="open"] .sidebar { display: flex; position: fixed; z-index: 60; width: var(--sidebar-w); }
  .search-trigger__label, .search-trigger__hint, .user-btn__text { display: none; }
  .search-trigger { flex: 0 0 auto; }
  .content { padding: var(--sp-4); }
  .grid-2, .grid-4, .grid-5, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .entity__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(odd) { border-left: 0; }
  .fact:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .page-head__actions { margin-left: 0; }
  .topbar { padding-right: var(--sp-3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media (forced-colors: active) {
  .pill::before, .sevbar__seg--critical, .sevbar__seg--high, .sevbar__seg--medium, .sevbar__seg--low { forced-color-adjust: none; }
}

/* card head extras */
.card__head > .icon { color: var(--text-3); }
.card__head > .tag:last-child, .card__head > .btn:last-child { margin-left: auto; }

/* block-level text inside inline containers */
.callout__title, .callout__text, .list__title, .list__sub, .cell-main__sub, .checkrow__sub { display: block; }
.delta { white-space: nowrap; }
.stat__foot { flex-wrap: nowrap; white-space: nowrap; }
/* plain-text footers (no icons / sparklines) wrap instead of being clipped by the card */
.stat__foot:not(:has(svg)) { white-space: normal; }
/* room for the preview bar */
.main { padding-bottom: 56px; }

/* equal-height cards in grids, footer pinned to bottom */
.grid > .card { display: flex; flex-direction: column; }
.grid > .card > .card__foot { margin-top: auto; }
.grid > .card.stat { display: flex; }
.tabs [role="tab"] { padding: 0 10px; }
.preview-role .btn--ghost { color: #c7d2e6; }
.preview-role .btn--ghost:hover { background: #222c42; color: #fff; }

/* dense list tables: never wrap cell text, scroll horizontally instead */
.table--nowrap td { white-space: nowrap; }
.table--nowrap .cell-main__sub { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.table--nowrap .cell-icon .cell-main__sub { max-width: 200px; } /* model · asset tag under a device name */
/* dense tables: slightly tighter columns so the key columns fit at 1440 px before scrolling */
.table--nowrap th, .table--nowrap td { padding-left: 10px; padding-right: 10px; }
.table--nowrap .col-check { padding-right: 0; }

/* OS chips: brand-recognisable logo, neutral chip */
.os-chip--windows { color: #0067b8; }
.os-chip--mac { color: var(--text); }
.os-chip--linux { color: var(--text); }
:root[data-theme="dark"] .os-chip--windows { color: #4ea7ff; }
.os-chip .icon { width: 15px; height: 15px; }
.entity__icon .icon--os { width: 26px; height: 26px; }

/* menus: checkbox items, notes, footer actions, fixed (escapes scroll containers) */
.menu--fixed { position: fixed; top: auto; right: auto; }
.menu__item--check { gap: var(--sp-3); }
.menu__item--check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.menu__note { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); max-width: 240px; }
.menu__note .icon { margin-top: 2px; }
.menu__actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2) var(--sp-2); }
.menu { max-height: 70vh; overflow-y: auto; }
.chart .os-win { color: #0067b8; }
.chart .os-ink { color: var(--text); }
:root[data-theme="dark"] .chart .os-win { color: #4ea7ff; }

.ack { display: flex; align-items: center; gap: var(--sp-2); min-width: 170px; }
.ack progress { width: 90px; }

/* ==========================================================================
   Endpoint popup (shown by the agent's session helper) — design preview
   ========================================================================== */
.ep-stage {
  position: relative; display: grid; place-items: center; min-height: 560px; padding: 48px 24px;
  border-radius: var(--radius-lg); overflow: hidden;
  background: radial-gradient(ellipse at 20% 10%, #3b5c8f 0%, transparent 55%), radial-gradient(ellipse at 90% 90%, #24476b 0%, transparent 50%), #172238;
}
.ep-stage--corner { place-items: end end; }
.ep-desk { position: absolute; inset: 0; pointer-events: none; }
.ep-desk::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40px;
  background: rgba(10, 16, 28, 0.82); border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.ep-desk__win {
  position: absolute; left: 6%; top: 8%; width: 52%; height: 62%;
  border-radius: 8px; background: rgba(240, 244, 250, 0.9); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.ep-desk__win::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 28px; border-radius: 8px 8px 0 0; background: rgba(210, 218, 230, 0.95); }
.ep-desk__win--b { left: 44%; top: 22%; width: 46%; height: 56%; background: rgba(228, 234, 243, 0.85); }
.ep-desk--dim::before { content: ""; position: absolute; inset: 0; z-index: 2; background: rgba(5, 9, 18, 0.55); }

.ep-window {
  position: relative; z-index: 3; width: min(540px, 100%);
  background: var(--surface); color: var(--text); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.2);
}
.ep-window__bar { height: 4px; background: var(--accent); }
.ep-window--critical .ep-window__bar { background: var(--danger-dot); }
.ep-window--important .ep-window__bar { background: var(--serious-dot); }
.ep-window__head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6) 0; }
.ep-window__icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.ep-window--critical .ep-window__icon { background: var(--danger-soft); color: var(--danger); }
.ep-window--important .ep-window__icon { background: var(--serious-soft); color: var(--serious); }
.ep-window__from { font-size: var(--fs-sm); font-weight: 600; }
.ep-window__verified { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: var(--fs-xs); color: var(--ok-text); }
.ep-window__prio {
  flex: none; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent-text);
}
.ep-window--critical .ep-window__prio { background: var(--danger-soft); color: var(--danger-text); }
.ep-window--important .ep-window__prio { background: var(--serious-soft); color: var(--serious); }
.ep-window__title { padding: var(--sp-4) var(--sp-6) 0; font-size: var(--fs-xl); font-weight: 650; line-height: 1.3; }
.ep-window__body { padding: var(--sp-3) var(--sp-6) 0; font-size: var(--fs-md); line-height: 1.6; color: var(--text-2); }
.ep-window__body p + p { margin-top: var(--sp-3); }
.ep-window__meta { padding: var(--sp-4) var(--sp-6) 0; font-size: var(--fs-xs); color: var(--text-3); }
.ep-window__safety {
  display: flex; align-items: center; gap: 6px; margin: var(--sp-3) var(--sp-6) 0; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-2);
}
.ep-window__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2);
  margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-6); border-top: 1px solid var(--border); background: var(--surface-2);
}
.ep-window__foot > .xs { margin-right: auto; }

.ep-toast {
  position: relative; z-index: 3; display: flex; gap: var(--sp-3); width: 360px; margin: 0 16px 56px 0; padding: var(--sp-4);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}
.ep-toast__icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); }
.ep-toast__title { margin-top: 2px; font-weight: 600; font-size: var(--fs-sm); }
.ep-toast__body { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-2); }

.ep-note { padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); font-size: var(--fs-sm); }
.ep-note p { margin-top: 4px; color: var(--text-2); }
.ep-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); font-size: var(--fs-sm); }
.ep-rules li { display: flex; gap: var(--sp-2); align-items: flex-start; }
.ep-rules .icon { color: var(--ok); margin-top: 2px; }
.tabs [role="tab"] .icon { width: 14px; height: 14px; }

/* Appearance settings */
.font-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.font-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: var(--sp-4);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer;
}
.font-card:hover { border-color: var(--text-3); }
.font-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-border); }
.font-card input { position: absolute; top: var(--sp-3); right: var(--sp-3); accent-color: var(--accent); }
.font-card__name { font-weight: 600; font-size: var(--fs-sm); }
.font-card__sample { font-size: var(--fs-lg); line-height: 1.35; color: var(--text); }
.font-card__note { font-size: var(--fs-xs); color: var(--text-3); }
.font-inter { font-family: "Inter", sans-serif; }
.font-plex { font-family: "IBM Plex Sans", sans-serif; }
.font-source { font-family: "Source Sans 3", sans-serif; }
.font-public { font-family: "Public Sans", sans-serif; }
.font-system { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.upload { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); }
.upload__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-3); }
.upload strong + .help { display: block; margin-top: 2px; } /* file hint on its own line under "Add up to 3 files" */

/* actions column always visible on wide tables */
.table--nowrap .col-actions { position: sticky; right: 0; z-index: 2; background: var(--surface); box-shadow: inset 1px 0 0 var(--border); }
.table--nowrap th.col-actions { background: var(--surface-2); z-index: 3; }
.table--nowrap tbody tr:hover td.col-actions { background: var(--surface-2); }
.table--nowrap tbody tr.is-selected td.col-actions { background: var(--accent-soft); }
.table--nowrap td.col-actions:has(.menu.is-open) { z-index: 20; }
.menu { white-space: normal; }

/* ---------- App (server-rendered) additions ---------- */
.field-error { font-size: var(--fs-xs); color: var(--danger-text); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.flash-stack { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.qr-box { display: grid; place-items: center; width: 220px; height: 220px; padding: var(--sp-2); background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.qr-box svg { width: 100%; height: 100%; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); padding: var(--sp-4); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); font-family: var(--font-mono); font-size: var(--fs-sm); }
.secret { font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0.08em; word-break: break-all; padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-radius: var(--radius); }
.empty { padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.empty .icon { width: 28px; height: 28px; margin: 0 auto var(--sp-2); color: var(--text-3); }
form.inline { display: inline; }
.search-trigger .search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-size: var(--fs-sm); color: var(--text); }
.search-trigger:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-border); }
:root[data-size="large"] { --fs-xs: 13px; --fs-sm: 14px; --fs-base: 15px; --fs-md: 16px; }

/* Employee portal shell */
.portal-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--sp-4); height: 60px; padding: 0 var(--sp-6); background: var(--nav-bg); color: var(--nav-text); }
.portal-top .brand { border: 0; padding: 0; height: auto; }
.portal-nav { display: flex; gap: 2px; margin-left: var(--sp-6); }
.portal-nav a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 var(--sp-3); border-radius: var(--radius); color: var(--nav-text); font-size: var(--fs-sm); font-weight: 500; }
.portal-nav a:hover { background: var(--nav-hover); color: #fff; text-decoration: none; }
.portal-nav a[aria-current="page"] { background: var(--nav-active-bg); color: #fff; }
.portal-user { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.portal-user .btn { color: var(--nav-text); border-color: #2a3449; background: transparent; }
/* the theme switch sits on the dark portal bar in both themes: use the nav colours, not the page ones */
.portal-user .icon-btn { color: var(--nav-text); }
.portal-user .icon-btn:hover { background: var(--nav-hover); color: #fff; }
.portal-main { max-width: 1120px; margin: 0 auto; padding: var(--sp-6); }
@media (max-width: 860px) { .portal-nav { display: none; } .portal-main { padding: var(--sp-4); } }
.code-block { margin: var(--sp-2) 0 0; max-width: 640px; max-height: 260px; overflow: auto; padding: var(--sp-2) var(--sp-3); white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }

[hidden] { display: none !important; }
.sev-fill--critical { fill: var(--danger-dot); }
.sev-fill--high { fill: var(--serious-dot); }
.sev-fill--medium { fill: var(--warn-dot); }
.sev-fill--low { fill: var(--neutral-dot); }
.menu__item:disabled, .menu__item[aria-disabled="true"] { color: var(--text-3); cursor: not-allowed; background: none; }
.menu__item:disabled .icon { color: var(--text-3); }

/* ---------- Command palette: server results (app.js builds the rows with DOM APIs) ---------- */
.cmdk__list:empty { display: none; }
.cmdk__item { cursor: pointer; }
.cmdk__item .icon { flex: none; }
.cmdk__main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cmdk__title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__sub { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__item small { flex: none; white-space: nowrap; }
.cmdk__foot .kbd { min-height: 18px; }
.search-trigger__hint { flex: none; }

/* ---------- Type-to-search picker (Search::_picker + app.js) ---------- */
.picker { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.picker__control { position: relative; display: flex; align-items: center; }
.picker__control > .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.picker__input { padding-left: 32px; padding-right: 38px; }
.picker.is-chosen .picker__input { border-color: var(--accent-soft-border); background: var(--accent-soft); font-weight: 550; }
.picker__clear {
  position: absolute; right: 4px; display: grid; place-items: center;
  width: 30px; height: 28px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-3); cursor: pointer;
}
.picker__clear:hover { color: var(--text); background: var(--surface-3); }
.picker__list {
  list-style: none; margin: 0; padding: var(--sp-1); max-height: 264px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md);
}
.picker__option { display: flex; align-items: center; gap: var(--sp-2); padding: 6px var(--sp-2); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-sm); }
.picker__option.is-active { background: var(--accent-soft); }
.picker__option-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.picker__option-title { font-weight: 550; color: var(--text); }
.picker__option-sub { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__check { visibility: hidden; color: var(--accent-text); }
.picker__option[aria-selected="true"] .picker__check { visibility: visible; }
.picker__empty { padding: var(--sp-2) var(--sp-3); color: var(--text-3); font-size: var(--fs-sm); }
.picker__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.picker__tags:empty { display: none; }
.picker__tag {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 26px; padding: 0 2px 0 8px;
  border: 1px solid var(--accent-soft-border); border-radius: var(--radius-sm); background: var(--accent-soft);
  color: var(--accent-text); font-size: var(--fs-xs); font-weight: 550;
}
.picker__tag-x { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 3px; background: transparent; color: inherit; cursor: pointer; }
.picker__tag-x:hover { background: var(--surface-3); }
.picker__tag-x .icon { width: 12px; height: 12px; }

/* ---------- Devices: live agent marker ---------- */
.tag--live { border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: var(--ok-soft); color: var(--ok-text); }
.tag--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }

/* ---------- Settings: certificates & network ---------- */
.fp { font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.days { display: grid; grid-template-columns: 52px 90px; gap: var(--sp-2); align-items: center; }
.san-list { display: flex; flex-wrap: wrap; gap: 6px; }
.fieldset-plain { margin: 0; padding: 0; border: 0; min-width: 0; }
.text-danger { color: var(--danger-text); }
/* Device / asset header: the actions column must not grow with its explanatory note (it squeezed the
   name column on macOS devices, whose note is long). */
.entity__actions { max-width: 560px; }
.entity__actions > .xs { flex-basis: 100%; text-align: right; }
@media (max-width: 1100px) { .entity__actions { max-width: none; } .entity__actions > .xs { text-align: left; } }

/* ---------- Devices: "Send message" dialog ---------- */
.dm-body { min-height: 112px; font-family: inherit; line-height: 1.5; }
.dm-over { color: var(--danger-text); font-weight: 600; }
.dm-prio > legend { padding: 0; margin-bottom: 6px; }
.dm-ack { justify-content: flex-end; padding-bottom: 2px; }
.dm-ack .switch:has(input:disabled) { cursor: default; }
.dm-ack .switch input:disabled { opacity: 0.55; cursor: not-allowed; }
.dm-sentby {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-2);
}
.dm-sentby > .icon { width: 14px; height: 14px; color: var(--text-3); }
.dm-sentby strong { color: var(--text); font-weight: 600; }
.dm-note { display: flex; align-items: center; gap: 6px; }
.dm-note .icon { width: 14px; height: 14px; flex: none; }
.dm-more { margin-right: auto; }

/* ---------- Segmented control as links (server-side choices, e.g. a time range: ?perf=7d) ---------- */
a.seg__opt { text-decoration: none; }
a.seg__opt:hover { text-decoration: none; }
.seg__opt[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-soft-border); }
.count--warn { background: var(--warn-soft); color: var(--warn-text); }

/* ---------- Grouped tables: a full-width group header row per tbody ---------- */
.table .table__group th {
  position: static; height: 32px; padding: 0 var(--sp-3);
  background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); letter-spacing: 0.01em;
}
.table tbody:first-of-type .table__group th { border-top: 0; }
.table tbody tr.table__group:hover th { background: var(--surface); }
.table tbody:has(+ tbody) tr:last-child td { border-bottom: 1px solid var(--border); }
.th-note { display: block; font-weight: 500; color: var(--text-3); letter-spacing: 0; font-size: 11px; }
.table th:has(.th-note) { height: auto; padding-top: 6px; padding-bottom: 6px; line-height: 1.3; }

/* ---------- Tabs that overflow: horizontal scroll, edge fades and chevrons (app.js adds .tabs-wrap) ---------- */
.tabs-wrap { position: relative; border-bottom: 1px solid var(--border); }
.tabs-wrap > .tabs { border-bottom: 0; scrollbar-width: none; scroll-behavior: smooth; scroll-padding-inline: 40px; }
.tabs-wrap > .tabs::-webkit-scrollbar { display: none; }
.tabs-wrap.is-over-start > .tabs { mask-image: linear-gradient(to right, transparent 0, #000 56px); }
.tabs-wrap.is-over-end > .tabs { mask-image: linear-gradient(to left, transparent 0, #000 56px); }
.tabs-wrap.is-over-start.is-over-end > .tabs { mask-image: linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%); }
.tabs-wrap__btn {
  position: absolute; top: 50%; z-index: 2; display: none; place-items: center; width: 28px; height: 28px; margin-top: -14px;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.tabs-wrap__btn:hover { color: var(--text); border-color: var(--border-strong); }
.tabs-wrap__btn .icon { width: 14px; height: 14px; }
.tabs-wrap__btn--prev { left: 4px; }
.tabs-wrap__btn--next { right: 4px; }
.tabs-wrap.is-over-start .tabs-wrap__btn--prev, .tabs-wrap.is-over-end .tabs-wrap__btn--next { display: grid; }
@media (forced-colors: active) { .tabs-wrap > .tabs { mask-image: none !important; } }
