/* ════════════════════════════════════════════════════
   Variables
   ════════════════════════════════════════════════════ */
:root {
  --primary:        #1a3a6b;
  --primary-light:  #2a5298;
  --primary-dark:   #0f2244;
  --accent:         #f0a500;
  --surface:        #ffffff;
  --bg:             #f4f6fb;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --success:        #16a34a;
  --danger:         #dc2626;
  --warning:        #d97706;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.06);
  --shadow:         0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.05);
  --font:           'DM Sans', system-ui, sans-serif;
  --sidebar-w:      230px;
}

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

body {
  font-family: var(--font);
  font-size:   14px;
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }

/* ════════════════════════════════════════════════════
   Splash (carga inicial)
   ════════════════════════════════════════════════════ */
.splash {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  min-height:      100vh;
  gap:             16px;
}
.splash__logo { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.splash__brand { font-size: 1.75rem; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; }
.splash__sub   { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.splash__spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ════════════════════════════════════════════════════
   Login
   ════════════════════════════════════════════════════ */
.login-screen {
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      100vh;
  padding:         24px;
  background:      var(--primary);
}

.login-card {
  width:         100%;
  max-width:     400px;
  background:    var(--surface);
  border-radius: var(--radius-lg);
  box-shadow:    0 20px 60px rgba(0,0,0,.35);
  overflow:      hidden;
}

.login-card__header {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  padding:         40px 32px 28px;
  background:      var(--surface);
  gap:             6px;
}

.login-card__title {
  font-size:      1.75rem;
  font-weight:    700;
  color:          var(--primary);
  letter-spacing: -0.5px;
}
.login-card__sub {
  font-size:      0.65rem;
  color:          var(--text-muted);
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.login-form {
  display:        flex;
  flex-direction: column;
  gap:            16px;
  padding:        8px 32px 28px;
}

.login-form .form-label {
  text-transform: none;
  letter-spacing: 0;
  font-size:      0.875rem;
  font-weight:    500;
  color:          var(--text-muted);
}

.login-form .btn--primary {
  height:      46px;
  font-size:   0.95rem;
  margin-top:  4px;
}

.login-card__footer {
  text-align: center;
  padding:    0 32px 20px;
  font-size:  0.75rem;
  color:      var(--text-muted);
}

/* ════════════════════════════════════════════════════
   Formularios
   ════════════════════════════════════════════════════ */
.form-group {
  display:        flex;
  flex-direction: column;
  gap:            6px;
}

.form-label {
  font-size:   0.8rem;
  font-weight: 600;
  color:       var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width:         100%;
  height:        42px;
  padding:       0 12px;
  border:        1.5px solid var(--border);
  border-radius: var(--radius);
  font-size:     0.9rem;
  color:         var(--text);
  background:    var(--surface);
  transition:    border-color .15s, box-shadow .15s;
  outline:       none;
}
.form-input:focus {
  border-color: var(--primary-light);
  box-shadow:   0 0 0 3px rgba(42,82,152,.12);
}
.form-input::placeholder { color: #aab4c8; }

.input-password {
  position: relative;
}
.input-password .form-input {
  padding-right: 42px;
}
.input-password__toggle {
  position:         absolute;
  right:            10px;
  top:              50%;
  transform:        translateY(-50%);
  color:            var(--text-muted);
  padding:          4px;
  border-radius:    4px;
  transition:       color .15s;
}
.input-password__toggle:hover { color: var(--primary); }

.form-error {
  font-size:    0.82rem;
  color:        var(--danger);
  background:   #fef2f2;
  border:       1px solid #fecaca;
  border-radius: var(--radius);
  padding:      8px 12px;
}

/* ════════════════════════════════════════════════════
   Botones
   ════════════════════════════════════════════════════ */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  height:          40px;
  padding:         0 18px;
  border-radius:   var(--radius);
  font-size:       0.9rem;
  font-weight:     600;
  transition:      background .15s, box-shadow .15s, opacity .15s;
  cursor:          pointer;
}
.btn--primary {
  background: var(--primary);
  color:      #fff;
}
.btn--primary:hover   { background: var(--primary-light); box-shadow: var(--shadow-md); }
.btn--primary:active  { background: var(--primary-dark); }
.btn--primary:disabled { opacity: .6; cursor: not-allowed; }
.btn--full    { width: 100%; }

.btn-icon {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           34px;
  height:          34px;
  border-radius:   var(--radius);
  color:           rgba(255,255,255,.7);
  transition:      background .15s, color .15s;
}
.btn-icon:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ════════════════════════════════════════════════════
   Spinner (dentro de botón)
   ════════════════════════════════════════════════════ */
.spinner {
  display:       inline-block;
  width:         18px;
  height:        18px;
  border:        2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation:     spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════
   Layout principal (post-login)
   ════════════════════════════════════════════════════ */
.layout {
  display:    flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width:            var(--sidebar-w);
  flex-shrink:      0;
  background:       var(--primary);
  display:          flex;
  flex-direction:   column;
  position:         fixed;
  top:              0;
  left:             0;
  bottom:           0;
  z-index:          100;
  overflow-y:       auto;
}

.sidebar__brand {
  display:        flex;
  flex-direction: column;
  padding:        24px 20px 20px;
  border-bottom:  1px solid rgba(255,255,255,.1);
}
.sidebar__brand-name {
  font-size:   1.15rem;
  font-weight: 700;
  color:       #fff;
  letter-spacing: -0.3px;
}
.sidebar__brand-sub {
  font-size:  0.72rem;
  color:      rgba(255,255,255,.55);
  font-weight: 500;
  margin-top: 1px;
}

.sidebar__nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display:       flex;
  align-items:   center;
  gap:           10px;
  padding:       9px 12px;
  border-radius: var(--radius);
  color:         rgba(255,255,255,.65);
  font-size:     0.875rem;
  font-weight:   500;
  transition:    background .15s, color .15s;
}
.nav-item:hover        { background: rgba(255,255,255,.1);  color: #fff; }
.nav-item--active      { background: rgba(255,255,255,.15); color: #fff; }
.nav-item svg          { flex-shrink: 0; }

.sidebar__footer {
  display:      flex;
  align-items:  center;
  gap:          8px;
  padding:      14px 12px;
  border-top:   1px solid rgba(255,255,255,.1);
}

.sidebar__avatar {
  width:           34px;
  height:          34px;
  border-radius:   50%;
  background:      var(--accent);
  color:           var(--primary-dark);
  font-weight:     700;
  font-size:       0.9rem;
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
}

.sidebar__user-info {
  flex:           1;
  min-width:      0;
  display:        flex;
  flex-direction: column;
}
.sidebar__user-name {
  font-size:   0.82rem;
  font-weight: 600;
  color:       #fff;
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
}
.sidebar__user-tenant {
  font-size:  0.72rem;
  color:      rgba(255,255,255,.5);
  white-space: nowrap;
  overflow:   hidden;
  text-overflow: ellipsis;
}

/* ── Contenido principal ─────────────────────────── */
.main-content {
  flex:        1;
  margin-left: var(--sidebar-w);
  display:     flex;
  flex-direction: column;
  min-height:  100vh;
}

.topbar {
  height:       56px;
  background:   var(--surface);
  border-bottom: 1px solid var(--border);
  display:      flex;
  align-items:  center;
  padding:      0 24px;
  position:     sticky;
  top:          0;
  z-index:      50;
  box-shadow:   var(--shadow-sm);
}
.topbar__title {
  font-size:   1rem;
  font-weight: 600;
  color:       var(--text);
}

.page-content {
  padding: 24px;
  flex:    1;
}

/* ── Welcome card placeholder ────────────────────── */
.welcome-card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:       32px;
  max-width:     480px;
  box-shadow:    var(--shadow-sm);
}
.welcome-card h3 {
  font-size:   1.1rem;
  font-weight: 600;
  color:       var(--primary);
  margin-bottom: 6px;
}
.welcome-card p { color: var(--text-muted); line-height: 1.5; }

/* ════════════════════════════════════════════════════
   Page header
   ════════════════════════════════════════════════════ */
.page-header {
  display:     flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header__title {
  font-size:   1.05rem;
  font-weight: 700;
  color:       var(--text);
}

/* ════════════════════════════════════════════════════
   Card
   ════════════════════════════════════════════════════ */
.card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow:      hidden;
  box-shadow:    var(--shadow-sm);
}

/* ════════════════════════════════════════════════════
   Stats row
   ════════════════════════════════════════════════════ */
.stats-row {
  display: flex;
  gap:     12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat-card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       14px 20px;
  display:       flex;
  flex-direction: column;
  gap:           2px;
  box-shadow:    var(--shadow-sm);
  min-width:     160px;
}
.stat-card--accent { border-left: 3px solid var(--primary); }
.stat-card__value {
  font-size:   1.3rem;
  font-weight: 700;
  color:       var(--text);
  line-height: 1.2;
}
.stat-card__label {
  font-size:  0.78rem;
  color:      var(--text-muted);
  font-weight: 500;
}

/* ════════════════════════════════════════════════════
   Data table
   ════════════════════════════════════════════════════ */
.data-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       0.875rem;
}
.data-table th {
  padding:      10px 14px;
  text-align:   left;
  font-size:    0.75rem;
  font-weight:  600;
  color:        var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background:   #fafbfc;
  white-space: nowrap;
}
.data-table td {
  padding:     11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color:       var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td     { background: #f8faff; }
.data-table--nested { background: transparent; }
.data-table--nested td { padding: 8px 14px; }

.row--inactive td { opacity: .55; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 0.8rem; }
.text-danger { color: var(--danger); }

/* ════════════════════════════════════════════════════
   Badges
   ════════════════════════════════════════════════════ */
.badge {
  display:       inline-flex;
  align-items:   center;
  padding:       2px 8px;
  border-radius: 100px;
  font-size:     0.72rem;
  font-weight:   600;
  letter-spacing: 0.03em;
  white-space:   nowrap;
}
.badge--gray   { background: #f1f5f9; color: #475569; }
.badge--blue   { background: #dbeafe; color: #1d4ed8; }
.badge--purple { background: #ede9fe; color: #6d28d9; }
.badge--dark   { background: #e2e8f0; color: #334155; }
.badge--orange { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge--green  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ════════════════════════════════════════════════════
   Status pill
   ════════════════════════════════════════════════════ */
.status {
  display:       inline-flex;
  align-items:   center;
  gap:           5px;
  font-size:     0.78rem;
  font-weight:   500;
}
.status::before {
  content:       '';
  width:         6px;
  height:        6px;
  border-radius: 50%;
  flex-shrink:   0;
}
.status--active::before  { background: var(--success); }
.status--inactive::before { background: #94a3b8; }

/* ════════════════════════════════════════════════════
   Color dot / clave badge
   ════════════════════════════════════════════════════ */
.color-dot {
  display:       inline-block;
  width:         14px;
  height:        14px;
  border-radius: 50%;
  border:        2px solid rgba(0,0,0,.08);
  flex-shrink:   0;
}
.clave-badge {
  font-size:     0.78rem;
  font-weight:   700;
  background:    #f1f5f9;
  color:         var(--primary);
  padding:       2px 7px;
  border-radius: 4px;
  font-family:   'DM Mono', 'Courier New', monospace;
  letter-spacing: 0.05em;
}

/* ════════════════════════════════════════════════════
   Action button (ícono inline en tabla)
   ════════════════════════════════════════════════════ */
.btn-action {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           30px;
  height:          30px;
  border-radius:   var(--radius);
  color:           var(--text-muted);
  transition:      background .12s, color .12s;
}
.btn-action:hover { background: #f1f5f9; color: var(--primary); }

/* ════════════════════════════════════════════════════
   Button variants adicionales
   ════════════════════════════════════════════════════ */
.btn--ghost {
  background:    transparent;
  color:         var(--text-muted);
  border:        1.5px solid var(--border);
}
.btn--ghost:hover { background: #f8faff; color: var(--text); border-color: #cbd5e1; }

/* ════════════════════════════════════════════════════
   Modal
   ════════════════════════════════════════════════════ */
.modal-overlay {
  display:         none;
  position:        fixed;
  inset:           0;
  background:      rgba(15,34,68,.45);
  z-index:         200;
  align-items:     center;
  justify-content: center;
  padding:         20px;
  backdrop-filter: blur(2px);
}
.modal-overlay--open { display: flex; }

.modal {
  background:    var(--surface);
  border-radius: var(--radius-lg);
  box-shadow:    var(--shadow-lg);
  width:         100%;
  max-width:     480px;
  max-height:    90vh;
  display:       flex;
  flex-direction: column;
  animation:     modal-in .18s ease;
}
.modal--lg { max-width: 560px; }

@keyframes modal-in {
  from { transform: translateY(12px) scale(.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.modal__header {
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  padding:       18px 22px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink:   0;
}
.modal__title {
  font-size:   1rem;
  font-weight: 600;
  color:       var(--text);
}
.modal__close {
  color:         var(--text-muted);
  padding:       4px;
  border-radius: 4px;
  transition:    background .12s, color .12s;
}
.modal__close:hover { background: #f1f5f9; color: var(--text); }

.modal__body {
  display:        flex;
  flex-direction: column;
  gap:            14px;
  padding:        20px 22px 0;
  overflow-y:     auto;
  flex:           1;
}

.modal__footer {
  display:     flex;
  align-items: center;
  gap:         10px;
  padding:     16px 22px;
  border-top:  1px solid var(--border);
  margin-top:  16px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════
   Form select & textarea
   ════════════════════════════════════════════════════ */
.form-select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.form-select--sm { height: 36px; font-size: 0.83rem; }

.form-textarea {
  height:     auto;
  padding:    8px 12px;
  resize:     vertical;
  min-height: 60px;
  line-height: 1.5;
}

.form-input--color {
  padding:       4px 6px;
  height:        42px;
  cursor:        pointer;
}

.form-row {
  display: flex;
  gap:     12px;
}
.form-row .form-group { flex: 1; }

/* ════════════════════════════════════════════════════
   Toggle label (activo/inactivo en modal)
   ════════════════════════════════════════════════════ */
.toggle-label {
  display:     flex;
  align-items: center;
  gap:         8px;
  cursor:      pointer;
  font-size:   0.875rem;
  color:       var(--text-muted);
  font-weight: 500;
}
.toggle-label input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* ════════════════════════════════════════════════════
   Filter bar
   ════════════════════════════════════════════════════ */
.filter-bar {
  display:     flex;
  gap:         16px;
  padding:     14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap:   wrap;
  align-items: flex-end;
}
.filter-bar__group {
  display:        flex;
  flex-direction: column;
  gap:            4px;
  min-width:      140px;
}

/* ════════════════════════════════════════════════════
   Hierarchy (Clasificador)
   ════════════════════════════════════════════════════ */
.hierarchy { padding: 8px 0; }

.hierarchy__capitulo { border-bottom: 1px solid var(--border); }
.hierarchy__capitulo:last-child { border-bottom: none; }

.hierarchy__capitulo-header {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     11px 16px;
  cursor:      pointer;
  font-weight: 700;
  font-size:   0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color:       var(--primary);
  background:  #f8faff;
  user-select: none;
  transition:  background .12s;
}
.hierarchy__capitulo-header:hover { background: #eef3fb; }
.hierarchy__chevron { transition: transform .2s; flex-shrink: 0; }
.hierarchy__count {
  margin-left:   auto;
  background:    var(--border);
  color:         var(--text-muted);
  font-size:     0.7rem;
  font-weight:   600;
  border-radius: 100px;
  padding:       1px 7px;
}

.hierarchy__capitulo-body          { }
.hierarchy__capitulo-body--collapsed { display: none; }

.hierarchy__concepto { }
.hierarchy__concepto-header {
  display:     flex;
  align-items: center;
  gap:         6px;
  padding:     8px 16px 8px 28px;
  cursor:      pointer;
  font-weight: 600;
  font-size:   0.85rem;
  color:       var(--text);
  user-select: none;
  transition:  background .12s;
}
.hierarchy__concepto-header:hover { background: #f4f6fb; }
.hierarchy__chevron--sm { transition: transform .2s; flex-shrink: 0; }

.hierarchy__concepto-body          { }
.hierarchy__concepto-body--collapsed { display: none; }

/* ════════════════════════════════════════════════════
   Empty state / Loading state
   ════════════════════════════════════════════════════ */
.empty-state {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  padding:         48px 24px;
  gap:             12px;
}
.empty-state__text { color: var(--text-muted); font-size: 0.875rem; text-align: center; }

.loading-state {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             10px;
  padding:         48px 24px;
  color:           var(--text-muted);
  font-size:       0.875rem;
}
.loading-spinner {
  width:         22px;
  height:        22px;
  border:        2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation:     spin .7s linear infinite;
  flex-shrink:   0;
}

/* ════════════════════════════════════════════════════
   Badges adicionales (asientos)
   ════════════════════════════════════════════════════ */
.badge--red   { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.badge--green { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

.text-success { color: var(--success); }

/* ════════════════════════════════════════════════════
   Stats row inline (dentro de card)
   ════════════════════════════════════════════════════ */
.stats-row--inline {
  padding:     14px 16px 0;
  border-bottom: none;
  margin-bottom: 0;
}
.stat-card--green { border-left: 3px solid var(--success); }
.stat-card--red   { border-left: 3px solid var(--danger); }

/* ════════════════════════════════════════════════════
   Type toggle (INGRESO / EGRESO / TRASPASO)
   ════════════════════════════════════════════════════ */
.type-toggle {
  display:       flex;
  gap:           4px;
  background:    var(--bg);
  border:        1.5px solid var(--border);
  border-radius: var(--radius);
  padding:       4px;
}
.type-toggle__btn {
  flex:            1;
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  padding:         8px 12px;
  border-radius:   5px;
  font-size:       0.82rem;
  font-weight:     600;
  color:           var(--text-muted);
  transition:      all .15s;
}
.type-toggle__btn:hover { background: var(--surface); color: var(--text); }

.type-toggle__btn--active { box-shadow: var(--shadow-sm); }
.type-toggle__btn--INGRESO  { background: #f0fdf4; color: #15803d; }
.type-toggle__btn--EGRESO   { background: #fef2f2; color: var(--danger); }
.type-toggle__btn--TRASPASO { background: #eff6ff; color: #1d4ed8; }

/* ════════════════════════════════════════════════════
   Modal XL (formulario asientos)
   ════════════════════════════════════════════════════ */
.modal--xl { max-width: 680px; }

/* ════════════════════════════════════════════════════
   Table scroll (tabla ancha en pantallas chicas)
   ════════════════════════════════════════════════════ */
.table-scroll { overflow-x: auto; }

/* ════════════════════════════════════════════════════
   Row anulado
   ════════════════════════════════════════════════════ */
.row--anulado td { text-decoration: line-through; color: var(--text-muted); }

/* ════════════════════════════════════════════════════
   Btn action — variante danger
   ════════════════════════════════════════════════════ */
.btn-action--danger:hover { background: #fef2f2; color: var(--danger); }

/* ════════════════════════════════════════════════════
   Search input wrapper
   ════════════════════════════════════════════════════ */
.search-input-wrap {
  position: relative;
}
.search-input-wrap__icon {
  position:  absolute;
  left:      10px;
  top:       50%;
  transform: translateY(-50%);
  color:     var(--text-muted);
  pointer-events: none;
}
.form-input--search { padding-left: 34px; }

/* ════════════════════════════════════════════════════
   Proyectos — grid de tarjetas
   ════════════════════════════════════════════════════ */
.proyecto-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap:                   16px;
  padding:               4px 0;
}

.proyecto-card {
  background:    var(--surface);
  border:        1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding:       20px;
  display:       flex;
  flex-direction: column;
  gap:           10px;
  transition:    box-shadow .15s, border-color .15s;
}
.proyecto-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.proyecto-card--inactive { opacity: .6; }

.proyecto-card__header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
}

.proyecto-card__nombre {
  font-size:   1.02rem;
  font-weight: 600;
  color:       var(--text);
  margin:      0;
}

.proyecto-card__desc {
  font-size: .82rem;
  color:     var(--text-muted);
  margin:    0;
  line-height: 1.4;
}

.proyecto-card__amounts {
  display:     flex;
  align-items: baseline;
  gap:         6px;
}
.proyecto-card__saldo {
  font-size:   1.25rem;
  font-weight: 700;
}
.proyecto-card__meta {
  font-size: .85rem;
  color:     var(--text-muted);
}

.proyecto-card__pct {
  display:     flex;
  align-items: center;
  font-size:   .82rem;
}

.proyecto-card__inactive-badge {
  display:       inline-block;
  font-size:     .72rem;
  font-weight:   600;
  color:         var(--text-muted);
  border:        1px solid var(--border);
  border-radius: 20px;
  padding:       2px 10px;
  align-self:    flex-start;
}

/* ════════════════════════════════════════════════════
   Progress bar
   ════════════════════════════════════════════════════ */
.progress-bar {
  height:        8px;
  background:    var(--border);
  border-radius: 99px;
  overflow:      hidden;
}
.progress-bar__fill {
  height:        100%;
  border-radius: 99px;
  transition:    width .4s ease;
}

/* ════════════════════════════════════════════════════
   Color dot — tamaño grande
   ════════════════════════════════════════════════════ */
.color-dot--lg {
  width:  14px;
  height: 14px;
}

/* ════════════════════════════════════════════════════
   Badge — variante amarilla (vencimiento próximo)
   ════════════════════════════════════════════════════ */
.badge--yellow { background: #fef9c3; color: #854d0e; }

/* ════════════════════════════════════════════════════
   Nav section separators
   ════════════════════════════════════════════════════ */
.nav-section {
  font-size:      .64rem;
  font-weight:    700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:          var(--text-muted);
  padding:        14px 16px 4px;
  opacity:        .6;
}

/* ════════════════════════════════════════════════════
   Form success message
   ════════════════════════════════════════════════════ */
.form-success {
  background:    #f0fdf4;
  color:         #15803d;
  border:        1px solid #bbf7d0;
  border-radius: var(--radius);
  padding:       8px 12px;
  font-size:     .85rem;
  margin-top:    8px;
}

/* ════════════════════════════════════════════════════
   Modal pequeño (usar plantilla)
   ════════════════════════════════════════════════════ */
.modal--sm { max-width: 420px; }

/* ════════════════════════════════════════════════════
   Btn small
   ════════════════════════════════════════════════════ */
.btn--sm { padding: 5px 10px; font-size: .78rem; }

/* ════════════════════════════════════════════════════
   Resumen / Dashboard
   ════════════════════════════════════════════════════ */
.resumen-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  margin-bottom:   20px;
}
.resumen-bienvenida {
  font-size:   1.25rem;
  font-weight: 700;
  color:       var(--text);
  margin:      0;
}
.resumen-grid {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   16px;
  margin-top:            16px;
}
@media (max-width: 700px) {
  .resumen-grid { grid-template-columns: 1fr; }
}
.resumen-section-title {
  font-size:     .78rem;
  font-weight:   700;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:         var(--text-muted);
  margin:        0 0 12px;
  display:       flex;
  align-items:   center;
  gap:           6px;
}

/* Fondos list */
.resumen-fondo-row {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     5px 0;
}
.resumen-fondo-info {
  display:     flex;
  align-items: center;
  gap:         6px;
  min-width:   130px;
}
.resumen-fondo-nombre {
  font-size:   .85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
  max-width:   110px;
}
.resumen-fondo-bar-wrap {
  flex:       1;
  height:     6px;
  background: var(--border);
  border-radius: 99px;
  overflow:   hidden;
}
.resumen-fondo-bar {
  height:        100%;
  border-radius: 99px;
  transition:    width .4s ease;
}
.resumen-fondo-saldo {
  font-size:  .82rem;
  font-weight:700;
  white-space:nowrap;
  min-width:  90px;
  text-align: right;
}

/* Proyectos list */
.resumen-proyecto-row {
  display:       flex;
  flex-direction:column;
  gap:           4px;
  padding:       6px 0;
  border-bottom: 1px solid var(--border);
}
.resumen-proyecto-row:last-child { border-bottom: none; }
.resumen-proyecto-info {
  display:     flex;
  align-items: center;
  gap:         6px;
}
.resumen-proyecto-nombre {
  font-size:   .85rem;
  font-weight: 500;
  overflow:    hidden;
  text-overflow:ellipsis;
  white-space: nowrap;
}

/* Alertas */
.resumen-alertas-card { margin-top: 16px; }
.alerta-row {
  display:       flex;
  align-items:   center;
  gap:           10px;
  padding:       8px 12px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size:     .85rem;
}
.alerta-row:last-child { margin-bottom: 0; }
.alerta--danger  { background: #fef2f2; color: #b91c1c; border-left: 3px solid var(--danger); }
.alerta--warning { background: #fefce8; color: #854d0e; border-left: 3px solid #eab308; }
.alerta--info    { background: #f0f9ff; color: #0c4a6e; border-left: 3px solid #38bdf8; }

/* ════════════════════════════════════════════════════
   Plantillas — grid de cards
   ════════════════════════════════════════════════════ */
.plantilla-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap:                   14px;
}
.plantilla-card {
  background:     var(--surface);
  border:         1.5px solid var(--border);
  border-radius:  var(--radius-lg);
  padding:        16px;
  display:        flex;
  flex-direction: column;
  gap:            8px;
  transition:     box-shadow .15s, border-color .15s;
}
.plantilla-card:hover          { box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.plantilla-card--inactive      { opacity: .55; }
.plantilla-card__header        { display: flex; align-items: center; gap: 8px; }
.plantilla-card__nombre        { font-size: .95rem; font-weight: 600; margin: 0; }
.plantilla-card__concepto      { font-size: .82rem; color: var(--text-muted); margin: 0; }
.plantilla-card__meta          { display: flex; align-items: center; gap: 6px; padding-top: 4px; border-top: 1px solid var(--border); font-size: .82rem; }

/* ════════════════════════════════════════════════════
   Flujo de Efectivo — tabla interactiva
   ════════════════════════════════════════════════════ */
.flujo-table {
  min-width:      900px;
  border-collapse: collapse;
}

.flujo-concepto-th {
  min-width:  200px;
  position:   sticky;
  left:       0;
  background: var(--surface);
  z-index:    2;
}

.flujo-mes-th   { min-width: 82px; }
.flujo-total-th { min-width: 110px; white-space: nowrap; }

/* Concepto cell (first column) */
.flujo-concepto {
  position:    sticky;
  left:        0;
  background:  var(--surface);
  z-index:     1;
  white-space: nowrap;
  padding:     6px 12px !important;
}
.flujo-concepto__text    { margin-right: 4px; }
.flujo-concepto__actions { display: none; gap: 2px; }
.flujo-row:hover .flujo-concepto__actions { display: inline-flex; }

/* Editable amount cells */
.flujo-cell {
  cursor:     pointer;
  padding:    6px 10px !important;
  white-space: nowrap;
  min-width:  82px;
  transition: background .1s;
}
.flujo-cell:hover { background: #eff6ff; }
.flujo-cell-input {
  width:      90px;
  text-align: right;
  font-size:  .85rem;
  padding:    2px 6px;
  border:     1.5px solid var(--primary);
  border-radius: 4px;
  outline:    none;
}

.flujo-total { white-space: nowrap; min-width: 110px; padding: 6px 10px !important; }

/* Section header rows */
.flujo-row--section > td { padding: 0 !important; }
.flujo-section-hdr {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         6px 12px;
  font-size:       .78rem;
  font-weight:     700;
  letter-spacing:  .06em;
  border-bottom:   1px solid var(--border);
}
.flujo-section-hdr--ingreso { background: #f0fdf4; color: #15803d; }
.flujo-section-hdr--egreso  { background: #fef2f2; color: #b91c1c; }
.btn-link {
  background:  none;
  border:      none;
  padding:     0;
  cursor:      pointer;
  color:       var(--primary);
  font-family: inherit;
}

.flujo-add-btn {
  font-size:   .78rem;
  font-weight: 600;
  opacity:     .7;
}
.flujo-add-btn:hover { opacity: 1; }

/* Subtotal rows */
.flujo-row--subtotal td         { background: #f8faff; border-top: 1.5px solid var(--border); }
.flujo-row--subtotal-ingreso td { background: #f0fdf4; color: #15803d; }
.flujo-row--subtotal-egreso td  { background: #fff1f2; color: #b91c1c; }

/* Balance row */
.flujo-row--balance td {
  background:  var(--bg);
  border-top:  2px solid var(--primary);
  font-size:   .92rem;
}

/* Hidden rows */
.flujo-row--oculto { opacity: .4; }

/* ════════════════════════════════════════════════════
   Tarjetas — grid de cards de crédito
   ════════════════════════════════════════════════════ */
.tarjeta-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap:                   16px;
  padding:               4px 0;
}

.tarjeta-card {
  background:     var(--surface);
  border:         1.5px solid var(--border);
  border-radius:  var(--radius-lg);
  display:        flex;
  flex-direction: column;
  gap:            12px;
  overflow:       hidden;
  transition:     box-shadow .15s, border-color .15s;
}
.tarjeta-card:hover         { box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.tarjeta-card--inactive     { opacity: .6; }

.tarjeta-card__header {
  display:         flex;
  align-items:     center;
  gap:             8px;
  padding:         12px 16px;
  background:      var(--bg);
  border-bottom:   1px solid var(--border);
}

.tarjeta-card__nombre {
  font-size:   1rem;
  font-weight: 600;
  color:       var(--text);
  margin:      0;
  padding:     0 16px;
}

.tarjeta-card__amounts {
  display:       flex;
  flex-direction: column;
  gap:           6px;
  padding:       0 16px;
}

.tarjeta-card__amount-row {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
}

.tarjeta-card__footer {
  display:      flex;
  align-items:  center;
  gap:          8px;
  flex-wrap:    wrap;
  padding:      10px 16px;
  border-top:   1px solid var(--border);
  background:   var(--bg);
  margin-top:   auto;
}
