/* ==========================================================================
   Admin workspace (2026-11-26): full-width header, Admin side menu (client's
   current menu items, same order), page area. Collapses to an icon rail on
   desktop; folds behind a button below 992px.
   ========================================================================== */

/* Full-width header and footer in the workspace, logo lines up with the menu */
.bo-app .bo-header .tb-container,
.bo-app .bo-footer .tb-container { max-width: none; padding-left: 24px; padding-right: var(--tb-gutter); }
.bo-main.bo-main--app { padding: 0; }   /* beats site.css's phone padding-top */

.ad-shell { --ad-nav-w: 264px; display: grid; grid-template-columns: var(--ad-nav-w) minmax(0, 1fr); align-items: start; min-height: calc(100vh - var(--tb-header-h)); }
.ad-shell.is-collapsed { --ad-nav-w: 68px; }

/* ---- Side menu ---- */
.ad-nav {
    position: sticky; top: var(--tb-header-h); height: calc(100vh - var(--tb-header-h));
    display: flex; flex-direction: column; min-width: 0;
    background: var(--tb-surface); border-right: 1px solid var(--tb-border);
}
.ad-nav__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 12px 10px 24px; }
.ad-nav__title { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tb-text-muted); }
.ad-nav__collapse {
    position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0;
    border: 0; border-radius: 8px; background: none; color: var(--tb-text-muted); cursor: pointer;
}
.ad-nav__collapse:hover { background: var(--tb-surface-muted); color: var(--tb-primary); }
.ad-nav__toggle { display: none; }

.ad-nav__list { flex: 1; margin: 0; padding: 4px 12px 24px; list-style: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.ad-nav__list > li + li { margin-top: 2px; }

.ad-link {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 10px 8px 12px;
    border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--tb-text);
    cursor: pointer; list-style: none; user-select: none;
}
.ad-link::-webkit-details-marker { display: none; }
.ad-link:hover { background: var(--tb-surface-muted); color: var(--tb-text-strong); text-decoration: none; }
.ad-link__ic { color: var(--tb-text-muted); }
.ad-link:hover .ad-link__ic { color: var(--tb-primary); }
.ad-link__label { flex: 1; min-width: 0; }
.ad-link__chev { color: var(--tb-text-muted); transition: transform .15s ease; }
.ad-group[open] > .ad-link .ad-link__chev { transform: rotate(180deg); }
.ad-link.is-active, .ad-group.has-active > .ad-link { color: var(--tb-primary); font-weight: 600; }
.ad-link.is-active { background: var(--tb-ice); }
.ad-link.is-active .ad-link__ic, .ad-group.has-active > .ad-link .ad-link__ic { color: var(--tb-primary); }

/* Submenu: a quiet guide line, the open page marked on it */
.ad-sub { margin: 2px 0 8px 21px; padding: 0 0 0 12px; list-style: none; border-left: 1px solid var(--tb-border); }
.ad-sub__link {
    position: relative; display: flex; align-items: center; min-height: 34px; padding: 6px 10px;
    border-radius: 6px; font-size: 13.5px; line-height: 1.35; color: var(--tb-text-neutral);
}
.ad-sub__link:hover { background: var(--tb-surface-muted); color: var(--tb-text-strong); text-decoration: none; }
.ad-sub__link.is-active { background: var(--tb-ice); color: var(--tb-primary); font-weight: 600; }
.ad-sub__link.is-active::before { content: ""; position: absolute; left: -13px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--tb-primary); }

.ad-link:focus-visible, .ad-sub__link:focus-visible, .ad-nav__collapse:focus-visible { outline: 2px solid var(--tb-royal); outline-offset: -2px; }

/* ---- Page area ---- */
.ad-content { min-width: 0; max-width: 1400px; padding: 28px var(--tb-gutter) 64px; container-type: inline-size; container-name: adcontent; }

/* ---- Desktop icon rail ---- */
@media (min-width: 992px) {
    .ad-shell.is-collapsed .ad-nav__head { padding: 18px 16px 10px; justify-content: center; }
    .ad-shell.is-collapsed .ad-nav__title,
    .ad-shell.is-collapsed .ad-link__chev,
    .ad-shell.is-collapsed .ad-sub { display: none; }
    .ad-shell.is-collapsed .ad-link__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .ad-shell.is-collapsed .ad-nav__list { padding: 4px 12px 24px; overflow: visible; }
    .ad-shell.is-collapsed .ad-link { justify-content: center; padding: 8px; }
    .ad-shell.is-collapsed .ad-group.has-active > .ad-link { background: var(--tb-ice); }

    /* Name of each icon on hover / keyboard focus */
    .ad-shell.is-collapsed [data-tip]:hover::after,
    .ad-shell.is-collapsed [data-tip]:focus-visible::after {
        content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); z-index: 60;
        padding: 6px 10px; border-radius: 6px; background: var(--tb-primary); color: var(--tb-on-strong);
        font-size: 12.5px; font-weight: 500; white-space: nowrap; pointer-events: none; box-shadow: var(--tb-shadow-pop);
    }
}

/* ---- Tablet and phone: the menu folds behind a button above the page ---- */
@media (max-width: 991.98px) {
    .bo-app .bo-header .tb-container, .bo-app .bo-footer .tb-container { padding-left: var(--tb-gutter); }
    .ad-shell { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .ad-nav { position: relative; top: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--tb-border); }
    .ad-nav__head { display: none; }
    .ad-nav__toggle {
        display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 var(--tb-gutter);
        border: 0; background: none; font: 500 14px var(--tb-font); color: var(--tb-text-strong); cursor: pointer; text-align: left;
    }
    .ad-nav__toggle-cap { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tb-text-muted); }
    .ad-nav__toggle-page { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
    .ad-nav__toggle[aria-expanded="true"] .ic--sm { transform: rotate(180deg); }
    .ad-nav__list { display: none; padding: 0 calc(var(--tb-gutter) - 10px) 16px; overflow: visible; }
    .ad-shell.is-menu-open .ad-nav__list { display: block; }
    .ad-link { min-height: 44px; }
    .ad-sub__link { min-height: 40px; }
}

/* ==========================================================================
   Product pass (2026-12-03): the workspace feels like one product.
   The side menu stays still between pages and folds smoothly; the page arrives in a short, ordered rise;
   tabs, tables and list rows share one quiet finish. Motion tokens: design-system.css.
   ========================================================================== */
.ad-nav { view-transition-name: ad-nav; }
::view-transition-group(ad-nav) { animation: none; }
::view-transition-old(ad-nav) { display: none; }
::view-transition-new(ad-nav) { animation: none; }

/* Menu groups fold to their height instead of jumping */
.ad-group::details-content { block-size: 0; overflow: hidden; transition: block-size var(--tb-dur-3) var(--tb-ease), content-visibility var(--tb-dur-3) allow-discrete; }
.ad-group[open]::details-content { block-size: auto; }
.ad-link { transition: background-color var(--tb-dur-1), color var(--tb-dur-1); }
.ad-link__chev { transition: transform var(--tb-dur-2) var(--tb-ease); }
.ad-sub__link { transition: background-color var(--tb-dur-1), color var(--tb-dur-1), padding-left var(--tb-dur-2) var(--tb-ease); }
.ad-sub__link:hover { padding-left: 13px; }
.ad-sub__link.is-active::before { animation: tb-grow-y var(--tb-dur-3) var(--tb-ease); transform-origin: center; }
@keyframes tb-grow-y { from { transform: scaleY(0); } }
.ad-shell { transition: grid-template-columns var(--tb-dur-3) var(--tb-ease); }

/* The page arrives in order: heading, tabs, then the work area */
.ad-content > * { animation: tb-rise var(--tb-dur-3) var(--tb-ease) both; }
.ad-content > *:nth-child(2) { animation-delay: 30ms; }
.ad-content > *:nth-child(3) { animation-delay: 60ms; }
.ad-content > *:nth-child(n+4) { animation-delay: 90ms; }
.ad-content > .ev > * { animation: tb-rise var(--tb-dur-3) var(--tb-ease) both; }
.ad-content > .ev > *:nth-child(2) { animation-delay: 40ms; }
.ad-content > .ev > *:nth-child(3) { animation-delay: 80ms; }
.ad-content > .ev > *:nth-child(4) { animation-delay: 110ms; }
.ad-content > .ev > *:nth-child(n+5) { animation-delay: 140ms; }
.ad-content > .ev { animation: none; }
/* Dialogs are placed by the browser: never animate them as page blocks */
.ad-content dialog:not([open]) { animation: none; }

/* Page heading: title, one line about the page, actions on the right */
html body .ad-content .tb-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12.5px; }
html body .ad-content .tb-breadcrumb [aria-hidden="true"] { color: var(--tb-border-hover); }
html body .ad-content .ev-title { font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
html body .ad-content .ev-lead { margin-top: 4px; max-width: 720px; font-size: 14.5px; line-height: 1.5; color: var(--tb-text-muted); }
html body .ad-content .ma-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-top: 10px; }
/* 2026-12-03: pages whose title and lead sit straight in .ma-page keep the lead under the title, as on every other page */
html body .ad-content .ma-page > .ev-title { flex: 0 0 100%; }
html body .ad-content .ma-page > .ev-lead { margin-top: -8px; }

/* Tabs: the open tab's line grows in */
html body .ad-content .ma-tab { position: relative; border-bottom-color: transparent; transition: color var(--tb-dur-1); }
html body .ad-content .ma-tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background-color var(--tb-dur-2); }
html body .ad-content .ma-tab:hover::after { background: var(--tb-border-strong); }
html body .ad-content .ma-tab.is-on::after { background: var(--tb-primary); animation: tb-grow-x var(--tb-dur-3) var(--tb-ease); }
html body .ad-content .ma-tab__n { transition: background-color var(--tb-dur-2), color var(--tb-dur-2); }

/* Panels and tables: one finish everywhere */
html body .ad-content .tb-panel, html body .ad-content .tb-form-card { border-color: var(--tb-border); box-shadow: 0 1px 2px rgba(11, 31, 58, .03); }
html body .ad-content .ev-table th { background: var(--tb-surface-muted); font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--tb-text-neutral); border-bottom-color: var(--tb-border); }
html body .ad-content .ev-table thead tr:first-child th:first-child { border-top-left-radius: var(--tb-radius-card); }
html body .ad-content .ev-table thead tr:first-child th:last-child { border-top-right-radius: var(--tb-radius-card); }
html body .ad-content .ev-table td { border-bottom-color: #EDF1F7; transition: background-color var(--tb-dur-1); }
html body .ad-content .ev-table tbody tr:last-child td { border-bottom: 0; }
html body .ad-content .ev-table tbody tr:hover td { background: #F7FAFF; }
html body .ad-content .ev-foot { border-top: 1px solid var(--tb-border); background: var(--tb-surface); border-radius: 0 0 var(--tb-radius-card) var(--tb-radius-card); }

/* Rows arrive one after another (first screenful only) */
.ad-content .ev-table tbody tr { animation: tb-rise 260ms var(--tb-ease) both; }
.ad-content .ev-table tbody tr:nth-child(2) { animation-delay: 20ms; }
.ad-content .ev-table tbody tr:nth-child(3) { animation-delay: 40ms; }
.ad-content .ev-table tbody tr:nth-child(4) { animation-delay: 60ms; }
.ad-content .ev-table tbody tr:nth-child(5) { animation-delay: 80ms; }
.ad-content .ev-table tbody tr:nth-child(6) { animation-delay: 100ms; }
.ad-content .ev-table tbody tr:nth-child(7) { animation-delay: 120ms; }
.ad-content .ev-table tbody tr:nth-child(8) { animation-delay: 140ms; }
.ad-content .ev-table tbody tr:nth-child(n+9) { animation-delay: 160ms; }

/* Status tags: one shape, a dot that means something */
html body .ad-content .ev-tag { padding: 3px 10px 3px 8px; font-size: 12px; letter-spacing: .01em; }

/* Empty states: a calmer icon */
html body .ad-content .ev-state__icon { width: 52px; height: 52px; background: var(--tb-surface-muted); box-shadow: inset 0 0 0 1px var(--tb-border); }

/* Search field in table toolbars grows a little on focus */
html body .ad-content .ev-find { transition: border-color var(--tb-dur-1), box-shadow var(--tb-dur-2) var(--tb-ease); }
html body .ad-content .ev-find input { transition: width var(--tb-dur-3) var(--tb-ease); }
@media (min-width: 900px) { html body .ad-content .ev-find:focus-within input { width: 260px; } }
