/* ============================================================
   Escáner Tributario — Contabilidad Inteligente
   Sistema de diseño
   ============================================================ */

:root{
  /* Marca */
  --navy:        #0e1f2d;
  --navy-2:      #16293a;
  --navy-3:      #213347;
  --brand:       #2f6fc0;   /* azul corporativo (bombilla) */
  --brand-600:   #2a63ad;
  --brand-700:   #234f8a;
  --brand-soft:  #eaf1fb;
  --green:       #5fb98a;   /* verde wordmark */
  --green-soft:  #e6f4ec;

  /* Superficies (app clara) */
  --bg:          #f3f6fa;
  --card:        #ffffff;
  --card-2:      #fafbfd;
  --border:      #e5eaf1;
  --border-2:    #eef1f6;

  /* Texto */
  --ink:         #16222e;
  --ink-2:       #56657a;
  --ink-3:       #8a98aa;

  /* Semáforo tributario */
  --ok:          #1d9d5b;
  --ok-soft:     #e4f5ec;
  --warn:        #d98a04;
  --warn-soft:   #fbf0d8;
  --danger:      #d83a4c;
  --danger-soft: #fbe7e9;
  --info:        #1f8aa8;
  --info-soft:   #e2f1f6;
  --neutral:     #93a0b0;
  --neutral-soft:#eef1f5;

  /* Radios / sombras */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --sh-sm: 0 1px 2px rgba(16,32,48,.06), 0 1px 3px rgba(16,32,48,.04);
  --sh:    0 4px 16px rgba(16,32,48,.07), 0 1px 3px rgba(16,32,48,.05);
  --sh-lg: 0 18px 48px rgba(16,32,48,.16);

  --grad: linear-gradient(100deg, #2f6fc0 0%, #46a0c4 52%, #5fb98a 100%);

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --sidebar-w: 264px;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
#root{ min-height:100vh; }
button{ font-family:inherit; cursor:pointer; }
input,select,textarea{ font-family:inherit; }
a{ color:inherit; text-decoration:none; }
::selection{ background:rgba(47,111,192,.18); }

/* tipografía utilitaria */
.h1{ font-size:26px; font-weight:800; letter-spacing:-.02em; margin:0; }
.h2{ font-size:19px; font-weight:700; letter-spacing:-.01em; margin:0; }
.h3{ font-size:15px; font-weight:700; margin:0; }
.muted{ color:var(--ink-2); }
.mono{ font-family:var(--mono); }
.eyebrow{ font-size:11px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--ink-3); }

/* ---------- Logo lockup ---------- */
.lockup{ display:flex; align-items:center; gap:11px; }
.lockup img{ display:block; }
.lockup .wm{ font-weight:800; font-size:18px; letter-spacing:-.02em; line-height:1; white-space:nowrap; }
.lockup .wm .b{ color:#fff; }
.lockup .wm .i{ background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
.lockup.on-light .wm .b{ color:var(--brand); }

/* ============================================================
   Botones
   ============================================================ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:1px solid transparent; border-radius:10px;
  font-weight:700; font-size:14px; line-height:1; padding:0 16px; height:42px;
  transition:transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s;
  white-space:nowrap; user-select:none;
}
.btn:active{ transform:translateY(1px); }
.btn svg{ width:17px; height:17px; }
.btn-primary{ background:var(--brand); color:#fff; box-shadow:0 6px 16px rgba(47,111,192,.28); }
.btn-primary:hover{ background:var(--brand-600); }
.btn-grad{ background:var(--grad); color:#fff; box-shadow:0 8px 22px rgba(47,111,192,.30); background-size:140% 140%; }
.btn-grad:hover{ background-position:100% 0; }
.btn-ghost{ background:var(--card); color:var(--ink); border-color:var(--border); box-shadow:var(--sh-sm); }
.btn-ghost:hover{ border-color:#cfd8e4; background:var(--card-2); }
.btn-subtle{ background:var(--brand-soft); color:var(--brand-700); }
.btn-subtle:hover{ background:#dfeafa; }
.btn-danger{ background:var(--danger); color:#fff; }
.btn-sm{ height:34px; padding:0 12px; font-size:13px; border-radius:9px; }
.btn-lg{ height:50px; padding:0 24px; font-size:15px; border-radius:12px; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:.5; cursor:not-allowed; box-shadow:none; }
.btn-icon{ width:40px; height:40px; padding:0; border-radius:10px; display:flex; align-items:center; justify-content:center; }
.menu-btn{ display:none; }

/* ============================================================
   Cards
   ============================================================ */
.card{ background:var(--card); border:1px solid var(--border); border-radius:var(--r-lg); box-shadow:var(--sh-sm); }
.card-pad{ padding:22px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 22px; border-bottom:1px solid var(--border-2); }
.card-head .h2{ display:flex; align-items:center; gap:10px; }

/* ============================================================
   Inputs
   ============================================================ */
.field{ display:flex; flex-direction:column; gap:7px; }
.label{ font-size:13px; font-weight:700; color:var(--ink); }
.label .req{ color:var(--danger); }
.hint{ font-size:12px; color:var(--ink-3); }
.input, .select{
  height:46px; padding:0 14px; border:1.5px solid var(--border); border-radius:11px;
  background:var(--card); font-size:15px; color:var(--ink); width:100%;
  transition:border-color .15s, box-shadow .15s; outline:none;
}
.input::placeholder{ color:var(--ink-3); }
.input:focus, .select:focus{ border-color:var(--brand); box-shadow:0 0 0 4px rgba(47,111,192,.14); }
.input-wrap{ position:relative; display:flex; align-items:center; }
.input-wrap .lead{ position:absolute; left:13px; color:var(--ink-3); display:flex; pointer-events:none; }
.input-wrap.has-lead .input{ padding-left:42px; }
.input-wrap .trail{ position:absolute; right:8px; }
.eye{ background:none; border:none; color:var(--ink-3); width:34px; height:34px; border-radius:8px; display:flex; align-items:center; justify-content:center; }
.eye:hover{ background:var(--border-2); color:var(--ink-2); }

/* checkbox / radio */
.check{ display:flex; gap:11px; align-items:flex-start; cursor:pointer; user-select:none; }
.check input{ position:absolute; opacity:0; width:0; height:0; }
.check .box{ flex:0 0 auto; width:22px; height:22px; border-radius:7px; border:1.5px solid var(--border); background:var(--card); display:flex; align-items:center; justify-content:center; margin-top:1px; transition:.15s; }
.check .box svg{ width:14px; height:14px; color:#fff; opacity:0; transform:scale(.5); transition:.15s; }
.check input:checked + .box{ background:var(--brand); border-color:var(--brand); }
.check input:checked + .box svg{ opacity:1; transform:scale(1); }
.check input:disabled + .box{ background:var(--border-2); }
.check.disabled{ opacity:.55; cursor:not-allowed; }
.check .ctxt{ font-size:14px; }
.check .ctxt b{ font-weight:700; }
.check .ctxt > span{ display:block; color:var(--ink-3); font-size:12.5px; margin-top:2px; }

/* ============================================================
   Badges / pills
   ============================================================ */
.badge{ display:inline-flex; align-items:center; gap:6px; height:25px; padding:0 10px; border-radius:999px; font-size:12px; font-weight:700; letter-spacing:.01em; }
.badge .dot{ width:7px; height:7px; border-radius:50%; background:currentColor; }
.badge svg{ width:13px; height:13px; }
.badge-ok{ background:var(--ok-soft); color:#137a44; }
.badge-warn{ background:var(--warn-soft); color:#9c6303; }
.badge-danger{ background:var(--danger-soft); color:#b3273a; }
.badge-info{ background:var(--info-soft); color:#0f6a83; }
.badge-neutral{ background:var(--neutral-soft); color:#5d6b7c; }
.badge-brand{ background:var(--brand-soft); color:var(--brand-700); }

/* ============================================================
   Tablas
   ============================================================ */
.table-wrap{ overflow-x:auto; }
table.tbl{ width:100%; border-collapse:collapse; font-size:14px; }
table.tbl th{ text-align:left; font-size:11.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); padding:12px 16px; border-bottom:1px solid var(--border); white-space:nowrap; }
table.tbl td{ padding:14px 16px; border-bottom:1px solid var(--border-2); vertical-align:middle; }
table.tbl tr:last-child td{ border-bottom:none; }
table.tbl tbody tr{ transition:background .12s; }
table.tbl tbody tr.click{ cursor:pointer; }
table.tbl tbody tr.click:hover{ background:var(--card-2); }

/* ============================================================
   Animaciones
   ============================================================ */
@keyframes fadeUp{ from{ opacity:.35; transform:translateY(12px); } to{ opacity:1; transform:none; } }
@keyframes riseIn{ from{ transform:translateY(12px); } to{ transform:none; } }
@keyframes spin{ to{ transform:rotate(360deg); } }
@keyframes pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.4; } }
@keyframes shimmer{ 0%{ background-position:-400px 0; } 100%{ background-position:400px 0; } }
@media (prefers-reduced-motion: no-preference){
  .fade-up{ animation:riseIn .45s ease both; }
}
.spin{ animation:spin .8s linear infinite; }
.skel{ background:linear-gradient(90deg,#eef1f6 25%,#e3e8f0 37%,#eef1f6 63%); background-size:800px 100%; animation:shimmer 1.4s infinite; border-radius:8px; }

/* scrollbars */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-thumb{ background:#cfd8e4; border-radius:10px; border:2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover{ background:#b8c4d4; }

/* utilidades layout */
.row{ display:flex; gap:14px; }
.col{ display:flex; flex-direction:column; }
.between{ justify-content:space-between; }
.center{ align-items:center; }
.wrap{ flex-wrap:wrap; }
.grow{ flex:1; }
.gap-sm{ gap:8px; }
.gap-lg{ gap:22px; }
.hide-desktop{ display:none; }

/* ---------- Drawer móvil ---------- */
.drawer-overlay{ position:fixed; inset:0; z-index:80; background:rgba(14,31,45,.5); backdrop-filter:blur(2px); animation:fadeUp .2s; }
.drawer{ position:fixed; top:0; left:0; bottom:0; animation:slideIn .22s ease; box-shadow:var(--sh-lg); }
@keyframes slideIn{ from{ transform:translateX(-100%); } to{ transform:none; } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1080px){
  .dash-cols, .form-cols, .prog-cols{ grid-template-columns:1fr !important; }
  .report-cols{ grid-template-columns:1fr !important; }
  .toc{ display:none !important; }
  .stat-grid{ grid-template-columns:repeat(2,1fr) !important; }
}
@media (max-width: 860px){
  .hide-mobile{ display:none !important; }
  .hide-desktop{ display:initial; }
  .menu-btn{ display:flex !important; }
  .login-grid{ grid-template-columns:1fr !important; }
  .login-brand{ display:none !important; }
  .kv-grid, .resume-grid{ grid-template-columns:1fr !important; }
}
@media (max-width: 560px){
  .stat-grid{ grid-template-columns:1fr !important; }
  .h1{ font-size:22px; }
  .card-pad{ padding:18px; }
  .dash-hero{ padding:20px !important; }
}

/* ============================================================
   Impresión (Certificado → PDF)
   ============================================================ */
@media print{
  @page{ margin:14mm; }
  body{ background:#fff; }
  .sidebar-desktop, .drawer-overlay, header, .no-print, .toc{ display:none !important; }
  main{ display:block !important; }
  .report-cols{ grid-template-columns:1fr !important; display:block !important; }
  .paper{ border:none !important; box-shadow:none !important; padding:0 !important; max-width:none !important; }
  section{ break-inside:avoid; }
  .card{ box-shadow:none !important; }
}
