/* ================================================================
   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; }

/* Identifier / short-value columns (names, types, tiers, flags): never wrap and
   shrink to their content, so the remaining column takes the spare width and is
   the only one that wraps. Put it on the <th> and the <td>s of such a column.
   Wrap the table in .table-responsive where a long value could still overrun
   on a phone. Demo: /admin/styleguide §5 (tables), "Fit columns". */
.lx-table .lx-fit {
    white-space: nowrap;
    width: 1%;
}

/* 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;
    /* Block padding shifted by --badge-optical-shift so the caps sit in the
       optical middle, not high (tokens.css). */
    padding: calc(0.22em + var(--badge-optical-shift)) 0.6em calc(0.22em - var(--badge-optical-shift));
    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: calc(0.15em + var(--badge-optical-shift)) 0.5em calc(0.15em - var(--badge-optical-shift));
}
.lx-badge--lg {
    font-size: 0.9em;
    padding: calc(0.3em + var(--badge-optical-shift)) 0.75em calc(0.3em - var(--badge-optical-shift));
}
.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: '';
    /* A filled disc reads larger than stroked capitals of the same height, so
       0.66em sits optically level with the face's 0.73em cap height. Flex
       centring puts it on the line box's middle; the shift moves it to the
       cap-height midline (tokens.css --badge-optical-shift). */
    width: 0.66em;
    height: 0.66em;
    border-radius: 50%;
    background-color: currentColor;
    flex-shrink: 0;
    transform: translateY(calc(-1 * var(--badge-optical-shift)));
}

/* 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;
}

/* --- 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);
}

/* Disabled keeps the house skin (Bootstrap's :disabled rules outrank the
   single-class skins above and would flash stock blue/grey — seen on the
   terms-gate preview's inert buttons, #1481) — but must still READ as
   disabled: Bootstrap's .65 opacity + a not-allowed cursor, so an inert
   button (e.g. the clickwrap confirm before its checkbox is ticked) never
   looks clickable. */
.btn-primary:disabled,
.btn-primary.disabled {
    background-color: var(--lx-brand);
    border-color: var(--lx-brand);
    color: var(--color-neutral-white);
    opacity: 0.65;
    cursor: not-allowed;
}

/* 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);
}

.btn-secondary:disabled,
.btn-secondary.disabled {
    background-color: transparent;
    border-color: var(--lx-border-strong);
    color: var(--ss-dark);
    opacity: 0.65;
    cursor: not-allowed;
}

/* 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);
}

/* `.ps-btn` — the admin-tool action button (Proposal Studio screens). One
   definition: the screens each carried a copy with padding that ignored the
   line box, so a button sat shorter than the input beside it. Fixed height
   rhythm comes from the spacing scale; `.subtle` is the outlined secondary,
   `.danger` a destructive solid, `.danger-text` a quiet destructive outline. */
.ps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.5rem;
    padding: var(--space-2) var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--lx-radius-sm);
    background: var(--lx-blue-solid);
    color: var(--lx-on-brand);
    font-family: var(--ss-font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    transition: background-color var(--ss-transition-fast), border-color var(--ss-transition-fast);
}
.ps-btn:hover,
.ps-btn:focus-visible { filter: brightness(1.1); }
.ps-btn.subtle {
    background: var(--lx-surface);
    color: var(--lx-blue-solid);
    border-color: var(--lx-border-strong);
}
.ps-btn.subtle:hover,
.ps-btn.subtle:focus-visible { background: var(--lx-surface-muted); filter: none; }
.ps-btn.danger { background: var(--lx-danger-solid); }
.ps-btn.danger-text { color: var(--lx-danger-fg); }
.ps-btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }

/* 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 pill chips (#1280 / #1286 / #1909) ------------------------------
   A REMOVABLE FILTER: label + '×', clustered into (a or b) and (c or d) by the
   connector pills below. It reads one query — the reader's omni bar (#1286) and
   the Handbook browse bar's facet selection (#1909) are the same statement about
   what has been narrowed to, so they are the same pill. Moved here from
   celex_ui.css when the second consumer arrived: that sheet is the reader's
   chrome and the browse page does not load it, so a copy in browse.css was the
   only alternative — which is the fork #1462 exists to prevent.

   Rendered by `celex_omni_chips.js`; live specimen at /admin/styleguide §15.

   Amber is `--lx-warning-*` where the token is byte-identical to what the pill
   already used. The ink (#856404) and the cluster's border/wash are left as
   literals deliberately: `--lx-warning-fg` is #664d03, a different, darker ink,
   and swapping it would restyle the reader's bar under cover of a shared move.
   The connector's greys have no role-correct token at these values at all. */
.omni-chips {
    display: none;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    max-width: 60%;
    overflow: hidden;
}

.omni-chips--active {
    display: flex;
}

.omni-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    /* Vertical rhythm matches the canonical chip base (.lx-badge, §3 above):
       unitless line-height + symmetric em padding centres the
       glyph line-box reliably, where the old fixed line-height:18px + 1px padding
       let the text sit off-centre. L>R padding keeps room for the remove button.
       Central fix — every omni bar (reader + logic overlay) inherits it. */
    padding: 0.2em 0.4em 0.2em 0.6em;
    border: 1px solid var(--lx-warning-solid);
    border-radius: 10px;
    background: var(--lx-warning-bg);
    color: #856404;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

/* Boolean connector PILLS between individual value pills (#1286): muted
   neutral chrome, clearly distinct from the removable amber value pills.
   'or' joins values inside a cluster, 'and' joins clusters. Not interactive. */
.omni-chip-conn {
    align-self: center;
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #8a8a8a;
    text-transform: lowercase;
    background: #f1f1f1;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 0 5px;
    line-height: 14px;
    user-select: none;
    white-space: nowrap;
}

/* An OR-group cluster (#1286): one term's comma-list values render as one
   visually bracketed unit — (a or b) and (c or d) reads unambiguously. */
.omni-chip-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 4px;
    border: 1px solid #ffe08a;
    border-radius: 12px;
    background: rgba(255, 243, 205, 0.35);
}

.omni-chip__remove {
    border: none;
    background: transparent;
    color: #856404;
    font-size: 13px;
    line-height: 1;
    padding: 0 3px;
    cursor: pointer;
    border-radius: 50%;
}

.omni-chip__remove:hover {
    background: var(--lx-warning-solid);
    color: #fff;
}

/* 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);
}

/* The nsx correction modal pops with the definition popover's coral skin. */
.nsx-correction-modal .modal-content {
    border: 1px solid rgba(var(--color-coral-base-rgb), 0.68);
    box-shadow: var(--lx-shadow-coral-pop);
}

/* The modal fills the viewport, report view and editor alike: the reader needs the
   text, the card and the form side by side. The body scrolls inside; the header and
   footer stay put. Under 576px it is the full screen, as Bootstrap's own does. */
.modal-dialog.nsx-correction-modal {
    max-width: none;
    width: calc(100vw - 2rem);
    height: calc(100vh - 2rem);
    margin: 1rem auto;
}
.nsx-correction-modal .modal-content { height: 100%; max-height: 100%; }
.nsx-correction-modal .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.nsx-correction-modal .modal-body { min-height: 0; }
@media (max-width: 575.98px) {
    .modal-dialog.nsx-correction-modal {
        width: 100vw;
        height: 100vh;
        margin: 0;
    }
    .nsx-correction-modal .modal-content { border-radius: 0; border-width: 0; }
}

/* Report view: the form across the top, then [the text | the reading] beneath it
   on a wide screen, each of those two scrolling on its own; stacked, under the
   body's one scroll, below lg. Without the context (still loading, or
   unavailable) the form is simply the whole view. */
.nsx-correction-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: minmax(0, 1fr);
}
.nsx-correction-pane.normative-cards {
    margin: 0;
    padding: var(--space-3);
    overflow: hidden auto;
    max-block-size: 38vh; /* stacked: leave the form in reach; lifted in the wide grid below */
    background: var(--lx-surface);
    border-color: var(--lx-border);
}
.nsx-correction-pane[hidden] { display: none; }
.nsx-correction-pane__head {
    margin: 0 0 var(--space-2);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--lx-text-muted);
}
.nsx-correction-text {
    white-space: pre-wrap;
    line-height: 1.6;
    color: var(--text-color);
}
.nsx-correction-cards .ob { margin-bottom: var(--space-2); }
/* A card's head wraps here: the pane is narrower than the reader's column. */
.nsx-correction-cards details.ob > summary { flex-wrap: wrap; }
.nsx-correction-cards .term-badges { flex: 1 1 100%; flex-wrap: wrap; }
.nsx-correction-cards .ob-sum { white-space: normal; flex-basis: 100%; }
.nsx-correction-hint { min-height: 1.5em; }

/* The spans the statement is grounded in, tinted by role family exactly as its pills are. */
.nsx-correction-text mark {
    padding: 0 0.1em;
    border-radius: 2px;
    color: inherit;
    background: var(--lx-warning-bg);
}
.nsx-correction-text mark[data-fam='actor'] { background: color-mix(in srgb, var(--actor-bd) 48%, var(--actor-bg)); }
.nsx-correction-text mark[data-fam='term'] { background: color-mix(in srgb, var(--term-bd) 48%, var(--term-bg)); }
.nsx-correction-text mark[data-fam='time'] { background: color-mix(in srgb, var(--time-bd) 48%, var(--time-bg)); }
.nsx-correction-text mark[data-fam='cond'] { background: color-mix(in srgb, var(--cond-bd) 48%, var(--cond-bg)); }
.nsx-correction-text mark[data-fam='ref'] { background: color-mix(in srgb, var(--ref-bd) 48%, var(--ref-bg)); }
.nsx-correction-text mark[data-fam='exc'] { background: color-mix(in srgb, var(--exc-bd) 48%, var(--exc-bg)); }
.nsx-correction-text mark[data-fam='neg'] { background: color-mix(in srgb, var(--neg-bd) 48%, var(--neg-bg)); }
.nsx-correction-text mark[data-fam='bool'] { background: color-mix(in srgb, var(--bool-bd) 48%, var(--bool-bg)); }
.nsx-correction-text mark[data-fam='penalty'] { background: color-mix(in srgb, var(--penalty-bd) 48%, var(--penalty-bg)); }

@media (min-width: 992px) {
    .nsx-correction-modal .modal-body:has(.nsx-correction-grid--context:not([hidden])) {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    #nsxCorrectionReport:not([hidden]) {
        display: flex;
        flex-direction: column;
        min-height: 0;
        flex: 1 1 auto;
    }
    .nsx-correction-grid--context {
        flex: 1 1 auto;
        min-height: 0;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
    }
    .nsx-correction-grid--context > .nsx-correction-form { grid-column: 1 / -1; }
    .nsx-correction-grid--context > .nsx-correction-pane { max-block-size: none; }
}

/* With the editor open its three panes fill what the modal leaves. */
.nsx-correction-modal--editing .lx-reader-editor__panes {
    block-size: max(24rem, calc(100vh - 14.25rem));
}

/* The logic overlay (#logic-page[data-embedded], z-index 1050) shares Bootstrap's
   backdrop level (1050) and the backdrop is not guaranteed to win; lift it
   just under the modal (1055) while this modal is open so the page dims. */
body:has(#nsxCorrectionModal.show) .modal-backdrop { z-index: 1054; }

.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);
}

/* Why a control that opens the annotate modal did nothing (#4615): "still
   loading", "couldn't load", "sign in again". Positioned by
   edit_modal_access.js just under the control that was clicked, so it is fixed
   (the control can be inside the reader's shadow root) and above the header
   but below Bootstrap's modal, the same 1051 the flash messages use. */
.lx-edit-modal-status {
    position: fixed;
    z-index: 1051;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    max-width: min(360px, calc(100vw - 16px));
    margin: 0;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    box-shadow: var(--lx-shadow-md);
}

.lx-edit-modal-status--centred {
    top: calc(var(--header-height, 80px) + 8px);
    left: 50%;
    transform: translateX(-50%);
}

/* "A new version is available — Reload" (#4764), built by sw-register.js on
   the pages that register the service worker (reader shell, home, STRIDE). An
   update waits for the reader, so this only offers: nothing reloads until the
   Reload button is pressed, and the close button puts it away for this page.
   Bottom centre, fixed, so it covers neither the header nor a page's first row
   and moves nothing when it appears or goes; the same 1051 as the flash
   messages, so an open modal (a draft being written) stays above it. */
.lx-update-prompt {
    position: fixed;
    bottom: var(--space-4, 1rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1051;
    display: flex;
    align-items: center;
    gap: var(--space-3, 0.75rem);
    width: max-content;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    box-shadow: var(--lx-shadow-lg);
}

.lx-update-prompt[hidden] {
    display: none;
}

.lx-update-prompt__text {
    flex: 1 1 auto;
}

.lx-update-prompt__reload {
    flex: 0 0 auto;
}

/* The quiesce notice (sw_admission.js, #4836) wears the update prompt's parts
   but is a RECOVERY, not an offer: the page cannot go on without a reload, and
   it may have a modal open (a draft being written). So it sits on the recovery
   layer, above the modal, where the update prompt stays under it. The script
   moves focus to its Reload button and keeps a modal's focus trap off it. */
.lx-update-prompt.lx-admission-notice {
    z-index: var(--lx-z-recovery);
}

/* ================================================================
   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);
}

/* Copy card (#2596) — PROSE you copy, not code: a light card carrying the
   same .lx-code-copy icon button, docked in its top-right corner. The words
   copied are the card's `data-copy-text`, exactly, so the card can lay its
   words out (a heading, two lines) without the layout reaching the paste.
   Same delegated code_copy.js, same icon swap and failure alert. A card
   that also carries `data-copy-html` (a whole email) copies that HTML, with
   the text as its plain twin.

     <article class="lx-copy-card" data-copy-text="The words to paste.">
         <button type="button" class="lx-code-copy" title="Copy to clipboard"
                 aria-label="Copy to clipboard"><i class="bi bi-clipboard"></i></button>
         …the words, however they are best shown…
     </article>
   Consumer: /share. Demo: /admin/styleguide §22. */
.lx-copy-card {
    position: relative;
    background: var(--lx-surface);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
    box-shadow: var(--lx-shadow-sm);
    /* room on the right so text never runs under the corner button */
    padding: var(--space-4) calc(var(--space-5) + 2rem) var(--space-4) var(--space-5);
}

.lx-copy-card .lx-code-copy {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    margin: 0;
    background: transparent;
    color: var(--lx-text-muted);
}

.lx-copy-card .lx-code-copy:hover,
.lx-copy-card .lx-code-copy:focus-visible {
    background: var(--lx-surface-muted);
    color: var(--ss-dark);
}

.lx-copy-card .lx-code-copy.copied,
.lx-copy-card .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,
.lx-info-wrap[data-open] .lx-info-panel {
    display: block;
}
/* Closed by Escape until the pointer or the focus leaves it (freshness_tick.js). */
.lx-info-wrap[data-dismissed] .lx-info-panel { display: none; }

/* Modifiers: open above the icon, and hang from its right edge (an icon at the end of a bar). */
.lx-info-panel--above { top: auto; bottom: calc(100% + 6px); }
.lx-info-panel--end { left: auto; right: 0; }
/* The gap between icon and panel belongs to the panel, so the pointer can cross it without the
   hover (and the panel) being lost on the way. */
.lx-info-panel::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.lx-info-panel--above::before { top: auto; bottom: -8px; }

.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);
}


/* ================================================================
   15. AI-PROVENANCE BADGE + POPOVER (#1191/#1402/#1567) — the EU AI
       Act 50(4) marking pill rendered by
       includes/ai_provenance_macros.html, and the hover card it opens.
       A pill carrying the twin AI spark, plus a reticle glyph + warmer
       accent when the token is grounded (machine-checked). Glyphs
       inherit currentColor; the text colour IS the accent (the popover
       reads it back via getComputedStyle — CSS is its single home).
       Both halves live here so every surface (notice, homepage,
       styleguide, any live badge) is styled without an extra include —
       the badge moved from ai_transparency/_styles.html in #1191, the
       popover followed in #1567 once it turned out the homepage was
       opening an unstyled one. Demo: /admin/styleguide §18.
   ================================================================ */

.ai-provenance-badge {
    display: inline-flex; align-items: center; gap: .15rem;
    border: 1px solid rgba(var(--color-coral-base-rgb), 0.5); border-radius: 999px;
    padding: .14rem .42rem; line-height: 0;
    color: var(--lx-brand); background: #fff; white-space: nowrap;
    text-decoration: none; vertical-align: middle;
}
.ai-provenance-badge:hover { background: rgba(var(--color-coral-base-rgb), 0.08); text-decoration: none; }
.ai-provenance-badge .ai-prov-spark,
.ai-provenance-badge .ai-prov-glyph { flex: 0 0 auto; }
/* Grounded = a warmer orange, distinct from the base coral, so "machine-checked"
   reads apart from "nothing checked" at a glance. The orange has no coral token
   — it is a deliberate one-off accent. */
.ai-provenance-badge--grounded { color: #e8590c; border-color: rgba(232, 89, 12, 0.5); }
.ai-provenance-badge--grounded:hover { background: rgba(232, 89, 12, 0.08); }
/* Compact icons a touch larger than the original 12/13px for presence; the
   twin spark leads slightly bigger than the qualifier glyph. */
.ai-provenance-badge .ai-prov-glyph { width: 16px; height: 16px; }
.ai-provenance-badge .ai-prov-spark { width: 18px; height: 18px; }
/* Large variant for the badge showcase (and any prominent surface). */
.ai-provenance-badge--lg { padding: .34rem .72rem; gap: .28rem; border-width: 1.5px; }
.ai-provenance-badge--lg .ai-prov-glyph { width: 26px; height: 26px; }
.ai-provenance-badge--lg .ai-prov-spark { width: 29px; height: 29px; }
/* Worded variant — the prominent, labelled pill (icons + visible text). */
.ai-provenance-badge--worded { padding: .3rem .8rem; gap: .42rem; line-height: 1; border-width: 1.5px; }
.ai-provenance-badge--worded .ai-prov-glyph { width: 20px; height: 20px; }
.ai-provenance-badge--worded .ai-prov-spark { width: 22px; height: 22px; }
.ai-prov-word {
    font-family: var(--ss-font-primary, system-ui), -apple-system, 'Segoe UI', sans-serif;
    font-size: .9rem; font-weight: 700; letter-spacing: -.005em;
}

/* The popover the badge opens on hover/focus (ai_provenance_popover.js) —
   a dark card replacing the plain native title= tooltip. It lives HERE, not
   with the notice styles, for the same reason the badge does: the JS binds
   to every .ai-provenance-badge on any page, so CSS shipped only via an
   include leaves the popover unstyled everywhere else. That is exactly what
   happened on the homepage between #1191 and #1567 — the badge moved here
   and the popover was left behind.
   --pc is the accent, set per-token at runtime by the JS from the badge's
   own computed colour; the var() fallback keeps it coral if absent. The
   dark-card greys are one-offs with no token (deliberate, as with the
   grounded orange above). Demo: /admin/styleguide §18 — hover a badge. */
.ai-prov-pop {
    position: fixed; z-index: 1080; display: none; max-width: 300px;
    opacity: 0; transform: translateY(5px); pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
}
.ai-prov-pop.is-show { opacity: 1; transform: none; pointer-events: auto; }
.ai-prov-pop-inner {
    background: #241b1e; border: 1px solid rgba(255,240,235,.16);
    border-radius: 14px; padding: 15px 16px; box-shadow: 0 20px 54px rgba(44,0,2,.5);
}
.ai-prov-pop-title {
    display: flex; align-items: center; gap: 9px; margin-bottom: 8px;
    font-family: var(--ss-font-primary);
    font-weight: 700; font-size: 1rem; line-height: 1.15;
}
.ai-prov-pop-title .pop-ico { display: inline-flex; align-items: center; gap: 3px; color: var(--pc, var(--lx-brand)); flex: 0 0 auto; }
.ai-prov-pop-title .pop-ico svg { width: 22px; height: 22px; }
.ai-prov-pop-title .pop-txt { color: #f4ece9; }
.ai-prov-pop-token {
    display: inline-block; font-family: var(--font-stack-mono);
    font-size: .7rem; letter-spacing: .02em; color: var(--pc, var(--lx-brand));
    background: color-mix(in srgb, var(--pc, var(--lx-brand)) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--pc, var(--lx-brand)) 42%, transparent);
    padding: 2px 8px; border-radius: 6px; margin-bottom: 10px;
}
.ai-prov-pop-desc { margin: 0; font-family: system-ui, sans-serif; font-size: .85rem; line-height: 1.55; color: #cbbcb6; }
.ai-prov-pop-foot {
    margin-top: 10px; font-family: var(--font-stack-mono);
    font-size: .62rem; letter-spacing: .09em; text-transform: uppercase; color: #8a7d78;
}
.ai-prov-pop-arrow {
    position: absolute; bottom: -6px; width: 12px; height: 12px; background: #241b1e;
    border-right: 1px solid rgba(255,240,235,.16); border-bottom: 1px solid rgba(255,240,235,.16);
    transform: translateX(-50%) rotate(45deg);
}
.ai-prov-pop.is-below .ai-prov-pop-arrow {
    bottom: auto; top: -6px; border-right: 0; border-bottom: 0;
    border-left: 1px solid rgba(255,240,235,.16); border-top: 1px solid rgba(255,240,235,.16);
}
/* FCA glossary meaning — our own presentation of the FCA's text. The
   ingestion normaliser (fca_glossary.py normalize_glossary_html) has already
   flattened the FCA portal chrome to level-classed <p>s carrying the ordinary
   `internal-link definition` anchors, so this is just spacing + indent. The
   level classes are global (not scoped to .fca-def-meaning) so they also indent
   inside the hover popover.

   There is deliberately NO defined-term treatment here (#2046). A `.def-ref`
   rule used to draw one — coral plus a `border-bottom: 1px dotted` — which made
   the same defined term look one way inside a definition and another way in the
   text it defines, and did it with a mechanism nothing else in the app uses (a
   border sits at the bottom of the line box rather than on the text baseline,
   and underlines trailing space). A defined term is a defined term: it is drawn
   by `.internal-link.definition` in celex.css, wherever it appears. */
.fca-def-meaning { line-height: 1.5; }
.fca-def-meaning p { margin: .3rem 0; }
.fca-def-l2 { margin-left: 1.25rem; }
.fca-def-l3 { margin-left: 2.5rem; }

/* A defined term, wherever one is rendered — the reader's own text, the FCA
   glossary's definitions, the inside of a popover. Here rather than in celex.css
   for the same reason the popover skin below is: the FCA glossary page extends
   layouts/base.html, which loads this sheet and not celex.css, so a rule left
   there styled the reader's defined terms and silently missed the glossary's
   (#2046). Composes the tokens; states no value of its own. */
.internal-link.definition {
    color: var(--definition-link-color);
    text-decoration: var(--definition-link-decoration);
    text-decoration-style: var(--definition-link-decoration-style);
}

/* Two defined terms that overlap without nesting (#2507) — DORA Art 58's
   "critical ICT third-party service providers established in a third country"
   holds `critical ICT third-party service provider` AND `ICT third-party service
   provider established in a third country`. Anchors cannot overlap, so
   markup_defs links the longer term whole (`.def-overlap`), links the other
   term's own words as a separate anchor (`.def-overlap-part`, "critical"), and
   wraps the words the two share inside the longer anchor
   (`.def-overlap-shared`).

   The reading is carried by two STACKED underlines, one per term. The low line
   is drawn by the longer anchor, so it runs under all of its words; the high
   line is drawn by the part anchor and the shared span, so it runs under the
   other term's words. The shared words carry both. Each decorating box paints
   its own line at its own offset — a child's underline does not replace one it
   inherits — which is what lets one text run carry two.

   Longhands only, never the `text-decoration` shorthand: the shorthand would
   reset the style, and an FCA anchor we identified carries a dotted one
   (`[data-term-source='lexray']` in celex.css) that must survive here too.

   The high line is unbroken because markup_defs puts the space joining the
   two anchors INSIDE the part anchor ("critical "): between the tags it would
   belong to neither element and carry neither line. At a line break that
   space hangs at the line end and is not drawn, so each line keeps only its
   own words' lines. Punctuation between the two stays outside, with the space. */
.internal-link.definition.def-overlap,
.internal-link.definition.def-overlap-part,
.internal-link.definition .def-overlap-shared {
    text-decoration-line: underline;
    text-decoration-color: var(--lx-brand);
    text-decoration-thickness: 1px;
    text-decoration-skip-ink: none;
}
.internal-link.definition.def-overlap {
    text-underline-offset: 0.42em;
}
.internal-link.definition.def-overlap-part,
.internal-link.definition .def-overlap-shared {
    text-underline-offset: 0.14em;
}

/* Definition-term hover popover skin — the canonical term/meaning popover
   (docs/design_system.md §Popovers). Moved here from celex.css so it is
   available app-wide (the legislation floodlight AND the FCA glossary),
   defined once. Consumed via attachDefinitionPopover (definition_popover.js,
   customClass 'celex-definition-popover'). */
/* `.popover.` rather than the bare class: celex.css also carries a
   `.popover { max-width: min(32rem, ...) }`, and at equal specificity (0,1,0)
   the later sheet won — celex.css is linked after components.css on every
   reader page, so this skin's width had never actually applied. Measured live
   on /FCA-COBS: the tip computed 512px, celex.css's value, not the 416px here.
   Doubling the class outranks it without touching the generic rule, which is
   still the right default for a popover carrying no skin. */
.popover.celex-definition-popover {
    max-width: min(26rem, calc(100vw - 1.5rem));
    --bs-popover-bg: #fff;
    --bs-popover-border-color: rgba(var(--color-coral-base-rgb), 0.68);
    --bs-popover-arrow-border: rgba(var(--color-coral-base-rgb), 0.68);
    color: var(--text-color);
    background-color: var(--bs-popover-bg);
    background-image: none;
    border-color: var(--bs-popover-border-color);
    box-shadow: var(--lx-shadow-coral-pop);
}

/* The BODY's font-size does not reach the content, and that is not inheritance
   failing — it is inheritance losing. ss-main.css carries a bare
   `p { font-size: 15px }`, and an element rule beats an inherited value at any
   specificity, because an inherited value has none. A definition's meaning is
   emitted as `<p>`, so every definition popover drew its text at 15px while
   `.popover-body` sat at the 0.8rem (12.8px) this skin asks for — bigger than
   the reader's own prose in places, which is what made the tip look oversized.
   `:where()` keeps the reach at zero specificity so a caller can still style
   its own content, and `inherit` keeps `.popover-body` the single source of
   the size rather than restating it. */
/* The same rule serves every container that OWNS the size of document-derived
   content. `.definition-meaning` (celex.css, 0.9rem) and `.floodlight-section`
   (14px) each pick a deliberately smaller size for secondary content, and each
   was overridden the same way: measured live on /FCA-COBS, `.definition-meaning`
   computed 14.4px while its own `<p>` children computed 15px, so the floodlight
   read LARGER than the panel around it. Listing the containers here keeps one
   statement of the mechanism instead of a `font-size` patch in three sheets.

   Deliberately NOT applied to the body prose containers. Eight containers on
   COBS show a parent/child size mismatch; the other six are 16px -> 15px, which
   is ss-main's `p` rule doing its intended job where nothing else asked for a
   size. Only a container that stated a size has been overridden. */
.celex-definition-popover .popover-body
    :where(p, ul, ol, li, dl, dt, dd, div, span, table, td, th, blockquote),
.definition-meaning
    :where(p, ul, ol, li, dl, dt, dd, div, span, table, td, th, blockquote),
.floodlight-section .definition-item
    :where(p, ul, ol, li, dl, dt, dd, div, span, table, td, th, blockquote) {
    font-size: inherit;
}

/* ...and the REST of the typography, which is the half that kept it looking
   wrong. Neutralising only `font-size` left the wrapper taking ss-main.css's
   DOCUMENT paragraph styling: `p { font-family: Merriweather; font-weight: 300;
   line-height: 1.5 }` plus a bottom margin. Measured on /FCA-PRIN against
   /32016R0679, both at 14px in the same 14px panel: the EU meaning rendered
   ff-real-text-pro / 400 / 19.6px because it is BARE INLINE TEXT with no block
   to style, while the FCA one rendered Merriweather / 300 / 21px because it is
   wrapped.

   The wrapper is deliberate and stays: `normalize_glossary_html` emits
   `<p class="fca-def-lN">` per limb because an FCA definition is multi-limb and
   nested where an EU definition is one sentence. So the wrapper is made
   TRANSPARENT rather than removed.

   The lists are near-identical by hand, NOT shared — `font-weight` omits `dt`
   and `th` for the semantic reason below, so a single list could not express
   this. An earlier version of this comment claimed they "cannot drift"; they
   are three hand-maintained lists and they can. Change one, check the others.
   Today `p` is the only element ss-main or Bootstrap gives typography to —
   verified: ul/ol/li/dl/dt/dd/blockquote/td/th have none — so the wider list is
   insurance against formatting that does not exist yet rather than a fix for
   anything live. It costs nothing and removes the trap of a future `li` rule
   landing on the half of the problem that was never covered.

   `font-weight` is deliberately NOT inherited on `th`, and no inline element
   appears in the list at all: `th` is bold by UA default and `strong`/`b`/`em`
   carry meaning in the source text. Flattening those would destroy emphasis the
   act itself states — the same reasoning that keeps document headings out of
   these rules. */
.celex-definition-popover .popover-body
    :where(p, ul, ol, li, dl, dt, dd, div, blockquote, table, td, th),
.definition-meaning
    :where(p, ul, ol, li, dl, dt, dd, div, blockquote, table, td, th) {
    font-family: inherit;
    line-height: inherit;
    margin-block: 0;
}

/* `dt` and `th` are BOTH excluded here and both included above. Bootstrap sets
   `dt { font-weight: 700 }` and `th` is bold by UA default, and in each case the
   weight is semantic — a definition-list term and a table header are marked as
   such by being bold. Family and leading are presentation and get inherited;
   weight is not, for these two.

   `dt` was missed on the first pass: the "no typography rules" check ran over
   ss-main for every element but over Bootstrap for `ul`/`ol`/`li` only, so
   Bootstrap's `dt` rule slipped through and definition-list terms were being
   flattened to 400. Found by an independent review. */
.celex-definition-popover .popover-body
    :where(p, ul, ol, li, dl, dd, div, blockquote, table, td),
.definition-meaning
    :where(p, ul, ol, li, dl, dd, div, blockquote, table, td) {
    font-weight: inherit;
}

/* Limbs still need to read as separate limbs, so restore spacing BETWEEN
   siblings only — a single-limb meaning gets none, which is what the EU side
   looks like. Covers lists too, for the formatting that may come later. */
.celex-definition-popover .popover-body :where(p, ul, ol, blockquote) + :where(p, ul, ol, blockquote),
.definition-meaning :where(p, ul, ol, blockquote) + :where(p, ul, ol, blockquote) {
    margin-block-start: 0.5em;
}

/* The panel's own text blocks — its empty states ("No related articles found.")
   sit directly in `.floodlight-section` and were 15px against a 14px panel.
   TEXT BLOCKS ONLY here, deliberately: the wider list above is safe inside
   `.definition-item`, where div/span come from the source document, but at
   section level `span.section-close-icon` is chrome that asks for 16px and
   `inherit` would flatten it to 14px. Verified it still computes 16px. */
.floodlight-section > :where(p, ul, ol, li, dl, dt, dd, blockquote) {
    font-size: inherit;
}

/* The panel's HEADINGS, which are the loud part. `celex_floodlight.js` emits
   bare `<h4>` and `<h5>` with no class (lines ~292, ~318, ~1021), so they took
   the DOCUMENT heading scale — `--lx-h4` 1.25rem and `--lx-h5` 1.1rem against
   a 16px root — inside a 14px sidebar. Measured live on /FCA-COBS: "Introduction"
   computed 20px and "Marginalia" / "Definitions" 17.6px, in a panel whose own
   text is 14px. They had never been sized for this context; nothing in the CSS
   estate targets a floodlight heading at all.

   These are the one case the `:where()` rules above deliberately leave alone —
   a heading inside document content SHOULD keep the document scale, and
   flattening it to `inherit` would erase the hierarchy the act itself states.
   The floodlight is different: it is chrome, not the document, and its headings
   label panels rather than divide legislation.

   Sized against the panel rather than the page: the card title stays a step
   above the body it introduces, and the section labels sit level with it,
   carrying weight rather than size. Deliberately NOT --lx-h4/h5 — those are the
   document's ladder, and reusing them here is what produced the bug. */
#floodlight-column :where(h1, h2, h3, h4) {
    font-size: 1rem;
    line-height: 1.3;
}

#floodlight-column :where(h5, h6) {
    font-size: 0.9375rem;
    line-height: 1.3;
}
.celex-definition-popover .popover-body {
    padding: 0.65rem 0.8rem;
    line-height: 1.45;
    text-wrap: pretty;
    overflow-wrap: break-word;
    /* Let a tall meaning grow to most of the viewport before it ever scrolls.
       A meaning too tall to fit above/below the term makes Popper flip it to
       the side (fallbackPlacements), where it has the full height to use; only
       a meaning taller than 90vh even there scrolls inside the popover. */
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.celex-definition-popover .fca-context-intro {
    color: var(--ss-text-muted, #59636e);
    font-size: .8rem;
    font-weight: 600;
    margin: 0 0 .45rem;
}
.celex-definition-popover .fca-context-label {
    color: var(--ss-text-muted, #59636e);
    font-size: .74rem;
    font-weight: 600;
    margin-bottom: .3rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.celex-definition-popover .fca-context-group + .fca-context-group {
    border-top: 1px solid var(--lx-border, #d8dce0);
    margin-top: .7rem;
    padding-top: .65rem;
}
.celex-definition-popover .fca-context-count {
    background: #edf1f4;
    border-radius: 999px;
    color: #435063;
    font-size: .68rem;
    padding: .05rem .4rem;
}
.celex-definition-popover .fca-context-list {
    list-style: none;
    display: grid;
    gap: .4rem;
    margin: 0;
    padding: 0;
}
.celex-definition-popover .fca-context-item {
    background: #f8fafb;
    border: 1px solid #e3e8ec;
    border-left: 2px solid rgba(var(--color-coral-base-rgb), .7);
    border-radius: .4rem;
    padding: .4rem .55rem;
}
.celex-definition-popover .fca-context-item-bar {
    display: flex;
    align-items: start;
    gap: .35rem;
    min-height: 1.25rem;
    margin-bottom: .2rem;
}
.celex-definition-popover .fca-context-number {
    color: #4b5563;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.5;
}
.celex-definition-popover .fca-context-receipt {
    flex: 1;
    min-width: 0;
    text-align: right;
}
.celex-definition-popover .fca-context-receipt summary {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    list-style: none;
    border: 1px solid #cdd7df;
    border-radius: 999px;
    background: #fff;
    color: #435063;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.3;
    padding: .12rem .45rem;
}
.celex-definition-popover .fca-context-receipt summary::-webkit-details-marker {
    display: none;
}
.celex-definition-popover .fca-context-receipt summary:hover,
.celex-definition-popover .fca-context-receipt summary:focus-visible {
    border-color: rgba(var(--color-coral-base-rgb), .8);
    background: #fff2f2;
    color: #743441;
}
.celex-definition-popover .fca-context-receipt-body {
    margin-top: .35rem;
    padding: .4rem .5rem;
    border-radius: .3rem;
    background: #eef3f6;
    color: #344256;
    font-size: .72rem;
    line-height: 1.4;
    text-align: left;
}
.celex-definition-popover .fca-context-receipt-body p + p {
    margin-top: .3rem;
}
.celex-definition-popover .fca-context-citation {
    margin-top: .4rem;
    line-height: 1.55;
}
.celex-definition-popover .fca-context-citation .remote-citation {
    margin-left: 0;
}
.celex-definition-popover .fca-context-citation .remote-receipt {
    display: block;
    margin-top: .2rem;
    color: #59636e;
    font-size: .72rem;
}
.celex-definition-popover .fca-context-citation-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem;
}
.celex-definition-popover .fca-context-citation-kind {
    color: #59636e;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.celex-definition-popover .fca-context-citation-title {
    color: var(--ss-dark);
    font-family: var(--ss-font-primary);
    font-size: .8rem;
    font-weight: 600;
}
.celex-definition-popover .fca-context-citation-title a {
    color: inherit;
    text-decoration: underline dotted;
    text-underline-offset: .15em;
}
.celex-definition-popover .fca-context-citation-title a:hover {
    color: var(--lx-brand-strong);
}
.celex-definition-popover .fca-context-citation-why {
    margin: .2rem 0 0;
    color: #59636e;
    font-size: .72rem;
}
.celex-definition-popover .fca-context-citation-text {
    margin: .3rem 0 0;
    padding: .2rem 0 .2rem .6rem;
    border-left: 3px solid var(--lx-neutral-border);
}
.celex-definition-popover .fca-context-handbook p {
    color: #59636e;
    font-size: .73rem;
    font-weight: 600;
    margin-bottom: .45rem;
}
.celex-definition-popover .fca-context-other-group + .fca-context-other-group {
    margin-top: .6rem;
}
.celex-definition-popover .fca-context-other-label {
    color: #59636e;
    font-size: .72rem;
    font-weight: 600;
    margin-bottom: .25rem;
}
.celex-definition-popover .fca-context-elsewhere {
    border-top: 1px solid var(--lx-border, #d8dce0);
    margin-top: .55rem;
    padding-top: .4rem;
}
.celex-definition-popover .fca-context-elsewhere summary {
    cursor: pointer;
    font-size: .78rem;
    font-weight: 600;
}
.celex-definition-popover.bs-popover-top,
.celex-definition-popover.bs-popover-auto[data-popper-placement^='top'] {
    margin-bottom: 0.35rem;
}
@media (max-width: 768px) {
    /* Doubled class to MATCH the desktop rule's (0,2,0). A media query adds no
       specificity, so while this stayed `.celex-definition-popover` (0,1,0) the
       desktop `.popover.celex-definition-popover` outranked it and mobile got
       416px where it asks for the viewport width — a regression introduced by
       the desktop fix above and caught by an independent review. */
    .popover.celex-definition-popover {
        max-width: calc(100vw - 1rem);
    }
}

/* Seam note — the popover half of issue #1905. The coral interpunct in the
   body text marks that two defined terms touch; it does not explain itself,
   because a hoverable glyph a couple of pixels wide is a worse affordance than
   none. The explanation lives here instead: a reader who meets the unfamiliar
   mark hovers the term beside it (which they were going to do anyway) and the
   note names the whole run. Appended by celex_popover_delegate.js at hover
   time, so it needs no re-enrichment. Never the whole popover — see #1507. */
.def-seam-note {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--lx-border);
    font-size: 0.86em;
}
.def-seam-note__lead {
    color: var(--lx-text-muted);
}
.def-seam-note__run {
    margin-top: 0.15rem;
}
/* The separator between the run's terms is the same interpunct the body text
   uses, so the note reads as an expansion of the mark rather than a new
   vocabulary. Generated, for the same reason it is generated in the text. */
.def-seam-note__term + .def-seam-note__term::before {
    content: '·';
    color: var(--lx-brand);
    font-weight: 700;
    margin: 0 0.35em;
}

/* Overlap note — the popover half of issue #2507. The stacked underlines in
   the body text show which words belong to which term; they cannot say what the
   other term IS. Hovering either half appends this: the partner's defined term
   and its meaning, so both definitions are one hover away. Appended by
   celex_popover_delegate.js at hover time, never the whole popover (#1507). */
.def-overlap-note {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--lx-border);
    font-size: 0.86em;
}
.def-overlap-note__lead {
    color: var(--lx-text-muted);
}
.def-overlap-note__partner + .def-overlap-note__partner {
    margin-top: 0.4rem;
}
.def-overlap-note__term {
    margin-top: 0.15rem;
    font-weight: 600;
    color: var(--definition-link-color);
}

/* Both definitions, equally — the popover over the words two overlapping terms
   share (#2507). The text holds both terms there and does not say which the
   reader means, so neither is the meaning with the other as a note: both get
   the same block at the same size, in reading order, under one muted lead. */
.def-overlap-both__lead {
    margin-bottom: 0.5rem;
    font-size: 0.86em;
    color: var(--lx-text-muted);
}
.def-overlap-both__entry + .def-overlap-both__entry {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--lx-border);
}
.def-overlap-both__term {
    margin-bottom: 0.15rem;
    font-weight: 600;
    color: var(--definition-link-color);
}

/* Inert / gated enrichment (issue #642).
   A defined-term or cross-reference that is highlighted but neutralised for
   logged-out / free viewers: the visual cue that it IS enriched is kept, but it
   is no longer a live control — the paid interaction (popover / link) is removed
   server-side (apps/utils/inert_enrichment.py) and carries data-gated so the
   email wall (#643) can arm on it. Purely presentational; the gate is the HTML. */
.internal-link.gated,
a.internal-link.gated {
    text-decoration: none;
    /* Pointer events stay enabled (the CSS default) ON PURPOSE: a gated anchor
       must still receive the click/hover that arms the email wall (#643).
       pointer-events:none would silently disable that, so it is NOT set here. */
}
/* Cursor depends on whether the anchor still navigates. INERT anchors have had
   their href removed (dead — no click target), so show the default arrow. A
   LOCK anchor keeps its href (it still navigates internally, just no hover
   peek), so it must NOT look disabled — it keeps the normal link pointer. */
.internal-link.gated:not([href]),
a.internal-link.gated:not([href]) {
    cursor: default;
}
.internal-link.gated:hover,
.internal-link.gated:focus {
    text-decoration: none;
}

/* Shared "view-as" top banner (impersonation #1119 + preview-tier #1458).
   ONE fixed, full-width bar that RESERVES its own height so it never overlaps
   the header/nav. The layout + the body/header offset live here, single-sourced;
   each banner supplies only its own colour (a `--<name>` modifier, kept inline in
   the banner partial so no brand literal lands in this sheet). Applied whenever
   any top banner is active via `body.has-topbanner`. */
.lx-topbanner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    line-height: 1.3;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.lx-topbanner__icon { font-size: 1.15rem; flex: 0 0 auto; }
.lx-topbanner__text { flex: 1 1 auto; }
.lx-topbanner__exit { margin: 0; flex: 0 0 auto; }
.lx-topbanner__btn {
    border-radius: 4px;
    padding: 0.3rem 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
/* Reserve room for the fixed bar so page content and the fixed .header (which
   sits at top:0) are never hidden. Scoped to an active banner, so normal
   browsing is untouched. `--lx-topbanner-count` is the number of stacked bars
   (1 normally; 2 when impersonation AND preview-tier are both active), so the
   reserved height always matches what is actually on screen. */
body {
    /* Vertical space the fixed banner stack occupies: 0 normally, its real
       height once a banner is active. Anything positioned against the top of
       the VIEWPORT rather than against the padded body has to add this back —
       `.flash-messages` sits in the header band, which this moves. */
    --lx-topbanner-reserved: 0px;
}
body.has-topbanner {
    --lx-topbanner-height: 2.6rem;
    --lx-topbanner-count: 1;
    --lx-topbanner-reserved: calc(var(--lx-topbanner-height) * var(--lx-topbanner-count));
    padding-top: var(--lx-topbanner-reserved);
}
body.has-topbanner .header {
    top: var(--lx-topbanner-reserved);
}
/* Both banners active: stack them instead of overlapping. The impersonation bar
   stays at top:0; the preview bar drops below it and the body reserves both. */
body.has-topbanner-2 { --lx-topbanner-count: 2; }
body.has-topbanner-2 .lx-topbanner--preview {
    top: var(--lx-topbanner-height);
    z-index: 1999; /* just under impersonation (2000) so its shadow layers cleanly */
}
@media (max-width: 600px) {
    .lx-topbanner { flex-wrap: wrap; gap: 0.4rem 0.75rem; }
    body.has-topbanner { --lx-topbanner-height: 4.6rem; }
}

/* ================================================================
   QUOTED LEGISLATION (.lx-quote)
   ----------------------------------------------------------------
   The canonical way to show statutory text verbatim inside our own
   chrome — a commencement clause beside its resolved scope, the
   sentence a definition was read from, the provision a finding cites.

   It is deliberately NOT `.rte blockquote` (the vendor pull-quote:
   centred, oversized, decorative opening mark). That styling is for
   marketing emphasis; this is evidence a lawyer reads against, so it
   stays left-aligned, serif, at body size, with a rule marking where
   the act's words start and ours stop.

   Structure — cite is optional but strongly encouraged; a quote whose
   source you cannot see is not a receipt:

     <blockquote class="lx-quote">
       <p>Chapters I and II shall apply from 2 February 2025;</p>
       <cite class="lx-quote__cite">Article 113(a)</cite>
     </blockquote>

   Modifiers: --compact (dense lists), --inset (on an already-tinted
   surface, drops its own fill), --flagged (this quote is why something
   needs attention).
   ================================================================ */
.lx-quote {
    margin: 0 0 var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid var(--lx-border-strong);
    border-radius: 0 var(--lx-radius-sm) var(--lx-radius-sm) 0;
    background: var(--lx-surface-inset);
    font-family: var(--ss-font-serif);
    color: var(--text-color);
    quotes: none;
}
.lx-quote::before,
.lx-quote::after { content: none; }
.lx-quote > p { margin: 0 0 var(--space-2); }
.lx-quote > p:last-child { margin-bottom: 0; }
.lx-quote__cite {
    display: block;
    margin-top: var(--space-2);
    font-family: var(--ss-font-primary);
    font-size: 0.8rem;
    font-style: normal;
    color: var(--lx-text-muted);
}
.lx-quote__cite::before { content: '— '; }

.lx-quote--compact {
    padding: var(--space-2) var(--space-3);
    font-size: 0.92rem;
}
.lx-quote--inset { background: none; }
.lx-quote--flagged { border-left-color: var(--lx-warning-border); }

/* ================================================================
   FUTURE CHANGE CARD (.lx-change-card) — issue #2672
   ----------------------------------------------------------------
   What the reader sees on hovering words a regulator has already MADE
   a change to for a date not yet reached: a status band naming the
   provision, a timeline of the dates it takes effect and the
   instruments behind each, and the changed words as a redline. Built
   by reader_changes.js (madePopoverContent) and opened through
   attachDefinitionPopover with customClass 'lx-change-tip'.
   Demo: /admin/styleguide §21.

   Every rule is written two classes deep ON PURPOSE. The definition
   skin above flattens `font-size`, `font-family`, `line-height` and
   `margin-block` on every p/div/span/ol/li in a popover body at
   (0,2,0) — right for a pasted meaning, and it is what erased the
   spacing, the pill sizes and the quote margins of this card's first
   version. At (0,2,0) and later in the sheet, these win back only the
   card's own parts.

   Greyscale-safe, as §27 asks: the status is a glyph and a word, the
   removed side is struck through and signed '−', the added side is
   signed '+' and labelled with its date. Hue is the last channel, not
   the only one.
   ================================================================ */
.popover.celex-definition-popover.lx-change-tip {
    max-width: min(34rem, calc(100vw - 1.5rem));
}
.celex-definition-popover.lx-change-tip .popover-body {
    padding: 0;
    border-radius: inherit;
}
/* The status band runs to the tip's top edge, so an arrow pointing up into it takes
   the band's fill instead of cutting a white notch through it. */
.lx-change-tip.bs-popover-bottom > .popover-arrow::after,
.lx-change-tip.bs-popover-auto[data-popper-placement^='bottom'] > .popover-arrow::after {
    border-bottom-color: var(--lx-warning-bg);
}
@media (max-width: 768px) {
    .popover.celex-definition-popover.lx-change-tip {
        max-width: calc(100vw - 1rem);
    }
}

.lx-change-card {
    font-family: var(--ss-font-primary);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-color);
}

/* --- the status band: what this is, and where ------------------- */
.lx-change-card .lx-change-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--lx-warning-bg);
    border-bottom: 1px solid var(--lx-warning-border);
    border-radius: var(--lx-radius-sm) var(--lx-radius-sm) 0 0;
    color: var(--lx-warning-fg);
}
.lx-change-card .lx-change-card__status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.lx-change-card .lx-change-card__glyph {
    flex: 0 0 auto;
    width: 0.62em;
    height: 0.62em;
    border: 1.5px solid currentColor;
    border-radius: var(--lx-radius-pill);
}
.lx-change-card .lx-change-card__provision {
    padding: 0.15em 0.55em;
    font-family: var(--font-stack-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ss-dark);
    background: var(--lx-surface);
    border: 1px solid var(--lx-warning-border);
    border-radius: var(--lx-radius-sm);
    min-width: 0;
    overflow-wrap: anywhere;
}

/* --- sections ---------------------------------------------------- */
.lx-change-card .lx-change-card__section {
    padding: var(--space-3) var(--space-4);
}
.lx-change-card .lx-change-card__section + .lx-change-card__section {
    border-top: 1px solid var(--lx-border);
}
.lx-change-card .lx-change-card__heading {
    margin-bottom: var(--space-2);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--lx-text-muted);
}

/* --- the timeline: one event per date ---------------------------- */
.lx-change-card .lx-change-card__timeline {
    margin: 0;
    padding: 0;
    list-style: none;
}
.lx-change-card .lx-change-card__event {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    padding-left: var(--space-5);
}
.lx-change-card .lx-change-card__event + .lx-change-card__event {
    margin-top: var(--space-2);
}
/* The node: a ring, not a filled dot — the change is made but has not happened. */
.lx-change-card .lx-change-card__event::before {
    content: '';
    position: absolute;
    left: 0.15rem;
    top: 0.45rem;
    width: 0.6rem;
    height: 0.6rem;
    border: 2px solid var(--lx-warning-solid);
    border-radius: var(--lx-radius-pill);
    background: var(--lx-surface);
}
/* The spine joining one date to the next. */
.lx-change-card .lx-change-card__event:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(0.45rem - 1px);
    top: 1.05rem;
    bottom: calc(-1 * var(--space-2) - 0.45rem);
    border-left: 2px dotted var(--lx-warning-border);
}
:is(.lx-change-card, .lx-change-ledger, .lx-future-insertion, .lx-future-removal__note) .lx-change-card__date {
    padding: 0.15em 0.6em;
    font-family: var(--font-stack-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ss-dark);
    background: var(--lx-surface-muted);
    border: 1px solid var(--lx-border-strong);
    border-radius: var(--lx-radius-pill);
    white-space: nowrap;
}
:is(.lx-change-card, .lx-change-ledger, .lx-future-insertion, .lx-future-removal__note) .lx-change-card__instruments {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    min-width: 0;
}
:is(.lx-change-card, .lx-change-ledger, .lx-future-insertion, .lx-future-removal__note) .lx-change-card__instrument {
    padding: 0.1em 0.5em;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--lx-neutral-fg);
    background: var(--lx-neutral-bg);
    border: 1px solid var(--lx-neutral-border);
    border-radius: var(--lx-radius-sm);
    white-space: nowrap;
}
/* The fold for the instruments past the first few: a summary, so it is dashed and quieter. */
:is(.lx-change-card, .lx-change-ledger, .lx-future-insertion, .lx-future-removal__note) .lx-change-card__instrument--more {
    color: var(--lx-text-muted);
    background: var(--lx-surface);
    border-style: dashed;
}
:is(.lx-change-card, .lx-change-ledger, .lx-future-insertion, .lx-future-removal__note) .lx-change-card__empty {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--lx-text-muted);
}

/* --- the redline: the words either side -------------------------- */
.lx-change-card .lx-change-card__redline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-2);
}
.lx-change-card .lx-change-card__redline--stacked {
    grid-template-columns: minmax(0, 1fr);
}
.lx-change-card .lx-change-card__side {
    min-width: 0;
    padding: var(--space-2) var(--space-3);
    background: var(--lx-surface-muted);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
}
.lx-change-card .lx-change-card__side--new {
    background: var(--lx-surface);
    border-color: var(--lx-warning-border);
    box-shadow: inset 3px 0 0 var(--lx-warning-solid);
}
.lx-change-card .lx-change-card__label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-bottom: var(--space-1);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--lx-text-muted);
}
.lx-change-card .lx-change-card__sign {
    display: inline-grid;
    place-items: center;
    width: 1rem;
    height: 1rem;
    font-family: var(--font-stack-mono);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--lx-surface);
    background: var(--lx-text-muted);
    border-radius: var(--lx-radius-pill);
}
/* The date a side applies from, in the timeline pills' face: `6 Apr 2027`, ISO in its title. */
.lx-change-card .lx-change-card__when {
    font-family: var(--font-stack-mono);
    font-weight: 600;
    color: var(--ss-dark);
    white-space: nowrap;
}
.lx-change-card .lx-change-card__side--new .lx-change-card__sign {
    background: var(--lx-warning-fg);
}
/* Statutory words are serif, as in .lx-quote; a long span scrolls inside its side
   rather than pushing the popover past the viewport. Never sideways: a word-diff span's
   end padding at a wrap overhung the box by 2px and drew a horizontal scrollbar at
   phone width, so the box keeps a little inline-end room and clips the rest. */
.lx-change-card .lx-change-card__words {
    max-height: 14rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding-inline-end: var(--space-2);
    font-family: var(--ss-font-serif);
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--ss-dark);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
/* The shared word-diff spans (diff_styles.css), wrapping line by line. No side padding: the
   changed run sits inline in its shared context, and padding would read as a space that is not
   there (`retirement ,`). */
.lx-change-card .lx-change-card__words :is(.diff-delete, .diff-insert) {
    margin: 0;
    padding: 0.05em 0;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* --- provenance -------------------------------------------------- */
.lx-change-card .lx-change-card__note {
    padding: var(--space-2) var(--space-4);
    font-size: 0.6875rem;
    color: var(--lx-text-muted);
    background: var(--lx-surface-muted);
    border-top: 1px solid var(--lx-border);
    border-radius: 0 0 var(--lx-radius-sm) var(--lx-radius-sm);
}


/* ================================================================
   FUTURE CHANGES LEDGER (.lx-change-ledger) — issue #2672
   ----------------------------------------------------------------
   The FCA made-changes band at the top of a sourcebook. It opens
   CLOSED on every load: one line saying the changes are drawn as track
   changes below, a count, and a details button (aria-expanded /
   aria-controls). Opened, it is an .lx-table--compact of the changes
   (provision, date pills, instrument pills, kind), a muted list of the
   ones that could not be marked, and a Checked footer holding the
   hide/show-all toggle. The pills are the change card's own
   (.lx-change-card__date / __instrument), shared above.
   Built by reader_changes.js (buildLedger / renderLedger).
   Demo: /admin/styleguide §21.
   ================================================================ */
.lx-up-band.lx-change-ledger {
    flex-wrap: wrap;
    align-items: center;
    row-gap: var(--space-1);
}
.lx-change-ledger .lx-up-band__value {
    flex: 1 1 18rem;
    min-width: 0;
}
.lx-change-ledger__line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
}
.lx-change-ledger__count {
    padding: 0.1em 0.65em;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--up-fg);
    background: var(--lx-surface);
    border: 1px solid var(--up-bd);
    border-radius: var(--lx-radius-pill);
}
.lx-change-ledger__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
    white-space: nowrap;
}
.lx-change-ledger__toggle .bi { transition: transform 0.15s ease; }
.lx-change-ledger__toggle[aria-expanded='true'] .bi { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
    .lx-change-ledger__toggle .bi { transition: none; }
}

.lx-change-ledger__panel {
    flex: 1 0 100%;
    min-width: 0;
    text-align: left;
    color: var(--text-color);
    background: var(--lx-surface);
    border: 1px solid var(--up-bd);
    border-radius: var(--lx-radius-md);
    overflow: hidden;
}
/* Many rows scroll inside the panel, so it never pushes the text far down; a table wider
   than a phone scrolls sideways in here, never the page. */
.lx-change-ledger__scroll {
    max-height: min(24rem, 55vh);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--lx-border-strong) transparent;
}
.lx-change-ledger__table { margin: 0; }
.lx-change-ledger__table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--lx-surface);
}
.lx-change-ledger__table td,
.lx-change-ledger__table tbody th { vertical-align: top; }
/* A row header is a cell that names its row, not a column heading: the body's hairline and
   weight, not the header's 2px rule and uppercase. */
.lx-change-ledger__table tbody th {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--lx-surface-inset);
    text-transform: none;
    letter-spacing: normal;
}
/* The provision names its row, so it stays pinned while a phone scrolls the table sideways
   (the reader's wide-table rule, #1986). */
.lx-change-ledger__table .lx-change-ledger__provision,
.lx-change-ledger__table thead th:first-child {
    position: sticky;
    left: 0;
    white-space: nowrap;
    background: var(--lx-surface);
}
.lx-change-ledger__table thead th:first-child { z-index: 2; }
.lx-change-ledger__goto {
    padding: 0;
    font-family: var(--font-stack-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ss-dark);
    background: none;
    border: 0;
    text-decoration: underline;
    text-decoration-color: var(--lx-border-strong);
    text-underline-offset: 0.2em;
}
.lx-change-ledger__goto:hover,
.lx-change-ledger__goto:focus-visible { text-decoration-color: currentColor; }
.lx-change-ledger__dates {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}
.lx-change-ledger__kind {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35em;
    white-space: nowrap;
}
.lx-change-ledger__sign {
    font-family: var(--font-stack-mono);
    font-weight: 700;
}
.lx-change-ledger__kind[data-kind='added'] .lx-change-ledger__sign { color: var(--lx-success-fg); }
.lx-change-ledger__kind:is([data-kind='removed'], [data-kind='gone']) .lx-change-ledger__sign {
    color: var(--lx-danger-fg);
}
.lx-change-ledger__kind[data-kind='new'] .lx-change-ledger__sign { color: var(--lx-success-fg); }
.lx-change-ledger__places { color: var(--lx-text-muted); }

.lx-change-ledger__aside {
    padding: var(--space-2) var(--space-3);
    font-size: 0.78rem;
    color: var(--lx-text-muted);
    background: var(--lx-surface-muted);
    border-top: 1px solid var(--lx-border);
}
.lx-change-ledger__heading {
    margin-bottom: var(--space-1);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.lx-change-ledger__missing {
    margin: 0;
    padding: 0;
    list-style: none;
}
.lx-change-ledger__missing li + li { margin-top: 0.15rem; }
.lx-change-ledger__label {
    font-family: var(--font-stack-mono);
    font-weight: 600;
    color: var(--text-color);
}

.lx-change-ledger__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-1) var(--space-3);
    font-size: 0.75rem;
    color: var(--lx-text-muted);
    border-top: 1px solid var(--lx-border);
}
.lx-change-ledger__foot .lx-reader-change-control { margin: 0; }
.lx-change-ledger__asat {
    font-family: var(--font-stack-mono);
    white-space: nowrap;
}

/* Optical centring of the change pills (#2672): trim each pill's line box to
   cap height and baseline, then pad it evenly, so the caps sit in the middle
   whatever the face's ascent/descent. Measured before: the date pill's caps
   sat 1.7px high, the instruments' 2.2px; after, within half a pixel. The
   status label is trimmed too, so the flex-centred ring lands on its
   cap-height midline. Browsers without text-box keep the padding above. */
@supports (text-box: trim-both cap alphabetic) {
    :is(.lx-change-card, .lx-change-ledger, .lx-future-insertion, .lx-future-removal__note) .lx-change-card__date,
    .lx-change-card .lx-change-card__provision,
    .lx-change-ledger__count {
        text-box: trim-both cap alphabetic;
        padding-block: 0.5em;
    }
    :is(.lx-change-card, .lx-change-ledger, .lx-future-insertion, .lx-future-removal__note) .lx-change-card__instrument {
        text-box: trim-both cap alphabetic;
        padding-block: 0.47em;
    }
    .lx-change-card .lx-change-card__status-text { text-box: trim-both cap alphabetic; }
}

/* ================================================================
   FUTURE INSERTION / REMOVAL (.lx-future-insertion, .lx-future-removal) — #2672
   ----------------------------------------------------------------
   A provision the FCA ADDS on a future date, drawn in place after the
   card it follows (reader_changes.js insertionCard), and a provision it
   REMOVES, struck on its own card. Same grammar as the inline redline:
   the added words are diff_styles.css's .diff-insert under a '+' and a
   dashed green rule; the removed card's words are struck under a '−'.
   Hue is the last channel: sign, rule style and strikethrough carry it
   in greyscale.

   An insertion is NOT a .celex-card: it sits beside the cards, so the
   card's content-visibility/contain rules (#1460) are untouched, and
   nothing that walks cards (keyboard nav, floodlight, filters, copy,
   the navigate overlay) counts it. It carries [data-future-insertion]
   and is left out of print, where it would read as law in force.
   ================================================================ */
.lx-future-insertion {
    position: relative;
    margin: 0 0 1rem;
    padding: var(--space-2) var(--space-4) var(--space-3) var(--space-5);
    background: var(--lx-surface);
    border: 1px dashed var(--lx-success-border);
    border-left: 3px solid var(--lx-success-fg);
    border-radius: var(--lx-radius-sm);
    scroll-margin-top: var(--scroll-anchor-offset, 6rem);
}
.lx-future-insertion:focus-visible { outline: 2px solid var(--lx-success-fg); outline-offset: 2px; }
.lx-future-insertion__head,
.lx-future-removal__note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    font-family: var(--ss-font-primary);
    font-size: 0.8125rem;
}
.lx-future-insertion__head { margin-bottom: var(--space-2); }
.lx-future-insertion__sign {
    position: absolute;
    left: var(--space-2);
    font-family: var(--font-stack-mono);
    font-weight: 700;
    color: var(--lx-success-fg);
}
.lx-future-insertion__label {
    font-family: var(--ss-font-primary);
    font-size: 1.05rem;
    color: var(--ss-dark);
}
.lx-future-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    color: var(--lx-text-muted);
}
.lx-future-meta__verb {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.lx-future-insertion__para {
    display: flex;
    gap: var(--space-3);
    padding-left: calc(var(--depth, 0) * 2.5rem);
    font-family: var(--ss-font-serif);
    line-height: 1.6;
}
.lx-future-insertion__para + .lx-future-insertion__para { margin-top: var(--space-2); }
.lx-future-insertion__prefix {
    flex: 0 0 2.25rem;
    color: var(--ss-dark);
}
.lx-future-insertion__words {
    min-width: 0;
    overflow-wrap: anywhere;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.lx-future-removal__note {
    position: relative;
    margin-bottom: var(--space-2);
    padding-left: var(--space-4);
}
.lx-future-removal__note .lx-future-insertion__sign { left: 0; }
.lx-future-insertion__sign.lx-future-removal__sign { color: var(--lx-danger-fg); }
.lx-future-removal .paragraph-content {
    text-decoration: line-through;
    text-decoration-color: var(--lx-danger-fg);
    background: var(--lx-danger-bg);
}

@media print {
    [data-future-insertion],
    .lx-future-removal__note { display: none !important; }
    .lx-future-removal .paragraph-content { text-decoration: none; background: none; }
}

/* ================================================================
   COMMENCEMENT STATE (.lx-cs-*)  — issues #1514, #1707, #1928
   ----------------------------------------------------------------
   How the reader shows which parts of an act are live. Designed on
   /admin/design/commencement; this is the settled vocabulary.

   Keyed off `cellar_notice.STATUS_LABELS`' own values — prospective,
   not_yet_in_force, in_force_not_yet_applying, partially_applying,
   applying, expired, unknown — so a renderer emits the status verbatim
   with no translation layer between the model and the CSS. Six of the
   seven are what `commencement_position()` returns; `prospective` is
   the UK answer the reader derives from the commencement map's
   `uk_status`, and it is in the same dict for exactly that reason.

   THE RULE, in one paragraph. Three levels of loudness: the glyph is
   unconditional (every provision, every date, every state), and the
   rail and band escalate on top of it together. Text that is NOT live
   law is always loud. Live law is loud only where being live is not
   this act's norm — an act that is overwhelmingly applying stays quiet
   about the fact, one that is split labels everything. The
   unconditional glyph is what stops silence being a claim: with it,
   "no mark" can never be confused with "no commencement data". Unconditional
   has no exceptions — including an act where every provision resolves the
   same way, whose header sentence a reader arriving at one card by deep link
   never sees (#1514 follow-up, reversing a narrowing the first cut shipped).

   Colour is never the only channel. Every state carries a glyph and a
   word as well, and nothing here introduces a colour — each state
   resolves to an existing tokens.css trio.
   ================================================================ */

[data-commencement='applying'] {
    --cs-bg: var(--lx-success-bg); --cs-fg: var(--lx-success-fg);
    --cs-bd: var(--lx-success-border); --cs-solid: var(--lx-success-solid);
}
[data-commencement='in_force_not_yet_applying'] {
    --cs-bg: var(--lx-warning-bg); --cs-fg: var(--lx-warning-fg);
    --cs-bd: var(--lx-warning-border); --cs-solid: var(--lx-warning-solid);
}
/* `prospective` is neutral WITH the two below, and that is the decision, not
   an economy of selectors: upstream saying "this provision exists, nothing has
   commenced it, and no date has been appointed" is a confident claim about the
   law, and it belongs in the same register as "not yet in force". It is
   emphatically NOT the danger trio `unknown` owns — painting it red would make
   a failure claim on legislation.gov.uk's behalf, which is the P4 rule pointed
   the other way (#1928). The glyph is what separates it from `not_yet_in_force`
   at a glance: ◌ is deliberately hollow where ○ is merely early. */
[data-commencement='prospective'],
[data-commencement='not_yet_in_force'],
[data-commencement='expired'] {
    --cs-bg: var(--lx-neutral-bg); --cs-fg: var(--lx-neutral-fg);
    --cs-bd: var(--lx-neutral-border); --cs-solid: var(--lx-neutral-solid);
}
/* A compound, and the ONLY place one is used: a container that holds both
   live and not-yet-live provisions. Never on a leaf — where there is room a
   split provision states its two halves as two bands instead. */
[data-commencement='partially_applying'] {
    --cs-bg: var(--lx-success-bg); --cs-fg: var(--lx-warning-fg);
    --cs-bd: var(--lx-warning-border); --cs-solid: var(--lx-warning-solid);
}
/* Amber, not danger red (#3243). `unknown` now says "we have not been able to
   state this" far more often than "this is dangerous", and a red failure
   palette on 573 provisions of one act asserted a fault the reader could do
   nothing about. It is the same amber as `in_force_not_yet_applying`, so what
   separates the two is not colour: `unknown` has NO glyph and carries its
   sentence in the marker (an `in_force_not_yet_applying` mark is a half-disc
   with a date), and every unknown surface is drawn with a DASHED edge below.
   Words and the dashed edge are the non-colour channels. */
[data-commencement='unknown'] {
    --cs-bg: var(--lx-warning-bg); --cs-fg: var(--lx-warning-fg);
    --cs-bd: var(--lx-warning-border); --cs-solid: var(--lx-warning-solid);
}
.lx-cs-band[data-commencement='unknown'] { border-bottom-style: dashed; }
.lx-cs-rail[data-commencement='unknown'] { border-left-style: dashed; }
/* The chip carries a whole sentence rather than a date, so it wraps and is a
   rounded rectangle, not a one-line pill. */
.lx-cs-chip[data-commencement='unknown'] {
    border-style: dashed; border-radius: var(--lx-radius-sm);
    white-space: normal; font-weight: 500; line-height: 1.3; max-width: 32rem;
}

/* --- the prospective axis: is a change PROPOSED? (#2128) ---------- *
   A third axis beside the status and the reach, and it paints the marker
   amber. That is a deliberate collision, taken with the issue: amber is also
   `in_force_not_yet_applying`'s colour, so what separates the two is the GLYPH
   CHARACTER, which never changes — `●` on amber is a provision applying today
   that a proposal would amend, `◐` on amber is one in force and not yet
   applying. Colour is not allowed to be the only channel here, and this is the
   case that proves why.

   It outranks the STATUS (a status is about today; this marker's whole job is
   to say that today is not the end of the story) and loses to the REACH, which
   is asserted explicitly in the reach block below rather than left to source
   order. A directive's mark must stay neutral: painting it amber for a
   proposal would spend the reader's own answer — "this reaches you through
   national law we do not hold" — on a second question.

   So the amber cannot be the whole signal, because on those acts it is absent.
   The corner dot is the channel that survives every palette, and it is what
   makes the marker's meaning legible in greyscale and under the reach's
   neutral trio alike.

   Checked against #3688's "amber means mixed" and kept: a proposed change is
   an UNPUBLISHED reading of the provision's future, the same register as a
   proposed proviso, which #3688 also keeps amber. It is never a settled one, so
   there is no "whole" case for it to fall back to the status colour in. */
[data-prospective='proposed'],
[data-prospective='proposed'][data-commencement] {
    --cs-bg: var(--lx-warning-bg); --cs-fg: var(--lx-warning-fg);
    --cs-bd: var(--lx-warning-border); --cs-solid: var(--lx-warning-solid);
}
.lx-cs-glyph[data-prospective='proposed'],
.lx-cs-chip[data-prospective='proposed'] { position: relative; }
.lx-cs-glyph[data-prospective='proposed']::after,
.lx-cs-chip[data-prospective='proposed']::after {
    content: ''; position: absolute; top: -2px; right: -2px;
    width: 0.42em; height: 0.42em; border-radius: var(--lx-radius-pill);
    background: var(--lx-warning-solid);
    box-shadow: 0 0 0 1.5px var(--lx-surface);
}

/* --- the phased axis: is this date the whole story? (#3243) ------- *
   A third axis beside the status and the reach. Its non-colour channels are
   the WORDS -- every phased marker, band and title says "phased" (or, for a
   published split, gives each case its own line, #3694) -- and a DOTTED edge,
   which no status uses (`unknown` is dashed, `prospective` solid), so a
   greyscale or colour-blind reader still sees a distinct treatment.

   Colour is the status's, unless the area is MIXED (#3688). Amber means mixed:
   the members a marker or band speaks for, or the cases of the reading it
   carries, sit in different states on the legal day, or the reading is still
   unpublished (`held`, `proposed`). `commencement_state.js` decides that
   (`isMixed`) and says so as `data-mixed`; CSS only paints it. A published
   caveat on a provision applying since its one date is green, dotted. Loses to
   the reach (a directive's neutral trio is asserted in the reach block below). */
[data-mixed],
[data-mixed][data-commencement] {
    --cs-bg: var(--lx-warning-bg); --cs-fg: var(--lx-warning-fg);
    --cs-bd: var(--lx-warning-border); --cs-solid: var(--lx-warning-solid);
}
.lx-cs-band[data-phased] { border-bottom-style: dotted; }
.lx-cs-rail[data-phased] { border-left-style: dotted; }
.lx-cs-chip[data-phased] {
    border-style: dotted; border-radius: var(--lx-radius-sm);
    white-space: normal; font-weight: 500; line-height: 1.3; max-width: 32rem;
}

/* A proposal's document-level statement (#2042). "Not in force" is NOT a
   commencement status: every value above is a statement about the law, and this
   is a statement about what kind of document this is. So it is a class, not a
   [data-commencement] value — the state palette above cannot reach it, and
   nothing keying off a status can pick it up.

   Solid border over the muted surface, which is what the rest of the reader uses
   for a quiet statement of fact. Nothing is missing here — a proposal is not
   law, so it has no commencement, and that is a settled fact rather than a gap
   in ours. Emphatically not the danger trio `unknown` owns: `unknown` means we
   hold a record and it does not settle (the DSA's date conflict), and that
   refusal is a real signal that must stay loud and stay distinguishable from
   this. Permanent, unlike the placeholders this reader has carried: a proposal
   will never have commencement dates. */
.lx-cs-proposal {
    --cs-bg: var(--lx-surface-muted); --cs-fg: var(--lx-text-muted);
    --cs-bd: var(--lx-border); --cs-solid: var(--lx-border);
}
.lx-cs-band.lx-cs-proposal .lx-cs-band__value b { color: var(--text-color); }

/* --- 1. the glyph: unconditional, and the receipts trigger --------- */
.lx-cs-glyph {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.7em; height: 1.7em; border-radius: var(--lx-radius-pill);
    background: var(--cs-bg); color: var(--cs-fg); border: 1px solid var(--cs-bd);
    font-family: var(--ss-font-primary); font-size: 0.85rem; line-height: 1;
}

/* --- 2. the chip: the glyph plus its date ------------------------- */
.lx-cs-chip {
    display: inline-flex; align-items: center; gap: 0.35em;
    font-family: var(--ss-font-primary); font-size: 0.72rem; font-weight: 600;
    padding: 0.2em 0.55em; border-radius: var(--lx-radius-pill);
    background: var(--cs-bg); color: var(--cs-fg); border: 1px solid var(--cs-bd);
    white-space: nowrap;
}
/* On a tinted run the chip would take the tint's own colour and vanish into
   it, so it inverts: surface fill, state kept in the border and the ink. */
/* It is a corner TAG, not a pill: a rectangular radius so it reads as a label
   on the block rather than as inline content of the sentence it follows. The
   pill radius is kept for the card-header chip, which sits in a row of its own.

   `align-self` is the load-bearing line. This chip is appended to
   `.paragraph-container`, which carries Bootstrap's `d-flex` — so the chip is a
   FLEX ITEM, and the default `align-items: stretch` grew it to the full height
   of the paragraph beside it. A long paragraph produced a chip the height of
   the paragraph, which is what made it read as a huge pill and then as a huge
   rectangle. `float` cannot fix that: floats do not apply to flex items and are
   ignored outright. `flex-end` both stops the stretch and puts it on the bottom
   edge, which is where it belongs; `flex: 0 0 auto` keeps it the width of its
   own text. */
.lx-cs-chip--on-tint {
    background: var(--lx-surface); border-color: var(--cs-solid);
    box-shadow: var(--lx-shadow-sm);
    align-self: flex-end;
    flex: 0 0 auto;
    margin-left: auto;
    border-radius: var(--lx-radius-sm);
}

/* Both are interactive — they open the receipts. `pointer`, never `help`. */
.lx-cs-glyph[role='button'], .lx-cs-chip[role='button'] { cursor: pointer; }
.lx-cs-glyph[aria-expanded='true'], .lx-cs-chip[aria-expanded='true'] {
    box-shadow: 0 0 0 2px var(--lx-brand-bg);
}

/* --- 3. the rail: ambient, and immune to the navigation flash ----- */
/* border-left, deliberately: .highlight-flash sets background-color with
   !important, so anything using background as its channel is overridden for
   the second the flash lasts. A border is a different property. */
.lx-cs-rail { border-left: 3px solid var(--cs-solid); }

/* --- 4. the band: the sub-header row ------------------------------ */
/* Joins the .celex-card-sub-header family (Related Recitals / Articles), and
   uses its device of a distinct label per row — which is what lets a split
   provision state both halves as two bands rather than one compound one.

   CONTRACT: a band MUST also carry `highlight-target` — the same rule as
   .lx-cs-tint below, for the same reason. Its channel is background, so a band
   that opts out keeps its colour while every other row in the card washes
   cream, and that island reads as a rendering fault. The rows it sits with are
   already flash targets (render_html.py emits `highlight-target` on the
   sub-header container AND on each .celex-card-sub-header), so opting out also
   makes it the one row in the group that behaves differently. During the flash
   the state survives in the band's own words and glyph, which is what makes the
   trade affordable. */
.lx-cs-band {
    display: flex; align-items: baseline; gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--cs-bg); color: var(--cs-fg);
    border-bottom: 1px solid var(--cs-bd);
    font-family: var(--ss-font-primary); font-size: 0.85rem;
}
.lx-cs-band__label { min-width: 120px; white-space: nowrap; font-style: italic; opacity: 0.85; }
.lx-cs-band__value { flex: 1; }
.lx-cs-band--quiet {
    background: var(--lx-surface-muted); color: var(--text-color);
    border-bottom-color: var(--lx-border);
}
.lx-cs-band--quiet .lx-cs-band__value b { color: var(--cs-fg); }

/* --- 5. the tint: marking the affected text itself ---------------- */
/* A contiguous run of deferred paragraphs reads as ONE block — the deferral
   covers a provision and its points, which are a single legal unit — so only
   the outer corners round and a single chip goes at the end.

   CONTRACT: a tinted paragraph MUST also carry `highlight-target`. Tint and
   band are the two components here whose channel is background, so they are the
   two the navigation flash overrides — and a run that keeps its colour while
   the card around it washes cream reads as a rendering fault, not as emphasis.
   Opting in costs the fill for the second the flash lasts; the state survives in
   what does not depend on a background — the chip's border and ink (--on-tint
   fills from --lx-surface, so the flash has nothing of its own to override), the
   glyph, and the band's words. (#1514, decided against the alternative on the
   board.)

   The rail needs room, and it cannot simply be asked for. This class lands on
   `.paragraph-container`, which `render_html.py` emits carrying an INLINE
   `style="padding-left: 0px"` — so a plain `padding-left` here loses to it and
   the inset rail paints over the paragraph number (the "1" and "2" in the
   gutter). `!important` is the right tool for exactly one job, beating an
   inline style, and this is that job.

   The negative margin is what makes it free: it reclaims the space out of the
   card body's own 1rem padding, and the two cancel exactly — so the rail gets
   its gutter and NOTHING on the line moves. Matching a left marker with the
   space to hold it is the same rule `.lx-quote` and `.ob-norm` already follow;
   this one just has an inline style in the way.

   The proper fix is for `render_html.py` to stop emitting that inline zero, but
   the attribute is materialised into stored HTML, so it would not repair a
   single already-ingested act without a re-parse. */
.lx-cs-tint {
    background: var(--cs-bg);
    margin-left: -0.55rem;
    padding-left: 0.55rem !important;
    padding-top: 0.3rem; padding-right: 0.5rem; padding-bottom: 0;
    box-shadow: inset 3px 0 0 var(--cs-solid);
}
.lx-cs-tint + .lx-cs-tint { padding-top: 0; }
/* The quiet tint (#4387): a run in the card's OWN state that only started later —
   AI Act 2(13), applying since 27 July 2026 inside an Article 2 applying since 2
   February 2025. The full tint says "this part is not where the card is", which
   is false here, so the fill is a wash of the state's background and the rail a
   hairline of its border. Same contract as the full tint (highlight-target). */
.lx-cs-tint--quiet {
    background: color-mix(in srgb, var(--cs-bg) 40%, var(--lx-surface));
    box-shadow: inset 2px 0 0 var(--cs-bd);
}
.lx-cs-tint--first {
    border-top-left-radius: var(--lx-radius-sm);
    border-top-right-radius: var(--lx-radius-sm);
}
.lx-cs-tint--last {
    padding-bottom: 0.45rem;
    border-bottom-left-radius: var(--lx-radius-sm);
    border-bottom-right-radius: var(--lx-radius-sm);
}

/* --- 5b. the reader's own hosts (#1514) ---------------------------- */
/* The three places the reader mounts the vocabulary above. Positioning only:
   every colour still comes from --cs-* via [data-commencement], so a state
   added to the palette needs nothing here.

   `.lx-cs-bands` is a `.celex-card-sub-header-container` in every other
   respect — it joins the Related Recitals / Related Articles family and sits
   directly above it — so it inherits that container's own rules and adds only
   the removal of the horizontal padding a band supplies for itself. */
.lx-cs-bands { padding: 0; }

/* The document header line: the act's commencement sentence and stages. On the act
   page it is drawn in the Lens's "When it applies" (js/lens/lens.js), no longer under
   the title. Left-aligned: it is a statement about the act, read left-to-right like
   the bands it matches, and centring it makes a two-line sentence ragged on both edges. */
.lx-cs-dochead {
    max-width: 46rem; margin: 0.9rem auto 0; text-align: left;
    border: 1px solid var(--cs-bd); border-radius: var(--lx-radius-sm);
}
.lx-cs-band__mark { flex: 0 0 auto; margin-left: auto; }
.lx-cs-source-flag {
    display: inline-flex; align-items: center; gap: 0.25rem; margin-left: 0.55rem;
    padding: 0.08rem 0.38rem; border: 1px solid var(--lx-warning-border);
    border-radius: var(--lx-radius-sm); background: var(--lx-warning-bg);
    color: var(--lx-warning-fg); font-size: 0.72rem; font-weight: 600;
    white-space: nowrap;
}
.lx-cs-mark-wrap { gap: 0.35rem; }
.lx-cs-mark-wrap .lx-cs-source-flag { margin-left: 0; }
/* A device copy of the dates from an earlier legal day, served offline (#3587). */
.lx-cs-held { display: block; margin-top: 0.2rem; color: var(--lx-text-muted); font-size: 0.8rem; }

/* The stage list, under the header line: closed by default because the header
   line already answers the question, and open for the reader planning against
   a staged act. */
details.lx-cs-audience {
    max-width: 46rem; margin: 0.35rem auto 0; text-align: left;
    font-family: var(--ss-font-primary);
}
details.lx-cs-audience > summary { cursor: pointer; }

/* The header's space, held until commencement_state.js paints it (#3532).
   commencement_reserve.js marks #heading-content with the header's shape
   before the first frame; the painter removes the mark in the same task as it
   appends the header. Without it every card under the heading jumped down by
   the header's height once the text was already on screen.

   Built from the geometry above, so it moves with it: .lx-cs-dochead's
   0.9rem margin, .lx-cs-band's 0.6rem padding and 1px border, one 0.85rem
   line at line-height 1.5 per line with the 1.5rem mark as the floor of the
   first, and each disclosure (details.lx-cs-audience) its 0.35rem margin and
   a ~1.32rem summary row. The margin is a margin, not part of the height:
   the band's collapses with the reg-ref line's margin above it, and a
   reservation that did not collapse the same way came out 8px too tall. */
.heading-content[data-cs-reserve]::after {
    content: '';
    display: block;
    margin-top: 0.9rem;
    height: calc(
        1.2rem + 2px
        + max(1.5rem, var(--cs-reserve-lines, 1) * 1.275rem)
        + var(--cs-reserve-details, 0) * 1.67rem
    );
}
.heading-content[data-cs-reserve~='lines-2'] { --cs-reserve-lines: 2; }
.heading-content[data-cs-reserve~='lines-3'] { --cs-reserve-lines: 3; }
.heading-content[data-cs-reserve~='lines-4'] { --cs-reserve-lines: 4; }
.heading-content[data-cs-reserve~='lines-5'] { --cs-reserve-lines: 5; }
.heading-content[data-cs-reserve~='lines-6'] { --cs-reserve-lines: 6; }
.heading-content[data-cs-reserve~='details-1'] { --cs-reserve-details: 1; }
.heading-content[data-cs-reserve~='details-2'] { --cs-reserve-details: 2; }

/* Each preview card's marks' space, held the same way (#3532). The stored
   preview stamps every card with the room its marks will take
   (`data-cs-card-reserve`, sized by the same `cardMarks` that paints them), and
   the painter takes it over in the same task as it inserts them. Without it
   CRR's Article 1 grew 104px under the text: its unknown chip, a whole
   sentence, wrapped the header row to three lines, and its band came in below.

   Built from the geometry above: the rail is the 3px left border, held in
   transparent so the card is already its final width; the unknown chip is
   0.72rem at line-height 1.3 per line plus its 0.2em padding and 1px border,
   and holds the header row's button group at that height; each band row is
   its 0.6rem padding and 1px border, and each line one 0.85rem line at
   line-height 1.5. Bootstrap's .card is a flex column, so the header's margin
   does not collapse into the body's and holds exactly the bands' height.

   The chip is held by a placeholder where it goes, first in the header's
   right-aligned button group, its full width as well as its height: a chip
   long enough to wrap fills its 32rem max-width, and the mark wrap adds its
   0.5rem margin. Holding only the height left the group's left edge to move
   when the chip landed. A one-line chip's width is its text's, which CSS
   cannot know, so only a wrapping one (two lines or more) is held. */
.celex-card[data-cs-card-reserve~='rail'] { border-left: 3px solid transparent; }
.celex-card[data-cs-card-reserve*='chip-'] > .card-header .d-flex.flex-nowrap::before {
    content: '';
    flex: 0 0 auto;
    width: 32rem;
    margin-right: 0.5rem;
    height: calc(var(--cs-chip-lines, 2) * 0.936rem + 0.288rem + 2px);
}
.celex-card[data-cs-card-reserve*='band-rows-'] > .card-header {
    margin-bottom: calc(
        var(--cs-band-rows, 1) * (1.2rem + 1px) + var(--cs-band-lines, 1) * 1.275rem
    );
}
.celex-card[data-cs-card-reserve~='chip-2'] { --cs-chip-lines: 2; }
.celex-card[data-cs-card-reserve~='chip-3'] { --cs-chip-lines: 3; }
.celex-card[data-cs-card-reserve~='chip-4'] { --cs-chip-lines: 4; }
.celex-card[data-cs-card-reserve~='chip-5'] { --cs-chip-lines: 5; }
.celex-card[data-cs-card-reserve~='chip-6'] { --cs-chip-lines: 6; }
.celex-card[data-cs-card-reserve~='band-rows-2'] { --cs-band-rows: 2; }
.celex-card[data-cs-card-reserve~='band-rows-3'] { --cs-band-rows: 3; }
.celex-card[data-cs-card-reserve~='band-rows-4'] { --cs-band-rows: 4; }
.celex-card[data-cs-card-reserve~='band-lines-2'] { --cs-band-lines: 2; }
.celex-card[data-cs-card-reserve~='band-lines-3'] { --cs-band-lines: 3; }
.celex-card[data-cs-card-reserve~='band-lines-4'] { --cs-band-lines: 4; }
.celex-card[data-cs-card-reserve~='band-lines-5'] { --cs-band-lines: 5; }
.celex-card[data-cs-card-reserve~='band-lines-6'] { --cs-band-lines: 6; }
.celex-card[data-cs-card-reserve~='band-lines-7'] { --cs-band-lines: 7; }
.celex-card[data-cs-card-reserve~='band-lines-8'] { --cs-band-lines: 8; }
.celex-card[data-cs-card-reserve~='band-lines-9'] { --cs-band-lines: 9; }
.celex-card[data-cs-card-reserve~='band-lines-10'] { --cs-band-lines: 10; }
.celex-card[data-cs-card-reserve~='band-lines-11'] { --cs-band-lines: 11; }
.celex-card[data-cs-card-reserve~='band-lines-12'] { --cs-band-lines: 12; }

/* --- 6. the TOC button -------------------------------------------- */
/* One binary rule rather than the five-state palette: salmon when everything
   under the button is applying, amber when anything under it is not. The
   sidebar says where to look; the card says what the position is. Not keyed
   to [data-commencement], so the button can be one colour while its glyph
   still carries the precise state. */
.toc-btn.lx-cs-toc-pending {
    background-color: var(--lx-warning-bg) !important;
    border-color: var(--lx-warning-border) !important;
    color: var(--lx-warning-fg) !important;
}
.toc-btn .lx-cs-toc-glyph {
    display: block; font-size: 9px; line-height: 1; margin-top: 1px; opacity: 0.85;
}

/* --- 7. the subject axis ------------------------------------------ *
   Issue #1707. The six states above describe DIRECT APPLICATION, and a
   directive does none of it: it binds Member States to legislate, and
   the reader's obligations arrive through a national instrument we do
   not hold. 112 of 279 acts in the corpus are directives.

   The fix is a subject beside the status, not a seventh status. Both
   facts are true at once and one word carries only one of them: the
   European Accessibility Act really has been applying TO MEMBER STATES
   since 28 June 2025, and really never applies to the reader.

   A REGULATION IS UNCHANGED. Its subject is `you`, which adds no lane
   and no marker, so every surface renders exactly what it rendered
   before. Only a directive draws the two markers below.

   Colour is never the only channel here either: each marker carries its
   glyph AND its word, from SUBJECT_GLYPHS/SUBJECT_LABELS and
   REACH_GLYPHS/REACH_LABELS in cellar_notice.py, so the vocabulary has
   one home and the styleguide renders it from the Python dicts. */

/* A duty, but somebody else's — informational, not a warning about the
   reader's own position. */
[data-subject='member_states'] {
    --cs-bg: var(--lx-info-bg); --cs-fg: var(--lx-info-fg);
    --cs-bd: var(--lx-info-border); --cs-solid: var(--lx-info-solid);
}
/* We hold no fact about whether YOUR state has transposed, and we do not
   intend to (27 national registers, deliberately never claimed). Neutral
   is the honest trio: not a warning, and not a green light.

   The second selector is the same declaration at higher specificity, and it
   is load-bearing rather than decorative (#2041). A directive's mark carries
   BOTH attributes — `data-commencement` is its real member-state position and
   the receipts read it off there, `data-reach` is the reader's own answer —
   and the reach has to win, or 41 acts paint "applying" green for a reader
   the act never applies to. Winning on source order alone would put that
   outcome 200 lines away from the rules it depends on, where a re-order
   silently repaints them. */
[data-reach='via_national_law'],
[data-reach='via_national_law'][data-commencement],
[data-reach='via_national_law'][data-prospective],
[data-reach='via_national_law'][data-phased],
[data-reach='via_national_law'][data-mixed] {
    --cs-bg: var(--lx-neutral-bg); --cs-fg: var(--lx-neutral-fg);
    --cs-bd: var(--lx-neutral-border); --cs-solid: var(--lx-neutral-solid);
}

.lx-cs-subject, .lx-cs-reach {
    display: inline-flex; align-items: center; gap: 0.35em;
    font-family: var(--ss-font-primary); font-size: 0.72rem; font-weight: 600;
    padding: 0.2em 0.55em; border-radius: var(--lx-radius-pill);
    background: var(--cs-bg); color: var(--cs-fg); border: 1px solid var(--cs-bd);
    white-space: nowrap;
}

/* --- 8. the two-audience panel ------------------------------------ *
   The document header for a directive. YOU FIRST, and the member-state
   timetable underneath as its evidence — the only question this page has
   to answer is "does this bite on me yet", so it is answered in the first
   line rather than under a timetable that is not about the reader.

   Never asserts that a Member State HAS transposed. That is the fact we
   do not hold, and the wording has to be able to say "applies once
   transposed" without claiming whether it has been. */
.lx-cs-audience { margin-top: 0.55rem; }
.lx-cs-audience + .lx-cs-audience {
    margin-top: 0.85rem; padding-top: 0.7rem; border-top: 1px solid var(--lx-border);
}
.lx-cs-audience__who {
    font-family: var(--ss-font-primary); font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.11em; text-transform: uppercase; color: var(--lx-text-muted);
    margin-bottom: 0.3rem;
}
.lx-cs-audience__answer { font-size: 0.85rem; max-width: 62ch; margin: 0; }
.lx-cs-audience__answer b { color: var(--ss-dark); }
/* What we do not know, said out loud rather than left to be inferred. */
.lx-cs-audience__caveat {
    display: block; font-size: 0.78rem; color: var(--lx-text-muted); margin-top: 0.25rem;
}

/* The hazard mark: which STAGE is unsettled, never which provision. It sits
   beside the article count in "What applies when" and opens the uncertainty
   panel through the same controller the state pills use.

   `--lx-warning-solid`, not `--lx-warning-fg`: the fg token is text-on-pale and
   goes muddy at 15px, and this mark's whole job is to be seen from the top of a
   1,190-provision document. Deliberately NOT a --cs-* state colour — the
   stage's date is known, and what is unsettled is its membership. */
.lx-cs-hazard {
    color: var(--lx-warning-solid);
    display: inline-flex; align-items: center;
    margin-left: 0.35em; padding: 0.1em;
    vertical-align: -0.2em;
    cursor: pointer;
    border-radius: var(--lx-radius-xs);
}
.lx-cs-hazard svg { display: block; }
.lx-cs-hazard[aria-expanded='true'], .lx-cs-hazard:hover {
    background: var(--lx-warning-bg);
}
.lx-cs-hazard:focus-visible { outline: 2px solid var(--lx-warning-solid); outline-offset: 1px; }

/* The hazard panel borrows the receipts frame so it reads as a sibling, but its
   head keeps the STAGE's own state colour — the stage is what it is about — and
   the warning lives in the lead, which is amber. */
.lx-cs-haz__lead {
    margin: 0; padding: 0.55rem 0.85rem;
    background: var(--lx-warning-bg); color: var(--lx-warning-fg);
    border-bottom: 1px solid var(--lx-warning-border);
    font-size: 0.85rem; font-weight: 600; max-width: 62ch;
}
.lx-cs-haz__row { padding: 0.5rem 0.85rem; }
.lx-cs-haz__row + .lx-cs-haz__row { border-top: 1px solid var(--lx-border); }
.lx-cs-haz__cite { font-size: 0.8rem; color: var(--lx-text-muted); }
.lx-cs-haz__row blockquote {
    margin: 0.3rem 0; padding-left: 0.6rem;
    border-left: 3px solid var(--lx-warning-border);
    font-family: var(--ss-font-serif); font-size: 0.84rem;
}
.lx-cs-haz__why { font-size: 0.82rem; max-width: 62ch; }


/* One dated member-state row. The leader is a flex filler with a dotted
   bottom edge and no text of its own, so a screen reader hears the label
   then the date and never the decoration. */
.lx-cs-stage { display: flex; align-items: baseline; gap: 0.4rem; padding: 0.13rem 0; font-size: 0.82rem; }
.lx-cs-stage__what { white-space: nowrap; }
.lx-cs-stage__leader {
    flex: 1 1 auto; min-width: 1.5rem;
    border-bottom: 1px dotted var(--lx-border-strong); transform: translateY(-0.22em);
}
.lx-cs-stage__when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lx-cs-stage__mark { flex: 0 0 auto; }

/* --- receipts: what the glyph opens ---------------------------------------
   Rendered by commencement_receipts.js, which composes the independent checks with
   commencement_studio.js's evidenceHtml(). Styled here rather than in the
   design board because the board retires once the reader ships — the panel is
   a component, not a specimen.
   Colours come from the --cs-* set above via [data-commencement], so the head
   carries the same state colour as the glyph that opened it. */
.lx-cs-receipts {
    border: 1px solid var(--lx-border); border-radius: var(--lx-radius-md);
    background: var(--lx-surface); box-shadow: var(--lx-shadow-md);
    max-width: 480px; overflow: hidden;
}
.lx-cs-receipts__head {
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
    padding: 0.55rem 0.85rem; background: var(--cs-bg); color: var(--cs-fg);
    border-bottom: 1px solid var(--cs-bd); font-size: 0.85rem; font-weight: 600;
}
.lx-cs-receipts__scope {
    font-size: 0.78rem; margin: 0; padding: 0.45rem 0.85rem 0;
    color: var(--lx-text-muted);
}
.lx-cs-receipts__scope b { color: var(--lx-text); }

/* One row per independent verification. Separate rows rather than one sentence
   because a summary has to be right about every check at once, and on a
   provision whose date is verified but whose scope is not, it cannot be. */
.lx-cs-checks { padding: 0.5rem 0.85rem 0.2rem; }
.lx-cs-checks__head {
    font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--lx-text-muted); margin-bottom: 0.35rem;
}
.lx-cs-check {
    display: grid; grid-template-columns: 1.1rem 8.5rem 1fr; gap: 0.4rem;
    align-items: baseline; padding: 0.22rem 0; font-size: 0.8rem;
    border-top: 1px solid var(--lx-border);
}
.lx-cs-check:first-of-type { border-top: none; }
.lx-cs-check__mark { font-size: 0.85rem; line-height: 1.2; text-align: center; }
.lx-cs-check--pass .lx-cs-check__mark { color: var(--lx-success-solid); }
.lx-cs-check--fail .lx-cs-check__mark { color: var(--lx-danger-solid); }
.lx-cs-check--flag .lx-cs-check__mark { color: var(--lx-warning-fg); }
.lx-cs-check--none .lx-cs-check__mark { color: var(--lx-text-muted); }
.lx-cs-check__name {
    color: var(--lx-text-muted); font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.lx-cs-check__what b { font-weight: 600; }
.lx-cs-check__detail {
    grid-column: 3; font-size: 0.74rem; color: var(--lx-text-muted);
    font-family: var(--font-stack-mono); word-break: break-word;
}
.lx-cs-check--fail .lx-cs-check__what { color: var(--lx-danger-fg); }
.lx-cs-check--flag .lx-cs-check__what { color: var(--lx-warning-fg); }

/* The current/proposed state table (#2128).
   Deliberately NOT the `.lx-cs-check` vocabulary it sits beside: a check row is
   a verification verdict about our own reading, and these are statements of
   legal position. Sharing the classes would have made the two indistinguishable
   in a stylesheet and then, sooner or later, in the panel.

   The proposed rows are quieter than the `Now` row on purpose — muted ink and a
   dashed left rail — because the one thing a reader must not take from this
   table is that the proposal has already happened. */
.lx-cs-state { padding: 0.5rem 0.85rem 0.2rem; }
.lx-cs-state__head {
    font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--lx-text-muted); margin-bottom: 0.35rem;
}
.lx-cs-state__row {
    display: grid; grid-template-columns: 1.1rem 5.2rem 1fr; gap: 0.4rem;
    align-items: baseline; padding: 0.3rem 0; font-size: 0.8rem;
    border-top: 1px solid var(--lx-border);
}
.lx-cs-state__row:first-of-type { border-top: none; }
.lx-cs-state__mark { font-size: 0.85rem; line-height: 1.2; text-align: center; }
.lx-cs-state__name {
    color: var(--lx-text-muted); font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.lx-cs-state__detail {
    grid-column: 3; font-size: 0.74rem; color: var(--lx-text-muted);
    word-break: break-word;
}
.lx-cs-state__row--proposed {
    border-left: 2px dashed var(--lx-warning-border);
    padding-left: 0.4rem; margin-left: -0.4rem;
}
.lx-cs-state__row--proposed .lx-cs-state__mark,
.lx-cs-state__row--proposed .lx-cs-state__name { color: var(--lx-warning-fg); }
.lx-cs-state__when { color: var(--lx-text-muted); }
.lx-cs-state__note {
    font-size: 0.76rem; margin: 0.45rem 0 0.3rem;
    color: var(--lx-warning-fg); background: var(--lx-warning-bg);
    border: 1px solid var(--lx-warning-border); border-radius: var(--lx-radius-xs);
    padding: 0.4rem 0.5rem;
}
.lx-cs-state__asat { color: var(--lx-text-muted); }

/* The Studio's own receipt markup, dropped in unchanged. */
.lx-cs-receipts__evidence { padding: 0.6rem 0.85rem 0.2rem; font-size: 0.85rem; }
.lx-cs-receipts__evidence .cs-receipt > .badge { font-size: 0.7rem; }
.lx-cs-receipts__evidence blockquote { margin: 0.45rem 0 0; }

.lx-cs-receipts__flag {
    font-size: 0.78rem; color: var(--lx-warning-fg);
    background: var(--lx-warning-bg); border: 1px solid var(--lx-warning-border);
    border-radius: var(--lx-radius-xs); padding: 0.35rem 0.5rem;
    margin: 0.2rem 0.85rem 0.4rem;
}
/* The quiet tint's chip: the border of the state, not its solid. */
.lx-cs-chip--quiet { border-color: var(--cs-bd); box-shadow: none; }

/* "Human checked" and when (#4387): a badge, to the minute. */
.lx-cs-stamp {
    display: inline-block; margin-left: 0.25rem; padding: 0 0.4rem;
    border: 1px solid var(--lx-success-border); border-radius: var(--lx-radius-sm);
    background: var(--lx-success-bg); color: var(--lx-success-fg);
    font-size: 0.72rem; font-weight: 500; white-space: nowrap;
}

/* A card's dates, a line each (#4387): what a card's own mark opens where its
   parts start on different dates. Each line is a button opening that part's
   receipt; the line's colour is its own state's, through [data-commencement]. */
.lx-cs-dates { list-style: none; margin: 0; padding: 0.35rem 0; }
.lx-cs-dates__row {
    display: flex; align-items: baseline; gap: 0.5rem; width: 100%;
    padding: 0.45rem 0.85rem; border: 0; background: none; text-align: left;
    font: inherit; font-size: 0.82rem; color: var(--lx-text);
    box-shadow: inset 3px 0 0 var(--cs-solid);
}
li + li > .lx-cs-dates__row, li + li.lx-cs-dates__row { border-top: 1px solid var(--lx-border); }
button.lx-cs-dates__row { cursor: pointer; }
button.lx-cs-dates__row:hover, button.lx-cs-dates__row:focus-visible {
    background: var(--cs-bg); color: var(--cs-fg);
}
.lx-cs-dates__glyph { flex: 0 0 1rem; color: var(--cs-solid); }
.lx-cs-dates__what { flex: 1 1 auto; }
.lx-cs-dates__go { flex: 0 0 auto; color: var(--lx-text-muted); }
.lx-cs-receipts__back {
    display: block; width: 100%; padding: 0.35rem 0.85rem; border: 0;
    border-bottom: 1px solid var(--lx-border); background: var(--lx-surface-muted);
    font: inherit; font-size: 0.78rem; text-align: left; color: var(--lx-brand);
    cursor: pointer;
}

.lx-cs-receipts__foot {
    border-top: 1px solid var(--lx-border); padding: 0.5rem 0.85rem;
    font-size: 0.75rem; color: var(--lx-text-muted); background: var(--lx-surface-muted);
    /* The badge has padding but no margin — the container provides the gap, as
       _vocabulary.html does. `align-items: baseline` would drop the pill below
       the first text line, so it aligns to the start instead. */
    display: flex; align-items: flex-start; gap: 0.5rem;
}
/* ai-assisted emits no badge, but the host span stays in the DOM to carry
   data-provenance — collapse it so the flex gap does not indent the text. */
.lx-cs-receipts__foot .cb-prov-host:empty,
.lx-cs-receipts__foot .lx-prov-host:empty { display: none; }
.lx-cs-receipts__foot .cb-prov-host,
.lx-cs-receipts__foot .lx-prov-host { flex: 0 0 auto; }

/* ================================================================
   UPCOMING CHANGES (issue #1475, Layer 1)
   ================================================================
   One line under the act's title: are there proposals in flight that would
   amend the words below? Rendered by upcoming_changes.js from
   /api/legislation/<celex>/upcoming-changes.

   It borrows commencement's band geometry deliberately — it sits in
   #heading-content, where the commencement dochead was before the Lens took it, and two document-level
   statements that look like two different components read as two unrelated
   pieces of furniture. It does NOT borrow its classes: every value in the
   --cs-* set is a statement about whether text is live law, and none of them
   answers "would this change". So this is its own --up-* set, and nothing keyed
   to [data-commencement] can reach it or be reached by it.

   FOUR STATES, ALWAYS ONE OF THEM. The band renders on every act, including
   the two states that say nothing is happening — an act with no proposal
   against it has to be distinguishable from an act nobody checked, and if the
   line only appeared where there was something to say, its absence would be
   the claim (temporal P4, the same rule that makes commencement's glyph
   unconditional).

   Colour is never the only channel: each state carries a glyph and a word as
   well, and nothing here introduces a colour — each resolves to an existing
   tokens.css trio.

   `unplaced` is loud on purpose and takes the danger trio, not a muted one.
   "A proposal would amend this and we cannot tell you how far it has got" is
   precisely the thing not to be quiet about — the same reasoning that puts
   commencement's `unknown` there. */

[data-upcoming='in_flight'] {
    --up-bg: var(--lx-warning-bg); --up-fg: var(--lx-warning-fg);
    --up-bd: var(--lx-warning-border); --up-solid: var(--lx-warning-solid);
}
[data-upcoming='unplaced'],
[data-upcoming='unknown'] {
    --up-bg: var(--lx-danger-bg); --up-fg: var(--lx-danger-fg);
    --up-bd: var(--lx-danger-border); --up-solid: var(--lx-danger-solid);
}
[data-upcoming='none'],
[data-upcoming='unchecked'],
[data-upcoming='not_applicable'] {
    --up-bg: var(--lx-neutral-bg); --up-fg: var(--lx-neutral-fg);
    --up-bd: var(--lx-neutral-border); --up-solid: var(--lx-neutral-solid);
}

/* `not_applicable` is a statement about the QUESTION, not about the law —
   EUR-Lex names proposals against an EU act's base CELEX, so it has nothing to
   say about a UK act or a consolidated id. Marked the way §26 marks the same
   kind of claim (`.lx-cs-untracked`): a dashed hairline and no fill, an empty
   slot in a register rather than a finding. It must never read as `none`, which
   IS a finding — we asked, and nothing is in flight.

   Doubled up (`.lx-up-band.lx-up-untracked`) so it outranks the `border:`
   shorthand on .lx-up-band and the background on .lx-up-band--quiet, both of
   which come later in this file. */
.lx-up-band.lx-up-untracked {
    background: var(--lx-surface-muted); border-style: dashed;
}
.lx-up-glyph[data-upcoming='not_applicable'] { border-style: dashed; }

/* The band. CONTRACT: it carries `highlight-target`, the same rule as
   .lx-cs-band and for the same reason — its channel is background, and
   .highlight-flash overrides background-color with !important, so a band that
   opted out would keep its colour while everything around it washed cream and
   read as a rendering fault. */
.lx-up-band {
    display: flex; align-items: baseline; gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--up-bg); color: var(--up-fg);
    border: 1px solid var(--up-bd);
    font-family: var(--ss-font-primary); font-size: 0.85rem;
}
.lx-up-band__label { min-width: 120px; white-space: nowrap; font-style: italic; opacity: 0.85; }
.lx-up-band__value { flex: 1; }
.lx-up-band__mark { flex: 0 0 auto; margin-left: auto; }

/* The two quiet states keep the state in the glyph and lose the wash: a page
   that shouts on every act teaches the reader to stop reading the line, and
   then it cannot shout on the act that matters. */
.lx-up-band--quiet {
    background: var(--lx-surface-muted); color: var(--text-color);
    border-color: var(--lx-border);
}

/* Matches .lx-cs-dochead's geometry so the two document-level lines stack as
   one block rather than as two components that happen to be adjacent. */
.lx-up-dochead {
    max-width: 46rem; margin: 0.5rem auto 0; text-align: left;
    border-radius: var(--lx-radius-sm);
}

.lx-up-glyph {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.7em; height: 1.7em; border-radius: var(--lx-radius-pill);
    background: var(--up-bg); color: var(--up-fg); border: 1px solid var(--up-bd);
    font-family: var(--ss-font-primary); font-size: 0.85rem; line-height: 1;
}

/* The proposals themselves. Every one is a citation a reader can follow: the
   CELEX is the link, because a proposal named but not locatable is one the
   reader has to take on trust. */
.lx-up-list { list-style: none; margin: 0.45rem 0 0; padding: 0; }
.lx-up-item {
    display: block; padding: 0.18rem 0; font-size: 0.82rem;
    border-left: 3px solid var(--up-solid); padding-left: 0.55rem;
}
.lx-up-item + .lx-up-item { margin-top: 0.2rem; }
.lx-up-item__cite { font-variant-numeric: tabular-nums; font-weight: 600; }
.lx-up-item__note { color: var(--lx-text-muted); }
/* The reading date the server resolved against, shown rather than implied: a
   derived answer without its as_at is indistinguishable from a fact. */
.lx-up-asat { color: var(--lx-text-muted); font-size: 0.78rem; }

/* ================================================================
   FLASH MESSAGES (issue #1549)
   ================================================================
   `flash()` renders as the first child of <main> on EVERY page, and .header is
   an absolute coral overlay pinned over the top --header-height px at
   z-index 1050. The flash therefore landed *underneath* the nav — visible as a
   sliver, and unclickable, because the header won the hit test.

   But only on the pages that don't pad <main>. Where the page cleared the
   header, the flash sat correctly below it; the bug was confined to the
   full-bleed pages (home hero, pricing, stride, logic), which must NOT pad and
   so left the flash with nothing to sit under.

   It is an OVERLAY, and it lives in the header band itself — not below it.
   Two constraints drove that, and both were measured rather than assumed:

   - Dismissing must not move the page. In flow the message occupies real
     space (74px on a padded page, 170px on a full-bleed hero), so closing it
     snaps everything below it upward. Fixed, closing it changes nothing.
   - Below the header there is nowhere to sit that doesn't cover the page's own
     first row: a centred toast under the nav covers the homepage `Lex-Ray` h1,
     the pricing hero and the admin page headings; top-right lands on the intro
     line; bottom-right on a button. There are only 54px between the header and
     the homepage h1, so lowering the alert's height was not a way out either.

   The header band is, though. `.header_navigation` is empty ("reserved for
   future main nav"), so the middle of the 80px bar is dead space: measured
   1027px of clear width at a 1400px viewport between the wordmark (ending
   ~270px in) and the Sign In button (~142px from the right). The message sits
   there, vertically centred, covering nothing at either end — so the logo and
   the account menu both stay clickable.

   --lx-topbanner-reserved is back because this positions against the VIEWPORT:
   an impersonation / preview-tier banner pushes .header down the page, and
   without that term the message would land on top of the nav instead of in it.

   z-index sits ABOVE the header (1050) and STRICTLY BELOW Bootstrap's modal.
   1051 is deliberately the smallest value that does both, because the repo
   vendors TWO Bootstrap sheets with DIFFERENT modal stacks and only one of
   them ships: base.html links `bootstrap.min.css`, which is **v5.0.1** with a
   literal `.modal { z-index: 1060 }` and `.modal-backdrop { z-index: 1040 }`;
   the unminified `bootstrap.css` sitting beside it is a much newer build whose
   `--bs-modal-zindex` is 1055, and nothing links it. Picking 1051 keeps the
   flash under the dialog whichever sheet is in play, and survives the upgrade
   that eventually retires the mismatch. A tie with the modal would leave "the
   modal covers the flash" resting on DOM order rather than on the stack. A
   flash is a page-load announcement; a modal is opened afterwards and should
   cover it.

   The shipped backdrop is 1040, i.e. BELOW the 1050 header, so the header and
   the flash both stay bright over a dimmed page — which is already true of the
   header today and is not something this rule introduces. */
.flash-messages {
    position: fixed;
    top: var(--lx-topbanner-reserved, 0px);
    /* min-height, not height: one message centres in the 80px band, but Flask
       accumulates flashes (they survive redirects), and a hard height with
       `justify-content: center` makes an overflowing stack grow BOTH ways —
       pushing the first message up past y=0, off the top of the viewport and
       out of reach. Growing downward instead keeps every message on screen. */
    min-height: var(--header-height);
    /* Clear of the wordmark on the left and the account menu on the right —
       and SYMMETRIC, so the message centres on the viewport rather than on the
       gap. The two sides aren't equally wide (the wordmark reaches ~270px in,
       the account menu only ~142px from the right), so insetting each by what
       it actually needs would centre the message 65px right of every centred
       h1 on the page, which reads as crooked. Both sides take the larger
       inset: the right-hand clearance is generous rather than tight. */
    left: 285px;
    right: 285px;
    z-index: 1051;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    /* Only the messages themselves are hit-testable, so the empty band around
       them doesn't steal clicks from the nav underneath. */
    pointer-events: none;
}

.flash-messages > .alert {
    pointer-events: auto;
    margin: 0;
    max-width: 720px;
    /* Slimmer than a page alert so a one-line message clears the 80px band. */
    padding: 0.45rem 2.5rem 0.45rem 0.9rem;
    font-size: 0.875rem;
    box-shadow: var(--lx-shadow-md);
}

.flash-messages > .alert .btn-close {
    padding: 0.6rem;
}

/* Narrow viewports have no dead space to sit in — the wordmark and the account
   menu meet at ~390px and leave under 100px by 500px — so the message drops to
   just below the header and overlays the page. Still fixed, so dismissing it
   still moves nothing. */
@media (max-width: 1099.98px) {
    .flash-messages {
        top: calc(var(--lx-topbanner-reserved, 0px) + var(--header-height) + 0.5rem);
        min-height: 0;
        left: 1rem;
        right: 1rem;
    }
}

/* ================================================================
   19. REMOTE EXPANSION (#1527) — imported meaning inside a definition.

   A definition that cites another instrument now renders as a hybrid:
   the words this act enacted, with the *referenced* act's definiens
   substituted at the reference span. Three kinds of content share one
   line, and the reader has to see which is which at a glance:

     enacted local text  plain — it is the law; never tinted
     imported meaning    .remote-expansion — tinted (marking B, #1583)
     connective tissue   .remote-citation pill, .remote-receipt line

   The rule does all the work with no per-shape special-casing. A simple
   delegation renders as one large tinted block (nearly all imported);
   NIS2 renders as a mostly-plain skeleton with one tinted island inside
   limb (a); a tail carve-out ("except that, for the purposes of Part
   Four…") stands out by being plain *after* a tinted island. The tint
   proportion itself tells the reader how much of the meaning is
   imported — which is exactly the fact the old rendering destroyed.

   Kept to inline boxes (no display:block) because an island can open
   mid-sentence, inside a limb, between two enacted clauses.
   ================================================================ */

/* Marking B (#1583): the tint alone, no left rule. The rule marked the
   *start* of an island, which is the one thing the tint already does, and it
   repeated itself on every wrapped line — on a seven-limb definition with
   eight islands that is a page of vertical bars. The tint proportion is what
   carries the meaning here, and it survives being quieter. */
.remote-expansion {
    background: rgba(var(--color-coral-400-rgb), 0.07);
    border-radius: var(--lx-radius-xs);
    padding: 0.05em 0.25em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* The safety net: an island whose bounds could not be verified is added
   BESIDE the citation rather than replacing anything, so it must not
   read as though it were part of the enacted sentence. */
.remote-expansion-appositive {
    background: none;
    border-left: none;
    padding-left: 0;
    color: var(--lx-text-muted);
    font-style: italic;
}

/* Attribution. Names the REMOTE term, which is what makes the
   misattribution defect (#1527, defect 2) unwritable: there is nowhere
   in this chip for the local term to appear. The anchor inside it is
   the one the markup pipeline already built, so it stays clickable and
   keeps its popover. */
/* The attribution pill (#1583's P3: remote term — instrument, citation).
   Built on `.lx-badge--pill`, which the server now emits alongside this class,
   so there is one pill component and not two.

   Everything below is a delta a badge cannot supply, and each one is load-
   bearing. `display: inline` overrides the badge's `inline-flex`, because this
   chip opens mid-sentence and MUST be able to wrap — a flex box cannot, and an
   eight-island definition would push its pills off the measure. `white-space:
   normal` is the same argument against the badge's `nowrap`. The em-relative
   font-size keeps the chip proportional to the text it annotates, where a badge
   sits in chrome at a fixed size.

   Pre-#1583 rows carry `.remote-citation` WITHOUT the badge classes, so the
   fill and border are restated here rather than inherited: until an act is
   re-enriched its chips would otherwise render unstyled. */
.remote-citation {
    display: inline;
    margin-left: 0.3em;
    padding: 0.15em 0.6em;
    font-size: 0.8125em;
    font-family: var(--badge-font);
    color: var(--lx-neutral-fg);
    background-color: var(--lx-neutral-bg);
    border: 1px solid var(--lx-neutral-border);
    border-radius: var(--lx-radius-pill);
    white-space: normal;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.remote-citation-term {
    font-style: italic;
}

.remote-citation a {
    color: inherit;
    text-decoration: underline dotted;
    text-underline-offset: 0.15em;
}

.remote-citation a:hover {
    color: var(--lx-brand-strong);
}

/* The receipt: the enacted definiens, kept beneath every substituted
   rendering. Substitution rewrites what the reader sees, so the words
   actually enacted stay on the page. */
.remote-receipt {
    font-size: 0.875em;
}


/* ================================================================
   20. FCA PROVISION TYPE — rule vs guidance (#1796)

   The Handbook's central legal distinction, as a badge. It was
   `.celex.css`-local while the reader was its only surface; #1874's
   search panel draws the same marker on a result row, and
   /fca-handbook loads no reader sheet — so the badge is shared and
   the reader's own `.celex-card` rail stays in celex.css beside the
   card it belongs to.

   THREE REDUNDANT CHANNELS, and the redundancy is the requirement.
   Colour alone cannot carry a load-bearing legal distinction: it is
   gone in greyscale print and unreliable for ~8% of male readers.

     1. THE WORD. Each badge spells its category out — the only
        channel that works with no vision of colour or shape at all,
        so it must never be dropped for a tidier chip.
     2. FILL AND BORDER STYLE. A rule is FILLED; everything
        non-binding is outlined, and the outline's style separates
        them further (dashed guidance, double evidential, dotted
        onshored legislation).
     3. COLOUR, last and redundant.

   A provision whose category could not be resolved carries no
   `data-provision-type` and gets none of this.
   Demo: /admin/styleguide §27.
   ================================================================ */

.provision-type {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 0.1rem 0.5rem;
    font-family: var(--badge-font);
    font-weight: var(--badge-font-weight);
    font-size: 0.7rem;
    line-height: 1.6;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--ss-dark);
    background-color: transparent;
    border: 1px solid var(--lx-border-strong);
    border-radius: var(--lx-radius-sm);
}

/* Binding. The one filled badge in the set — an inversion reads as "different
   in kind" at a glance, and it survives greyscale where a hue shift does not. */
.provision-type--rule {
    color: var(--lx-surface);
    background-color: var(--ss-dark);
    border-color: var(--ss-dark);
}

/* Not binding. */
.provision-type--guidance {
    border-style: dashed;
    border-color: var(--lx-text-muted);
}

/* Between the two: not binding in itself, but evidential of the rule it
   relates to. The double border says "two things at once" without a third hue. */
.provision-type--evidential_provision {
    border-style: double;
    border-width: 3px;
    border-color: var(--lx-warning-fg);
}

/* Law, but not an FCA rule. */
.provision-type--uk_provision,
.provision-type--eu_provision {
    border-style: dotted;
    border-color: var(--lx-info-fg);
}

/* The four categories the FCA publishes but has never actually sent on a
   provision (see fca_parser.PROVISION_TYPE_MAP). Styled so they are not
   invisible if one ever arrives, not styled as if we had designed for them. */
.provision-type--principle,
.provision-type--direction,
.provision-type--code {
    border-color: var(--lx-neutral-fg);
}


/* ================================================================
   21. BROWSE SEARCH SUGGESTIONS (#1874) — the sectioned result panel

   The Handbook search bar's dropdown: sections with a title and a
   count, rows that mark the matched span, and one active row the
   arrow keys walk. It composes two shapes that already existed —
   the omni bar's grouped panel (celex_ui.css `.omni-suggest*`,
   styleguide §15) and the rapid-search bar's dropdown geometry
   (autocomplete.css, §24) — into the browse bar, which has two
   potential consumers, so it is shared rather than FCA-local.

   The panel is anchored to `.browse-search`, which browse.css makes
   a positioning context. Nothing here assumes a product: the rows
   are supplied by whoever called `browse_search`.

   #1897 gave the row LINES and an expansion. Three things follow.

   The row is a flex column with a small gap rather than three
   stacked blocks — the citation, the heading and the excerpt are
   three different statements about the hit and they were reading as
   one paragraph.

   The excerpt is capped at two lines and is now centred on the
   match, so it usually occupies ONE: the row is shorter than it was,
   which is the whole reason a list beats a grid of cards here. Twenty
   hits across several sourcebooks in one glance is the affordance,
   and a row that grows to fit a rule would spend it.

   The expanded body is the server's own rendered markup, so almost
   nothing is styled here: only what the reader's celex.css would have
   supplied and this page does not load. A definition anchor arrives
   with its href already removed (it cannot be hydrated here), so it
   is styled as the marked word it now is rather than as a link.
   Demo: /admin/styleguide §28.
   ================================================================ */

.browse-suggest-panel {
    position: absolute;
    z-index: 20;
    /* Same step as the sidebar column's, so the two panels start on one line
       (browse.css declares it; the fallback keeps this rule standalone). */
    top: calc(100% + var(--browse-stack-gap, 10px));
    left: 0;
    right: 0;
    /* The space actually below the panel, not a fraction of the whole
       viewport (#1904). `70vh` is measured from the panel's own top, which
       hangs ~80px down the page, so it stopped 70% of the window BELOW that
       and left a band of dead background under a list clipped mid-row. No CSS
       expression yields "this element's distance to the bottom of the
       window", so `fca_search_panel.js` measures it and writes the number
       here; the fallback is the rule as it was, so a page carrying the markup
       with no controller is unchanged. */
    max-height: var(--browse-suggest-max, 70vh);
    overflow-y: auto;
    background: var(--lx-surface);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
    box-shadow: var(--lx-shadow-md);
}

/* The fold, said to be a fold (#1904). A list cut off flat at the panel's
   edge reads as a rendering fault; the same list under a short fade reads as
   "there is more below". Sticky inside the scroller, so it stays at the
   visible bottom, and pulled back over the content it fades by its own
   height. The controller draws it only while the panel overflows AND
   something is still below — a fade over the end of a fully scrolled list
   would be the same false statement in the other direction. */
.browse-suggest__fade {
    position: sticky;
    bottom: 0;
    height: 1.75rem;
    margin-top: -1.75rem;
    pointer-events: none;
    background: linear-gradient(to top, var(--lx-surface), transparent);
}

.browse-suggest-panel:not(.is-overflowing) .browse-suggest__fade,
.browse-suggest-panel.is-at-end .browse-suggest__fade {
    display: none;
}

.browse-suggest__section + .browse-suggest__section {
    border-top: 1px solid var(--lx-border);
}

.browse-suggest__title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.25rem;
    font-family: var(--ss-font-primary);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--lx-text-muted);
    background: var(--lx-surface-muted);
    position: sticky;
    top: 0;
}

.browse-suggest__count {
    margin-left: auto;
    padding: 0 0.4rem;
    border-radius: var(--lx-radius-pill);
    background: var(--lx-surface-inset);
    font-size: 0.7rem;
    letter-spacing: 0;
}

.browse-suggest__row {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.browse-suggest__row:hover,
.browse-suggest__row--active {
    background: var(--lx-warning-bg);
    border-left-color: var(--lx-brand);
}

/* A control the reader can act on — "show all 159 in COBS", "show 24 more"
   (#1904). It is a `role="option"` row because that is the only thing this
   panel's keyboard route walks: Tab completes the input and dismisses, so
   focus never enters the popup and a button in a section header would have no
   keyboard route at all. It is drawn as an action rather than as a result —
   centred, in the brand's own text colour — so a reader scanning citations
   does not read it as one. */
.browse-suggest__row--action {
    /* `align-items`, not `justify-content`: the row is a flex COLUMN, so the
       main axis is vertical and centring across it is the cross-axis rule. */
    align-items: center;
    padding: 0.45rem 0.75rem;
}

.browse-suggest__action {
    font-family: var(--ss-font-primary);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--lx-brand-strong);
}

/* The controls sit in a section of their own, with no title over them: a
   heading here would head rows that are not results, and since #1901 a number
   sits only over the thing it counts. */
.browse-suggest__section--actions {
    background: var(--lx-surface-muted);
}

.browse-suggest__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.browse-suggest__cite {
    font-family: var(--badge-font);
    font-size: 0.8rem;
    color: var(--ss-dark);
    text-decoration: none;
}

.browse-suggest__row:hover .browse-suggest__cite,
.browse-suggest__row--active .browse-suggest__cite {
    text-decoration: underline;
}

.browse-suggest__heading {
    font-family: var(--ss-font-primary);
    font-size: 0.8rem;
    line-height: 1.3;
    color: var(--lx-text-muted);
}

/* ONE typographic treatment for the two places a row shows the
   provision's own words (#1910). They used to differ — the snippet at
   1.3, the expanded body at 1.45 — so opening a row changed the type
   under the reader mid-sentence. Declared together rather than
   separately with matching values, because two rules that happen to
   agree are two rules that will stop agreeing. The `<mark>` treatment
   is shared already: it is scoped to `.browse-suggest`, which is an
   ancestor of both. */
.browse-suggest__snippet,
.browse-suggest__body {
    font-family: var(--ss-font-primary);
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--ss-dark);
}

/* The matched span in its sentence. Two lines is a CAP, not a
   reservation: the excerpt is built around the match rather than from
   the start of the body, so on a full-width panel it usually takes
   one and the row is shorter than it was before #1897. */
.browse-suggest__snippet {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The expansion control (#1897, redrawn in #1910).

   It was `.sector-chevron`, the shared engine's facet-family toggle,
   which points RIGHT and rotates 90° when open — the wrong direction
   for a control whose body appears below it, and at 0.7rem the
   smallest target on a row whose text is 0.8rem. It is now its own
   control: a chevron pointing the way the body will go, drawn above
   the row's own text size rather than below it, with a target big
   enough to hit. The icon is swapped in the markup, so there is no
   rotation to undo here. */
.browse-suggest__expand {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--lx-radius-sm);
    font-size: 0.95rem;
    line-height: 1;
    color: var(--lx-text-muted);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.browse-suggest__expand:hover {
    color: var(--lx-brand-strong);
    border-color: var(--lx-border);
}

/* An open row's control, drawn as active. The arrow already says which
   state this is — this is the second, redundant signal, for the
   reason §27's badges carry three: colour alone cannot be the
   carrier, and here it is not being asked to be. */
.browse-suggest__expand.is-open {
    color: var(--lx-brand-strong);
}

.browse-suggest__row--loading .browse-suggest__expand {
    opacity: 0.5;
}

.browse-suggest__expand:disabled {
    opacity: 0.35;
    cursor: default;
}

/* The provision, expanded in place: the SERVER's rendered markup, not
   a card drawn here (#1897). It arrives with the reader's own
   structure — numbering gutters, indentation, tables — carried on
   inline styles and Bootstrap utilities, both of which this page
   already has. What it does not have is celex.css, so the few rules
   below stand in for it and nothing more. */
.browse-suggest__body {
    margin-top: 0.35rem;
    padding: 0.5rem 0.65rem;
    max-height: 22rem;
    overflow: auto;
    cursor: auto;
    background: var(--lx-surface-muted);
    border-left: 2px solid var(--lx-border-strong);
    border-radius: var(--lx-radius-sm);
}

.browse-suggest__body p {
    margin-bottom: 0.35rem;
}

.browse-suggest__body p:last-child {
    margin-bottom: 0;
}

/* A defined term whose popover engine is not on this page. The
   fragment arrives with the href already gone (#1770: an anchor that
   cannot be hydrated degrades to its words), so it is drawn as the
   marked word it is — never as something that looks clickable. */
.browse-suggest__body a.definition:not([href]) {
    color: inherit;
    text-decoration: underline dotted;
    text-underline-offset: 0.15em;
}

/* A cross-reference, which IS live: FCA hrefs are absolute reader
   URLs by the time they are rendered, so they resolve from here. */
.browse-suggest__body a[href] {
    color: var(--lx-brand-strong);
}

.browse-suggest__body table {
    width: 100%;
    margin-bottom: 0.5rem;
}

.browse-suggest__body th,
.browse-suggest__body td {
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--lx-border);
    vertical-align: top;
}

.browse-suggest mark {
    padding: 0;
    background: var(--lx-warning-border);
    color: inherit;
}

/* Why a layer has nothing to show. "Not entitled" and "no match"
   are different answers and an empty list cannot tell them apart. */
.browse-suggest__note {
    padding: 0.5rem 0.75rem;
    font-family: var(--ss-font-primary);
    font-size: 0.8rem;
    color: var(--lx-text-muted);
}

/* The catalog behind an open suggestion panel (#1903).

   `!important` for the same reason `.d-none` carries it, and to compose with it:
   the shared engine toggles `.d-none` on these very containers to switch between
   the card and table views, so the two must be able to hide the same element
   without either one's removal revealing it while the other still applies. */
.is-search-suppressed {
    display: none !important;
}

/* A note that is a warning rather than an aside (#1901): the rows above it are
   in document order, not relevance order. Muted grey would set that beside
   "Searched by meaning across COBS", and the two are not the same kind of
   statement — one describes the list, the other corrects what it looks like. */
.browse-suggest__note--warn {
    background: var(--lx-warning-bg);
    color: var(--lx-warning-fg);
    border-top: 1px solid var(--lx-warning-border);
}

/* ================================================================
   22. BETA MARK (#1714) — feature maturity, NOT the AI disclosure.

   The nsx / logic surfaces carry two marks that make completely
   different claims, and a reader who reads one as the other defeats
   both. So they are built to be unmistakable for each other:

     .lx-beta               a WORDED, dashed-outline pill in violet,
                            on the SURFACE's chrome. Commercial: early,
                            free while it is, priced later.
     .ai-provenance-badge   an ICON-ONLY coral/orange pill linking to
                            /ai-transparency, at the CONTENT. Legal:
                            EU AI Act Art 50 (§15 above).

   Different word/icon channel, different outline, different hue,
   different level. Colour is never the only channel: the word "Beta"
   and the dashed border both carry it, so the pill survives greyscale
   and every form of colour-blindness.

   Geometry is entirely the .lx-badge family (§3) — this is a variant of
   the canonical chip, not a second badge idiom. Only the accent trio,
   the dashed rule and the tracking are new.

   Where the two marks unavoidably share a line, .nsx-marks separates
   them with a rule, so they read as two statements rather than one
   compound label. Demo: /admin/styleguide §31 — the pair is reviewed
   TOGETHER there, which is the only way the "must not read as one
   thing" requirement can actually be checked.
   ================================================================ */

.lx-badge.lx-beta {
    background-color: var(--lx-accent-bg);
    color: var(--lx-accent-fg);
    /* Dashed, not solid: the second (non-colour) channel. Provisional
       reads as provisional even with the fill knocked out. */
    border: 1px dashed var(--lx-accent-border);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* The point-of-use statement (#1443): a reader meeting the logic view
   learns HERE that it is free now and priced later, rather than on a
   pricing page nobody visits. Quiet — it is a note, not a banner. */
.lx-beta-note {
    display: flex;
    align-items: baseline;
    gap: 0.5em;
    flex-wrap: wrap;
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--lx-text-muted);
}

.lx-beta-note__text { flex: 1 1 16rem; min-width: 0; }

/* The two marks on one line. The rule is the whole point: without it a
   beta pill sitting flush against a provenance badge reads as one
   compound mark, which is the failure mode this section exists to
   prevent. */
.nsx-marks {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}

.nsx-marks .nsx-prov {
    display: inline-flex;
    align-items: center;
    padding-left: 0.5em;
    border-left: 1px solid var(--lx-neutral-border);
}

/* An ai-assisted provision renders an EMPTY host (the field travels, no
   badge — §5). Collapse it so the divider does not draw a rule against
   nothing. */
.nsx-marks .nsx-prov:empty {
    padding-left: 0;
    border-left: 0;
}

/* The "Doesn't look right?" control (#3161): a quiet text button in the marks
   span. It is a question put to the reader's own judgement, not a warning, so it
   takes the muted text ink and an underline, and only the focus ring is loud. */
/* The own-reading toggle (#3163) is the same quiet text button. */
.nsx-correct,
.nsx-reading-toggle {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 0.78rem;
    color: var(--lx-text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
}

.nsx-correct:hover,
.nsx-reading-toggle:hover { color: var(--lx-accent-fg); }

.nsx-correct:focus-visible,
.nsx-reading-toggle:focus-visible {
    outline: 2px solid var(--lx-accent-border);
    outline-offset: 2px;
    border-radius: 2px;
}

.nsx-marks .nsx-correct {
    padding-left: 0.5em;
    border-left: 1px solid var(--lx-neutral-border);
}

/* The reader's own reading in place of the published one (#3163).

   "Your reading" is the .lx-badge info pill (§3): blue and WORDED, so it
   cannot be taken for the coral, icon-only AI pill or the violet, dashed
   Beta pill beside it. A replaced provision carries `ai-assisted`, whose
   host is empty, so the mark sits straight after Beta. Its toggle is the
   quiet .nsx-reading-toggle text button, ruled off like the correction
   control. Styleguide §31. */
.nsx-marks .nsx-mine { white-space: nowrap; }

/* The stale notice: the published reading moved since the reader's
   started from it. The warning trio, like the reader editor's notice —
   it asks for a decision, and nothing happens until the reader makes one. */
.nsx-stale {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin: var(--space-2) 0;
    padding: var(--space-2) var(--space-3);
    background: var(--lx-warning-bg);
    color: var(--lx-warning-fg);
    border: 1px solid var(--lx-warning-border);
    border-radius: var(--lx-radius-sm);
    font-family: var(--ss-font-primary);
    font-size: 0.85rem;
}
.nsx-stale[hidden],
.nsx-stale [hidden] { display: none; }
.nsx-stale__text { flex: 1 1 18rem; }
.nsx-stale__actions { display: inline-flex; flex-wrap: wrap; gap: var(--space-2); }
.nsx-stale__confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    flex: 1 1 100%;
    padding-top: var(--space-2);
    border-top: 1px solid var(--lx-warning-border);
}
.nsx-stale__compare {
    flex: 1 1 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--lx-surface);
    color: var(--text-color);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-sm);
}

/* Compare: the two statement lists, paired by key. A changed headline is
   word-diffed; colour is never the only channel — removed words are struck
   through and added words underlined. */
.nsx-compare { margin: 0; padding-left: 1.25rem; }
.nsx-compare__summary { margin: 0 0 var(--space-2); color: var(--lx-text-muted); }
.nsx-compare__row { margin-bottom: var(--space-2); }
.nsx-compare__head { display: flex; gap: var(--space-2); align-items: baseline; }
.nsx-compare__key { font-weight: 600; }
.nsx-compare__status { color: var(--lx-text-muted); font-size: 0.8rem; }
.nsx-compare__row--same .nsx-compare__text { color: var(--lx-text-muted); }
.nsx-compare__fields { color: var(--lx-text-muted); font-size: 0.8rem; }
.nsx-compare .diff-delete {
    background: var(--lx-danger-bg);
    color: var(--lx-danger-fg);
    text-decoration: line-through;
}
.nsx-compare .diff-insert {
    background: var(--lx-success-bg);
    color: var(--lx-success-fg);
    text-decoration: underline;
}

/* ================================================================
   25. WIDE TABLES IN LEGISLATION CONTENT (#1986)

   A provision card CLIPS. `.celex-card` carries `content-visibility:
   auto` (celex.css, #1460), whose implied paint containment cuts every
   descendant at the card's padding box, and `contain: layout`, which
   keeps the overrun out of any ancestor's scrollable width. So a table
   wider than its card is not merely awkward — it is painted nowhere and
   reachable by nothing. It was measured that way rather than assumed:
   hit-testing a point past the card's right edge returns the row behind
   the table, and returns the table's own `<th>` the moment
   `content-visibility` is lifted. Both declarations are load-bearing for
   scroll performance on 15MB sourcebooks, so the overrun has to be
   consumed INSIDE the card instead.

   Why this is CSS and not the renderer: a wrapper emitted by
   render_html.py only reaches acts parsed after it lands, and a stored
   tree is not repaired by a parser change. A rule here fixes every act
   already in the database, including the FCA modules this was found on.

   Two shapes reach the reader, and they are kept in SEPARATE rules on
   purpose. An unknown selector invalidates the whole rule it sits in, not
   just its own arm — so grouping these would make a browser without
   `:has()` support drop the FCA scroller too, though the FCA arm needs no
   `:has()` at all. Separated, each degrades only itself.

     - FCA:          .paragraph-content ... figure.table > table
                     (the regulator's own wrapper, kept by fca_markup)
     - EU/UK (#708): .paragraph-content > table.legislation-table

   The FCA arm is a DESCENDANT combinator, also on purpose. render_html.py
   drops the serialised block into .paragraph-content verbatim, and that
   block is not always the figure itself — `<div class="rule"><figure
   class="table">` is a shape the parser tests already pin
   (test_fca_content.py). A child combinator there silently misses exactly
   the nested tables it was written for. The structured arm stays a child
   combinator because render_table emits the table as a direct child, so
   `> table` is the whole truth. Nesting costs nothing either way: a scroll
   container's min-content size is zero in its scrollable axis, so an inner
   figure still lets every ancestor stay at the card's width.
   ================================================================ */

/* --- the scroller, FCA shape ---------------------------------------- */
.paragraph-content figure.table {
    overflow-x: auto;

    /* These boxes are flex items of `.paragraph-container` (`d-flex`), or
       sit inside one. A flex item's automatic minimum size is its
       CONTENT's minimum, which is exactly what lets a wide table push the
       box past the card instead of scrolling inside it. A scroll
       container's automatic minimum is zero, so `overflow-x` above already
       settles it — but the block-level FCA `figure` is not itself the flex
       item, so say it explicitly. */
    min-width: 0;

    /* THE AFFORDANCE. A scroller nobody can see is the unreachable column
       again with extra steps, so the bar is made permanent and given
       contrast rather than left to the platform, which hides overlay
       scrollbars until you already suspect there is something to find.
       Declaring `scrollbar-color` is also what opts Blink out of overlay
       scrollbars, so the cue is present before the first interaction.

       It is self-revealing in the right direction: `overflow-x: auto`
       paints a bar only when the content genuinely overruns, so a table
       that fits gains nothing to look at. */
    scrollbar-width: thin;
    scrollbar-color: var(--lx-border-strong) var(--lx-surface-inset);
}

/* --- the scroller, structured EU/UK shape (#708) --------------------- */
.paragraph-content:has(> table) {
    overflow-x: auto;
    min-width: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--lx-border-strong) var(--lx-surface-inset);
}

/* WebKit/Blink still reads the legacy pseudo-elements, and styling them is
   the other half of forcing a classic, always-drawn bar there. Split for
   the same reason as the rules above. */
.paragraph-content figure.table::-webkit-scrollbar {
    height: 0.5rem;
}

.paragraph-content figure.table::-webkit-scrollbar-track {
    background-color: var(--lx-surface-inset);
    border-radius: var(--lx-radius-pill);
}

.paragraph-content figure.table::-webkit-scrollbar-thumb {
    background-color: var(--lx-border-strong);
    border-radius: var(--lx-radius-pill);
}

.paragraph-content:has(> table)::-webkit-scrollbar {
    height: 0.5rem;
}

.paragraph-content:has(> table)::-webkit-scrollbar-track {
    background-color: var(--lx-surface-inset);
    border-radius: var(--lx-radius-pill);
}

.paragraph-content:has(> table)::-webkit-scrollbar-thumb {
    background-color: var(--lx-border-strong);
    border-radius: var(--lx-radius-pill);
}

/* COLUMN RELATIONSHIPS. Scrolling is chosen over reflow precisely because
   it keeps the grid intact — a transitional provision's end date means
   nothing detached from the material it ends. But scrolling right can
   still carry the row's own identifier off the left edge, so the first
   column is pinned: every cell stays beside the row heading that says
   which provision it belongs to, at any scroll offset.

   `:not(:has([rowspan]))` is the correctness guard, and it is not
   defensive padding. `:first-child` selects the first cell in DOM order,
   which is the first COLUMN only while every row starts one. Under a
   `rowspan` in an earlier column, the rows it covers begin at their
   second column, so pinning their `:first-child` would stick the wrong
   column to the left edge and lay it over the spanning cell — worse than
   not pinning at all. CSS cannot say "first logical column", so the pin
   stands down for any table carrying a rowspan and those tables simply
   scroll, which is the behaviour this issue asked for anyway.

   A pinned cell must be opaque, or the columns sliding beneath it show
   through. It takes the card's own surface rather than the table-header
   wash: neither shape washes its header row here, so a muted pin read as
   a stray grey block against five transparent siblings. The header cell
   sits a layer above the body so the two pinned columns do not fight
   where they meet. */
.paragraph-content figure.table > table:not(:has([rowspan])) > tbody > tr > :first-child,
.paragraph-content figure.table > table:not(:has([rowspan])) > thead > tr > :first-child,
.paragraph-content:has(> table) > table:not(:has([rowspan])) > tbody > tr > :first-child,
.paragraph-content:has(> table) > table:not(:has([rowspan])) > thead > tr > :first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: var(--lx-surface);
}

.paragraph-content figure.table > table:not(:has([rowspan])) > thead > tr > :first-child,
.paragraph-content:has(> table) > table:not(:has([rowspan])) > thead > tr > :first-child {
    z-index: 2;
}

/* Admin-only view switch on public pages (e.g. the recast map's confidence labels). */
.lx-admin-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin: 0 0 var(--space-4);
    padding: var(--space-2) var(--space-4);
    border: 1px dashed var(--lx-border-strong);
    border-radius: var(--lx-radius-pill);
    background: var(--lx-surface-inset);
    font-size: 0.85rem;
    width: fit-content;
    max-width: 100%;
}
.lx-admin-toggle-label { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; font-weight: 600; cursor: pointer; }
.lx-admin-toggle-hint { color: var(--lx-text-muted); }

/* CELL ALIGNMENT. A legislation table reads like the text around it: from
   the top-left of each cell. Two defaults were overriding that.

   Horizontal: the FCA stamps `class="entry text-align-center"` on nearly
   every table cell it serves — 32,634 of the 33,325 in the official-API
   fixtures, header and prose alike, and no cell carries any other
   `text-align-*` class — and ss-main.css's `.text-align-center` utility
   obliges, centring whole paragraphs of rule text. A class on every cell
   says nothing about any one of them, so it is boilerplate, not meaning.
   The cell's own inline `text-align` (which fca_markup keeps, #1703) is the
   regulator stating an alignment, and an inline style still beats this.

   Vertical: the history panel's clean wording (fca_history_definitions.js)
   is an allow-listed projection that drops every class, Bootstrap's
   `.table` with them, so its cells fell back to the user agent's
   `tbody { vertical-align: middle }` — a row number floating halfway down
   beside a tall neighbour. Stating `top` here makes both surfaces say the
   same thing rather than agreeing by accident. */
:is(.paragraph-content, .fhr-clean) :is(td, th) {
    vertical-align: top;
    text-align: start;
}

/* ================================================================
   READER NSX EDITOR (#3162) — a reader's own reading, in a modal.

   The Semantic Studio structure editor, mounted for a reader by
   nsx_reader_editor.js (`mountReaderEditorPanes` in semantic_studio.js).
   The editor's own components (statement cards, span chips, issue rows,
   the card preview) are the Studio's and stay in semantic_studio.css;
   this is only the LAYOUT that fits them into the correction modal
   (#3161), three panes rather than the Studio's four:

     ┌ bar: status · span target · Undo · Discard · Save · Send ┐
     ├ notice (409 / discard confirm), hidden when empty         ┤
     ├ prose          │ structure         │ preview              ┤
     │ (the text)     │ (the editable     │ (the reader's card)  │
     │                │  tree)            │                      │
     └────────────────┴───────────────────┴──────────────────────┘

   "Read the text, edit the tree, see the card": three columns side by
   side, each scrolling on its own. Below the md breakpoint the three
   stack. The bar is re-skinned from the Studio's dark admin chrome to the house surface,
   because this sits inside a reader page. Styleguide §33.
   ================================================================ */
.lx-reader-editor {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-family: var(--ss-font-primary);
    color: var(--text-color);
}

.lx-reader-editor .lx-reader-editor__bar {
    position: static;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--lx-surface-muted);
    color: var(--text-color);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-sm);
}
.lx-reader-editor .lx-reader-editor__bar .ss-status,
.lx-reader-editor__focus { color: var(--lx-text-muted); }
.lx-reader-editor .lx-reader-editor__bar .ss-focus { color: var(--ss-dark); }
.lx-reader-editor .lx-reader-editor__bar button,
.lx-reader-editor .lx-reader-editor__notice button {
    margin: 0;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--lx-border-strong);
    border-radius: var(--lx-radius-sm);
    background: var(--lx-surface);
    color: var(--text-color);
    font: inherit;
    cursor: pointer;
}
.lx-reader-editor .lx-reader-editor__bar #ss-save,
.lx-reader-editor .lx-reader-editor__notice .lx-reader-editor__notice-primary {
    background: var(--lx-brand);
    border-color: var(--lx-brand);
    color: var(--lx-on-brand);
}
.lx-reader-editor .lx-reader-editor__bar #ss-send {
    border-color: var(--lx-brand);
    color: var(--lx-brand-fg);
}
.lx-reader-editor .lx-reader-editor__bar #ss-discard { color: var(--lx-danger-fg); }
.lx-reader-editor .lx-reader-editor__bar button:disabled { opacity: 0.55; cursor: not-allowed; }

.lx-reader-editor__notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--lx-warning-bg);
    color: var(--lx-warning-fg);
    border: 1px solid var(--lx-warning-border);
    border-radius: var(--lx-radius-sm);
}
.lx-reader-editor__notice[hidden] { display: none; }
.lx-reader-editor__notice > span { flex: 1 1 18rem; }

.lx-reader-editor__panes {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: 'prose structure preview';
    block-size: min(76vh, 56rem);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-sm);
    overflow: hidden;
}
.lx-reader-editor .lx-reader-editor__prose { grid-area: prose; border-right: 1px solid var(--lx-border); }
.lx-reader-editor .lx-reader-editor__preview { grid-area: preview; border-right: 0; }
.lx-reader-editor .lx-reader-editor__structure {
    grid-area: structure;
    border-right: 1px solid var(--lx-border);
}

/* Only the statement the reader flagged is shown; this says so and offers the rest. */
.lx-reader-editor .ss-scope-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    margin-bottom: var(--space-2);
    color: var(--lx-text-muted);
    font-size: 0.875rem;
}

/* Toasts sit inside the editor: a page-fixed host would be under the modal. */
.lx-reader-editor .ss-toast-host {
    position: absolute;
    right: var(--space-3);
    bottom: var(--space-3);
    z-index: 2;
}

@media (max-width: 767.98px) {
    .lx-reader-editor__panes {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        grid-template-areas: 'prose' 'structure' 'preview';
        block-size: auto;
    }
    .lx-reader-editor .lx-reader-editor__prose,
    .lx-reader-editor .lx-reader-editor__structure,
    .lx-reader-editor .lx-reader-editor__preview {
        max-block-size: 50vh;
        border-right: 0;
    }
    .lx-reader-editor .lx-reader-editor__structure,
    .lx-reader-editor .lx-reader-editor__preview {
        border-top: 1px solid var(--lx-border);
    }
}

/* --- Pill nav (period / range switcher) ------------------------------------
   A short row of links choosing ONE of a few ranges ("4w 6w 8w 12w", "Week
   Month"). The active pill is the brand fill; the rest sit on a muted track.
   Links, not buttons: each choice is a URL, so it is shareable and
   back-button safe. Mark the current one with `.active` and aria-current. */
.lx-pill-nav {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--lx-surface-muted);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-pill);
}

.lx-pill-nav__item {
    padding: 0.25rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--lx-text-muted);
    text-decoration: none;
    border-radius: var(--lx-radius-pill);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lx-pill-nav__item:hover {
    background: var(--lx-surface-inset);
    color: var(--ss-dark);
    text-decoration: none;
}

/* The same pill as a <button> (an in-page flip rather than a link). */
button.lx-pill-nav__item {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

/* A choice that cannot be made yet: say why in a title, never in the mouse cursor. */
.lx-pill-nav__item[aria-disabled='true'],
.lx-pill-nav__item[aria-disabled='true']:hover {
    background: transparent;
    color: var(--lx-text-muted);
    opacity: 0.55;
    text-decoration: line-through;
}

.lx-chart-panel__toggle { margin-bottom: var(--space-2); }

.lx-pill-nav__item:focus-visible {
    outline: 2px solid var(--lx-brand);
    outline-offset: 2px;
}

.lx-pill-nav__item.active,
.lx-pill-nav__item.active:hover {
    background: var(--lx-brand);
    color: var(--lx-on-brand);
    font-weight: 600;
    box-shadow: var(--lx-shadow-sm);
}

/* --- KPI tiles (scorecard row) ------------------------------------------------
   A row of headline numbers, each this period against the one before (#3444).
   `.lx-kpi__value` is the number; `.lx-kpi__change` the raw difference, coloured
   by direction only as a second channel (the arrow and the sign carry it first);
   `.lx-kpi__meta` the small lines under it; `.lx-kpi__badge` says which filters
   the number was drawn under. A tile with nothing to measure uses
   `.lx-kpi--empty` and says why in `.lx-kpi__empty`, never shows a zero.
   `.lx-kpi__target` appears only when a target has been set. #3470 adds the
   tile's icon (`.lx-kpi__icon`), a sparkline (`.lx-kpi__spark`), the delta's
   state as a modifier (`--up/--down/--flat/--thin/--in_progress`, each with
   its own icon) and the detail lines collapsed in `.lx-kpi__more`. */
.lx-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    gap: var(--space-3);
}

.lx-kpi {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
    padding: var(--space-3) var(--space-4);
    background: var(--lx-surface);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
}

.lx-kpi--lead {
    border-color: var(--lx-brand-border);
    box-shadow: inset 4px 0 0 var(--lx-brand);
}

.lx-kpi__label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--lx-text-muted);
}

.lx-kpi__value {
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--ss-dark);
}

.lx-kpi__unit {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--lx-text-muted);
}

.lx-kpi__change {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--lx-text-muted);
}

.lx-kpi__change .fa-solid { margin-right: 0.3em; }
.lx-kpi__change--up { color: var(--lx-success-fg); }
/* Down is stated, not alarmed (#3470): the icon and the sign carry it. */
.lx-kpi__change--down,
.lx-kpi__change--flat { color: var(--lx-text-muted); }
.lx-kpi__change--thin,
.lx-kpi__change--in_progress { color: var(--lx-info-fg); }

.lx-kpi__icon {
    margin-right: 0.4em;
    color: var(--lx-brand);
}

/* 12-week sparkline under the value; drawn by assets/js/analytics_charts.js. */
.lx-kpi__spark {
    position: relative;
    block-size: 2.75rem;
    margin: var(--space-1) 0;
}

/* Two tiles a row on a phone, so the charts are not seven screens down. */
@media (max-width: 560px) {
    .lx-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
    .lx-kpi { padding: var(--space-2) var(--space-3); }
    .lx-kpi__value { font-size: 1.6rem; }
    .lx-kpi__label { font-size: 0.7rem; }
}

.lx-kpi__more > summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--lx-text-muted);
}

.lx-kpi__meta {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
    color: var(--lx-text-muted);
    overflow-wrap: anywhere;
}

.lx-kpi__target,
.lx-kpi__now {
    font-size: 0.8rem;
    color: var(--lx-info-fg);
}

.lx-kpi__empty {
    font-size: 0.85rem;
    color: var(--lx-text-muted);
    font-style: italic;
}

/* A scope note, not a label: it can run to two lines, and a full pill radius turns a
   wrapped chip into an oval. Small radius, the house badge face, and it may wrap. */
.lx-kpi__badge {
    margin-top: auto;
    align-self: flex-start;
    max-width: 100%;
    padding: 0.15rem 0.5rem;
    font-family: var(--badge-font);
    font-size: 0.7rem;
    line-height: 1.35;
    color: var(--lx-neutral-fg);
    background: var(--lx-neutral-bg);
    border: 1px solid var(--lx-neutral-border);
    border-radius: var(--lx-radius-sm);
}

/* --- Inline bar (a proportion drawn inside a table cell) ----------------------
   Ranks a column by eye without a chart: set `--lx-bar` (0-100) inline on the
   `.lx-bar` element; the number beside it carries the value, so the bar is an
   aid and never the only channel. */
.lx-bar {
    display: inline-block;
    inline-size: 6rem;
    max-inline-size: 100%;
    block-size: 0.5rem;
    vertical-align: middle;
    background: var(--lx-surface-inset);
    border-radius: var(--lx-radius-pill);
    overflow: hidden;
}

.lx-bar::before {
    content: '';
    display: block;
    block-size: 100%;
    inline-size: calc(var(--lx-bar, 0) * 1%);
    background: var(--lx-brand);
}

/* --- Chart panels (growth scorecard and dashboard, #3470) ---------------------
   A chart first, its table collapsed beneath it. `.lx-chart-grid` lays panels
   two up on a wide screen and one up on a phone; `--wide` spans both columns.
   `.lx-chart` gives a canvas a fixed height that INCLUDES its axes (Chart.js
   draws them inside the canvas), so nothing scrolls inside the card. The
   `<details class="lx-data">` holds the canonical table: the chart's text
   equivalent and the exact numbers. Colours come from the --lx-chart-* tokens,
   read by assets/js/analytics_charts.js. */
.lx-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr));
    gap: var(--space-4);
    margin: var(--space-5) 0;
}

.lx-chart-panel {
    min-width: 0;
    padding: var(--space-4);
    background: var(--lx-surface);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
}

.lx-chart-panel--wide { grid-column: 1 / -1; }

.lx-chart-panel__title {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 0 0 var(--space-1);
    font-size: var(--lx-h5);
    font-weight: 600;
}

.lx-chart-panel__title .fa-solid { color: var(--lx-brand); font-size: 0.9em; }

.lx-chart-panel__note {
    margin: 0 0 var(--space-3);
    font-size: 0.8rem;
    color: var(--lx-text-muted);
}

.lx-chart-panel__empty {
    margin: var(--space-4) 0;
    color: var(--lx-text-muted);
    font-style: italic;
}

.lx-chart { position: relative; inline-size: 100%; }
.lx-chart--sm { block-size: 11rem; }
.lx-chart--md { block-size: 16rem; }
.lx-chart--lg { block-size: 21rem; }

.lx-data { margin-top: var(--space-3); }

.lx-data > summary {
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--lx-text-muted);
}

.lx-data > summary .fa-solid { margin-right: 0.4em; }
.lx-data[open] > summary { margin-bottom: var(--space-2); }

/* Small multiples: one tiny chart per series, same axes. */
.lx-multiples {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
    gap: var(--space-3) var(--space-4);
}

.lx-multiples__item { min-width: 0; }

.lx-multiples__title {
    display: block;
    font-size: 0.75rem;
    color: var(--lx-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lx-multiples__title strong { color: var(--ss-dark); font-weight: 600; }
.lx-multiples__chart { position: relative; block-size: 5.5rem; }

/* --- Bullet rows: a rate beside a published range ----------------------------
   Set `--lx-bullet-lo`, `--lx-bullet-hi` and `--lx-bullet-v` (0-100, each a
   share of the row's own scale) inline on `.lx-bullet__track`. The band is a
   reference, never a target; the words beside it carry the value, so the
   track is never the only channel. */
.lx-bullets { list-style: none; margin: 0; padding: 0; }

.lx-bullet {
    display: grid;
    grid-template-columns: minmax(9rem, 14rem) minmax(8rem, 1fr) minmax(12rem, 17rem);
    align-items: center;
    gap: var(--space-1) var(--space-4);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--lx-border);
    font-size: 0.85rem;
}

.lx-bullet__metric { font-weight: 600; }

.lx-bullet__track {
    position: relative;
    block-size: 0.875rem;
    background: var(--lx-surface-muted);
    border-radius: var(--lx-radius-xs);
}

.lx-bullet__band {
    position: absolute;
    inset-block: 0;
    inset-inline-start: calc(var(--lx-bullet-lo) * 1%);
    inline-size: max(3px, calc((var(--lx-bullet-hi) - var(--lx-bullet-lo)) * 1%));
    background: var(--lx-chart-band);
    border-inline: 1px solid var(--lx-chart-band-edge);
}

.lx-bullet__mark {
    position: absolute;
    inset-block: -0.2rem;
    inset-inline-start: calc(var(--lx-bullet-v) * 1%);
    inline-size: 4px;
    margin-inline-start: -2px;
    background: var(--lx-chart-1);
    border-radius: 2px;
    box-shadow: 0 0 0 2px var(--lx-surface);
}

.lx-bullet__read { font-variant-numeric: tabular-nums; }

.lx-bullet__few,
.lx-bullet__source {
    grid-column: 2 / -1;
    font-size: 0.75rem;
    color: var(--lx-text-muted);
}

.lx-bullet__few .fa-solid { margin-right: 0.4em; color: var(--lx-info-fg); }

@media (max-width: 640px) {
    .lx-bullet { grid-template-columns: 1fr; }
    .lx-bullet__few,
    .lx-bullet__source { grid-column: 1; }
}

/* --- Dot strip: one mark per week ---------------------------------------------
   `--researching` filled, `--active` ringed, bare = not seen that week. */
.lx-dots { display: inline-flex; gap: 3px; vertical-align: middle; }

.lx-dots__dot {
    inline-size: 0.6rem;
    block-size: 0.6rem;
    border-radius: 50%;
    background: var(--lx-surface-inset);
}

.lx-dots__dot--researching { background: var(--lx-chart-1); }
.lx-dots__dot--active { background: transparent; box-shadow: inset 0 0 0 2px var(--lx-chart-1); }

/* --- Entry card: the dashboard's way into the scorecard ------------------------ */
.lx-entry {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) repeat(3, minmax(0, 1fr)) auto;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    margin-bottom: var(--space-5);
    padding: var(--space-4) var(--space-5);
    background: var(--lx-surface);
    border: 1px solid var(--lx-brand-border);
    border-radius: var(--lx-radius-lg);
    box-shadow: inset 4px 0 0 var(--lx-brand), var(--lx-shadow-sm);
}

.lx-entry__title { margin: 0; font-size: var(--lx-h4); font-weight: 600; }
.lx-entry__title .fa-solid { color: var(--lx-brand); margin-right: 0.4em; }
.lx-entry__lead { margin: var(--space-1) 0 0; font-size: 0.8rem; color: var(--lx-text-muted); }
.lx-entry__figure { min-width: 0; }

.lx-entry__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--lx-text-muted);
}

.lx-entry__value { font-size: 1.75rem; font-weight: 600; line-height: 1.1; color: var(--ss-dark); }
.lx-entry__when { font-size: 0.75rem; color: var(--lx-text-muted); }
.lx-entry__spark { position: relative; block-size: 2.25rem; }

@media (max-width: 900px) {
    .lx-entry { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lx-entry__intro,
    .lx-entry__go { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
    .lx-entry { grid-template-columns: 1fr; padding: var(--space-4); }
}

/* ================================================================
   PERSON PICKER (#3420) — THE way to choose a person: a text input whose
   value is the chosen email, with a type-ahead list of people (avatar +
   name + email, an offline badge, a role). Rendered by the
   `person_picker()` macro (includes/person_picker_macros.html) and wired
   by person_picker.js; the list comes from /api/people/search, whose
   SCOPE the server decides. Rows reuse §13's avatar, so a person looks
   the same in a list as in a card. Demo: /admin/styleguide §35.
   ================================================================ */
.lx-picker {
    position: relative;
}

/* Fixed, positioned from the input by person_picker.js, so a table cell or a
   scrolling modal body never clips it. Above a modal (1060) and the flash
   overlay (1051); below nothing that should cover a menu. */
.lx-picker__list {
    position: fixed;
    z-index: 1080;
    max-height: 18rem;
    overflow-y: auto;
    margin: 0;
    padding: var(--space-1) 0;
    list-style: none;
    background: var(--lx-surface);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
    box-shadow: var(--lx-shadow-md);
}

.lx-picker__list[hidden] {
    display: none;
}

.lx-picker__option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
}

.lx-picker__option--active {
    background: var(--lx-surface-muted);
}

.lx-picker__option--disabled {
    cursor: default;
    opacity: 0.55;
}

.lx-picker__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.lx-picker__name {
    font-weight: 600;
}

.lx-picker__email,
.lx-picker__hint {
    color: var(--lx-text-muted);
    font-size: 0.85em;
}

.lx-picker__option > .lx-person__role,
.lx-picker__option > .lx-badge,
.lx-picker__option > .lx-picker__hint {
    margin-left: auto;
    flex-shrink: 0;
}

.lx-picker__option--free {
    border-top: 1px solid var(--lx-border);
}

.lx-picker__empty {
    padding: var(--space-2) var(--space-3);
    color: var(--lx-text-muted);
    font-size: 0.9em;
}

/* ================================================================
   PUBLISHER-BEHIND NOTICE (#3726) — the official text is missing a change
   in force (EUR-Lex has not consolidated an amending act; legislation.gov.uk
   has not applied an effect). The text is still served; this says what it
   is missing, under the act's header. Amber with a dotted edge: the same
   pairing as the freshness pill's "publisher behind" (§36).
   ================================================================ */
.lx-publisher-notice {
    max-width: 48rem;
    margin: var(--space-2) auto var(--space-3);
    padding: var(--space-2) var(--space-3);
    text-align: left;
    background: var(--lx-warning-bg);
    color: var(--lx-warning-fg);
    border: 1px dotted var(--lx-warning-fg);
    border-radius: var(--lx-radius-sm);
    font-size: 0.9rem;
}
.lx-publisher-notice p { margin: 0 0 var(--space-1); }
.lx-publisher-notice p:last-child { margin-bottom: 0; }
.lx-publisher-notice a { color: inherit; text-decoration: underline; }

/* ================================================================
   FRESHNESS CHIP (#3728) — how old the last check of the act's text is, an icon at the end
   of the Lens's footer (or beside the title when the page has no Lens). Rendered by the server
   (freshness_view.chip_html) with its receipt in an .lx-info-* panel; freshness_tick.js moves
   it to its next state as the clock passes its instants, and opens it on a tap. Colour is never
   the only channel: the SHAPE of the icon carries the state. Demo: /admin/styleguide §36.
   ================================================================ */
.lx-freshness-slot[hidden] { display: none; }
.lx-freshness-slot--foot {
    display: inline-flex;
    margin-left: auto;
    position: relative;
}
/* Beside the title, where a page has no Lens to hold the chip. */
.heading-title + .lx-freshness-slot { display: flex; justify-content: center; margin: 0 0 var(--space-2); }
.heading-title + .lx-freshness-slot .lx-info-panel { right: auto; left: 50%; transform: translateX(-50%); }
/* A quiet icon: no ring, no fill. Fixed size, so nothing moves when it is drawn. */
.lx-freshness {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--lx-text-muted);
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
}
.lx-freshness:hover { color: var(--ss-dark); }
.lx-freshness[data-freshness="current"] { color: var(--lx-success-fg); opacity: 0.7; }
.lx-freshness[data-freshness="current"]:hover { opacity: 1; }
.lx-freshness[data-freshness="stale"] { color: var(--lx-warning-fg); }
/* The states that mean the text is, or may be, wrong keep a tinted disc: not for skimming. */
.lx-freshness[data-freshness="publisher_behind"],
.lx-freshness[data-freshness="not_verified"],
.lx-freshness[data-freshness="out_of_date"] { width: 1.5rem; height: 1.5rem; border: 1px solid transparent; }
.lx-freshness[data-freshness="publisher_behind"] {
    background: var(--lx-warning-bg); color: var(--lx-warning-fg); border: 1px dotted var(--lx-warning-fg);
}
.lx-freshness[data-freshness="not_verified"] {
    background: var(--lx-warning-bg); color: var(--lx-warning-fg); border: 1px dashed var(--lx-warning-fg);
}
.lx-freshness[data-freshness="out_of_date"] {
    background: var(--lx-danger-bg); color: var(--lx-danger-fg); border-color: var(--lx-danger-border);
}
.lx-freshness:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* The receipt. Labels in the house sans as quiet small caps, values in the mono stack, so a
   timestamp reads as a record and lines up row to row. Nothing is clipped: the panel's hover
   bridge (::before) hangs outside it, and the head takes the panel's corners itself. */
.lx-freshness-receipt.lx-info-panel { width: 26rem; max-width: min(26rem, 80vw); padding: 0; }
/* The head carries the state's colour, as the commencement receipts' head carries a provision's. */
.lx-freshness-receipt[data-freshness="current"] {
    --cs-bg: var(--lx-success-bg); --cs-fg: var(--lx-success-fg); --cs-bd: var(--lx-success-border);
}
.lx-freshness-receipt[data-freshness="stale"],
.lx-freshness-receipt[data-freshness="publisher_behind"],
.lx-freshness-receipt[data-freshness="not_verified"] {
    --cs-bg: var(--lx-warning-bg); --cs-fg: var(--lx-warning-fg); --cs-bd: var(--lx-warning-border);
}
.lx-freshness-receipt[data-freshness="out_of_date"] {
    --cs-bg: var(--lx-danger-bg); --cs-fg: var(--lx-danger-fg); --cs-bd: var(--lx-danger-border);
}
.lx-freshness-receipt__head {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--cs-bg); color: var(--cs-fg); border-bottom: 1px solid var(--cs-bd);
    border-radius: var(--lx-radius-md) var(--lx-radius-md) 0 0;
    font-size: 0.85rem; font-weight: 600;
}
.lx-freshness-receipt__body { padding: var(--space-2) var(--space-3) var(--space-3); }
.lx-freshness-receipt__foot { display: block; margin-top: var(--space-2); font-size: 0.82rem; }
.lx-freshness-receipt__rows {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-2) var(--space-4);
    align-items: baseline;
    margin: var(--space-2) 0 0;
    padding: 0;
}
.lx-freshness-receipt__row { display: contents; }
.lx-freshness-receipt__row dt {
    font-family: var(--ss-font-primary);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--lx-text-muted);
}
.lx-freshness-receipt__row dd { margin: 0; font-size: 0.85rem; color: var(--ss-dark); }
.lx-freshness-receipt__mono {
    font-family: var(--font-stack-mono);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
.lx-freshness-receipt__none { font-size: 0.75rem; color: var(--lx-text-muted); }
.lx-freshness-receipt__rel:not(:empty) { margin-left: var(--space-2); font-size: 0.75rem; color: var(--lx-text-muted); }

/* The whole-act withheld notice: an apology and an explanation, set as prose, not a status
   strip. Same family as the per-provision notice, but it has the page to itself. It prints
   the last check's receipt as the same table the chip's popover does. */
.lx-integrity-notice--act {
    max-width: 44rem;
    margin: var(--space-6) auto;
    padding: var(--space-5) var(--space-6);
    background: var(--lx-surface-muted);
    color: var(--text-color);
    border: 1px solid var(--lx-border);
    border-left: 4px solid var(--lx-warning-border);
    border-radius: var(--lx-radius-sm);
    font-family: var(--ss-font-primary);
    line-height: 1.55;
}
.lx-integrity-notice--act .lx-integrity-notice__title {
    margin: 0 0 var(--space-3);
    font-size: var(--lx-h4);
    font-weight: var(--lx-heading-weight);
    color: var(--ss-dark);
}
.lx-integrity-notice--act p { margin: 0 0 var(--space-3); }
.lx-integrity-notice--act .lx-integrity-notice__action { margin-bottom: 0; font-weight: 600; }
/* An act withheld whole has no floodlight and no second column: the card takes the page and
   sits in the middle of it. Keyed on the notice in the markup, so it holds from the first frame
   the preview paints, before any script has run or the payload has arrived. */
.row:has(> #legislation-column #legislation > .lx-integrity-notice--act) > #floodlight-column {
    display: none;
}
.row:has(> #legislation-column #legislation > .lx-integrity-notice--act) > #legislation-column {
    flex: 0 0 100%;
    max-width: 100%;
}
.lx-integrity-notice--act .lx-ago { color: var(--lx-text-muted); }
.lx-integrity-notice__receipt {
    margin: var(--space-4) 0;
    border-top: 1px solid var(--lx-border);
    border-bottom: 1px solid var(--lx-border);
}
.lx-integrity-notice__receipt-title {
    margin: var(--space-3) 0 0;
    font-family: var(--ss-font-primary);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--lx-text-muted);
}
.lx-integrity-notice__receipt .lx-freshness-receipt__rows { margin: 0; padding: var(--space-3) 0; }

/* ================================================================
   37. CONSENT PROMPT (#4600) — the ad-measurement question for a
   visitor who arrived from one of our ads, and the choice switch
   that changes the answer on the profile page and in the privacy
   notice. Built by assets/js/ad_consent.js.
   Non-modal: no backdrop, no focus trap, the page stays usable. It
   sits in the bottom-left corner on a wide screen and along the
   bottom on a phone, and while it is open a spacer of its height
   ends the page (`.lx-consent-spacer`), so nothing is left under
   it. Two equal buttons in the same skin; neither is pre-selected.
   ================================================================ */
.lx-consent {
    position: fixed;
    left: var(--space-4);
    bottom: var(--space-4);
    z-index: 1040; /* above the sliding footer (1030), under modals (1050) */
    width: min(26rem, calc(100vw - 2 * var(--space-4)));
    padding: var(--space-4) var(--space-5);
    background: var(--lx-surface);
    color: var(--ss-dark);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius-md);
    box-shadow: var(--lx-shadow-lg);
    font-family: var(--ss-font-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}
.lx-consent__title {
    margin: 0 var(--space-6) var(--space-2) 0;
    font-size: var(--lx-h5);
    font-weight: 600;
    color: var(--ss-dark);
}
.lx-consent__title:focus { outline: none; }
.lx-consent__status { margin: 0 0 var(--space-2); font-weight: 600; }
.lx-consent__text { margin: 0 0 var(--space-2); }
.lx-consent__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin: var(--space-3) 0 var(--space-2);
}
.lx-consent__more { margin: 0; font-size: 0.8rem; color: var(--lx-text-muted); }
.lx-consent__more a { color: inherit; text-decoration: underline; }
.lx-consent__close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: var(--lx-radius-sm);
    background: transparent;
    color: var(--lx-text-muted);
    font-size: 1.25rem;
    line-height: 1;
}
.lx-consent__close:hover,
.lx-consent__close:focus-visible { background: var(--lx-surface-inset); color: var(--ss-dark); }
.lx-consent .lx-consent__narrow { display: none; }
.lx-consent-spacer { pointer-events: none; }

/* The styleguide's specimen sits in its section, not over the page. */
.lx-consent--specimen { position: relative; left: auto; bottom: auto; z-index: auto; }

@media (max-width: 575.98px) {
    .lx-consent {
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        padding: var(--space-3) var(--space-4);
        border-radius: var(--lx-radius-md) var(--lx-radius-md) 0 0;
        border-bottom: 0;
    }
    .lx-consent .lx-consent__wide { display: none; }
    .lx-consent .lx-consent__narrow { display: inline; }
    .lx-consent p.lx-consent__narrow { display: block; }
    .lx-consent__actions { margin-top: var(--space-2); }
}

/* The styleguide's phone specimen: the narrow wording at any width, in place. */
.lx-consent--specimen-narrow { width: min(22rem, 100%); }
.lx-consent--specimen-narrow .lx-consent__wide { display: none; }
.lx-consent--specimen-narrow .lx-consent__narrow { display: inline; }
.lx-consent--specimen-narrow p.lx-consent__narrow { display: block; }

/* The platforms the prompt names only as "the platforms we advertise on": a
   link to the privacy notice's table of them. */
.lx-consent__platforms { color: inherit; font-weight: 600; text-decoration: underline; }

/* The choice switch (#4600): the same question's answer, given or changed on
   the profile page and in the privacy notice's Advertising section. In the
   page's flow, not fixed. The current answer is the pressed button; neither is
   pressed while unanswered, so the two still read as equals. */
.lx-consent-switch { max-width: 30rem; margin: var(--space-3) 0; }
.lx-consent-switch__ask { margin: 0 0 var(--space-2); }
.lx-consent-switch__status { margin: 0 0 var(--space-2); font-weight: 600; }
.lx-consent-switch__actions { margin: 0; }
.lx-consent-switch .lx-consent__choice[aria-pressed="true"] {
    border-color: var(--lx-accent-border);
    background: var(--lx-accent-bg);
    color: var(--lx-accent-fg);
}
.lx-consent-switch .lx-consent__choice[aria-pressed="true"]::before { content: "\2713\00a0"; }
