@font-face { font-family: "Poppins MAJ"; src: url(/fonts/Poppins-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins MAJ"; src: url(/fonts/Poppins-Medium.ttf) format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins MAJ"; src: url(/fonts/Poppins-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Archivo Black MAJ"; src: url(/fonts/ArchivoBlack-Regular.ttf) format("truetype"); font-display: swap; }

:root {
  --ground: #ffffff;
  --tone: #f4f6f8;
  --tone-2: #e9edf1;
  --line: #e3e7eb;
  --line-strong: #cfd6dd;
  --ink: #10243b;
  --muted: #5a6b7c;
  --navy: #14365c;
  --navy-soft: #e6edf5;
  --brass: #a4782f;
  --ok: #1d6b4a;
  --ok-soft: #e3f2ea;
  --bad: #a3322a;
  --bad-soft: #fbe9e7;
  --radius: 6px;
  font-family: "Poppins MAJ", sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-size: 14px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.num, td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ok { color: var(--ok); } .bad { color: var(--bad); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.mark { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.mark svg { flex: none; }
.mark b { font-family: "Archivo Black MAJ", "Poppins MAJ", sans-serif; font-weight: 400; font-size: 15px; letter-spacing: -0.01em; display: block; line-height: 1.1; }
.mark small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .grupo { font-size: 12px; color: var(--muted); padding: 12px 10px 4px; }
.nav a { display: block; padding: 7px 10px; border-radius: var(--radius); color: var(--ink); }
.nav a:hover { background: var(--tone); }
.nav a.on { background: var(--tone-2); font-weight: 500; }
.side .pie { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 6px; }
.side .pie button { margin-top: 6px; }
.main { padding: 24px 32px 64px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.top .titulo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.top .acciones { display: flex; gap: 8px; align-items: center; }
.estado { font-size: 12px; color: var(--muted); }
.estado.bad { color: var(--bad); }

/* ---------- Controles ---------- */
.btn { border: 1px solid var(--line-strong); background: var(--ground); padding: 7px 14px; border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--tone); }
.btn.pri { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.pri:hover { background: var(--navy); }
.btn.pri:disabled { background: var(--tone-2); border-color: var(--tone-2); color: var(--muted); cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--navy); padding: 3px 6px; }
.btn.link.bad { color: var(--bad); }
input[type=text], input[type=date], input[type=email], input[type=number], input:not([type]), select, textarea {
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 7px 10px; background: var(--ground); min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--navy); outline-offset: -1px; border-color: var(--navy); }
textarea { width: 100%; resize: vertical; }
label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.campo > input, label.campo > select { color: var(--ink); font-size: 14px; }
.fila { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.fila > .crece { flex: 1 1 220px; }
.panel { border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 20px; background: var(--ground); }
.panel.tono { background: var(--tone); border-color: var(--tone); }
.errores { color: var(--bad); font-size: 13px; margin: 8px 0 0; padding-left: 18px; }
.aviso { background: var(--tone); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; }
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--tone-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- Tablas ---------- */
table { border-collapse: collapse; width: 100%; }
th { font-size: 12px; font-weight: 400; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.total td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; }
tr.grupo td { font-weight: 600; }
td.cod { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; width: 1%; }
td .glosa { display: block; color: var(--muted); font-size: 13px; font-style: italic; }
td.sangria { padding-left: 46px; }
.tabla-scroll { overflow-x: auto; }

/* Libro diario: un bloque por asiento */
.diario tbody tr:last-child td { border-bottom: 1px solid var(--line-strong); }
.diario td.asiento { color: var(--muted); white-space: nowrap; }

/* Editor de asiento */
.lineas td { border-bottom: 0; padding: 4px 6px 4px 0; vertical-align: middle; }
.lineas th { padding: 4px 6px 4px 0; border: 0; }
.lineas input { width: 100%; }
.lineas input.n { text-align: right; font-variant-numeric: tabular-nums; }
.lineas .nombre { font-size: 12px; color: var(--muted); display: block; min-height: 16px; padding: 2px 2px 0; }
.lineas tfoot td { padding-top: 10px; font-weight: 600; }

/* Mayores en doble T: la firma de este programa */
.tes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px 24px; }
.t h3 { text-align: center; padding-bottom: 6px; border-bottom: 2px solid var(--navy); font-size: 13px; }
.t h3 small { display: block; color: var(--muted); font-weight: 400; }
.t .cuerpo { display: grid; grid-template-columns: 1fr 1fr; }
.t .lado { padding: 6px 10px 6px 0; font-variant-numeric: tabular-nums; }
.t .lado:nth-child(even) { border-left: 2px solid var(--navy); padding: 6px 0 6px 10px; }
.t .lado.pie-t { padding-top: 0; padding-bottom: 0; }
.t .mv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 1.7; }
.t .mv i { color: var(--muted); font-style: normal; }
.t .suma { border-top: 1px solid var(--line-strong); padding-top: 4px; font-weight: 600; display: flex; justify-content: space-between; min-height: 27px; }
.t .saldo { display: flex; justify-content: space-between; font-size: 13px; color: var(--navy); font-weight: 600; padding-top: 2px; }

/* Estados financieros */
.estado-fin { max-width: 760px; }
.estado-fin td.v { width: 140px; }
.estado-fin tr.n1 td { font-weight: 600; }
.estado-fin tr.n2 td:first-child { padding-left: 22px; }
.estado-fin tr.n3 td:first-child { padding-left: 38px; }
.estado-fin tr.n4 td:first-child, .estado-fin tr.n5 td:first-child { padding-left: 54px; }
.estado-fin tr.resalta td { background: var(--navy-soft); font-weight: 600; color: var(--navy); }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.cuadre { margin-top: 16px; font-weight: 500; }

/* Kárdex */
.kardex th.g { text-align: center; border-bottom: 1px solid var(--line); }
.kardex td { font-size: 13px; }
.kardex td.sep, .kardex th.sep { border-left: 1px solid var(--line); }
.kardex .capa { display: block; }
.prod-lista { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.prod-lista a { padding: 5px 12px; border-radius: 99px; background: var(--tone); color: var(--ink); }
.prod-lista a.on { background: var(--ink); color: #fff; }

/* Formulario 104/103 */
.cas td.c { color: var(--navy); font-weight: 600; width: 64px; font-variant-numeric: tabular-nums; }
.cas tr.sub td { background: var(--tone); font-weight: 600; }
.cas tr.cero td { color: var(--muted); }

/* Entrada */
.entrada { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.entrada .izq { padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; }
.entrada .der { background: var(--tone); padding: 56px 64px; display: flex; align-items: center; }
.entrada form { display: flex; flex-direction: column; gap: 14px; max-width: 380px; width: 100%; }
.entrada .grande { font-family: "Archivo Black MAJ", "Poppins MAJ", sans-serif; font-size: 44px; line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 16px; font-weight: 400; max-width: 12ch; }
.muestra { background: var(--ground); border-radius: 8px; padding: 22px 26px; width: 100%; max-width: 460px; }

.vacio { padding: 28px 0; color: var(--muted); }
.lista-prac a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.lista-prac a:hover b { color: var(--navy); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .grupo { display: none; }
  .main { padding: 18px 16px 48px; }
  .dos-col, .entrada { grid-template-columns: 1fr; }
  .entrada .izq, .entrada .der { padding: 32px 22px; }
  .entrada .grande { font-size: 34px; }
}
@media print {
  .side, .top .acciones, .no-print, .panel.form { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .panel { border: 0; padding: 0; }
}
#d-prev { flex: 1 1 380px; line-height: 1.8; }
#d-prev b, #d-prev span { white-space: nowrap; }
.voz { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.voz input { flex: 1 1 320px; }
.avisos { margin: 0 0 10px; padding-left: 18px; font-size: 13px; color: var(--navy); }
.avisos:empty { display: none; }
.mayor-sel { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.lista-mayores { display: flex; flex-direction: column; max-height: 72vh; overflow: auto; position: sticky; top: 16px; }
.lista-mayores a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: var(--radius); color: var(--ink); font-size: 13px; }
.lista-mayores a:hover { background: var(--tone); }
.lista-mayores a.on { background: var(--tone-2); font-weight: 500; }
.lista-mayores a b { font-weight: 400; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.lista-mayores .cod-m { display: block; font-size: 11px; color: var(--muted); }
.doble-t thead th { border-bottom: 2px solid var(--navy); color: var(--ink); font-weight: 600; }
.doble-t .col-t { border-left: 2px solid var(--navy); width: 130px; }
.doble-t tfoot td { border-top: 2px solid var(--navy); }
@media (max-width: 900px) { .mayor-sel { grid-template-columns: 1fr; } .lista-mayores { position: static; max-height: 220px; } }
.diario-tx { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; gap: 24px; align-items: start; margin-bottom: 24px; }
.diario-tx .panel { margin-bottom: 0; }
.transacciones { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.transacciones h2 { margin-bottom: 6px; }
.tx { display: flex; gap: 12px; text-align: left; border: 1px solid var(--line); background: var(--ground); border-radius: 8px; padding: 12px 14px; cursor: pointer; line-height: 1.5; }
.tx:hover { border-color: var(--line-strong); }
.tx.on { border-color: var(--navy); box-shadow: inset 3px 0 0 var(--navy); background: var(--navy-soft); }
.tx.hecha { background: var(--tone); }
.tx.hecha .tx-t { color: var(--muted); }
.tx-n { flex: none; width: 26px; height: 26px; border-radius: 99px; background: var(--tone-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.tx.on .tx-n { background: var(--navy); color: #fff; }
.tx.hecha .tx-n { background: var(--ok-soft); color: var(--ok); }
.tx-t { font-size: 14px; }
.tx-ok { display: block; font-size: 12px; color: var(--ok); margin-top: 4px; }
@media (max-width: 1000px) { .diario-tx { grid-template-columns: 1fr; } .transacciones { position: static; max-height: 260px; } }
