/* =================================================================
   WF Portal — Component & Utility Framework
   -----------------------------------------------------------------
   Replaces Bootstrap CSS. All values reference --theme-* tokens
   from root.css. Same class names — zero .razor file changes.
   ================================================================= */

/* =================================================================
   Reset
   ================================================================= */

*, *::before, *::after { box-sizing: border-box; }

body { margin: 0; line-height: 1.5; -webkit-text-size-adjust: 100%; }

hr {
    margin: 1rem 0;
    border: 0;
    border-top: 1px solid var(--theme-border);
    opacity: .5;
}

/* =================================================================
   Buttons (portal-look-and-feel 3.12)
   -----------------------------------------------------------------
   36px default / 30px .btn-sm / 44px .btn-lg, 14px padding, 13/600,
   a 7px icon gap, the tenant's button radius (pills on a pill tenant,
   square on Sharp), 1px down when pressed, a 2px primary-ink focus
   outline. ONE .btn-primary per view; everything else is quiet.
   .btn-secondary and the .btn-outline-* family are now the QUIET
   shape (card fill + a strong hairline) so the 400+ uses restyle
   without markup churn; an outline variant keeps its meaning in its
   INK (primary / danger / success / warning / info), never as a
   coloured slab.
   ================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0.4375rem 0.875rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--theme-text);
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: var(--wf-radius-sm);
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background-color var(--theme-transition), border-color var(--theme-transition),
        color var(--theme-transition), box-shadow var(--theme-transition), transform var(--theme-transition);
    vertical-align: middle;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; box-shadow: none; }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }

.btn-primary {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
    color: var(--theme-text-on-primary);
    box-shadow: var(--wf-elev-1);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--theme-primary-hover);
    border-color: var(--theme-primary-hover);
    /* Preserve on-primary text color on hover. Defense in depth — even
       if a future global :hover rule tries to override (this happened on
       a:hover in root.css; fixed there too with :not(.btn)), this rule
       still holds. */
    color: var(--theme-text-on-primary);
}

/* THE QUIET BUTTON - the house secondary: the card fill, a strong hairline, emphasis text.
   .btn-secondary / .btn-outline-secondary / .btn-outline-light / .btn-dark are its aliases. */
.btn-quiet,
.btn-secondary,
.btn-outline-secondary,
.btn-outline-light,
.btn-dark {
    background-color: var(--wf-card);
    border-color: var(--wf-line-strong);
    color: var(--theme-text-emphasis);
}
.btn-quiet:hover, .btn-quiet:focus,
.btn-secondary:hover, .btn-secondary:focus,
.btn-outline-secondary:hover, .btn-outline-secondary:focus,
.btn-outline-light:hover,
.btn-dark:hover {
    background-color: var(--wf-card-hover);
    border-color: var(--wf-line-strong);
    color: var(--theme-text-emphasis);
}

/* THE GHOST BUTTON - text-only primary ink ("Not now" is .btn-ghost.is-muted). */
.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--wf-primary-ink);
}
.btn-ghost:hover, .btn-ghost:focus { background-color: var(--wf-primary-soft); color: var(--wf-primary-ink); }
.btn-ghost.is-muted { color: var(--theme-text-muted); font-weight: 500; }
.btn-ghost.is-muted:hover { background-color: var(--wf-neutral-soft); color: var(--theme-text-emphasis); }

/* The fill is DARKENED off the token, not the raw token. White on
   --theme-success (#16a34a) measures 3.3:1 and fails AA - it was the last
   solid button in this file that did. Mixing 18% black holds the same green
   and lifts white text past 4.5:1. The token itself is untouched, so
   .btn-outline-success, .badge.bg-success and every other consumer keep the
   exact colour they have today. The label is --theme-text-on-success (white),
   NOT the primary's label: a grey-primary tenant gets BLACK on-primary labels,
   which on this green would fail. */
.btn-success {
    background-color: color-mix(in srgb, var(--theme-success), black 18%);
    border-color: color-mix(in srgb, var(--theme-success), black 18%);
    color: var(--theme-text-on-success);
}
.btn-success:hover { opacity: .85; color: var(--theme-text-on-success); }

.btn-info {
    background-color: var(--theme-offset);
    border-color: var(--theme-offset);
    color: var(--theme-text-on-offset);
}
.btn-info:hover { opacity: .85; color: var(--theme-text-on-offset); }

.btn-accent {
    background-color: var(--theme-accent);
    border-color: var(--theme-accent);
    color: var(--theme-text-on-accent);
}
.btn-accent:hover, .btn-accent:focus {
    background-color: var(--theme-accent-hover);
    border-color: var(--theme-accent-hover);
    color: var(--theme-text-on-accent);
}

/* The outline family keeps the QUIET shape; its meaning rides in its ink. */
.btn-outline-primary,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-danger,
.btn-outline-info,
.btn-outline-accent {
    background-color: var(--wf-card);
    border-color: var(--wf-line-strong);
}
.btn-outline-primary { color: var(--wf-primary-ink); }
.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--wf-primary-soft);
    border-color: color-mix(in srgb, var(--wf-primary-ink) 45%, var(--wf-line-strong));
    color: var(--wf-primary-ink);
}

.btn-outline-success { color: var(--wf-success-ink); }
.btn-outline-success:hover {
    background-color: var(--wf-success-soft);
    color: var(--wf-success-ink);
}

.btn-outline-warning { color: var(--wf-warning-ink); }
.btn-outline-warning:hover {
    background-color: var(--wf-warning-soft);
    color: var(--wf-warning-ink);
}

.btn-outline-danger { color: var(--wf-danger-ink); }
.btn-outline-danger:hover, .btn-outline-danger:focus {
    background-color: var(--wf-danger-soft);
    border-color: color-mix(in srgb, var(--theme-danger) 45%, var(--wf-line-strong));
    color: var(--wf-danger-ink);
}

.btn-outline-info { color: color-mix(in oklab, var(--theme-info) 66%, var(--theme-text-emphasis)); }
.btn-outline-info:hover, .btn-outline-info:focus {
    background-color: var(--theme-info-muted);
    color: color-mix(in oklab, var(--theme-info) 66%, var(--theme-text-emphasis));
}

.btn-link {
    color: var(--wf-primary-ink);
    text-decoration: none;
    border-color: transparent;
    background: none;
    padding: 0;
    font-weight: 500;
}
.btn-link:hover { color: color-mix(in oklab, var(--wf-primary-ink) 78%, var(--theme-text-emphasis)); }
.btn-link:active { transform: none; }

.btn-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    opacity: .6;
    /* The glyph is text (::after "x") - follow the surrounding text color so it
       stays visible on light AND dark surfaces. Filter tricks (Bootstrap's
       image-based btn-close) forced it white and vanished on light themes. */
    color: inherit;
    font-size: 1rem;
}
.btn-close::after { content: "\00d7"; font-size: 1.25rem; }
.btn-close:hover { opacity: 1; }

/* The compact variant. Authored at 7 call sites (copilot dock + baton chips,
   the email-template and tenant dialogs) but never defined here, so all seven
   silently rendered full-size - a 1.5rem glyph crowding a 0.78rem chip. */
.btn-close-sm { width: 1.125rem; height: 1.125rem; }
.btn-close-sm::after { font-size: 1rem; }

.btn-sm {
    padding: 0.3rem 0.6875rem;
    font-size: 0.78125rem;
}

.btn-lg {
    padding: 0.65625rem 1.25rem;
    font-size: var(--theme-font-size-base);
}

.btn-group {
    display: inline-flex;
    vertical-align: middle;
}
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-top-left-radius: var(--wf-radius-sm); border-bottom-left-radius: var(--wf-radius-sm); }
.btn-group > .btn:last-child { border-top-right-radius: var(--wf-radius-sm); border-bottom-right-radius: var(--wf-radius-sm); }
.btn-group > .btn + .btn { margin-left: -1px; }
.btn-group-sm > .btn { padding: 0.3rem 0.6875rem; font-size: 0.78125rem; }

/* Field and phone primaries: 44px targets on a coarse pointer. */
@media (pointer: coarse) {
    .btn:not(.btn-sm):not(.btn-link) { min-height: 44px; }
}

/* =================================================================
   Forms (portal-look-and-feel 3.11)
   -----------------------------------------------------------------
   The label 13/600 ABOVE the field, a one-sentence hint in muted
   12.5, inputs on the CARD fill (not grey) with a strong hairline,
   focus = a primary-ink border + the tenant focus ring, an error =
   a danger border with a 3px ring and the hint in danger ink.
   ================================================================= */

.form-control, .form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: var(--theme-font-size-base);
    font-weight: 400;
    line-height: 1.5;
    color: var(--theme-text-emphasis);
    background-color: var(--wf-card);
    border: 1px solid var(--wf-line-strong);
    border-radius: var(--wf-radius-sm);
    transition: border-color var(--theme-transition), box-shadow var(--theme-transition);
    appearance: none;
}
.form-control::placeholder { color: var(--theme-text-placeholder); }
.form-control:focus, .form-select:focus {
    background-color: var(--wf-card);
    border-color: var(--wf-primary-ink);
    box-shadow: var(--theme-focus-ring);
    color: var(--theme-text-emphasis);
    outline: 0;
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] {
    background-color: var(--wf-inset);
    color: var(--theme-text-muted);
    opacity: .7;
}

/* An error: the border turns danger with a 3px ring; the hint under it says what to do. */
.form-control.is-invalid, .form-select.is-invalid,
.form-control[aria-invalid="true"], .form-select[aria-invalid="true"] {
    border-color: var(--theme-danger);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-danger) 20%, transparent);
}
.invalid-feedback, .form-text.is-invalid {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 0.3rem;
    color: var(--wf-danger-ink);
    font-size: 0.78125rem;
}

.form-control-sm, .form-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: var(--theme-font-size-sm);
}
.form-control-lg {
    padding: 0.625rem 1rem;
    font-size: var(--theme-font-size-lg);
}

/* The select's chevron is drawn from the theme (two gradients), so it follows a dark tenant
   instead of a baked-in grey SVG. */
.form-select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--theme-text-muted) 50%),
        linear-gradient(135deg, var(--theme-text-muted) 50%, transparent 50%);
    background-repeat: no-repeat;
    background-position: calc(100% - 1.05rem) 52%, calc(100% - 0.75rem) 52%;
    background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
    padding-right: 2.25rem;
}
.form-select option {
    background-color: var(--theme-background-raised);
    color: var(--theme-text);
}

.form-label {
    display: inline-block;
    margin-bottom: 0.375rem;
    color: var(--theme-text-emphasis);
    font-weight: 600;
    font-size: 0.8125rem;
}
/* "(optional)" beside a label, in muted 500 - never a red star. */
.form-label .is-optional { color: var(--theme-text-muted); font-weight: 500; }

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.78125rem;
    color: var(--theme-text-muted);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.5rem;
}
.form-check-input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    background-color: var(--wf-card);
    border: 1px solid var(--wf-line-strong);
    border-radius: 0.25rem;
    appearance: none;
    cursor: pointer;
    flex-shrink: 0;
}
.form-check-input[type="radio"] { border-radius: 50%; }
/* THE TICK IS DRAWN IN THE ON-PRIMARY INK (2026-11-23). It was a near-black glyph baked into a picture, so on a dark brand
   colour a ticked box was a dark square with nothing in it (1-800-Flowers' purple; the default green was barely better).
   A picture cannot read a token, so the tick is a mask over the ink a primary button's label uses. */
.form-check-input { position: relative; }
.form-check-input:checked {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}
.form-check-input:checked::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: var(--theme-text-on-primary);
    -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") center / contain no-repeat;
}

/* AN ON / OFF SWITCH (.form-switch) IS A TRACK AND A KNOB. The markup has asked for one on fifty-five controls and got a
   tick box, which reads as "select this row", not "this is on". Off: a quiet neutral track (3:1 against the card). On: the
   primary, the knob in the on-primary ink. The knob slides; nothing else moves. */
.form-switch .form-check-input {
    width: 2rem;
    height: 1.125rem;
    border-radius: 999px;
    background-color: color-mix(in oklab, var(--theme-text-secondary) 60%, var(--wf-card));
    border-color: transparent;
    transition: background-color var(--wf-motion);
}
.form-switch .form-check-input::before {
    content: "";
    position: absolute;
    inset: auto;
    top: 50%;
    left: 2px;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: var(--wf-card);
    -webkit-mask: none;
    mask: none;
    transform: translateY(-50%);
    transition: transform var(--wf-motion);
}
.form-switch .form-check-input:checked { background-color: var(--theme-primary); border-color: transparent; }
.form-switch .form-check-input:checked::before {
    background-color: var(--theme-text-on-primary);
    transform: translate(0.875rem, -50%);
}
.form-switch .form-check-input:disabled { opacity: 0.55; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) {
    .form-switch .form-check-input,
    .form-switch .form-check-input::before { transition: none; }
}
/* FORCED COLORS (Windows High Contrast) replace every background colour with Canvas - the masked tick, the knob and the "on"
   track with it - so a ticked box and an on switch would look exactly like unticked and off. The system colours put them back:
   the tick in CanvasText; the switch's knob CanvasText when off, HighlightText on a Highlight track when on. */
@media (forced-colors: active) {
    .form-check-input:checked::before { background-color: CanvasText; }
    .form-switch .form-check-input::before { background-color: CanvasText; }
    .form-switch .form-check-input:checked { background-color: Highlight; }
    .form-switch .form-check-input:checked::before { background-color: HighlightText; }
}
.form-check-input:focus { box-shadow: var(--theme-focus-ring); outline: 0; }
.form-check-input:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; }
.form-check-label { cursor: pointer; color: var(--theme-text); }
.form-check-inline { display: inline-flex; margin-right: 1rem; }

/* 16px text and 44px targets on a coarse pointer (iOS zooms the page on a smaller input and never
   zooms back out). */
@media (pointer: coarse) {
    .form-control, .form-select { font-size: 16px; }
    .form-control:not(.form-control-sm):not(textarea), .form-select:not(.form-select-sm) { min-height: 44px; }
}

.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.input-group > .form-control, .input-group > .form-select {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}
.input-group > .form-control:not(:first-child), .input-group > .form-select:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-group > .form-control:not(:last-child), .input-group > .form-select:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group > .btn:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}
.input-group > .btn:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.form-floating {
    position: relative;
}
.form-floating > .form-control,
.form-floating > .form-control-plaintext {
    height: calc(3.5rem + 2px);
    padding: 1.625rem 0.75rem 0.625rem;
}
.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem 0.75rem;
    pointer-events: none;
    transform-origin: 0 0;
    transition: opacity .1s ease-in-out, transform .1s ease-in-out;
    color: var(--theme-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-control-plaintext ~ label {
    transform: scale(.85) translateY(-0.5rem) translateX(0.15rem);
    color: var(--theme-text-secondary);
}
.form-control-plaintext {
    display: block;
    width: 100%;
    padding: 0.4375rem 0;
    color: var(--theme-text);
    background-color: transparent;
    border: solid transparent;
    border-width: 1px 0;
}

.font-monospace { font-family: var(--theme-font-mono) !important; }

/* =================================================================
   Cards (portal-look-and-feel 3.9)
   -----------------------------------------------------------------
   The card fill, a hairline, the tenant's own radius, elevation 1 at
   rest. The header LOSES the grey slab: transparent, a 15/650 title,
   tools on the right, and a hairline only when the body is a table
   or a list. A card that is wholly a link lifts on hover.
   ================================================================= */

.card {
    display: flex;
    flex-direction: column;
    background-color: var(--wf-card);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    box-shadow: var(--wf-elev-1);
    overflow: hidden;
}
a.card, .card.is-link { color: inherit; text-decoration: none; transition: box-shadow var(--wf-motion-panel), transform var(--wf-motion-panel); }
a.card:hover, .card.is-link:hover { box-shadow: var(--wf-elev-2); transform: translateY(-1px); }
.card-header, .card-footer {
    padding: 1rem 1.25rem 0.25rem;
    background-color: transparent;
    border-color: var(--wf-line);
    color: var(--theme-text-emphasis);
}
.card-header { border-bottom: 0; font-size: var(--wf-text-h3); font-weight: 650; }
.card-header > .bi:first-child { color: var(--wf-primary-ink); }
/* A table or a list right under the header gets the one hairline. */
.card-header:has(+ .table, + .table-responsive, + .list-group, + .card-body.p-0) {
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--wf-line);
}
.card-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--wf-line); }
.card-body {
    flex: 1 1 auto;
    padding: 1rem 1.25rem;
    color: var(--theme-text);
}
.card-title {
    margin-bottom: 0.5rem;
    font-weight: 650;
    color: var(--theme-text-emphasis);
}

/* =================================================================
   Tables (portal-look-and-feel 3.10)
   -----------------------------------------------------------------
   The header sits transparent on the card in muted 12.5/600 SENTENCE
   CASE (no uppercase, no letter-spacing) over one hairline; rows are
   divided by a hairline, never zebra-striped; hover = the card hover
   fill, selected = primary soft; numbers right-aligned and tabular.
   ================================================================= */

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--theme-text);
    border-collapse: collapse;
}
.table > thead { border-bottom: 1px solid var(--wf-line); }
.table thead th {
    background-color: transparent;
    color: var(--theme-text-muted);
    font-weight: 600;
    font-size: 0.78125rem;
    text-transform: none;
    letter-spacing: 0;
    padding: 0.625rem 0.75rem;
    border-bottom-color: var(--wf-line);
    text-align: start;
    white-space: nowrap;
}
.table > tbody > tr { border-bottom: 1px solid var(--wf-line); transition: background-color 120ms ease; }
.table > tbody > tr:last-child { border-bottom: 0; }
.table > tbody > tr > td {
    padding: 0.75rem;
    vertical-align: middle;
    color: var(--theme-text);
}
.table > tbody > tr > td.fw-semibold,
.table > tbody > tr > td.fw-medium { color: var(--theme-text-emphasis); }
/* Codes read as quiet secondary monospace, not as primary at 80% opacity. */
.table > tbody > tr > td.font-monospace {
    color: var(--theme-text-secondary) !important;
}
.table td.text-end, .table th.text-end { font-variant-numeric: tabular-nums; }

.table-sm > tbody > tr > td,
.table-sm > thead > tr > th { padding: 0.375rem 0.5rem; }

.table-hover > tbody > tr:hover {
    background-color: var(--wf-card-hover) !important;
    color: var(--theme-text-emphasis) !important;
}
.table-hover > tbody > tr:hover > td { color: var(--theme-text-emphasis); }
.table-hover > tbody > tr:hover > td.text-muted { color: var(--theme-text-secondary) !important; }

/* No zebra: rows are divided by a hairline. The class stays valid. */
.table-striped > tbody > tr:nth-of-type(odd) { background-color: transparent; }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table-light, thead.table-light, thead.table-light th {
    background-color: transparent !important;
    color: var(--theme-text-muted) !important;
    border-color: var(--wf-line) !important;
}

.table-active { background-color: var(--wf-primary-soft) !important; }
.table-warning { background-color: var(--wf-warning-soft) !important; }

.align-middle { vertical-align: middle !important; }

/* =================================================================
   Modals
   ================================================================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}
.modal.show, .modal.d-block { display: block; }

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 500px;
    pointer-events: none;
}
.modal-dialog-sm { max-width: 300px; }
.modal-dialog-lg { max-width: 960px; }
/* The spelling every dialog actually WRITES. 28 components say `modal-lg`
   (muscle memory from the removed framework) while zero say the house's
   `modal-dialog-lg` - so every "large" dialog silently sat at the 500px
   base cap and the 960px rule above had no consumers (found via the Data
   Studio property editor, 2026-08-25). Alias the real-world spelling;
   both names stay valid. */
.modal-dialog.modal-lg { max-width: 960px; }
.modal-dialog.modal-xl { max-width: 95%; }
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}
.modal:has(.modal-dialog-scrollable) {
    overflow: hidden;
}
.modal-dialog-scrollable {
    display: flex;
    height: calc(100vh - 3.5rem);
    max-height: calc(100vh - 3.5rem);
}
.modal-dialog-scrollable .modal-content {
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    flex: 1;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    /* A dialog floats: the float surface (the highest step in a dark theme), radius xl,
       elevation 3 (portal-look-and-feel 3.13). */
    background-color: var(--theme-background-float);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-xl);
    box-shadow: var(--wf-elev-3);
    outline: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--theme-nav-border);
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--theme-nav-background);
    color: var(--theme-nav-text-active);
    border-radius: var(--wf-radius-xl) var(--wf-radius-xl) 0 0;
}
.modal-header .btn {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--theme-nav-text-active);
    background: transparent;
}
.modal-header .btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
}
.modal-header .btn-save {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}
.modal-header .btn-save:hover {
    background: rgba(255, 255, 255, 0.3);
}
.modal-title {
    margin: 0;
    line-height: 1.5;
    font-weight: 600;
    color: inherit;
}

.modal-body { flex: 1 1 auto; padding: 1rem; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--wf-line);
}

/* Every backdrop is the one scrim (--wf-scrim, black 48%) with a 3px blur - it replaces two
   hard-coded rgba(0,0,0,.65) slabs that read heavier than the dialog over them. */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background-color: var(--wf-scrim);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.modal-backdrop.show { opacity: 1; }
.modal-backdrop.fade { opacity: 0; transition: opacity .15s linear; }

.fade { transition: opacity .15s linear; }
.show { opacity: 1; }

/* =================================================================
   wf-modal — self-contained overlay pattern used by FormCreateWizard,
   IconPickerDialog, MenuItemEditDialog, FormHierarchyField. One
   backdrop div wrapping the dialog box (no separate modal-dialog
   wrapper like Bootstrap). Closes on backdrop click; dialog stops
   propagation. All four components follow the same DOM shape.
   ================================================================= */

.wf-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background-color: var(--wf-scrim);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 3rem 1rem;
}

/* Stacked modifier: when one wf-modal opens another (e.g. MenuItemEditDialog
   -> IconPickerDialog), the inner one needs to sit ABOVE the outer. Without
   this both backdrops tie at z 1055 and DOM order picks the winner; the
   picker often loses and renders hidden behind the parent dialog. */
.wf-modal-backdrop.wf-modal-backdrop-stacked {
    z-index: 1065;
}

.wf-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 6rem);
    background-color: var(--theme-background-float);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-xl);
    box-shadow: var(--wf-elev-3);
    outline: 0;
}

.wf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--theme-nav-border);
    background: var(--theme-nav-background);
    color: var(--theme-nav-text-active);
    border-radius: var(--wf-radius-xl) var(--wf-radius-xl) 0 0;
    flex-shrink: 0;
}
.wf-modal-title {
    margin: 0;
    line-height: 1.5;
    font-weight: 600;
    color: inherit;
}

.wf-modal-body {
    flex: 1 1 auto;
    padding: 1rem;
    overflow-y: auto;
}

.wf-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--theme-border);
    flex-shrink: 0;
}

/* =================================================================
   Alerts (portal-look-and-feel 3.13) - a calm, soft tone card in the
   page's voice: the tone's soft fill, a faint tone border, the text in
   the tone's INK (readable on a grey or pastel theme, and in dark).
   ================================================================= */

.alert {
    position: relative;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--wf-radius-md);
    font-size: 0.84375rem;
    line-height: 1.5;
}
.alert-danger {
    background-color: var(--wf-danger-soft);
    border-color: color-mix(in srgb, var(--theme-danger) 22%, var(--wf-card));
    color: var(--wf-danger-ink);
}
.alert-success {
    background-color: var(--wf-success-soft);
    border-color: color-mix(in srgb, var(--theme-success) 22%, var(--wf-card));
    color: var(--wf-success-ink);
}
.alert-warning {
    background-color: var(--wf-warning-soft);
    border-color: color-mix(in srgb, var(--theme-warning) 24%, var(--wf-card));
    color: var(--wf-warning-ink);
}
.alert-info {
    background-color: var(--wf-primary-soft);
    border-color: color-mix(in srgb, var(--theme-primary) 22%, var(--wf-card));
    color: var(--wf-primary-ink);
}
.alert-dismissible { padding-right: 3rem; }
.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.75rem 1rem;
}

/* =================================================================
   Badges - SOFT tone pills, never solid slabs: the tone's soft fill
   and its ink (portal-look-and-feel 3.12). The .bg-* utilities still
   paint solid on everything that is not a badge.
   ================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    padding: 0.3em 0.6em;
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    color: var(--theme-text-secondary);
    background-color: var(--wf-neutral-soft);
    white-space: nowrap;
    border-radius: var(--wf-radius-pill);
    vertical-align: baseline;
}

.bg-primary   { background-color: var(--theme-primary) !important; }
.bg-secondary { background-color: var(--theme-background-active) !important; color: var(--theme-text) !important; }
.bg-success   { background-color: var(--theme-success) !important; }
.bg-danger    { background-color: var(--theme-danger) !important; }
.bg-warning   { background-color: var(--theme-warning) !important; color: var(--theme-text-emphasis) !important; }
.bg-info      { background-color: var(--theme-info) !important; }
.bg-dark      { background-color: var(--theme-background-active) !important; }
.bg-light     { background-color: var(--theme-background-subtle) !important; color: var(--theme-text) !important; }

.text-bg-primary   { background-color: var(--theme-primary) !important; color: var(--theme-text-on-primary) !important; }
.text-bg-secondary { background-color: var(--theme-background-active) !important; color: var(--theme-text) !important; }
.text-bg-success   { background-color: var(--theme-success) !important; color: var(--theme-text-on-success) !important; }
.text-bg-danger    { background-color: var(--theme-danger) !important; color: var(--theme-text-on-danger) !important; }
.text-bg-warning   { background-color: var(--theme-warning) !important; color: var(--theme-text-emphasis) !important; }
.text-bg-info      { background-color: var(--theme-info) !important; color: var(--theme-text-on-info) !important; }

/* The soft pill for every badge tone (more specific than the solid utilities above). */
.badge.bg-primary, .badge.text-bg-primary { background-color: var(--wf-primary-soft) !important; color: var(--wf-primary-ink) !important; }
.badge.bg-secondary, .badge.text-bg-secondary,
.badge.bg-light, .badge.text-bg-light,
.badge.bg-dark { background-color: var(--wf-neutral-soft) !important; color: var(--theme-text-secondary) !important; }
.badge.bg-success, .badge.text-bg-success { background-color: var(--wf-success-soft) !important; color: var(--wf-success-ink) !important; }
.badge.bg-warning, .badge.text-bg-warning { background-color: var(--wf-warning-soft) !important; color: var(--wf-warning-ink) !important; }
.badge.bg-danger, .badge.text-bg-danger { background-color: var(--wf-danger-soft) !important; color: var(--wf-danger-ink) !important; }
.badge.bg-info, .badge.text-bg-info {
    background-color: color-mix(in srgb, var(--theme-info) 13%, var(--wf-card)) !important;
    color: color-mix(in oklab, var(--theme-info) 66%, var(--theme-text-emphasis)) !important;
}

.badge-accent  { background-color: var(--wf-accent-soft);  color: var(--wf-accent-ink); }
.badge-primary { background-color: var(--wf-primary-soft); color: var(--wf-primary-ink); }
.badge-offset  { background-color: var(--theme-offset-muted);  color: color-mix(in oklab, var(--theme-offset) 62%, var(--theme-text-emphasis)); }


/* =================================================================
   List Groups
   ================================================================= */

.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
}
.list-group-item {
    position: relative;
    display: block;
    padding: 0.625rem 1rem;
    background-color: var(--theme-background-subtle);
    border: 1px solid var(--theme-border);
    color: var(--theme-text);
}
.list-group-item:first-child { border-top-left-radius: var(--theme-radius); border-top-right-radius: var(--theme-radius); }
.list-group-item:last-child { border-bottom-left-radius: var(--theme-radius); border-bottom-right-radius: var(--theme-radius); }
.list-group-item + .list-group-item { border-top-width: 0; }
.list-group-item-action {
    cursor: pointer;
    transition: background-color var(--theme-transition), color var(--theme-transition);
}
.list-group-item-action:hover {
    background-color: var(--theme-background-hover);
    color: var(--theme-text-emphasis);
}
.list-group-item-light { background-color: var(--theme-background-subtle); }
.list-group-item.active {
    background-color: var(--theme-primary-muted);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

/* =================================================================
   Spinners
   ================================================================= */

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    border: 0.25em solid var(--theme-primary);
    border-right-color: transparent;
    border-radius: 50%;
    animation: wf-spin .75s linear infinite;
}
.spinner-border-sm { width: 1rem; height: 1rem; border-width: 0.2em; }

@keyframes wf-spin { to { transform: rotate(360deg); } }

/* =================================================================
   Flexbox & Display Utilities
   ================================================================= */

.d-flex          { display: flex !important; }
.d-inline-flex   { display: inline-flex !important; }
.d-block         { display: block !important; }
.d-inline        { display: inline !important; }
.d-none          { display: none !important; }
.d-grid          { display: grid !important; }

.flex-grow-1     { flex-grow: 1 !important; }
.flex-shrink-0   { flex-shrink: 0 !important; }
.flex-column     { flex-direction: column !important; }
.flex-wrap       { flex-wrap: wrap !important; }

.justify-content-start   { justify-content: flex-start !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end     { justify-content: flex-end !important; }

.align-items-start   { align-items: flex-start !important; }
.align-items-center  { align-items: center !important; }
.align-items-end     { align-items: flex-end !important; }
.align-content-stretch { align-content: stretch !important; }

/* =================================================================
   Spacing Utilities
   ================================================================= */

/* Margin */
.m-0  { margin: 0 !important; }
.m-1  { margin: 0.25rem !important; }
.m-2  { margin: 0.5rem !important; }
.m-3  { margin: 1rem !important; }
.m-4  { margin: 1.5rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.ms-auto { margin-inline-start: auto !important; }
.ms-1 { margin-inline-start: 0.25rem !important; }
.ms-2 { margin-inline-start: 0.5rem !important; }
.ms-3 { margin-inline-start: 1rem !important; }

.me-1 { margin-inline-end: 0.25rem !important; }
.me-2 { margin-inline-end: 0.5rem !important; }
.me-3 { margin-inline-end: 1rem !important; }

.mx-auto { margin-inline: auto !important; }
.my-0 { margin-block: 0 !important; }
.my-1 { margin-block: 0.25rem !important; }
.my-2 { margin-block: 0.5rem !important; }
.my-3 { margin-block: 1rem !important; }

/* Padding */
.p-0  { padding: 0 !important; }
.p-1  { padding: 0.25rem !important; }
.p-2  { padding: 0.5rem !important; }
.p-3  { padding: 1rem !important; }
.p-4  { padding: 1.5rem !important; }
.p-5  { padding: 3rem !important; }

.pt-1 { padding-top: 0.25rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }

.pb-1 { padding-bottom: 0.25rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }

.ps-1 { padding-inline-start: 0.25rem !important; }
.ps-2 { padding-inline-start: 0.5rem !important; }
.ps-3 { padding-inline-start: 1rem !important; }

.pe-1 { padding-inline-end: 0.25rem !important; }
.pe-2 { padding-inline-end: 0.5rem !important; }
.pe-3 { padding-inline-end: 1rem !important; }

.px-2 { padding-inline: 0.5rem !important; }
.px-3 { padding-inline: 1rem !important; }

.py-1 { padding-block: 0.25rem !important; }
.py-2 { padding-block: 0.5rem !important; }
.py-3 { padding-block: 1rem !important; }
.py-5 { padding-block: 3rem !important; }

/* Gap */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

/* =================================================================
   Text Utilities
   ================================================================= */

.text-center          { text-align: center !important; }
.text-end             { text-align: end !important; }
.text-start           { text-align: start !important; }

/* Coloured TEXT reads in the tone's INK (the hue mixed toward the emphasis text), so a grey or
   pastel tenant - and every dark one - still gets readable words and icons. Raw hues are fills. */
.text-muted           { color: var(--theme-text-muted) !important; }
.text-danger          { color: var(--wf-danger-ink) !important; }
.text-success         { color: var(--wf-success-ink) !important; }
.text-warning         { color: var(--wf-warning-ink) !important; }
.text-primary         { color: var(--wf-primary-ink) !important; }
.text-secondary       { color: var(--theme-text-secondary) !important; }
.text-dark            { color: var(--theme-text-emphasis) !important; }

.text-nowrap          { white-space: nowrap !important; }
.text-truncate        { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-decoration-none { text-decoration: none !important; }

.fw-bold              { font-weight: 700 !important; }
.fw-semibold          { font-weight: 600 !important; }
.fw-medium            { font-weight: 500 !important; }
.fst-italic           { font-style: italic !important; }

.fs-1                 { font-size: 2.5rem !important; }
.fs-5                 { font-size: var(--theme-font-size-lg) !important; }

.small                { font-size: var(--theme-font-size-sm); }

/* =================================================================
   Grid System
   ================================================================= */

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}
.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

/* Gap variants (g-*) override the padding/margin approach */
.g-2 { --wf-gutter: 0.5rem; gap: var(--wf-gutter); margin: 0; }
.g-2 > * { padding: 0; }
.g-3 { --wf-gutter: 1rem; gap: var(--wf-gutter); margin: 0; }
.g-3 > * { padding: 0; }
.g-4 { --wf-gutter: 1.5rem; gap: var(--wf-gutter); margin: 0; }
.g-4 > * { padding: 0; }

/* Base column widths (all breakpoints) -- width = N/12, minus the shared gutter. */
.col-3  { flex: 0 0 auto; width: calc(25% - var(--wf-gutter, 1rem) * 3 / 4); }
.col-4  { flex: 0 0 auto; width: calc(33.3333% - var(--wf-gutter, 1rem) * 2 / 3); }
.col-5  { flex: 0 0 auto; width: calc(41.6667% - var(--wf-gutter, 1rem) * 7 / 12); }
.col-6  { flex: 0 0 auto; width: calc(50% - var(--wf-gutter, 1rem) / 2); }
.col-7  { flex: 0 0 auto; width: calc(58.3333% - var(--wf-gutter, 1rem) * 5 / 12); }
.col-8  { flex: 0 0 auto; width: calc(66.6667% - var(--wf-gutter, 1rem) / 3); }
.col-12 { flex: 0 0 auto; width: 100%; }

/* Sizing utilities (equal-height cards in a row, full-width elements). */
.h-100 { height: 100%; }
.w-100 { width: 100%; }

/* Small breakpoint (≥576px) */
@media (min-width: 576px) {
    .col-sm-3 { flex: 0 0 auto; width: calc(25% - var(--wf-gutter, 1rem) * 3 / 4); }
    .col-sm-6 { flex: 0 0 auto; width: calc(50% - var(--wf-gutter, 1rem) / 2); }
    .col-sm-9 { flex: 0 0 auto; width: calc(75% - var(--wf-gutter, 1rem) / 4); }
}

/* Medium breakpoint (≥768px) */
@media (min-width: 768px) {
    .col-md-1  { flex: 0 0 auto; width: calc(8.3333% - var(--wf-gutter, 1rem) * 11 / 12); }
    .col-md-2  { flex: 0 0 auto; width: calc(16.6667% - var(--wf-gutter, 1rem) * 5 / 6); }
    .col-md-3  { flex: 0 0 auto; width: calc(25% - var(--wf-gutter, 1rem) * 3 / 4); }
    .col-md-4  { flex: 0 0 auto; width: calc(33.3333% - var(--wf-gutter, 1rem) * 2 / 3); }
    .col-md-5  { flex: 0 0 auto; width: calc(41.6667% - var(--wf-gutter, 1rem) * 7 / 12); }
    .col-md-6  { flex: 0 0 auto; width: calc(50% - var(--wf-gutter, 1rem) / 2); }
    .col-md-7  { flex: 0 0 auto; width: calc(58.3333% - var(--wf-gutter, 1rem) * 5 / 12); }
    .col-md-8  { flex: 0 0 auto; width: calc(66.6667% - var(--wf-gutter, 1rem) / 3); }
    .col-md-9  { flex: 0 0 auto; width: calc(75% - var(--wf-gutter, 1rem) / 4); }
    .col-md-12 { flex: 0 0 auto; width: 100%; }
}

/* Large breakpoint (≥992px) */
@media (min-width: 992px) {
    .col-lg-2  { flex: 0 0 auto; width: calc(16.6667% - var(--wf-gutter, 1.5rem) * 5 / 6); }
    .col-lg-3  { flex: 0 0 auto; width: calc(25% - var(--wf-gutter, 1.5rem) * 3 / 4); }
    .col-lg-4  { flex: 0 0 auto; width: calc(33.3333% - var(--wf-gutter, 1.5rem) * 2 / 3); }
    .col-lg-5  { flex: 0 0 auto; width: calc(41.6667% - var(--wf-gutter, 1.5rem) * 7 / 12); }
    .col-lg-6  { flex: 0 0 auto; width: calc(50% - var(--wf-gutter, 1.5rem) / 2); }
    .col-lg-7  { flex: 0 0 auto; width: calc(58.3333% - var(--wf-gutter, 1.5rem) * 5 / 12); }
    .col-lg-8  { flex: 0 0 auto; width: calc(66.6667% - var(--wf-gutter, 1.5rem) / 3); }
    .col-lg-9  { flex: 0 0 auto; width: calc(75% - var(--wf-gutter, 1.5rem) / 4); }
    .col-lg-10 { flex: 0 0 auto; width: calc(83.3333% - var(--wf-gutter, 1.5rem) / 6); }
    .col-lg-12 { flex: 0 0 auto; width: 100%; }
}

/* Extra-large breakpoint (≥1200px) - new; col-xl-6 had one live consumer
   and nothing to match it. */
@media (min-width: 1200px) {
    .col-xl-6  { flex: 0 0 auto; width: calc(50% - var(--wf-gutter, 1.5rem) / 2); }
}

/* =================================================================
   Sizing
   ================================================================= */

.w-100  { width: 100% !important; }
.vh-100 { height: 100vh !important; }

/* =================================================================
   Display & Visibility
   ================================================================= */

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media print { .no-print { display: none !important; } }

/* =================================================================
   Borders
   ================================================================= */

.border        { border: 1px solid var(--theme-border) !important; }
.border-top    { border-top: 1px solid var(--theme-border) !important; }
.border-bottom { border-bottom: 1px solid var(--theme-border) !important; }
.border-start  { border-inline-start: 1px solid var(--theme-border) !important; }
.border-end    { border-inline-end: 1px solid var(--theme-border) !important; }

.rounded       { border-radius: var(--theme-radius) !important; }
.rounded-pill  { border-radius: 50rem !important; }

/* =================================================================
   Position & Overflow
   ================================================================= */

.position-fixed    { position: fixed !important; }
.position-absolute { position: absolute !important; }
.position-relative { position: relative !important; }

.overflow-auto   { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }

/* =================================================================
   Misc
   ================================================================= */

.user-select-none { user-select: none !important; }

/* =================================================================
   Language Pills (DisplayPropertiesEditor + LanguagePills)
   ================================================================= */

.lang-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.lang-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid var(--theme-border);
    overflow: hidden;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    background: var(--theme-bg);
    color: var(--theme-text-muted);
    transition: border-color 0.15s;
    user-select: none;
}

.lang-pill.lang-pill-active {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 10%, transparent);
}

.lang-pill-code {
    padding: 0.3rem 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    line-height: 1;
    text-transform: lowercase;
}

.lang-pill-code:disabled {
    cursor: default;
    opacity: 0.5;
}

/* ── Inactive-pill state hints (color-only on the code itself) ────── */
.lang-pill.lang-pill-state-empty .lang-pill-code {
    opacity: 0.5;
    font-style: italic;
}
.lang-pill.lang-pill-state-stale .lang-pill-code {
    color: var(--theme-warning, #f59e0b);
}
.lang-pill.lang-pill-state-locked .lang-pill-code {
    opacity: 0.7;
}

/* ── Per-pill controls — only visible when pill is active ─────────── */
.lang-pill-control {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.4rem;
    background: none;
    border: none;
    border-left: 1px solid var(--theme-border);
    cursor: pointer;
    color: inherit;
    font-size: 0.7rem;
    line-height: 1;
}
.lang-pill-control:hover:not(:disabled) {
    background: color-mix(in srgb, currentColor 10%, transparent);
}
.lang-pill-control:disabled {
    cursor: default;
    opacity: 0.4;
}
.lang-pill-control-stale {
    color: var(--theme-warning, #f59e0b);
}

/* ── Source marker (always visible, prepended) ────────────────────── */
.lang-pill-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0 0.3rem 0.5rem;
    line-height: 1;
}

.lang-pill-all {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--theme-border);
    background: none;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--theme-text-muted);
    cursor: pointer;
    line-height: 1;
    letter-spacing: 0.03em;
    margin-left: auto;
}

.lang-pill-all:hover:not(:disabled) {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

.lang-pill-all:disabled {
    opacity: 0.4;
    cursor: default;
}

.lang-pill-source-marker {
    color: var(--theme-warning, #f59e0b);
    font-size: 0.65rem;
}

/* ── Bulk-actions pill (Unlock-all / Refresh-all / Lock-all) ──────── */
.lang-pill-bulk {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid var(--theme-border);
    overflow: hidden;
    line-height: 1;
    margin-left: auto;
    background: var(--theme-bg);
}

.lang-pill-bulk-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--theme-text-muted);
    font-size: 0.7rem;
    line-height: 1;
}

.lang-pill-bulk-btn + .lang-pill-bulk-btn {
    border-left: 1px solid var(--theme-border);
}

.lang-pill-bulk-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--theme-primary) 10%, transparent);
    color: var(--theme-primary);
}

.lang-pill-bulk-btn-active {
    background: color-mix(in srgb, var(--theme-primary) 15%, transparent);
    color: var(--theme-primary);
}

.lang-pill-bulk-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.lang-pill-bulk-busy {
    padding: 0.3rem 0.6rem;
}

.lang-pill-bulk-busy-content {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--theme-text-muted);
    letter-spacing: 0.03em;
}

/* ── Translation-coverage status footer ────────────────────────────── */
.lang-status {
    line-height: 1.4;
}
.lang-status.lang-status-missing {
    color: var(--theme-danger, #dc3545);
}
.lang-status.lang-status-stale {
    color: var(--theme-warning, #f59e0b);
}

/* =================================================================
   Step media slots (mock)
   ================================================================= */

.media-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.media-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 10rem;
    height: 10rem;
    padding: 0.5rem;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-bg);
    color: var(--theme-text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.media-slot:hover:not(:disabled) {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 5%, transparent);
}

.media-slot:disabled {
    cursor: default;
    opacity: 0.6;
}

.media-slot-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.media-slot-label {
    font-size: 0.75rem;
}

.media-slot-loading {
    border-style: solid;
    color: var(--theme-primary);
}

/* Populated tile — holds an AssetPreview + filename + remove button */
.media-slot-filled {
    position: relative;
    border-style: solid;
    border-color: var(--theme-border, var(--theme-primary));
    background: var(--theme-surface, transparent);
    cursor: default;
    overflow: hidden;
}

/* The AssetPreview wrapper fills the tile's vertical space minus the
   filename + remove-button caption row. */
.media-slot-filled .asset-preview {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Override AssetPreview's global 6rem × 4rem cap so the thumbnail
   actually fills the workflow-media tile. */
.media-slot-filled .asset-preview-thumb {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.media-slot-filled .asset-preview-file i {
    font-size: 2.5rem;
}

.media-slot-filename {
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--theme-text-muted);
    cursor: text;
    padding: 0.125rem 0.25rem;
    border-radius: 0.125rem;
}

.media-slot-filename:hover {
    background: color-mix(in srgb, var(--theme-primary) 8%, transparent);
    color: var(--theme-text);
}

.media-slot-filename-input {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.125rem 0.25rem;
    border: 1px solid var(--theme-primary);
    border-radius: 0.125rem;
    text-align: center;
    background: var(--theme-surface, #fff);
    color: var(--theme-text);
}

/* ── FmAssetPicker thumbnails in list rows ─────────────────────────
   When the asset's MIME starts with image/, the row renders a tiny
   inline thumbnail in place of the bootstrap icon. Fixed-size keeps
   row heights uniform whether the row has a thumb or an icon. */
.fm-asset-thumb {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: cover;
    border-radius: 0.25rem;
    border: 1px solid var(--theme-border-subtle, rgba(0, 0, 0, 0.1));
    flex-shrink: 0;
}

.fm-asset-icon {
    width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.fm-asset-row {
    min-height: 3rem;
}

.media-slot-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    border: 0;
    background: color-mix(in srgb, var(--theme-surface, #fff) 80%, transparent);
    color: var(--theme-text);
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    line-height: 1;
    font-size: 0.75rem;
}

.media-slot-filled:hover .media-slot-remove,
.media-slot-remove:focus-visible {
    opacity: 1;
}

/* A file whose removal is in flight keeps its place, faded, until the re-read drops it (StepMediaEditor _removing). */
.media-slot-removing {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
}

.media-slot-remove:hover:not(:disabled) {
    background: var(--theme-danger, #dc3545);
    color: #fff;
}

.media-slot-remove:disabled {
    opacity: 0;
    cursor: default;
}

/* "Add" tile retains the existing dashed-border behavior from .media-slot;
   no override needed. Class kept for any future divergence. */
.media-slot-add { }

/* =================================================================
   Step info row — CSS Grid, auto equal-width columns per child
   ================================================================= */

.step-info-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 1rem;
}

.step-info-col {
    min-width: 0;
}

.source-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: none;
    background: var(--theme-surface-raised, #333);
    color: var(--theme-text-inverse, #fff);
    font-size: 0.7rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.source-toggle-btn:hover { opacity: 0.8; }

/* =================================================================
   LiveHtmlEditor / HtmlEditor — content padding
   ================================================================= */

.email-html-editor [contenteditable="true"],
.email-html-editor textarea.form-control {
    padding: 0.75rem 1rem;
}

/* =================================================================
   THE ABSENT-CLASS SWEEP (audit 2026-09-09)
   -----------------------------------------------------------------
   wf.css reimplements the Bootstrap class names the Portal actually
   uses; anything it never needed is simply missing, and a missing
   class fails SILENTLY. An audit of every class written in .razor
   markup against every stylesheet index.html loads turned up the set
   below - all of them live in real pages today, all of them doing
   nothing. Worst was .btn-danger (49 uses): an element carrying it
   inherits bare .btn - transparent background AND transparent border
   - so a DESTRUCTIVE action rendered as plain body text, weaker than
   the outlined Cancel beside it.

   Everything here was ADDITIVE when the sweep landed, and every colour
   comes from a --theme-* / --wf-* token, so each class follows the
   tenant theme like the rest of the file. (2026-10-01, the look:
   .btn-danger became a ghost until the confirm step, and .btn-light /
   .btn-outline-accent took the quiet shape - portal-look-and-feel 3.12.)
   ================================================================= */

/* ---- Solid semantic buttons -------------------------------------
   Same shape as .btn-success / .btn-info above: token background and
   border, on-primary text, and an opacity hover (there is no
   --theme-danger-hover / --theme-warning-hover token to reach for).
   The explicit hover `color` is the same defence-in-depth .btn-primary
   documents - a global a:hover rule must not repaint button text. */

/* DANGER IS A GHOST UNTIL THE CONFIRM STEP (portal-look-and-feel 3.12): on a page, the first
   click on a destructive action is quiet danger INK, never a red slab beside a calm page; inside
   the confirm dialog (or a container that says .is-confirm) it is the solid, AA-fixed fill. The
   label on the fill is --theme-text-on-danger (white), not the primary's label. */
.btn-danger {
    background-color: transparent;
    border-color: color-mix(in srgb, var(--theme-danger) 35%, var(--wf-line-strong));
    color: var(--wf-danger-ink);
}
.btn-danger:hover, .btn-danger:focus {
    background-color: var(--wf-danger-soft);
    color: var(--wf-danger-ink);
}
.modal .btn-danger, .modal-content .btn-danger, .wf-modal .btn-danger, [role="dialog"] .btn-danger, [role="alertdialog"] .btn-danger,
.btn-danger.is-confirm, .is-confirm .btn-danger {
    background-color: var(--theme-danger);
    border-color: var(--theme-danger);
    color: var(--theme-text-on-danger);
}
.modal .btn-danger:hover, .modal-content .btn-danger:hover, .wf-modal .btn-danger:hover, [role="dialog"] .btn-danger:hover, [role="alertdialog"] .btn-danger:hover,
.btn-danger.is-confirm:hover, .is-confirm .btn-danger:hover {
    background-color: var(--theme-danger);
    opacity: .85;
    color: var(--theme-text-on-danger);
}

/* Amber takes DARK text, not white. Measured in-browser against these
   tokens: white on --theme-warning (#d97706) is 3.19:1 and FAILS AA,
   --theme-text-emphasis (#111827) on it is 5.57:1 and passes. This is
   the one solid variant that breaks the on-primary-text habit, and it
   breaks it on purpose. */
.btn-warning {
    background-color: var(--theme-warning);
    border-color: var(--theme-warning);
    color: var(--theme-text-emphasis);
}
.btn-warning:hover, .btn-warning:focus {
    opacity: .85;
    color: var(--theme-text-emphasis);
}

/* The quiet neutral - now the house quiet button (.btn-quiet) under its old name. */
.btn-light {
    background-color: var(--wf-card);
    border-color: var(--wf-line-strong);
    color: var(--theme-text-emphasis);
}
.btn-light:hover, .btn-light:focus {
    background-color: var(--wf-card-hover);
    border-color: var(--wf-line-strong);
    color: var(--theme-text-emphasis);
}

/* The quiet shape with the accent in its ink ("make something new"). */
.btn-outline-accent {
    background-color: var(--wf-card);
    border-color: var(--wf-line-strong);
    color: var(--wf-accent-ink);
}
.btn-outline-accent:hover, .btn-outline-accent:focus {
    background-color: var(--wf-accent-soft);
    border-color: color-mix(in srgb, var(--theme-accent) 45%, var(--wf-line-strong));
    color: var(--wf-accent-ink);
}

/* ---- Modal size alias -------------------------------------------
   Same fix the modal-lg / modal-xl aliases above document: the house
   class is .modal-dialog-sm, but 9 dialogs write .modal-sm, so every
   one of them silently sat at the 500px base cap. Both names valid. */
.modal-dialog.modal-sm { max-width: 300px; }

/* ---- Type scale -------------------------------------------------
   .fs-1 (2.5rem) and .fs-5 already existed with a hole between them;
   34 uses of fs-2/3/4/6 fell into it. Filled from the font-size
   tokens so the scale stays monotonic:
   2.5rem > 1.875 > 1.5 > 1.25 > 1rem > 0.875rem. */
.fs-2                 { font-size: var(--theme-font-size-3xl) !important; }
.fs-3                 { font-size: var(--theme-font-size-2xl) !important; }
.fs-4                 { font-size: var(--theme-font-size-xl) !important; }
.fs-6                 { font-size: var(--theme-font-size-base) !important; }

/* ---- Opacity utilities ------------------------------------------ */
.opacity-25 { opacity: .25 !important; }
.opacity-50 { opacity: .50 !important; }
.opacity-75 { opacity: .75 !important; }
.opacity-100 { opacity: 1 !important; }

/* ---- Spacing scale ----------------------------------------------
   The margin scale stopped at -4 while padding already had a -5 tier
   (p-5 / py-5 = 3rem). Completing the -4 row and adding the matching
   -5 row keeps the two halves of the scale in step - an arbitrary
   gap in a utility scale is exactly what produced this whole sweep. */
.ms-4 { margin-inline-start: 1.5rem !important; }
.me-4 { margin-inline-end: 1.5rem !important; }
.mx-4 { margin-inline: 1.5rem !important; }
.my-4 { margin-block: 1.5rem !important; }

.m-5  { margin: 3rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.ms-5 { margin-inline-start: 3rem !important; }
.me-5 { margin-inline-end: 3rem !important; }
.mx-5 { margin-inline: 3rem !important; }
.my-5 { margin-block: 3rem !important; }

.gap-5 { gap: 3rem !important; }

/* ---- Text ------------------------------------------------------- */
.text-break {
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

/* ---- Bordered table ---------------------------------------------
   .table already paints horizontal row rules; -bordered adds the
   vertical ones, on the same token. */
.table-bordered th,
.table-bordered td {
    border: 1px solid var(--theme-border);
}

/* ---- Page containers --------------------------------------------
   Every .container in the Portal today already carries its own inline
   max-width (60rem / 1100px / 720px / 480px), so the cap below can
   never narrow an existing page - inline wins. What they were missing
   is the CENTERING they asked for by writing "container" at all: with
   no rule, the block sat left-aligned against the rail. */
.container {
    width: 100%;
    max-width: 1320px;
    margin-inline: auto;
    padding-inline: 1rem;
}
.container-fluid {
    width: 100%;
    margin-inline: auto;
    padding-inline: 1rem;
}
