/* ==========================================================================
   Onix breadcrumb — the surface of Components/Shared/Breadcrumbs.razor: the
   page's heading with the way back.

     .page-trail            the row: a list shows its title alone
     .page-trail.has-record a record is open: a glass bar that stays in view
                            under the top bar while the form scrolls
     .page-trail-back       the back arrow
     .page-trail-history    the screens the person came through
                            (drawn by js/onix-trail.js)
     .page-trail-crumb      a step back: the list, an earlier screen
     .page-trail-more       the "…" the oldest steps fold into
     .page-trail.has-tools  the record's commands (Tools), workflow (Status) and
                            the way through the list (Pager) ride in the bar —
                            Odoo's control panel: full width, one row beside a
                            sticky document pane
     .page-trail-tools      those: .page-trail-actions, .page-trail-status, then
                            .page-trail-pager at the far right (Odoo's form pager)
     .page-trail.is-claimed a list whose grid draws the title in its control
                            row (Services/PageTitleSlot.cs): no row of its own

   The bar's height goes out as --trail-h (js/onix-trail.js) for what parks
   under it (css/onix-splitview.css). Every colour is a token.
   ========================================================================== */

.page-trail {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    margin: 0 0 8px;
    min-height: 28px;
}
.page-trail h2 {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Breadcrumbs Dense: a list whose rows want the window — a smaller heading on a shorter line, with less under
   it, so the list's control row starts higher. A record's bar (.has-record) is not dense. */
.page-trail.is-dense { min-height: 24px; margin-bottom: 4px; }
.page-trail.is-dense h2 { font-size: 1rem; }
.page-trail-history { display: contents; }
/* The grid draws the title in its control row: the nav keeps only the way back when there is one (the earlier
   screens the script draws), else it takes no room at all. The shell's bar, then the control row, over the rows. */
.page-trail.is-claimed h2 { display: none; }
.page-trail.is-claimed:not(.has-history) { display: none; }
.page-trail.is-claimed.has-history { min-height: 24px; margin-bottom: 4px; }

.page-trail.has-record {
    position: sticky;
    top: calc(var(--shell-gap) + var(--shell-bar-h) + 8px);
    z-index: 40;
    width: fit-content;
    max-width: 100%;
    margin: -2px 0 8px -4px;
    padding: 3px 12px 3px 4px;
    border-radius: 999px;
    background: var(--glass-fill-chrome);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-chrome);
    box-shadow: var(--glass-shadow), var(--glass-highlight);
}

.page-trail-back {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-right: 4px;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: 50%;
    background: var(--glass-fill-control);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.page-trail-back svg { width: 15px; height: 15px; }
.page-trail-back:hover { background: var(--brand); border-color: var(--brand); color: #fff; transform: translateX(-1px); }

.page-trail-crumb {
    flex: 0 4 auto;        /* the steps back give way before the heading does */
    min-width: 2.5em;
    max-width: 22em;
    padding: 3px 5px;
    border: 0;
    border-radius: var(--radius-xs);
    background: none;
    color: var(--brand);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.page-trail-crumb:hover { color: var(--brand-strong); background: var(--glass-fill-control); text-decoration: none; }

.page-trail-back:focus-visible,
.page-trail-crumb:focus-visible,
.page-trail-more > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* The "/" between the steps: after every step back, never after the heading. */
.page-trail-sep { flex: none; padding: 0 3px; color: var(--muted); opacity: 0.6; user-select: none; }

/* With a step before it the heading is the last crumb: the size of the others. */
.page-trail.has-record h2,
.page-trail.has-history h2 { font-size: 0.98rem; padding: 0 4px; }
/* REV-013: the internal (journal) number beside a customer document's ЗДДС number. */
.page-trail-internal { flex: none; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* "…": the oldest steps, in a drop-down. */
.page-trail-more { position: relative; flex: none; }
.page-trail-more > summary {
    list-style: none;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
}
.page-trail-more > summary::-webkit-details-marker { display: none; }
.page-trail-more > summary:hover,
.page-trail-more[open] > summary { color: var(--ink); background: var(--glass-fill-control); }
.page-trail-more-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    max-width: min(340px, calc(100vw - 48px));
    padding: 6px;
    background: var(--glass-pop);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}
.page-trail-more-panel .page-trail-crumb { max-width: none; padding: 7px 10px; color: var(--ink); font-weight: 500; }
.page-trail-more-panel .page-trail-crumb:hover { color: var(--brand-strong); }

/* ─── The record's commands and workflow in the bar: Odoo's control panel ── */

/* Tools and/or Status make the bar full width: the crumbs, then the commands pushed to the
   right, the workflow at the end. Beside a sticky document pane (a window wider than the split's
   stacking point, css/onix-splitview.css) it is one row — the crumbs give way to their ellipses
   before anything wraps — so the pane knows where it ends; on a narrower window the commands take
   a row of their own. */
.page-trail.has-tools {
    width: 100%;
    margin: -2px 0 10px;
    padding: 3px 8px 3px 4px;
    border-radius: 16px;
    gap: 4px 10px;
    flex-wrap: wrap;
}
.page-trail.has-tools .page-trail-current { min-width: 4em; }
.page-trail-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: auto;
    gap: 4px 10px;
}
.page-trail-actions,
.page-trail-status,
.page-trail-pager { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.page-trail-actions > * { flex: none; }

/* The bar's controls: as tall as the pill's arrow leaves them, never broken across lines. */
.page-trail-tools .button.small { padding: 3px 8px; white-space: nowrap; }
.page-trail-tools .button svg { width: 15px; height: 15px; vertical-align: -3px; }
.page-trail-tools .button svg + .button-label { margin-left: 4px; }
.page-trail-tools .button[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.page-trail-tools .row-menu-button { padding: 3px 8px; font-size: 0.8rem; border-radius: var(--radius-xs); }
.page-trail-status .statusbar { flex-wrap: nowrap; }
.page-trail-status .statusbar-step { padding: 3px 10px; font-size: 0.76rem; white-space: nowrap; }

/* Odoo's form pager at the far right end: "‹ 3 / 50 ›" joined, the count between the arrows and bordered like
   them (IDE-001, Variant C) — the way through the list without leaving the form (Pages/Accounting/Invoices.razor,
   EditorPager). */
.page-trail-pager { flex: none; flex-wrap: nowrap; margin-left: 2px; padding-left: 8px; border-left: 1px solid var(--hairline); }
.page-trail-pager .editor-nav { display: inline-flex; align-items: center; gap: 6px; }
.editor-nav__count { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.editor-nav__buttons { display: inline-flex; align-items: stretch; }
.editor-nav__buttons > .button.small.icon { width: 26px; padding: 0; border-radius: 0; box-shadow: none; justify-content: center; }
.editor-nav__buttons > .editor-nav__count {
    display: inline-flex; align-items: center; padding: 0 8px; margin-left: -1px;
    border: 1px solid var(--hairline); background: var(--glass-fill-control);
}
.editor-nav__buttons > * + .button { margin-left: -1px; }
.editor-nav__buttons > :first-child { border-top-left-radius: 7px; border-bottom-left-radius: 7px; }
.editor-nav__buttons > :last-child { border-top-right-radius: 7px; border-bottom-right-radius: 7px; }
.editor-nav__buttons > .button:hover:not(:disabled), .editor-nav__buttons > .button:focus-visible { position: relative; z-index: 1; }

@media (min-width: 1100.02px) {
    .page-trail.has-tools,
    .page-trail-status { flex-wrap: nowrap; }
    /* One row while it fits; when it does not — a posted document's Pay… and payment chip, from 1280 px
       up to 1920 — the workflow steps drop under the commands instead of running out of the bar. The
       tools take the room left (so they never wrap when they fit) and may shrink to it (E2E 2026-10-13). */
    .page-trail-tools { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
    /* The editor's steps, badges, chips, tools and commands are one group: wider than the bar — a posted
       document's Fields, Confirm and open next, Cash payment, Pay…, the Documents chip — it wraps inside the
       bar, Save and ⋯ on a row of their own, rather than running out of it (E2E 2026-10-21, REV-006). */
    .page-trail-actions { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
}
/* A window the one-row bar is tight on: the tools keep their icons and drop their words (their
   titles say them) — the form's tools and the document's commands first, the rest and the steps'
   padding later. */
@media (min-width: 1100.02px) and (max-width: 1500px) {
    /* Save keeps its word ("Запази" in the Variant C mock-up at 1440 px); the other commands drop theirs. */
    .page-trail-tools .editor-tools .button-label,
    .page-trail-tools .editor-commands :not(.editor-save) > .button-label,
    .page-trail-tools .row-menu-button > span:not(.row-menu-caret) { display: none; }
    .page-trail-tools .row-menu-button .row-menu-caret { margin-left: 2px; }
}
@media (min-width: 1100.02px) and (max-width: 1200px) {
    .page-trail-tools .button-label { display: none; }
    .page-trail-status .statusbar-step { padding: 3px 8px; }
}

@media (max-width: 767.98px) {
    /* The top bar is part of the page on a phone: the bar sticks to the window's top. */
    .page-trail.has-record { top: calc(var(--safe-top) + 8px); margin-left: 0; }
    .page-trail.has-tools { margin-left: 0; border-radius: 18px; }
    .page-trail-crumb { max-width: 9em; }
    /* No room for the backlog: the arrow, the list and the record. */
    .page-trail-history .page-trail-crumb,
    .page-trail-history .page-trail-sep,
    .page-trail-more { display: none; }
    /* The commands and the workflow on rows of their own, each scrolling sideways when it must; the pager beside the workflow. */
    .page-trail-tools { flex: 1 1 100%; justify-content: flex-start; }
    .page-trail-actions,
    .page-trail-status { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
    .page-trail-status { flex: 1 1 auto; }
    .page-trail-pager { margin-left: auto; }
}

@media print {
    .page-trail.has-record { position: static; padding: 0; border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .page-trail-back, .page-trail-history, .page-trail-crumb, .page-trail-sep, .page-trail-tools { display: none; }
}
