/* ═══════════════════════════════════════════════════════════════════
   NS PORTAL — DESIGN SYSTEM v2.0
   Marca: Nicolás Sierra Abogados
   Paleta: #001a70 (navy), #52b1ad (teal) + secundarios #001744 / #00af9b
   Filosofía: blanco dominante · degradados de marca · tipografía amplia
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ─── COLORES DE MARCA ─── */
  --c-navy:        #001a70;
  --c-navy-dk:     #001744;
  --c-navy-lt:     #233a8c;
  --c-teal:        #52b1ad;
  --c-teal-vivid:  #00af9b;
  --c-teal-dk:     #3a8e8a;
  --c-teal-lt:     #c1e3e1;

  /* ─── DEGRADADOS OFICIALES ─── */
  --grad-primary:    linear-gradient(135deg, #001a70 0%, #52b1ad 100%);
  --grad-reverse:    linear-gradient(135deg, #52b1ad 0%, #001a70 100%);
  --grad-soft:       linear-gradient(135deg, rgba(0,26,112,.04) 0%, rgba(82,177,173,.07) 100%);
  --grad-soft-rev:   linear-gradient(135deg, rgba(82,177,173,.06) 0%, rgba(0,26,112,.04) 100%);
  --grad-glow:       radial-gradient(circle at 80% 0%, rgba(82,177,173,.10), transparent 60%);
  --grad-vivid:      linear-gradient(135deg, #001744 0%, #00af9b 100%);

  /* ─── SUPERFICIES Y FONDOS ─── */
  --bg:           #ffffff;
  --bg-soft:      #fafbfc;
  --bg-hover:     #f5f7fb;
  --bg-active:    #eef2f9;
  --bg-elevated:  #ffffff;

  /* ─── BORDES ─── */
  --bd:           #eef0f5;
  --bd-strong:    #d8dde8;
  --bd-focus:     #52b1ad;

  /* ─── TIPOGRAFÍA: COLORES ─── */
  --tx-strong:    #0a1535;
  --tx:           #2e3247;
  --tx-muted:     #6b7280;
  --tx-subtle:    #9aa1b3;
  --tx-on-grad:   #ffffff;

  /* ─── ESTADOS ─── */
  --st-success:   #10b981;
  --st-success-bg:#d1fae5;
  --st-warning:   #f59e0b;
  --st-warning-bg:#fef3c7;
  --st-error:     #ef4444;
  --st-error-bg:  #fee2e2;
  --st-info:      #3b82f6;
  --st-info-bg:   #dbeafe;

  /* ─── ESPACIADO (escala 4x) ─── */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-7: 32px;  --sp-8: 40px;
  --sp-9: 56px;  --sp-10: 72px;

  /* ─── RADIO ─── */
  --r-xs: 6px;  --r-sm: 8px;  --r: 12px;  --r-md: 14px;
  --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;

  /* ─── SOMBRAS (suaves, basadas en navy) ─── */
  --sh-xs:  0 1px 2px rgba(0,26,112,.04);
  --sh-sm:  0 2px 6px rgba(0,26,112,.05), 0 1px 2px rgba(0,26,112,.04);
  --sh:     0 4px 14px rgba(0,26,112,.06), 0 2px 4px rgba(0,26,112,.04);
  --sh-md:  0 8px 24px rgba(0,26,112,.08);
  --sh-lg:  0 16px 40px rgba(0,26,112,.10);
  --sh-xl:  0 24px 60px rgba(0,26,112,.14);
  --sh-glow:0 8px 28px rgba(82,177,173,.30);
  --sh-glow-soft: 0 4px 14px rgba(82,177,173,.18);

  /* ─── TRANSICIONES ─── */
  --ease:     cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast:   150ms var(--ease);
  --t-norm:   220ms var(--ease);
  --t-slow:   400ms var(--ease);

  /* ─── TIPOGRAFÍA: FAMILIAS ─── */
  --ff-head:  'Nunito Sans', system-ui, -apple-system, sans-serif;
  --ff-body:  'Open Sans', system-ui, -apple-system, sans-serif;
  --ff-mono:  'SF Mono', Consolas, Monaco, monospace;

  /* ─── LAYOUT ─── */
  --sw: 264px;
  --topbar-h: 64px;

  /* ─── Z-INDEX ─── */
  --z-sb:    50;
  --z-top:   100;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* ═══════════════════════════════════════════════════════════════════
   RESET Y BASE
   ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--tx);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--ff-head); color: var(--tx-strong); font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-teal-dk); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }

::selection { background: rgba(82,177,173,.25); color: var(--tx-strong); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bd-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--c-teal); border: 2px solid transparent; background-clip: padding-box; }

/* ═══════════════════════════════════════════════════════════════════
   APP SHELL: SIDEBAR + MAIN
   ═══════════════════════════════════════════════════════════════════ */
.ns-app {
  display: flex; min-height: 100vh; background: var(--bg);
}

/* ─── SIDEBAR BLANCO ─── */
.ns-sb {
  width: var(--sw); flex-shrink: 0; background: var(--bg);
  border-right: 1px solid var(--bd);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: var(--z-sb);
  overflow: hidden;
}
.ns-sb__logo {
  padding: var(--sp-5) var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-3);
  border-bottom: 1px solid var(--bd);
}
.ns-sb__logo-mark {
  width: 40px; height: 40px; border-radius: var(--r);
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-head); font-weight: 900; font-size: 14px;
  color: var(--tx-on-grad); letter-spacing: -.02em;
  box-shadow: var(--sh-glow-soft);
  transition: transform var(--t-norm);
}
.ns-sb__logo-mark img { width: 100%; height: 100%; border-radius: var(--r); object-fit: cover; }
.ns-sb__logo:hover .ns-sb__logo-mark { transform: rotate(-4deg) scale(1.05); }
.ns-sb__logo-text { display: flex; flex-direction: column; min-width: 0; }
.ns-sb__brand {
  font-family: var(--ff-head); font-weight: 900; font-size: 13px;
  color: var(--c-navy); letter-spacing: -.01em;
}
.ns-sb__sub {
  font-size: 10.5px; color: var(--tx-subtle);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-top: 2px;
}

.ns-sb__emp {
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--bd);
  background: var(--grad-soft);
}
.ns-sb__emp-nm {
  font-family: var(--ff-head); font-size: 12.5px; font-weight: 800;
  color: var(--c-navy); line-height: 1.3;
}
.ns-sb__emp-nit {
  font-size: 10.5px; color: var(--tx-muted); margin-top: 2px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}

.ns-sb__nav {
  flex: 1; overflow-y: auto; padding: var(--sp-3) 0;
}
.ns-sb__sec {
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
  font-family: var(--ff-head); font-size: 9.5px; font-weight: 800;
  color: var(--tx-subtle); text-transform: uppercase; letter-spacing: .14em;
}

.ns-sb__item {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); margin: 1px var(--sp-3); border-radius: var(--r);
  font-family: var(--ff-head); font-size: 13px; font-weight: 600;
  color: var(--tx); cursor: pointer; user-select: none;
  transition: background var(--t-fast), color var(--t-fast), padding var(--t-fast);
}
.ns-sb__item::before {
  content: ''; position: absolute; left: 0; top: 50%;
  width: 3px; height: 0; background: var(--c-teal);
  border-radius: 0 99px 99px 0; transform: translateY(-50%);
  transition: height var(--t-norm) var(--ease-out);
}
.ns-sb__item:hover {
  background: var(--bg-hover); color: var(--c-navy);
}
.ns-sb__item.active {
  background: var(--grad-soft); color: var(--c-navy);
  font-weight: 800;
}
.ns-sb__item.active::before { height: 60%; }
.ns-sb__item-ic {
  width: 20px; height: 20px; flex-shrink: 0;
  color: var(--tx-muted); transition: color var(--t-fast);
}
.ns-sb__item:hover .ns-sb__item-ic,
.ns-sb__item.active .ns-sb__item-ic { color: var(--c-teal-dk); }
.ns-sb__item-ic svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ns-sb__foot {
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--bd);
  display: flex; align-items: center; gap: var(--sp-3);
}
.ns-sb__avatar {
  width: 36px; height: 36px; border-radius: var(--r);
  background: var(--grad-primary); color: var(--tx-on-grad);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-head); font-size: 12px; font-weight: 900;
  flex-shrink: 0; box-shadow: var(--sh-glow-soft);
}
.ns-sb__user { flex: 1; min-width: 0; }
.ns-sb__user-nm {
  font-family: var(--ff-head); font-size: 12px; font-weight: 800; color: var(--c-navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ns-sb__user-rl {
  font-size: 10.5px; color: var(--tx-muted); margin-top: 1px;
  text-transform: capitalize;
}
.ns-sb__logout {
  background: transparent; border: 1px solid var(--bd); border-radius: var(--r-sm);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--tx-muted); transition: all var(--t-fast);
}
.ns-sb__logout:hover { background: var(--st-error-bg); color: var(--st-error); border-color: transparent; }
.ns-sb__logout svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ─── MAIN ─── */
.ns-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}
.ns-top {
  height: var(--topbar-h); padding: 0 var(--sp-7);
  background: var(--bg); border-bottom: 1px solid var(--bd);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: var(--z-top); backdrop-filter: blur(8px);
}
.ns-top__title {
  font-family: var(--ff-head); font-size: 18px; font-weight: 900;
  color: var(--c-navy); letter-spacing: -.01em;
}
.ns-top__sub { font-size: 11.5px; color: var(--tx-muted); margin-top: 2px; }
.ns-top__right { display: flex; align-items: center; gap: var(--sp-3); }

.ns-content {
  flex: 1; padding: var(--sp-7) var(--sp-7);
  background: var(--bg); overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   BOTONES
   ═══════════════════════════════════════════════════════════════════ */
.ns-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--ff-head); font-weight: 700; font-size: 13px;
  padding: 10px 18px; border-radius: var(--r);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform var(--t-fast), box-shadow var(--t-norm), background var(--t-fast), border-color var(--t-fast);
  position: relative; overflow: hidden;
}
.ns-btn:active { transform: translateY(1px) scale(.99); }

.ns-btn--primary {
  background: var(--grad-primary); color: var(--tx-on-grad);
  box-shadow: var(--sh-glow-soft);
}
.ns-btn--primary:hover { box-shadow: var(--sh-glow); transform: translateY(-2px); }

.ns-btn--ghost {
  background: var(--bg); color: var(--c-navy);
  border: 1.5px solid var(--bd);
}
.ns-btn--ghost:hover { border-color: var(--c-teal); background: var(--bg-hover); }

.ns-btn--soft {
  background: var(--grad-soft); color: var(--c-navy);
  border: 1px solid transparent;
}
.ns-btn--soft:hover { border-color: var(--c-teal); }

.ns-btn--danger {
  background: var(--st-error-bg); color: var(--st-error);
  border: 1px solid rgba(239,68,68,.25);
}
.ns-btn--danger:hover { background: var(--st-error); color: white; border-color: transparent; }

.ns-btn--sm { font-size: 12px; padding: 7px 12px; border-radius: var(--r-sm); }
.ns-btn--xs { font-size: 11px; padding: 5px 10px; border-radius: var(--r-xs); }
.ns-btn--lg { font-size: 14px; padding: 14px 26px; }
.ns-btn--icon { padding: 8px; }
.ns-btn--icon svg { width: 16px; height: 16px; }

.ns-btn[disabled], .ns-btn:disabled { opacity: .5; cursor: not-allowed; }
.ns-btn[disabled]:hover { transform: none; box-shadow: var(--sh-glow-soft); }

/* ═══════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════ */
.ns-card {
  background: var(--bg); border: 1px solid var(--bd);
  border-radius: var(--r-md); overflow: hidden;
  transition: transform var(--t-norm), box-shadow var(--t-norm), border-color var(--t-fast);
}
.ns-card:hover { box-shadow: var(--sh); }

.ns-card--featured {
  position: relative; overflow: hidden;
}
.ns-card--featured::after {
  content: ''; position: absolute; top: 0; right: 0; width: 220px; height: 100%;
  background: var(--grad-soft); pointer-events: none;
  border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md);
}
.ns-card--featured > * { position: relative; z-index: 1; }

.ns-card--clickable { cursor: pointer; }
.ns-card--clickable:hover { transform: translateY(-2px); border-color: var(--c-teal-lt); box-shadow: var(--sh-md); }

.ns-card__head {
  padding: var(--sp-4) var(--sp-5);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  flex-wrap: wrap; border-bottom: 1px solid var(--bd);
}
.ns-card__title {
  font-family: var(--ff-head); font-size: 14px; font-weight: 800;
  color: var(--c-navy); letter-spacing: -.005em;
  display: flex; align-items: center; gap: var(--sp-2);
}
.ns-card__sub { font-size: 11.5px; color: var(--tx-muted); margin-top: 2px; font-weight: 500; }
.ns-card__body { padding: var(--sp-5); }

/* ─── KPI / STAT CARDS ─── */
.ns-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.ns-stat {
  background: var(--bg); border: 1px solid var(--bd); border-radius: var(--r-md);
  padding: var(--sp-5); display: flex; align-items: center; gap: var(--sp-4);
  transition: all var(--t-norm); position: relative; overflow: hidden;
}
.ns-stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 0;
  background: var(--grad-primary); pointer-events: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
  transition: height var(--t-norm) var(--ease-out);
}
.ns-stat:hover { transform: translateY(-2px); border-color: var(--c-teal-lt); box-shadow: var(--sh); }
.ns-stat:hover::before { height: 3px; }
.ns-stat__icon {
  width: 48px; height: 48px; border-radius: var(--r); flex-shrink: 0;
  background: var(--grad-soft); color: var(--c-teal-dk);
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
  transition: all var(--t-norm);
}
.ns-stat__icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ns-stat:hover .ns-stat__icon { background: var(--grad-primary); color: var(--tx-on-grad); transform: scale(1.05); }
.ns-stat__body { position: relative; z-index: 1; flex: 1; min-width: 0; }
.ns-stat__num {
  font-family: var(--ff-head); font-size: 28px; font-weight: 900;
  color: var(--c-navy); line-height: 1; letter-spacing: -.03em;
}
.ns-stat__lbl { font-size: 11.5px; color: var(--tx-muted); margin-top: 4px; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════
   FORMULARIOS
   ═══════════════════════════════════════════════════════════════════ */
.ns-fg { margin-bottom: var(--sp-4); }
.ns-fl {
  display: block; font-family: var(--ff-head); font-size: 11.5px; font-weight: 700;
  color: var(--c-navy); margin-bottom: 6px; letter-spacing: .01em;
}
.ns-fl--req::after { content: ' *'; color: var(--st-error); }
.ns-input, .ns-select, .ns-textarea {
  width: 100%; background: var(--bg);
  border: 1.5px solid var(--bd); border-radius: var(--r-sm);
  padding: 10px 14px; font-size: 13px; color: var(--tx);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.ns-input:hover, .ns-select:hover, .ns-textarea:hover { border-color: var(--bd-strong); }
.ns-input:focus, .ns-select:focus, .ns-textarea:focus {
  outline: none; border-color: var(--c-teal);
  box-shadow: 0 0 0 3px rgba(82,177,173,.15);
  background: var(--bg);
}
.ns-textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.ns-fhint { font-size: 11px; color: var(--tx-muted); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════ */
.ns-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--ff-head); font-size: 10px; font-weight: 800;
  padding: 3px 10px; border-radius: var(--r-pill);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.ns-badge--navy   { background: var(--grad-soft); color: var(--c-navy); }
.ns-badge--teal   { background: rgba(82,177,173,.14); color: var(--c-teal-dk); }
.ns-badge--ok     { background: var(--st-success-bg); color: var(--st-success); }
.ns-badge--warn   { background: var(--st-warning-bg); color: var(--st-warning); }
.ns-badge--err    { background: var(--st-error-bg); color: var(--st-error); }
.ns-badge--neutral{ background: #f1f5f9; color: #64748b; }
.ns-badge--dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ═══════════════════════════════════════════════════════════════════
   TABLAS
   ═══════════════════════════════════════════════════════════════════ */
.ns-tablewrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--bd); background: var(--bg); }
.ns-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.ns-table thead th {
  font-family: var(--ff-head); font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em; color: var(--tx-muted);
  text-align: left; padding: var(--sp-3) var(--sp-4); white-space: nowrap;
  background: var(--bg-soft); border-bottom: 1px solid var(--bd);
}
.ns-table tbody td {
  padding: var(--sp-3) var(--sp-4); font-size: 12.5px; color: var(--tx);
  border-bottom: 1px solid var(--bd); vertical-align: middle;
}
.ns-table tbody tr { transition: background var(--t-fast); }
.ns-table tbody tr:hover { background: var(--bg-hover); }
.ns-table tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════════════
   MODALES
   ═══════════════════════════════════════════════════════════════════ */
.ns-modal {
  position: fixed; inset: 0; background: rgba(0,23,68,.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal); display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; padding: var(--sp-4);
  transition: opacity var(--t-norm);
}
.ns-modal.open { opacity: 1; pointer-events: all; }
.ns-modal__box {
  background: var(--bg); border-radius: var(--r-lg);
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  transform: scale(.96) translateY(20px); opacity: 0;
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t-norm);
  box-shadow: var(--sh-xl);
}
.ns-modal.open .ns-modal__box { transform: scale(1) translateY(0); opacity: 1; }
.ns-modal__head {
  padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--bd);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.ns-modal__title {
  font-family: var(--ff-head); font-size: 17px; font-weight: 900; color: var(--c-navy); letter-spacing: -.01em;
}
.ns-modal__close {
  width: 32px; height: 32px; border-radius: var(--r-sm); background: transparent; color: var(--tx-muted);
  display: flex; align-items: center; justify-content: center; transition: all var(--t-fast);
}
.ns-modal__close:hover { background: var(--st-error-bg); color: var(--st-error); }
.ns-modal__body { padding: var(--sp-6); }
.ns-modal__foot {
  padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--bd);
  display: flex; gap: var(--sp-3); justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════ */
#ns-toast-container {
  position: fixed; top: var(--sp-5); right: var(--sp-5); z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.ns-toast {
  background: var(--bg); border: 1px solid var(--bd); border-left: 4px solid var(--c-teal);
  border-radius: var(--r); padding: var(--sp-3) var(--sp-4);
  font-size: 13px; font-weight: 600; color: var(--tx);
  box-shadow: var(--sh-md); min-width: 260px; max-width: 380px;
  animation: ns-toast-in .32s var(--ease-out);
}
.ns-toast-info  { border-left-color: var(--st-info); }
.ns-toast-ok    { border-left-color: var(--st-success); }
.ns-toast-warn  { border-left-color: var(--st-warning); }
.ns-toast-error { border-left-color: var(--st-error); }
@keyframes ns-toast-in {
  from { opacity: 0; transform: translateX(20px) scale(.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════
   ANIMACIONES Y MICROINTERACCIONES
   ═══════════════════════════════════════════════════════════════════ */
@keyframes ns-fadeup {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ns-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes ns-pop {
  0%   { opacity: 0; transform: scale(.92); }
  60%  { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes ns-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes ns-spin { to { transform: rotate(360deg); } }

.ns-anim-up    { animation: ns-fadeup .5s var(--ease-out) both; }
.ns-anim-fade  { animation: ns-fadein .4s var(--ease) both; }
.ns-anim-pop   { animation: ns-pop .42s var(--ease-out) both; }

/* Stagger entradas (clase aplicada al padre) */
.ns-stagger > * { animation: ns-fadeup .5s var(--ease-out) both; }
.ns-stagger > *:nth-child(1) { animation-delay: 40ms; }
.ns-stagger > *:nth-child(2) { animation-delay: 90ms; }
.ns-stagger > *:nth-child(3) { animation-delay: 140ms; }
.ns-stagger > *:nth-child(4) { animation-delay: 190ms; }
.ns-stagger > *:nth-child(5) { animation-delay: 240ms; }
.ns-stagger > *:nth-child(6) { animation-delay: 290ms; }
.ns-stagger > *:nth-child(7) { animation-delay: 340ms; }
.ns-stagger > *:nth-child(8) { animation-delay: 390ms; }
.ns-stagger > *:nth-child(n+9) { animation-delay: 440ms; }

/* Skeleton loader */
.ns-skel {
  background: linear-gradient(90deg, var(--bd) 0%, var(--bg-soft) 50%, var(--bd) 100%);
  background-size: 200% 100%; animation: ns-shimmer 1.4s infinite;
  border-radius: var(--r-sm); display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════════
   PORTAL: tarjetas de módulos
   ═══════════════════════════════════════════════════════════════════ */
.ns-modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-5); }
.ns-modcard {
  position: relative; background: var(--bg); border: 1px solid var(--bd);
  border-radius: var(--r-md); padding: var(--sp-5); min-height: 168px;
  display: flex; flex-direction: column; cursor: pointer;
  text-decoration: none; color: inherit;
  transition: transform var(--t-norm), box-shadow var(--t-norm), border-color var(--t-fast);
  overflow: hidden;
}
.ns-modcard::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 0;
  background: var(--grad-primary); pointer-events: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
  transition: height var(--t-norm) var(--ease-out);
}
.ns-modcard:not(.disabled):hover {
  transform: translateY(-4px); border-color: var(--c-teal-lt);
  box-shadow: var(--sh-md);
}
.ns-modcard:not(.disabled):hover::before { height: 4px; }
.ns-modcard.disabled { opacity: .55; cursor: not-allowed; }
.ns-modcard__icon {
  width: 44px; height: 44px; border-radius: var(--r);
  background: var(--grad-soft); color: var(--c-teal-dk);
  display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-4);
  position: relative; z-index: 1;
  transition: all var(--t-norm);
}
.ns-modcard__icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ns-modcard:not(.disabled):hover .ns-modcard__icon {
  background: var(--grad-primary); color: var(--tx-on-grad);
  transform: scale(1.06) rotate(-3deg); box-shadow: var(--sh-glow);
}
.ns-modcard__name {
  font-family: var(--ff-head); font-size: 16px; font-weight: 900;
  color: var(--c-navy); margin-bottom: var(--sp-1); position: relative; z-index: 1;
  letter-spacing: -.01em;
}
.ns-modcard__desc {
  font-size: 12.5px; color: var(--tx-muted); flex: 1; position: relative; z-index: 1;
  line-height: 1.5;
}
.ns-modcard__badge { margin-top: var(--sp-3); position: relative; z-index: 1; }

/* ═══════════════════════════════════════════════════════════════════
   LOADING / SPINNERS
   ═══════════════════════════════════════════════════════════════════ */
.ns-loader-fs {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  flex-direction: column; gap: var(--sp-4);
}
.ns-spin {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--bd); border-top-color: var(--c-teal);
  animation: ns-spin .8s linear infinite;
}
.ns-loader-fs__txt {
  font-family: var(--ff-head); color: var(--c-navy); font-weight: 700; font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════════
   LOADER GLOBAL CON LOGO LISSTOS
   - Aparece en cada navegación entre páginas
   - Se inserta automáticamente vía script
   ═══════════════════════════════════════════════════════════════════ */
#lst-page-loader {
  position: fixed; inset: 0; background: var(--bg); z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: var(--sp-5);
  opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
  background-image: radial-gradient(circle at 30% 30%, rgba(82,177,173,.08), transparent 50%),
                    radial-gradient(circle at 70% 70%, rgba(0,26,112,.06), transparent 50%);
}
#lst-page-loader.show { opacity: 1; pointer-events: all; }
#lst-page-loader.hide { opacity: 0; pointer-events: none; }
.lst-pl__logo {
  width: 320px; max-width: 80vw; height: auto;
  animation: lst-pl-pulse 1.6s var(--ease) infinite;
  filter: drop-shadow(0 16px 40px rgba(0,26,112,.18));
}
@keyframes lst-pl-pulse {
  0%, 100% { transform: scale(1); opacity: .75; }
  50%      { transform: scale(1.06); opacity: 1; }
}
.lst-pl__bar {
  width: 200px; height: 3px; border-radius: 99px;
  background: var(--bd); position: relative; overflow: hidden;
}
.lst-pl__bar::before {
  content: ''; position: absolute; left: -30%; top: 0; bottom: 0; width: 30%;
  background: var(--grad-primary); border-radius: 99px;
  animation: lst-pl-bar 1.4s var(--ease-out) infinite;
}
@keyframes lst-pl-bar {
  0%   { left: -30%; }
  100% { left: 100%; }
}
.lst-pl__txt {
  font-family: var(--ff-head); color: var(--c-navy);
  font-size: 12.5px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  opacity: .8;
}

/* ═══════════════════════════════════════════════════════════════════
   UTILIDADES
   ═══════════════════════════════════════════════════════════════════ */
.ns-hidden { display: none !important; }
.ns-flex { display: flex; }
.ns-grid { display: grid; }
.ns-row { display: flex; align-items: center; gap: var(--sp-3); }
.ns-row--between { justify-content: space-between; }
.ns-row--wrap { flex-wrap: wrap; }
.ns-text-strong { color: var(--tx-strong); font-weight: 700; }
.ns-text-muted  { color: var(--tx-muted); }
.ns-text-subtle { color: var(--tx-subtle); }
.ns-text-navy   { color: var(--c-navy); }
.ns-text-teal   { color: var(--c-teal-dk); }
.ns-text-grad   { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }

.ns-mt-2 { margin-top: var(--sp-2); }
.ns-mt-4 { margin-top: var(--sp-4); }
.ns-mt-6 { margin-top: var(--sp-6); }
.ns-mb-2 { margin-bottom: var(--sp-2); }
.ns-mb-4 { margin-bottom: var(--sp-4); }
.ns-mb-6 { margin-bottom: var(--sp-6); }

.ns-section-label {
  font-family: var(--ff-head); font-size: 10.5px; font-weight: 800;
  color: var(--tx-subtle); text-transform: uppercase; letter-spacing: .12em;
  margin-bottom: var(--sp-3);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sw: 240px; }
  .ns-content { padding: var(--sp-5); }
}
@media (max-width: 720px) {
  .ns-sb { width: 64px; }
  .ns-sb__brand, .ns-sb__sub, .ns-sb__emp, .ns-sb__sec, .ns-sb__item span:not(.ns-sb__item-ic), .ns-sb__user, .ns-sb__logo-text { display: none; }
  .ns-sb__item { justify-content: center; }
  .ns-content { padding: var(--sp-4); }
}
