/* General layout rules that belong to no single component. */

/* Running text: 65 characters wide at most, no orphan on the last line. Headings balance their lines. */
p,
li,
blockquote {
    text-wrap: pretty;
}

p,
blockquote {
    max-width: 65ch;
}

/* A centered block of text (empty states) keeps its measure centered too */
:is(.text-center, .empty) p {
    margin-inline: auto;
}

h1,
h2,
h3,
.page-title,
.card-title,
.cb-card__title {
    text-wrap: balance;
}

/* A legal page: one reading column of about 70 characters, centered in the public frame */
.legal {
    max-width: 70ch;
    margin-inline: auto;

    :is(p, li, blockquote) {
        max-width: none;
    }
}

/* A flag of the language switcher (20 x 15 in the markup): a hairline so a white band does not melt into the surface */
.cb-flag {
    flex: none;
    box-shadow: 0 0 0 1px var(--line);
}

/* A link styled as a button, a card, a tab, a list or menu item never underlines: feedback comes from border, fill or shadow */
a:is(.btn, .card, .cb-card, .cb-object, .list-group-item, .dropdown-item, .nav-link) {
    &,
    &:hover,
    &:focus,
    &:active {
        text-decoration: none;
    }
}

/* A file input hidden behind its label styled as a button (the profile photo): the label carries the focus ring */
.visually-hidden:focus-visible + label.btn {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* 150ms on color changes of links and product components; users who ask for reduced motion get none */
@media (prefers-reduced-motion: no-preference) {
    :where(a, .cb-card, .cb-object, .cb-version) {
        transition:
            color 150ms,
            background-color 150ms,
            border-color 150ms,
            box-shadow 150ms;
    }

    /*
     * A menu opens in 150ms: it fades in and slides 4px from its button. The translate property leaves alone the transform
     * Popper positions a menu with. Closing stays instant.
     */
    .dropdown-menu.show {
        animation: cb-menu-in 150ms ease-out;
    }

    .dropup .dropdown-menu.show {
        --cb-menu-from: 4px;
    }

    @keyframes cb-menu-in {
        from {
            opacity: 0;
            translate: 0 var(--cb-menu-from, -4px);
        }
    }
}

/*
 * The environment banner (templates/_environment_banner.html.twig): pinned to the top of the window on every page of every
 * environment but production, and of every environment during a "signed in as" session. One line of 1.75rem, the stage
 * and "signed in as" side by side, ellipsized rather than wrapped so that the height is known. The banner is a sibling of
 * the page, not an ancestor of the sidebar: a variable written on it never reaches the sidebar, so html holds its height,
 * and the scroll of the window, body and the sidebar read it from there.
 *
 * It is fixed, not sticky: Tabler gives body height: 100% and the page overflows it, and a sticky box stays inside its parent,
 * so it would let go after one window height of scrolling. Body makes room for it with its padding (border-box: its height
 * stays 100%, so .page keeps filling the window with no scroll of its own), and Tabler's sidebar, fixed to the window and
 * starting at its top edge, is pushed down by the same height.
 */
html:has(> body > .cb-env-banner) {
    /* The line and the 1px bottom edge of the banner */
    --cb-env-banner-height: calc(1.75rem + 1px);

    /* The window scrolls on html, and only html's scroll-padding reaches it: a skip link, an anchor or a focused field stops under the banner */
    scroll-padding-block-start: var(--cb-env-banner-height);
}

body:has(> .cb-env-banner) {
    padding-block-start: var(--cb-env-banner-height);

    /* The banner does not print: neither does its room */
    @media print {
        padding-block-start: 0;
    }

    /* Below the breakpoint the sidebar is a bar in the flow, under the banner already */
    @media (min-width: 992px) {
        .navbar-vertical.navbar-expand-lg {
            top: var(--cb-env-banner-height);
        }
    }
}

/* z-index: above Tabler's fixed sidebar (1030), under its offcanvas backdrop (1040), modals (1055) and toasts (1090) */
.cb-env-banner {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    z-index: 1031;
    display: flex;
    column-gap: var(--space-2);
    align-items: center;
    justify-content: center;
    height: var(--cb-env-banner-height);
    padding-inline: var(--space-4);
    border-block-end: 1px solid var(--warning);
    background: var(--warning-soft);
    color: var(--ink);
    font: 400 13px/20px var(--font-sans);
}

/* nowrap overrides the wrap of .cb-meta: the banner has one row */
.cb-env-banner__stage,
.cb-env-banner__impersonation {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: nowrap;
    column-gap: var(--space-2);
    align-items: center;
    min-width: 0;
}

/* The stage name stays whole on a narrow screen: only the host ends in an ellipsis (.cb-meta) */
.cb-env-banner__stage > :first-child {
    flex: none;
}

/* On a phone the host gives its room to "signed in as": the stage name stays whole, and the dot of .cb-meta after it separates the two parts */
.cb-env-banner__stage:has(+ .cb-env-banner__impersonation) {
    flex: none;

    > :last-child {
        display: none;
    }

    @media (min-width: 576px) {
        flex: 0 1 auto;

        > :last-child {
            display: block;
        }
    }
}

/* From 576px, the dot of .cb-meta between the host and "signed in as" */
.cb-env-banner__stage + .cb-env-banner__impersonation::before {
    @media (min-width: 576px) {
        content: '·';
        content: '·' / '';
    }
}

/* The name ends in an ellipsis, and the button stays whole on a narrow screen */
.cb-env-banner__impersonation {
    > form {
        flex: none;
    }

    /* btn-sm is 32px high: 26px here, inside the 28px line */
    .btn {
        --tblr-btn-padding-y: var(--space-1);
    }
}

/*
 * The frame (templates/layout/app.html.twig).
 * The sidebar is Tabler's vertical navbar: entries and footer are Tabler's own.
 * What follows tunes its measures to the charte (36px entries) and styles what Tabler has no class for: the title of a
 * group and the floating menu of the account.
 */
.cb-sidebar {
    /* Entries 36px high: 20px of line, 8px above and below (Tabler's 12px make 44px). The footer keeps its own 8px. */
    .navbar-nav {
        --tblr-sidebar-nav-padding-y: var(--space-2);
    }

    /* The current entry takes the icon in its own color; Tabler does that for .nav-item.active, the layout marks the link */
    .nav-link.active {
        --tblr-nav-link-icon-color: currentColor;
        font-weight: 600;
    }

    /* A hover on an entry fills with surface-sunken, like the account */
    .nav-link:not(.active):hover,
    .nav-link:not(.active):focus-visible,
    .nav-link:not(.active)[aria-expanded='true'] {
        background: var(--surface-sunken);
        color: var(--ink);
    }

    /*
     * The account at the foot: avatar, name, then the selector icon at the end of the line. Below the breakpoint Tabler keeps
     * the avatar alone and drops the border; the name stays, and so does the rule above the account.
     */
    .navbar-footer {
        margin-block-start: var(--space-2);
        padding-block: var(--space-2);
        border-block-start: 1px solid var(--line);

        .nav-link-title {
            display: block;
        }

        /* Above the breakpoint Tabler spaces the avatar itself, with a more specific rule */
        .nav-link .avatar {
            margin-inline-end: var(--space-2);
        }

        .nav-link > .icon {
            flex: none;
            margin-inline-start: auto;
            color: var(--ink-muted);
        }
    }

    /*
     * The workspace filter just above the account (decision of Thibault, 25 November): the name of the choice, then the
     * selector icon at the end of the line. It takes the rule and the push to the foot from the account, which follows it
     * on the same ground. Inset like the entries (Tabler's sidebar inset, 8px).
     */
    .cb-workspace-filter {
        order: 1;
        margin-block-start: auto;
        padding: var(--space-2) var(--space-2) 0;
        border-block-start: 1px solid var(--line);

        > .btn {
            font-weight: 600;
        }
    }

    /*
     * Tabler unfolds any menu of the collapse in place, without surface: the footer grew upward and the account jumped
     * from under the pointer. The menus of the sidebar float instead, the width of their button, dressed like any
     * dropdown, above their button.
     */
    :is(.navbar-footer .dropup, .cb-workspace-filter) .dropdown-menu {
        position: absolute;
        z-index: var(--tblr-dropdown-zindex);
        min-width: 0;
        padding: var(--tblr-dropdown-padding-y) var(--tblr-dropdown-padding-x);
        background: var(--tblr-dropdown-bg);
        box-shadow: var(--tblr-dropdown-box-shadow);
        color: var(--tblr-dropdown-color);

        /* Tabler indents the entries of a sidebar menu by an icon; the buttons would shrink to their text */
        .dropdown-item {
            width: 100%;
            padding-inline: var(--tblr-dropdown-item-padding-x);
            border-radius: 0;
            color: var(--tblr-dropdown-link-color);
        }
    }

    .navbar-footer .dropup .dropdown-menu {
        inset: auto 0 100%;
        margin: 0 0 var(--space-1);
    }

    /* As specific as Tabler's rule of the collapse, which sets the margin to 0; the width of the button, inside the inset */
    .cb-workspace-filter.dropup .dropdown-menu {
        inset: auto var(--space-2) 100%;
        margin: 0 0 var(--space-1);
    }
}

/* The account under the workspace filter: no rule and no push of its own (as specific as Tabler's rule of the footer) */
.cb-sidebar.navbar-vertical .cb-workspace-filter + .navbar-footer {
    margin-block-start: 0;
    border-block-start: 0;
}

/* The lockup keeps its own size: Tabler scales it with the width of the bar */
.cb-sidebar .navbar-brand {
    overflow: hidden;

    > img {
        flex: none;
        max-width: none;
        height: 32px;
    }
}

/* The focus ring of an entry stays inside it: outside, the scrolling menu cut its sides and the next entry covered its edge */
.cb-sidebar .nav-link:focus-visible {
    outline-offset: -2px;
}

.cb-sidebar :is(.nav-link-title, .cb-nav-group__title) {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Group of entries: the second one carries a title, small capitals in ink-muted aligned with the text of the entries (8px of inset + 12px of padding) */
.cb-nav-group + .cb-nav-group {
    margin-block-start: var(--space-4);
}

.cb-nav-group__title {
    margin: 0 var(--space-2);
    padding: var(--space-1) var(--space-3);
    color: color-mix(in srgb, var(--on-srf) 45%, transparent);
    font: 400 10px/16px var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/*
 * The sidebar of the wireframes: the dark Brikks Néon surface in both themes (the aside carries data-bs-theme="dark", so
 * every token inside it takes its dark value), entries in on-srf, the current one in the lime signal on a 6% wash.
 */
.cb-sidebar.navbar-vertical {
    background: var(--srf);
    color: var(--on-srf);

    .nav-link {
        color: color-mix(in srgb, var(--on-srf) 72%, transparent);
    }

    .navbar-nav .nav-link.active {
        background: color-mix(in srgb, var(--on-srf) 6%, transparent);
        color: var(--signal);
    }

    .nav-link:not(.active):hover,
    .nav-link:not(.active):focus-visible,
    .nav-link:not(.active)[aria-expanded='true'] {
        background: color-mix(in srgb, var(--on-srf) 6%, transparent);
        color: var(--on-srf);
    }

    :is(.navbar-footer, .cb-workspace-filter) {
        border-block-start-color: color-mix(in srgb, var(--on-srf) 14%, transparent);
    }
    /* The white lockup on the dark surface, whatever the theme of the page */
    .navbar-brand .hide-theme-dark {
        display: none !important;
    }

    .navbar-brand .hide-theme-light {
        display: inline !important;
    }
}

/* The title keeps room to read: when the actions of a page do not fit beside it (a client with its picture, its pieces and two buttons, on a phone), they wrap under it */
.page-header .row > .col {
    min-width: 14rem;
}

/*
 * The portal of a person of a client: the title and the page in one calm column, not the width of the team's screens.
 * The header and the footer keep the full width; the way back above the title is the size of a link, not of a label.
 */
.cb-portal {
    /* The pages of a project (cb-wide) read the full width, as the production reads them */
    &:not(.cb-wide) :is(.page-header, .page-body) > .container-xl {
        max-width: 46rem;
    }

    .page-pretitle {
        font-size: 0.875rem;
    }
}

/* A page of one form (invite a person, the access of a person): the title and the card in one column of 600px, centred */
.cb-narrow {
    :is(.page-header, .page-body) > .container-xl {
        max-width: calc(37.5rem + var(--tblr-gutter-x, 1.5rem));
    }
}

/*
 * The user guide (app., templates/support/guide/ and the HTML of App\Guide\GuideRenderer).
 * The navigation and the table of contents stay in view while the page scrolls, under the environment banner when there is one.
 */
.cb-guide-aside {
    @media (min-width: 992px) {
        position: sticky;
        inset-block-start: calc(var(--cb-env-banner-height, 0px) + var(--space-5));
        max-block-size: calc(100vh - var(--cb-env-banner-height, 0px) - var(--space-6));
        overflow-y: auto;
    }
}

.cb-guide-nav {
    .nav .nav {
        padding-inline-start: var(--space-3);
    }

    .nav-link {
        padding: var(--space-1) var(--space-3);
        border-radius: var(--radius-md);
        color: var(--ink-muted);

        &:hover,
        &:focus-visible {
            background: var(--surface-sunken);
            color: var(--ink);
        }

        &.active {
            background: var(--brand-soft);
            color: var(--ink);
            font-weight: 600;
        }
    }

    /* A category names its pages: it reads in ink, its pages in muted ink */
    .nav-link.fw-semibold {
        color: var(--ink);
    }
}

.cb-guide-toc li {
    padding-block: var(--space-1);
    font-size: 0.875rem;
}

/* The text of a page. Headings start at h2 (the title is the h1 of the template) and leave room for the anchors of the table of contents. */
.guide-content {
    overflow-wrap: anywhere;

    :is(h2, h3, h4) {
        margin-block: var(--space-6) var(--space-3);
        scroll-margin-block-start: var(--space-5);
    }

    :is(img, video, iframe) {
        max-width: 100%;
    }

    img {
        height: auto;
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
    }

    /* A phone capture is taller than wide: phone width, centred, not stretched to the column */
    img.guide-img-portrait {
        display: block;
        max-width: min(100%, 20rem);
        margin-inline: auto;
    }

    /* A wide table scrolls inside the column instead of the page */
    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
    }

    :is(th, td) {
        padding: var(--space-2) var(--space-3);
        border-block-end: 1px solid var(--line);
        text-align: start;
    }

    pre {
        overflow-x: auto;
    }
}

/* [!NOTE], [!TIP], [!WARNING] and [!IMPORTANT]: Tabler's alert carries the tone (its info, success, warning and danger colors are the tokens'); the text stays in ink, which reads on every tint */
.guide-callout {
    color: var(--ink);
}

.guide-callout-title {
    margin-block-end: var(--space-1);
    font-weight: 600;
}

.guide-callout-body > :last-child {
    margin-block-end: 0;
}

/* A plain quote: set apart by a neutral rule and muted ink, no tone */
.guide-quote {
    margin-inline: 0;
    padding-inline-start: var(--space-4);
    border-inline-start: 2px solid var(--line-strong);
    color: var(--ink-muted);
}

/*
 * The eye button of a password field (form/_password_toggle.html.twig) reads as the end of the field, not as a button
 * beside it: the border of the field (line-strong, brand on focus, danger on error), no line between them, the surface
 * of the field. The eye while the password is hidden, the struck eye while it shows: aria-pressed carries the state.
 */
.input-group:has(> .cb-password-toggle) > .form-control {
    border-inline-end: 0;
}

.input-group > .cb-password-toggle {
    border: 1px solid var(--line-strong);
    border-inline-start: 0;
    background: var(--surface);
    color: var(--ink-muted);

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

.input-group > .form-control:focus + .cb-password-toggle {
    border-color: var(--brand);
}

.input-group > .form-control.is-invalid + .cb-password-toggle {
    border-color: var(--danger);
}

.cb-password-toggle[aria-pressed='false'] .cb-password-toggle__hide,
.cb-password-toggle[aria-pressed='true'] .cb-password-toggle__show {
    display: none;
}

/*
 * The frame of the wireframes (the artifact of the screens, project/ob.css): what every screen shares.
 * - the page head: a grey breadcrumb, the current page in bold at its end (.crumb), then a title of 32px (.h1), 28px on
 *   the page of an object, which carries a picture (.h1.sm);
 * - the badges: capitals, 12px, a tinted ground (.badge.n|ok|info|warn|ko); Tabler's -lt grounds take those tints;
 * - the buttons: radius 12px, a secondary button with the strong line (.btn.sd), 32px and radius 8px when small (.btn.sm);
 * - the entries of the sidebar: 14px (.nav), the lockup 24px high (.brand);
 * - the rows of a list: one card each, 12px apart (.lst > .item), the name in the display family (.item .ttl).
 */
.page-header {
    .page-title {
        font-size: 32px;
        line-height: 40px;
    }

    &:has(.cb-page-media) .page-title {
        font-size: 28px;
        line-height: 36px;
    }
}

.page-pretitle .breadcrumb {
    --tblr-breadcrumb-divider-color: var(--ink-faint);
    margin: 0 0 var(--space-1);
    font: 500 13px/20px var(--font-sans);
    color: var(--ink-muted);

    a {
        color: var(--ink-muted);
        text-decoration: none;
    }

    a:is(:hover, :focus-visible) {
        color: var(--ink);
    }

    .breadcrumb-item.active {
        color: var(--ink);
        font-weight: 600;
    }
}

.badge {
    --tblr-badge-font-size: 12px;
    --tblr-badge-font-weight: 600;
    --tblr-badge-border-radius: var(--radius-sm);
    --tblr-badge-padding-x: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 24px;
    line-height: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--surface-sunken);
    color: var(--ink-muted);

    .icon {
        width: 14px;
        height: 14px;
    }
}

.badge.bg-green-lt {
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
}

.badge.bg-blue-lt {
    background: var(--info-soft) !important;
    color: var(--info) !important;
}

.badge.bg-orange-lt {
    background: var(--warning-soft) !important;
    color: var(--warning) !important;
}

.badge.bg-red-lt {
    background: var(--danger-soft) !important;
    color: var(--danger) !important;
}

.badge.bg-secondary-lt {
    background: var(--surface-sunken) !important;
    color: var(--ink-muted) !important;
}

.btn {
    --tblr-btn-border-radius: var(--radius-btn);
}

.page-wrapper .btn:not([class*='btn-primary'], [class*='btn-ghost'], [class*='btn-outline'], [class*='btn-link'], .btn-icon, .dropdown-item) {
    --tblr-btn-border-color: var(--line-strong);
    --tblr-btn-hover-border-color: var(--ink);
}

.btn-sm {
    --tblr-btn-border-radius: var(--radius-md);
}

.cb-sidebar {
    .nav-link {
        font-size: 14px;
        line-height: 20px;
    }

    .navbar-brand > img {
        height: 24px;
    }
}

/* The rows of a list (.cb-rows: one card per row, in place of one card of rows) */
.cb-rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-block-end: var(--space-4);

    > .list-group-item {
        padding: 14px var(--space-4);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        background: var(--surface-raised);
        box-shadow: var(--shadow-sm);
    }

    .cb-person__name {
        font: 600 17px/24px var(--font-display);
        color: var(--ink);
        text-decoration: none;
    }

    a.cb-person__name:is(:hover, :focus-visible) {
        color: var(--brand-ink);
    }
}

/*
 * The page of an object, as the wireframes draw it (Nu-Client, Nu-Produit):
 * - its initials on a sunken square, left of the title and at the head of a row (.ico);
 * - its badges after the title, on the same line (.h1 .badge);
 * - the count of a tab after its name (.tab .n);
 * - a card: its title of 17px and its action on one line (.cardh), then rows of a label with its icon and a value (.kv).
 */
.cb-ico {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font: 600 14px var(--font-display);
}

.cb-page-media .cb-ico {
    width: 48px;
    height: 48px;
}

/* Next to a title and its line under it, the picture takes the height of both: 36px of title, 8 of gap, 28 of line */
.page-header .row:has(.cb-page-subline) .cb-page-media .cb-ico {
    width: 72px;
    height: 72px;
    font-size: 20px;
}

/* The photo of a product in place of its initials (_ico.html.twig): the whole picture, on the sunken square. */
.cb-ico--photo {
    object-fit: contain;
}

/* The line under the title of a page: its badges, then its meta line */
.cb-page-subline {
    display: flex;
    flex-wrap: wrap;
    column-gap: var(--space-3);
    row-gap: var(--space-1);
    align-items: center;
    margin-block-start: var(--space-2);

    .cb-title-badges {
        display: inline-flex;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .badge {
        font-size: 12px;
    }

    .page-meta {
        margin: 0;
    }
}

.nav-tabs .cb-tab-count {
    margin-inline-start: 6px;
    color: var(--ink-faint);
    font: 400 11px var(--font-mono);
}

.cb-cardh {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-block-end: var(--space-3);

    > h2 {
        flex: 1;
        margin: 0;
        font-size: 17px;
        line-height: 24px;
    }
}

.cb-kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding-block: var(--space-2);
    border-block-end: 1px solid var(--line);
    font-size: 13px;
    line-height: 20px;

    &:last-child {
        border-block-end: 0;
    }
}

.cb-kv__key {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink-muted);

    .icon {
        width: 16px;
        height: 16px;
        color: var(--ink-faint);
    }
}

.cb-kv__value {
    min-width: 0;
    text-align: end;
    overflow-wrap: anywhere;
}

/* A row of a list (.cb-rows): the initials, the text, then the actions, which stay visible (« Ouvrir », « Modifier ») */
.cb-rows .cb-person:has(> .cb-row-actions) {
    grid-template: "who menu" / minmax(0, 1fr) auto;

    > .cb-row-actions {
        display: flex;
        grid-area: menu;
        align-items: center;
        gap: var(--space-2);
    }

    .cb-title-badges {
        display: inline-flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        margin-inline-start: 10px;
        vertical-align: 2px;
    }
}

/* The bar of a form at the foot of the page: a rule, then Annuler and Enregistrer on the right */
.cb-form-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-5);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--line);
}

/* An icon in a sunken round, at the head of a card (the wireframes' .sic) */
.cb-sic {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    color: var(--ink-muted);

    .icon {
        width: 15px;
        height: 15px;
    }
}

/* An icon after the label of a button (« Ouvrir → », .cb-btn-end): Tabler spaces an icon for the start of the label only */
.cb-btn-end > .icon {
    margin: 0 calc(var(--space-1) * -1) 0 var(--space-1);
}

/* The legal links of the application: the copyright and the links on one small line, at the foot of the page */
.page-wrapper > .footer:has(.cb-legal-line) {
    padding-block: var(--space-3);
}

.cb-legal-line {
    font-size: 12px;
    line-height: 16px;
}

/*
 * The pieces of the product pages (wireframes: Nu-Produit*):
 * - a reference or a packaging in a pill, in the mono family (.version);
 * - a word read in the orders, between guillemets, in the display family (the synonyms);
 * - the title of the card of an application, 22px (.title).
 */
.cb-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    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);
    white-space: nowrap;
    vertical-align: middle;

    .icon {
        width: 12px;
        height: 12px;
    }
}

.cb-pill--sm {
    height: 24px;
    padding: 0 var(--space-2);
    font-size: 11px;
}

.cb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cb-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    background: var(--surface-raised);
    font-size: 13px;
    line-height: 20px;
}

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

.cb-hits {
    color: var(--ink-muted);
    font: 400 13px/20px var(--font-mono);
    white-space: nowrap;
}

.cb-app-title {
    margin: 0;
    font-size: 22px;
    line-height: 28px;
}

/* A table of the wireframes in a card: amounts on the right, in bold */
.cb-table .cb-num {
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.cb-sic--ok {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.cb-sic--ko {
    background: var(--danger-soft);
    color: var(--danger);
}

.cb-sic--warn {
    background: var(--warning-soft);
    color: var(--warning);
}

.cb-sic--sm {
    width: 22px;
    height: 22px;
}

/*
 * The orders (wireframes: Commandes, Commande-Validation-Nu, Commande-Suivi):
 * - a row of a list: the state, the number in a pill, the customer and its meta, the time, the action (.lrow);
 * - the figures of the delivery, side by side, each in a tile with its icon (.kpis .tile);
 * - the history of an order, one line per version (.tl).
 */
.cb-rows > .cb-order-row {
    display: grid;
    grid-template-columns: 28px auto minmax(0, 1fr) auto auto;
    gap: var(--space-3);
    align-items: center;
    padding: 10px 14px;
}

.cb-order-row__number {
    justify-content: center;
    min-width: 64px;
}

.cb-order-row__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;

    .cb-meta {
        font-size: 13px;
        line-height: 18px;
        color: var(--ink-muted);
    }
}

.cb-order-row__customer {
    overflow: hidden;
    color: var(--ink);
    font: 600 15px/20px var(--font-display);
    text-decoration: none;
    white-space: nowrap;
    text-overflow: ellipsis;

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

.cb-order-row__when {
    color: var(--ink-muted);
    font-size: 13px;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .cb-rows > .cb-order-row {
        grid-template-columns: 28px minmax(0, 1fr) auto;

        > .cb-order-row__number,
        > .cb-order-row__when {
            display: none;
        }
    }
}

.cb-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    margin-block-end: var(--space-3);
}

/* A figure of a card in its own sunken box: the icon, then the value over its label */
.cb-tile {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.cb-tile__icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    color: var(--ink-muted);
}

.cb-tile__icon--ok {
    border-color: transparent;
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.cb-tile__value {
    display: block;
    color: var(--ink);
    font: 600 15px/1.15 var(--font-display);
    white-space: nowrap;
}

.cb-tile__label {
    display: block;
    margin-block-start: 2px;
    color: var(--ink-faint);
    font-size: 11px;
}

.cb-order-banner {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 20px;
}

.cb-order-banner--ok {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.cb-order-banner--ko {
    background: var(--danger-soft);
    color: var(--danger);
}

.cb-order-banner--info {
    background: var(--info-soft);
    color: var(--info);
}

/* A suggestion of the AI (wireframes: .banner.ai): the gradient frame, the light wash, the sparkles in their tile */
.cb-order-banner--ai {
    border: 1.5px solid transparent;
    background:
        linear-gradient(90deg, var(--ai-soft-start) 0%, transparent 35%, transparent 65%, var(--ai-soft-end) 100%) padding-box,
        linear-gradient(var(--surface-raised), var(--surface-raised)) padding-box,
        linear-gradient(90deg, var(--ai-start), var(--ai-end)) border-box;
    color: var(--ink);
    box-shadow: var(--shadow-md);
}

.cb-order-banner__label {
    background: linear-gradient(90deg, var(--ai-start), var(--ai-end));
    background-clip: text;
    color: transparent;
    font: 600 12px/16px var(--font-sans);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-inline-end: var(--space-1);
}

.cb-ai-tile {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    box-shadow: var(--shadow-sm);
}

/*
 * The state of an order at the head of its page: a soft card with its icon in a round, a title, then one row per
 * anomaly (its name in bold, what it concerns after it). Only with anomalies: without, the state says enough.
 */
.cb-order-alert {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
}

.cb-order-alert--ko {
    background: var(--danger-soft);
    color: var(--danger);
}

.cb-order-alert__icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-raised);
}

.cb-order-alert__body {
    min-width: 0;
}

.cb-order-alert__title {
    margin: 0;
    font: 600 15px/32px var(--font-sans);
}

.cb-order-alert__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin: 0 0 var(--space-1);
    padding: 0;
    list-style: none;
    font-size: 13px;
    line-height: 20px;

    > li {
        display: flex;
        flex-wrap: wrap;
        column-gap: var(--space-2);
    }

    > li > span {
        color: var(--ink);
    }
}

/* The lines of an order: the product with its initials and meta, then the figures in their columns */
.cb-order-lines {
    > tbody > tr > td {
        vertical-align: top;
    }

    .cb-num {
        white-space: nowrap;
    }

    tr.cb-order-lines__bad .cb-num strong {
        color: var(--danger);
    }
}

.cb-order-lines__product {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;

    .cb-ico {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
}

.cb-order-lines__hint {
    margin-block-start: 2px;
    color: var(--ink-faint);
    font: 400 11px var(--font-mono);
}

/*
 * An order read from a mail (wireframes: Commande-Validation-Nu, Commande-Anomalie): the passage of the mail a field comes
 * from, in italics under it; a field the reading was unsure of, in orange until a member saves the order.
 */
.cb-quote {
    display: block;
    margin-block-start: 2px;
    color: var(--ink-faint);
    font-size: 12px;
    font-style: italic;
    line-height: 16px;
}

.cb-uncertain {
    padding-inline: var(--space-1);
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--warning);
}

.cb-kv--read .cb-kv__value {
    text-align: end;
}

.cb-order-lines__badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-block-start: var(--space-2);
}

/* Under the lines: the minimum on the left, the totals on the right, as on an invoice */
.cb-order-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: space-between;
    align-items: flex-start;
    border-block-start: 1px solid var(--line);
}

.cb-order-minimum {
    display: flex;
    flex-wrap: wrap;
    column-gap: var(--space-3);
    row-gap: var(--space-1);
    align-items: center;
    font-size: 13px;
}

/* Who forced the minimum, on its own line, under the label: past the width of its icon */
.cb-order-minimum__forced {
    flex-basis: 100%;
    padding-inline-start: calc(var(--tblr-icon-size, 1.25rem) + var(--space-1));
    font-size: 12px;
}

.cb-order-minimum__label {
    display: inline-flex;
    gap: var(--space-1);
    align-items: center;
    color: var(--ink-muted);
}

.cb-order-totals-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    width: min(100%, 18rem);
    margin: 0 0 0 auto;
    font-size: 13px;

    > div {
        display: flex;
        justify-content: space-between;
        gap: var(--space-3);
    }

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

    dd {
        margin: 0;
        font-family: var(--font-mono);
    }
}

.cb-order-totals-list__grand {
    margin-block-start: var(--space-1);
    padding-block-start: var(--space-2);
    border-block-start: 1px solid var(--line);

    dt,
    dd {
        color: var(--ink);
        font-weight: 600;
        font-size: 15px;
    }
}

/*
 * A timeline (wireframes: .tl): a mark per event, its icon in a round, the marks linked by a line; the event and who
 * did it, then the date on the right.
 */
.cb-timeline {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cb-timeline__item {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: var(--space-3);
    align-items: start;
    padding-block-end: var(--space-4);
    font-size: 13px;
    line-height: 18px;

    &::before {
        position: absolute;
        inset-block: 30px 2px;
        inset-inline-start: 13px;
        width: 2px;
        background: var(--line);
        content: "";
    }

    &:last-child {
        padding-block-end: 0;

        &::before {
            content: none;
        }
    }
}

.cb-timeline__mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--surface-raised);
    border-radius: 50%;
    background: var(--surface-sunken);
    box-shadow: 0 0 0 1px var(--line);
    color: var(--ink-muted);

    .icon {
        width: 14px;
        height: 14px;
    }
}

.cb-timeline__mark--ok {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.cb-timeline__mark--ko {
    background: var(--danger-soft);
    color: var(--danger);
}

.cb-timeline__body {
    display: flex;
    flex-direction: column;
    padding-block-start: 5px;
}

.cb-timeline__date {
    padding-block-start: 5px;
    color: var(--ink-faint);
    font: 400 11px/18px var(--font-mono);
    white-space: nowrap;
}

/*
 * A card whose title stands in a body above a table: the header of the table becomes a sunken band between two rules,
 * which parts the title from the rows (the order, its entry).
 */
.card > .card-body:has(+ .table-responsive > .cb-table) {
    padding-block-end: var(--space-2);
}

.card > .card-body + .table-responsive > .cb-table > thead > tr > th {
    border-block-start: 1px solid var(--line);
    background: var(--surface-sunken);
}

.cb-order-line-form {
    /*
     * Fixed widths, read from the header: the quantity, the VAT, the total and « Retirer » keep theirs, the product takes
     * the rest, and opening its list never moves the columns. Below 40rem, the table scrolls sideways.
     */
    min-width: 40rem;
    table-layout: fixed;

    > thead > tr > th:nth-child(2) {
        width: 6.5rem;
    }

    > thead > tr > th:nth-child(3) {
        width: 4.5rem;
    }

    > thead > tr > th:nth-child(4) {
        width: 7rem;
    }

    > thead > tr > th:last-child {
        width: 3.5rem;
    }

    > tbody > tr > td {
        vertical-align: top;
    }

    /* A required column: the asterisk of a required label (Tabler's .form-label.required), the labels being hidden */
    > thead > tr > th.cb-th-required::after {
        margin-inline-start: 0.25rem;
        color: var(--tblr-red);
        content: "*";
    }
}

/* The total of a line of the entry, on the line of its fields; the totals of the entry under the table */
.cb-order-line-form__total {
    line-height: 40px;
    text-align: end;
    white-space: nowrap;
}

.cb-order-totals {
    border-block-start: 1px solid var(--line);
}

/* A button closing a field (« + » after the address of an order): the border and the corners of the field */
.input-group > .cb-input-action {
    border-color: var(--tblr-control-border-color);
    border-start-end-radius: var(--radius-md);
    border-end-end-radius: var(--radius-md);
    background: var(--surface-raised);
}

/* « Aucune ligne » under the table of the entry while it has no row */
.cb-order-lines-empty {
    max-width: none;
    margin: 0;
    padding: var(--space-3);
    color: var(--ink-faint);
    font-size: 13px;
    text-align: center;
}

.cb-order-line-form:has(> tbody > tr) + .cb-order-lines-empty {
    display: none;
}

/* The target of the prices: a narrow list on the left of « Modifier » (wireframes: Nu-Produit-Prix) */
.cb-price-target {
    width: min(100%, 20rem);
}

/* A price being typed: the field keeps the width of an amount, on the right of its cell */
.cb-price-input {
    width: 10rem;

    .form-control {
        text-align: end;
    }
}

/*
 * A table of the wireframes (ob.css: table, th, td): headers in small capitals in ink-muted, no ground, a line under them,
 * then rows on a light rule. In a card body it keeps to the padding of the card.
 */
.cb-table {
    --tblr-table-bg: transparent;
    margin: 0;
    font-size: 13px;
    line-height: 20px;

    > thead > tr > th {
        padding: var(--space-2) var(--space-3);
        border-block-end: 1px solid var(--line);
        background: none;
        color: var(--ink-muted);
        font: 600 12px/16px var(--font-sans);
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    > tbody > tr > td {
        padding: 10px var(--space-3);
        border-block-end: 1px solid var(--line);
    }

    > tbody > tr:last-child > td {
        border-block-end: 0;
    }
}

/* A table set straight in a card body: its first and last cells line up with the text of the card */
.card-body > .cb-table {
    > * > tr > :first-child {
        padding-inline-start: 0;
    }

    > * > tr > :last-child {
        padding-inline-end: 0;
    }
}

/* An amount or a measure typed in a field: its unit after it, the figures on the right (CentsType, ScaledIntType) */
.cb-unit-input {
    > .form-control {
        text-align: end;
        font-variant-numeric: tabular-nums;
    }

    > .input-group-text {
        color: var(--ink-muted);
    }
}

/* The breadcrumb in a bar of its own, on a rule, apart from the header of the page (.cb-crumbbar, templates/layout/app.html.twig) */
.cb-crumbbar {
    padding-block: var(--space-3);
    border-block-end: 1px solid var(--line);

    .cb-pretitle-row,
    .page-pretitle .breadcrumb {
        margin: 0;
    }
}

.cb-crumbbar + .page-header {
    margin-block-start: var(--space-5);
}

/* The home at the start of the breadcrumb: an icon alone, on the line of the text */
.cb-crumb-home .icon {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

/* The count of an entry of the sidebar, on its right (wireframes: .nav .n): the conversations to handle of the inbox */
.cb-nav-count {
    margin-inline-start: auto;
    padding-inline-start: var(--space-2);
    color: color-mix(in srgb, var(--on-srf) 50%, transparent);
    font: 400 11px var(--font-mono);
}

.cb-sidebar .nav-link.active .cb-nav-count {
    color: var(--signal);
}

/* A word after the breadcrumb, in faint ink (wireframes: .crumb .aux): the address of the inbox */
.cb-crumb-with-aux {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.cb-crumb-aux {
    color: var(--ink-faint);
    font-size: 13px;

    &::before {
        content: "· ";
    }
}

/* An icon or a time in the faint ink of the wireframes (.when, .when .t) */
.cb-when {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-muted);
    white-space: nowrap;

    .icon {
        width: 14px;
        height: 14px;
        color: var(--ink-faint);
        stroke-width: 1.75;
    }
}

.cb-when__time {
    color: var(--ink-faint);
    font: 400 12px/16px var(--font-mono);
}

/*
 * The inbox (wireframes: Inbox, Conversation):
 * - a conversation of the list: the mail icon on a square the height of both lines, then the subject, its count of
 *   messages and its dates on a first line, the customer and the sender under it (.lrow);
 * - a mail of a conversation: its sender and its date, its text, its attachments in pills.
 */
.cb-rows > .cb-conv-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--space-3);
    row-gap: 2px;
    align-items: center;
    padding: 10px 12px;

    > .cb-ico {
        grid-row: span 2;
    }
}

.cb-conv-row__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: inherit;
    text-decoration: none;

    &:is(:hover, :focus, :focus-visible, :active) {
        color: inherit;
        text-decoration: none;
    }

    &:is(:hover, :focus-visible) .cb-conv-row__subject {
        color: var(--brand-ink);
    }
}

.cb-conv-row__subject {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font: 600 15px/20px var(--font-display);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cb-conv-row__count {
    height: 20px;
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.cb-conv-row__dates {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 13px;
    line-height: 18px;
    white-space: nowrap;
}

.cb-conv-row__who {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    line-height: 18px;
}

.cb-conv-row__customer {
    color: var(--ink);
    font-weight: 500;
}

.cb-conv-row__customer--none {
    color: var(--ink-muted);
}

/* The orders read from a conversation, in full width under it and in its page: one row each (wireframes: Inbox, Conversation). */
.cb-conv-row__objects {
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    gap: 6px;
    margin-block-start: 6px;
}

.cb-object {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) auto 32px;
    gap: 10px;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    color: inherit;
    text-decoration: none;

    &:is(:hover, :focus, :focus-visible, :active) {
        color: inherit;
        text-decoration: none;
    }

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

.cb-object__number {
    justify-self: start;
    background: var(--surface-raised);
}

.cb-object__meta {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    line-height: 18px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cb-object__ko {
    color: var(--danger);
    font: 500 13px/18px var(--font-sans);
}

.cb-object__warn {
    color: var(--warning);
    font: 500 13px/18px var(--font-sans);
}

.cb-object__open {
    width: 32px;
    padding: 0;
    justify-content: center;
}

/* An order in the card Commandes of a conversation (wireframes: Conversation, « Objets créés »). */
.cb-conv-orders {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cb-conv-order {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    color: inherit;
    text-decoration: none;

    &:is(:hover, :focus, :focus-visible, :active) {
        color: inherit;
        text-decoration: none;
    }

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

    .cb-kv {
        padding-block: 5px;
    }
}

.cb-conv-order__head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cb-conv-order .cb-object__ko {
    align-items: flex-start;
    white-space: normal;
}

.cb-conv-order__lines {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
}

.cb-conv-order__line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px 72px;
    gap: var(--space-2);
    padding: 5px 8px;
    font-size: 13px;
    line-height: 18px;

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

    > .font-monospace {
        font-size: 12px;
        text-align: end;
    }
}

.cb-conv-order__line--ko {
    color: var(--danger);
}

.cb-conv-order__product {
    overflow: hidden;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cb-conv-order__facts {
    display: flex;
    flex-direction: column;
}

/* An update read in a later mail that waits for a member, under its order: hung on the card, in the colour of a doubt. */
.cb-conv-pending {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-block-start: -10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-block-start: 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: var(--warning-soft);

    .cb-kv {
        padding-block: 5px;
    }
}

@media (max-width: 767.98px) {
    .cb-object {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .cb-object__open {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .cb-conv-row__count,
    .cb-conv-row__dates {
        display: none;
    }
}

.cb-mails {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.cb-mail {
    display: flex;
    flex-direction: column;
    gap: 6px;

    & + & {
        padding-block-start: var(--space-3);
        border-block-start: 1px solid var(--line);
    }
}

.cb-mail__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
}

.cb-mail__date {
    margin-inline-start: auto;
    white-space: nowrap;
}

.cb-mail__text {
    color: var(--ink);
    font-size: 13px;
    line-height: 20px;
    overflow-wrap: anywhere;
}

.cb-mail__files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cb-mail__file {
    height: 26px;
    padding-inline: 10px;
    font: 400 12px/16px var(--font-sans);
    text-decoration: none;

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

    .text-secondary {
        margin-inline-start: var(--space-1);
    }
}

/* A sender of the inbox: a link in the ink of its line, underlined only by its colour on hover */
.cb-sender {
    color: inherit;
    text-decoration: none;

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

/* The history a reply quotes, folded under its text */
.cb-mail__quote {
    > summary {
        width: fit-content;
        color: var(--ink-muted);
        font-size: 13px;
        cursor: pointer;
    }

    > .cb-mail__text {
        margin-block-start: 6px;
        padding-inline-start: var(--space-3);
        border-inline-start: 2px solid var(--line);
        color: var(--ink-muted);
    }
}

/* The HTML of a mail, in its sandboxed frame (mail_frame_controller.js): the height follows the content */
.cb-mail__frame {
    display: block;
    width: 100%;
    min-height: 40px;
    border: 0;
}

.cb-mail__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);

    &:not(:has(> :not([hidden]))) {
        display: none;
    }
}

/* A forwarded mail, in a card under the words of the member who forwards it */
.cb-mail__forward {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.cb-mail__forward-title {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin: 0;
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;

    .icon {
        width: 14px;
        height: 14px;
    }
}

.cb-mail__forward-headers {
    display: grid;
    gap: 2px;
    margin: 0;
    font-size: 13px;
    line-height: 18px;

    > div {
        display: flex;
        gap: var(--space-2);
    }

    dt {
        min-width: 56px;
        color: var(--ink-muted);
        font-weight: 500;
    }

    dd {
        margin: 0;
        overflow-wrap: anywhere;
    }
}

/* Above a mail whose remote images are hidden: what is hidden, and the button that shows them */
.cb-mail__images {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    font-size: 13px;

    &[hidden] {
        display: none;
    }
}
