/*
 * Product components (cb-*), ported from docs/charte/bundle.css as native nested CSS,
 * without the .cb root that only isolated the design-system previews.
 * Generic controls (buttons, fields, switch, card, table, dropdown, badge) stay Tabler's:
 * nothing here redraws them. Colors come from tokens.css only.
 */

/*
 * The mark of the AI (Thibault's decision of 5 November 2026): the sparkles of Tabler and the gradient from ai-start to
 * ai-end, the one gradient of the charte, which only the AI wears. base.html.twig defines the gradient once for the page
 * (#cb-ai-gradient, its stops below); .cb-ai-icon strokes the sparkles with it, the violet where it cannot. A border of the
 * gradient is the gradient drawn on the border box, under a fill of the padding box.
 */
.cb-ai-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;

    & stop:first-child {
        stop-color: var(--ai-start);
    }

    & stop:last-child {
        stop-color: var(--ai-end);
    }
}

.cb-ai-icon path,
.cb-btn--generate-outline .icon path {
    stroke: url("#cb-ai-gradient") var(--ai-start);
}

/*
 * What the AI made, in a pill (Cb:AiPill): the gradient on its border and the violet ink, read or not. Solid, the gradient
 * fills it: the brief waits for a person to read it.
 */
.cb-ai-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-width: 100%;
    padding: 0 var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: linear-gradient(var(--surface-raised), var(--surface-raised)) padding-box, linear-gradient(90deg, var(--ai-start), var(--ai-end)) border-box;
    color: var(--ai-ink);
    font: 600 12px/20px var(--font-sans);
    white-space: nowrap;
    vertical-align: middle;

    /* Size only: the stroke comes from .icon */
    & svg {
        flex: none;
        width: 12px;
        height: 12px;
    }
}

.cb-ai-pill--solid {
    gap: 6px;
    padding: 2px 10px;
    border: 0;
    background: linear-gradient(90deg, var(--ai-start), var(--ai-end-strong));
    color: var(--on-ai);
    font-size: 13px;

    & svg {
        width: 14px;
        height: 14px;
    }
}

/* A card that waits for a person to read what the AI prepared (the brief, an expected file): the gradient on its border. */
.card.cb-ai-card {
    border: 1.5px solid transparent;
    background: linear-gradient(var(--surface-raised), var(--surface-raised)) padding-box, linear-gradient(90deg, var(--ai-start), var(--ai-end)) border-box;
}

/* The thumbnail of a file the AI proposed and nobody has read yet: ringed with the gradient. */
.cb-thumb.cb-ai-ring {
    border: 1.5px solid transparent;
    background: linear-gradient(var(--surface-sunken), var(--surface-sunken)) padding-box, linear-gradient(135deg, var(--ai-start), var(--ai-end)) border-box;
}

/* "L'IA" as a piece of a meta line: the sparkles in the gradient, then the word. */
.cb-ai-author {
    display: inline-flex;
    align-items: center;
    gap: 2px;

    & svg {
        flex: none;
        width: 14px;
        height: 14px;
    }
}

/*
 * Generation button: modifiers set on a Tabler .btn, through Tabler's own button variables so that hover, active and focus
 * states keep working. The only action that carries the sparkles. The solid one is the filled gradient with an ai-soft-start
 * ring that widens on hover; the outline one draws the gradient on its border and its sparkles.
 */
.cb-btn--generate {
    --tblr-btn-color: var(--on-ai);
    --tblr-btn-bg: var(--ai-start);
    --tblr-btn-border-color: transparent;
    --tblr-btn-hover-color: var(--on-ai);
    --tblr-btn-hover-bg: var(--ai-start);
    --tblr-btn-hover-border-color: transparent;
    --tblr-btn-active-color: var(--on-ai);
    --tblr-btn-active-bg: var(--ai-start);
    --tblr-btn-active-border-color: transparent;
    --tblr-btn-box-shadow: 0 0 0 3px var(--ai-soft-start);

    background-image: linear-gradient(90deg, var(--ai-start), var(--ai-end-strong));

    &:hover {
        --tblr-btn-box-shadow: 0 0 0 4px var(--ai-soft-start);
    }
}

.cb-btn--generate-outline {
    --tblr-btn-color: var(--ink);
    --tblr-btn-border-color: transparent;
    --tblr-btn-hover-color: var(--ink);
    --tblr-btn-hover-border-color: transparent;
    --tblr-btn-active-color: var(--ink);
    --tblr-btn-active-border-color: transparent;

    background: linear-gradient(var(--surface-raised), var(--surface-raised)) padding-box, linear-gradient(90deg, var(--ai-start), var(--ai-end)) border-box;

    &:hover,
    &:active {
        background: linear-gradient(90deg, var(--ai-soft-start), var(--ai-soft-end)) padding-box, linear-gradient(90deg, var(--ai-start), var(--ai-end)) border-box;
    }
}

/* Deliverable status badge */
.cb-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 24px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    font: 600 12px/16px var(--font-sans);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;

    /* Size only: a Tabler icon gets its 1.5px stroke from .icon */
    & svg {
        width: 14px;
        height: 14px;
    }
}

.cb-badge--brief {
    background: var(--info-soft);
    color: var(--info);
}

.cb-badge--draft {
    background: linear-gradient(90deg, var(--ai-soft-start), var(--ai-soft-end));
    color: var(--ai-ink);

    & svg {
        width: 12px;
        height: 12px;
    }
}

.cb-badge--review {
    background: var(--warning-soft);
    color: var(--ink);
}

.cb-badge--validated {
    background: var(--success-soft);
    color: var(--success);
}

.cb-badge--delivered {
    background: var(--brand-soft);
    color: var(--brand);
}

.cb-badge--refused {
    background: var(--danger-soft);
    color: var(--danger);
}

.cb-badge--neutral {
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

/* Version chip */
.cb-version {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 28px;
    padding: 0 var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    background: var(--surface-raised);
    color: var(--ink);
    font: 400 13px/20px var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.cb-version--current {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}

.cb-version__meta {
    color: var(--ink-muted);
}

/* Annotation canvas, pin and bubble */
.cb-canvas {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 3 / 2;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-sunken);
    overflow: hidden;
}

.cb-pin {
    position: absolute;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--surface-raised);
    border-radius: var(--radius-pill);
    background: var(--info);
    box-shadow: var(--shadow-sm);
    color: var(--surface);
    font: 500 11px/16px var(--font-mono);
    transform: translate(-50%, -50%);
}

.cb-pin--done {
    background: var(--success);
}

.cb-pin--ai {
    background: linear-gradient(135deg, var(--ai-start), var(--ai-end-strong));
    color: var(--on-ai);
}

.cb-bubble {
    position: absolute;
    max-width: 240px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
    font: 400 13px/20px var(--font-sans);
}

.cb-bubble__meta {
    display: block;
    margin-bottom: 2px;
    color: var(--ink-muted);
    font: 400 11px/16px var(--font-mono);
}

/* Deliverable card */
.cb-card {
    width: 100%;
    max-width: 320px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.cb-card__preview {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: var(--surface-sunken);
    color: var(--ink-faint);
    font: 400 13px/20px var(--font-mono);
}

.cb-card__body {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-4);
}

.cb-card__title {
    margin: 0;
    font: 600 17px/24px var(--font-display);
}

.cb-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

/* A line of meta: pieces (spans), each its own translated text, with the dot between them drawn here so that no sentence has to join them.
   A piece never breaks inside, and the dot ends the piece before it: when the line wraps, the dot stays at the end of the line it
   separates and never opens the next one. A piece longer than the line (a client name of 150 characters) ends in an ellipsis
   instead of pushing the page sideways. */
.cb-meta {
    display: flex;
    flex-wrap: wrap;
    column-gap: var(--space-2);
    min-width: 0;

    & > * {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    & > :not(:last-child)::after {
        content: '·';
        content: '·' / '';
        margin-inline-start: var(--space-2);
    }
}

/*
 * A meta line that wraps (the address and the last visit of a person): each piece draws its dot before itself, in a
 * margin the line lends on its start side. The piece that opens a line has its dot in that margin, which the clip hides,
 * so a line never ends on a dot alone nor starts with one.
 */
.cb-meta--wrap {
    column-gap: 0;
    margin-inline-start: calc(-1 * var(--space-4));
    clip-path: inset(0 0 0 var(--space-4));

    & > :not(:last-child)::after {
        content: none;
    }

    & > ::before {
        content: '·';
        content: '·' / '';
        display: inline-block;
        width: var(--space-4);
        text-align: center;
    }
}

/*
 * Thumbnail of a file of a library: the image itself (up to 2 MB, Asset::hasPreview()) or a tile with its extension.
 * sm is a 40px square, md fills its column at 4:3 (the board of a library), lg is a 120px square.
 * The image is contained, never cropped: a logo keeps its whole shape on the sunken background.
 */
.cb-thumb {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

.cb-thumb--sm {
    width: 40px;
    aspect-ratio: 1;
}

.cb-thumb--md {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
}

.cb-thumb--lg {
    width: 120px;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
}

.cb-thumb__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: var(--space-1);
    object-fit: contain;
}

.cb-thumb__label {
    max-width: 100%;
    padding-inline: 2px;
    overflow: hidden;
    font: 500 10px/16px var(--font-mono);
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-thumb__disc {
    display: grid;
    place-items: center;
    width: 60%;
    max-width: 36px;
    aspect-ratio: 1;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--ai-start), var(--ai-end-strong));
    color: var(--on-ai);

    & svg {
        width: 55%;
        height: 55%;
    }
}

.cb-thumb--md .cb-thumb__label {
    padding-inline: var(--space-1);
    font-size: 13px;
}

.cb-thumb--lg .cb-thumb__label {
    padding-inline: var(--space-1);
    font-size: 14px;
}

/*
 * Mosaic: up to four thumbnails of a library in a 2 × 2 grid, or the initial of its name on the same sunken square.
 * The square is 56px (sm) or 96px (md) whatever it holds, so a list of them lines up.
 */
.cb-mosaic {
    display: grid;
    flex: none;
    grid-template-columns: repeat(2, 1fr);
    align-content: start;
    gap: 2px;
    padding: var(--space-1);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);

    & .cb-thumb {
        width: auto;
        border: 0;
        border-radius: var(--radius-sm);
        background: var(--surface-raised);
    }

    & .cb-thumb__label {
        padding-inline: 0;
        font-size: 7px;
        line-height: 8px;
    }
}

.cb-mosaic--sm {
    width: 56px;
    height: 56px;
}

.cb-mosaic--md {
    width: 96px;
    height: 96px;
    gap: var(--space-1);
    padding: 6px;

    & .cb-thumb__label {
        font-size: 10px;
        line-height: 12px;
    }
}

.cb-mosaic--initial {
    grid-template-columns: 1fr;
    place-items: center;
    align-content: center;
    padding: 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
}

.cb-mosaic--initial.cb-mosaic--sm {
    font-size: 24px;
    line-height: 1;
}

.cb-mosaic--initial.cb-mosaic--md {
    font-size: 40px;
    line-height: 1;
}

/*
 * Filmstrip: the files of a project once its brief is validated. The production reads a grid of cards (Cb:ObjectCard, its
 * menu beside it, over the top right of the image): the extension stands large in the image zone until a version gives a
 * thumbnail, the status in a pill at its top left. A principal and its declinations share one sunken frame, where the
 * image zones turn to the ground of the page: a pair spans two columns, more take the row. The grid has three columns
 * from 40rem of room, two from 24rem, one under. A waiting declination mutes its status. The client side reads one line per file,
 * a declination indented under its principal.
 */
.cb-film-section {
    container-type: inline-size;
    display: grid;
    gap: var(--space-4);
    min-width: 0;
}

.cb-film-section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.cb-film {
    --cb-film-columns: 1;

    display: grid;
    grid-template-columns: repeat(var(--cb-film-columns), minmax(0, 1fr));
    gap: var(--space-4);
}

.cb-film__group {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(var(--cb-film-columns), minmax(0, 1fr));
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: calc(var(--radius-lg) + var(--space-1));
    background: var(--surface-sunken);

    & .cb-object--grid .cb-object__media {
        background: var(--surface);
    }
}

@container (min-width: 24rem) {
    .cb-film {
        --cb-film-columns: 2;
    }
}

@container (min-width: 40rem) {
    .cb-film {
        --cb-film-columns: 3;
    }

    .cb-film__group--pair {
        --cb-film-columns: 2;

        grid-column: span 2;
    }
}

.cb-film__card {
    display: grid;

    & .cb-object__meta {
        font-family: var(--font-mono);
    }

    & .cb-object__status {
        color: var(--ink-muted);
        font: 400 12px/16px var(--font-mono);
    }
}

.cb-film__ext {
    color: var(--ink-muted);
    font: 500 28px/1 var(--font-mono);
    letter-spacing: 0.04em;
}

.cb-film__status {
    padding: 2px var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    font: 600 13px/20px var(--font-sans);
    white-space: nowrap;
}

/* On the image zone of a card, the pill keeps clear of the grip and the menu at the other corner */
.cb-film__card .cb-film__status {
    position: absolute;
    top: var(--space-3);
    inset-inline-start: var(--space-3);
    max-width: calc(100% - 2 * var(--space-3) - var(--space-7) - var(--space-5));
    overflow: hidden;
    background: var(--surface-raised);
    text-overflow: ellipsis;
}

.cb-film__group .cb-film__card .cb-film__status {
    background: var(--surface-sunken);
}

.cb-film__card--waiting .cb-film__status {
    color: var(--ink-muted);
}

/* On a phone the status of a line goes under its name: the name and the meta keep the width */
.cb-film-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-1) var(--space-3);

    @media (max-width: 575.98px) {
        & > .cb-thumb {
            grid-row: span 2;
            align-self: start;
        }

        & > .cb-film__status {
            grid-column: 2;
            justify-self: start;
        }
    }
}

.cb-film-row--declination > .cb-thumb {
    margin-inline-start: var(--space-5);
}

.cb-film-row__body {
    display: grid;
    min-width: 0;
}

.cb-film-row__name {
    overflow-wrap: anywhere;
    font-weight: 600;
}

.cb-film-row__meta {
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-mono);
}

/*
 * Steps of a long process (Cb:Steps): one bar per step, full with a check once passed, half full for the current step,
 * whose name stands in ink with whose turn it is after the dot of its meta. In a band narrower than 50rem (the calm
 * column of a client, a tablet) whose turn it is goes under the name, which a fifth of the band cannot hold on one line.
 * Below 576px the other steps keep their bar and leave their name to screen readers: the current step takes the room.
 */
.cb-steps {
    container-type: inline-size;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.cb-steps__step {
    position: relative;
    display: grid;
    align-content: start;
    gap: var(--space-2);
    min-width: 0;
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

.cb-steps__bar {
    height: 4px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--line);

    &::before {
        content: '';
        display: block;
        width: 0;
        height: 100%;
        border-radius: inherit;
        background: var(--brand);
    }
}

.cb-steps__step--done .cb-steps__bar::before {
    width: 100%;
}

.cb-steps__step--current .cb-steps__bar::before {
    width: 50%;
}

.cb-steps__label {
    display: flex;
    align-items: center;
    min-width: 0;

    & > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.cb-steps__step--done .cb-steps__label {
    gap: var(--space-1);

    & > svg {
        flex: none;
        width: 16px;
        height: 16px;
        color: var(--brand);
    }
}

.cb-steps__step--current {
    color: var(--ink);
}

.cb-steps__name {
    font-weight: 600;
}

.cb-steps__turn {
    color: var(--ink-muted);
}

@container (max-width: 50rem) {
    .cb-steps__step--current .cb-steps__label {
        flex-direction: column;
        align-items: stretch;

        & > :not(:last-child)::after {
            content: none;
        }
    }
}

@media (max-width: 575.98px) {
    .cb-steps {
        display: flex;
    }

    .cb-steps__step {
        flex: 0 0 var(--space-5);
    }

    .cb-steps__step--current {
        flex: 1 1 0;
    }

    .cb-steps__step:not(.cb-steps__step--current) .cb-steps__label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
}

/* A card whose form is open (the brief of the team being written) takes the brand border. */
.cb-card--editing {
    border-color: var(--brand);
}

/*
 * The frame of the pages of a project (layout/project.html.twig): the summary of the project on the left, on the sunken
 * ground, the full height of the window and sticky under the banner; the header and the body of the page on the right.
 * Below the breakpoint the summary is an offcanvas of Tabler, opened by its button above the header.
 */
.cb-frame {
    @media (min-width: 992px) {
        display: grid;
        grid-template-columns: 16rem minmax(0, 1fr);
        align-items: start;
    }
}

.cb-frame__work {
    min-width: 0;
}

.cb-project-summary-toggle {
    margin: var(--space-3) var(--space-3) 0;
}

@media (min-width: 992px) {
    .cb-frame > .cb-project-summary-frame {
        position: sticky;
        top: var(--cb-env-banner-height, 0px);
        height: calc(100vh - var(--cb-env-banner-height, 0px));
        overflow-y: auto;
        border-inline-end: 1px solid var(--line);
        background: var(--surface-sunken);

        & > .offcanvas-body {
            display: block;
        }
    }
}

.cb-project-summary {
    display: grid;
    align-content: start;
    gap: var(--space-2);
    width: 100%;
}

.cb-project-summary__project {
    margin: 0;
    padding-inline: var(--space-2);
    color: var(--ink-muted);
    font: 600 13px/20px var(--font-sans);
    overflow-wrap: anywhere;
}

.cb-project-summary__files {
    margin: var(--space-2) 0 0;
    padding: var(--space-2) var(--space-2) 0;
    border-block-start: 1px solid var(--line);
    color: var(--ink-muted);
    font: 600 11px/16px var(--font-sans);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* A declination sits a short step under its principal: long names keep their room in a column of 16rem */
.cb-project-summary .cb-file-nav__entry--declination {
    gap: var(--space-2);
    padding-inline-start: var(--space-1);

    .cb-files__branch {
        width: 16px;
        height: 16px;
    }
}

/* The dot of who has to act, on the corner of the tile: to act in info, waiting in ink-muted, validated in success */
.cb-project-summary__tile {
    position: relative;
    overflow: visible;
}

.cb-project-summary__signal {
    position: absolute;
    inset-block-start: -3px;
    inset-inline-end: -3px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--surface-sunken);
    border-radius: 50%;
    background: var(--ink-muted);

    &[data-signal='to_act'] {
        background: var(--info);
    }

    &[data-signal='validated'] {
        background: var(--success);
    }
}

/*
 * A card read folded (the brief once validated, at the top of the page of a project): its title and "Éditer" on one
 * line, who validated it, then an extract of the text, cut after 5 lines until "Lire le brief" lets it run. Its headings
 * keep to the size of the text.
 */
.cb-folded {
    display: grid;
    gap: var(--space-3);
}

.cb-folded__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);

    & > .card-title {
        margin: 0;
    }
}

.cb-folded__text {
    font: 400 14px/22px var(--font-sans);

    & :is(h1, h2, h3, h4, h5, h6) {
        margin-block: 0 var(--space-1);
        font: 600 15px/22px var(--font-display);
    }

    & > :last-child {
        margin-block-end: 0;
    }
}

/*
 * The toolbar of the Markdown editor (the brief of the team): a band on the sunken ground, joined to the top of its
 * field, so the buttons and the text read as one tool.
 */
.cb-md-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: var(--space-1);
    border: 1px solid var(--line-strong);
    border-bottom-color: var(--line);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: var(--surface-sunken);

    & + * > textarea.form-control {
        border-top: 0;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }
}

/* Who validated the brief, in a green pill (the words carry the state, the colour only marks it), then the date as meta */
.cb-validated-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

.cb-validated {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-width: 100%;
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--success-soft);
    color: var(--success);
    font-weight: 600;

    /* Size only: the stroke comes from .icon */
    & svg {
        flex: none;
        width: 12px;
        height: 12px;
    }
}

.cb-workbench__work {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-width: 0;
}

/*
 * The entries of the summary of a project (templates/workspace/project/_summary.html.twig): the project, then each file
 * (the tile of its extension, its name over its status), a declination behind a bent arrow; the open page stands on
 * brand-soft with a brand border. Then the page of a file (templates/workspace/file.html.twig): the preview at 16:9 (the
 * extension, large, until a version gives one) and what is expected, as a list of terms, on one column under 576px.
 */
.cb-file-nav {
    padding: var(--space-4) var(--space-2);

    & ul {
        display: grid;
        gap: 2px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    & ul ul {
        margin-block-start: 2px;
    }
}

.cb-file-nav__entry {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: calc(var(--space-2) - 1px);
    border: 1px solid transparent;
    border-radius: var(--radius-md);

    &,
    &:hover,
    &:focus,
    &:active {
        color: var(--ink);
        text-decoration: none;
    }

    &:hover {
        background: var(--surface-raised);
    }

    &[aria-current='page'] {
        border-color: var(--brand);
        background: var(--brand-soft);
    }
}

.cb-file-nav__entry--declination {
    padding-inline-start: var(--space-4);
}

.cb-file-nav__icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--ink-muted);

    & > svg {
        width: 20px;
        height: 20px;
    }
}

.cb-file-nav__icon--validated {
    background: var(--success-soft);
    color: var(--success);
}

.cb-file-nav__text {
    display: grid;
    min-width: 0;
}

.cb-file-nav__name {
    overflow-wrap: anywhere;
    font: 600 14px/20px var(--font-sans);
}

.cb-file-nav__status {
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);

    [aria-current='page'] > .cb-file-nav__text > & {
        color: var(--brand);
    }
}

.cb-file-preview {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--space-2);
    aspect-ratio: 16 / 9;
    background: var(--surface-sunken);
}

.cb-file-preview__ext {
    color: var(--ink-muted);
    font: 500 44px/1 var(--font-mono);
    letter-spacing: 0.04em;
}

.cb-file-preview__none {
    color: var(--ink-muted);
    font-weight: 600;
}

.cb-expected {
    display: grid;
    grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
    gap: var(--space-2) var(--space-4);
    margin: 0;

    & > dt {
        color: var(--ink-muted);
        font-weight: 400;
    }

    & > dd {
        margin: 0;
    }

    @media (max-width: 575.98px) {
        grid-template-columns: minmax(0, 1fr);

        & > dd:not(:last-child) {
            margin-block-end: var(--space-2);
        }
    }
}

.cb-expected__source {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.cb-expected__mono {
    font: 400 14px/22px var(--font-mono);
}

.cb-expected__brief {
    max-width: 60ch;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.cb-expected__declinations {
    display: grid;
    justify-items: start;
    gap: var(--space-1);

    & > a:not(.btn) {
        font-weight: 600;
    }
}

/*
 * The request of a project (templates/workspace/brief/_request.html.twig). Its files are rows: the tile of the extension,
 * the name over the size, and, frozen, the whole row downloads. On the production side a long text is cut after 13
 * lines until "Lire toute la demande" opens it (a <details> with nothing inside: opened, it lets the text run and goes).
 * Once the brief is validated, the client reads the request folded on the sunken ground, its title and meta left of
 * "Lire".
 */
.cb-attachments:not(:first-child) {
    margin-block-start: var(--space-4);
}

.cb-attachment {
    display: flex;
    align-items: center;
    gap: var(--space-3);

    & > svg {
        flex: none;
        color: var(--ink-muted);
    }
}

.cb-attachment__body {
    display: grid;
    flex: 1;
    min-width: 0;
}

.cb-attachment__name {
    font-weight: 600;
}

.cb-clip:has(+ .cb-clip__more:not([open])) {
    max-height: 13lh;
    overflow: hidden;
}

.cb-clip.cb-clip--short:has(+ .cb-clip__more:not([open])) {
    max-height: 5lh;
}

.cb-clip__more {
    &[open] {
        display: none;
    }

    & > summary {
        display: inline;
        color: var(--brand);
        font: 600 13px/20px var(--font-sans);
        cursor: pointer;

        &::-webkit-details-marker {
            display: none;
        }
    }
}

.cb-fold {
    border: 0;
    background: var(--surface-sunken);
    box-shadow: none;
}

.cb-fold__summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--space-3);
    cursor: pointer;

    &::-webkit-details-marker {
        display: none;
    }

    & > .card-title {
        margin: 0;
    }

    & > .cb-meta {
        grid-column: 1;
        color: var(--ink-muted);
    }

    & > .cb-fold__toggle {
        grid-row: 1 / span 2;
        grid-column: 2;
        gap: var(--space-1);
    }
}

.cb-fold[open] .cb-fold__toggle > svg {
    transform: rotate(180deg);
}

/* On the side of the production: the title, who wrote and the files, then "Lire la demande" as a link under them */
.cb-fold--stacked .cb-fold__summary {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-2);

    & > .cb-fold__toggle {
        grid-row: auto;
        grid-column: 1;
        justify-self: start;
    }
}

.cb-fold__toggle--link {
    display: inline-flex;
    align-items: center;
    color: var(--brand);
    font: 600 13px/20px var(--font-sans);
}

/* The validation of the brief in the header of its project: the button, and its reason under it while it waits. */
.cb-validate {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-1);
}

.cb-validate__reason {
    max-width: 20rem;
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
    text-align: end;
}

/*
 * Expected files of a project while its brief waits (the production only): a list of fiches, each read from top to
 * bottom. The grip, the tile of the extension, then the name and its mark, the source and the dimensions, the exports in
 * pills of mono text, the first line of the short brief; the menu on the right. A line parts two principals. The
 * declinations hang under their principal, in a list of their own, joined to the middle of its tile (the stem) by a
 * bent line: down from the tile of the principal, then an elbow at the height of the middle of each declination's tile.
 */
.cb-files {
    --cb-files-start: var(--space-5);
    --cb-files-elbow: 16px;
    --cb-files-stem: calc(var(--cb-files-start) + 18px + var(--space-3) + 20px);

    /* On a phone the declinations step in less: their fiche keeps room for its name */
    @media (max-width: 575.98px) {
        --cb-files-start: var(--space-3);
        --cb-files-elbow: var(--space-3);
    }
}

.cb-files,
.cb-files__declinations {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cb-files__declinations {
    padding-block-end: var(--space-1);
}

.cb-files__group + .cb-files__group {
    border-top: 1px solid var(--line);
}

.cb-files__entry {
    --cb-files-tile: 40px;
    --cb-files-pad: 14px;

    position: relative;
    display: grid;
    grid-template-columns: 18px var(--cb-files-tile) minmax(0, 1fr) auto;
    align-items: start;
    column-gap: var(--space-3);
    padding: var(--cb-files-pad) var(--space-3) var(--cb-files-pad) var(--cb-files-start);

    /* The grip is absent from a file without siblings: every other child keeps its column. */
    & > .cb-grip {
        grid-column: 1;
        margin-top: calc((var(--cb-files-tile) - 20px) / 2);
    }

    & > .cb-thumb {
        grid-column: 2;
        width: var(--cb-files-tile);
    }

    & > .cb-files__body {
        grid-column: 3;
    }

    & > .dropdown {
        grid-column: 4;
    }
}

.cb-files__entry--declination {
    --cb-files-tile: 32px;
    --cb-files-pad: 10px;

    padding-inline-start: calc(var(--cb-files-stem) + var(--cb-files-elbow) + var(--space-2));

    & .cb-files__name {
        font-size: 14px;
        line-height: 20px;
    }
}

.cb-files__group:has(> .cb-files__declinations) > .cb-files__entry::after,
.cb-files__entry--declination:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    inset-inline-start: var(--cb-files-stem);
    border-inline-start: 1.5px solid var(--line-strong);
}

.cb-files__group > .cb-files__entry::after {
    top: calc(var(--cb-files-pad) + var(--cb-files-tile));
}

/* Down the whole height of a declination that is not the last: the elbow branches off it, with no gap at its curve */
.cb-files__entry--declination:not(:last-child)::after {
    top: 0;
}

.cb-files__entry--declination::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-start: var(--cb-files-stem);
    width: var(--cb-files-elbow);
    height: calc(var(--cb-files-pad) + var(--cb-files-tile) / 2);
    border-inline-start: 1.5px solid var(--line-strong);
    border-bottom: 1.5px solid var(--line-strong);
    border-end-start-radius: 8px;
}

/* Its one track never grows past the column: a long name or label wraps instead of passing under the menu */
.cb-files__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
    min-width: 0;

    & > .cb-meta {
        font: 400 13px/20px var(--font-sans);
    }
}

.cb-files__headline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.cb-files__name {
    color: var(--ink);
    font: 600 15px/22px var(--font-sans);
    overflow-wrap: anywhere;

    &,
    &:hover,
    &:focus,
    &:active {
        text-decoration: none;
    }

    &:hover,
    &:focus {
        color: var(--brand);
    }
}

.cb-files__spec {
    font: 400 12px/20px var(--font-mono);

    /* The review reads the dimensions: on a narrow fiche they wrap, never cut */
    white-space: normal;
}

/* The label of an export is what the review checks: on a narrow fiche it wraps inside its pill, never cut */
.cb-files__body .cb-export > * {
    white-space: normal;
}

.cb-files__brief {
    margin: 0;
    overflow: hidden;
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* The bent arrow of a declination in the column of the page of a file */
.cb-files__branch {
    flex: none;
    width: 20px;
    height: 20px;
    color: var(--ink-muted);
}

.cb-files__exports {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.cb-export {
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    font: 400 12px/16px var(--font-mono);
}

/*
 * The grip of an expected file that drags among its siblings (sortable_files_controller.js): a hold for the mouse and the
 * finger, no control. On a fiche, in its own first column; on a card, beside the menu. The place a file leaves fades while
 * it moves.
 */
.cb-grip {
    display: inline-flex;
    color: var(--ink-muted);
    font-size: 20px;
    cursor: grab;
    touch-action: none;
}

.cb-film__card .cb-object-actions__menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.sortable-ghost {
    opacity: 0.4;
}

/*
 * Object card: a project, a client, a library or a workspace as one link (a grid tile or a row). Nothing interactive goes
 * inside it. Hover and focus change the border and the shadow, never the text; the arrow shows with them, and stays visible
 * where nothing hovers (touch).
 */
.cb-object {
    position: relative;
    display: flex;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-sm);

    &,
    &:hover,
    &:focus,
    &:active {
        color: var(--ink);
    }

    &:hover,
    &:focus-visible {
        border-color: var(--line-strong);
        box-shadow: var(--shadow-md);
    }
}

.cb-object__body {
    display: grid;
    flex: 1;
    align-content: start;
    gap: 2px;
    min-width: 0;
}

.cb-object__title {
    margin: 0;
    font: 600 16px/24px var(--font-display);
    overflow-wrap: anywhere;
}

/* The title and its badges (the flags of an account) on one line; the badges wrap under a long title */
.cb-object__headline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    font: 500 13px/20px var(--font-sans);
}

.cb-object__meta {
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

.cb-object__status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-1);
    font: 500 13px/20px var(--font-sans);
}

.cb-object__arrow {
    display: inline-grid;
    flex: none;
    place-items: center;
    color: var(--ink-muted);
    font-size: 18px;
}

.cb-object__aside {
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--space-3);
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

/* Grid: the image zone on top (4:3, sunken), the text under it, the arrow at the foot */
.cb-object--grid {
    flex-direction: column;
    overflow: hidden;

    & .cb-object__media {
        display: grid;
        place-items: center;
        aspect-ratio: 4 / 3;
        padding: var(--space-3);
        border-block-end: 1px solid var(--line);
        background: var(--surface-sunken);
    }

    /* The badge of the card (a project status) sits at the top left of the image zone */
    & .cb-object__media {
        position: relative;
    }

    & .cb-object__media-badge {
        position: absolute;
        inset-block-start: var(--space-3);
        inset-inline-start: var(--space-3);
    }

    /* A mosaic (the library of a project) fills the image zone: a 96px square would float in the middle of a wide card */
    & .cb-object__media:has(> .cb-mosaic) {
        padding: 0;
    }

    & .cb-mosaic {
        place-self: stretch;
        width: auto;
        height: auto;
        border-radius: 0;
    }

    & .cb-mosaic:not(.cb-mosaic--initial) {
        grid-template-rows: repeat(2, 1fr);

        & .cb-thumb {
            aspect-ratio: auto;
        }

        & .cb-thumb__label {
            font-size: 13px;
            line-height: 16px;
        }
    }

    /* A face (Cb:Face, 38px with its ring) sits astride the lower edge of the media; the text keeps clear of its lower half */
    & .cb-object__face {
        position: relative;
        z-index: 1;
        height: 0;
        padding-inline: calc(var(--space-4) - 3px) var(--space-2);
    }

    & .cb-object__face .cb-face {
        transform: translateY(-50%);
    }

    & .cb-object__face + .cb-object__body {
        padding-block-start: calc(var(--space-2) + 19px);
    }

    & .cb-object__body {
        padding: var(--space-3) var(--space-4) var(--space-4);
    }

    /* The arrow sits at the foot of the card: the last line keeps clear of it, whichever of the two it is */
    & .cb-object__meta,
    & .cb-object__status {
        padding-inline-end: var(--space-5);
    }

    & .cb-object__arrow {
        position: absolute;
        inset-inline-end: var(--space-4);
        bottom: var(--space-3);
    }
}

/*
 * Row: the media on the left, the text, then what the aside says. The line never wraps: in a narrow column (the libraries of a
 * client beside its projects) the text gives way, it is the media that never drops above it. The arrow leaves the flow and
 * sits in the room the right padding keeps for it, centered on the card.
 */
.cb-object--row {
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) calc(var(--space-4) + var(--space-5)) var(--space-3) var(--space-3);

    & .cb-object__media {
        display: grid;
        flex: none;
    }

    & .cb-object__body {
        flex: 1 1 0;
    }

    & .cb-object__arrow {
        position: absolute;
        inset-inline-end: var(--space-4);
        inset-block: 0;
        height: fit-content;
        margin-block: auto;
    }
}

@media (hover: hover) {
    .cb-object__arrow {
        opacity: 0;
    }

    :is(.cb-object, .cb-summary):is(:hover, :focus-visible) .cb-object__arrow {
        color: var(--brand);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .cb-object__arrow {
        transition:
            opacity 150ms,
            transform 150ms;
    }

    @media (hover: hover) {
        .cb-object__arrow {
            transform: translateX(-4px);
        }

        :is(.cb-object, .cb-summary):is(:hover, :focus-visible) .cb-object__arrow {
            transform: translateX(0);
        }
    }
}

/*
 * An object card with its menu of actions (a workspace of the administration, an expected file): the menu is no part of
 * the link, so it sits beside it, over the right of the card. The row keeps room for it, and the arrow moves to its left;
 * a grid card keeps it at the top right of its image.
 */
.cb-object-actions {
    position: relative;

    & > .cb-object--row {
        padding-inline-end: calc(var(--space-4) + var(--space-5) + var(--space-7));
    }

    & > .cb-object--row .cb-object__arrow {
        inset-inline-end: calc(var(--space-4) + var(--space-7));
    }
}

.cb-object-actions__menu {
    position: absolute;
    inset-inline-end: var(--space-3);
    inset-block: 0;
    height: fit-content;
    margin-block: auto;
}

.cb-object--grid + .cb-object-actions__menu {
    inset-inline-end: var(--space-2);
    inset-block: var(--space-2) auto;
    margin-block: 0;
}

/*
 * Searchable selects: Tom Select, started by symfony/ux-autocomplete, in its Bootstrap 5 theme. The theme reads the --bs-*
 * variables, which Tabler does not declare (its own carry the tblr prefix), so they are set here from the tokens. The
 * wrapper keeps the classes of the select (form-select, is-invalid), so Tabler draws the border, the chevron and the
 * state. The stylesheet of Tom Select loads after this one: each rule hangs from the wrapper to win by specificity.
 */
.ts-wrapper {
    --bs-border-color: var(--line-strong);
    --bs-border-color-translucent: var(--line);
    --bs-border-radius: var(--radius-md);
    --bs-border-radius-sm: var(--radius-sm);
    --bs-border-radius-lg: var(--radius-lg);
    --bs-border-width: 1px;
    --bs-body-bg: var(--surface-raised);
    --bs-body-color: var(--ink);
    --bs-secondary-bg: var(--surface-sunken);
    --bs-tertiary-bg: var(--surface-sunken);
    --bs-box-shadow-inset: none;
    --bs-form-invalid-color: var(--danger);
    --bs-form-valid-color: var(--success);

    /* Same height as a text field (40px: 24 + 2 x 7 + 2 x 1), whatever the control holds */
    &.single {
        min-height: 40px;
    }

    & .ts-control {
        padding-block: 7px;
        color: var(--ink);
        line-height: 24px;

        & input {
            color: var(--ink);
            line-height: 24px;
        }
    }

    /* The ring of the charte (2px, offset 2px, in the focus color), not the blue glow of the theme */
    &.focus .ts-control {
        border-color: var(--brand);
        outline: 2px solid var(--focus);
        outline-offset: 2px;
        box-shadow: none;
    }

    & .ts-dropdown {
        margin-top: var(--space-1);
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        background: var(--surface-raised);
        color: var(--ink);
        box-shadow: var(--shadow-md);

        & .option,
        & .no-results {
            padding: var(--space-2) var(--space-3);
            color: var(--ink);
        }

        & .no-results {
            color: var(--ink-muted);
        }

        /* The title of a group of options (the formats of a source), small and quiet above its options */
        & .optgroup-header {
            padding: var(--space-2) var(--space-3) var(--space-1);
            background: none;
            color: var(--ink-muted);
            font-size: 12px;
            font-weight: 600;
            line-height: 16px;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        & .active {
            background: var(--surface-sunken);
            color: var(--ink);
        }

        & .option.selected {
            background: var(--brand-soft);
        }

        /* What the search matched: heavier, not colored (the gradient belongs to the AI, and brand to the action) */
        & [data-selectable] .highlight {
            background: none;
            font-weight: 600;
        }
    }
}

/* The library list: an option is a mosaic and two lines, so the list is taller than the 200px of a plain one. */
.ts-dropdown-content.cb-library-list {
    max-height: 340px;
}

.cb-library-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.cb-library-option__body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.cb-library-option__name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-library-option__meta {
    color: var(--ink-muted);
    font-size: 13px;
    line-height: 20px;
}

/* The library chosen, in the closed control: the same mosaic, smaller, then the name. */
.cb-library-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.cb-library-item .cb-mosaic {
    width: 24px;
    height: 24px;
    gap: 1px;
    padding: 2px;
    border-radius: var(--radius-sm);
}

.cb-library-item .cb-mosaic--initial {
    padding: 0;
    font-size: 13px;
}

.cb-library-item .cb-thumb {
    border-radius: 2px;
}

.cb-library-item .cb-thumb__img {
    padding: 0;
}

/* The list of the format of a source: an option, and the item chosen, read the tile of the extension, then the name. */
.cb-format-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);

    & .cb-thumb {
        width: 28px;
    }

    & .cb-thumb__label {
        padding-inline: 0;
        font-size: 9px;
    }
}

/* In the closed control, a smaller tile keeps the field at the height of the others (40px), four letters still whole. */
/*
 * A searchable list of one value (Tom Select) keeps its field on the line of the value chosen: Tom Select gives the field
 * a minimum of 7rem, which sent it under a value with a tile (the format of a source) in a narrow column.
 */
.ts-wrapper.single.has-items .ts-control > input {
    min-width: 0;
}

.ts-control .cb-format-option {
    & .cb-thumb {
        width: 24px;
    }

    & .cb-thumb__label {
        font-size: 8px;
    }
}

/* A row of the expected exports of a file: the format, the use, "Retirer", and its errors under it. */
.cb-export-row {
    margin-top: var(--space-2);
}

.cb-export-row__fields {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: center;

    @media (max-width: 575.98px) {
        grid-template-columns: 6rem minmax(0, 1fr) auto;
    }
}

/*
 * AI banner (Cb:AiBanner), the width of its container: the pale gradient of the AI with the gradient on its border. At work,
 * the sparkles pulse in a disc of the gradient, and the text says what the AI works on; otherwise they stand in the gradient.
 */
.cb-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--ai-soft-start), var(--ai-soft-end)) padding-box, linear-gradient(90deg, var(--ai-start), var(--ai-end)) border-box;
    color: var(--ink);

    & .btn {
        flex: none;
        margin-inline-start: auto;
    }
}

.cb-banner__title {
    margin: 0;
    font: 600 15px/24px var(--font-sans);
}

.cb-banner__text {
    margin: 0;
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

.cb-banner__mark {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;

    & svg {
        width: 24px;
        height: 24px;
    }
}

.cb-banner__disc {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--ai-start), var(--ai-end-strong));
    color: var(--on-ai);

    & svg {
        width: 20px;
        height: 20px;
    }
}

/* The working sparkles on one line of text: a demo being prepared, in the administration's list. */
.cb-working-line {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--ink);

    & svg {
        width: 14px;
        height: 14px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .cb-banner__disc,
    .cb-thumb__disc,
    .cb-working-line .cb-ai-icon {
        animation: cb-pulse 1.4s ease-in-out infinite;
    }

    @keyframes cb-pulse {
        0%,
        100% {
            opacity: 0.5;
            transform: scale(0.9);
        }

        50% {
            opacity: 1;
            transform: scale(1.05);
        }
    }
}

/* "Powered by" mention. The lockup is an inline SVG in currentColor: it takes the text color, never a fixed ink. */
.cb-powered {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink-muted);
    font: 400 12px/16px var(--font-sans);
}

.cb-powered__logo {
    display: inline-block;
    width: 98px;
    height: 18px;
    fill: currentColor;
}

/* Author mark */
.cb-author {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink);
    font: 400 13px/20px var(--font-sans);
}

.cb-author__mark {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-pill);

    /* Size only: the 1.5px stroke comes from .icon */
    & svg {
        width: 14px;
        height: 14px;
    }
}

.cb-author--client .cb-author__mark {
    background: var(--info-soft);
    color: var(--info);
}

.cb-author--team .cb-author__mark {
    background: var(--brand-soft);
    color: var(--brand);
}

/* The AI has no disc nor face: the sparkles in its gradient, then its name. */
.cb-author--ai .cb-author__mark {
    width: 16px;

    & svg {
        width: 16px;
        height: 16px;
    }
}

.cb-author__name {
    font-weight: 600;
}

.cb-author__meta {
    color: var(--ink-muted);
}

/*
 * Face (Cb:Face): a person in a role, the photo ringed with the surface of a card so that it can sit over an image. On hover
 * of the face, or when its card takes the keyboard focus, the name and the role slide out beside it in the same pill. A touch
 * screen never sees them: the text of the page names the person in that role.
 */
.cb-face {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border: 3px solid var(--surface-raised);
    border-radius: var(--radius-pill);
    background: var(--surface-raised);
    color: var(--ink);

    & .avatar {
        flex: none;
    }
}

.cb-face--xs {
    border-width: 2px;
}

.cb-face__label {
    flex-wrap: nowrap;
    max-width: 0;
    overflow: hidden;
    font: 400 13px/20px var(--font-sans);
}

.cb-face__name {
    font-weight: 600;
}

.cb-face__role {
    color: var(--ink-muted);
}

/* On a card, the name over the role: the label takes the width of the longer one, and a name too long for the card ends in an ellipsis */
.cb-face--sm .cb-face__label {
    display: grid;

    & > * {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    & .cb-face__name {
        line-height: 16px;
    }

    & .cb-face__role {
        font-size: 12px;
        line-height: 14px;
    }
}

@media (hover: hover) {
    .cb-face:hover .cb-face__label,
    .cb-object:focus-visible .cb-face__label {
        max-width: 24rem;
        padding-inline: var(--space-2);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .cb-face__label {
        transition:
            max-width 150ms ease-out,
            padding 150ms ease-out;
    }
}

/* A mosaic with a face on its lower right corner (the page of a project): the label slides out over the header, to the right */
.cb-media-face {
    position: relative;
    display: inline-block;
    vertical-align: top;

    & > .cb-face {
        position: absolute;
        z-index: 2;
        bottom: -6px;
        left: calc(100% - 20px);
        max-width: none;
    }
}

/*
 * Drop zone of an upload (templates/upload/_dropzone.html.twig): one dashed line, in brand while files hover over the board.
 * The element of the upload controller wraps the whole board and puts is-dragover on the zone, which may sit out of view on a
 * long board; the zone also rings when its hidden file field takes the keyboard focus.
 */
.cb-dropzone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink-muted);
    font: 400 14px/20px var(--font-sans);

    &.is-dragover {
        border-style: solid;
        border-color: var(--brand);
        background-color: var(--brand-soft);
    }

    &:has(input:focus-visible) {
        outline: 2px solid var(--focus);
        outline-offset: 2px;
    }
}

.cb-dropzone__limit {
    color: var(--ink);
    font-weight: 600;
}

/* The progress rows of the files in flight, under the drop zone: a gap under them only when there are some */
.cb-upload-rows:not(:empty) {
    margin-block-end: var(--space-3);
}

/*
 * The drop zone of the request of a brief, right under its field: what it does in brand over where the files go, and
 * the rows of the files in flight under it. While the form is sent, it is locked (submit_lock_controller.js).
 */
.cb-dropzone__text {
    display: grid;
    min-width: 0;
}

.cb-dropzone__action {
    color: var(--brand);
    font-weight: 600;
}

.cb-dropzone.is-locked {
    border-style: solid;
    color: var(--ink-faint);
    cursor: default;

    & .cb-dropzone__action {
        color: var(--ink-faint);
    }
}

.cb-dropzone--attach ~ .cb-upload-rows:not(:empty) {
    margin-block: var(--space-3) 0;
}

/*
 * Board of a library (templates/workspace/library.html.twig): the grid of files, the format filter, and the column of memories.
 * The memories column follows the scroll on a large screen and falls under the grid on a small one.
 */
.cb-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);

    /* The current choice: the pair of the current entry of the menu, a toggle of links like the one of the projects */
    & .btn {
        border-radius: var(--radius-pill);

        &.active {
            background: var(--brand-soft);
            border-color: transparent;
            color: var(--brand);
        }
    }
}

.cb-filter__count {
    margin-inline-start: var(--space-1);
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 12px;

    .active > & {
        color: inherit;
    }
}

.cb-board__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: var(--space-3);
    padding: 0;
}

/* A file: the thumbnail on top with its menu over a corner, then the name and its line of meta. The card is no link: it holds a menu. */
.cb-file {
    min-width: 0;
    margin: 0;
    padding: var(--space-2);
    gap: var(--space-2);
}

.cb-file__media {
    position: relative;
}

.cb-file__menu {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-end: var(--space-2);
}

.cb-file__body {
    min-width: 0;
    padding-inline: var(--space-1);
    padding-block-end: var(--space-1);
}

.cb-file__name {
    font: 600 14px/20px var(--font-sans);
}

.cb-file__meta {
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

.cb-memory__main {
    flex: 1;
    min-width: 0;
}

/* The header of a library or of a project carries a menu and the brand button: on a narrow screen they drop under the title instead of squeezing it */
.page-header .row:has(.cb-add-files, .cb-validate) > .col {
    flex-basis: 16rem;
}

@media (min-width: 992px) {
    .cb-board__memories {
        position: sticky;
        /* The fixed environment banner (app.css) covers the top of the window: the column sticks under it. 0 without banner. */
        inset-block-start: calc(var(--space-4) + var(--cb-env-banner-height, 0px));
    }
}

/*
 * Options of a single choice, each with a title and one line (cb_choices_row in templates/form/theme.html.twig): the radio,
 * then the text. The option chosen takes the brand-soft background; a disabled one fades and shows its other line (the
 * reason), so a script only disables the radio. Cards sit three in a row from 576px, one under the other below; a stack
 * holds its options in one frame.
 */
.cb-choices--cards {
    display: grid;
    gap: var(--space-3);

    @media (min-width: 576px) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    & .cb-choice {
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
    }

    & .cb-choice:has(:checked) {
        border-color: var(--brand);
    }
}

.cb-choices--stack {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);

    & .cb-choice + .cb-choice {
        border-block-start: 1px solid var(--line);
    }
}

.cb-choice {
    display: flex;
    gap: var(--space-3);
    margin: 0;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;

    & .form-check-input {
        flex: none;
        margin-block-start: 0.25em;
    }

    &:has(:checked) {
        background: var(--brand-soft);
    }

    /* A disabled option fades its radio and its title; its line, the reason, stays readable */
    &:has(:disabled) {
        cursor: not-allowed;

        & :is(.form-check-input, .cb-choice__title) {
            opacity: 0.55;
        }
    }
}

.cb-choice__body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.cb-choice__title {
    font-weight: 600;
}

.cb-choice__text {
    color: var(--ink-muted);
    font: 400 13px/18px var(--font-sans);
}

.cb-choice__text--disabled,
.cb-choice:has(:disabled) .cb-choice__text--enabled {
    display: none;
}

.cb-choice:has(:disabled) .cb-choice__text--disabled {
    display: block;
}

/* A switch in a frame the width of the form: its label at the start of the line, the switch at the end */
.cb-switch-frame {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);

    & .form-switch {
        display: flex;
        flex-direction: row-reverse;
        justify-content: space-between;
        gap: var(--space-4);
        min-height: 0;
        margin: 0;
        padding: 0;
    }

    & .form-switch .form-check-input {
        flex: none;
        float: none;
        margin: 0;
    }

    & .form-check-label {
        font-weight: 600;
    }
}

/*
 * The People page: one card per perimeter, one row per line. From 768px a row reads on one line: the person, the access in
 * a word, the menu. Below, the access goes under the name and the menu stays top right. An invitation has a dashed circle
 * with an envelope in place of a photo.
 */
.cb-person {
    --cb-person-avatar: 2rem;
    display: grid;
    grid-template: "who menu" "access ." / minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-1) var(--space-4);

    /* The menu keeps to the first line, top right, whatever the height of the row */
    & > .dropdown {
        grid-area: menu;
        align-self: start;
    }

    @media (min-width: 768px) {
        grid-template: "who access menu" / minmax(0, 1fr) 11rem auto;
    }
}

.cb-person__who {
    display: flex;
    grid-area: who;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;

    /* A long address shortens itself, never the photo */
    & > .avatar {
        flex: none;
    }
}

.cb-person__text {
    min-width: 0;
}

.cb-person__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.cb-person__meta {
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-sans);
}

.cb-person__access {
    grid-area: access;
    /* Under the name on a phone, past the avatar */
    padding-inline-start: calc(var(--cb-person-avatar) + var(--space-3));
    font-size: 14px;

    @media (min-width: 768px) {
        padding-inline-start: 0;
    }

    & .icon,
    & svg {
        width: 16px;
        height: 16px;
        vertical-align: -3px;
    }
}

.cb-invite-mark {
    --tblr-avatar-bg: transparent;
    --tblr-avatar-box-shadow: none;
    border: 1px dashed var(--line-strong);
    color: var(--ink-muted);

    & svg {
        width: 16px;
        height: 16px;
    }
}

/* An invitation that ran out: the tone of a warning, the text in ink */
.cb-badge-expired {
    background: var(--warning-soft);
    color: var(--ink);
}

/* The title of a section of the People page: the type (Client, Projet) small before the name, then the client of a project */
.cb-section-title .cb-meta {
    display: inline-flex;
    vertical-align: baseline;
}

.cb-section-client {
    color: var(--ink-muted);
    font-weight: 400;
}

.cb-section-kind {
    margin-inline-end: var(--space-1);
    color: var(--ink-muted);
    font: 500 13px/20px var(--font-sans);
}

/*
 * A summary row of the People page (a client, a project): the whole row is the link to its own People page. Hover fills the
 * row (Tabler's list-group action) and shows the arrow of an object card.
 */
.cb-summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.cb-summary__body {
    display: grid;
    flex: 1;
    min-width: 0;
}

/*
 * The access of an account on its page in the administration, grouped by workspace: the name of a workspace (or
 * "Invitations") as a quiet heading that sticks to the first of its lines.
 */
.cb-access .cb-access__workspace {
    margin: 0;
    padding-block-end: 0;
    border-block-end-width: 0;
    color: var(--ink-muted);
    font: 600 13px/20px var(--font-sans);
}

/* The check of Valide sits on the text line, as on the People page */
.cb-access .cb-meta svg {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

/* Consent banner of www.: a card pinned to the bottom of the viewport, above the page, readable in both themes through the card tokens */
.cb-consent {
    position: fixed;
    inset-inline: var(--space-4);
    bottom: var(--space-4);
    z-index: 1030;
    max-width: 720px;
    margin-inline: auto;
    box-shadow: var(--shadow-md);
}

/* "Manage cookies" sits among the footer links as a button: drawn like them, underlined on hover like them */
.cb-consent-open {
    padding: 0;
    border: 0;
    background: none;

    &:hover {
        text-decoration: underline;
    }
}
