/* ==========================================================================
   Onix shell — the floating chrome of the Figma "OnixBI — Home v0.1".

   Desktop (frame "Home / Desktop 1440", drawn tighter: the chrome is one slim
   row, so a list's title and control row are the only other row over its rows)
     SideRail   88 wide · 12 from the edges · radius 24 · padding 10/12 · gap 4
     TopBar     44 high · top 12 · left 112 · right 12 · radius 22 · padding 0 8
     Page       content starts at x=112, y=68 (12 + 44 + 12), 24 bottom
   Phone (frame "Home / Mobile 393")
     no rail; the bar dissolves into the page header; a floating TabBar
     72 high · 16 from the edges · radius 36 · blur 40 with the capture FAB.

   Chrome = the glass recipe of onix-glass.css with the 60% fill / 95% rim.
   Components: Layout/SideRail.razor, TopBar.razor, MobileTabBar.razor.
   ========================================================================== */

:root {
    --shell-gap: 12px;
    --shell-rail-w: 88px;
    --shell-bar-h: 44px;
    --shell-content-x: calc(var(--shell-gap) + var(--shell-rail-w) + 12px);   /* 112 */
    /* Where what stays in view parks (sticky table headers, the document pane): the bar and 8px of air. */
    --topbar-h: calc(var(--shell-gap) + var(--shell-bar-h) + 8px);
    --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
    --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

.shell { min-height: 100vh; min-height: 100dvh; }

main.shell-main {
    margin: 0 var(--shell-gap) 0 var(--shell-content-x);
    padding: calc(var(--shell-gap) * 2 + var(--shell-bar-h)) 0 24px;
}
.shell-main .content { max-width: none; margin: 0; }

/* The page keeps its face while its island loads (js/onix-settle.js): a view transition holds a snapshot of the
   content — the content alone: the root opts out, so the rail and the bar stay live — until the island has rendered
   with its data, then swaps without animating. Nothing of the transition takes the pointer: a click on the chrome
   while the content is held lands.
   The content carries the name only while it is held (.is-held, set and taken back by the script): a named element is
   a stacking context of its own, and a drawer opened in the page (css/onix-drawer.css, z-index 1300) would count
   only inside the content — under the bar and the rail, its ✕ covered. Never name the content for good. */
main.shell-main > article.content.is-held { view-transition-name: onix-content; }
:root { view-transition-name: none; }
::view-transition { pointer-events: none; }
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }

/* ─── Chrome surface ───────────────────────────────────────────────────── */

.shell-rail,
.shell-topbar,
.shell-tabbar {
    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);
}

/* ─── Side rail ────────────────────────────────────────────────────────── */

.shell-rail {
    position: fixed;
    top: var(--shell-gap);
    bottom: var(--shell-gap);
    left: var(--shell-gap);
    z-index: 52;
    width: var(--shell-rail-w);
    padding: 10px 12px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.shell-mark { display: block; width: 40px; height: 40px; border-radius: 12px; flex: none; transition: transform 0.18s ease; }
.shell-mark img { display: block; width: 40px; height: 40px; }
.shell-mark:hover { transform: scale(1.04); }

.shell-rail-divider { width: 40px; height: 1px; margin: 6px 0 4px; background: var(--hairline); flex: none; }
.shell-rail-spacer { flex: 1 1 auto; }
.shell-rail-nav { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* Nav item: 64 wide, icon 28 over a 10px label; the active one is a white
   pill with a soft navy shadow, its label in teal/700. */
.shell-nav {
    width: 64px;
    padding: 8px 4px 6px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}
.shell-nav, .shell-nav:visited { color: var(--muted); }
.shell-nav:hover { text-decoration: none; color: var(--ink-soft); background: var(--glass-fill-control); }
.shell-nav img { width: 28px; height: 28px; display: block; opacity: 0.6; transition: opacity 0.16s ease; }
.shell-nav:hover img { opacity: 0.9; }
.shell-nav svg { width: 22px; height: 22px; display: block; margin: 3px 0; }
.shell-nav::-webkit-details-marker { display: none; }

.shell-nav.is-active,
.shell-pop[open] > .shell-nav {
    background: var(--panel);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0, 0, 0, 0.04);
    color: var(--brand-strong);
    font-weight: 600;
}
.shell-nav.is-active img,
.shell-pop[open] > .shell-nav img { opacity: 1; }

:root[data-theme="dark"] .shell-nav.is-active,
:root[data-theme="dark"] .shell-pop[open] > .shell-nav,
:root[data-theme="dark"] .shell-subnav-link.active,
:root[data-theme="dark"] .shell-menu[open] > .shell-menu-head.active { background: rgba(255, 255, 255, 0.10); box-shadow: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-nav.is-active,
    :root:not([data-theme="light"]) .shell-pop[open] > .shell-nav,
    :root:not([data-theme="light"]) .shell-subnav-link.active,
    :root:not([data-theme="light"]) .shell-menu[open] > .shell-menu-head.active { background: rgba(255, 255, 255, 0.10); box-shadow: none; }
}

/* A short window — or a rail the person filled (.shell-rail--dense, RailLayout.DenseFrom entries or more): drop the
   labels (the bare spans; an app's glyph tile and the edit mode's × keep their classes) before the rail overflows. */
@media (max-height: 660px) {
    .shell-nav { padding: 9px 4px; }
    .shell-nav > span:not([class]) { display: none; }
    .shell-rail { gap: 4px; }
    .shell-rail-nav { gap: 4px; }
}
.shell-rail--dense .shell-nav { padding: 9px 4px; }
.shell-rail--dense .shell-nav > span:not([class]) { display: none; }
.shell-rail--dense { gap: 4px; }
.shell-rail--dense .shell-rail-nav { gap: 4px; }

/* ─── Top bar ──────────────────────────────────────────────────────────── */

.shell-topbar {
    position: fixed;
    top: var(--shell-gap);
    left: var(--shell-content-x);
    right: var(--shell-gap);
    z-index: 50;
    height: var(--shell-bar-h);
    padding: 0 6px 0 8px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search: 260 wide pill, 15px glyph, "⌘K" chip — 30 high like every control of the bar — and Mayla's sparkle at its
   right end (TopBar.razor, .shell-searchbar: the box takes the bar's sizing, the pill fills it, the sparkle sits on it). */
.shell-searchbar {
    position: relative;
    flex: 0 1 260px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.shell-search {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 10px 0 11px;
    border-radius: 999px;
    background: var(--panel-hover);
    border: 1px solid transparent;
    font: inherit;
    font-size: 12.5px;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease, box-shadow 0.16s ease;
}
.shell-search:hover { background: #E8E8ED; }
.shell-search:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.shell-search svg { width: 15px; height: 15px; flex: none; }
.shell-search-hint { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-search kbd {
    flex: none;
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--panel-hover);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--muted);
}
.shell-searchbar .shell-search { padding-right: 36px; }
.shell-search-mayla {
    position: absolute;
    top: 50%;
    right: 3px;
    width: 26px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 999px 999px 0;
    background: transparent;
    color: var(--dnt-coral-500, var(--brand));
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 0.16s ease, background 0.16s ease;
}
.shell-search-mayla svg, .shell-mayla-icon svg { width: 16px; height: 16px; }
.shell-search-mayla:hover { background: color-mix(in srgb, var(--dnt-coral-500, var(--brand)) 12%, transparent); }
.shell-search-mayla:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.shell-search-mayla[aria-expanded="true"] { background: color-mix(in srgb, var(--dnt-coral-500, var(--brand)) 16%, transparent); }
.shell-mayla-icon { color: var(--dnt-coral-500, var(--brand)); }
.shell-iconbtn.shell-search-icon, .shell-iconbtn.shell-mayla-icon { display: none; }
/* With an app menu beside it the search yields room: 220 wide, the hint still readable. */
.shell-topbar:has(.shell-subnav-app) .shell-searchbar { flex-basis: 200px; }

/* The current app and its pages. */
.shell-subnav { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 4px; }
.shell-subnav-app {
    flex: none;
    padding: 0 8px 0 4px;
    border-right: 1px solid var(--hairline);
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink) !important;
    white-space: nowrap;
}
.shell-subnav-app:hover { text-decoration: none; color: var(--brand-strong) !important; }
/* The menu bar: Odoo's drop-downs and the plain buttons, one row that is
   never scrolled — js/onix-shell.js folds the buttons past the width into a
   "More" drop-down at the end. Until it has run, the row clips instead of
   spilling over the actions. */
.shell-menubar {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px 4px 3px 2px;
}
.shell-menubar:not(.is-ready) { overflow: hidden; }
.shell-menu-entry.is-overflow { display: none; }
.shell-subnav-link {
    flex: none;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--ink-soft) !important;
    transition: background 0.16s ease, color 0.16s ease;
}
.shell-subnav-link:hover { text-decoration: none; color: var(--ink) !important; background: var(--glass-fill-control); }
.shell-subnav-link.active {
    background: var(--panel);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0, 0, 0, 0.04);
    color: var(--brand-strong) !important;
    font-weight: 600;
}

/* A drop-down button: the same pill, a caret; open, it looks hovered. */
.shell-menu { position: relative; flex: none; }
.shell-menu-head {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding-right: 9px;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.shell-menu-head::-webkit-details-marker { display: none; }
.shell-menu-head::marker { content: ""; }
.shell-menu-head .shell-caret { width: 11px; height: 11px; color: currentColor; opacity: 0.7; transition: transform 0.16s ease; }
.shell-menu[open] > .shell-menu-head { background: var(--glass-fill-control); color: var(--ink) !important; }
.shell-menu[open] > .shell-menu-head.active { background: var(--panel); color: var(--brand-strong) !important; }
.shell-menu[open] > .shell-menu-head .shell-caret { transform: rotate(180deg); }

/* The drop-down: under its button's left edge (flipped to the right edge when
   it would leave the window). Its headed runs are columns, each as wide as its
   longest heading or entry — never narrower, so no column runs into the next —
   side by side while the panel has the room (about four across at most), on a
   further row when it has not; a heading-less lead run ("Settings") is a row
   of its own above them. An entry past a column's limit ends in an ellipsis.
   Two classes: these must win over the generic .shell-pop-panel rules further
   down. */
.shell-pop-panel.shell-menu-panel {
    left: 0;
    right: auto;
    top: calc(100% + 8px);
    min-width: 232px;
    max-width: min(1040px, 100vw - 48px);
    padding: 8px;
}
.shell-pop-panel.shell-menu-panel.is-flipped { left: auto; right: 0; }
.shell-pop-panel.shell-menu-panel.has-sections { width: max-content; }
.shell-menu-columns { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 16px; }
.shell-menu-columns > .shell-menu-section { flex: 0 1 auto; min-width: 150px; max-width: 340px; }
.shell-menu-section--lead { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--hairline); }
.shell-menu-section-title {
    padding: 8px 10px 4px;
    font-family: var(--font-display);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shell-menu-panel .shell-menu-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-menu-item.is-active { background: var(--brand-soft); color: var(--brand-strong) !important; font-weight: 600; }
.shell-menu-item.is-active:hover { background: var(--brand-soft-2); }

/* "More": the buttons the width could not hold — a link stays a link, a
   drop-down becomes a titled run of its links, its headings indented under it. */
.shell-menu--more .shell-menu-panel { max-height: calc(100vh - 140px); overflow-y: auto; overscroll-behavior: contain; }
.shell-menu--more .shell-menu-panel > * + .shell-menu-group,
.shell-menu--more .shell-menu-panel > .shell-menu-group + * { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--hairline); }
.shell-menu-group-title {
    padding: 8px 10px 4px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    white-space: nowrap;
}
.shell-menu-group .shell-menu-section-title { padding-left: 18px; color: var(--muted); }
.shell-menu-group .shell-menu-item { padding-left: 18px; }

.shell-actions { flex: none; display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Company switcher: glass pill, green "live" dot, name, chevron. */
.shell-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--glass-border);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink) !important;
    white-space: nowrap;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.16s ease;
}
.shell-pill::-webkit-details-marker { display: none; }
.shell-pill:hover { background: var(--panel-hover); text-decoration: none; }
.shell-live { width: 8px; height: 8px; border-radius: 50%; background: var(--dnt-green); flex: none; }
.shell-company-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.shell-caret { width: 12px; height: 12px; flex: none; color: var(--muted); }

/* Bell (and the phone's search button): 32px glass circle. */
.shell-iconbtn {
    position: relative;
    width: 32px;
    height: 32px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    background: var(--panel);
    border: 1px solid var(--glass-border);
    color: var(--ink) !important;
    cursor: pointer;
    transition: background 0.16s ease;
}
.shell-iconbtn:hover { background: var(--panel-hover); text-decoration: none; }
.shell-iconbtn svg { width: 16px; height: 16px; display: block; }
/* The language switch: the same glass circle, the other language's code in it. */
.shell-lang { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-family: inherit; }
.shell-badge {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 1.5px #FFFFFF;
}

/* Avatar: navy disc, white ring, initials. */
.shell-avatar {
    width: 32px;
    height: 32px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--solid);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #FFFFFF;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.shell-avatar::-webkit-details-marker { display: none; }
.shell-avatar--lg { width: 40px; height: 40px; font-size: 12px; cursor: default; }

:root[data-theme="dark"] .shell-search,
:root[data-theme="dark"] .shell-pill,
:root[data-theme="dark"] .shell-iconbtn { background: var(--glass-fill-control); }
:root[data-theme="dark"] .shell-search:hover,
:root[data-theme="dark"] .shell-pill:hover,
:root[data-theme="dark"] .shell-iconbtn:hover { background: rgba(255, 255, 255, 0.12); }
:root[data-theme="dark"] .shell-avatar { background: var(--solid); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22); }
:root[data-theme="dark"] .shell-badge { box-shadow: 0 0 0 1.5px var(--dnt-navy-700); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-search,
    :root:not([data-theme="light"]) .shell-pill,
    :root:not([data-theme="light"]) .shell-iconbtn { background: var(--glass-fill-control); }
    :root:not([data-theme="light"]) .shell-search:hover,
    :root:not([data-theme="light"]) .shell-pill:hover,
    :root:not([data-theme="light"]) .shell-iconbtn:hover { background: rgba(255, 255, 255, 0.12); }
    :root:not([data-theme="light"]) .shell-avatar { background: var(--solid); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22); }
    :root:not([data-theme="light"]) .shell-badge { box-shadow: 0 0 0 1.5px var(--dnt-navy-700); }
}

/* ─── Popovers (apps, companies, account) ──────────────────────────────── */

.shell-pop { position: relative; }
.shell-pop > summary { list-style: none; }
.shell-pop > summary::marker { content: ""; }

.shell-pop-panel {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    z-index: 60;
    min-width: 272px;
    max-width: 340px;
    padding: 8px;
    background: var(--glass-pop);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    color: var(--ink);
    animation: pop-in 0.16s var(--ease);
}

.shell-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 10px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-strong);
}
.shell-pop-count { padding: 1px 8px; border-radius: 999px; background: var(--panel-hover); color: var(--muted); font-family: var(--font-text); letter-spacing: 0; }
.shell-pop-foot { margin-top: 6px; padding: 10px 10px 6px; border-top: 1px solid var(--hairline); font-size: 12px; }
.shell-pop-foot a { color: var(--brand) !important; font-weight: 500; }

/* Apps: opens beside the rail, aligned with its top — the rail, not the
   entry, is the anchor, so the panel never runs off the bottom. */
.shell-pop--apps { position: static; }
.shell-apps-panel {
    top: 0;
    left: calc(100% + 12px);
    right: auto;
    width: min(620px, calc(100vw - 160px));
    max-width: none;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 14px 16px 18px;
}
.shell-apps-panel .apps-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); margin-top: 2px; gap: 10px; }
.shell-apps-panel .app-tile { padding: 14px 10px 12px; gap: 10px; border-radius: 16px; box-shadow: none; background: var(--glass-fill-inset); border-color: var(--hairline); }
.shell-apps-panel .app-tile-icon { width: 44px; height: 44px; border-radius: 12px; }
.shell-apps-panel .app-tile-icon .app-svg { width: 22px; height: 22px; }
.shell-apps-panel .app-tile-title { font-size: 12.5px; font-weight: 500; }

.shell-company-list { display: flex; flex-direction: column; gap: 2px; max-height: min(56vh, 384px); overflow-y: auto; overscroll-behavior: contain; }
.company-option { border-radius: 12px; }
.company-option:hover:not(:disabled), .company-option:focus-visible { background: var(--panel-hover); }
.company-option.active { background: var(--brand-soft); }
.company-avatar { border-radius: 10px; background: var(--panel-hover); color: var(--ink-soft); }
.company-option.active .company-avatar { background: var(--solid); color: var(--solid-ink); }
.company-option-check { color: var(--brand-strong); }
/* A company with a logo keeps its white tile when it is the active one (app.css: .company-avatar.has-logo). */
.company-option.active .company-avatar.has-logo { background: #fff; box-shadow: 0 0 0 2px var(--brand-strong); }

.shell-user-panel { min-width: 248px; }
.shell-user-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--hairline); }
.shell-user-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.shell-user-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-user-company { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-menu-item {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    color: var(--ink) !important;
    cursor: pointer;
}
.shell-menu-item:hover { background: var(--panel-hover); text-decoration: none; }
.shell-menu-item--out { color: var(--danger-strong) !important; }
.shell-menu-sep { display: block; height: 1px; margin: 4px 10px; background: var(--hairline); }
/* Language row of the account menu: "Language   Български · English", the current one set in bold. */
.shell-menu-lang { display: flex; align-items: center; gap: 8px; cursor: default; }
.shell-menu-lang:hover { background: transparent; }
.shell-menu-lang-label { flex: 1 1 auto; color: var(--muted); font-weight: 500; }
.shell-menu-lang-option { color: var(--ink) !important; padding: 2px 6px; border-radius: 8px; }
a.shell-menu-lang-option:hover { background: var(--panel-hover); text-decoration: none; }
.shell-menu-lang-option.is-active { font-weight: 700; color: var(--brand-strong) !important; }
.shell-user-panel .logout-form { display: block; }
/* app.css shows the sun/moon pair by theme; here they are words, not glyphs. */
.shell-menu-item.theme-toggle .icon-sun, .shell-menu-item.theme-toggle .icon-moon { display: none; }
.shell-menu-item.theme-toggle .icon-moon { display: inline; }
:root[data-theme="dark"] .shell-menu-item.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .shell-menu-item.theme-toggle .icon-sun { display: inline; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-menu-item.theme-toggle .icon-moon { display: none; }
    :root:not([data-theme="light"]) .shell-menu-item.theme-toggle .icon-sun { display: inline; }
}

/* ─── Tab bar (phone) ──────────────────────────────────────────────────── */

.shell-tabbar { display: none; }

/* ─── Tablet: tighter bar ──────────────────────────────────────────────── */

@media (max-width: 1180px) {
    .shell-searchbar { flex-basis: 200px; }
    .shell-company-name { max-width: 140px; }
}
@media (max-width: 980px) {
    /* With an app menu in the bar the search collapses to its glyph. */
    .shell-topbar:has(.shell-subnav-app) .shell-searchbar { flex: none; }
    .shell-topbar:has(.shell-subnav-app) .shell-search { flex: none; width: auto; padding: 11px; }
    /* The pill a glyph: the sparkle beside it, a round button of the bar. */
    .shell-topbar:has(.shell-subnav-app) .shell-search-mayla {
        position: static; width: 30px; height: 30px; border: 0; border-radius: 999px;
        background: var(--panel-hover); transform: none;
    }
    .shell-topbar:has(.shell-subnav-app) .shell-search-hint,
    .shell-topbar:has(.shell-subnav-app) .shell-search kbd { display: none; }
}

/* ─── Phone ────────────────────────────────────────────────────────────── */

@media (max-width: 767.98px) {
    .shell-rail { display: none; }

    main.shell-main { margin: 0 16px; padding: 14px 0 calc(140px + var(--safe-bottom)); }

    /* The bar dissolves: company switcher left, search · bell · avatar right,
       the app menu on a row of its own. No glass — the page header is the bar. */
    .shell-topbar {
        position: static;
        height: auto;
        margin: 0;
        padding: calc(var(--safe-top) + 10px) 16px 0;
        flex-wrap: wrap;
        gap: 8px;
        border: 0;
        border-radius: 0;
        background: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: none;
    }
    .shell-searchbar { display: none; }
    .shell-iconbtn.shell-search-icon, .shell-iconbtn.shell-mayla-icon { display: inline-flex; }
    .shell-actions { display: contents; }
    .shell-company { order: 1; margin-right: auto; min-width: 0; }
    .shell-search-icon, .shell-mayla-icon { order: 2; }
    /* No room on a phone: the account menu has the language row. */
    .shell-lang { display: none; }
    .shell-bell { order: 3; }
    .shell-user { order: 4; }
    .shell-subnav { order: 5; flex: 1 1 100%; }
    .shell-subnav.is-empty { display: none; }

    /* The switcher as the design draws it on a phone: words and a chevron. */
    .shell-company .shell-pill { height: 32px; padding: 0; border: 0; background: none; color: var(--brand-strong) !important; }
    .shell-company .shell-live { display: none; }
    .shell-company .shell-caret { color: var(--brand-strong); }
    .shell-company-name { max-width: 46vw; }
    .shell-iconbtn { background: rgba(255, 255, 255, 0.7); }
    .shell-company-panel { left: 0; right: auto; }
    .shell-pop-panel { max-width: calc(100vw - 32px); }

    .shell-subnav-app { display: none; }
    .shell-subnav { position: relative; }
    .shell-menubar { padding: 4px 0; gap: 6px; }
    .shell-subnav-link { background: var(--glass-fill-control); border: 1px solid var(--glass-border); padding: 7px 12px; }
    .shell-menu-head { padding-right: 10px; }
    /* A drop-down spans the row: a sheet under the pills, its headings stacked. */
    .shell-menu { position: static; }
    .shell-pop-panel.shell-menu-panel, .shell-pop-panel.shell-menu-panel.is-flipped { left: 0; right: 0; top: 100%; min-width: 0; max-width: none; }
    .shell-pop-panel.shell-menu-panel.has-sections { width: auto; }
    .shell-menu-columns { flex-direction: column; gap: 0; }
    .shell-menu-columns > .shell-menu-section { flex: none; max-width: none; }
    .shell-menu-columns > .shell-menu-section + .shell-menu-section { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--hairline); }

    .shell-tabbar {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: calc(16px + var(--safe-bottom));
        z-index: 55;
        height: 72px;
        padding: 8px 22px;
        border-radius: 36px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(255, 255, 255, 0.62);
        -webkit-backdrop-filter: blur(40px);
        backdrop-filter: blur(40px);
        box-shadow: 0 12px 32px rgba(16, 27, 65, 0.14), inset 0 1px 0 #FFFFFF;
    }

    .shell-tab {
        min-width: 52px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 10px;
        font-weight: 500;
        line-height: 1.2;
        color: var(--muted) !important;
        -webkit-tap-highlight-color: transparent;
    }
    .shell-tab:hover { text-decoration: none; }
    .shell-tab img { width: 26px; height: 26px; display: block; opacity: 0.5; }
    .shell-tab.is-active { color: var(--brand-strong) !important; font-weight: 600; }
    .shell-tab.is-active img { opacity: 1; }

    /* Capture: 56px teal disc, white inner rim, teal glow. */
    .shell-fab {
        width: 56px;
        height: 56px;
        flex: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--dnt-teal-500);
        box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9), inset 0 2px 2px rgba(255, 255, 255, 0.3), 0 8px 20px rgba(0, 87, 210, 0.40);
        color: #FFFFFF !important;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.14s ease;
    }
    .shell-fab:active { transform: scale(0.95); }
    .shell-fab svg { width: 26px; height: 26px; display: block; }

    /* Toasts clear the floating bar. */
    .toast-host { bottom: calc(104px + var(--safe-bottom)); right: 16px; left: 16px; max-width: none; }
    .setup-balloon { bottom: calc(104px + var(--safe-bottom)); right: 16px; left: 16px; width: auto; }

    /* Sticky table headers have no fixed bar to clear on a phone. */
    :root { --topbar-h: 0px; }
}

@media (max-width: 767.98px) {
    :root[data-theme="dark"] .shell-tabbar { background: rgba(18, 28, 63, 0.78); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.10); }
    :root[data-theme="dark"] .shell-iconbtn { background: var(--glass-fill-control); }
}
@media (max-width: 767.98px) and (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-tabbar { background: rgba(18, 28, 63, 0.78); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.10); }
    :root:not([data-theme="light"]) .shell-iconbtn { background: var(--glass-fill-control); }
}

/* ─── Framed (html[data-framed], set by App.razor when the page runs inside a frame: the "Go to
   definition" popup of js/onix-definition.js, the app's page viewer) — the record alone: no rail,
   no top bar, no tab bar, no Mayla launcher, the content from the frame's edges. */
html[data-framed] .shell-rail, html[data-framed] .shell-topbar, html[data-framed] .shell-tabbar, html[data-framed] .mayla { display: none !important; }
html[data-framed] { --topbar-h: 8px; --shell-content-x: var(--shell-gap); }
html[data-framed] main.shell-main { margin: 0 var(--shell-gap); padding: var(--shell-gap) 0 16px; }

/* ─── Embedded (OP-032: a page opened with ?layout=embedded — MainLayout.razor's .shell--embedded, and html[data-layout="embedded"],
   which App.razor keeps for the pages that follow in the frame) — the page alone for another system's frame: no rail, no top bar,
   no tab bar (still rendered: the top bar carries the pages Mayla's agent reads); Mayla's launcher and panel stay. */
html[data-layout="embedded"] .shell-rail, html[data-layout="embedded"] .shell-topbar, html[data-layout="embedded"] .shell-tabbar,
.shell--embedded .shell-rail, .shell--embedded .shell-topbar, .shell--embedded .shell-tabbar { display: none !important; }
html[data-layout="embedded"] { --topbar-h: 8px; --shell-content-x: var(--shell-gap); }
html[data-layout="embedded"] main.shell-main, .shell--embedded main.shell-main { margin: 0 var(--shell-gap); padding: var(--shell-gap) 0 16px; }

@media print {
    .shell-rail, .shell-topbar, .shell-tabbar { display: none !important; }
    main.shell-main { margin: 0; padding: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Colour — a hue per destination, the app's colour in the bar.
   Tokens: onix-theme.css (--nav-*, --app-color / --app-ink).
   ═══════════════════════════════════════════════════════════════════════════ */

/* The rail: a faint teal → violet wash over the glass, so it is not a grey slab. */
.shell-rail {
    background:
        linear-gradient(180deg, rgba(0, 87, 210, 0.07), rgba(66, 165, 245, 0.06) 60%, rgba(245, 124, 0, 0.04)),
        var(--glass-fill-chrome);
}
.shell-topbar { background: linear-gradient(90deg, rgba(0, 87, 210, 0.05), rgba(255, 255, 255, 0) 40%), var(--glass-fill-chrome); }

/* Each entry knows its colour (data-nav = ShellNavItem.Key). */
.shell-nav, .shell-tab { --nav-color: var(--brand); }
.shell-nav[data-nav="home"],      .shell-tab[data-nav="home"]      { --nav-color: var(--nav-home); }
.shell-nav[data-nav="documents"], .shell-tab[data-nav="documents"] { --nav-color: var(--nav-documents); }
.shell-nav[data-nav="banking"],   .shell-tab[data-nav="banking"]   { --nav-color: var(--nav-banking); }
.shell-nav[data-nav="invoices"],  .shell-tab[data-nav="invoices"]  { --nav-color: var(--nav-invoices); }
.shell-nav[data-nav="reports"],   .shell-tab[data-nav="reports"]   { --nav-color: var(--nav-reports); }
.shell-nav[data-nav="guides"],    .shell-tab[data-nav="guides"]    { --nav-color: var(--nav-guides); }
.shell-nav[data-nav="apps"],      .shell-tab[data-nav="apps"]      { --nav-color: var(--nav-apps); }
.shell-nav[data-nav="settings"],  .shell-tab[data-nav="settings"]  { --nav-color: var(--nav-settings); }

.shell-nav { position: relative; }
.shell-nav:hover { color: var(--nav-color); background: color-mix(in srgb, var(--nav-color) 9%, transparent); }
.shell-nav:hover img { opacity: 1; }
.shell-nav.is-active,
.shell-pop[open] > .shell-nav {
    color: var(--nav-color);
    background: color-mix(in srgb, var(--nav-color) 12%, #FFFFFF);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--nav-color) 22%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--nav-color) 16%, transparent);
}
/* The current place: a coloured bar in the rail's gutter, the icon lifted on a glow of its hue. */
.shell-nav.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    width: 4px;
    height: 26px;
    border-radius: 4px;
    background: var(--nav-color);
    transform: translateY(-50%);
    box-shadow: 0 0 10px color-mix(in srgb, var(--nav-color) 60%, transparent);
}
.shell-nav.is-active img,
.shell-pop[open] > .shell-nav img { filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--nav-color) 38%, transparent)); }
.shell-nav--glyph svg { color: var(--nav-color); opacity: 0.75; }
.shell-nav--glyph:hover svg, .shell-nav--glyph.is-active svg { opacity: 1; }

:root[data-theme="dark"] .shell-nav.is-active,
:root[data-theme="dark"] .shell-pop[open] > .shell-nav { background: color-mix(in srgb, var(--nav-color) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-color) 30%, transparent); }
:root[data-theme="dark"] .shell-rail { background: linear-gradient(180deg, rgba(100, 181, 246, 0.12), rgba(66, 165, 245, 0.08) 60%, rgba(255, 183, 77, 0.06)), var(--glass-fill-chrome); }
:root[data-theme="dark"] .shell-topbar { background: linear-gradient(90deg, rgba(100, 181, 246, 0.08), rgba(255, 255, 255, 0) 40%), var(--glass-fill-chrome); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-nav.is-active,
    :root:not([data-theme="light"]) .shell-pop[open] > .shell-nav { background: color-mix(in srgb, var(--nav-color) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-color) 30%, transparent); }
    :root:not([data-theme="light"]) .shell-rail { background: linear-gradient(180deg, rgba(100, 181, 246, 0.12), rgba(66, 165, 245, 0.08) 60%, rgba(255, 183, 77, 0.06)), var(--glass-fill-chrome); }
    :root:not([data-theme="light"]) .shell-topbar { background: linear-gradient(90deg, rgba(100, 181, 246, 0.08), rgba(255, 255, 255, 0) 40%), var(--glass-fill-chrome); }
}

/* ─── Top bar: the app's colour on its name and its menu ───────────────── */

.shell-subnav { --app-color: var(--brand); }
.shell-subnav-app {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--app-ink) !important;
}
/* The app's swatch before its name — the same square the palette and the tiles use. */
.shell-subnav-app::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--app-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-color) 18%, transparent);
    flex: none;
}
.shell-subnav-app:hover { color: var(--app-color) !important; }
.shell-subnav-link:hover { color: var(--app-ink) !important; background: color-mix(in srgb, var(--app-color) 9%, transparent); }
.shell-subnav-link.active,
.shell-menu[open] > .shell-menu-head.active {
    color: var(--app-ink) !important;
    background: color-mix(in srgb, var(--app-color) 12%, #FFFFFF);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--app-color) 22%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--app-color) 16%, transparent);
}
.shell-menu[open] > .shell-menu-head { background: color-mix(in srgb, var(--app-color) 9%, transparent); color: var(--app-ink) !important; }
.shell-pop-panel.shell-menu-panel { border-top: 3px solid var(--app-color); }
.shell-menu-section-title { color: var(--app-ink); }
.shell-menu-group-title { color: var(--app-ink); }
.shell-menu-panel .shell-menu-item:hover { background: color-mix(in srgb, var(--app-color) 9%, transparent); }
.shell-menu-item.is-active { background: color-mix(in srgb, var(--app-color) 13%, transparent); color: var(--app-ink) !important; }
.shell-menu-item.is-active:hover { background: color-mix(in srgb, var(--app-color) 20%, transparent); }

:root[data-theme="dark"] .shell-subnav-link.active,
:root[data-theme="dark"] .shell-menu[open] > .shell-menu-head.active { background: color-mix(in srgb, var(--app-color) 26%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-color) 34%, transparent); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-subnav-link.active,
    :root:not([data-theme="light"]) .shell-menu[open] > .shell-menu-head.active { background: color-mix(in srgb, var(--app-color) 26%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-color) 34%, transparent); }
}

/* The actions: the language switch in the brand tint, the bell amber while
   something waits, the avatar a teal → navy disc. */
.shell-lang { background: var(--brand-soft); color: var(--brand-strong) !important; border-color: transparent; }
.shell-lang:hover { background: var(--brand-soft-2); }
.shell-bell:has(.shell-badge) { color: var(--hue-amber) !important; background: var(--hue-amber-soft); border-color: transparent; }
.shell-avatar { background: linear-gradient(135deg, #1E88E5, #0057D2); }
.shell-pop-head { color: var(--brand-strong); }
.company-option.active .company-avatar { background: linear-gradient(135deg, #1E88E5, #0057D2); color: #FFFFFF; }
:root[data-theme="dark"] .shell-avatar { background: linear-gradient(135deg, #42A5F5, #1565C0); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shell-avatar { background: linear-gradient(135deg, #42A5F5, #1565C0); } }

/* ─── Phone tab bar: the same hues ─────────────────────────────────────── */
@media (max-width: 767.98px) {
    .shell-tab.is-active { color: var(--nav-color) !important; }
    .shell-tab.is-active img { filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--nav-color) 38%, transparent)); }
    .shell-tab.is-active::after { content: ""; width: 16px; height: 3px; border-radius: 3px; background: var(--nav-color); margin-top: 1px; }
    .shell-subnav-link.active { color: var(--app-ink) !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   The rail away — <html data-rail="hidden">, the top bar's first button.
   Markup: Layout/TopBar.razor (.shell-railtoggle, .shell-barmark) · the click
   and the cookie: js/onix-shell.js · the server's render: Services/RailChoice.cs.

   The rail slides out past the left edge while the bar and the page take its
   room: the three travel the same distance on one curve for one duration, so
   they read as one piece and the gap between the rail and the bar holds all
   the way. The state arrives rendered, so a page never slides on a navigation —
   only the click moves anything.
   ═══════════════════════════════════════════════════════════════════════════ */

:root { --rail-motion: 0.38s cubic-bezier(0.32, 0.72, 0, 1); }
:root[data-rail="hidden"] { --shell-content-x: var(--shell-gap); }

.shell-rail { transition: transform var(--rail-motion), opacity 0.24s ease, visibility 0s; }
:root[data-rail="hidden"] .shell-rail {
    transform: translateX(calc(-100% - var(--shell-gap) - 8px)) scale(0.97);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Seen moving first, then gone; out of the tab order once it has left. */
    transition: transform var(--rail-motion), opacity 0.22s ease 0.12s, visibility 0s 0.38s;
}
.shell-topbar { transition: left var(--rail-motion); }
main.shell-main { transition: margin-left var(--rail-motion); }

/* The toggle: the brand tint of the language switch at the other end of the bar. */
.shell-railtoggle {
    background: var(--brand-soft);
    color: var(--brand-strong) !important;
    border-color: transparent;
    transition: background 0.16s ease, transform 0.12s ease;
}
.shell-railtoggle:hover { background: var(--brand-soft-2); }
.shell-railtoggle:active { transform: scale(0.94); }
.shell-railtoggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* The glyph: three strokes 16 × 2, five apart — the menu's lines, the same
   burger whether the rail is in view or away. */
.shell-railtoggle-glyph { position: relative; display: block; width: 16px; height: 12px; }
.shell-railtoggle-glyph i {
    position: absolute;
    left: 0;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}
.shell-railtoggle-glyph i:nth-child(1) { top: 0; }
.shell-railtoggle-glyph i:nth-child(2) { top: 5px; }
.shell-railtoggle-glyph i:nth-child(3) { top: 10px; }

/* The mark in the bar (28, the rail's is 40): it steps in as the rail leaves —
   a beat after the rail has started moving — and steps out first when the rail
   comes back. Folded to no width, it also gives back the bar's gap. */
.shell-barmark {
    flex: none;
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    transition: width var(--rail-motion), margin-left var(--rail-motion), opacity 0.2s ease 0.14s, transform var(--rail-motion) 0.06s, visibility 0s;
}
.shell-barmark img { display: block; width: 28px; height: 28px; }
.shell-barmark:hover { transform: scale(1.06); }
.shell-barmark:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
:root:not([data-rail="hidden"]) .shell-barmark {
    width: 0;
    margin-left: -8px;
    opacity: 0;
    transform: translateX(-10px) scale(0.7);
    visibility: hidden;
    pointer-events: none;
    transition: width var(--rail-motion), margin-left var(--rail-motion), opacity 0.14s ease, transform var(--rail-motion), visibility 0s 0.38s;
}

/* A phone has no rail to put away: neither the toggle nor the bar's mark — after
   their own rules, which would otherwise win the tie. */
@media (max-width: 767.98px) {
    .shell-railtoggle, .shell-barmark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .shell-rail, .shell-topbar, main.shell-main, .shell-barmark,
    .shell-railtoggle { transition-duration: 0.01s; transition-delay: 0s; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   The rail arranged — the person's own entries (Services/RailLayout.cs) and
   the edit mode js/onix-rail.js runs on the static rail (SideRail.razor).
   ═══════════════════════════════════════════════════════════════════════════ */

/* An app, a page of it or a shortcut: the app's stroke glyph in a tile of its colour (the glass icons stay the places'). */
.shell-nav-glyph {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex: none;
    background: color-mix(in srgb, var(--nav-color) 12%, transparent);
    color: var(--nav-color);
    opacity: 0.78;
    transition: opacity 0.16s ease, box-shadow 0.16s ease;
}
.shell-nav-glyph svg { width: 17px; height: 17px; margin: 0; }
.shell-nav:hover .shell-nav-glyph, .shell-nav.is-active .shell-nav-glyph, .shell-tab.is-active .shell-nav-glyph { opacity: 1; }
.shell-nav.is-active .shell-nav-glyph { box-shadow: 0 4px 8px color-mix(in srgb, var(--nav-color) 30%, transparent); }
.shell-tab .shell-nav-glyph { width: 26px; height: 26px; }

/* Out of the edit mode nothing of it shows. */
.shell-nav-remove, .shell-rail-picker, .shell-rail-editbar { display: none; }

/* In it: the entries are handles, × takes one off, "+ Add" stands after them, the bar beside the rail says the way out. */
.shell-rail.is-editing .shell-rail-picker { display: block; position: static; }
.shell-rail.is-editing .shell-rail-editbar { display: flex; }
/* The picker opens where the bar stands: one at a time. */
.shell-rail.is-editing:has(.shell-rail-picker[open]) .shell-rail-editbar { display: none; }
.shell-rail.is-editing .shell-nav[data-kind] {
    cursor: grab;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-color) 40%, transparent);
}
.shell-rail.is-editing .shell-nav[data-kind]:active { cursor: grabbing; }
.shell-rail.is-editing .shell-nav[data-kind].is-dragging { opacity: 0.35; }
.shell-rail.is-editing .shell-nav[data-kind].is-drop-before::after,
.shell-rail.is-editing .shell-nav[data-kind].is-drop-after::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    height: 3px;
    border-radius: 3px;
    background: var(--brand);
    box-shadow: 0 0 8px color-mix(in srgb, var(--brand) 60%, transparent);
}
.shell-rail.is-editing .shell-nav[data-kind].is-drop-before::after { top: -4px; }
.shell-rail.is-editing .shell-nav[data-kind].is-drop-after::after { bottom: -4px; }
.shell-rail.is-editing .shell-nav-remove {
    display: grid;
    place-items: center;
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--danger);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.shell-rail.is-editing .shell-nav-remove:hover { transform: scale(1.1); }
.shell-rail-add svg { width: 22px; height: 22px; margin: 3px 0; color: var(--brand); }
.shell-rail-add { --nav-color: var(--brand); }
.shell-rail-add span { color: var(--brand); }

/* The picker: beside the rail like the apps panel, the page open now first, then the places, the apps, the pages. */
.shell-pop-panel.shell-rail-picker-panel { width: min(600px, calc(100vw - 160px)); padding: 12px 12px 14px; }
.shell-rail-picker-search {
    width: 100%;
    margin: 0 0 6px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--hairline);
    background: var(--glass-fill-inset);
    font: inherit;
    font-size: 13px;
    color: var(--ink);
}
.shell-rail-picker-search:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 0; }
.shell-rail-picker-list { max-height: calc(100vh - 190px); overflow-y: auto; overscroll-behavior: contain; }
.shell-rail-picker-section { margin-top: 8px; }
.shell-rail-picker-title {
    padding: 6px 8px 4px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.shell-rail-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px; }
.shell-rail-pick {
    --nav-color: var(--brand);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.shell-rail-pick:hover:not(:disabled), .shell-rail-pick:focus-visible { background: var(--panel-hover); }
.shell-rail-pick:disabled { opacity: 0.45; cursor: default; }
.shell-rail-pick-icon {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--nav-color) 12%, transparent);
    color: var(--nav-color);
}
.shell-rail-pick-icon img { width: 22px; height: 22px; display: block; }
.shell-rail-pick-icon svg { width: 16px; height: 16px; display: block; }
.shell-rail-pick-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.shell-rail-pick-label { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-rail-pick-app { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-rail-thispage { display: flex; align-items: center; gap: 8px; padding: 2px 8px 4px; }
.shell-rail-thispage input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--hairline);
    background: var(--glass-fill-inset);
    font: inherit;
    font-size: 13px;
    color: var(--ink);
}
.shell-rail-thispage .button { padding: 8px 12px; font-size: 12.5px; white-space: nowrap; }
.shell-rail-thispage-address { padding: 0 8px 4px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-rail-picker-empty { padding: 12px 8px; font-size: 12.5px; color: var(--muted); }

/* The edit bar: a floating panel at the rail's foot, beside it. */
.shell-rail-editbar {
    position: absolute;
    left: calc(100% + 12px);
    bottom: 0;
    z-index: 60;
    width: 272px;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 20px;
    background: var(--glass-pop);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    color: var(--ink);
    animation: pop-in 0.16s var(--ease);
}
.shell-rail-editbar-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; }
.shell-rail-editbar-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.shell-rail-editbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.shell-rail-editbar-actions .button { padding: 7px 12px; font-size: 12.5px; }

/* ═══ Flat ═══════════════════════════════════════════════════════════════════
   The chrome as App Store Connect draws it: a white bar and rail with a
   hairline, the current place a grey pill with the ink (the sidebar's "iOS"),
   the current page of the app in the blue, one blue for every destination,
   no washes, bars, glows or swatches. */
.shell-rail, .shell-topbar, .shell-tabbar,
:root[data-theme="dark"] .shell-rail, :root[data-theme="dark"] .shell-topbar { background: var(--glass-fill-chrome); box-shadow: var(--glass-shadow); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-rail, :root:not([data-theme="light"]) .shell-topbar { background: var(--glass-fill-chrome); box-shadow: var(--glass-shadow); }
}
.shell-nav, .shell-tab,
.shell-nav[data-nav], .shell-tab[data-nav] { --nav-color: var(--brand); }
.shell-nav:hover { color: var(--ink); background: var(--panel-hover); }
.shell-nav.is-active, .shell-pop[open] > .shell-nav,
:root[data-theme="dark"] .shell-nav.is-active, :root[data-theme="dark"] .shell-pop[open] > .shell-nav {
    color: var(--ink);
    background: var(--panel-hover);
    box-shadow: none;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-nav.is-active, :root:not([data-theme="light"]) .shell-pop[open] > .shell-nav { color: var(--ink); background: var(--panel-hover); box-shadow: none; }
}
.shell-nav.is-active::before { display: none; }
.shell-nav.is-active img, .shell-pop[open] > .shell-nav img, .shell-tab.is-active img { filter: none; }
.shell-nav--glyph svg { color: var(--ink-soft); }
.shell-nav--glyph.is-active svg { color: var(--ink); }

.shell-subnav-app::before { display: none; }
.shell-subnav-app { color: var(--ink) !important; }
.shell-subnav-app:hover { color: var(--brand) !important; }
.shell-subnav-link:hover { color: var(--ink) !important; background: var(--panel-hover); }
.shell-subnav-link.active, .shell-menu[open] > .shell-menu-head.active,
:root[data-theme="dark"] .shell-subnav-link.active, :root[data-theme="dark"] .shell-menu[open] > .shell-menu-head.active {
    color: var(--brand) !important;
    background: var(--brand-soft);
    box-shadow: none;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell-subnav-link.active, :root:not([data-theme="light"]) .shell-menu[open] > .shell-menu-head.active { color: var(--brand) !important; background: var(--brand-soft); box-shadow: none; }
}
.shell-menu[open] > .shell-menu-head { background: var(--panel-hover); color: var(--ink) !important; }
.shell-pop-panel.shell-menu-panel { border-top: 1px solid var(--glass-border); }
.shell-menu-section-title, .shell-menu-group-title, .shell-pop-head { color: var(--muted); }
.shell-menu-panel .shell-menu-item:hover { background: var(--panel-hover); }
.shell-menu-item.is-active { background: var(--brand-soft); color: var(--brand) !important; }
.shell-menu-item.is-active:hover { background: var(--brand-soft-2); }

.shell-lang { background: var(--panel); color: var(--ink) !important; border-color: var(--glass-border); }
.shell-lang:hover { background: var(--panel-hover); }
.shell-bell:has(.shell-badge) { color: var(--ink) !important; background: var(--panel); border-color: var(--glass-border); }
.shell-badge { background: var(--danger); }
.shell-avatar, :root[data-theme="dark"] .shell-avatar, .company-option.active .company-avatar { background: var(--solid); color: #FFFFFF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shell-avatar { background: var(--solid); } }
.shell-pop-panel { border-radius: 14px; }
@media (max-width: 767.98px) {
    .shell-tab.is-active { color: var(--brand) !important; }
    .shell-tab.is-active::after { background: var(--brand); }
}

/* ATP-002: "The company changed — reload" (Layout/CompanyChangedNotice.razor, shown by app.js): over the whole page, so
   nothing more is done in the company of before. Above the reconnect overlay, which a switch makes moot. */
.company-changed {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: color-mix(in srgb, var(--ink) 45%, transparent);
}
.company-changed[hidden] { display: none; }
.company-changed-card {
    width: 100%;
    max-width: 380px;
    padding: 24px 20px;
    text-align: center;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.company-changed-title { margin: 0 0 8px; font-weight: 600; font-size: 16px; }
.company-changed-text { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.45; }
