/* ============================================================================
   Shell - grouped sidebar, collapse, user box, page header.

   THE PALETTE DOES NOT CHANGE HERE. This file is structure only: the navy, the
   amber active rule and the card styling are exactly as signed off in the
   mockups. What moved is the navigation shape, so it can carry the Step 8 and
   Stage B screens without becoming an unscannable list.

   Loaded after theme.css so it can adjust the base shell rules.
   ========================================================================== */

:root { --sidebar-w-collapsed: 72px; }

/* ------------------------------------------------------------- sidebar --- */

.app-sidebar {
    display: flex;
    flex-direction: column;
    overflow: visible;          /* the user menu escapes the rail */
    transition: width .16s ease;
}

.app-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 22px 16px 18px 22px;
}

.app-brand__link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #FFFFFF;
    min-width: 0;
}

.app-brand__collapse {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, .06);
    color: var(--sidebar-label);
    cursor: pointer;
    padding: 0;
}

.app-brand__collapse svg { width: 17px; height: 17px; }
.app-brand__collapse:hover { background: rgba(255, 255, 255, .13); color: #FFFFFF; }

/* Scroll the nav, not the brand or the user box. */
.app-nav-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 10px;
}

.app-nav-scroll::-webkit-scrollbar { width: 6px; }
.app-nav-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .13); border-radius: 3px; }

.app-nav-group + .app-nav-group { margin-top: 20px; }

.app-nav-group__label {
    padding: 0 22px 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: #6E7CAB;
    white-space: nowrap;
}

/* The mockup's bullet is replaced by the icon. The amber active rule, the
   lighter navy pill and the white label are unchanged. */
.app-nav__link::before { content: none; }

.app-nav__link {
    gap: 13px;
    padding: 10px 14px 10px 22px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-right: 12px;
    white-space: nowrap;
}

.app-nav__link .nav-ico {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    opacity: .85;
}

.app-nav__link.is-active .nav-ico { opacity: 1; color: var(--amber); }
.app-nav__link.is-active::after { border-radius: 0 3px 3px 0; top: 4px; bottom: 4px; }

.app-nav__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------- user box --- */

.app-userbox {
    flex: 0 0 auto;
    border-top: 1px solid rgba(255, 255, 255, .09);
    padding: 12px;
}

.app-userbox__button {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    border: 0;
    background: none;
    border-radius: var(--radius);
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
    color: #FFFFFF;
}

.app-userbox__button:hover { background: rgba(255, 255, 255, .07); }

.app-userbox__avatar {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--amber);
    color: #22180A;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .4px;
}

.app-userbox__who { min-width: 0; flex: 1 1 auto; }

.app-userbox__name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-userbox__role {
    display: block;
    font-size: 12px;
    color: var(--sidebar-label);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-userbox__caret { width: 15px; height: 15px; flex: 0 0 15px; color: var(--sidebar-label); }

.app-userbox__menu { min-width: 226px; padding: 0; overflow: hidden; }

.app-userbox__head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    background: var(--page-bg);
}

.app-userbox__head .app-userbox__name { color: var(--ink); }
.app-userbox__head .app-userbox__role { color: var(--ink-muted); }

.app-userbox__action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 16px;
    font-size: 14px;
    color: var(--ink);
}

.app-userbox__action:hover { background: var(--page-bg); color: var(--ink-strong); }
.app-userbox__action.is-disabled { opacity: .5; pointer-events: none; }

.app-userbox__soon {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--ink-muted);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 1px 8px;
}

/* ------------------------------------------------------------ collapsed --- */

html.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .app-main    { margin-left: var(--sidebar-w-collapsed); }

html.sidebar-collapsed .app-brand { justify-content: center; padding-left: 0; padding-right: 0; }
html.sidebar-collapsed .app-brand__text,
html.sidebar-collapsed .app-nav-group__label,
html.sidebar-collapsed .app-nav__label,
html.sidebar-collapsed .app-userbox__who,
html.sidebar-collapsed .app-userbox__caret { display: none; }

html.sidebar-collapsed .app-brand__collapse { position: absolute; opacity: 0; pointer-events: none; }
html.sidebar-collapsed .app-brand__link { gap: 0; }

/* A rule keeps the groups separable once the labels are gone. */
html.sidebar-collapsed .app-nav-group + .app-nav-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .09);
}

html.sidebar-collapsed .app-nav__link {
    justify-content: center;
    padding: 11px 0;
    margin: 0 10px;
    border-radius: var(--radius);
}

html.sidebar-collapsed .app-nav__link.is-active::after { display: none; }
html.sidebar-collapsed .app-nav__link.is-active { background: var(--amber); }
html.sidebar-collapsed .app-nav__link.is-active .nav-ico { color: #22180A; }

html.sidebar-collapsed .app-userbox { padding: 10px 0; }
html.sidebar-collapsed .app-userbox__button { justify-content: center; padding: 8px 0; gap: 0; }

/* Expand control, shown only while collapsed. */
.app-sidebar__expand {
    display: none;
    margin: 4px auto 0;
    width: 34px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, .06);
    color: var(--sidebar-label);
    cursor: pointer;
}

.app-sidebar__expand svg { width: 17px; height: 17px; transform: rotate(180deg); }
.app-sidebar__expand:hover { background: rgba(255, 255, 255, .13); color: #FFFFFF; }
html.sidebar-collapsed .app-sidebar__expand { display: flex; }

/* --------------------------------------------------------- page header --- */

.app-topbar { gap: 14px; }

.topbar-search { margin-left: 0; }
.topbar-search__icon svg { width: 16px; height: 16px; display: block; }

.app-sidebar__toggle svg { width: 21px; height: 21px; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-header__text { min-width: 0; }
.page-header .app-breadcrumb { font-size: 13px; margin-bottom: 5px; display: block; }

.page-title {
    margin: 0;
    font-size: 25px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.2px;
}

.page-sub {
    margin: 5px 0 0;
    font-size: 14.5px;
    color: var(--ink-muted);
}

.page-sub:empty { display: none; }

.page-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ------------------------------------------------------------ responsive -- */

.sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(16, 20, 40, .45);
    z-index: 1029;
}

@media (max-width: 991.98px) {
    /* On a narrow screen the rail slides over the page rather than collapsing,
       so the collapse control is meaningless and is hidden. */
    html.sidebar-collapsed .app-sidebar { width: var(--sidebar-w); }
    html.sidebar-collapsed .app-main    { margin-left: 0; }
    html.sidebar-collapsed .app-brand__text,
    html.sidebar-collapsed .app-nav-group__label,
    html.sidebar-collapsed .app-nav__label,
    html.sidebar-collapsed .app-userbox__who { display: revert; }
    html.sidebar-collapsed .app-nav__link { justify-content: flex-start; padding: 10px 14px 10px 22px; }
    .app-brand__collapse, .app-sidebar__expand { display: none !important; }
}

@media (min-width: 992px) {
    .sidebar-scrim { display: none !important; }
}
