/* =====================================================================
   GAIA Contable - estilos
   Colores inspirados en la Estrella de Oriente: azul, rojo, verde y dorado
   ===================================================================== */
:root {
  --navy: #1b2a4a;
  --navy-2: #24365e;
  --gold: #c9a227;
  --gold-soft: #f5ecd0;
  --bg: #f4f5f8;
  --ink: #1d2433;
  --muted: #6b7385;
  --line: #e3e6ee;
  --adm: #2c5aa0;
  --ben: #b8445a;
  --psc: #2f7d5b;
  --ok: #2f9e6b;
  --bad: #d0554d;
  --radius: 12px;
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
body { background: var(--bg); color: var(--ink); font-family: var(--bs-body-font-family); }
a { color: var(--adm); }
.btn-primary { --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-hover-bg: var(--navy-2); --bs-btn-hover-border-color: var(--navy-2); --bs-btn-active-bg: var(--navy-2); }
.btn-outline-primary { --bs-btn-color: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--navy); }
.nav-pills .nav-link { color: var(--navy); }

/* ---------- estructura ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { --bs-offcanvas-bg: var(--navy); --bs-offcanvas-width: 280px; width: 268px; background: var(--navy) !important; color: #cfd6e6; display: flex; flex-direction: column; flex-shrink: 0; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.estrella { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--gold), #e6c45a); color: var(--navy); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.brand-title { color: #fff; font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: #9fb0d0; }
.sidebar-nav { padding: 10px 10px 20px; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7f8fb0; padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #d4dbea; text-decoration: none; font-size: 14px; }
.nav-item i { font-size: 16px; width: 20px; text-align: center; color: #9fb0d0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(201,162,39,.16); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-item.active i { color: var(--gold); }
.sidebar-foot { font-size: 11px; color: #7f8fb0; padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
@media (max-width: 575px) { .content { padding: 16px; } .topbar { padding: 8px 12px; } }
.btn-icon { font-size: 22px; padding: 2px 8px; }
.gestion-pill, .user-pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* ---------- encabezados y tarjetas ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(20,30,60,.04); }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-footer { background: #fafbfd; border-top: 1px solid var(--line); }
.filtros { background: #fff; }
.table > :not(caption) > * > * { padding-top: .5rem; padding-bottom: .5rem; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
tr.anulado td { opacity: .5; text-decoration: line-through; }
tr.anulado td:last-child { text-decoration: none; opacity: 1; }
tr.grupo td, tr.grupo th { background: #f3f5fa; font-weight: 600; }
tr.genero td { background: var(--navy); color: #fff; font-weight: 700; }

.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-state > i { font-size: 48px; color: var(--gold); display: block; margin-bottom: 10px; }

/* ---------- panel ---------- */
.cta-card { border-radius: var(--radius); padding: 18px 20px; color: #fff; position: relative; overflow: hidden; height: 100%; }
.cta-card::after { content: "★"; position: absolute; right: -10px; bottom: -42px; font-size: 140px; opacity: .08; }
.cta-adm { background: linear-gradient(135deg, var(--adm), #1f4280); }
.cta-ben { background: linear-gradient(135deg, var(--ben), #8e2f43); }
.cta-psc { background: linear-gradient(135deg, var(--psc), #215c42); }
.cta-name { font-weight: 600; }
.cta-bank { font-size: 12px; opacity: .8; }
.cta-ico { font-size: 26px; opacity: .85; }
.cta-saldo { font-size: 1.75rem; font-weight: 700; margin: 14px 0 6px; letter-spacing: -.5px; }
.cta-mini { display: flex; gap: 16px; font-size: 13px; opacity: .9; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; height: 100%; }
.kpi-l { font-size: 12px; color: var(--muted); }
.kpi-v { font-size: 1.25rem; font-weight: 700; margin-top: 2px; }
.kpi-s { font-size: 12px; color: var(--muted); }
.badge-adm { background: var(--adm); }
.badge-ben { background: var(--ben); }
.badge-psc { background: var(--psc); }

/* ---------- formulario de movimientos ---------- */
.form-mov.form-ing { border-top: 4px solid var(--ok); }
.form-mov.form-egr { border-top: 4px solid var(--bad); }
.btn-cuenta { border: 2px solid var(--line); background: #fff; text-align: left; padding: 10px 14px; display: flex; flex-direction: column; color: var(--ink); border-radius: 10px; }
.btn-cuenta small { color: var(--muted); font-size: 12px; }
.btn-cuenta .sig { color: var(--navy); font-weight: 600; }
.btn-check:checked + .btn-cuenta.cta-adm { border-color: var(--adm); background: #eef3fb; color: var(--ink); }
.btn-check:checked + .btn-cuenta.cta-ben { border-color: var(--ben); background: #fbeff1; color: var(--ink); }
.btn-check:checked + .btn-cuenta.cta-psc { border-color: var(--psc); background: #eef7f2; color: var(--ink); }
.btn-cuenta.cta-adm, .btn-cuenta.cta-ben, .btn-cuenta.cta-psc { background: #fff; }

/* ---------- presupuesto ---------- */
.pres-tab { display: block; padding: 12px 14px; border-radius: 10px; background: #fff; border: 2px solid var(--line); text-decoration: none; color: var(--ink); }
.pres-tab span { display: block; font-size: 12px; color: var(--muted); }
.pres-tab.active.cta-adm { border-color: var(--adm); }
.pres-tab.active.cta-ben { border-color: var(--ben); }
.pres-tab.active.cta-psc { border-color: var(--psc); }
.pres-tab.cta-adm, .pres-tab.cta-ben, .pres-tab.cta-psc { background: #fff; }
.tabla-pres input { min-width: 80px; }

/* ---------- gestiones ---------- */
.gestion-card.abierta { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.g-logos { display: flex; flex-direction: column; gap: 6px; }
.g-logos img, .g-logo-vacio { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; background: #fafbfd; border: 1px solid var(--line); }
.g-logo-vacio { display: grid; place-items: center; color: var(--gold); font-size: 26px; }
.g-aut { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; margin: 10px 0 0; }
.g-aut dt { color: var(--muted); font-weight: 500; }
.g-aut dd { margin: 0; font-weight: 600; }
.g-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.g-nums div { background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.g-nums span { display: block; font-size: 11px; color: var(--muted); }
.g-nums b { font-size: 14px; }
@media (max-width: 575px) { .g-nums { grid-template-columns: repeat(2, 1fr); } }
.paso { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; margin-right: 6px; }
.cta-nueva { border-left: 4px solid; padding: 10px 12px; border-radius: 8px; background: #fafbfd; margin-bottom: 10px; }
.cta-nueva.cta-adm { border-color: var(--adm); } .cta-nueva.cta-ben { border-color: var(--ben); } .cta-nueva.cta-psc { border-color: var(--psc); }
.cta-nueva.cta-adm, .cta-nueva.cta-ben, .cta-nueva.cta-psc { background: #fafbfd; color: var(--ink); }
.logo-prev { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.logo-prev img { max-height: 80px; max-width: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.logo-prev small { color: var(--muted); }

/* ---------- miembros ---------- */
.estado-activo { background: var(--ok); } .estado-vitalicia { background: var(--gold); color: #3a2c00; }
.estado-licencia { background: #e0a106; } .estado-baja, .estado-renuncio { background: #8a91a3; } .estado-fallecido { background: #3b3f4a; }

/* ---------- reportes (pantalla y papel) ---------- */
.hoja { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; }
@media (max-width: 575px) { .hoja { padding: 16px; } }
.rep-head { display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; gap: 12px; border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 18px; text-align: center; }
.rep-logo img { max-width: 86px; max-height: 86px; object-fit: contain; }
.rep-inst { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.rep-cap { font-weight: 600; }
.rep-title { font-size: 1.2rem; font-weight: 700; margin: 6px 0 2px; color: var(--navy); letter-spacing: .02em; }
.rep-sub { font-size: 13px; color: var(--muted); }
.rep-tabla { font-size: 13px; }
.rep-tabla thead th { background: #f3f5fa; }
.rep-tabla tr.total td, .rep-tabla tr.total th, .rep-tabla tfoot th { background: #eef1f7; font-weight: 700; }
.rep-er tr.seccion td { background: var(--navy); color: #fff; font-weight: 700; letter-spacing: .05em; }
.rep-er tr.resultado td { font-weight: 800; font-size: 15px; }
.rep-er tr.resultado.pos td { background: #e6f5ec; color: #1f6e48; }
.rep-er tr.resultado.neg td { background: #fbeaea; color: #a33a33; }
.rep-firmas { display: flex; justify-content: space-around; gap: 24px; margin-top: 70px; flex-wrap: wrap; }
.firma { text-align: center; min-width: 170px; flex: 1; max-width: 240px; }
.firma .linea { border-top: 1px solid #333; margin-bottom: 4px; }
.firma .fn { font-size: 12px; font-weight: 600; min-height: 16px; }
.firma .fc { font-size: 12px; color: var(--muted); }
.rep-pie { text-align: right; font-size: 10px; color: #9aa1b2; margin-top: 24px; }
.pct { position: relative; background: #eef1f7; border-radius: 6px; height: 20px; overflow: hidden; min-width: 90px; }
.pct-bar { position: absolute; inset: 0 auto 0 0; background: #b7d7c6; }
.pct-bar.over { background: #f0b7b2; }
.pct span { position: relative; font-size: 12px; font-weight: 600; padding: 0 6px; line-height: 20px; }
.comprobante { max-width: 860px; margin: 0 auto; position: relative; }
.comp-nro { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.comp-nro div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.comp-nro span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.comp-nro b { font-size: 1.05rem; }
.comp-tabla { width: 100%; font-size: 14px; }
.comp-tabla th { width: 160px; color: var(--muted); font-weight: 500; vertical-align: top; padding: 6px 0; }
.comp-tabla td { padding: 6px 0; border-bottom: 1px dotted #ccd; }
.sello-anulado { position: absolute; top: 150px; right: 40px; transform: rotate(-12deg); border: 4px solid #c33; color: #c33; font-size: 2rem; font-weight: 800; padding: 4px 18px; border-radius: 8px; opacity: .8; text-align: center; }
.sello-anulado small { display: block; font-size: 12px; font-weight: 600; }
.print-only { display: none; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(circle at 20% 20%, #2a3f6d, var(--navy) 60%); color: #e3e9f6; padding: 60px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-art::after { content: "★"; position: absolute; right: -60px; bottom: -120px; font-size: 420px; color: var(--gold); opacity: .07; }
.login-star { width: 64px; height: 64px; border-radius: 16px; background: linear-gradient(135deg, var(--gold), #e6c45a); color: var(--navy); display: grid; place-items: center; font-size: 30px; margin-bottom: 24px; }
.login-art h1 { color: #fff; font-weight: 800; font-size: 2.4rem; }
.login-art p { font-size: 1.05rem; color: #b9c5de; }
.login-feats { list-style: none; padding: 0; margin: 20px 0 0; }
.login-feats li { padding: 4px 0; } .login-feats i { color: var(--gold); margin-right: 6px; }
.login-form { display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-art { padding: 36px 24px; } .login-art h1 { font-size: 1.8rem; } .login-feats { display: none; } }

/* ---------- impresión ---------- */
@media print {
  @page { size: A4 portrait; margin: 14mm 12mm; }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .alert, .modal { display: none !important; }
  .print-only { display: block !important; }
  .content { padding: 0; max-width: none; }
  .hoja, .card { border: none !important; box-shadow: none !important; padding: 0 !important; }
  .table-responsive { overflow: visible !important; }
  .rep-tabla, .table { font-size: 11px; }
  a { color: inherit; text-decoration: none; }
  tr { page-break-inside: avoid; }
  .rep-firmas { page-break-inside: avoid; }
  .cta-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* gráfico del panel */
.graf svg { width: 100%; height: auto; display: block; }
.g-grid { stroke: #e8ebf2; }
.g-eje { font-size: 11px; fill: #6b7385; font-family: inherit; }
.g-ing { fill: var(--ok); }
.g-egr { fill: var(--bad); }
.g-saldo { fill: none; stroke: var(--navy); stroke-width: 2.5; }
.g-punto { fill: #fff; stroke: var(--navy); stroke-width: 2; }
.rep-tabla .text-end { white-space: nowrap; }
