/* ================================================================
   COMPONENTS.CSS — canonical shared components (issue #1211)

   The one place the app's reusable visual components are defined:
   heading scale, data tables, badges/pills/chips, buttons, filter
   chips + bars, dropdown menus, selects, modals, toasts, and the
   decrypt-text treatment. Every value comes from tokens.css.

   Conventions:
   - New markup uses the `lx-` classes.
   - Legacy class names (`.leg-table`, `.badge-pending`, `.event-tag`,
     …) are converged here as grouped selectors on the SAME canonical
     declarations, so existing markup keeps working while their
     per-template <style> copies are deleted.
   - Review surface: /admin/styleguide renders every variant.
   ================================================================ */

/* ================================================================
   1. TYPE SCALE — the single h1–h6 definition (was quintuplicated
      across base/stride/home/celex/isotope).
   ================================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ss-font-primary);
    font-weight: var(--lx-heading-weight);
    letter-spacing: var(--lx-heading-tracking);
    line-height: 1.3em;
    color: var(--ss-dark);
}

h1 { font-size: var(--lx-h1); }
h2 { font-size: var(--lx-h2); }
h3 { font-size: var(--lx-h3); }
h4 { font-size: var(--lx-h4); }
h5 { font-size: var(--lx-h5); }
h6 { font-size: var(--lx-h6); }

/* Display h1 — landing/hero pages (the home "Lex-Ray" treatment: bigger,
   one weight lighter, tighter leading; usually white on the coral hero).
   Application pages keep the plain h1 above (legislation-title scale;
   base.css's .heading-title is that same tier). ss-main's
   .hero--home h1.large carries these exact values for the homepage. */
.lx-h1--display {
    font-size: var(--lx-h1-display-sm);
    font-weight: var(--lx-display-weight);
    line-height: 1.05;
}

@media (min-width: 768px) {
    .lx-h1--display { font-size: var(--lx-h1-display); }
}

/* Section label — the recurring small uppercase-grey label treatment */
.lx-label {
    font-family: var(--ss-font-primary);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--lx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ================================================================
   2. DATA TABLES — one canonical table (replaces .leg-table ×3,
      .marginalia-table ×3, .members/.groups/.api-keys/.visitors/
      .param/.rc/.ps-table …). Default look: uppercase-grey header,
      hairline rows, row hover.
   ================================================================ */

.lx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.lx-table th {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 2px solid var(--lx-border);
    font-family: var(--ss-font-primary);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--lx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lx-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--lx-surface-inset);
    vertical-align: middle;
}

.lx-table tbody tr:hover {
    background-color: var(--lx-surface-muted);
}

/* Variants */
.lx-table--compact th,
.lx-table--compact td { padding: 0.3rem 0.5rem; }
.lx-table--compact { font-size: 0.85rem; }

.lx-table--bordered th,
.lx-table--bordered td { border: 1px solid var(--lx-border); }

.lx-table--striped tbody tr:nth-child(odd) { background-color: var(--lx-surface-muted); }

.lx-table--plain th {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.875rem;
}

.lx-table--static tbody tr:hover { background-color: transparent; }

/* Numeric cells — right-aligned tabular numerals */
.lx-table .lx-num,
.lx-table .count,
.leg-table .count,
.visitors-table .count {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Legacy table families converge on the canonical look. Their markup
   keeps the old class (JS hooks like .closest('.marginalia-table')
   still work); the visuals now come from here. */
.leg-table,
.visitors-table,
.marginalia-table,
.members-table,
.groups-table,
.api-keys-table,
.param-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.leg-table th,
.visitors-table th,
.marginalia-table th,
.members-table th,
.groups-table th,
.api-keys-table th,
.param-table th {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 2px solid var(--lx-border);
    font-family: var(--ss-font-primary);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--lx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.leg-table td,
.visitors-table td,
.marginalia-table td,
.members-table td,
.groups-table td,
.api-keys-table td,
.param-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--lx-surface-inset);
    vertical-align: middle;
}

.leg-table tbody tr:hover,
.visitors-table tbody tr:hover {
    background-color: var(--lx-surface-muted);
}

.param-table td code { font-size: 0.8rem; }

/* Bootstrap .table on admin surfaces: give thead th the canonical
   uppercase-grey header without touching cell borders/stripes. */
.table > thead > tr > th {
    font-family: var(--ss-font-primary);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--lx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* DataTables fixed-header fix — was copy-pasted into admin.html,
   edit_stride.html, stride_approvals.html, tasks.html. */
table.dataTable.fixedHeader-floating thead th,
table.dataTable.fixedHeader-locked thead th {
    background: var(--lx-surface) !important;
    border-bottom: 2px solid var(--lx-border);
}

/* ================================================================
   3. BADGES / PILLS / CHIPS

   Typography for ALL badges (#716): Bootstrap .badge gets the mono
   treatment here (moved from base.css); the .lx-badge base carries
   the same tokens for standalone chips.
   ================================================================ */

.badge {
    font-family: var(--badge-font);
    font-weight: var(--badge-font-weight);
}

/* --- Canonical chip base --- */
.lx-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.22em 0.6em;
    font-family: var(--badge-font);
    font-weight: var(--badge-font-weight);
    font-size: 0.78em;
    line-height: 1.4;
    border-radius: var(--lx-radius-sm);
    white-space: nowrap;
    background-color: var(--lx-neutral-bg);
    color: var(--lx-neutral-fg);
    border: 1px solid transparent;
}

/* Shape + size modifiers */
.lx-badge--pill { border-radius: var(--lx-radius-pill); }
.lx-badge--sm { font-size: 0.7em; padding: 0.15em 0.5em; }
.lx-badge--lg { font-size: 0.9em; padding: 0.3em 0.75em; }
.lx-badge--caps { text-transform: uppercase; letter-spacing: 0.03em; }

/* Subtle (tinted) semantic variants — bg/fg/border trios from tokens */
.lx-badge--success { background-color: var(--lx-success-bg); color: var(--lx-success-fg); border-color: var(--lx-success-border); }
.lx-badge--warning { background-color: var(--lx-warning-bg); color: var(--lx-warning-fg); border-color: var(--lx-warning-border); }
.lx-badge--danger  { background-color: var(--lx-danger-bg);  color: var(--lx-danger-fg);  border-color: var(--lx-danger-border); }
.lx-badge--info    { background-color: var(--lx-info-bg);    color: var(--lx-info-fg);    border-color: var(--lx-info-border); }
.lx-badge--neutral { background-color: var(--lx-neutral-bg); color: var(--lx-neutral-fg); border-color: var(--lx-neutral-border); }
.lx-badge--brand   { background-color: var(--lx-brand-bg);   color: var(--lx-brand-fg);   border-color: var(--lx-brand-border); }
.lx-badge--accent  { background-color: var(--lx-accent-bg);  color: var(--lx-accent-fg);  border-color: var(--lx-accent-border); }

/* Outline (ghost) modifier — the "similar but different" sibling: same
   hue as its tinted counterpart, no fill. Use for the related-but-distinct
   state of the SAME thing (inherited vs direct, proposed vs applied,
   draft vs confirmed); stack AFTER a semantic variant, and pair with a
   trailing icon inside the badge to say why it differs. */
.lx-badge--outline { background-color: transparent; }

/* A small annotation icon INSIDE a badge (trailing, right-hand side):
   slightly smaller + dimmed so it reads as an annotation, not content.
   Explicit class — a blanket `.role-badge i` would also restyle LEADING
   content icons (the steward badge's shield). .lx-badge is inline-flex
   with a gap; .role-badge (users page) needs the margin. */
.lx-note-icon {
    font-size: 0.85em;
    opacity: 0.75;
}

.role-badge .lx-note-icon {
    margin-left: 0.3em;
}

/* Solid semantic variants */
.lx-badge--solid-success { background-color: var(--lx-success-solid); color: #fff; }
.lx-badge--solid-warning { background-color: var(--lx-warning-solid); color: #111; }
.lx-badge--solid-danger  { background-color: var(--lx-danger-solid);  color: #fff; }
.lx-badge--solid-neutral { background-color: var(--lx-text-muted);    color: #fff; }
.lx-badge--solid-blue    { background-color: var(--lx-blue-solid);    color: #fff; }
.lx-badge--solid-brand   { background-color: var(--lx-brand);         color: #fff; }
.lx-badge--solid-purple  { background-color: var(--lx-purple-solid);  color: #fff; }

/* Status dot (the .nt-cpill pattern) */
.lx-badge--dot::before {
    content: '';
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    background-color: currentColor;
    flex-shrink: 0;
}

/* Numeric counter pill */
.lx-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5em;
    height: 1.5em;
    padding: 0 0.4em;
    border-radius: var(--lx-radius-pill);
    font-family: var(--badge-font);
    font-weight: 600;
    font-size: 0.72em;
    background-color: var(--lx-blue-solid);
    color: #fff;
}

/* --- Environment badges (TEST / BETA etc., moved from base.css) --- */
.env-badge {
    background-color: var(--lx-warning-solid);
    color: #1a1205;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
    padding: 0.25em 0.55em;
    border-radius: var(--lx-radius-sm);
}

.env-badges {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
}

.env-corner-badges {
    position: fixed;
    bottom: 12px;
    right: 12px;
    /* Below every Bootstrap 5 overlay layer (offcanvas-backdrop 1040 …
       toast 1090) so focused overlays cover this indicator. */
    z-index: 1039;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    pointer-events: none;
}

.env-corner-badge {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* --- Legacy status badges converge on the canonical palette ---
   (were solid Bootstrap hexes re-typed in stride_approvals.html,
   tasks.html, edit_stride.html; geometry via Bootstrap .badge) */
.badge-pending,
.rag-badge-amber { background-color: var(--lx-warning-solid); color: #111; }

.badge-approved,
.badge-completed,
.rag-badge-green { background-color: var(--lx-success-solid); color: #fff; }

.badge-rejected,
.badge-overdue,
.rag-badge-red { background-color: var(--lx-danger-solid); color: #fff; }

.badge-blocked,
.badge-secondary { background-color: var(--lx-text-muted); color: #fff; }

/* Group-membership badges (were group_detail.html + _groups_styles.html).
   Rendered as bare <span class="badge-admin"> (no Bootstrap .badge), so the
   shared defs carry geometry + typography as well as colour. */
.badge-admin,
.badge-member,
.badge-invited,
.badge-hidden,
.badge-own {
    display: inline-block;
    padding: 0.2em 0.55em;
    border-radius: var(--lx-radius-sm);
    font-family: var(--badge-font);
    font-weight: var(--badge-font-weight);
    font-size: 0.75rem;
}

.badge-admin   { background-color: var(--lx-blue-solid); color: #fff; }
.badge-member  { background-color: var(--lx-text-muted); color: #fff; }
.badge-invited { background-color: var(--lx-warning-solid); color: #111; }
.badge-hidden  { background-color: var(--lx-danger-solid); color: #fff; }
.badge-own     { background-color: var(--lx-success-solid); color: #fff; }

/* Manual-definition marker (was manual_definitions_modal.html) */
.badge-manual { background-color: var(--lx-purple-solid); color: #fff; font-size: 0.75rem; }

/* --- Event/activity tags (were byte-identical in user_activity.html
   and visitor_journey.html) --- */
.event-tag {
    display: inline-block;
    padding: 0.15em 0.5em;
    background-color: var(--lx-surface-inset);
    color: #374151;
    border-radius: var(--lx-radius-xs);
    font-family: var(--badge-font);
    font-size: 0.78rem;
    font-weight: var(--badge-font-weight);
}

.event-tag.filter-add    { background-color: var(--lx-success-bg); color: var(--lx-success-fg); }
.event-tag.filter-remove { background-color: var(--lx-danger-bg);  color: var(--lx-danger-fg); }
.event-tag.filter-group  { background-color: var(--lx-info-bg);    color: var(--lx-info-fg); }
.event-tag.regulation    { background-color: var(--lx-accent-bg);  color: var(--lx-accent-fg); }
.event-tag.path          { background-color: var(--lx-warning-bg); color: var(--lx-warning-fg); }
.event-tag.view-mode     { background-color: var(--lx-neutral-bg); color: var(--lx-neutral-fg); }

/* --- Steward/person chips (were duplicated in stride_stewards.html
   and tasks.html) --- */
.steward-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.15em 0.6em;
    border-radius: var(--lx-radius-pill);
    font-size: 0.8rem;
    background-color: var(--lx-info-bg);
    color: var(--lx-info-fg);
    border: 1px solid var(--lx-info-border);
}

.steward-chip.draft {
    background-color: var(--lx-warning-bg);
    color: var(--lx-warning-fg);
    border: 1px dashed var(--lx-warning-border);
}

.steward-chip .chip-email {
    color: var(--lx-text-muted);
    font-size: 0.75rem;
}

/* ================================================================
   4. BUTTONS
   ================================================================ */

/* Bootstrap re-skins (moved from base.css) */
.btn-primary {
    background-color: var(--lx-brand);
    border-color: var(--lx-brand);
    color: var(--color-neutral-white);
    font-family: var(--ss-font-primary);
    font-weight: 400;
    transition: all var(--ss-transition-fast);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--lx-brand-strong);
    border-color: var(--lx-brand-strong);
    color: var(--color-neutral-white);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Secondary: neutral outline on light surfaces (the old white-outline
   skin assumed a dark background; that variant is scoped below). */
.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--lx-border-strong);
    color: var(--ss-dark);
    font-family: var(--ss-font-primary);
    font-weight: 400;
    transition: all var(--ss-transition-fast);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--lx-surface-inset);
    border-color: var(--lx-border-strong);
    color: var(--ss-dark);
}

/* On-dark secondary (header/hero): the original white-outline look. */
.header .btn-secondary,
.btn-secondary--on-dark {
    background-color: transparent;
    border: 1px solid var(--color-neutral-white);
    color: var(--color-neutral-white);
}

.header .btn-secondary:hover,
.header .btn-secondary:focus,
.btn-secondary--on-dark:hover,
.btn-secondary--on-dark:focus {
    background-color: var(--color-neutral-white);
    border-color: var(--color-neutral-white);
    color: var(--ss-dark);
}

/* Buttons pick up the house sans + calm weight app-wide */
.btn {
    font-family: var(--ss-font-primary);
}

/* Outline info/warning re-skins — Bootstrap's stock light cyan/yellow are
   near-invisible as icon-only buttons on a white row. Recoloured from the
   badge tone tokens (dark fg for text/border; hover fills with the soft bg),
   so the semantic vocabulary stays usable at action-button size. */
.btn-outline-info {
    color: var(--lx-info-fg);
    border-color: var(--lx-info-fg);
}

.btn-outline-info:hover,
.btn-outline-info:focus,
.btn-outline-info:active,
.btn-outline-info.active,
.btn-check:checked + .btn-outline-info {
    background-color: var(--lx-info-bg);
    border-color: var(--lx-info-fg);
    color: var(--lx-info-fg);
}

.btn-outline-warning {
    color: var(--lx-warning-fg);
    border-color: var(--lx-warning-fg);
}

.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-warning:active,
.btn-outline-warning.active,
.btn-check:checked + .btn-outline-warning {
    background-color: var(--lx-warning-bg);
    border-color: var(--lx-warning-fg);
    color: var(--lx-warning-fg);
}

/* --- The filter `.button` system — SINGLE canonical definition
   (was defined 5 ways across stride.css / isotope.css / home.css /
   base.css / stride_sidebar.css; this is the coral app skin). --- */
.button {
    display: inline-block;
    padding: 0.5em 1em;
    border-radius: var(--lx-radius-sm);
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--ss-light-gray);
    color: var(--ss-dark);
    cursor: pointer;
    font-family: var(--ss-font-primary);
    font-size: 0.95rem;
    transition: all var(--ss-transition-fast);
}

.button:hover {
    background-color: var(--color-neutral-white);
    border-color: var(--lx-brand);
    color: var(--lx-brand);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(var(--color-coral-base-rgb), 0.2);
}

.button:active,
.button.is-checked {
    background-color: var(--lx-brand);
    border-color: var(--lx-brand);
    color: var(--color-neutral-white);
}

.button.is-checked {
    box-shadow: 0 2px 6px rgba(var(--color-coral-base-rgb), 0.3);
}

.button:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 10px;
}

/* --- Row-action icon buttons (blessed recipe, #1368) ---
   The actions cell of a table row: <td class="lx-actions"> holding
   `btn btn-sm btn-outline-<semantic>` buttons, each icon-only with a
   title + aria-label. The cell handles nowrap/sizing/spacing so the
   markup needs no mb-0/ms-1/min-width utilities (was per-page CSS in
   home/admin.html + the users panel). Demo: /admin/styleguide §5. */
.lx-actions {
    white-space: nowrap;
}

.lx-actions .btn {
    min-width: 30px;
    min-height: 30px;
    padding: 0.25rem 0.45rem;
    line-height: 1;
    margin-bottom: 0;
}

.lx-actions .btn i {
    font-size: 0.75rem;
}

.lx-actions .btn + .btn {
    margin-left: 0.25rem;
}

/* Person-chip inline actions (steward manager / country allocator, was
   page-local in stride_stewards.html): solid square micro-buttons that
   sit to the RIGHT of a .steward-chip and act on that person (confirm /
   remove). Deliberately smaller than .lx-actions row actions and solid —
   they belong to the chip, not the table row. */
.steward-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 5px;
    font-size: 0.72rem;
    line-height: 1;
    flex: 0 0 auto;
}

/* ================================================================
   5. FILTERS / CHIPS
   ================================================================ */

/* Single definition (was stride.css / home.css / stride_sidebar.css) */
.filter-section {
    margin-bottom: 1rem;
}

/* Toggleable filter chip — the dim/active opacity pattern (formalised
   from admin/ai_discovery.html's .filter-pill; stack on .badge or
   .lx-badge for colour/geometry). */
.lx-chip,
.filter-pill {
    cursor: pointer;
    user-select: none;
    opacity: 0.45;
    transition: opacity 0.15s ease;
}

.lx-chip:hover,
.filter-pill:hover { opacity: 0.75; }

.lx-chip.active,
.filter-pill.active { opacity: 1; font-weight: 600; }

/* Filter bar — label + controls row above a table/grid */
.lx-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.lx-filter-bar label {
    font-family: var(--ss-font-primary);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--lx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}

/* ================================================================
   6. DROPDOWN MENUS — light token skin over Bootstrap (the dark
      header menu keeps its scoped skin in base.css).
   ================================================================ */

.dropdown-menu {
    font-family: var(--ss-font-primary);
    font-size: 0.9rem;
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
    box-shadow: var(--lx-shadow-md);
}

.dropdown-item {
    transition: background-color var(--ss-transition-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--lx-surface-inset);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--lx-brand);
    color: var(--color-neutral-white);
}

/* Table-header filter dropdown (the .filter-dd pattern from
   stride_stewards.html + tasks.html — defined once here). */
.filter-dd .dropdown-toggle {
    font-size: 0.75rem;
    padding: 2px 6px;
}

.filter-dd-menu {
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.85rem;
}

/* ================================================================
   7. SELECTS / FORM CONTROLS — house font + coral focus ring for
      every .form-select / .form-control (86 selects had no skin).
   ================================================================ */

.form-select,
.form-control {
    font-family: var(--ss-font-primary);
}

.form-select:focus,
.form-control:focus {
    border-color: var(--color-coral-200);
    box-shadow: 0 0 0 0.25rem rgba(var(--color-coral-base-rgb), 0.2);
}

.form-check-input:checked {
    background-color: var(--lx-brand);
    border-color: var(--lx-brand);
}

.form-check-input:focus {
    border-color: var(--color-coral-200);
    box-shadow: 0 0 0 0.25rem rgba(var(--color-coral-base-rgb), 0.2);
}

/* ================================================================
   8. MODALS — branding moved from base.css; utility-modal extras
      stay in stride_modal_utils.css (issue #906 owns the deeper
      modal consolidation).
   ================================================================ */

.modal-content {
    border-radius: var(--lx-radius-md);
    border: none;
    box-shadow: var(--lx-shadow-lg);
}

.modal-header {
    background-color: var(--lx-surface-muted);
    border-bottom: 2px solid var(--lx-brand);
}

.modal-title {
    font-family: var(--ss-font-primary);
    font-weight: 300;
    color: var(--ss-dark);
}

.modal-header.bg-dark .modal-title,
.modal-header.bg-dark h1,
.modal-header.bg-dark h2,
.modal-header.bg-dark h3,
.modal-header.bg-dark h4,
.modal-header.bg-dark h5,
.modal-header.bg-dark h6 {
    color: #fff;
}

.modal-body {
    font-family: var(--ss-font-serif);
    color: var(--ss-dark);
}

.modal-body a {
    color: var(--lx-brand);
}

.modal-body a:hover {
    color: var(--lx-brand-strong);
}

/* Modal surfaces are always light: a Cancel/secondary button must never
   arrive white-on-white from an ancestor on-dark scope (.header, hero
   sections) or a legacy white-outline skin — the invisible-Cancel bug.
   Scoped to .modal-content and later in the cascade, this pins the
   light-surface skin no matter where the modal markup lives in the DOM. */
.modal-content .btn-secondary,
.modal-content .btn-outline-secondary {
    background-color: transparent;
    border-color: var(--lx-border-strong);
    color: var(--ss-dark);
}

.modal-content .btn-secondary:hover,
.modal-content .btn-secondary:focus,
.modal-content .btn-outline-secondary:hover,
.modal-content .btn-outline-secondary:focus {
    background-color: var(--lx-surface-inset);
    border-color: var(--lx-border-strong);
    color: var(--ss-dark);
}

/* ================================================================
   9. TOASTS + ALERTS
   ================================================================ */

.toast {
    background-color: var(--lx-surface);
    border-radius: var(--lx-radius-sm);
    box-shadow: var(--lx-shadow-lg);
}

.alert {
    font-family: var(--ss-font-primary);
    border-radius: var(--lx-radius-md);
}

/* ================================================================
   10. DECRYPT TEXT — the scramble/reveal treatment (pairs with
       decrypt_text.js). One class instead of literal JetBrains
       stacks in header_text_macros / stride modals / home features.
   ================================================================ */

.lx-decrypt {
    font-family: var(--font-stack-mono);
    font-weight: 500;
    letter-spacing: 0.02em;
    font-variant-ligatures: none;
}

/* ================================================================
   11. TABLE FILTER WIDGETS (issue #1368) — the two multi-select
       filter chromes, built by table_utils.js (createMultiSelect /
       buildFilterDropdown). Previously duplicated per page
       (users panel ⇄ ai_discovery; stride_stewards ⇄ tasks).
       Demo: /admin/styleguide §5.
   ================================================================ */

/* --- Header-cell checkbox dropdown (.multi-select) --- */
.multi-select {
    position: relative;
    width: 100%;
}

.multi-select-toggle {
    width: 100%;
    font-size: 0.8rem;
    padding: 3px 20px 3px 6px;
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-sm);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 6px center;
    color: #374151;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-toggle:hover {
    border-color: var(--lx-border-strong);
}

.multi-select-toggle.has-selection {
    background-color: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--lx-surface);
    border: 1px solid var(--lx-border-strong);
    border-radius: var(--lx-radius-sm);
    box-shadow: var(--lx-shadow-md);
    max-height: 240px;
    overflow-y: auto;
    margin-top: 2px;
    min-width: 160px;
}

.multi-select-dropdown.show {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    gap: 6px;
}

.multi-select-option:hover {
    background: var(--lx-surface-muted);
}

.multi-select-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.multi-select-option label {
    cursor: pointer;
    margin: 0;
    flex: 1;
}

/* --- Toolbar Bootstrap dropdown variant (.filter-dd) --- */
.filter-dd-menu .form-check {
    margin: 0;
    padding: 0.25rem 0.5rem 0.25rem 1.9rem;
    white-space: nowrap;
    border-radius: 0.3rem;
    cursor: pointer;
}

.filter-dd-menu .form-check:hover {
    background: var(--lx-surface-muted);
}

.filter-dd-menu .form-check-label {
    cursor: pointer;
}

.filter-dd-actions {
    display: flex;
    justify-content: space-between;
    padding: 0.15rem 0.4rem 0.35rem;
    border-bottom: 1px solid var(--lx-surface-inset);
    margin-bottom: 0.2rem;
}

.filter-dd-actions button {
    font-size: 0.75rem;
    padding: 0 0.25rem;
}

/* ================================================================
   12. CODE BLOCKS (#1368) — the copyable code panel used by setup
       pages and modals (profile MCP setup, /docs cards, hydration
       preview). Was three hand-rolled variants (.config-code-block /
       .docs-card pre + .copy-btn / .preview-json); one recipe:

         <div class="lx-code-block">
             <button type="button" class="lx-code-copy" title="Copy to clipboard"
                     aria-label="Copy to clipboard"><i class="bi bi-clipboard"></i></button>
             <pre>…</pre>
         </div>

       Modifiers: --light (light panel for in-page previews),
       --scroll (cap height, scroll long output). Copy wiring is the
       delegated code_copy.js (icon swap + .copied, no per-page JS).
       Demo: /admin/styleguide.
   ================================================================ */
.lx-code-block {
    display: flex;
    flex-direction: row-reverse;   /* copy button docks top-right */
    align-items: flex-start;
    background: #1e1e1e;
    border-radius: var(--lx-radius-md);
    margin: 0.75rem 0;
}

.lx-code-block pre {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 1rem;
    background: transparent;
    border: none;
    color: #d4d4d4;
    font-family: var(--font-stack-mono);
    font-size: 0.8rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.lx-code-block--scroll pre {
    max-height: 300px;
    overflow-y: auto;
}

.lx-code-copy {
    flex-shrink: 0;
    margin: 0.5rem 0.5rem 0 0;
    padding: 0.25rem 0.55rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--lx-radius-sm);
    color: #999;
    cursor: pointer;
    transition: all var(--ss-transition-fast);
}

.lx-code-copy:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.lx-code-copy.copied,
.lx-code-copy.copied:hover {
    color: #4ade80;
}

/* Light variant — in-page previews on a light surface (hydration). */
.lx-code-block--light {
    background: var(--lx-surface-inset);
    border: 1px solid var(--lx-border);
}

.lx-code-block--light pre {
    color: var(--ss-dark);
}

.lx-code-block--light .lx-code-copy {
    background: rgba(0, 0, 0, 0.05);
    color: var(--lx-text-muted);
}

.lx-code-block--light .lx-code-copy:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--ss-dark);
}

.lx-code-block--light .lx-code-copy.copied,
.lx-code-block--light .lx-code-copy.copied:hover {
    color: var(--lx-success-fg);
}

/* ================================================================
   13. PEOPLE (#1368) — THE person row: avatar (photo or initials)
       + name link + role/department + optional external profile.
       Rendered ONLY by the `person()` macro (includes/people_macros.html)
       — the legacy .contact-* markup was fully migrated to it, so no
       alias selectors. Compact pill form: .steward-chip (§3).
       Demo: /admin/styleguide §6.
   ================================================================ */
.lx-person {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.4em;
    font-size: inherit;
}

.lx-person:last-child {
    margin-bottom: 0;
}

.lx-person__avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.lx-person__avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--lx-text-muted);
    color: #fff;
    font-size: 0.6em;
    font-weight: 600;
}

.lx-person__info {
    display: flex;
    align-items: baseline;
    gap: 0.4em;
    flex-wrap: wrap;
    min-width: 0;
}

.lx-person__name {
    font-weight: 600;
    text-decoration: none;
}

a.lx-person__name:hover {
    text-decoration: underline;
}

.lx-person__role {
    opacity: 0.7;
    font-size: 0.9em;
}

.lx-person__ext {
    opacity: 0.4;
    font-size: 0.85em;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.lx-person__ext:hover {
    opacity: 0.8;
}

/* Big variant — 40px avatar, name stacked over role. For card footers /
   profile-ish contexts where the person IS the content; the default
   (small) row is for dense lists. */
.lx-person--lg {
    gap: 0.65em;
}

.lx-person--lg .lx-person__avatar {
    width: 40px;
    height: 40px;
}

.lx-person--lg .lx-person__avatar--initials {
    font-size: 0.85em;
}

.lx-person--lg .lx-person__info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1.35;
}

.lx-person--lg .lx-person__name {
    font-size: 1.02em;
}

/* ================================================================
   14. INFO POPOVER — the hoverable "i" icon carrying a titled help
       panel with key/description rows. Ported from Semantic
       Studio's ss-info-icon / ss-tooltip-panel (semantic_studio.css)
       as the shared affordance for inline, non-editable explanations
       (first consumer: the tier explainer on /admin/permissions
       posture cards). Pure CSS: shows on hover and :focus-within.
       Affordance is the ringed-i chip + hover lift — never the
       question-mark cursor (banned; see docs/design_system.md).
       Demo: /admin/styleguide.
   ================================================================ */

.lx-info-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.lx-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid var(--lx-border-strong);
    border-radius: 999px;
    background: var(--lx-surface);
    color: var(--color-neutral-500);
    font-family: var(--ss-font-primary);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    user-select: none;
    padding: 0;
}

.lx-info-wrap:hover .lx-info-icon,
.lx-info-wrap:focus-within .lx-info-icon {
    border-color: var(--lx-brand);
    color: var(--lx-brand);
}

.lx-info-icon:focus-visible {
    outline: 2px solid var(--lx-brand);
    outline-offset: 1px;
}

.lx-info-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1060; /* above card stacking contexts + modals' backdrop */
    width: 420px;
    max-width: min(420px, 70vw);
    padding: 10px 12px;
    border: 1px solid var(--lx-border-strong);
    border-radius: var(--lx-radius-md);
    background: var(--lx-surface);
    box-shadow: var(--lx-shadow-md);
    color: var(--ss-dark);
    font-family: var(--ss-font-primary);
    text-align: left;
    /* The trigger may sit inside nowrap/muted small text; the panel
       must wrap and size its own type regardless. */
    white-space: normal;
    font-size: 12px;
    line-height: 1.4;
}

.lx-info-wrap:hover .lx-info-panel,
.lx-info-wrap:focus-within .lx-info-panel {
    display: block;
}

.lx-info-panel strong {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--ss-dark);
}

.lx-info-intro {
    display: block;
    margin-bottom: 8px;
    color: var(--color-neutral-500);
}

.lx-info-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px;
    margin-top: 6px;
}

.lx-info-key {
    font-family: var(--font-stack-mono);
    font-weight: 600;
    color: var(--ss-dark);
}

.lx-info-text {
    color: var(--color-neutral-500);
}
