/**
 * Admin view styles - the shared UI kit and the per-view rules for the pages
 * that used to carry their own light-theme <style> blocks.
 *
 * Loaded LAST (after admin.css and the vendored web-ui layers) so it can refine
 * them. Everything here is expressed in the theme tokens from
 * theme/edy-auth-dark/tokens.css (--bg-*, --text-*, --status-*, --border-*);
 * there are deliberately no hard-coded light colours. The only literals are the
 * two accent shades below, which exist because --accent-primary (#007acc) is a
 * fine BACKGROUND but only 3.4:1 as small TEXT on the dark panels.
 *
 * Contrast targets (WCAG AA, 4.5:1 for text):
 *   --text-primary   on --bg-secondary  10.3
 *   --text-secondary on --bg-secondary   5.6
 *   --accent-text    on --bg-secondary   6.2
 *   --status-*       on their 10% tint   5.2 - 8.5
 */

:root {
  /* Native widgets (datetime-local pickers, <select> popups, scrollbars,
     checkboxes) follow the dark theme instead of rendering light-on-light. */
  color-scheme: dark;

  --accent-text: #4daafc;        /* accent blue usable as text */
  --focus-ring: #4daafc;
  --info-bg: rgba(0, 122, 204, 0.24);
  --info-text: #6cb6ff;
}

/* ------------------------------------------------------------------ */
/* Links, focus                                                        */
/* ------------------------------------------------------------------ */

a { color: var(--accent-text); }

/* A visible focus indicator on EVERY interactive element. Earlier rules in
   admin.css removed the outline from some fields (outline: none + a border
   colour change) and native datetime-local controls had none at all, so a
   keyboard user could not tell where they were. !important is deliberate: it
   has to beat those per-component `outline: none` declarations. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="tab"]:focus-visible {
  outline: 2px solid var(--focus-ring) !important;
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn-small { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

a.btn-primary,
a.btn-secondary,
a.btn-danger {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
a.btn-primary   { color: #fff; }
a.btn-secondary { color: var(--text-primary); }

.btn-primary[disabled],
.btn-secondary[disabled],
.btn-danger[disabled] { opacity: 0.5; cursor: not-allowed; }

/* A button that reads as a link (Reset to default, Copy, ...). */
.btn-link {
  background: none;
  border: none;
  padding: 0.1rem 0.25rem;
  color: var(--accent-text);
  cursor: pointer;
  font-size: var(--font-size-sm);
}
.btn-link:hover { text-decoration: underline; background: none; }

/* ------------------------------------------------------------------ */
/* Cards, forms, help text                                             */
/* ------------------------------------------------------------------ */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-primary);
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.form-help {
  color: var(--text-secondary);
  font-size: var(--font-size-md);
  margin: 0 0 var(--space-3);
}

/* admin.css sizes every .form-group input at width:100%, which stretched
   checkboxes across the row and pushed their label text underneath. */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  width: auto;
  padding: 0;
  margin-right: 0.5rem;
  vertical-align: middle;
}
.form-group label > input[type="checkbox"] + *,
.form-group label > input[type="radio"] + * { font-weight: 400; }
.form-group label:has(> input[type="checkbox"]),
.form-group label:has(> input[type="radio"]) { font-weight: 400; }

.form-group select {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.muted { color: var(--text-secondary); }

/* Status banners the dynamic views write into their #xx-msg slot. */
.pv-msg, .ob-msg, .ev-msg, .cl-msg {
  margin: var(--space-2) 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
}
.pv-msg.ok, .ob-msg.ok, .ev-msg.ok, .cl-msg.ok {
  background: var(--status-success-10);
  border-color: rgba(78, 201, 176, 0.45);
  color: var(--status-success);
}
.pv-msg.err, .ob-msg.err, .ev-msg.err, .cl-msg.err {
  background: var(--status-error-10);
  border-color: rgba(244, 135, 113, 0.5);
  color: var(--status-error);
}
.restart-note {
  display: inline-block;
  margin-top: var(--space-1);
  padding: 1px var(--space-2);
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-sm);
  background: var(--status-warning-10);
  color: var(--status-warning);
  font-size: var(--font-size-sm);
}

/* ------------------------------------------------------------------ */
/* Badges - pill chips                                                 */
/*                                                                     */
/* The views emit `badge badge-success` etc.; components.css only had  */
/* `.badge.success`, so the chips rendered as bare text. Both spellings */
/* are styled here.                                                    */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-block;
  padding: 1px var(--space-2);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-success, .badge.success {
  background: var(--status-success-10);
  border-color: rgba(78, 201, 176, 0.45);
  color: var(--status-success);
}
.badge-warning, .badge-warn, .badge.warning, .badge.warn {
  background: var(--status-warning-10);
  border-color: rgba(220, 220, 170, 0.45);
  color: var(--status-warning);
}
.badge-danger, .badge-error, .badge.error, .badge.danger {
  background: var(--status-error-10);
  border-color: rgba(244, 135, 113, 0.5);
  color: var(--status-error);
}
.badge-info, .badge.info {
  background: var(--info-bg);
  border-color: rgba(0, 122, 204, 0.6);
  color: var(--info-text);
}
.badge-neutral, .badge-secondary, .badge.neutral, .badge.secondary {
  background: var(--bg-quaternary);
  border-color: var(--border-primary);
  color: var(--text-primary);
}

/* ------------------------------------------------------------------ */
/* Tab strips (Events tabs, Settings sections, Policy drawer)           */
/* ------------------------------------------------------------------ */

/* Policy drawer: the strip is styled as the other tab strips below, and only
   the active pane shows (there was no .tab-pane rule, so all four stacked). */
.drawer-content > .tab-pane { display: none; }
.drawer-content > .tab-pane.active { display: block; }

.ev-tabs,
.drawer-tabs,
.settings-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
}

.ev-tabs button,
.drawer-tabs button,
.settings-section-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.55rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  font-size: var(--font-size-md);
}
.ev-tabs button:hover,
.drawer-tabs button:hover,
.settings-section-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.ev-tabs button.active,
.ev-tabs button[aria-selected="true"],
.drawer-tabs button.active,
.drawer-tabs button[aria-selected="true"],
.settings-section-link.active,
.settings-section-link[aria-selected="true"] {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border-primary);
  border-bottom: 2px solid var(--accent-secondary);
  margin-bottom: -1px;
}

.settings-badge {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--accent-primary);
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Providers + Onboarding                                              */
/* ------------------------------------------------------------------ */

.pv-grid,
.ob-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
}
.ob-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.pv-card,
.ob-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  color: var(--text-primary);
}
.pv-card h4,
.ob-card h4 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-1);
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}
.pv-meta,
.ob-state {
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}
.pv-actions,
.ob-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.pv-actions { margin-top: var(--space-3); }

.ob-prog { display: flex; gap: 4px; margin: var(--space-2) 0 var(--space-3); }
.ob-dot { flex: 1; height: 5px; border-radius: 3px; background: var(--bg-elevated); }
.ob-dot.on { background: var(--status-success); }

.pv-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: var(--space-3) 0 var(--space-4);
}
.pv-step {
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--bg-quaternary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}
.pv-step.active { background: var(--accent-primary); color: #fff; }
.pv-step.done {
  background: var(--status-success-10);
  color: var(--status-success);
}

.pv-check {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  margin: var(--space-1) 0;
  font-size: var(--font-size-md);
}

.pv-wt,
.ob-stepbox {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
}
.pv-wt h5,
.ob-stepbox h5 { margin: 0 0 6px; font-size: var(--font-size-md); color: var(--text-primary); }
.pv-wt ol,
.ob-wt ol,
.ob-stepbox ol,
.ob-pre ol { margin: 4px 0 0 18px; padding: 0; }
.pv-wt li,
.ob-wt li,
.ob-stepbox li { margin: 3px 0; font-size: var(--font-size-md); line-height: 1.45; }

.pv-note,
.ob-note {
  margin-top: var(--space-2);
  padding: 7px 10px;
  background: var(--status-warning-10);
  border-left: 3px solid var(--status-warning);
  color: var(--text-primary);
  font-size: var(--font-size-md);
}
.ob-pre {
  padding: 8px 10px;
  background: var(--info-bg);
  border-left: 3px solid var(--accent-primary);
  color: var(--text-primary);
  font-size: var(--font-size-md);
}

code.pv-cb,
code.ob-cb {
  padding: 2px 6px;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  word-break: break-all;
}

.pv-table td, .pv-table th,
.pv-trouble td, .pv-trouble th,
.ob-table td, .ob-table th {
  padding: 6px 8px;
  font-size: var(--font-size-sm);
  text-align: left;
  vertical-align: top;
}
.ob-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.ob-table th, .ob-table td { border-bottom: 1px solid var(--border-primary); }

.pv-wizard-nav { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.pv-redirect { margin-top: 6px; }
.pv-verify-out { margin-top: var(--space-3); }
.pv-trouble-details { margin-top: var(--space-4); }
.pv-trouble-details summary { cursor: pointer; color: var(--text-primary); }
.pv-trouble { margin-top: var(--space-2); }
.ob-detail-body { padding: var(--space-1) 0; }
.ob-subhead { margin-top: var(--space-4); }
.ob-actions-footer { margin-top: var(--space-4); }
#ob-copy, #pv-copy-cb { margin-left: 6px; }

/* Enable/disable control on each provider card. */
.pv-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-md);
}

/* ------------------------------------------------------------------ */
/* Events                                                              */
/* ------------------------------------------------------------------ */

.ev-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-3);
}
.ev-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 150px;
  min-width: 140px;
  max-width: 260px;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
}
.ev-field input,
.ev-field select {
  width: 100%;
  padding: 6px;
  font-size: var(--font-size-sm);
}
.ev-filters .btn-primary { flex: 0 0 auto; }
.ev-pager {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin: var(--space-2) 0;
  color: var(--text-secondary);
}

.ev-table td, .ev-table th {
  padding: 5px 8px;
  font-size: var(--font-size-sm);
  vertical-align: top;
}
.ev-table .ev-time { white-space: nowrap; }

.ev-data { max-width: 380px; font-family: var(--font-mono); font-size: var(--font-size-xs); color: var(--text-secondary); }
.ev-data summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  color: var(--text-secondary);
}
.ev-data[open] summary { white-space: normal; }
pre.ev-json,
pre.ev-yaml {
  margin: var(--space-1) 0 0;
  padding: var(--space-2);
  max-height: 260px;
  overflow: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  white-space: pre-wrap;
  word-break: break-word;
}
pre.ev-yaml { white-space: pre; word-break: normal; }

/* ------------------------------------------------------------------ */
/* Cluster                                                             */
/* ------------------------------------------------------------------ */

.cl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  align-items: start;
}
.cl-grid > .card { margin-bottom: 0; }

.cl-kv {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: 4px 12px;
  font-size: var(--font-size-md);
}
.cl-kv > div:nth-child(odd) { color: var(--text-secondary); }
.cl-kv code { font-size: var(--font-size-sm); word-break: break-all; }

.cl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
}

/* "Join a cluster" wipes the node: a red-tinted panel that stays legible. */
.cl-danger {
  background: var(--status-error-05);
  border: 1px solid var(--status-error);
}
.cl-danger .card-header { color: var(--status-error); border-bottom-color: rgba(244, 135, 113, 0.4); }
.cl-danger hr { margin: var(--space-4) 0; border: 0; border-top: 1px solid rgba(244, 135, 113, 0.35); }

.cl-code-box {
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--status-success);
  border-radius: var(--radius-md);
  color: var(--status-success);
  font-family: var(--font-mono);
  word-break: break-all;
}

.cl-table td, .cl-table th {
  padding: 6px 8px;
  font-size: var(--font-size-sm);
  vertical-align: top;
}
.cl-lag-ok  { color: var(--status-success); font-weight: 600; }
.cl-lag-bad { color: var(--status-error);   font-weight: 600; }

/* Mint-code row: every control gets a visible label above it. */
.cl-inline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-3);
}
.cl-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 160px;
  min-width: 140px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}
.cl-field-wide { flex: 2 1 260px; }
.cl-field input { width: 100%; }

/* ------------------------------------------------------------------ */
/* Settings                                                            */
/* ------------------------------------------------------------------ */

.settings-view .view-actions { flex-wrap: wrap; }
.settings-body { display: block; }

.settings-form-header h3 { margin: 0 0 var(--space-1); font-size: var(--font-size-lg); }
.settings-form-description { color: var(--text-secondary); margin: 0 0 var(--space-3); }
.settings-group-heading {
  margin: var(--space-4) 0 var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
  font-size: var(--font-size-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-field {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
}
.settings-field-label { font-weight: 600; color: var(--text-primary); }
.settings-field-description { color: var(--text-secondary); font-size: var(--font-size-sm); }
.settings-field-control { min-width: 0; }
.settings-input { width: 100%; max-width: 640px; }
.settings-input.settings-checkbox { width: auto; max-width: none; }
textarea.settings-input { font-family: var(--font-mono); min-height: 5.5em; resize: vertical; }
.settings-checkbox-label { display: inline-flex; align-items: center; gap: var(--space-2); }
.settings-password-row { display: flex; gap: var(--space-2); max-width: 640px; }
.settings-password-row .settings-input { flex: 1 1 auto; }
.settings-field-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
}
.settings-field-error,
.settings-error {
  padding: var(--space-1) var(--space-2);
  background: var(--status-error-10);
  border-left: 3px solid var(--status-error);
  color: var(--status-error);
  font-size: var(--font-size-sm);
}
.settings-field-danger { border-color: var(--status-error); }
.settings-danger-flag {
  padding: var(--space-1) var(--space-2);
  background: var(--status-error-10);
  color: var(--status-error);
  font-size: var(--font-size-sm);
}
.settings-nested-object { margin: 0; }
.settings-nested-object > summary {
  cursor: pointer;
  font-weight: 600;
  padding: var(--space-1) 0;
}
.settings-nested-body { padding: var(--space-2) 0 0 var(--space-4); border-left: 2px solid var(--border-primary); }
.settings-restart-banner {
  margin-top: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--status-warning-10);
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-md);
  color: var(--status-warning);
}
.settings-copied { color: var(--status-success); font-size: var(--font-size-xs); }

/* ------------------------------------------------------------------ */
/* Static template modals (views/*.html: `.modal.hidden` shown by        */
/* dropping `hidden`). admin.css makes an open one a fixed, dimmed,      */
/* centred dialog. sessions.html also parks a `.modal-overlay` sibling   */
/* in each; as a fixed, z-indexed layer it painted OVER the (un-         */
/* positioned) dialog and swallowed its clicks, and dimmed the page      */
/* twice. Keep it as a transparent click-target behind the dialog.       */
/*                                                                       */
/* Stacking: the open modal is a fixed z-1000 layer in the ROOT stacking */
/* context (admin.css `#main` is deliberately not a stacking context), so */
/* it paints above the sidebar (101) and top bar (100) - and above the   */
/* mobile nav panel (850) - and its backdrop blocks all of them.         */
/* Size: components.css (loaded after admin.css) lifts .modal-content to */
/* max-width 80vw, which made a form dialog 1100px wide and pushed its   */
/* left half under the sidebar; a dialog is a dialog-sized card.         */
/* ------------------------------------------------------------------ */

.modal > .modal-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 0;
}
.modal > .modal-content {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 520px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.modal-header h2,
.modal-header h3 { margin: 0; }
.modal-actions,
.modal-footer {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-4);
}

/* ------------------------------------------------------------------ */
/* Drawers (users, groups & roles, sessions, policies) start UNDER the   */
/* top bar. The shared `.drawer` (web-ui-base/components.css) is        */
/* `top: 0`, and that file loads AFTER admin.css, so admin.css's         */
/* `.dir-drawer { top: var(--topbar-height) }` never applied: the title  */
/* sat under the top bar and the close button under Logoff. This file    */
/* loads last, so one rule here fixes every drawer, including the plain  */
/* `.drawer` of the policy view. z-index stays 800 (below modals).       */
/* ------------------------------------------------------------------ */

.drawer,
.dir-drawer { top: var(--topbar-height); }

/* ------------------------------------------------------------------ */
/* Sessions: filter bar + drawer (markup lives in sessions.js)         */
/* ------------------------------------------------------------------ */

.sessions-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  align-items: flex-end;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
}
.sessions-filter-bar .filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.sessions-filter-bar .filter-group > label,
.sessions-filter-bar legend {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}
.sessions-filter-bar input[type="text"],
.sessions-filter-bar input[type="datetime-local"],
.sessions-filter-bar select {
  min-width: 9rem;
  padding: 0.35rem 0.5rem;
  font-size: var(--font-size-md);
}
.sessions-filter-bar fieldset.filter-state {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0.2rem 0.6rem 0.4rem;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
}
.sessions-filter-bar legend { padding: 0 var(--space-1); }
.sessions-filter-bar .filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.15rem 0.65rem;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
}
.sessions-filter-bar .filter-pill input { width: auto; margin: 0; padding: 0; }
.sessions-filter-bar .filter-pill:has(input:checked) {
  background: var(--info-bg);
  border-color: var(--accent-primary);
}
.sessions-filter-bar .filter-actions { margin-left: auto; }

.session-detail-pane {
  position: fixed;
  right: 0;
  top: var(--topbar-height);
  bottom: 0;
  width: min(520px, 100vw);
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-primary);
  box-shadow: var(--shadow-md);
  z-index: 50;
}

/* Label/value rows used by the session drawer and the audit drawer. */
.session-info .info-row,
.audit-event-detail .info-row {
  display: flex;
  gap: 1rem;
  padding: 0.25rem 0;
}
.session-info .info-row label,
.audit-event-detail .info-row label {
  flex: 0 0 10rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.session-info .info-row span,
.audit-event-detail .info-row span { flex: 1; min-width: 0; word-break: break-word; }

/* ------------------------------------------------------------------ */
/* Audit                                                               */
/* ------------------------------------------------------------------ */

/* Filters sit on their own row under the title instead of inside the header
   row, where they squeezed "Audit Log" onto two lines. */
.audit-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  align-items: flex-end;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
}
.audit-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.audit-filters select,
.audit-filters input[type="text"],
.audit-filters input[type="datetime-local"] {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}
.audit-filters select[multiple] { min-width: 9rem; }
.audit-filters .audit-filter-buttons { display: flex; gap: var(--space-2); margin-left: auto; }

/* The audit endpoint pages SERVER-side (limit/offset), so the DataTable only
   ever holds one page of rows. Its own "Showing 1-N / Previous / Next" footer
   would be a second, always-disabled pager next to the real one below. */
.audit-table-container .datatable-pagination { display: none; }

.audit-pagination { color: var(--text-primary); }
.audit-user { white-space: nowrap; }
.audit-user small { color: var(--text-secondary); }

/* ------------------------------------------------------------------ */
/* Realms                                                              */
/* ------------------------------------------------------------------ */

/* The detail pane used to slide over the table and hide its right-hand
   columns. While it is open the table gives up the pane's width. */
@media (min-width: 1100px) {
  .realms-view.has-detail-pane .realms-table-container { margin-right: 520px; }
}

/* A status chip in an info row is a chip, not a full-width bar. */
.realm-info .info-row span.status-badge,
.site-info .info-row span.status-badge { flex: 0 0 auto; align-self: flex-start; }

.realm-info .info-row label,
.site-info .info-row label { color: var(--text-secondary); }

/* ------------------------------------------------------------------ */
/* Realm sign-in providers (views/provider-picker.js, providers-tab)    */
/* ------------------------------------------------------------------ */

.provider-picker {
  margin: var(--space-2) 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
}
.provider-picker legend { padding: 0 var(--space-1); font-weight: 600; color: var(--text-primary); }
.provider-picker .pp-mode {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-1) 0;
  font-weight: 400;
}
.provider-picker .pp-options { list-style: none; margin: 0 0 0 var(--space-5); padding: 0; }
.provider-picker .pp-option { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 2px 0; }
.provider-picker .pp-option label { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 400; }
.provider-picker .pp-hint { color: var(--text-secondary); font-size: var(--font-size-xs); }
.provider-picker .pp-removed label { text-decoration: line-through; color: var(--text-secondary); }
.provider-picker .pp-empty-hint,
.provider-picker .pp-legacy-note,
.provider-picker .pp-legacy-choice { color: var(--status-warning); margin: var(--space-1) 0; }
.provider-picker .pp-locked-text { margin: var(--space-1) 0; }

/* Muted, dashed chip; the visible text ("totp (not enabled)", "Inherit")
   carries the meaning, not the styling. */
.chip-inactive { color: var(--text-secondary); border-style: dashed; }

.realm-providers-cell { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* A button that reads as a link (aliases "+N", Remove, Change…). */
.link-btn {
  padding: 0;
  background: none;
  border: none;
  color: var(--accent-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Amber notes: deployment notes, enforcement mode, policy warnings. */
.pp-note-warn,
.unreg-deploy-note {
  margin: var(--space-2) 0;
  padding: var(--space-2) var(--space-3);
  background: var(--status-warning-10);
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-md);
  color: var(--status-warning);
}
.pp-unsat-excluded { color: var(--status-warning); }
.pp-unsat-disabled,
.pp-override-disabled { color: var(--text-secondary); }
.pp-policy dl { margin: var(--space-1) 0 var(--space-2); }
.pp-policy details summary { cursor: pointer; }

/* ------------------------------------------------------------------ */
/* Unregistered Sign-ins (views/unregistered-signins.js)               */
/* ------------------------------------------------------------------ */

/* Client-supplied origins: monospace, and long hosts wrap instead of
   pushing the table wider. */
.unreg-origin { font-family: var(--font-mono); word-break: break-all; }
.unreg-flags { display: block; }
.unreg-flags .badge { margin: 2px 4px 0 0; white-space: normal; }
.unreg-recorder { font-size: var(--font-size-sm); }

/* What registering trusts, server-wide. */
.trust-box {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--status-warning-10);
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}
.trust-box .trust-origins { list-style: none; margin: var(--space-1) 0; padding: 0; }
.trust-box .trust-origins code { font-size: var(--font-size-lg); }
.trust-box .trust-warning { color: var(--status-warning); }
.trust-box .unreg-ack-missing { outline: 2px solid var(--status-error); outline-offset: 2px; }

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

.nav-toggle { display: none; }
.nav-backdrop { display: none; }
.nav-brand { display: none; }

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
  }
  .nav-toggle:hover { background: var(--bg-tertiary); }
  /* Three bars; the middle one is the element, the others are pseudo-elements. */
  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    content: "";
  }
  .nav-toggle-bars { position: relative; }
  .nav-toggle-bars::before { position: absolute; top: -6px; }
  .nav-toggle-bars::after  { position: absolute; top: 6px; }
  .nav-brand {
    display: block;
    margin: 0 auto 0 0.75rem;
    color: var(--accent-text);
    font-weight: 600;
  }

  #topbar {
    left: 0;
    padding: 0 0.75rem;
    justify-content: flex-start;
  }
  #topbar .user-info { margin-left: auto; gap: 0.5rem; }
  #topbar .user-name { white-space: nowrap; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
  #topbar .user-roles { display: none; }

  /* The nav becomes an off-canvas panel under the top bar. visibility keeps
     the collapsed links out of the tab order; the delay lets the slide-out
     finish before they are hidden. */
  #sidebar {
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    width: min(280px, 85vw);
    /* Above the drawers (800) and below the modals (900/1000): with #main no
       longer a stacking context the drawers share the root context with the
       nav panel, and the panel must stay on top of them. */
    z-index: 850;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  body.nav-open #sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease, visibility 0s;
    box-shadow: var(--shadow-md);
  }
  body.nav-open .nav-backdrop {
    display: block;
    position: fixed;
    inset: var(--topbar-height) 0 0 0;
    background: var(--overlay-bg);
    z-index: 840;
  }

  #main { left: 0; padding: 1rem; }
  #content { max-width: 100%; }
  #content h1 { font-size: 1.5rem; }

  .view-header { flex-wrap: wrap; gap: var(--space-2); }
  .view-actions { flex-wrap: wrap; }
  /* A view's button row (.toolbar) wraps too: the Unregistered Sign-ins
     toolbar (six buttons) ran 80px past a 390px screen. */
  .view-header .toolbar { flex-wrap: wrap; max-width: 100%; }

  /* Wide tables scroll inside their own box instead of dragging the page. */
  .data-table,
  .ev-table,
  .cl-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
  .datatable-container,
  .datatable-scroll-container,
  .datatable-wrap,
  .audit-table-container,
  .realms-table-container,
  .sessions-table-container {
    max-width: 100%;
    overflow-x: auto;
  }

  .realm-detail-pane,
  .site-detail-pane,
  .session-detail-pane,
  .dir-drawer { width: 100vw; max-width: 100vw; }
  .realm-info .info-row,
  .site-info .info-row,
  .session-info .info-row,
  .audit-event-detail .info-row { flex-direction: column; gap: 0.1rem; }
  .realm-info .info-row label,
  .site-info .info-row label,
  .session-info .info-row label,
  .audit-event-detail .info-row label { flex: none; }

  .cl-kv { grid-template-columns: 1fr; }
  .cl-kv > div:nth-child(even) { margin-bottom: var(--space-2); }
  .settings-field { padding: var(--space-2); }
  .settings-password-row { flex-direction: column; }
}

/* ------------------------------------------------------------------ */
/* Schema-driven forms inside a full-screen action modal (New user, New  */
/* group, New role ...). web-ui-base lays `.schema-form` out as a 220px  */
/* section-nav + settings grid (and each field as two equal columns), so */
/* a plain create form was squeezed into the 220px column: label, hint,  */
/* input and error overlapped. In a modal it is one readable column:     */
/* label, then hint, then a full-width control, then the error, with the */
/* actions pinned to the bottom edge. Server/global errors sit just      */
/* above the actions so they are seen where the button was pressed.      */
/* ------------------------------------------------------------------ */
.action-modal-body .schema-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
}
.action-modal-body .schema-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  min-width: 0;
}
.action-modal-body .schema-form-field .field-label,
.action-modal-body .schema-form-field label.field-label {
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-weight: 600;
}
.action-modal-body .schema-form-field .field-required { color: var(--danger); }
.action-modal-body .schema-form-field .field-description,
.action-modal-body .schema-form-field .field-assist {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  margin: 0;
}
.action-modal-body .schema-form-field .field-control { min-width: 0; }
.action-modal-body .schema-form-field input:not([type="checkbox"]):not([type="radio"]),
.action-modal-body .schema-form-field select,
.action-modal-body .schema-form-field textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  font: inherit;
}
.action-modal-body .schema-form-field.field-has-error input,
.action-modal-body .schema-form-field.field-has-error select,
.action-modal-body .schema-form-field.field-has-error textarea { border-color: var(--danger); }
.action-modal-body .schema-form-field .field-error {
  color: var(--danger);
  font-size: var(--font-size-sm);
  min-height: 0;
}
.action-modal-body .schema-form-field .field-error:empty { display: none; }
.action-modal-body .schema-form-field .field-default { display: none; }
.action-modal-body .schema-form-field .field-password-row { display: flex; gap: var(--space-2); }
.action-modal-body .schema-form-field .field-label-inline { display: flex; align-items: center; gap: var(--space-2); }
.action-modal-body .schema-form-error {
  order: 90;
  padding: var(--space-3);
  border: 1px solid var(--danger);
  border-radius: 4px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.action-modal-body .schema-form-error[hidden] { display: none; }
.action-modal-body .schema-form-actions {
  order: 100;
  position: sticky;
  bottom: -2rem;
  z-index: 1;
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin: var(--space-2) calc(-1 * var(--space-2)) 0;
  padding: var(--space-3) var(--space-2);
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border-primary);
}
.action-modal-body .schema-form-actions .btn-primary,
.action-modal-body .schema-form-actions .btn-secondary { min-height: 2.5rem; padding: 0 var(--space-5); }

/* New user: "Create new user" | "Register user from another realm" choice. */
.nu-modes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  max-width: 40rem;
  margin: 0 auto var(--space-5);
  padding: 0;
  border: 0;
}
.nu-modes legend { color: var(--text-secondary); font-size: var(--font-size-sm); padding: 0 0 var(--space-2); }
.nu-mode {
  flex: 1 1 14rem;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
}
.nu-mode:has(input:checked) { border-color: var(--accent-primary); background: var(--bg-tertiary); font-weight: 600; }
.nu-mode:has(input:focus-visible) { outline: 2px solid var(--accent-focus); outline-offset: 2px; }
.nu-pane { max-width: 40rem; margin: 0 auto; }
.action-modal-body .nu-pane .schema-form { max-width: none; }

/* Register user pane. */
.nu-register { display: flex; flex-direction: column; gap: var(--space-4); }
.nu-register .nu-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.nu-register .nu-field > label { font-weight: 600; font-size: var(--font-size-md); }
.nu-register .nu-field input,
.nu-register .nu-field select {
  width: 100%; box-sizing: border-box; min-height: 2.5rem; padding: 0.5rem 0.65rem;
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border-primary); border-radius: 4px; font: inherit;
}
.nu-register .nu-help { color: var(--text-secondary); font-size: var(--font-size-sm); line-height: 1.4; margin: 0; }
.nu-register .nu-error { color: var(--danger); font-size: var(--font-size-sm); margin: 0; }
.nu-register .nu-error:empty { display: none; }
.nu-register .nu-note { padding: var(--space-3); border: 1px solid var(--border-primary); border-radius: 4px; background: var(--bg-tertiary); }
.nu-register .nu-note.warn { border-color: var(--warn); }
.nu-register .nu-note h3 { margin: 0 0 var(--space-2); font-size: var(--font-size-md); }
.nu-register ul { margin: 0; padding-left: 1.25rem; }
.nu-register ol { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: var(--space-1); }
.nu-register .nu-link { display: flex; gap: var(--space-2); }
.nu-register .nu-link input { flex: 1 1 auto; font-family: var(--font-mono); }
.nu-found { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-primary); border-radius: 4px; max-height: 14rem; overflow-y: auto; }
.nu-found:empty { display: none; }
.nu-found .nu-help { display: block; padding: 0.5rem 0.65rem; }
.nu-found li { margin: 0; }
.nu-found button {
  width: 100%; text-align: left; min-height: 2.5rem; padding: 0.4rem 0.65rem;
  background: transparent; color: var(--text-primary); border: 0; border-bottom: 1px solid var(--border-secondary); cursor: pointer; font: inherit;
}
.nu-found button:hover, .nu-found button[aria-pressed="true"] { background: var(--bg-tertiary); }
.nu-register .nu-actions {
  position: sticky; bottom: -2rem; z-index: 1;
  display: flex; gap: var(--space-3); justify-content: flex-end;
  margin: var(--space-2) calc(-1 * var(--space-2)) 0; padding: var(--space-3) var(--space-2);
  background: var(--sidebar-bg); border-top: 1px solid var(--border-primary);
}
@media (max-width: 600px) {
  .action-modal-body .schema-form-actions,
  .nu-register .nu-actions { bottom: -1.5rem; }
  .action-modal-body .schema-form-actions .btn-primary,
  .action-modal-body .schema-form-actions .btn-secondary,
  .nu-register .nu-actions .btn { flex: 1 1 auto; }
}

/* Phone width (375-390 px): toggle + brand + user-name block + badge + Logoff added up to ~395 px and the body clips overflow, so Logoff
   was cut off. The badge already shows the name: drop the duplicate block, let the brand and the badge shrink, keep Logoff whole. */
@media (max-width: 480px) {
  #topbar .user-details { display: none; }
  #topbar .user-info { min-width: 0; }
  #topbar .user-info edy-user-badge { min-width: 0; max-width: 100%; }
  #topbar .btn-logoff { flex: 0 0 auto; padding: 0.5rem 0.75rem; }
  .nav-brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  #sidebar { transition: none !important; }
}

/* ------------------------------------------------------------------ */
/* <edy-user-badge> in the top bar (index.html #console-badge)         */
/* Themed through its --eub-* custom properties from the dark tokens.  */
/* ------------------------------------------------------------------ */
#topbar edy-user-badge {
  --eub-bg: var(--bg-secondary);
  --eub-fg: var(--text-primary);
  --eub-muted: var(--text-secondary);
  --eub-accent: var(--accent-primary);
  --eub-accent-fg: var(--text-on-accent, #fff);
  --eub-border: var(--border-primary);
  --eub-surface: var(--bg-tertiary);
  --eub-danger: var(--status-error);
  --eub-ok: var(--status-success);
  --eub-radius: var(--radius-lg);
}

/* The badge's account modal is position:fixed inside the top bar's stacking
   context (z-index 100, below the sidebar and the drawers): lift the bar while
   the modal is open (js/console-badge.js watchBadgeModal). */
#topbar.badge-modal-open { z-index: 2000; }

/* Site ACL tab (views/realm-tabs/site-acl-tab.js): matched-rule highlight, drop-down multi-selects, chips, segmented effect. */
/* B91: the rules table is wider than the slide-over; the Id column must not wrap one character per line (the Columns button and the horizontal scroll stay) */
.siteacl-table-host table.datatable { min-width: 58rem; }
.siteacl-table-host table.datatable th:first-child, .siteacl-table-host table.datatable td:first-child { white-space: nowrap; min-width: 9rem; }
.siteacl-table-host table.datatable td:nth-child(4), .siteacl-table-host table.datatable td:nth-child(7) { min-width: 10rem; }
tr.siteacl-matched > td { background: var(--bg-tertiary); box-shadow: inset 0 2px 0 var(--accent-primary), inset 0 -2px 0 var(--accent-primary); }
.siteacl-dd { display: inline-block; max-width: 100%; border: 1px solid var(--border-primary); border-radius: var(--radius-md); padding: 0.25rem 0.5rem; }
.siteacl-dd > summary { cursor: pointer; }
.siteacl-opts { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; padding-top: 0.5rem; }
.siteacl-opt input { width: auto; margin-right: 0.25rem; }
.siteacl-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.25rem 0; }
.siteacl-seg { display: inline-flex; gap: 1rem; }
.siteacl-seg input { width: auto; margin-right: 0.25rem; }
.siteacl-pathbtns { display: block; margin: 0.25rem 0; }
.siteacl-label { display: block; font-weight: 600; }
.siteacl-form .field-error:empty { display: none; }

.siteacl-subtabs { display: flex; gap: 0.25rem; margin: 0.5rem 0; }
.siteacl-obs-path { display: inline-flex; align-items: center; gap: 0.25rem; }
.siteacl-obs-path .btn-icon { padding: 0 0.4rem; min-width: 1.75rem; }
.siteacl-pager { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0; }
.siteacl-from-node { margin: 0.25rem 0; }

/* Headers tab (views/realm-tabs/headers-*.js): banners, settings grid, live checks, previews. */
.hdrpol-banner { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-left: 4px solid var(--border-primary); background: var(--bg-tertiary); border-radius: var(--radius-md); }
.hdrpol-banner.warning { border-left-color: var(--warn, #b7791f); }
.hdrpol-banner.danger { border-left-color: var(--danger, #c53030); }
.hdrpol-banner.info { border-left-color: var(--accent-primary); }
.hdrpol-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 0.5rem 1.5rem; }
.hdrpol-seg { flex-wrap: wrap; }
.hdrpol-live { display: block; font-size: 0.85em; color: var(--text-secondary); }
.hdrpol-live.error, .hdrpol-prot.error { color: var(--danger, #c53030); }
.hdrpol-suggest { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.25rem 0; }
.hdrpol-form .field-error:empty { display: none; }
.hdrpol-form input[type="text"], .hdrpol-form textarea, .hdrpol-form select { max-width: 100%; }
.hdrpol-consequence { border-left: 4px solid var(--danger, #c53030); padding: 0.25rem 0.75rem; background: var(--bg-tertiary); }
.hdrpol-prev-table { border-collapse: collapse; margin: 0.5rem 0; max-width: 100%; display: block; overflow-x: auto; }
.hdrpol-prev-table th, .hdrpol-prev-table td { border: 1px solid var(--border-primary); padding: 0.2rem 0.5rem; text-align: left; vertical-align: top; }
.hdrpol-json { max-height: 14rem; overflow: auto; background: var(--bg-tertiary); padding: 0.5rem; }
.hdrpol-preview-frame { width: 100%; height: 16rem; border: 1px solid var(--border-primary); background: #fff; }
.hdrpol-warn { margin: 0.25rem 0; }
.hdrpol-tester textarea { width: 100%; font-family: monospace; }
@media (max-width: 640px) { .hdrpol-settings-grid { grid-template-columns: 1fr; } }
.realm-headers-tab .form-help { display: block; }
.realm-headers-tab .field-error:empty { display: none; }
.realm-headers-tab .hdrpol-setting .siteacl-seg { display: flex; }

/* Page integration tab (views/realm-tabs/pageint-*.js): status strip, badge form mock viewport, sandboxed preview frame, variable list. Shares the hdrpol-* form look. */
.realm-pageint-tab .form-help { display: block; }
.realm-pageint-tab .field-error:empty { display: none; }
.pgint-settings-box { margin: 0.5rem 0; }
.pgint-vars { display: grid; gap: 0.25rem; }
.pgint-vars label { display: block; }
.pgint-form [hidden] { display: none !important; }
.pgint-mock { position: relative; width: 240px; max-width: 100%; height: 140px; border: 1px solid var(--border-primary); border-radius: var(--radius-md); background: var(--bg-tertiary); overflow: hidden; }
.pgint-mock-dot { position: absolute; top: 4px; right: 4px; width: 28px; height: 10px; border-radius: 999px; background: var(--accent-primary); }
.pgint-preview-box, .pgint-preview-summary { margin: 0.5rem 0; }
.pgint-preview-summary { font-size: 0.9em; color: var(--text-secondary); }
.pgint-frame { display: block; width: 100%; height: 18rem; max-width: 100%; border: 1px solid var(--border-primary); background: #fff; }
.pgint-html-out pre { max-height: 14rem; overflow: auto; white-space: pre-wrap; }
.pgint-form textarea, .pgint-preview-form textarea { width: 100%; max-width: 100%; font-family: monospace; }
.pgint-form input[type="number"] { width: 7rem; }
@media (max-width: 640px) { .pgint-frame { height: 14rem; } .pgint-form input[type="number"] { width: 5.5rem; } }

/* Proxy tab (views/realm-tabs/proxy-tab.js): chips, the enrol wizard, listeners and diff tables. Colours come from the theme variables (dark mode follows them). */
.proxy-chip { margin-right: 0.25rem; }
.proxy-todo { background: var(--warn, #b7791f); color: var(--bg-primary, #fff); padding: 0 0.25rem; border-radius: var(--radius-sm, 3px); font-weight: 600; }
.proxy-pre { margin: 0.25rem 0; padding: 0.5rem 0.75rem; background: var(--bg-tertiary); border: 1px solid var(--border-primary); border-radius: var(--radius-md); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.proxy-wait { margin: 0.75rem 0; padding: 0.5rem 0.75rem; border-left: 4px solid var(--accent-primary); background: var(--bg-tertiary); border-radius: var(--radius-md); }
.proxy-wait.ok { border-left-color: var(--success, #2f855a); }
.proxy-listeners, .proxy-certs, .proxy-diff { width: 100%; border-collapse: collapse; }
.proxy-listeners th, .proxy-listeners td, .proxy-certs th, .proxy-certs td, .proxy-diff th, .proxy-diff td { text-align: left; padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--border-primary); vertical-align: top; }
.proxy-names { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.25rem; }
.proxy-confirm { z-index: 3000; }
.proxy-form input[type="text"], .proxy-form select, .proxy-form textarea { max-width: 100%; }
@media (max-width: 40rem) { .proxy-form input[type="text"], .proxy-form textarea { width: 100%; box-sizing: border-box; } .proxy-pre { font-size: 0.8rem; } }

/* B96: per-field settings help (components/SettingHelp.js) */
.setting-help { margin: 4px 0 8px; }
.setting-summary { margin: 0 0 2px; color: var(--text-secondary, inherit); font-size: 0.9em; }
.setting-current { display: inline-block; margin-right: 8px; font-size: 0.85em; }
.setting-source { margin-left: 4px; text-transform: none; }
.setting-more > summary { cursor: pointer; font-size: 0.85em; color: var(--link-color, #2563eb); width: max-content; }
.setting-more[open] > summary { margin-bottom: 4px; }
.setting-more-body { border-left: 3px solid var(--border-color, #d0d5dd); padding: 2px 0 2px 10px; font-size: 0.9em; max-width: 72ch; }
.setting-more-body dl { margin: 0; }
.setting-more-body dt { font-weight: 600; margin-top: 6px; }
.setting-more-body dd { margin: 0; overflow-wrap: anywhere; }
.setting-facts { margin: 0 0 4px; font-size: 0.85em; }
.setting-reset { margin-left: 4px; font-size: 0.85em; }
.setting-reference { list-style: none; margin: 0; padding: 0; }
.setting-reference > li { border-bottom: 1px solid var(--border-color, #e4e7ec); padding: 6px 0; }
.setting-ref-head { overflow-wrap: anywhere; }
.tab-settings-help { margin: 12px 0 0; }
.tab-settings-help > details > summary { cursor: pointer; font-weight: 600; }
@media (max-width: 600px) { .setting-more-body { max-width: none; } }
/* B96: the Session security panel carries two forms now (network / browser checks, idle timeout / kiosk): one column, each group full width, so a phone shows them under each other */
.realm-session-security .dir-inline-form { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 14px; }
.realm-session-security .dir-inline-form .form-group { width: 100%; }
.realm-session-security .dir-inline-form select, .realm-session-security .dir-inline-form input[type="number"] { max-width: 100%; }
.realm-session-security .dir-inline-form > button { align-self: flex-start; }
.sec-inline { display: block; margin: 4px 0; }
