/* App shell: livery top bar, sidebar navigation, main work area. Tokens live in brand.css. */
:root { --nw-bar-h: 56px; --nw-side-w: 252px; }

body.nw-app { min-height: 100vh; background: var(--nw-surface); }

/* ---- Top bar: slate body, yellow stripe ----------------------------- */
.nw-bar {
    position: fixed; inset: 0 0 auto 0; z-index: 1030;
    height: calc(var(--nw-bar-h) + var(--nw-stripe));
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1rem var(--nw-stripe);
    background: var(--nw-slate);
    border-bottom: var(--nw-stripe) solid var(--nw-yellow);
    color: #fff;
}
.nw-bar-brand { display: inline-flex; align-items: center; padding: .25rem 0; border-radius: var(--nw-radius-sm); }
.nw-bar-brand img { height: 30px; width: auto; display: block; }
.nw-bar-brand:focus-visible { outline-color: var(--nw-yellow); }
.nw-bar-app { color: #DCE1E5; font-size: .82rem; font-weight: 600; letter-spacing: .02em; padding-left: .85rem; margin-left: .15rem; border-left: 1px solid rgba(255, 255, 255, .22); line-height: 1.2; }
.nw-bar-spacer { flex: 1; }
.nw-bar-user { display: flex; align-items: center; gap: .9rem; font-size: .875rem; color: #E9ECEF; }
.nw-bar-user .nw-user-name { font-weight: 600; }
.nw-bar-link { color: #E9ECEF; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem; border-radius: var(--nw-radius-sm); }
.nw-bar-link:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.nw-bar-link:focus-visible { outline-color: var(--nw-yellow); }
.nw-menu-btn { display: none; color: #fff; background: transparent; border: 1px solid rgba(255, 255, 255, .3); border-radius: var(--nw-radius-sm); width: 40px; height: 40px; align-items: center; justify-content: center; font-size: 1.35rem; }
.nw-menu-btn:hover { background: rgba(255, 255, 255, .1); }
.nw-menu-btn:focus-visible { outline-color: var(--nw-yellow); }

/* ---- Sidebar ------------------------------------------------------- */
.nw-side {
    position: fixed; top: calc(var(--nw-bar-h) + var(--nw-stripe)); bottom: 0; left: 0; z-index: 1020;
    width: var(--nw-side-w);
    background: var(--nw-ground);
    border-right: 1px solid var(--nw-rule);
    overflow-y: auto;
}
.nw-side .offcanvas-body { display: block; padding: 1rem .75rem 2rem; }
.nw-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nw-nav-item, .nw-nav-toggle {
    display: flex; align-items: center; gap: .7rem; width: 100%;
    padding: .5rem .75rem; border: 0; border-radius: var(--nw-radius-sm);
    background: transparent; color: var(--nw-slate-800);
    font-size: .9rem; font-weight: 600; text-align: left; text-decoration: none;
}
.nw-nav-item .bi, .nw-nav-toggle .bi { font-size: 1rem; color: var(--nw-slate-500); width: 1.1rem; text-align: center; flex: none; }
.nw-nav-item:hover, .nw-nav-toggle:hover { background: var(--nw-slate-100); color: var(--nw-ink); }
.nw-nav-toggle .nw-chev { margin-left: auto; font-size: .75rem; color: var(--nw-slate-400); transition: transform .18s cubic-bezier(.2, .7, .2, 1); }
.nw-nav-toggle[aria-expanded="true"] .nw-chev { transform: rotate(90deg); }
.nw-nav-toggle[aria-expanded="true"] { color: var(--nw-ink); }
.nw-sub { list-style: none; margin: 2px 0 6px; padding: 0; }
.nw-sub a {
    display: block; padding: .38rem .75rem .38rem 2.55rem; border-radius: var(--nw-radius-sm);
    color: var(--nw-slate-600); font-size: .875rem; text-decoration: none;
}
.nw-sub a:hover { background: var(--nw-slate-100); color: var(--nw-ink); }
/* Active page: white plate with a straight livery stripe on its left edge */
.nw-nav a.is-active {
    border-radius: 0 var(--nw-radius-sm) var(--nw-radius-sm) 0;
    background: var(--nw-surface); color: var(--nw-ink); font-weight: 600;
    box-shadow: inset 3px 0 0 var(--nw-yellow), 0 1px 2px rgba(28, 34, 39, .08);
}
.nw-nav a.is-active .bi { color: var(--nw-slate); }
.nw-nav-group.has-active > .nw-nav-toggle .bi:first-child { color: var(--nw-slate); }
.nw-nav-sep { height: 1px; background: var(--nw-rule); margin: .6rem .75rem; }

/* Bootstrap's .offcanvas-lg forces a transparent background at lg+; keep the slate-50 ground. */
@media (min-width: 992px) { .nw-side.offcanvas-lg { background-color: var(--nw-ground) !important; } }

/* ---- Main ---------------------------------------------------------- */
.nw-main {
    padding: calc(var(--nw-bar-h) + var(--nw-stripe) + 1.75rem) 2.5rem 3rem calc(var(--nw-side-w) + 2.5rem);
    min-width: 0;
}
body.nw-anon .nw-bar { display: none; }
body.nw-anon .nw-main { padding: 2rem 1rem; }

/* ---- Small screens: sidebar becomes a drawer ------------------------ */
@media (max-width: 991.98px) {
    .nw-menu-btn { display: inline-flex; }
    .nw-bar-app, .nw-bar-user .nw-user-name { display: none; }
    .nw-side.offcanvas-lg { top: 0; width: min(86vw, 320px); border-right: 0; z-index: 1045; }
    .nw-side .offcanvas-header { background: var(--nw-slate); border-bottom: var(--nw-stripe) solid var(--nw-yellow); color: #fff; min-height: calc(var(--nw-bar-h) + var(--nw-stripe)); }
    .nw-side .offcanvas-header img { height: 26px; }
    .nw-side .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .85; }
    .nw-main { padding: calc(var(--nw-bar-h) + var(--nw-stripe) + 1.25rem) 1rem 2.5rem; }
}

/* ---- Sign-in -------------------------------------------------------- */
.nw-signin { min-height: calc(100vh - 4rem); display: grid; place-items: center; }
.nw-signin-card { width: min(100%, 400px); background: var(--nw-surface); border: 1px solid var(--nw-rule); border-radius: var(--nw-radius); box-shadow: var(--nw-shadow); overflow: hidden; }
.nw-signin-head { background: var(--nw-slate); border-bottom: var(--nw-stripe) solid var(--nw-yellow); padding: 1.5rem 1.75rem 1.25rem; }
.nw-signin-head img { height: 34px; display: block; }
.nw-signin-body { padding: 1.5rem 1.75rem 1.75rem; }
.nw-signin-body h1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 .25rem; }
.nw-signin-body p.nw-muted { color: var(--nw-muted); font-size: .9rem; margin: 0 0 1.25rem; }
.nw-signin-body .btn { width: 100%; padding: .6rem 1rem; }
body.nw-anon { background: var(--nw-ground); }

@media (prefers-reduced-motion: reduce) {
    .nw-nav-toggle .nw-chev { transition: none; }
}
