/* =========================================
   GRUPO BANDE — Tesoreria
   Sistema visual compartido con Procura (compras_mvc)
   -----------------------------------------
   DESIGN TOKENS (single source of truth)
   - Cambia la marca ajustando solo los tokens
     primitivos (--gray-*, --brand-*) o los
     alias semanticos (--color-*).
   - Las reglas del archivo usan los alias,
     nunca hex directos. Si encuentras un hex
     suelto, prefiere migrarlo a un token.
   ========================================= */

/* ── TIPOGRAFIA: Inter Variable (self-hosted) ── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/InterVariable.woff2') format('woff2-variations'),
       url('../fonts/InterVariable.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/InterVariable-Italic.woff2') format('woff2-variations'),
       url('../fonts/InterVariable-Italic.woff2') format('woff2');
}

:root {
  /* ── Color primitivos ── */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-300: #93c5fd;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;

  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #15803d;
  --green-700: #166534;
  --red-100:   #fee2e2;
  --red-500:   #ef4444;
  --red-600:   #b91c1c;
  --red-700:   #991b1b;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #b45309;
  --amber-700: #92400e;
  --sky-100:   #e0f2fe;
  --sky-600:   #0369a1;
  --violet-100:#ede9fe;
  --violet-600:#6d28d9;

  /* ── Color semantico (uso diario) ── */
  --color-bg:            #f0f4f8;
  --color-surface:       #ffffff;
  --color-surface-2:     var(--gray-50);
  --color-surface-3:     var(--gray-100);
  --color-border:        var(--gray-200);
  --color-border-strong: var(--gray-300);

  --color-text:          var(--gray-900);
  --color-text-muted:    var(--gray-500);
  --color-text-subtle:   var(--gray-400);
  --color-text-on-brand: #ffffff;

  --color-brand:         var(--brand-800);
  --color-brand-hover:   var(--brand-900);
  --color-brand-soft:    var(--brand-100);
  --color-brand-mid:     var(--brand-500);

  --color-success:        var(--green-600);
  --color-success-bg:     var(--green-100);
  --color-success-strong: var(--green-700);
  --color-danger:         var(--red-600);
  --color-danger-bg:      var(--red-100);
  --color-danger-strong:  var(--red-700);
  --color-warning:        var(--amber-600);
  --color-warning-bg:     var(--amber-100);
  --color-warning-strong: var(--amber-700);
  --color-info:           var(--sky-600);
  --color-info-bg:        var(--sky-100);

  /* ── Aliases legacy (no romper reglas existentes) ── */
  --bg:            var(--color-bg);
  --card:          var(--color-surface);
  --text:          var(--color-text);
  --muted:         var(--color-text-muted);
  --border:        var(--color-border);
  --primary:       var(--color-brand);
  --primary-dark:  var(--color-brand-hover);
  --primary-light: var(--color-brand-soft);
  --primary-mid:   var(--color-brand-mid);
  --success:       var(--color-success);
  --success-bg:    var(--color-success-bg);
  --danger:        var(--color-danger);
  --danger-bg:     var(--color-danger-bg);
  --warning:       var(--color-warning);
  --warning-bg:    var(--color-warning-bg);
  --info:          var(--color-info);
  --info-bg:       var(--color-info-bg);

  /* ── Sidebar ── */
  --sidebar-bg:     var(--gray-900);
  --sidebar-active: var(--brand-700);
  --sidebar-hover:  rgba(255,255,255,.07);
  --sidebar-text:   rgba(255,255,255,.82);

  /* ── Spacing (escala 4 → 64) ── */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* ── Radius ── */
  --radius-xs:    6px;
  --radius-sm:    8px;
  --radius-md:    10px;
  --radius-lg:    12px;
  --radius-xl:    14px;
  --radius-2xl:   18px;
  --radius-pill:  999px;
  --radius-circle: 50%;
  --radius:     var(--radius-xl);  /* alias legacy */

  /* ── Elevation ── */
  --shadow-xs:     0 1px 2px  rgba(15,23,42,.06);
  --shadow-sm:     0 1px 3px  rgba(15,23,42,.10);
  --shadow-md:     0 4px 14px rgba(15,23,42,.08);
  --shadow-lg:     0 8px 24px rgba(15,23,42,.10);
  --shadow-xl:     0 18px 40px rgba(15,23,42,.16);
  --shadow-2xl:    0 30px 70px rgba(15,23,42,.28);
  --shadow-brand:        0 6px 18px rgba(30,64,175,.18);
  --shadow-brand-strong: 0 8px 24px rgba(30,64,175,.32);
  --shadow-focus:        0 0 0 3px rgba(30,64,175,.20);
  --shadow:        var(--shadow-md);   /* alias legacy */

  /* ── Type scale (6 niveles + display) ──
     base = body, escala armonica para evitar 19 tamanos sueltos. */
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-family-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-feature-default: "cv11", "ss01", "ss03";   /* alt 1/I y geometria mejor para UI */
  --font-feature-tabular: "tnum", "cv11";           /* cifras tabulares para columnas $ */

  --text-xs:      0.75rem;   /* 12px — chips, badges, captions */
  --text-sm:      0.875rem;  /* 14px — secundario, helper text */
  --text-base:    1rem;      /* 15-16px — cuerpo */
  --text-lg:      1.25rem;   /* 20px — h4, section titles */
  --text-xl:      1.625rem;  /* 26px — h2 / h3 */
  --text-display: 2.125rem;  /* 34px — h1 / hero */

  /* Line-heights coherentes */
  --leading-tight:    1.2;    /* titulos */
  --leading-snug:     1.35;   /* subtitulos */
  --leading-normal:   1.55;   /* cuerpo */
  --leading-relaxed:  1.7;    /* long-form */

  /* Weights */
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semibold:600;
  --weight-bold:    700;
  --weight-black:   800;

  /* Letter-spacing */
  --tracking-tight:   -0.018em;   /* titulos grandes */
  --tracking-normal:   0;
  --tracking-wide:     0.04em;
  --tracking-eyebrow:  0.12em;    /* eyebrows en MAYUSCULAS */

  /* Aliases legacy (no romper rules viejas) */
  --text-md:  var(--text-base);
  --text-2xl: var(--text-xl);
  --text-3xl: var(--text-display);
  --text-4xl: var(--text-display);
  --weight-normal: var(--weight-regular);

  /* ── Motion ── */
  --duration-fast:  120ms;
  --duration-base:  180ms;
  --duration-slow:  250ms;
  --ease:           cubic-bezier(.4, 0, .2, 1);
  --ease-out:       cubic-bezier(.16, 1, .3, 1);
  --transition-base: all var(--duration-base) var(--ease);

  /* ── Layout / z-index ── */
  --nav-h: 66px;
  --side-w: 220px;
  --side-w-collapsed: 72px;
  --container-max: 1440px;
  --z-base:    1;
  --z-sticky:  20;
  --z-nav:     50;
  --z-overlay: 80;
  --z-modal:   100;
  --z-toast:   120;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family-sans);
  font-feature-settings: var(--font-feature-default);
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
}

/* ── Headings (escala consistente) ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-sans);
  color: var(--color-text);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}
h1 { font-size: var(--text-display); font-weight: var(--weight-black); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-normal); }
h5 { font-size: var(--text-sm); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-normal); text-transform: none; }
h6 {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--color-text-muted);
}

p { line-height: var(--leading-normal); }
small { font-size: var(--text-sm); }

/* Cifras tabulares en columnas monetarias y stats numericos */
.format-money,
.money,
.tabular,
.stat-number,
table td,
table th { font-variant-numeric: tabular-nums; font-feature-settings: var(--font-feature-tabular); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* === NAVBAR (top) === */
.navbar,
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 14px;
  box-shadow: 0 1px 10px rgba(15,23,42,.06);
}

.menu-btn,
.hamburger {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  width: 40px; height: 40px;
  display: none;
  align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  color: var(--text);
  font-size: .82rem;
  padding: 0;
}
.hamburger { flex-direction: column; gap: 5px; }
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; }

.sidebar-collapse-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  padding: 0;
  box-shadow: none;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
}
.sidebar-collapse-toggle:hover {
  background: var(--gray-50);
  border-color: var(--brand-200);
  color: var(--primary);
  transform: translateY(-1px);
}
.sidebar-collapse-toggle svg {
  width: 19px;
  height: 19px;
}
.sidebar-collapse-toggle .collapse-icon-right { display: none; }
body.sidebar-collapsed .sidebar-collapse-toggle .collapse-icon-left { display: none; }
body.sidebar-collapsed .sidebar-collapse-toggle .collapse-icon-right { display: block; }

.navbar-brand,
.topbar-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 800; color: var(--primary);
  flex-shrink: 0; text-decoration: none;
}
.navbar-brand:hover { text-decoration: none; }

.topbar-title { color: var(--text); }
.topbar-title strong { font-size: .98rem; }
.topbar-title span { color: var(--muted); font-weight: 500; font-size: .78rem; margin-left: 6px; }

.navbar-brand-mark,
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .04em;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(30,64,175,.22);
}

.brand {
  display: flex; align-items: center; gap: 12px;
}
.brand.center { justify-content: center; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 1rem; color: inherit; }
.brand-copy small { color: var(--muted); font-size: .78rem; }

.nav-spacer,
.topbar-spacer { flex: 1; }

.nav-context-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 1 230px;
    max-width: 230px;
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--brand-50), var(--gray-50));
    border: 1px solid var(--brand-100);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
    color: var(--text);
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.nav-context-chip:hover {
    text-decoration: none;
    border-color: var(--brand-300);
    box-shadow: 0 6px 18px rgba(30,64,175,.12);
    transform: translateY(-1px);
}
.nav-context-item { display: grid; gap: 1px; min-width: 0; width: 100%; }
.nav-context-label {
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--primary);
}
.nav-context-value {
    font-size: .82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-context-meta {
    display: block;
    font-size: .65rem;
    color: var(--brand-400);
    letter-spacing: .02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.usd-ref {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: var(--success-bg);
    color: var(--success);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .02em;
}

/* === Bloque "Por cobrar / Por pagar" === */
.loan-summary .dash-section-head { margin-bottom: 16px; }
.loan-summary-block {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    display: grid;
    gap: 10px;
    align-content: start;
}
.loan-summary-block header { display: grid; gap: 2px; }
.loan-summary-block header strong { font-size: .95rem; }
.loan-summary-block header small { font-size: .78rem; line-height: 1.45; }
.loan-summary-block--in {
    border-color: rgba(21,128,61,.22);
    background: linear-gradient(180deg, var(--success-bg) 0%, #fff 65%);
}
.loan-summary-block--out {
    border-color: rgba(185,28,28,.22);
    background: linear-gradient(180deg, var(--danger-bg) 0%, #fff 65%);
}
.loan-summary-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
}
.loan-summary-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(15,23,42,.08);
    font-weight: 600;
}
.loan-summary-list li:last-child { border-bottom: 0; }
.loan-summary-amount { font-size: 1.02rem; letter-spacing: -.01em; }

/* === Preview CSV en /reconciliation/create === */
.recon-preview {
    margin-top: 6px;
    padding: 16px;
    border: 1px solid var(--brand-200);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, var(--primary-light), #fff 50%);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}
.recon-preview .table-wrap {
    overflow-x: auto;
    max-width: 100%;
    border-radius: var(--radius-sm);
    background: #fff;
}
.recon-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.recon-preview-head strong {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-right: 8px;
}
.recon-preview-table {
    font-size: .82rem;
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}
.recon-preview-table th,
.recon-preview-table td {
    padding: 8px 10px;
    vertical-align: top;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}
.recon-preview-table th {
    text-transform: none;
    font-size: .76rem;
    letter-spacing: .02em;
    background: #fff;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.recon-preview-meta-row th {
    background: transparent;
    padding-bottom: 4px;
    border-bottom: 0;
}
.recon-preview-tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.recon-preview-mapped {
    background: rgba(219, 234, 254, .35);
}
.recon-preview-table td {
    border-bottom: 1px solid #eef2f7;
}
.recon-preview-table tbody tr:last-child td { border-bottom: 0; }

/* === Conciliacion bancaria === */
.recon-progress {
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-bottom: 4px;
    max-width: 160px;
}
.recon-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-600), var(--success));
    border-radius: var(--radius-pill);
    transition: width .25s ease;
}

.recon-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}
.recon-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 22px;
}
.recon-overview .card {
    margin-bottom: 0;
}
.recon-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.recon-section-head h2 { margin: 0; font-size: 1.02rem; font-weight: 700; }

.recon-table { font-size: .88rem; }
.recon-table th { padding: 10px 10px; font-size: .68rem; }
.recon-table td { padding: 12px 10px; vertical-align: top; }
.recon-desc { font-weight: 600; line-height: 1.35; }
.recon-link {
    margin-top: 4px;
    padding: 5px 8px;
    background: var(--success-bg);
    color: var(--success);
    border-radius: var(--radius-sm);
    font-size: .76rem;
    line-height: 1.4;
}
.recon-link .badge { margin-left: 6px; font-size: .62rem; padding: 1px 7px; }
.recon-row--conciliado { background: rgba(220, 252, 231, .25); }
.recon-row--ignorado   { background: rgba(241, 245, 249, .55); color: var(--muted); }
.recon-insight {
    display: grid;
    gap: 14px;
}
.recon-delta {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--gray-50);
}
.recon-delta strong {
    font-size: 1.55rem;
    letter-spacing: -.02em;
}
.recon-delta.is-ok {
    background: rgba(220, 252, 231, .45);
    border-color: var(--green-100);
}
.recon-delta.is-warning {
    background: rgba(254, 249, 195, .45);
    border-color: var(--amber-100);
}
.recon-summary-list {
    display: grid;
    gap: 10px;
}
.recon-summary-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
}
.recon-summary-row strong {
    display: block;
    font-size: .92rem;
}
.recon-summary-row small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.4;
}
.recon-suggestion-table td {
    vertical-align: top;
}

.recon-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    min-width: 220px;
}
.recon-match-form {
    display: flex;
    gap: 6px;
    align-items: center;
}
.recon-match-form select {
    padding: 6px 8px;
    font-size: .82rem;
    min-width: 0;
    flex: 1;
}
.recon-match-form .btn { flex-shrink: 0; }

@media (max-width: 1100px) {
    .recon-layout { grid-template-columns: 1fr; }
    .recon-overview { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .recon-actions { min-width: 0; }
    .recon-match-form { flex-direction: column; align-items: stretch; }
}

/* === CTA Saldos iniciales (en Configuracion) === */
.opening-cta {
    background: linear-gradient(135deg, var(--primary-light), #fff 70%);
    border-color: var(--brand-200);
}
.opening-cta-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.opening-cta-body h3 {
    margin: 0 0 4px;
    font-size: 1.02rem;
    font-weight: 700;
}
.opening-cta-body p {
    margin: 0;
    max-width: 70ch;
    font-size: .88rem;
    line-height: 1.55;
}
.opening-cta-body .btn { flex-shrink: 0; }

/* === Saldos iniciales === */
.opening-notes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.opening-notes article {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow);
    display: grid;
    gap: 4px;
    align-content: start;
}
.opening-notes article strong { font-size: .92rem; }
.opening-notes article p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.opening-notes article em { font-style: normal; color: var(--primary); font-weight: 700; }

.opening-block + .opening-block { margin-top: 18px; }
.opening-block > h3 {
    margin: 4px 0 10px;
    font-size: .98rem;
    font-weight: 700;
    color: var(--text);
}
.opening-table { table-layout: fixed; width: 100%; }
.opening-table .col-medio  { width: 30%; }
.opening-table .col-moneda { width: 10%; }
.opening-table .col-saldo  { width: 18%; }
.opening-table .col-monto  { width: 24%; }
.opening-table td,
.opening-table th { vertical-align: middle; }
.opening-table input[type="number"] {
    padding: 9px 11px;
    font-size: .9rem;
    text-align: right;
}

@media (max-width: 900px) {
    .opening-notes { grid-template-columns: 1fr; }
    .opening-table { table-layout: auto; }
    .opening-table .col-medio,
    .opening-table .col-moneda,
    .opening-table .col-saldo,
    .opening-table .col-monto { width: auto; }
}

/* === Chip para movimientos generados por prestamo === */
.movement-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--violet-100);
    color: var(--violet-600);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    vertical-align: middle;
}
.movement-tag--in {
    background: var(--success-bg);
    color: var(--success);
}
.movement-tag--out {
    background: var(--danger-bg);
    color: var(--danger);
}

.nav-user {
  display: flex; align-items: center; gap: 12px;
}
.avatar {
  width: 38px; height: 38px; border-radius: var(--radius-circle);
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .82rem; flex-shrink: 0;
  letter-spacing: .02em;
}
.nav-info { display: flex; flex-direction: column; line-height: 1.3; }
.nav-name { font-size: .88rem; font-weight: 700; }
.nav-role { font-size: .74rem; color: var(--muted); }

.logout-form,
.nav-logout-form { display: inline-flex; flex-shrink: 0; margin-left: 4px; }
.nav-logout {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 0; appearance: none;
  background: var(--danger-bg); color: var(--danger);
  font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: background .18s ease;
}
.nav-logout:hover { background: var(--red-100); color: var(--danger); text-decoration: none; }
.nav-logout svg { width: 15px; height: 15px; }

/* === SIDEBAR === */
.sidebar {
  position: fixed; top: var(--nav-h); left: 0; bottom: 0;
  width: var(--side-w); z-index: 40;
  background: linear-gradient(180deg, #111827 0%, var(--gray-900) 100%);
  border-right: 1px solid rgba(255,255,255,.04);
  overflow-y: auto; padding: 12px 8px 22px;
  transition: transform .25s ease, width .22s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.55) rgba(255,255,255,.04);
  color: var(--sidebar-text);
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: var(--radius-pill); }
.sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(148,163,184,.62), rgba(100,116,139,.82));
  border-radius: var(--radius-pill);
  border: 2px solid rgba(15,23,42,.72);
}

.sidebar-brand {
  display: none;
}

.sidebar-section,
.nav-section {
  padding: 12px 10px 5px;
  margin: 0;
  font-size: .66rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: rgba(148,163,184,.62);
}
.sidebar-section:first-child,
.nav-section:first-child { padding-top: 4px; }

.sidebar-link,
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin: 2px 3px;
  padding: 9px 11px;
  border-radius: var(--radius-lg);
  color: rgba(255,255,255,.88);
  font-size: .86rem; font-weight: 600;
  text-decoration: none;
  background: transparent;
  border: 0;
  transition: background .18s, color .18s, transform .18s, box-shadow .18s;
  line-height: 1.35;
}
.sidebar-link svg,
.nav a svg {
  width: 18px; height: 18px; flex-shrink: 0;
  opacity: .72;
  color: rgba(191,219,254,.86);
}
.sidebar-link:hover,
.nav a:hover {
  background: rgba(255,255,255,.055);
  color: #fff;
  text-decoration: none;
  transform: translateX(2px);
}
.sidebar-link:hover svg,
.nav a:hover svg { opacity: 1; }
.sidebar-link.active,
.nav a.active {
  background: linear-gradient(135deg, var(--brand-600) 0%, #3156d3 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37,99,235,.26);
}
.sidebar-link.active::before,
.nav a.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.92);
}
.sidebar-link.active svg,
.nav a.active svg { opacity: 1; }

body.sidebar-collapsed .sidebar {
  width: var(--side-w-collapsed);
  padding-left: 8px;
  padding-right: 8px;
  overflow-x: hidden;
}

body.sidebar-collapsed .content,
body.sidebar-collapsed .app-footer {
  margin-left: var(--side-w-collapsed);
}

body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .nav-section {
  position: relative;
  height: 18px;
  margin: 10px 0 4px;
  padding: 0;
  color: transparent;
  font-size: 0;
}

body.sidebar-collapsed .sidebar-section::before,
body.sidebar-collapsed .nav-section::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 1px;
  border-radius: var(--radius-pill);
  background: rgba(148,163,184,.42);
  transform: translate(-50%, -50%);
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .nav a {
  width: 46px;
  height: 46px;
  margin: 2px auto;
  padding: 0;
  justify-content: center;
  gap: 0;
  font-size: 0;
  line-height: 0;
}

body.sidebar-collapsed .sidebar-link svg,
body.sidebar-collapsed .nav a svg {
  width: 20px;
  height: 20px;
}

body.sidebar-collapsed .sidebar-link:hover,
body.sidebar-collapsed .nav a:hover {
  transform: translateY(-1px);
}

body.sidebar-collapsed .sidebar-link.active::before,
body.sidebar-collapsed .nav a.active::before {
  left: -8px;
  top: 12px;
  bottom: 12px;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 35;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

body.modal-open { overflow: hidden; }

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}
.app-modal[hidden] { display: none; }
.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .68);
  backdrop-filter: blur(4px);
}
.app-modal-panel {
  position: relative;
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 20px;
  box-shadow: var(--shadow-2xl);
  padding: 56px 18px 18px;
}
.app-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gray-600);
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  z-index: 2;
}
.app-modal-close:hover {
  background: transparent;
  color: var(--gray-900);
  transform: none;
}
.app-modal-close svg {
  width: 22px;
  height: 22px;
  display: block;
}
.app-modal-status {
  display: none;
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: var(--radius-lg);
  font-size: .9rem;
  line-height: 1.45;
}
.app-modal-status.is-visible { display: block; }
.app-modal-status.is-error {
  background: #fef2f2;
  color: var(--red-700);
  border: 1px solid var(--red-100);
}
.app-modal-status.is-success {
  background: #f0fdf4;
  color: var(--green-700);
  border: 1px solid var(--green-100);
}
.app-modal-body {
  margin-top: 12px;
}
.app-modal-body .page-header {
  margin-bottom: 18px;
}
.app-modal-body .card {
  box-shadow: none;
}
.app-modal-body .form-actions {
  margin-top: 8px;
}

.movement-modal-shell {
  display: grid;
  gap: 18px;
}
.movement-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.movement-modal-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.movement-modal-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
  color: var(--primary);
  transition: background .2s, color .2s;
}
.movement-modal-icon svg { width: 22px; height: 22px; }
.movement-modal-shell[data-tipo="entrada"] .movement-modal-icon {
  background: var(--success-bg);
  color: var(--success);
}
.movement-modal-shell[data-tipo="salida"] .movement-modal-icon {
  background: var(--danger-bg);
  color: var(--danger);
}
.movement-modal-head h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
.movement-modal-head p {
  margin: 3px 0 0;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.45;
}

.movement-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--gray-50), #fff);
  white-space: nowrap;
}
.movement-balance-pill-label {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.movement-balance-pill-currency {
  font-size: .72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--primary-light);
  color: var(--primary);
  letter-spacing: .04em;
}
.movement-balance-pill strong {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
}

.movement-form {
  display: grid;
  gap: 16px;
}
.movement-type-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.movement-field-label {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.movement-hidden-select {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.movement-type-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: var(--gray-100);
  border: 1px solid var(--border);
  gap: 4px;
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 700;
  font-family: inherit;
  background: transparent;
  color: var(--muted);
  border: 0;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg-btn svg { width: 14px; height: 14px; }
.seg-btn:hover {
  background: var(--gray-200);
  color: var(--text);
}
.seg-btn.is-active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.12);
}
.seg-btn.seg-entrada.is-active {
  color: var(--success);
}
.seg-btn.seg-salida.is-active {
  color: var(--danger);
}

.movement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.movement-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.movement-grid-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
}
.movement-grid-label .req {
  color: var(--danger);
  font-weight: 800;
}
.movement-grid label.wide { grid-column: 1 / -1; }
.movement-grid input,
.movement-grid select,
.movement-grid textarea {
  width: 100%;
  font-size: .9rem;
  color: var(--text);
}
.movement-grid textarea { resize: vertical; min-height: 64px; }

.movement-amount-field input[name="amount"] {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
.movement-amount-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.chip-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--gray-100);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip-btn:hover {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
}

.movement-balance-note {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  margin-left: auto;
}
.movement-balance-note:empty { display: none; }
.movement-balance-note.is-ok {
  color: var(--success);
  background: var(--success-bg);
}
.movement-balance-note.is-warning {
  color: var(--danger);
  background: var(--danger-bg);
}

.movement-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* === MAIN CONTENT === */
.main { display: contents; }

.content {
  margin-left: var(--side-w);
  padding: calc(var(--nav-h) + 22px) 28px 28px;
  min-height: 100vh;
  width: auto;
  transition: margin-left .22s ease;
}

.app-shell { min-height: 100vh; }
body.app-body { min-height: 100vh; }

/* === PAGE HEADER === */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-eyebrow {
  display: inline-block;
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--primary); margin-bottom: 3px;
}
.page-header h1 { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin: 0; }
.page-header p { margin: .35rem 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* === DASHBOARD HERO === */
.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.9fr);
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-hero-main { display: grid; gap: 10px; }
.dash-hero h1 { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.dash-hero p { margin: 0; color: var(--muted); max-width: 60ch; }
.dash-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .85rem; }
.dash-meta span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius-pill);
  background: var(--gray-100); border: 1px solid var(--gray-200);
}
.dash-meta strong { color: var(--text); }

.dash-hero-card {
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 8px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--primary-light), #fff);
  border: 1px solid var(--brand-100);
}
.dash-hero-card-label {
  color: var(--primary);
  font-size: .72rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
}
.dash-hero-card-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; }
.dash-hero-card p { margin: 0; color: var(--muted); }
.dash-meta--card { margin-top: 2px; }

.dash-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.dash-section-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.dash-actions { margin-bottom: 22px; }

/* === DASHBOARD KPI + CHARTS === */
.kpi-grid { margin-bottom: 22px; }
.kpi-card {
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 112px;
  height: 112px;
  border-radius: var(--radius-circle);
  background: radial-gradient(circle, rgba(37,99,235,.18) 0%, rgba(37,99,235,0) 68%);
  pointer-events: none;
}
.kpi-card strong {
  font-size: 1.55rem;
  letter-spacing: -.03em;
}
.kpi-card small {
  position: relative;
  z-index: 1;
  line-height: 1.45;
}

/* === DESGLOSE MULTIMONEDA === */
.cb-stack {
  display: grid;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.cb-stack.cb-empty {
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}
.cb-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.cb-cur {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  min-width: 22px;
}
.cb-val {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.dash-hero-card .cb-val { font-size: 1.55rem; }
.kpi-card .cb-val { font-size: 1.2rem; }
.cb-eq {
  font-size: .78rem;
  color: var(--muted);
  padding-top: 4px;
  border-top: 1px dashed var(--gray-200);
  margin-top: 2px;
}

/* === BADGE DE MONEDA === */
.currency-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
}
.currency-badge.currency-usd {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.currency-badge.currency-eur {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
}
.currency-badge.currency-ves {
  background: var(--amber-100);
  border-color: var(--amber-100);
  color: var(--amber-700);
}

.badge.tracking-pendiente {
  background: var(--amber-100);
  color: var(--amber-700);
}
.badge.tracking-confirmado {
  background: var(--brand-50);
  color: var(--brand-700);
}
.badge.tracking-conciliado {
  background: var(--success-bg);
  color: var(--green-700);
}
.badge.tracking-observado {
  background: var(--danger-bg);
  color: var(--danger);
}

.movement-dossier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  align-items: start;
}

.movement-dossier-main,
.movement-dossier-editor {
  display: grid;
  gap: 18px;
}

.movement-dossier-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.movement-dossier-head > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.movement-dossier-head > strong {
  font-size: 1.35rem;
  color: var(--text);
  white-space: nowrap;
}

.movement-dossier-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.movement-dossier-facts div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.movement-dossier-facts span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.movement-dossier-facts strong {
  color: var(--text);
  font-size: .92rem;
}

.movement-dossier-section {
  display: grid;
  gap: 10px;
}

.movement-dossier-section h2,
.movement-dossier-editor h2 {
  margin: 0;
  font-size: 1rem;
}

.movement-dossier-section p {
  margin: 0;
  color: var(--muted);
}

.movements-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.movements-quick-search {
  width: min(100%, 420px);
}

.movements-quick-search input {
  width: 100%;
}

.movement-attachments-list {
  display: grid;
  gap: 10px;
}

.movement-attachments-list a {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.movement-attachments-list small {
  color: var(--muted);
}

.currency-radio-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.currency-radio-option + .currency-radio-option {
  margin-top: 12px;
}

.currency-radio-option:hover,
.currency-radio-option:focus-within {
  border-color: var(--brand-300);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.currency-radio-option input[type="radio"] {
  margin-top: 3px;
}

.currency-radio-option span {
  display: grid;
  gap: 4px;
}

.currency-radio-option strong {
  font-size: .98rem;
  color: var(--text);
}

.currency-radio-option small {
  color: var(--muted);
  line-height: 1.45;
}

.currency-radio-option-custom input[type="number"] {
  margin-top: 10px;
  max-width: 240px;
}

.currency-radio-option.is-disabled {
  opacity: .68;
  background: var(--gray-50);
}

.dashboard-charts {
  margin-bottom: 22px;
}
.dashboard-chart-toolbar {
  margin-bottom: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.chart-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chart-currency-control {
  display: grid;
  gap: 6px;
  min-width: 210px;
}
.chart-currency-control span {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.chart-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 390px;
}
.chart-card.wide {
  min-height: 410px;
}
.chart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.chart-card-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}
.chart-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}
.chart-card-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--gray-50);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.chart-canvas-wrap {
  position: relative;
  min-height: 310px;
}
.chart-card.wide .chart-canvas-wrap {
  min-height: 325px;
}
.chart-canvas-wrap canvas {
  max-width: 100%;
  max-height: 100%;
}

/* === REPORTS DASHBOARD === */
.position-panel {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--gray-900) 0%, var(--gray-800) 100%);
  color: var(--gray-100);
  box-shadow: var(--shadow-xl);
}
.position-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.position-panel-head .page-eyebrow {
  color: var(--brand-300);
  margin-bottom: 4px;
}
.position-panel-head h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.position-panel-head p {
  margin: 4px 0 0;
  color: var(--gray-300);
  font-size: .86rem;
  max-width: 60ch;
}
.position-panel-total {
  text-align: right;
  display: grid;
  gap: 2px;
}
.position-panel-total span {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-300);
}
.position-panel-total strong {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.position-panel-total small {
  color: var(--gray-400);
  font-size: .78rem;
}

.position-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.position-card {
  padding: 18px;
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  display: grid;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.position-card::after {
  content: '';
  position: absolute;
  inset: auto -40px -40px auto;
  width: 140px;
  height: 140px;
  border-radius: var(--radius-circle);
  opacity: .25;
  pointer-events: none;
}
.position-card-ves::after { background: radial-gradient(circle, var(--brand-400) 0%, transparent 70%); }
.position-card-usd::after { background: radial-gradient(circle, #34d399 0%, transparent 70%); }
.position-card-eur::after { background: radial-gradient(circle, #a78bfa 0%, transparent 70%); }
.position-card-ves { border-color: rgba(96,165,250,.35); }
.position-card-usd { border-color: rgba(52,211,153,.35); }
.position-card-eur { border-color: rgba(167,139,250,.35); }
.position-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
}
.position-card-symbol {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  background: rgba(255,255,255,.12);
}
.position-card-ves .position-card-symbol { background: rgba(96,165,250,.18); color: var(--brand-300); }
.position-card-usd .position-card-symbol { background: rgba(52,211,153,.18); color: #6ee7b7; }
.position-card-eur .position-card-symbol { background: rgba(167,139,250,.18); color: #c4b5fd; }
.position-card-code {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--gray-300);
}
.position-card-amount {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
  z-index: 1;
}
.position-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: .78rem;
  color: var(--gray-300);
  z-index: 1;
}
.position-card-eq {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,.08);
  font-weight: 600;
}
.position-card-eq-inline {
  justify-self: start;
  margin-top: -6px;
  color: var(--gray-200);
  z-index: 1;
}

/* === CURRENCY MATRIX === */
.currency-matrix {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.currency-matrix-head {
  padding: 12px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
}
.currency-matrix-head h3 {
  margin: 0;
  font-size: .9rem;
  font-weight: 800;
}
.currency-matrix-head small {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-top: 2px;
}
.matrix-table { font-size: .88rem; }
.matrix-table th {
  padding: 10px 12px;
  font-size: .68rem;
}
.matrix-table td {
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}
.matrix-table td.matrix-empty {
  color: var(--gray-300);
  font-weight: 600;
}
.matrix-table td.matrix-total {
  font-weight: 800;
  background: var(--gray-50);
}
.matrix-table tfoot td {
  background: var(--gray-100);
  font-weight: 700;
  border-top: 1.5px solid var(--border);
  font-size: .82rem;
}
.matrix-table tfoot td.matrix-grand {
  color: var(--primary);
}
.matrix-currency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.matrix-currency em {
  font-style: normal;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--gray-100);
  color: var(--muted);
}
.matrix-currency-ves em { background: var(--primary-light); color: var(--brand-800); }
.matrix-currency-usd em { background: var(--success-bg); color: var(--green-700); }
.matrix-currency-eur em { background: var(--violet-100); color: var(--violet-600); }

.rate-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--brand-100);
  background: linear-gradient(180deg, var(--brand-50), #fff);
}
.rate-strip-label {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
}
.rate-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--gray-300);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}
.rate-chip strong {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--primary-light);
  color: var(--primary);
}
.rate-strip-meta {
  font-size: .75rem;
  color: var(--muted);
  margin-left: auto;
}
.rate-strip-link {
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.rate-strip-link:hover {
  background: #fff;
  border-color: var(--primary);
  text-decoration: none;
}

.report-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.breakdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--gray-100);
  border: 1px solid var(--border);
  font-size: .72rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.breakdown-chip em {
  font-style: normal;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
}
.breakdown-chip.breakdown-ves em { color: var(--brand-800); background: var(--primary-light); }
.breakdown-chip.breakdown-usd em { color: var(--green-700); background: var(--success-bg); }
.breakdown-chip.breakdown-eur em { color: var(--violet-600); background: var(--violet-100); }

.reports-filters { padding: 20px 22px; }
.reports-filters-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.reports-filters-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}
.reports-filters-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .82rem;
}
.reports-period-scope {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px)) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(219, 234, 254, .78), rgba(255, 255, 255, .92));
}
.reports-period-scope span {
  color: var(--brand-800);
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.45;
}
.reports-filters-grid { margin-bottom: 14px; }
.reports-filters-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.reports-list {
  display: grid;
  gap: 18px;
}
.report-section {
  display: grid;
  gap: 18px;
  padding: 22px;
  margin-bottom: 0;
}
.report-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.report-section-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}
.report-section-icon {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
}
.report-section-icon svg { width: 20px; height: 20px; }
.report-section-head h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
.report-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.5;
}
.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.report-mini {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--gray-50);
  display: grid;
  gap: 4px;
}
.report-mini span {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.report-mini strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.report-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 18px;
}
.report-chart,
.report-table {
  display: grid;
  gap: 10px;
  align-content: start;
}
.report-chart h3,
.report-table h3 {
  margin: 0;
  font-size: .82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.report-chart-wrap {
  min-height: 260px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}
.report-chart-empty {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
}
.report-table .table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.report-table table { font-size: .86rem; }
.report-table th {
  padding: 10px 12px;
  font-size: .68rem;
}
.report-table td {
  padding: 10px 12px;
}
.report-empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 24px 12px !important;
}

/* === STAT CARDS === */
.cards-grid,
.stats-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  align-content: start;
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
}
.stat-card strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.1;
}
.stat-card small { color: var(--muted); font-size: .78rem; line-height: 1.5; }

.stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.stat-icon svg { width: 20px; height: 20px; }
.ic-blue   { background: var(--primary-light); color: var(--primary); }
.ic-green  { background: var(--success-bg); color: var(--success); }
.ic-red    { background: var(--danger-bg); color: var(--danger); }
.ic-yellow { background: var(--warning-bg); color: var(--warning); }
.ic-teal   { background: #ccfbf1; color: #0f766e; }

/* === QUICK ACTIONS === */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.quick-action {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.quick-action:hover {
  text-decoration: none;
  border-color: var(--brand-200);
  box-shadow: 0 12px 24px rgba(15,23,42,.08);
  transform: translateY(-1px);
}
.quick-action strong { font-size: .95rem; font-weight: 700; }
.quick-action span { color: var(--muted); font-size: .82rem; line-height: 1.45; }

/* === GENERIC CARD === */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
}
.card h3 { margin: 0 0 12px; font-size: .95rem; font-weight: 700; }

/* === GRID HELPERS === */
.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.wide { grid-column: 1 / -1; }

/* === TABLES === */
.table-wrap,
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead { background: var(--gray-50); }
th {
  padding: 12px 14px;
  text-align: left;
  font-size: .72rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center;
  padding: 5px 11px; border-radius: var(--radius-pill);
  background: var(--gray-200); color: var(--gray-700);
  font-size: .73rem; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap; text-transform: capitalize;
}
.badge.entrada,
.badge.active,
.badge.activa,
.badge.approved,
.badge-green { background: var(--success-bg); color: var(--success); }

.badge.salida,
.badge.inactive,
.badge.inactiva,
.badge.void,
.badge-red { background: var(--danger-bg); color: var(--danger); }

.badge.pending,
.badge.pendiente,
.badge-yellow { background: var(--warning-bg); color: var(--warning); }

.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--muted); }

/* === BUTTONS === */
.btn,
button:not(.hamburger):not(.menu-btn):not(.nav-logout):not(.seg-btn):not(.chip-btn):not(.row-action):not(.sidebar-collapse-toggle) {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600;
  border: 0; cursor: pointer;
  background: var(--primary); color: #fff;
  font-family: inherit; white-space: nowrap; text-decoration: none;
  transition: background .18s, transform .18s, box-shadow .18s, color .18s;
}
.btn:hover,
button:not(.hamburger):not(.menu-btn):not(.nav-logout):not(.seg-btn):not(.chip-btn):not(.row-action):not(.sidebar-collapse-toggle):hover {
  background: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--green-700); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: var(--red-700); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--amber-700); color: #fff; }
.btn-ghost,
.btn-light {
  background: #fff; color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover,
.btn-light:hover { background: var(--bg); color: var(--text); border-color: var(--gray-300); }
.btn-sm { padding: 7px 13px; font-size: .8rem; border-radius: 7px; }
.btn-lg { padding: 13px 26px; font-size: 1rem; }
.btn-block,
.full { width: 100%; justify-content: center; }
.btn svg { width: 15px; height: 15px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { display: inline-flex; margin: 0; }
.actions button {
  padding: 7px 12px;
  background: var(--gray-100);
  color: var(--text);
  box-shadow: none;
}
.actions button:hover {
  background: var(--gray-200);
  color: var(--text);
  transform: none;
}

/* === TABLE COLUMN SIZING === */
th.col-narrow,
td.col-narrow { width: 140px; }
th.col-actions,
td.col-actions { width: 1%; white-space: nowrap; text-align: right; }
table.table-compact th,
table.table-compact td { padding: 10px 14px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -6px 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: var(--shadow);
}

.pagination-summary {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}

.pagination-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-link,
.pagination-ellipsis {
  min-width: 36px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: .82rem;
  font-weight: 800;
}

.pagination-link:hover {
  text-decoration: none;
  border-color: var(--brand-200);
  color: var(--primary);
  background: var(--brand-50);
}

.pagination-link.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.pagination-link.is-disabled {
  opacity: .48;
  cursor: not-allowed;
  background: var(--gray-50);
}

.pagination-ellipsis {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.report-pagination {
  margin-top: 14px;
}

/* === ROW ACTIONS (icon buttons in tables) === */
td.actions,
td.row-actions {
  white-space: nowrap;
  width: 1%;
  text-align: right;
}
td.actions .row-actions-wrap,
td.row-actions .row-actions-wrap {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.row-action svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.row-action:hover {
  text-decoration: none;
  transform: none;
  box-shadow: none;
}
.row-action.is-edit:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.row-action.is-view:hover {
  background: var(--violet-100);
  border-color: #7c3aed;
  color: var(--violet-600);
}
.row-action.is-deactivate:hover,
.row-action.is-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}
.row-action.is-activate:hover,
.row-action.is-success:hover {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}
.row-action.is-warning:hover {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}
.row-action-form {
  display: inline-flex;
  margin: 0;
}
.row-action-form button.row-action {
  background: #fff;
  color: var(--muted);
}

/* === TABLES -> CARDS ON MOBILE === */
@media (max-width: 720px) {
  .movements-table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .movements-quick-search {
    width: 100%;
  }

  .card.table-wrap {
    padding: 14px;
  }

  .table-wrap,
  .table-scroll {
    overflow: visible;
  }

  .table-wrap table,
  .table-scroll table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  .table-wrap thead,
  .table-scroll thead {
    display: none;
  }

  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td,
  .table-scroll tbody,
  .table-scroll tr,
  .table-scroll td {
    display: block;
    width: 100%;
  }

  .table-wrap tbody tr[hidden],
  .table-scroll tbody tr[hidden],
  .table-wrap tbody td[hidden],
  .table-scroll tbody td[hidden] {
    display: none !important;
  }

  .table-wrap tbody tr,
  .table-scroll tbody tr {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    margin: 0 0 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
  }

  .table-wrap tbody tr:hover,
  .table-scroll tbody tr:hover {
    background: var(--card);
  }

  .table-wrap tbody tr:last-child,
  .table-scroll tbody tr:last-child {
    margin-bottom: 0;
  }

  .table-wrap tbody td,
  .table-scroll tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
    word-break: break-word;
    font-size: .9rem;
  }

  .table-wrap tbody tr td:last-child,
  .table-scroll tbody tr td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .table-wrap tbody tr td:first-child,
  .table-scroll tbody tr td:first-child {
    padding-top: 0;
  }

  .table-wrap td[data-label]::before,
  .table-wrap td[data-mobile-label]::before,
  .table-scroll td[data-label]::before,
  .table-scroll td[data-mobile-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: left;
    flex: 0 0 auto;
    max-width: 45%;
  }

  .table-wrap td[data-mobile-label]::before,
  .table-scroll td[data-mobile-label]::before {
    content: attr(data-mobile-label);
  }

  .table-wrap td.row-actions,
  .table-wrap td.actions,
  .table-scroll td.row-actions,
  .table-scroll td.actions {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 8px;
  }

  .table-wrap td.row-actions::before,
  .table-wrap td.actions::before,
  .table-scroll td.row-actions::before,
  .table-scroll td.actions::before {
    margin-bottom: 4px;
  }

  .table-wrap td.row-actions .row-actions-wrap,
  .table-wrap td.actions .row-actions-wrap,
  .table-scroll td.row-actions .row-actions-wrap,
  .table-scroll td.actions .row-actions-wrap {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .table-wrap td.row-actions .row-action,
  .table-wrap td.actions .row-action,
  .table-scroll td.row-actions .row-action,
  .table-scroll td.actions .row-action {
    width: 100%;
  }

  .table-wrap tbody tr[data-no-card="true"],
  .table-scroll tbody tr[data-no-card="true"] {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 0 12px;
    box-shadow: none;
  }

  .table-wrap tbody tr[data-no-card="true"] > td,
  .table-scroll tbody tr[data-no-card="true"] > td {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .table-wrap tbody tr[data-no-card="true"] > td::before,
  .table-scroll tbody tr[data-no-card="true"] > td::before {
    content: none;
  }
}

/* === CHECKBOX ALIGNMENT === */
label.check,
label.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--gray-50);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  justify-self: start;
  transition: border-color .15s, background .15s;
}
label.check:hover,
label.check-inline:hover {
  border-color: var(--brand-200);
  background: #fff;
}
label.check input[type="checkbox"],
label.check-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
label.check:has(input:checked),
label.check-inline:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* === FORMS === */
.form-grid,
.form-stack { display: grid; gap: 16px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .92rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder,
textarea::placeholder { color: var(--gray-400); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
textarea { min-height: 96px; resize: vertical; }

.form-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px;
}
.form-note {
  padding: 13px 16px;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: var(--gray-50);
  line-height: 1.5;
}

.filters { margin-bottom: 22px; }

/* === PERMISSIONS === */
.permissions-stack { display: grid; gap: 14px; }
.perm-group {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fbfdff;
}
.perm-group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.perm-group-head strong { font-size: .95rem; }
.perm-group-head span { color: var(--muted); font-size: .8rem; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.perm-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
}
.perm-item:hover {
  border-color: var(--brand-200);
  box-shadow: 0 8px 16px rgba(15,23,42,.06);
}
.perm-item.is-checked {
  border-color: var(--primary);
  background: rgba(21, 101, 192, 0.06);
  box-shadow: 0 8px 20px rgba(21,101,192,.10);
}
.perm-item input { margin-top: 2px; width: 16px; height: 16px; flex: 0 0 auto; }
.perm-item span { display: grid; gap: 3px; }
.perm-item strong { font-size: .9rem; }
.perm-item small { color: var(--muted); line-height: 1.45; }

.role-summary {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--gray-50);
  margin-bottom: 14px;
}
.role-summary strong { display: block; margin-bottom: 6px; }
.role-summary p { margin: 0; color: var(--muted); line-height: 1.55; }

/* === ROLES WORKBENCH === */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-head h3 { margin-bottom: 0; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field { display: grid; gap: 7px; }
.g-span2 { grid-column: 1 / -1; }

.field-label {
  display: inline-block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.field-hint {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.search-box svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-box input {
  border: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  background: transparent;
}

.search-box input:focus {
  border-color: transparent;
  box-shadow: none;
}

.balance-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  color: var(--primary);
  border: 1px solid var(--brand-100);
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}

.roles-page-subtitle {
  margin-top: 8px;
  max-width: 760px;
  color: var(--muted);
  font-size: .94rem;
}

.roles-page-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.roles-rail {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  align-self: start;
  overflow: hidden;
}

.roles-rail .card-head,
.roles-tabs-head {
  align-items: flex-start;
}

.roles-rail-copy {
  color: var(--muted);
  font-size: .85rem;
  margin-top: 4px;
}

.roles-rail-body {
  display: grid;
  gap: 14px;
}

.roles-search {
  display: grid;
  gap: 8px;
}

.roles-search-box {
  max-width: none;
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.roles-list {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - var(--nav-h) - 232px);
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.role-item {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px 16px 14px 20px;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
  box-shadow: 0 8px 18px rgba(15,23,42,.04);
  color: var(--text);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.role-item::before {
  content: '';
  position: absolute;
  inset: 10px auto 10px 10px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, transparent, var(--primary-mid), var(--primary));
  opacity: 0;
  transform: scaleY(.4);
  transform-origin: center;
  transition: opacity .18s ease, transform .18s ease;
}

.role-item:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(30,64,175,.34);
  background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
  box-shadow: 0 18px 28px rgba(15,23,42,.10), 0 0 0 1px rgba(30,64,175,.05);
}

.role-item:hover::before,
.role-item.is-active::before {
  opacity: 1;
  transform: scaleY(1);
}

.role-item.is-active {
  border-color: rgba(30,64,175,.42);
  background: linear-gradient(135deg, #eaf3ff 0%, #fff 100%);
  box-shadow: 0 18px 30px rgba(30,64,175,.12), 0 0 0 1px rgba(30,64,175,.10);
}

.role-item-copy strong {
  display: block;
  color: var(--text);
  font-size: .96rem;
  margin-bottom: 4px;
}

.role-item-copy p {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}

.role-item-copy small {
  display: inline-block;
  margin-top: 6px;
  color: var(--primary);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.role-item-badges,
.roles-editor-badges,
.roles-summary-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.roles-empty-state {
  padding: 18px;
  border-radius: var(--radius-2xl);
  border: 1px dashed var(--gray-300);
  background: var(--gray-50);
}

.roles-empty-state strong {
  display: block;
  margin-bottom: 4px;
}

.roles-empty-state p {
  color: var(--muted);
  font-size: .86rem;
}

.roles-tabs-card {
  min-width: 0;
  overflow: visible;
}

.roles-tabs {
  display: flex;
  gap: 8px;
  margin: -4px -6px 18px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.roles-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-size: .86rem;
  font-weight: 700;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.roles-tab:hover {
  background: var(--gray-50);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15,23,42,.08);
}

.roles-tab.is-active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--brand-200);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}

.roles-tab-panel {
  display: none;
  overflow: visible;
}

.roles-tab-panel.is-active {
  display: grid;
  gap: 16px;
}

.roles-tab-panels,
.roles-edit-form,
.roles-create-form {
  display: grid;
  gap: 16px;
}

.roles-editor-hero,
.roles-create-hero {
  display: grid;
  gap: 18px;
  align-items: start;
  padding: 20px;
  border-radius: 22px;
  background: radial-gradient(circle at top right, rgba(59,130,246,.12), transparent 30%), linear-gradient(180deg, #fbfdff 0%, #f7fbff 100%);
  border: 1px solid var(--brand-100);
}

.roles-editor-hero {
  grid-template-columns: minmax(0, 1fr) auto;
}

.roles-create-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 2px;
}

.roles-editor-copy h2,
.roles-create-hero h2,
.roles-summary-card-hero h2 {
  margin-top: 4px;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.18;
}

.roles-editor-copy p,
.roles-create-hero p,
.roles-summary-card-hero p {
  margin-top: 8px;
  color: var(--muted);
  max-width: 760px;
}

.roles-editor-stats,
.roles-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
}

.roles-mini-stat {
  min-width: 92px;
  padding: 14px 15px;
  border-radius: var(--radius-2xl);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 10px 20px rgba(15,23,42,.05);
  text-align: center;
}

.roles-mini-stat strong {
  display: block;
  color: var(--primary);
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 5px;
}

.roles-mini-stat span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.roles-permissions-toolbar {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.roles-permissions-toolbar-copy {
  display: grid;
  gap: 5px;
}

.roles-permissions-toolbar-copy p {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
}

.roles-permissions-toolbar-actions {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) repeat(2, minmax(150px, 170px));
  align-items: center;
  gap: 10px;
}

.roles-permissions-toolbar-actions .btn {
  width: 100%;
}

.roles-permission-groups {
  display: grid;
  gap: 18px;
}

.roles-permission-group {
  margin-bottom: 0;
  overflow: hidden;
}

.roles-permission-group-head p {
  color: var(--muted);
  font-size: .84rem;
  margin-top: 4px;
}

.roles-group-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.roles-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.permission-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 15px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.permission-item:hover {
  transform: translateY(-1px);
  border-color: rgba(30,64,175,.2);
  box-shadow: 0 12px 24px rgba(15,23,42,.07);
}

.permission-item.is-checked {
  background: linear-gradient(135deg, var(--brand-50) 0%, #fff 100%);
  border-color: rgba(30,64,175,.36);
  box-shadow: 0 12px 24px rgba(30,64,175,.08);
}

.permission-item.is-unchecked {
  border-color: var(--border);
}

.permission-item input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--primary);
}

.permission-item-copy strong {
  display: block;
  color: var(--text);
  margin-bottom: 5px;
}

.permission-item-copy p {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.55;
}

.permission-item-copy small {
  display: inline-block;
  margin-top: 6px;
  color: var(--primary);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.permission-status {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: .68rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.permission-item.is-checked .permission-status {
  background: var(--success-bg);
  color: var(--green-700);
}

.roles-form-actions,
.roles-summary-actions,
.roles-summary-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.roles-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 16px;
  align-items: start;
}

.roles-summary-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.roles-summary-card-hero {
  border-color: var(--brand-100);
  background: radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 30%), linear-gradient(180deg, #fbfdff 0%, #f7fbff 100%);
}

.roles-summary-card h4 {
  margin-bottom: 12px;
  color: var(--primary);
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.roles-summary-panels,
.roles-summary-progress-list,
.roles-summary-progress-item {
  display: grid;
  gap: 12px;
}

.roles-summary-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.roles-summary-progress-head span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.roles-progress {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--gray-200);
  overflow: hidden;
}

.roles-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary-mid), var(--primary));
}

.roles-summary-empty {
  color: var(--muted);
  font-size: .9rem;
}

/* === ALERTS / FLASH === */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 14px; font-size: .9rem;
  border-left: 4px solid transparent;
}
.alert.success,
.success {
  background: var(--success-bg); color: var(--success);
  border-left-color: var(--success);
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px;
}
.alert.error,
.alert.danger,
.danger {
  background: var(--danger-bg); color: var(--danger);
  border-left-color: var(--danger);
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px;
}
.alert.warning,
.warning {
  background: var(--warning-bg); color: var(--warning);
  border-left-color: var(--warning);
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px;
}
.alert.info,
.info {
  background: var(--info-bg); color: var(--info);
  border-left-color: var(--info);
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px;
}

/* === HELPERS === */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; justify-content: center; }

/* =========================================
   AUTH (login) — mirrors compras_mvc .lp-card
   Background con motivo financiero (gradiente
   profundo + grilla tipo trading)
   ========================================= */

.auth-body,
body.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 22%, rgba(16,185,129,.16), transparent 38%),
    radial-gradient(circle at 82% 78%, rgba(56,189,248,.12), transparent 42%),
    linear-gradient(135deg, #0a1d33 0%, #0f2747 45%, #06182d 100%);
  background-attachment: fixed;
}

.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg,
      rgba(148,197,255,.06) 0,
      rgba(148,197,255,.06) 1px,
      transparent 1px,
      transparent 56px),
    repeating-linear-gradient(90deg,
      rgba(148,197,255,.06) 0,
      rgba(148,197,255,.06) 1px,
      transparent 1px,
      transparent 56px);
  mask-image: radial-gradient(circle at center, rgba(0,0,0,.9), transparent 75%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,.9), transparent 75%);
  pointer-events: none;
}
.auth-wrap::after {
  content: '';
  position: absolute;
  left: -10%; right: -10%; top: 55%;
  height: 220px;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 200' preserveAspectRatio='none'><path d='M0 150 L120 130 L240 160 L360 110 L480 140 L600 80 L720 120 L840 60 L960 100 L1080 50 L1200 95 L1320 35 L1440 80 L1600 25' fill='none' stroke='%2334d399' stroke-width='2' stroke-opacity='.55'/><path d='M0 170 L120 160 L240 180 L360 140 L480 165 L600 120 L720 150 L840 110 L960 140 L1080 95 L1200 130 L1320 80 L1440 115 L1600 70' fill='none' stroke='%2360a5fa' stroke-width='1.5' stroke-opacity='.45'/></svg>") center / 100% 100% no-repeat;
  filter: drop-shadow(0 6px 18px rgba(16,185,129,.18));
  pointer-events: none;
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  display: grid;
  gap: 14px;
}
.auth-flash {
  margin: 0;
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 34px rgba(15,23,42,.18);
}

.lp-card {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    0 40px 90px rgba(0,0,0,.45),
    0 10px 28px rgba(0,0,0,.22);
  background: #0d1526;
  min-height: 560px;
}

.lp-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 36px;
  background: transparent;
}
.lp-panel-inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 38px; text-align: center;
}
.lp-logo-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.lp-logo-circle {
  width: 132px; height: 92px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 10px;
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow:
    0 18px 36px rgba(0,0,0,.20),
    inset 0 1px 0 rgba(255,255,255,.12);
  font-weight: 900; font-size: 1.8rem; letter-spacing: .08em;
}
.img-logo {
  width: 78%; height: 78%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.lp-brand-name {
  font-size: 1.7rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .07em;
}
.lp-panel-tagline {
  font-size: .72rem;
  color: rgba(255,255,255,.42);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0;
}
.lp-dots { display: flex; gap: 10px; align-items: center; }
.lp-dot { width: 12px; height: 12px; border-radius: var(--radius-circle); }
.lp-dot-r { background: #ef5350; }
.lp-dot-o { background: #ff9800; }
.lp-dot-g { background: #66bb6a; }

.lp-form-panel {
  background: #fff;
  border-radius: 28px 0 0 28px;
  box-shadow: -14px 0 48px rgba(0,0,0,.20);
  display: flex; flex-direction: column;
}
.lp-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 26px 28px 0;
  font-size: 1rem;
  font-weight: 800;
  color: #0d1526;
}
.lp-mobile-brand .lp-brand-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1976d2, #1565c0);
  box-shadow: 0 4px 12px rgba(21,101,192,.30);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .82rem; letter-spacing: .04em;
}
.lp-form-inner {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 40px 36px;
}
.lp-form-head { margin-bottom: 24px; }
.lp-form-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #0d1526;
  line-height: 1.35;
  margin: 0 0 4px;
}
.lp-form-title span { color: #1565c0; }
.lp-form-sub { font-size: .84rem; color: var(--gray-400); margin: 0; }

.lp-form { display: flex; flex-direction: column; gap: 18px; }
.lp-field { display: flex; flex-direction: column; gap: 5px; }
.lp-label {
  font-size: .73rem;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.lp-field input,
.lp-field select {
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1.5px solid var(--gray-200);
  border-radius: 0;
  font-size: .93rem;
  font-family: inherit;
  color: var(--gray-900);
  background: transparent;
  outline: none;
  transition: border-color .18s;
  appearance: none;
  -webkit-appearance: none;
}
.lp-field input::placeholder { color: var(--gray-300); }
.lp-field input:focus,
.lp-field select:focus {
  border-bottom-color: #1565c0;
  box-shadow: none;
  background: transparent;
}

.lp-pass-wrap { position: relative; }
.lp-pass-wrap input { padding-right: 32px; }
.lp-eye {
  position: absolute;
  right: 0; bottom: 4px;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 4px;
  color: var(--gray-400);
  cursor: pointer;
  display: flex; align-items: center;
  border-radius: var(--radius-xs);
  -webkit-appearance: none;
  appearance: none;
  transition: color .15s;
}
.lp-eye:hover { color: #1565c0; transform: none; }

.lp-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  padding: 13px 20px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: .12em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(21,101,192,.32);
  transition: opacity .18s, transform .15s, box-shadow .18s;
}
.lp-btn:hover {
  opacity: .94;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(21,101,192,.40);
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: #fff;
}
.lp-btn:active { transform: translateY(0); }
.lp-btn:disabled,
.lp-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.lp-demo {
  margin-top: 18px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--gray-200);
  overflow: hidden;
}
.lp-demo-label {
  display: block;
  padding: 5px 12px;
  background: var(--gray-50);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-400);
}
.lp-demo-body {
  padding: 9px 12px;
  font-size: .76rem;
  color: var(--gray-500);
  line-height: 1.7;
}
.lp-demo-body strong { color: #374151; }

.lp-credit {
  margin-top: 14px;
  font-size: .68rem;
  line-height: 1.55;
  color: var(--gray-400);
  text-align: center;
}
.lp-credit span {
  display: block;
  color: var(--gray-500);
  letter-spacing: .04em;
}

/* === FOOTER === */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 28px 22px;
  color: var(--gray-400);
  font-size: .74rem;
  margin-left: var(--side-w);
}
.app-footer small {
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .lp-card { grid-template-columns: 1fr; min-height: auto; }
  .lp-panel { padding: 36px 28px 18px; }
  .lp-form-panel { border-radius: 0; box-shadow: none; }
  .lp-mobile-brand { display: flex; }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .menu-btn,
  .hamburger { display: inline-flex; }
  .sidebar-collapse-toggle { display: none; }

  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }

  .content,
  .app-footer { margin-left: 0; padding-left: 18px; padding-right: 18px; }
  body.sidebar-collapsed .content,
  body.sidebar-collapsed .app-footer { margin-left: 0; }
  body.sidebar-collapsed .sidebar {
    width: 260px;
    padding: 14px 10px 24px;
  }

  .topbar,
  .navbar { padding: 0 16px; gap: 10px; }

  .nav-user,
  .nav-context-chip { display: none; }

  .page-header,
  .dash-section-head { flex-direction: column; align-items: flex-start; }
  .dashboard-chart-toolbar .chart-controls { justify-content: flex-start; width: 100%; }
  .chart-currency-control { min-width: 100%; }
  .chart-card-head { flex-direction: column; align-items: flex-start; }
  .report-card-head,
  .report-section-head,
  .reports-filters-head { flex-direction: column; align-items: flex-start; }
  .reports-period-scope { grid-template-columns: 1fr; }
  .report-metrics { grid-template-columns: 1fr 1fr; }
  .report-body { grid-template-columns: 1fr; }
  .report-chart-wrap { min-height: 220px; }
  .position-cards { grid-template-columns: 1fr; }
  .position-panel-head { flex-direction: column; align-items: flex-start; }
  .position-panel-total { text-align: left; }

  .dash-hero { grid-template-columns: 1fr; padding: 18px; }
  .dash-hero h1 { font-size: 1.45rem; }

  .form-grid,
  .form-grid.compact,
  .perm-grid { grid-template-columns: 1fr; }
  .movement-modal-head { flex-direction: column; align-items: flex-start; }
  .movement-grid { grid-template-columns: 1fr; }
  .movement-actions { flex-direction: column-reverse; }
  .movement-actions .btn { width: 100%; }
  .roles-page-shell { grid-template-columns: 1fr; }
  .roles-rail { position: static; top: auto; overflow: visible; }
  .roles-list {
    display: flex;
    gap: 10px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 10px;
    scroll-snap-type: x proximity;
  }
  .role-item {
    min-width: 240px;
    max-width: 280px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
  .roles-editor-hero,
  .roles-create-hero,
  .roles-summary-grid { grid-template-columns: 1fr; }
  .roles-permissions-toolbar-actions { grid-template-columns: 1fr; }
  .roles-permission-group-head { flex-direction: column; align-items: flex-start; }
  .roles-group-actions { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .topbar-title span { display: none; }
  .lp-form-inner { padding: 24px 22px 28px; }
  .lp-panel { padding: 28px 22px 14px; }
  .lp-logo-circle { width: 108px; height: 76px; }
  .auth-wrap::after { display: none; }
  .page-header h1 { font-size: 1.4rem; }
  .report-metrics { grid-template-columns: 1fr; }
  .form-actions { width: 100%; }
  .form-actions .btn,
  .form-actions .btn-light { width: 100%; }
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }
  .pagination-links {
    justify-content: flex-start;
  }
  .field-grid,
  .roles-form-grid,
  .roles-permission-grid { grid-template-columns: 1fr; }
  .roles-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .roles-tab {
    width: 100%;
    border-radius: var(--radius-xl);
  }
  .roles-editor-stats,
  .roles-summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roles-mini-stat:last-child { grid-column: 1 / -1; }
  .roles-summary-actions,
  .roles-summary-hero-actions,
  .roles-form-actions { flex-direction: column; align-items: stretch; }
  .roles-summary-actions .btn,
  .roles-summary-hero-actions .btn,
  .roles-form-actions .btn,
  .roles-restore-form { width: 100%; }
  .movement-dossier-grid { grid-template-columns: 1fr; }
  .movement-dossier-head { flex-direction: column; }
  .movement-dossier-head > strong { white-space: normal; }
}

@media print {
  .navbar, .topbar, .sidebar, .sidebar-overlay,
  .btn, button, .actions, .filters, .app-footer {
    display: none !important;
  }
  .content { margin: 0; padding: 0; }
  .card, .stat-card, .dash-hero { box-shadow: none; }
}
