/* =============================================================================
   SIDEBAR NAV (nv-*) — classic desktop side menu for the trmc-mockup shell.
   GitLab-inspired behaviour: "Search or go to" palette, Pinned section,
   collapsible module groups, icon rail with flyouts, pinned footer.
   Rendered by assets/js/shell.js; replaces the legacy `.navbar.sidebar`.

   Three sidebar tones, each defined for BOTH themes:
     flush    — sidebar shares the page surface, hairline divider
     canvas   — header + sidebar become one darker chrome, content sits in an
                inset rounded panel (the GitLab "panels" layout)
     midnight — deep navy sidebar (stays navy in light theme too)
   Tone:   html[data-nv-tone]      Active style: html[data-nv-active="solid"]
   Labels: html[data-nv-labels="off"] hides section captions (separators stay)
   ============================================================================= */

:root {
    --nv-w: 248px;
    --nv-rail: 56px;
    --nv-top: 80px;
    --nv-row-h: 32px;
    --nv-radius: 8px;
    --nv-ease: cubic-bezier(.2, .7, .2, 1);

    /* dark · flush (default) */
    --nv-bg: #11161d;
    --nv-border: rgba(240, 246, 252, 0.07);
    --nv-text: #a3adb9;
    --nv-text-strong: #e6edf3;
    --nv-muted: #6e7681;
    --nv-caption: #6e7681;
    --nv-hover: rgba(240, 246, 252, 0.05);
    --nv-active-bg: rgba(88, 166, 255, 0.12);
    --nv-active-text: #e6edf3;
    --nv-active-shadow: none;
    --nv-marker: #58a6ff;
    --nv-guide: rgba(240, 246, 252, 0.08);
    --nv-count-bg: rgba(240, 246, 252, 0.07);
    --nv-field-bg: rgba(240, 246, 252, 0.04);
    --nv-field-border: rgba(240, 246, 252, 0.09);
    --nv-focus: rgba(88, 166, 255, 0.55);
    --nv-lab: #b89cf7;

    /* popovers (flyout, palette, appearance) follow the theme, not the tone */
    --nv-pop-bg: #1a2029;
    --nv-pop-border: rgba(240, 246, 252, 0.1);
    --nv-pop-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
    --nv-pop-hover: rgba(240, 246, 252, 0.06);
    --nv-pop-text: #c9d1d9;
    --nv-pop-strong: #e6edf3;
    --nv-pop-muted: #7d8590;

    --nv-chrome: #11161d;          /* what header/body become in canvas tone */
    --nv-panel-border: rgba(240, 246, 252, 0.08);
}

/* ---- dark · canvas ---------------------------------------------------- */
html[data-nv-tone="canvas"] {
    --nv-bg: #0b0e13;
    --nv-chrome: #0b0e13;
    --nv-border: transparent;
    --nv-hover: rgba(240, 246, 252, 0.05);
    --nv-active-bg: rgba(240, 246, 252, 0.08);
    --nv-guide: rgba(240, 246, 252, 0.07);
}

/* ---- dark · midnight -------------------------------------------------- */
html[data-nv-tone="midnight"] {
    --nv-bg: linear-gradient(180deg, #0f1a2e 0%, #0b1322 100%);
    --nv-border: rgba(88, 166, 255, 0.1);
    --nv-text: #a8b5c8;
    --nv-text-strong: #eef3fa;
    --nv-muted: #6f7f98;
    --nv-caption: #6f82a3;
    --nv-hover: rgba(148, 187, 255, 0.07);
    --nv-active-bg: rgba(88, 166, 255, 0.17);
    --nv-guide: rgba(148, 187, 255, 0.12);
    --nv-count-bg: rgba(148, 187, 255, 0.1);
    --nv-field-bg: rgba(148, 187, 255, 0.06);
    --nv-field-border: rgba(148, 187, 255, 0.13);
}

/* ---- light · flush ---------------------------------------------------- */
html[data-theme="light"] {
    --nv-bg: #ffffff;
    --nv-border: #e2e8f0;
    --nv-text: #475569;
    --nv-text-strong: #0f172a;
    --nv-muted: #94a3b8;
    --nv-caption: #94a3b8;
    --nv-hover: rgba(15, 23, 42, 0.05);
    --nv-active-bg: rgba(54, 127, 211, 0.1);
    --nv-active-text: #0f172a;
    --nv-marker: #367fd3;
    --nv-guide: #e2e8f0;
    --nv-count-bg: rgba(15, 23, 42, 0.06);
    --nv-field-bg: #f8fafc;
    --nv-field-border: #e2e8f0;
    --nv-focus: rgba(54, 127, 211, 0.55);
    --nv-lab: #7c4dde;

    --nv-pop-bg: #ffffff;
    --nv-pop-border: #e2e8f0;
    --nv-pop-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.08);
    --nv-pop-hover: rgba(15, 23, 42, 0.05);
    --nv-pop-text: #334155;
    --nv-pop-strong: #0f172a;
    --nv-pop-muted: #94a3b8;

    --nv-chrome: #f1f5f9;
    --nv-panel-border: #dfe5ec;
}

/* ---- light · canvas --------------------------------------------------- */
html[data-theme="light"][data-nv-tone="canvas"] {
    --nv-bg: #e7ecf2;
    --nv-chrome: #e7ecf2;
    --nv-border: transparent;
    --nv-hover: rgba(15, 23, 42, 0.05);
    --nv-active-bg: #ffffff;
    --nv-active-shadow: 0 1px 2px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.04);
    --nv-guide: #d3dae3;
    --nv-field-bg: rgba(255, 255, 255, 0.7);
    --nv-field-border: #d6dde6;
}

/* ---- light · midnight (navy sidebar on a light page) ------------------ */
html[data-theme="light"][data-nv-tone="midnight"] {
    --nv-bg: linear-gradient(180deg, #13223d 0%, #0e1a30 100%);
    --nv-border: transparent;
    --nv-text: #b6c2d4;
    --nv-text-strong: #ffffff;
    --nv-muted: #7d8ca6;
    --nv-caption: #7d8ca6;
    --nv-hover: rgba(255, 255, 255, 0.07);
    --nv-active-bg: rgba(88, 166, 255, 0.22);
    --nv-active-text: #ffffff;
    --nv-marker: #7cb8ff;
    --nv-guide: rgba(255, 255, 255, 0.12);
    --nv-count-bg: rgba(255, 255, 255, 0.1);
    --nv-field-bg: rgba(255, 255, 255, 0.07);
    --nv-field-border: rgba(255, 255, 255, 0.12);
    --nv-focus: rgba(124, 184, 255, 0.7);
    --nv-lab: #c7b1ff;
}

/* =============================================================================
   Layout integration with the legacy page shell
   ============================================================================= */
body.nv-on #meniuLeft { display: none !important; }

body.nv-on .page-content {
    margin-left: var(--nv-w) !important;
    transition: margin-left .2s var(--nv-ease);
}
body.nv-on .page-footer-wrapper {
    margin-left: var(--nv-w) !important;
    padding-left: 24px;
    transition: margin-left .2s var(--nv-ease);
}
body.nv-on.nv-collapsed .page-content,
body.nv-on.nv-collapsed .page-footer-wrapper { margin-left: var(--nv-rail) !important; }
body.nv-on.nv-no-anim .page-content,
body.nv-on.nv-no-anim .page-footer-wrapper,
body.nv-on.nv-no-anim .nv-side { transition: none !important; }

/* canvas tone: header + sidebar + page background become one chrome, the
   content area is an inset panel with a rounded leading corner */
html[data-nv-tone="canvas"] body.nv-on,
html[data-nv-tone="canvas"] body.nv-on .page-container,
html[data-nv-tone="canvas"] body.nv-on .page-content-wrapper {
    background-color: var(--nv-chrome) !important;
}
html[data-nv-tone="canvas"] body.nv-on .page-header.navbar.page-navbar {
    background: var(--nv-chrome) !important;
    border-bottom-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
html[data-nv-tone="canvas"] body.nv-on .page-content {
    border: 1px solid var(--nv-panel-border);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    margin-right: 8px;
    min-height: calc(100vh - var(--nv-top) - 60px);
}

/* =============================================================================
   Sidebar
   ============================================================================= */
.nv-side {
    position: fixed;
    top: var(--nv-top);
    left: 0;
    bottom: 0;
    width: var(--nv-w);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: var(--nv-bg);
    border-right: 1px solid var(--nv-border);
    color: var(--nv-text);
    font-family: "Roboto", "Segoe UI", Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.3;
    transition: width .2s var(--nv-ease);
    -webkit-font-smoothing: antialiased;
}
html[data-nv-tone="canvas"] .nv-side { border-right: 0; }
body.nv-collapsed .nv-side { width: var(--nv-rail); }

.nv-side *,
.nv-side *::before,
.nv-side *::after { box-sizing: border-box; }
.nv-side ul { list-style: none; margin: 0; padding: 0; }
.nv-side button { font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0; cursor: pointer; text-align: left; }
.nv-side svg { display: block; flex: 0 0 auto; }

/* ---- top: search / go-to ------------------------------------------------ */
.nv-top { padding: 12px 10px 6px; flex: 0 0 auto; }
.nv-side .nv-search {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    height: 34px;
    padding: 0 8px 0 10px;
    border-radius: var(--nv-radius);
    background: var(--nv-field-bg);
    border: 1px solid var(--nv-field-border);
    color: var(--nv-muted);
    transition: border-color .15s, background .15s, color .15s;
}
.nv-side .nv-search:hover { color: var(--nv-text); border-color: var(--nv-focus); }
.nv-search .nv-search-label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nv-kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 5px;
    border: 1px solid var(--nv-field-border);
    font: 600 11px/1 "Roboto Mono", Consolas, monospace;
    color: var(--nv-muted);
}

/* ---- scroll area --------------------------------------------------------- */
.nv-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 10px 12px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.nv-scroll:hover { scrollbar-color: var(--nv-guide) transparent; }
.nv-scroll::-webkit-scrollbar { width: 6px; }
.nv-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; }
.nv-scroll:hover::-webkit-scrollbar-thumb { background: var(--nv-guide); }

.nv-sec + .nv-sec { margin-top: 6px; }
.nv-sep { height: 1px; background: var(--nv-guide); margin: 8px 6px; }

.nv-caption {
    display: flex; align-items: center; gap: 8px;
    height: 28px;
    padding: 10px 10px 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--nv-caption);
    white-space: nowrap;
}
.nv-caption--lab { color: var(--nv-lab); }
.nv-caption .nv-lab-pill {
    font-size: 9.5px; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px;
    border: 1px solid currentColor; opacity: .8;
}
html[data-nv-labels="off"] .nv-caption { display: none; }
html[data-nv-labels="off"] .nv-sec + .nv-sec { margin-top: 0; }
html[data-nv-labels="off"] .nv-sec + .nv-sec::before {
    content: ""; display: block; height: 1px; background: var(--nv-guide); margin: 8px 6px;
}

/* ---- rows ----------------------------------------------------------------- */
.nv-li { position: relative; }
.nv-li + .nv-li { margin-top: 1px; }

.nv-side .nv-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: var(--nv-row-h);
    padding: 0 8px 0 10px;
    border-radius: var(--nv-radius);
    color: var(--nv-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background .12s, color .12s;
    outline: none;
}
.nv-side .nv-row:hover,
.nv-side .nv-row:focus { color: var(--nv-text-strong); text-decoration: none; }
.nv-side .nv-row:hover { background: var(--nv-hover); }
.nv-side .nv-row:focus-visible { box-shadow: inset 0 0 0 2px var(--nv-focus); }

.nv-ico { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 18px; opacity: .92; }
.nv-ico svg { width: 18px; height: 18px; }
.nv-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.nv-count {
    flex: 0 0 auto;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--nv-count-bg);
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
    color: var(--nv-text);
    font-variant-numeric: tabular-nums;
}
.nv-count--alert { background: rgba(248, 81, 73, 0.16); color: #ff7b72; }
html[data-theme="light"] .nv-count--alert { background: rgba(218, 54, 51, 0.1); color: #c9302c; }
html[data-theme="light"][data-nv-tone="midnight"] .nv-count--alert { background: rgba(248, 81, 73, 0.22); color: #ff9a93; }

.nv-tag {
    flex: 0 0 auto;
    font-size: 10px; font-weight: 600; letter-spacing: .03em;
    padding: 1px 5px; border-radius: 4px;
    color: var(--nv-marker);
    background: color-mix(in srgb, var(--nv-marker) 14%, transparent);
}
.nv-ext { opacity: .55; }
.nv-ext svg { width: 13px; height: 13px; }

.nv-chev { width: 16px; height: 16px; display: inline-flex; color: var(--nv-muted); transition: transform .18s var(--nv-ease); }
.nv-chev svg { width: 14px; height: 14px; margin: 1px; }
.nv-li--group.is-open > .nv-row .nv-chev { transform: rotate(90deg); }

/* stub (route exists in the product, not in the mockup) */
.nv-row.is-stub .nv-label { opacity: .9; }

/* sub list: inline accordion (grid-rows animation) */
.nv-sub {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .2s var(--nv-ease);
}
.nv-li--group.is-open > .nv-sub { grid-template-rows: 1fr; }
.nv-sub > ul { overflow: hidden; min-height: 0; }
/* spacing lives on the items: padding on the ul would survive the 0fr collapse */
.nv-sub > ul > li:first-child { margin-top: 2px; }
.nv-sub > ul > li:last-child { margin-bottom: 4px; }
.nv-side .nv-row--sub { padding-left: 38px; min-height: 30px; }
.nv-side .nv-row--sub::after {
    /* guide line under the parent icon */
    content: "";
    position: absolute;
    left: 18px;
    top: 0; bottom: 0;
    width: 1px;
    background: var(--nv-guide);
}
.nv-sub li:first-child .nv-row--sub::after { top: 3px; }
.nv-sub li:last-child .nv-row--sub::after { bottom: 3px; }

/* ---- active --------------------------------------------------------------- */
.nv-side .nv-row.is-active {
    background: var(--nv-active-bg);
    color: var(--nv-active-text);
    font-weight: 600;
    box-shadow: var(--nv-active-shadow);
}
.nv-side .nv-row.is-active::before {
    /* GitLab-style edge marker, drawn in the sidebar gutter */
    content: "";
    position: absolute;
    left: -10px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--nv-marker);
}
.nv-side .nv-row--sub.is-active::after { background: var(--nv-marker); width: 2px; left: 17.5px; top: 6px; bottom: 6px; border-radius: 2px; }
/* a closed group that contains the current page reads as active */
.nv-side .nv-li--group.has-active:not(.is-open) > .nv-row {
    background: var(--nv-active-bg);
    color: var(--nv-active-text);
    font-weight: 600;
    box-shadow: var(--nv-active-shadow);
}
.nv-side .nv-li--group.has-active > .nv-row { color: var(--nv-text-strong); }
.nv-side .nv-li--group.has-active > .nv-row .nv-ico { color: var(--nv-marker); opacity: 1; }

/* solid active style */
html[data-nv-active="solid"] .nv-side .nv-row.is-active,
html[data-nv-active="solid"] .nv-side .nv-li--group.has-active:not(.is-open) > .nv-row {
    background: #367fd3;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
html[data-nv-active="solid"] .nv-side .nv-row.is-active::before { display: none; }
html[data-nv-active="solid"] .nv-side .nv-row.is-active .nv-count { background: rgba(255, 255, 255, 0.2); color: #fff; }
html[data-nv-active="solid"] .nv-side .nv-li--group.has-active:not(.is-open) > .nv-row .nv-ico,
html[data-nv-active="solid"] .nv-side .nv-li--group.has-active:not(.is-open) > .nv-row .nv-chev { color: #fff; }
html[data-nv-active="solid"] .nv-side .nv-row--sub.is-active::after { background: var(--nv-guide); width: 1px; left: 18px; top: 0; bottom: 0; }

/* ---- pin button ------------------------------------------------------------ */
.nv-side .nv-pin {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--nv-muted);
    z-index: 2;
}
.nv-side .nv-pin svg { width: 14px; height: 14px; }
.nv-side .nv-pin:hover { color: var(--nv-text-strong); background: var(--nv-hover); }
.nv-side .nv-pin.is-pinned { color: var(--nv-marker); }
.nv-li--pinnable:hover > .nv-pin,
.nv-li--pinnable:focus-within > .nv-pin { display: inline-flex; }
.nv-li--pinnable:hover > .nv-row .nv-count,
.nv-li--pinnable:focus-within > .nv-row .nv-count,
.nv-li--pinnable:hover > .nv-row .nv-tag,
.nv-li--pinnable:hover > .nv-row .nv-ext { visibility: hidden; }
html[data-nv-active="solid"] .nv-li--pinnable > .nv-row.is-active ~ .nv-pin { color: rgba(255, 255, 255, 0.8); }

.nv-pinned-empty {
    margin: 2px 4px 4px 38px;
    font-size: 12px;
    color: var(--nv-muted);
    line-height: 1.45;
}
.nv-pinned-empty svg { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; }

/* ---- footer ----------------------------------------------------------------- */
.nv-foot {
    flex: 0 0 auto;
    padding: 8px 10px 12px;
    border-top: 1px solid var(--nv-guide);
}
.nv-foot .nv-row { color: var(--nv-text); }
.nv-foot .nv-row .nv-ico { color: var(--nv-muted); }
.nv-foot .nv-row:hover .nv-ico { color: inherit; }
.nv-foot .nv-row:hover { color: var(--nv-text-strong); }
.nv-foot .nv-row .nv-kbd { margin-left: auto; }
.nv-foot .nv-row.is-on { color: var(--nv-text-strong); background: var(--nv-hover); }

/* =============================================================================
   Collapsed rail
   ============================================================================= */
body.nv-collapsed .nv-top { padding: 12px 8px 6px; }
body.nv-collapsed .nv-search { width: 40px; padding: 0; justify-content: center; }
body.nv-collapsed .nv-search .nv-search-label,
body.nv-collapsed .nv-search .nv-kbd { display: none; }
body.nv-collapsed .nv-scroll { padding: 4px 8px 12px; }
body.nv-collapsed .nv-row { width: 40px; padding: 0; justify-content: center; gap: 0; height: 36px; }
body.nv-collapsed .nv-label,
body.nv-collapsed .nv-count,
body.nv-collapsed .nv-tag,
body.nv-collapsed .nv-ext,
body.nv-collapsed .nv-chev,
body.nv-collapsed .nv-pin,
body.nv-collapsed .nv-sub,
body.nv-collapsed .nv-pinned-empty,
body.nv-collapsed .nv-foot .nv-kbd { display: none !important; }
body.nv-collapsed .nv-caption { height: 0; padding: 0; overflow: hidden; }
body.nv-collapsed .nv-sec + .nv-sec::before {
    content: ""; display: block; height: 1px; background: var(--nv-guide); margin: 8px 6px;
}
body.nv-collapsed .nv-sec + .nv-sec { margin-top: 0; }
body.nv-collapsed .nv-foot { padding: 8px 8px 12px; }
body.nv-collapsed .nv-side .nv-row.is-active::before,
body.nv-collapsed .nv-side .nv-li--group.has-active > .nv-row::before {
    content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--nv-marker);
}
body.nv-collapsed .nv-side .nv-li--group.has-active > .nv-row {
    background: var(--nv-active-bg); box-shadow: var(--nv-active-shadow);
}
html[data-nv-active="solid"] body.nv-collapsed .nv-side .nv-li--group.has-active > .nv-row { background: #367fd3; color: #fff; }
html[data-nv-active="solid"] body.nv-collapsed .nv-side .nv-li--group.has-active > .nv-row .nv-ico { color: #fff; }
html[data-nv-active="solid"] body.nv-collapsed .nv-side .nv-row::before { display: none; }
body.nv-collapsed .nv-row.is-flyout { background: var(--nv-hover); color: var(--nv-text-strong); }
/* count as a dot on the rail icon */
body.nv-collapsed .nv-row[data-count]::after {
    content: "";
    position: absolute;
    top: 7px; right: 7px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #f85149;
    box-shadow: 0 0 0 2px var(--nv-dot-ring, #11161d);
}
body.nv-collapsed .nv-row[data-count].is-active::after { box-shadow: none; }

/* =============================================================================
   Flyout (rail hover menus)
   ============================================================================= */
.nv-fly {
    position: fixed;
    z-index: 10030;
    min-width: 200px;
    max-width: 280px;
    padding: 6px;
    border-radius: 10px;
    background: var(--nv-pop-bg);
    border: 1px solid var(--nv-pop-border);
    box-shadow: var(--nv-pop-shadow);
    color: var(--nv-pop-text);
    font-family: "Roboto", "Segoe UI", Arial, sans-serif;
    font-size: 13.5px;
    opacity: 0;
    transform: translateX(-4px);
    pointer-events: none;
    transition: opacity .12s, transform .12s var(--nv-ease);
}
.nv-fly.is-open { opacity: 1; transform: none; pointer-events: auto; }
.nv-fly--tip { min-width: 0; padding: 6px 10px; font-weight: 600; color: var(--nv-pop-strong); white-space: nowrap; }
.nv-fly--tip .nv-fly-sub { font-weight: 400; color: var(--nv-pop-muted); margin-left: 6px; }
.nv-fly-head {
    padding: 6px 10px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--nv-pop-border);
    font-size: 12px;
    font-weight: 700;
    color: var(--nv-pop-strong);
    display: flex; align-items: center; gap: 8px;
}
.nv-fly-head .nv-count { margin-left: auto; }
.nv-fly ul { list-style: none; margin: 0; padding: 0; }
.nv-fly a.nv-fly-row,
.nv-fly a.nv-fly-row:hover,
.nv-fly a.nv-fly-row:focus {
    display: flex; align-items: center; gap: 8px;
    min-height: 30px; padding: 0 10px;
    border-radius: 7px;
    color: var(--nv-pop-text);
    text-decoration: none;
    white-space: nowrap;
}
.nv-fly a.nv-fly-row:hover,
.nv-fly a.nv-fly-row:focus { background: var(--nv-pop-hover); color: var(--nv-pop-strong); outline: none; }
.nv-fly a.nv-fly-row.is-active { color: var(--nv-pop-strong); font-weight: 600; background: rgba(54, 127, 211, 0.14); }
.nv-fly a.nv-fly-row .nv-count { margin-left: auto; }
.nv-fly a.nv-fly-row .nv-tag { margin-left: auto; }
.nv-fly-empty { padding: 6px 10px; color: var(--nv-pop-muted); font-size: 12px; }

/* =============================================================================
   Toast (stub routes)
   ============================================================================= */
.nv-toast {
    position: fixed;
    z-index: 10040;
    left: calc(var(--nv-w) + 16px);
    bottom: 20px;
    max-width: 380px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--nv-pop-bg);
    border: 1px solid var(--nv-pop-border);
    box-shadow: var(--nv-pop-shadow);
    color: var(--nv-pop-text);
    font: 13px/1.45 "Roboto", "Segoe UI", Arial, sans-serif;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .15s, transform .15s var(--nv-ease);
    pointer-events: none;
}
body.nv-collapsed .nv-toast { left: calc(var(--nv-rail) + 16px); }
.nv-toast.is-open { opacity: 1; transform: none; }
.nv-toast b { color: var(--nv-pop-strong); }
.nv-toast code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--nv-pop-hover); color: var(--nv-pop-text); }

/* =============================================================================
   "Search or go to" palette
   ============================================================================= */
.nv-pal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(1, 4, 9, 0.55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 11vh;
}
html[data-theme="light"] .nv-pal-backdrop { background: rgba(15, 23, 42, 0.3); }
.nv-pal-backdrop.is-open { display: flex; }
.nv-pal {
    width: 600px;
    max-width: calc(100vw - 32px);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    background: var(--nv-pop-bg);
    border: 1px solid var(--nv-pop-border);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    color: var(--nv-pop-text);
    font-family: "Roboto", "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    overflow: hidden;
    animation: nvPalIn .14s var(--nv-ease);
}
html[data-theme="light"] .nv-pal { box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22); }
@keyframes nvPalIn { from { opacity: 0; transform: translateY(-6px) scale(.99); } to { opacity: 1; transform: none; } }
.nv-pal-head {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px;
    height: 54px;
    border-bottom: 1px solid var(--nv-pop-border);
    color: var(--nv-pop-muted);
}
.nv-pal-head svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nv-pal-head input {
    flex: 1 1 auto;
    height: 100%;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--nv-pop-strong) !important;
    font-size: 15px;
    padding: 0;
}
.nv-pal-head input::placeholder { color: var(--nv-pop-muted); }
.nv-pal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 8px 8px; }
.nv-pal-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--nv-pop-muted); }
.nv-pal a.nv-pal-row,
.nv-pal a.nv-pal-row:hover,
.nv-pal a.nv-pal-row:focus {
    display: flex; align-items: center; gap: 12px;
    min-height: 40px; padding: 0 10px;
    border-radius: 8px;
    color: var(--nv-pop-text);
    text-decoration: none;
    outline: none;
}
.nv-pal a.nv-pal-row.is-sel { background: rgba(54, 127, 211, 0.14); color: var(--nv-pop-strong); }
.nv-pal-ico {
    width: 28px; height: 28px; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--nv-pop-hover);
    color: var(--nv-pop-text);
    flex: 0 0 auto;
}
.nv-pal-ico svg { width: 16px; height: 16px; }
.nv-pal-title { color: var(--nv-pop-strong); font-weight: 500; }
.nv-pal-title mark { background: none; color: #58a6ff; font-weight: 700; padding: 0; }
html[data-theme="light"] .nv-pal-title mark { color: #2563ac; }
.nv-pal-crumb { color: var(--nv-pop-muted); font-size: 12.5px; margin-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nv-pal-row .nv-pal-end { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--nv-pop-muted); font-size: 12px; }
.nv-pal-row .nv-pal-enter { display: none; }
.nv-pal-row.is-sel .nv-pal-enter { display: inline-flex; }
.nv-pal-row .nv-pal-enter svg { width: 14px; height: 14px; }
.nv-pal-stub { font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--nv-pop-border); }
.nv-pal-empty { padding: 28px 16px; text-align: center; color: var(--nv-pop-muted); }
.nv-pal-foot {
    flex: 0 0 auto;
    display: flex; gap: 16px; align-items: center;
    padding: 9px 16px;
    border-top: 1px solid var(--nv-pop-border);
    font-size: 12px;
    color: var(--nv-pop-muted);
}
.nv-pal-foot .nv-kbd { border-color: var(--nv-pop-border); color: var(--nv-pop-muted); margin-right: 4px; }

/* =============================================================================
   Appearance popover
   ============================================================================= */
.nv-appear {
    position: fixed;
    z-index: 10045;
    width: 316px;
    padding: 14px;
    border-radius: 12px;
    background: var(--nv-pop-bg);
    border: 1px solid var(--nv-pop-border);
    box-shadow: var(--nv-pop-shadow);
    color: var(--nv-pop-text);
    font: 13px/1.4 "Roboto", "Segoe UI", Arial, sans-serif;
    display: none;
}
.nv-appear.is-open { display: block; }
.nv-appear h4 { margin: 0 0 2px; font-size: 13px; font-weight: 700; color: var(--nv-pop-strong); }
.nv-appear .nv-ap-hint { margin: 0 0 12px; font-size: 12px; color: var(--nv-pop-muted); }
.nv-ap-label { margin: 14px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--nv-pop-muted); }
.nv-ap-tones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nv-appear button { font: inherit; }
.nv-ap-tone {
    display: flex; flex-direction: column; gap: 6px;
    padding: 6px 6px 8px;
    border-radius: 9px;
    border: 1px solid var(--nv-pop-border);
    background: transparent;
    color: var(--nv-pop-text);
    cursor: pointer;
    text-align: left;
}
.nv-ap-tone:hover { border-color: rgba(54, 127, 211, 0.5); }
.nv-ap-tone.is-on { border-color: #367fd3; box-shadow: 0 0 0 1px #367fd3; }
.nv-ap-tone b { font-size: 12px; color: var(--nv-pop-strong); }
.nv-ap-tone span { font-size: 11px; color: var(--nv-pop-muted); line-height: 1.3; }
/* mini preview: sidebar column + header strip + content panel */
.nv-ap-prev {
    position: relative;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--p-page);
    border: 1px solid var(--nv-pop-border);
}
.nv-ap-prev i { position: absolute; display: block; }
.nv-ap-prev .p-hdr { left: 0; right: 0; top: 0; height: 9px; background: var(--p-hdr); }
.nv-ap-prev .p-side { left: 0; top: 9px; bottom: 0; width: 26px; background: var(--p-side); border-right: 1px solid var(--p-line); }
.nv-ap-prev .p-row { left: 5px; width: 16px; height: 3px; border-radius: 2px; background: var(--p-ink); opacity: .55; }
.nv-ap-prev .p-row.on { background: #58a6ff; opacity: 1; }
.nv-ap-prev .p-panel { left: 26px; right: 0; top: 9px; bottom: 0; background: var(--p-page); }
.nv-ap-prev .p-card { left: 33px; right: 7px; height: 12px; border-radius: 3px; background: var(--p-card); }
.nv-ap-prev[data-tone="canvas"] .p-side { border-right: 0; }
.nv-ap-prev[data-tone="canvas"] .p-panel { left: 28px; right: 3px; top: 11px; border-radius: 5px 5px 0 0; border: 1px solid var(--p-line); border-bottom: 0; }

.nv-ap-seg { display: flex; padding: 3px; border-radius: 9px; background: var(--nv-pop-hover); gap: 3px; }
.nv-ap-seg button {
    flex: 1 1 0;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--nv-pop-text);
    cursor: pointer;
    font-size: 12.5px;
}
.nv-ap-seg button.is-on { background: var(--nv-pop-bg); color: var(--nv-pop-strong); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.nv-ap-foot { margin-top: 14px; font-size: 11.5px; color: var(--nv-pop-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.nv-ap-foot .nv-kbd { border-color: var(--nv-pop-border); margin-right: 3px; }

/* ---- small extras ---------------------------------------------------------- */
.nv-crumb { font-weight: 400; font-size: 12px; color: var(--nv-muted); margin-left: 3px; }
.nv-row.is-active .nv-crumb { font-weight: 400; }
html[data-nv-active="solid"] .nv-row.is-active .nv-crumb { color: rgba(255, 255, 255, 0.75); }
/* group counts summarise a closed group; once open, the child carries it */
.nv-li--group.is-open > .nv-row .nv-count { display: none; }
/* ring behind the rail count dot = the tone's solid sidebar colour */
:root { --nv-dot-ring: #11161d; }
html[data-nv-tone="canvas"] { --nv-dot-ring: #0b0e13; }
html[data-nv-tone="midnight"] { --nv-dot-ring: #0e1728; }
html[data-theme="light"] { --nv-dot-ring: #ffffff; }
html[data-theme="light"][data-nv-tone="canvas"] { --nv-dot-ring: #e7ecf2; }
html[data-theme="light"][data-nv-tone="midnight"] { --nv-dot-ring: #11203a; }
