/* 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 under the logo: the name of the choice, then the selector icon at the end of the line. Inset like the entries (Tabler's sidebar inset, 8px). */
    .cb-workspace-filter {
        margin-inline: var(--space-2);
        margin-block-end: var(--space-4);

        > .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: the account's above it, the workspace filter's under it.
     */
    :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 */
    .cb-workspace-filter.dropdown .dropdown-menu {
        inset: 100% 0 auto;
        margin: var(--space-1) 0 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);
    }

    .navbar-footer {
        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;
}

.page-title .cb-title-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-inline-start: var(--space-3);
    vertical-align: middle;

    .badge {
        font-size: 12px;
    }
}

.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: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-block-end: var(--space-2);
}

.cb-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-inline-start: 1px solid var(--line);

    &:first-child {
        padding-inline-start: 0;
        border-inline-start: 0;
    }
}

.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-sunken);
    color: var(--ink-muted);
}

.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-lines {
    td,
    th {
        padding-inline: 0;
    }

    .cb-order-lines__amount {
        white-space: nowrap;
        text-align: end;
    }

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

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

.cb-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;

    > li {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: var(--space-2);
        padding-block-end: var(--space-2);
        border-block-end: 1px solid var(--line);
        font-size: 13px;

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

.cb-order-line-form {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.3fr) auto;
    gap: var(--space-3);
    align-items: end;
    padding-block: var(--space-2);
    border-block-end: 1px solid var(--line);

    .mb-3 {
        margin-block-end: 0 !important;
    }

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

        > :first-child {
            grid-column: 1 / -1;
        }
    }
}

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

/* The foot of the sidebar: the workspace shown, then the person under it, each on its own line (_account.html.twig) */
.cb-sidebar .navbar-footer .cb-account-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 18px;

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

.cb-sidebar .navbar-footer .cb-account-workspace {
    color: color-mix(in srgb, var(--on-srf) 55%, transparent);
    font-size: 12px;
}

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