/* ============================================================================
   ShellV4 — estilos del nuevo shell. TODO aislado bajo .ns-shellv4.
   No toca app.css ni clases ns-* existentes. Colores/medidas/radios fieles al
   prototipo docs/nanchesoft-shell-lite.html. Modo claro/oscuro vía [data-theme],
   densidad vía [data-density] (los pone el layout en el contenedor .ns-shellv4).
   Las variables --brand1/--brand2 las escribe nsShellV4.applyTheme().
   ============================================================================ */

.ns-shellv4 {
    --brand1: #0071e3; --brand2: #0a84ff;
    --bg: #f4f6f9; --panel: #ffffff; --rail: #0e1726;
    --line: #e6e9ef; --line2: #eef1f5;
    --ink: #1c2330; --muted: #6b7280; --muted2: #9aa3b2;
    --hover: #eef4ff; --active: #e3efff; --zebra: #fafbfd;
    --row: 30px;                       /* densidad compacta */
    --nav-w: 226px; --rail-w: 54px; --top-h: 50px;
    --radius: 9px;

    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
    background: var(--bg); color: var(--ink);
    font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.ns-shellv4[data-density="comodo"] { --row: 38px; --nav-w: 248px; }

.ns-shellv4 *, .ns-shellv4 *::before, .ns-shellv4 *::after { box-sizing: border-box; }
.ns-shellv4 button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.ns-shellv4 ::-webkit-scrollbar { width: 8px; height: 8px; }
.ns-shellv4 ::-webkit-scrollbar-thumb { background: #cdd3dd; border-radius: 8px; }

/* ---------- TOP BAR ---------- */
.ns-shellv4__topbar {
    height: var(--top-h); display: flex; align-items: center; gap: 12px;
    padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line);
    flex: none; z-index: 30;
}
.ns-shellv4__brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.ns-shellv4__logomark { height: 30px; width: auto; display: block; }
.ns-shellv4__logo--darkbg { display: none; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__logo--lightbg { display: none; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__logo--darkbg { display: block; }

.ns-shellv4__searchbar {
    flex: 1; max-width: 560px; margin: 0 auto; height: 34px; display: flex; align-items: center; gap: 8px;
    padding: 0 12px; background: var(--bg); border: 1px solid var(--line);
    border-radius: 999px; color: var(--muted); cursor: text; transition: .15s;
}
.ns-shellv4__searchbar:hover { border-color: #c9d4e6; background: #fff; }
.ns-shellv4__searchhint { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-shellv4__kbd { margin-left: auto; font: 600 10px/1 ui-monospace, monospace; background: #fff; border: 1px solid var(--line);
    border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; color: var(--muted); }
.ns-shellv4__topright { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ns-shellv4__user { font-weight: 600; color: var(--muted); padding: 0 6px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- SHELL BODY (riel | lista | main) ---------- */
.ns-shellv4__body {
    display: grid; grid-template-columns: var(--rail-w) var(--nav-w) 1fr;
    flex: 1; min-height: 0;
}

/* riel */
.ns-shellv4__rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; overflow: auto; }
.ns-shellv4__rail::-webkit-scrollbar { display: none; }
.ns-shellv4__railbtn { position: relative; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    color: #fff; opacity: .82; transition: transform .13s ease, opacity .13s ease, filter .13s ease; }
/* Cuadro con el COLOR VIVO del módulo (var --mod), código en blanco, redondeado. */
.ns-shellv4__railcode { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: var(--mod, var(--brand1)); color: #fff; font: 700 11px/1 system-ui;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 2px 6px rgba(0,0,0,.28); }
.ns-shellv4__railbtn:hover { opacity: 1; transform: translateY(-1px); filter: brightness(1.08); }
/* ACTIVO: opacidad full + barrita blanca a la izquierda + anillo blanco alrededor del cuadro. */
.ns-shellv4__railbtn.is-active { opacity: 1; }
.ns-shellv4__railbtn.is-active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: #fff; }
.ns-shellv4__railbtn.is-active .ns-shellv4__railcode { box-shadow: 0 0 0 2px var(--rail), 0 0 0 4px rgba(255,255,255,.92), 0 2px 8px rgba(0,0,0,.3); }
.ns-shellv4__railspacer { flex: 1; }
/* Engrane (Apariencia): neutro, no usa color de módulo. */
.ns-shellv4__cog .ns-shellv4__railcode { font-size: 16px; background: rgba(255,255,255,.10); box-shadow: none; }
.ns-shellv4__cog:hover .ns-shellv4__railcode { background: rgba(255,255,255,.18); }

/* Tooltip estilizado (riel + lista): burbuja única position:fixed posicionada por ns-shellv4.js,
   para que ESCAPE el overflow del riel/lista (donde un tooltip CSS puro se recorta). Look tipo .rtip. */
.ns-shellv4__tip { position: fixed; z-index: 1100; transform: translateY(-50%) translateX(-4px); white-space: nowrap;
    background: #0b1220; color: #fff; font: 600 11.5px/1.2 system-ui; padding: 5px 9px; border-radius: 7px;
    pointer-events: none; opacity: 0; box-shadow: 0 6px 18px rgba(0,0,0,.35);
    transition: opacity .12s ease, transform .12s ease; }
.ns-shellv4__tip.is-show { opacity: 1; transform: translateY(-50%) translateX(0); }

/* lista compacta */
.ns-shellv4__list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.ns-shellv4__listhead { padding: 12px 14px 8px; display: flex; align-items: center; gap: 8px; }
.ns-shellv4__listdot { width: 9px; height: 9px; border-radius: 3px; background: var(--brand1); flex: none; }
.ns-shellv4__listtitle { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.ns-shellv4__filterwrap { margin: 0 12px 8px; height: 30px; display: flex; align-items: center; gap: 7px; padding: 0 9px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.ns-shellv4__filter { flex: 1; min-width: 0; border: 0; background: none; outline: 0; color: var(--ink); font: inherit; }
.ns-shellv4__filter::placeholder { color: var(--muted); }
.ns-shellv4__items { overflow: auto; padding: 2px 8px 16px; flex: 1; }
.ns-shellv4__item { display: flex; align-items: center; gap: 9px; height: var(--row); padding: 0 9px; border-radius: 8px;
    color: #384152; width: 100%; text-align: left; transition: background .1s; }
.ns-shellv4__item:hover { background: var(--hover); }
.ns-shellv4__item.is-active { background: var(--active); color: #0a3d91; font-weight: 600; }
.ns-shellv4__itemtitle { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.ns-shellv4__itembadge { font: 600 10px/1 system-ui; color: var(--muted2); background: var(--bg);
    border: 1px solid var(--line); border-radius: 999px; padding: 2px 6px; }
.ns-shellv4__item.is-active .ns-shellv4__itembadge { background: #fff; border-color: #cfe0ff; color: #0a66d6; }

/* main (tabs + panes) */
.ns-shellv4__main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg); }

/* tabs */
.ns-shellv4__tabbar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 10px;
    background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.ns-shellv4__tabs { display: flex; align-items: center; gap: 4px; overflow-x: auto; flex: 1; height: 100%; }
.ns-shellv4__tabs::-webkit-scrollbar { height: 0; }
.ns-shellv4__tab { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; border-radius: 8px;
    color: #475067; font-size: 12.5px; white-space: nowrap; border: 1px solid transparent; cursor: pointer; flex: none; max-width: 230px; }
.ns-shellv4__tab:hover { background: var(--bg); }
.ns-shellv4__tab.is-active { background: var(--active); color: #0a3d91; border-color: #cfe0ff; font-weight: 600; }
.ns-shellv4__tab.is-temp .ns-shellv4__tablabel { font-style: italic; }
.ns-shellv4__tabchip { width: 16px; height: 16px; border-radius: 5px; display: grid; place-items: center; color: #fff; font: 700 9px/1 system-ui; flex: none; }
.ns-shellv4__tablabel { overflow: hidden; text-overflow: ellipsis; }
.ns-shellv4__tabpin { opacity: 0; color: var(--muted2); }
.ns-shellv4__tab:hover .ns-shellv4__tabpin, .ns-shellv4__tab.is-pinned .ns-shellv4__tabpin { opacity: 1; }
.ns-shellv4__tab.is-pinned .ns-shellv4__tabpin { color: #0a66d6; }
.ns-shellv4__tabx { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; color: var(--muted2); opacity: 0; font-size: 13px; }
.ns-shellv4__tab:hover .ns-shellv4__tabx { opacity: 1; }
.ns-shellv4__tabx:hover { background: #dbe4f0; color: #0b1220; }
.ns-shellv4__tab.is-pinned .ns-shellv4__tabx { display: none; }
.ns-shellv4__tab.is-pinned:hover .ns-shellv4__tabx { display: grid; }
.ns-shellv4__tabaction { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 5px 9px; border-radius: 7px; border: 1px solid var(--line); }
.ns-shellv4__tabaction:hover { background: var(--bg); color: var(--ink); }

/* Vista dividida: fila de DOS tiras alineadas con las mitades (misma --ns-split que los panes). */
.ns-shellv4__tabrow { display: flex; flex: none; }
.ns-shellv4__tabrow > .ns-shellv4__tabbar { min-width: 0; }
.ns-shellv4__tabrow > .ns-shellv4__tabbar:first-child { width: calc(var(--ns-split, .5) * 100%); flex: none; border-right: 1px solid var(--line); }
.ns-shellv4__tabrow > .ns-shellv4__tabbar:last-child { flex: 1; }
/* Panel ENFOCADO: acento sutil en el borde superior de su tira. */
.ns-shellv4__tabbar.is-focused { box-shadow: inset 0 2px 0 0 var(--brand2); }
/* Botón "enviar al otro panel" (aparece al pasar el mouse sobre la pestaña). */
.ns-shellv4__tabmove { opacity: 0; color: var(--muted2); font-size: 12px; line-height: 1; padding: 0 1px; }
.ns-shellv4__tab:hover .ns-shellv4__tabmove { opacity: 1; }
.ns-shellv4__tabmove:hover { color: var(--ink); }
/* Responsive: en ventanas angostas se oculta "Dividir/Unir" (el JS además colapsa a un panel). */
@media (max-width: 960px) { .ns-shellv4__tabaction--split { display: none; } }

/* panes (vivos: posicionados; el layout oculta los inactivos con display:none inline) */
.ns-shellv4__panes { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.ns-shellv4__pane { position: absolute; inset: 0; overflow: auto; }
/* Vista dividida (50/50 fijo en Fase 1): el pane completo usa inset:0; las mitades solo
   sobreescriben right/left según --ns-split. Mismo @key/contenedor → sin remount. */
.ns-shellv4__pane--left { right: calc((1 - var(--ns-split, .5)) * 100%); }
.ns-shellv4__pane--right { left: calc(var(--ns-split, .5) * 100%); }
/* Divisor AJUSTABLE: zona de agarre de 9px centrada en la línea, con una línea visible interna. */
.ns-shellv4__split-divider { position: absolute; top: 0; bottom: 0; left: calc(var(--ns-split, .5) * 100%);
    width: 9px; transform: translateX(-4.5px); cursor: col-resize; z-index: 6; pointer-events: auto; touch-action: none; }
.ns-shellv4__split-divider::before { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px;
    background: var(--line); transition: background .12s ease, width .12s ease, left .12s ease; }
.ns-shellv4__split-divider:hover::before, .ns-shellv4__split-divider.is-dragging::before { left: 3px; width: 3px; background: var(--brand2); }
.ns-shellv4__panenote { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
    text-align: center; color: var(--muted); font-size: 13px; }
/* ErrorBoundary por pane: pantalla que truena → recuadro contenido (no rompe el shell). */
.ns-shellv4__paneerror { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
    gap: 8px; padding: 24px; text-align: center; color: var(--ink); }
.ns-shellv4__paneerror-icon { font-size: 28px; color: #d97706; }
.ns-shellv4__paneerror-title { font-size: 15px; font-weight: 700; }
.ns-shellv4__paneerror-sub { font-size: 12.5px; color: var(--muted); max-width: 42ch; }
.ns-shellv4__paneerror-actions { display: flex; gap: 8px; margin-top: 6px; }
/* Fase 4: arrastre de pestañas. El cursor de arrastre y la imagen "levantada" los da el navegador;
   aquí atenuamos la pestaña origen y resaltamos las zonas de drop. */
.ns-shellv4__tab.is-dragging { opacity: .45; }
.ns-shellv4__tabbar.is-drop { background: var(--hover); box-shadow: inset 0 0 0 2px var(--brand2); }
.ns-shellv4__dropzone { position: absolute; top: 0; right: 0; bottom: 0; width: 40%; z-index: 20;
    display: grid; place-items: center; border-left: 2px dashed transparent;
    background: linear-gradient(to right, transparent, rgba(10, 132, 255, .05)); }
.ns-shellv4__dropzone.is-hot { background: rgba(10, 132, 255, .13); border-left-color: var(--brand2); }
.ns-shellv4__dropzone-label { padding: 8px 14px; border-radius: 999px; background: var(--panel);
    border: 1px solid var(--brand2); color: var(--brand1); font-size: 12.5px; font-weight: 600;
    box-shadow: 0 6px 18px rgba(2, 10, 30, .18); opacity: .9; }
.ns-shellv4__dropzone.is-hot .ns-shellv4__dropzone-label { opacity: 1; }
.ns-shellv4__empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; }
.ns-shellv4__emptybig { font-size: 15px; color: #42495a; font-weight: 600; margin-bottom: 6px; }

/* ---------- COMMAND PALETTE (Ctrl+K) ---------- */
.ns-shellv4__palov { position: fixed; inset: 0; background: rgba(13,20,33,.42); backdrop-filter: blur(3px);
    display: flex; align-items: flex-start; justify-content: center; z-index: 1060; padding-top: 11vh; }
.ns-shellv4__pal { width: min(640px, 92vw); background: var(--panel); border-radius: 16px; overflow: hidden;
    box-shadow: 0 24px 80px rgba(2,10,30,.4); border: 1px solid var(--line); }
.ns-shellv4__palinput { width: 100%; border: 0; outline: 0; font: 16px/1 system-ui; background: var(--panel); color: var(--ink);
    padding: 16px 18px; border-bottom: 1px solid var(--line2); }
.ns-shellv4__palinput::placeholder { color: var(--muted2); }
.ns-shellv4__palres { max-height: 54vh; overflow: auto; padding: 8px; }
.ns-shellv4__palrow { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.ns-shellv4__palrow.is-sel { background: var(--active); }
.ns-shellv4__palico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font: 700 11px/1 system-ui; flex: none; }
.ns-shellv4__palmeta { flex: 1; min-width: 0; }
.ns-shellv4__palt { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ns-shellv4__pals { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ns-shellv4__palgo { font: 600 11px/1 system-ui; color: var(--muted2); opacity: 0; }
.ns-shellv4__palrow.is-sel .ns-shellv4__palgo { opacity: 1; }
.ns-shellv4__palempty { padding: 34px; text-align: center; color: var(--muted); }

/* ---------- PANEL DE TEMA ---------- */
.ns-shellv4__tov { position: fixed; inset: 0; background: rgba(8,13,24,.45); backdrop-filter: blur(2px); z-index: 1070; }
.ns-shellv4__themedrawer { position: fixed; top: 0; right: 0; height: 100vh; width: 340px; max-width: 92vw; background: var(--panel);
    border-left: 1px solid var(--line); box-shadow: -18px 0 50px rgba(2,10,30,.20); z-index: 1071;
    display: flex; flex-direction: column; animation: nsShellV4Drawer .22s cubic-bezier(.4,0,.2,1); }
@keyframes nsShellV4Drawer { from { transform: translateX(105%); } to { transform: none; } }
.ns-shellv4__themehead { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line2); }
.ns-shellv4__themehead b { font-size: 15px; }
.ns-shellv4__ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.ns-shellv4__ic:hover { background: var(--bg); color: var(--ink); }
.ns-shellv4__themesection { padding: 4px 18px 0; }
.ns-shellv4__themelabel { font: 700 10.5px/1 system-ui; letter-spacing: .06em; text-transform: uppercase; color: var(--muted2); margin: 18px 0 9px; }
.ns-shellv4__presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ns-shellv4__preset { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
    cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--bg); text-align: left; }
.ns-shellv4__preset:hover { border-color: #9bb6e6; }
.ns-shellv4__preset.is-on { border-color: transparent; box-shadow: 0 0 0 2px var(--brand2); }
.ns-shellv4__sw { width: 20px; height: 20px; border-radius: 6px; flex: none; }
.ns-shellv4__accentrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ns-shellv4__accentrow input[type=color] { width: 46px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: none; cursor: pointer; padding: 3px; }
.ns-shellv4__swatch { width: 24px; height: 24px; border-radius: 7px; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.ns-shellv4__seg { display: flex; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.ns-shellv4__seg button { flex: 1; height: 32px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ns-shellv4__seg button.is-on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ns-shellv4__themefoot { display: flex; gap: 8px; padding: 14px 18px; margin-top: auto; border-top: 1px solid var(--line2); }
.ns-shellv4__btn { flex: 1; justify-content: center; height: 32px; padding: 0 12px; border-radius: 8px; display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; font-weight: 600; color: #374151; }
.ns-shellv4__btn:hover { border-color: #c9d4e6; }
.ns-shellv4__btn--pri { background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff; border: 0; box-shadow: 0 2px 8px rgba(10,132,255,.3); }

/* ---------- CONTROLES DE SESIÓN (tenant / empresa / usuario) ---------- */
.ns-shellv4__session { display: flex; align-items: center; gap: 8px; }
.ns-shellv4__ctxwrap { position: relative; }
.ns-shellv4__ctx { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--panel); color: var(--ink); max-width: 200px; }
.ns-shellv4__ctx--company { cursor: pointer; }
.ns-shellv4__ctx--company:hover, .ns-shellv4__userpill:hover { background: var(--hover); border-color: #c9d4e6; }
.ns-shellv4__ctx-avatar { width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid; place-items: center;
    font: 700 9px/1 system-ui; color: #fff; background: linear-gradient(135deg, var(--brand1), var(--brand2)); }
.ns-shellv4__ctx--tenant .ns-shellv4__ctx-avatar { background: linear-gradient(135deg, #334155, #0f172a); }
.ns-shellv4__ctx-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.ns-shellv4__ctx-eyebrow { font: 700 8.5px/1 system-ui; letter-spacing: .06em; text-transform: uppercase; color: var(--muted2); }
.ns-shellv4__ctx-value { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-shellv4__caret { color: var(--muted2); font-size: 10px; margin-left: 2px; flex: none; }

.ns-shellv4__userpill { display: flex; align-items: center; gap: 5px; height: 36px; padding: 0 6px 0 4px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--panel); }
.ns-shellv4__avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff;
    font: 700 11px/1 system-ui; background: linear-gradient(135deg, #334155, #0f172a); }
.ns-shellv4__avatarimg { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.ns-shellv4__menuscrim { position: fixed; inset: 0; z-index: 1040; background: transparent; }
.ns-shellv4__menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 1041; min-width: 240px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(2,10,30,.22); overflow: hidden; animation: nsShellV4Pop .12s ease; }
.ns-shellv4__menu--right { left: auto; right: 0; }
@keyframes nsShellV4Pop { from { transform: translateY(-6px); opacity: .4; } to { transform: none; opacity: 1; } }
.ns-shellv4__menuhead { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-bottom: 1px solid var(--line2); }
.ns-shellv4__menuhead > span { font-size: 13px; font-weight: 700; }
.ns-shellv4__menuhead small, .ns-shellv4__menuhead2 small { font-size: 11px; color: var(--muted); }
.ns-shellv4__menuhead2 { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line2); }
.ns-shellv4__menuavatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff;
    font: 700 14px/1 system-ui; background: linear-gradient(135deg, var(--brand1), var(--brand2)); }
.ns-shellv4__menuhead2-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ns-shellv4__menuhead2-meta b { font-size: 13px; }
.ns-shellv4__menulist { padding: 6px; display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.ns-shellv4__menuitem { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
    font-size: 12.5px; color: var(--ink); }
.ns-shellv4__menuitem:hover:not(:disabled) { background: var(--hover); }
.ns-shellv4__menuitem:disabled { opacity: .55; cursor: default; }
.ns-shellv4__menuitem--muted { color: var(--muted); }
.ns-shellv4__menuitem--danger { color: #dc2626; }
.ns-shellv4__menuitem--danger:hover { background: #fdecec; }
.ns-shellv4__menuicon { width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid; place-items: center; color: #fff;
    font: 700 9px/1 system-ui; background: linear-gradient(135deg, var(--brand1), var(--brand2)); }
.ns-shellv4__menutext { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-shellv4__menuglyph { color: var(--muted); display: grid; place-items: center; }
.ns-shellv4__menuitem--danger .ns-shellv4__menuglyph { color: #dc2626; }
.ns-shellv4__tagactual { font: 600 9.5px/1 system-ui; color: var(--muted); background: var(--bg); border: 1px solid var(--line);
    border-radius: 999px; padding: 2px 6px; }
@media (max-width: 1100px) { .ns-shellv4__ctx-label { display: none; } .ns-shellv4__ctx { max-width: none; padding: 0 8px; } }

/* ---------- BUSCADOR: fila de búsqueda + grupos + footer ---------- */
.ns-shellv4__palsi { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--line2); color: var(--muted2); }
.ns-shellv4__palsi .ns-shellv4__palinput { flex: 1; border: 0; outline: 0; font: 16px/1 system-ui; background: none; color: var(--ink); padding: 0; }
.ns-shellv4__palinput::placeholder { color: var(--muted2); }
.ns-shellv4__palesc { font: 600 11px/1 system-ui; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; }
.ns-shellv4__palgl { padding: 10px 12px 4px; font: 700 10.5px/1 system-ui; letter-spacing: .06em; text-transform: uppercase; color: var(--muted2); }
.ns-shellv4__palfoot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line2); color: var(--muted); font-size: 11.5px; }
.ns-shellv4__palfoot b { font-weight: 600; border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; margin-right: 5px; }

/* ---------- LISTA: ícono de color por ítem + contador ---------- */
.ns-shellv4__listcount { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted2); }
.ns-shellv4__itemico { width: 18px; height: 18px; border-radius: 6px; flex: none; display: grid; place-items: center; font: 700 9px/1 system-ui; color: #fff; }
.ns-shellv4__itemico svg { width: 12px; height: 12px; }
.ns-shellv4__railcode svg { width: 19px; height: 19px; }

/* ---------- TOAST ---------- */
.ns-shellv4__toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px); z-index: 1080;
    background: #0b1220; color: #fff; font-size: 13px; font-weight: 600; padding: 11px 18px; border-radius: 999px;
    box-shadow: 0 12px 30px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.ns-shellv4__toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- COLAPSAR MENÚ ---------- */
.ns-shellv4__navtoggle { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
.ns-shellv4__navtoggle:hover { background: var(--bg); color: var(--ink); }
.ns-shellv4[data-nav="off"] .ns-shellv4__body { grid-template-columns: var(--rail-w) 0 1fr; }
.ns-shellv4[data-nav="off"] .ns-shellv4__list { display: none; }

/* ---------- TOGGLE de pestañas (Mantener / Auto-cerrar) ---------- */
.ns-shellv4__tabmode { display: flex; gap: 2px; flex: none; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.ns-shellv4__tabmode button { height: 24px; padding: 0 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ns-shellv4__tabmode button.is-on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* ---------- MODO OSCURO ---------- */
.ns-shellv4[data-theme="dark"] {
    --bg: #0e1524; --panel: #151d30; --rail: #080d18;
    --line: #263452; --line2: #1c2640;
    --ink: #e8edf6; --muted: #9aabc4; --muted2: #6f83a3;
    --hover: #1b2740; --active: #16335f; --zebra: #121b2d;
}
.ns-shellv4[data-theme="dark"] .ns-shellv4__btn { color: var(--ink); }
.ns-shellv4[data-theme="dark"] .ns-shellv4__item { color: #c3cee1; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__item.is-active { color: #cfe0ff; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__tab { color: #b7c3d8; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__kbd { background: #1b2540; color: var(--muted); }
.ns-shellv4[data-theme="dark"] .ns-shellv4__searchbar:hover { background: var(--panel); border-color: #33415e; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__seg button.is-on,
.ns-shellv4[data-theme="dark"] .ns-shellv4__tabmode button.is-on { background: #22304c; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__user { color: var(--muted); }
.ns-shellv4[data-theme="dark"] .ns-shellv4__ctx--company:hover,
.ns-shellv4[data-theme="dark"] .ns-shellv4__userpill:hover { border-color: #33415e; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__menuitem--danger { color: #f87171; }
.ns-shellv4[data-theme="dark"] .ns-shellv4__menuitem--danger:hover { background: #2a1414; }

@media (prefers-reduced-motion: reduce) { .ns-shellv4 *, .ns-shellv4 *::before, .ns-shellv4 *::after { transition: none !important; animation: none !important; } }
