/* =====================================================================
   The common components of the four applications (PBI #595): one definition per component, which reads on the
   console and on the paper through the surface tokens of tokens.css (--on-surface, --control-border, --link,
   --btn-*…). Linked right after tokens.css by every application: the panel, Unit Control and the chat's dossier window
   bundle it (FccCssBundle), the Marketplace and the chat link it, and the public site writes it inline (PageStyles).
   In the shared layer: Bootstrap (vendor) never wins over it; what an application adds on top (the app layer, or the
   unlayered css/site.css of the public family) only places a button (width, order, margins), never recolours it.

   Sections: 1 buttons, 2 windows (FccDialog and FccDrawer), 3 fields; after the layer, chip and counter (PBI #600, unlayered).
   ===================================================================== */
@layer shared {
    /* ---- 1 · Buttons (PBI #596) ----------------------------------------------------------------------------------
       .btn plus one variant: .btn-primary (the main action: gold on the console, ink on the paper), .btn-ghost (border
       >= 3:1, text of the surface), .btn-outline (gold border, the public family), .btn-danger and .btn-danger-ghost,
       .btn-link and .btn-icon (square, for an icon with its aria-label). Sizes .btn-sm and .btn-lg. Sentence case.
       Every text >= 4.5:1 on its surface, also disabled (PBI #604: the reason goes beside it, .btn-reason).
       Until #597 and #598 move the markup to these names, the Bootstrap names still in it are read as their common
       variant: .btn-success as .btn-primary, .btn-outline-primary / -secondary / -warning and .btn-secondary as
       .btn-ghost, .btn-outline-danger as .btn-danger-ghost. */
    :root {
        --btn-fs:.875rem;    --btn-h:40px; --btn-pad:8px 16px;
        --btn-fs-sm:.875rem;  --btn-h-sm:32px; --btn-pad-sm:4px 10px;
        --btn-fs-lg:1rem;    --btn-h-lg:48px; --btn-pad-lg:12px 22px;
    }
    /* The scale of the public family (the web, the Marketplace and the chat), and of Unit Control since PBI #637 (epic
       #630, <html class="fcc-uc">): 44, 38 and 52 px high, 15.7 px. The panel keeps the one of :root. */
    :root.fcc-site, :root.fcc-uc {
        --btn-fs:.98rem;  --btn-h:44px; --btn-pad:10px 18px;
        --btn-fs-sm:.9rem; --btn-h-sm:38px; --btn-pad-sm:6px 12px;
        --btn-fs-lg:1.05rem; --btn-h-lg:52px; --btn-pad-lg:12px 24px;
    }
    /* On touch every button, also .btn-sm and the square .btn-icon, is a 44 px target (PBI #617; :root.fcc-site and
       :root.fcc-uc included, or their own .btn-sm would win). */
    @media (pointer: coarse) { :root, :root.fcc-site, :root.fcc-uc { --btn-h:44px; --btn-h-sm:44px; } }

    .btn {
        display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:var(--btn-h); padding:var(--btn-pad);
        border:1px solid transparent; border-radius:var(--uc-radius); background:transparent; color:var(--on-surface);
        font:600 var(--btn-fs)/1.2 var(--ag-sans); letter-spacing:.01em; text-transform:none; text-align:center;
        text-decoration:none; cursor:pointer; box-shadow:none;
        transition:background-color .15s, border-color .15s, color .15s, transform .15s;
    }
    .btn:focus-visible { outline:2px solid var(--accent-text); outline-offset:2px; box-shadow:none; }
    .btn:focus:not(:focus-visible) { box-shadow:none; }
    .btn-sm { min-height:var(--btn-h-sm); padding:var(--btn-pad-sm); font-size:var(--btn-fs-sm); }
    .btn-lg { min-height:var(--btn-h-lg); padding:var(--btn-pad-lg); font-size:var(--btn-fs-lg); }
    .btn-block { width:100%; }

    .btn:is(.btn-primary, .btn-success) { border-color:var(--btn-primary-bg); background:var(--btn-primary-bg); color:var(--btn-primary-text); }
    .btn:is(.btn-primary, .btn-success):hover:not(:disabled, .disabled) {
        border-color:var(--btn-primary-hover); background:var(--btn-primary-hover); color:var(--btn-primary-text); transform:translateY(-1px);
    }
    .btn:is(.btn-ghost, .btn-outline-primary, .btn-outline-secondary, .btn-outline-warning, .btn-secondary) {
        border-color:var(--control-border); background:transparent; color:var(--on-surface);
    }
    .btn:is(.btn-ghost, .btn-outline-primary, .btn-outline-secondary, .btn-outline-warning, .btn-secondary):hover:not(:disabled, .disabled) {
        border-color:var(--accent-text); background:color-mix(in srgb, var(--accent-text) 12%, transparent); color:var(--on-surface);
    }
    .btn.btn-outline { border-color:var(--accent-text); background:transparent; color:var(--accent-text); }
    .btn.btn-outline:hover:not(:disabled, .disabled) { background:color-mix(in srgb, var(--accent-text) 14%, transparent); color:var(--accent-text); }
    .btn.btn-danger { border-color:var(--btn-danger-bg); background:var(--btn-danger-bg); color:var(--btn-danger-text); }
    .btn.btn-danger:hover:not(:disabled, .disabled) { border-color:var(--btn-danger-hover); background:var(--btn-danger-hover); color:var(--btn-danger-text); }
    .btn:is(.btn-danger-ghost, .btn-outline-danger) { border-color:var(--danger-text); background:transparent; color:var(--danger-text); }
    .btn:is(.btn-danger-ghost, .btn-outline-danger):hover:not(:disabled, .disabled) {
        border-color:var(--danger-text); background:color-mix(in srgb, var(--danger-text) 12%, transparent); color:var(--danger-text);
    }
    .btn.btn-link { min-height:0; padding-inline:4px; border-color:transparent; background:transparent; color:var(--link); text-underline-offset:3px; }
    .btn.btn-link:hover:not(:disabled, .disabled) { color:var(--link); text-decoration:underline; }
    .btn.btn-icon { min-width:var(--btn-h); padding:0; }
    .btn.btn-icon.btn-sm { min-width:var(--btn-h-sm); }
    .btn > svg, .btn > .uc-icon { flex:none; }
    /* A pressed toggle (aria-pressed, .active, the checked Bootstrap .btn-check). */
    .btn:is(.active, [aria-pressed="true"]), .btn-check:checked + .btn {
        border-color:var(--accent-text); background:color-mix(in srgb, var(--accent-text) 18%, transparent); color:var(--on-surface);
    }

    /* Disabled: inactive, not broken, and still readable (PBI #604). Its outline keeps 3:1 (PBI #708: the edge of a
       control is never fainter than that) and says «inactive» with a dashed line and the muted text. */
    .btn:is(:disabled, .disabled, .is-disabled) { opacity:1; cursor:not-allowed; transform:none; box-shadow:none; }
    .btn:is(.disabled, .is-disabled) { pointer-events:none; }
    .btn:is(.btn-primary, .btn-success, .btn-danger):is(:disabled, .disabled, .is-disabled) {
        border-color:var(--control-border); background:var(--btn-disabled-bg); color:var(--on-surface-muted);
    }
    .btn:not(.btn-primary, .btn-success, .btn-danger):is(:disabled, .disabled, .is-disabled) {
        border-color:var(--control-border); border-style:dashed; color:var(--on-surface-muted);
    }
    .btn.btn-link:is(:disabled, .disabled, .is-disabled) { border-color:transparent; }
    .btn-reason { display:block; margin-top:4px; color:var(--on-surface-muted); font-size:.85rem; }

    /* ---- 2 · Windows (PBI #601) ----------------------------------------------------------------------------------
       FccDialog with a Surface: .fcc-dialog.is-console (dark panel, gold title) or .is-paper (the manila file; it also
       carries .umap-modal, the paper class every sheet recognises), centred, .is-sm 560 / .is-md 860 / .is-lg 1280 px
       and the whole height. .is-drawer (FccDrawer): from the right, the whole height, 640 px (.is-lg 1120); on a phone a
       sheet that rises from the bottom (PBI #657: panel on the desktop, sheet on the phone, never a window above another). The common chrome: .fcc-dialog-head (title in Barlow, the kicker above it, the close button
       .btn-icon), .fcc-dialog-body (scrolls), .fcc-dialog-foot (the actions, always in view). */
    /* The native <dialog> of FccDialog (opened with showModal, PBI #621 moved it here from components.css):
       The browser's own dialog styles (border, padding, margin, inset, sizes, overflow, colours) are reset with zero
       specificity, so the classes of each window (umap-modal, rx-drawer) place and draw it exactly as the <div> it
       replaced; only the backdrop moves to ::backdrop. */
    :where(dialog.fcc-dialog) {
        inset:auto;
        width:auto;
        height:auto;
        max-width:none;
        max-height:none;
        margin:0;
        padding:0;
        overflow:visible;
        border:0;
        background:transparent;
        color:inherit;
    }
    :where(dialog.fcc-dialog):not([open]) { display:none; }
    :where(dialog.fcc-dialog):focus { outline:none; }
    .fcc-dialog:is(.is-console, .is-paper) {
        position:fixed; z-index:1051; top:50%; left:50%; display:flex; flex-direction:column;
        width:min(860px, calc(100vw - 32px)); max-height:calc(100vh - 80px); transform:translate(-50%, -50%); outline:none;
    }
    .fcc-dialog:is(.is-console, .is-paper).is-sm { width:min(560px, calc(100vw - 32px)); }
    .fcc-dialog:is(.is-console, .is-paper).is-lg { width:min(1280px, calc(100vw - 32px)); height:calc(100vh - 60px); max-height:none; }
    .fcc-dialog:is(.is-console, .is-paper)::backdrop { background:rgba(2,6,10,.72); backdrop-filter:blur(2px); }
    .fcc-dialog.is-console {
        color-scheme:dark; border:1px solid var(--ag-line-2); background:var(--ag-panel-2); color:var(--on-surface);
        box-shadow:0 24px 80px rgba(0,0,0,.65);
    }
    .fcc-dialog.is-paper {
        color-scheme:light; border:1px solid var(--paper-edge); color:var(--on-surface); font-family:var(--ag-sans);
        background:
            radial-gradient(circle at 18% 12%, rgba(255,255,255,.35), transparent 40%),
            repeating-linear-gradient(0deg, rgba(90,70,30,.035) 0 1px, transparent 1px 26px),
            linear-gradient(180deg, var(--paper), var(--paper-2));
        box-shadow:inset 0 0 60px rgba(120,90,40,.22), 0 24px 80px rgba(0,0,0,.65);
    }
    .fcc-dialog.is-drawer {
        top:0; right:0; bottom:0; left:auto; width:min(640px, 100vw); height:auto; max-height:none; transform:none;
        border-width:0 0 0 1px; box-shadow:-24px 0 60px rgba(0,0,0,.55); animation:fcc-drawer-in .18s ease-out;
    }
    .fcc-dialog.is-drawer.is-lg { width:min(1120px, 100vw); }
    .fcc-dialog.is-drawer::backdrop { background:rgba(2,5,8,.62); }
    @keyframes fcc-drawer-in { from { transform:translateX(40px); opacity:.4; } to { transform:none; opacity:1; } }

    .fcc-dialog-head {
        flex:none; display:flex; align-items:center; gap:12px; min-height:50px; padding:10px 8px 10px 22px;
        border-bottom:1px solid var(--ag-line-2); background:var(--ag-panel-3);
    }
    .fcc-dialog-title { flex:1; min-width:0; }
    .fcc-dialog-title small {
        display:block; color:var(--ag-gold-2); font:600 var(--fs-label) var(--ag-sans); letter-spacing:.12em; text-transform:uppercase;
    }
    .fcc-dialog-title h2 {
        margin:0; overflow:hidden; color:var(--on-surface-title); font-family:var(--ag-display); font-size:1.35rem; font-weight:600;
        letter-spacing:.04em; line-height:1.2; text-overflow:ellipsis; white-space:nowrap;
    }
    .fcc-dialog-body { flex:1 1 auto; min-height:0; overflow:auto; padding:18px 22px; }
    .fcc-dialog-foot {
        flex:none; display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:12px 22px;
        border-top:1px solid var(--ag-line-2); background:var(--ag-panel-3);
    }
    .fcc-dialog.is-paper :is(.fcc-dialog-head, .fcc-dialog-foot) { border-color:var(--paper-edge); }
    .fcc-dialog.is-paper .fcc-dialog-head { background:linear-gradient(180deg, var(--paper-head), var(--paper-head-2)); }
    .fcc-dialog.is-paper .fcc-dialog-foot { background:rgba(207,188,140,.35); }
    .fcc-dialog.is-paper .fcc-dialog-title small { color:var(--on-surface-2); }

    @media (max-width:700px) {
        .fcc-dialog:is(.is-console, .is-paper):not(.is-drawer) { width:calc(100vw - 16px); max-height:calc(100dvh - 16px); }
        .fcc-dialog:is(.is-console, .is-paper).is-lg:not(.is-drawer) { height:calc(100dvh - 16px); }
        .fcc-dialog-head { padding-left:14px; }
        :is(.fcc-dialog-body, .fcc-dialog-foot) { padding-left:14px; padding-right:14px; }
        .fcc-dialog.is-drawer .fcc-dialog-foot .btn { flex:1 1 auto; }
        /* The bottom sheet (PBI #657): the whole width, up to 92 % of the height, the top corners rounded and a grip. */
        .fcc-dialog.is-drawer, .fcc-dialog.is-drawer.is-lg {
            top:auto; right:0; bottom:0; left:0; width:100vw; max-height:92dvh; border-width:1px 0 0;
            border-radius:var(--uc-radius) var(--uc-radius) 0 0; animation:fcc-sheet-in var(--dur) ease-out;
        }
        .fcc-dialog.is-drawer .fcc-dialog-head { position:relative; padding-top:16px; }
        .fcc-dialog.is-drawer .fcc-dialog-head::before {
            content:""; position:absolute; top:6px; left:50%; width:40px; height:4px; margin-left:-20px; border-radius:var(--radius-pill);
            background:var(--ag-line-2); opacity:.9;
        }
    }
    @keyframes fcc-sheet-in { from { transform:translateY(48px); opacity:.4; } to { transform:none; opacity:1; } }
    /* «Back» of a step inside a panel (PBI #657): the same 44 px target as the close button. */
    .fcc-dialog-back { flex:none; }
    @media (prefers-reduced-motion: reduce) {
        .fcc-dialog.is-drawer { animation:none; }
    }

    /* ---- 3 · Fields (PBI #599) -----------------------------------------------------------------------------------
       .form-control, .form-select, textarea and .check-input, one look on both surfaces through the surface tokens:
       the field fill (--surface-field: the console panel, the light paper of the sign-in cards), a border >= 3:1
       (--control-border), the text of the surface and a placeholder >= 4.5:1, the ring of #518 on focus (--focus-ring),
       a red border when invalid and a disabled field that is still readable. 15 px Plex Sans and 40 px high (44 on a
       touch screen). What a page adds on top only places a field (width, padding for an icon, a monospaced code). */
    :root { --field-h:40px; --field-h-sm:32px; --field-pad:7px 12px; }
    /* Unit Control: its fields as high as its buttons (PBI #637), 44 and 38 px. */
    :root.fcc-uc { --field-h:44px; --field-h-sm:38px; }
    @media (pointer: coarse) { :root, :root.fcc-uc { --field-h:44px; --field-h-sm:44px; } }

    .form-control, .form-select {
        min-height:var(--field-h); padding:var(--field-pad); border:1px solid var(--control-border); border-radius:var(--uc-radius);
        background-color:var(--surface-field); color:var(--on-surface);
        font:400 var(--fs-body)/1.4 var(--ag-sans); letter-spacing:normal; text-transform:none; box-shadow:none;
    }
    textarea.form-control { min-height:calc(var(--field-h) * 2); line-height:1.5; }
    .form-select { padding-right:36px; --bs-form-select-bg-img:var(--field-arrow); }
    .form-select option { background-color:var(--surface-field); color:var(--on-surface); }
    :is(.form-control, .form-select).form-control-sm, .form-select.form-select-sm { min-height:var(--field-h-sm); padding-block:3px; font-size:var(--fs-action); }
    .form-control::placeholder { color:var(--on-surface-muted); opacity:1; }
    :is(.form-control, .form-select):focus {
        border-color:var(--accent-text); background-color:var(--surface-field); color:var(--on-surface); box-shadow:none;
    }
    :is(.form-control, .form-select, .check-input):focus-visible { outline:2px solid var(--focus-ring); outline-offset:2px; }
    :is(.form-control, .form-select, .check-input):is(.is-invalid, [aria-invalid="true"]) { border-color:var(--danger-text); }
    :is(.form-control, .form-select):is(.is-invalid, [aria-invalid="true"]):focus { border-color:var(--danger-text); box-shadow:none; }
    .form-control.is-invalid { padding-right:12px; background-image:none; }
    .form-select.is-invalid { --bs-form-select-bg-icon:none; }
    :is(.form-control, .form-select):disabled, .form-control[readonly]:not(.form-control-plaintext) {
        border-style:dashed; background-color:var(--btn-disabled-bg); color:var(--on-surface-muted); opacity:1; cursor:not-allowed;
    }
    .form-control[readonly]:not(:disabled) { cursor:default; }

    /* Checks and radios (PBI #606: own names, no Bootstrap underneath): .check is the line (the box hangs in its left
       padding, the label after it), .check-input the box and .check-label its text. The box in the field fill and the
       control border; checked, the main action's fill (gold on the console, ink on paper) with its mark in the colour
       that reads on it. */
    .check { display:block; min-height:1.5rem; padding-left:1.5em; margin-bottom:.125rem; }
    .check > .check-input { float:left; margin-left:-1.5em; }
    .check-input {
        flex-shrink:0; width:1em; height:1em; margin-top:.25em; vertical-align:top; appearance:none;
        border:1px solid var(--control-border); background:var(--surface-field) var(--check-mark, none) center / contain no-repeat;
        box-shadow:none; print-color-adjust:exact;
    }
    .check-input[type="checkbox"] { border-radius:var(--uc-radius); }
    .check-input[type="radio"] { border-radius:50%; }
    .check-input:active { filter:brightness(90%); }
    .check-input:checked { border-color:var(--btn-primary-bg); background-color:var(--btn-primary-bg); }
    .check-input:checked[type="checkbox"] { --check-mark:var(--field-check); }
    .check-input:checked[type="radio"] { --check-mark:var(--field-radio); }
    .check-input:focus { border-color:var(--accent-text); box-shadow:none; }
    .check-input:disabled { pointer-events:none; filter:none; opacity:.6; }
    .check-input:disabled ~ .check-label { color:var(--on-surface-muted); opacity:1; cursor:default; }

    /* ---- 4 · Layout and small helpers (PBI #606) -----------------------------------------------------------------
       FCC's own names for what Unit Control and UI.Shared took from Bootstrap's utilities (row/col, d-flex, mt-3,
       text-muted...), so they no longer need Bootstrap (#607). Only what the pages use; anything that belongs to one
       component goes in that component's stylesheet. tests/.../BootstrapClassListTests forbids the Bootstrap names. */
    .stack { display:flex; flex-direction:column; gap:var(--stack-gap, .5rem); }
    .cluster { display:flex; flex-wrap:wrap; align-items:center; gap:var(--cluster-gap, .5rem); }
    .cluster.is-between { justify-content:space-between; }
    .cluster.is-top { align-items:flex-start; }
    .cluster.is-nowrap { flex-wrap:nowrap; }
    /* A form grid: one column on a phone, two (or three) from 768 px; .grid-full takes the whole row. */
    .grid-2, .grid-3 { display:grid; grid-template-columns:minmax(0, 1fr); gap:var(--grid-gap, 0 1.5rem); }
    @media (min-width: 768px) {
        .grid-2 { grid-template-columns:repeat(2, minmax(0, 1fr)); }
        .grid-3 { grid-template-columns:repeat(3, minmax(0, 1fr)); }
    }
    .grid-full { grid-column:1 / -1; }

    /* Field texts: the label above a control, the help line and the error under it (the Field component has its own
       .fcc-field-*; these are for the forms that are not built with it). */
    .field-label { display:inline-block; margin-bottom:.5rem; }
    .field-hint { display:block; margin-top:.25rem; color:var(--on-surface-muted); font-size:.875em; }
    .field-error { display:block; margin-top:.25rem; color:var(--danger-text); font-size:.875em; }
    .form-control.form-control-color { width:3rem; height:var(--field-h); padding:.375rem; }

    /* Texts, headings and one-off spacing. Like the utilities they replace, the helpers are !important: they win over
       the look of the component they sit on (the forced layer still beats them). */
    .muted { color:var(--on-surface-muted) !important; }
    .danger-text { color:var(--danger-text) !important; }
    .title-md { font-size:1.25rem; }
    .title-sm { font-size:1rem; }
    .flush { margin:0 !important; }
    .space-top { margin-top:1rem !important; }
    .space-start { margin-inline-start:.5rem !important; }
    .fit-width { width:auto !important; }
    .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;
    }

    /* A message box in the flow of a page (AlertBanner, the indexing warning of a unit): the pages give it their look
       (agency.css, design-system.css); here only its box and the colour of each kind. */
    .alert {
        position:relative; margin-bottom:1rem; padding:1rem; border:1px solid var(--control-border); border-radius:var(--uc-radius);
        background:var(--surface-raised); color:var(--on-surface);
    }
    .alert-success { border-color:var(--ok-text); }
    .alert-danger { border-color:var(--danger-text); }
    .alert-warning { border-color:var(--focus-ring); }

    /* ---- 5 · Confirmation next to the button (PBI #786, ConfirmDialog Inline) -------------------------------------
       The base of every application, from the surface tokens (console or paper); Unit Control draws it its own way in
       ux-shared.css (layer app). Cancel before the action, on the right; stacked on a phone. */
    .ux-confirm {
        display:flex; flex-direction:column; gap:8px; margin:8px 0; padding:12px 14px;
        border:1px solid var(--control-border); border-left:3px solid var(--accent-text); border-radius:var(--uc-radius);
        background:var(--surface-raised); color:var(--on-surface);
    }
    .ux-confirm.is-danger { border-left-color:var(--danger-text); }
    .ux-confirm-title { color:var(--on-surface-title, var(--on-surface)); font-size:var(--fs-body); font-weight:600; }
    .ux-confirm.is-danger .ux-confirm-title { color:var(--danger-text); }
    .ux-confirm-text { margin:0; color:var(--on-surface-2); font-size:var(--fs-label); line-height:1.5; }
    .ux-confirm-blockers { padding:8px 10px; border:1px dashed var(--danger-text); font-size:var(--fs-label); }
    .ux-confirm .alert { margin:0; }
    .ux-confirm .ux-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
    @media (max-width: 720px) {
        .ux-confirm .ux-actions { flex-direction:column-reverse; align-items:stretch; }
    }

    @media (prefers-reduced-motion: reduce) {
        .btn { transition:none; }
        .btn:is(.btn-primary, .btn-success):hover:not(:disabled, .disabled) { transform:none; }
    }
}

/* ---- Chip and counter (PBI #600): outside the layers, as #600 linked them. ---------------------------------------- */
/* Common components of the panels and of Unit Control (PBI #600): the chip and the counter. Colours only from tokens.css.
   Chip: 11 px, text >= 4.5:1 and border (currentColor) >= 3:1 on the console; on paper the dark inks. */
.fcc-chip {
    --chip-ink:var(--uc-grey); --chip-bg:var(--uc-grey-bg);
    display:inline-flex; align-items:center; gap:4px; padding:1px 7px; border:var(--uc-border) solid currentColor; border-radius:var(--uc-radius);
    background:var(--chip-bg); color:var(--chip-ink);
    font:600 var(--fs-stamp) var(--ag-mono); font-style:normal; letter-spacing:.08em; line-height:1.35; text-transform:uppercase; white-space:nowrap;
}
.fcc-chip.is-gold { --chip-ink:var(--ag-gold-2); --chip-bg:var(--ag-gold-dim); }
.fcc-chip.is-ok { --chip-ink:var(--uc-green); --chip-bg:var(--uc-green-bg); }
.fcc-chip.is-warn { --chip-ink:var(--uc-amber); --chip-bg:var(--uc-amber-bg); }
.fcc-chip.is-danger { --chip-ink:var(--uc-red); --chip-bg:var(--uc-red-bg); }
.fcc-chip.is-dashed { border-style:dashed; }
.fcc-chip.is-lg { padding:2px 10px; font-size:var(--fs-label); }
/* On paper (dossiers and modals of unit) the same tones take their darker inks. */
:is(.ux-paper, .entity-details-panel:not(.cmd-graph-side), .paper-modal, .dos-sheet, .rec-detail, .profile-card, .paper) .fcc-chip.is-neutral { --chip-ink:var(--uc-grey-paper); }
:is(.ux-paper, .entity-details-panel:not(.cmd-graph-side), .paper-modal, .dos-sheet, .rec-detail, .profile-card, .paper) .fcc-chip:is(.is-gold, .is-warn) { --chip-ink:var(--uc-amber-paper); --chip-bg:rgba(168,118,24,.14); }
:is(.ux-paper, .entity-details-panel:not(.cmd-graph-side), .paper-modal, .dos-sheet, .rec-detail, .profile-card, .paper) .fcc-chip.is-ok { --chip-ink:var(--uc-green-paper); }
:is(.ux-paper, .entity-details-panel:not(.cmd-graph-side), .paper-modal, .dos-sheet, .rec-detail, .profile-card, .paper) .fcc-chip.is-danger { --chip-ink:var(--uc-red-paper); }

/* State (PBI #780, chapter 9 of the flow audit): the chip, its sentence and one next action, as the cards of Cuarteles
   (#736). Stacked by default; .is-compact puts the three on one line and wraps them when there is no room (390 px).
   The sentence keeps the muted tone of the surface (>= 4.5:1 on console and paper); the chip carries the colour. */
.fcc-status { display:grid; grid-template-columns:minmax(0, 1fr); justify-items:start; gap:4px; min-width:0; }
.fcc-status-why { margin:0; color:var(--on-surface-2); font-size:var(--fs-meta); line-height:1.4; overflow-wrap:anywhere; }
.fcc-status-action { margin-top:4px; }
.fcc-status.is-compact { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; }
.fcc-status.is-compact .fcc-status-why { flex:1 1 16ch; min-width:0; }
.fcc-status.is-compact .fcc-status-action { margin-top:0; margin-left:auto; }

/* Counter: white on --uc-red-badge (6.5:1), 11 px; the gold variant for the counts of tabs. */
.fcc-badge {
    display:inline-grid; place-items:center; box-sizing:border-box; min-width:19px; height:19px; padding:0 5px; border-radius:10px;
    background:var(--uc-red-badge); color:var(--ag-white); font:700 var(--fs-stamp)/19px var(--ag-mono); text-align:center; font-style:normal;
}
.fcc-badge.is-gold { background:var(--ag-gold); color:var(--uc-cta-text); }

/* The invitations to groups at the top of the list of conversations (PBI #809). */
.chat-invitations { padding: 0.75rem; border-bottom: 1px solid var(--line); }
.chat-invitations-title { margin: 0 0 0.5rem; font-size: 0.875rem; }
.chat-invitations-list { display: flex; flex-direction: column; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.chat-invitations-group { margin: 0 0 0.25rem; font-weight: 600; overflow-wrap: anywhere; }
.chat-invitations-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.chat-invitations-error { margin: 0 0 0.5rem; color: var(--danger-text); font-size: 0.875rem; }

/* The chips that filter (PBI #975): pills in Plex Sans, sentence case, a 44 px target, the count in grey (.fcc-count or small).
   The same in the events of the web and in the topics of FCC Videos; the list form (nav.chips > ul > li > a) is the same row. */
.chips, .chips ul { display: flex; flex-wrap: wrap; gap: 8px; }
.chips ul, ul.chips { margin: 0; padding: 0; list-style: none; }
.chips a, .chips button {
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--line-control); border-radius: 999px;
    background: var(--panel); color: var(--text); font: 500 .92rem var(--sans); cursor: pointer;
}
.fcc-count, .chips small { color: var(--muted); font-size: var(--fs-label); font-weight: 400; }
.chips a:hover, .chips button:hover { border-color: var(--gold); color: var(--gold-2); }
.chips a[aria-current="page"], .chips button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold); color: var(--ag-gold-ink); }
.chips a[aria-current="page"] :is(small, .fcc-count), .chips button[aria-pressed="true"] :is(small, .fcc-count) { color: var(--ag-gold-ink); }
