/* KardexEC · «la tarjeta kardex»
   Base común de la familia Utiliec (gris oficina, papel blanco, tablas con encabezado negro)
   con color propio: verde oliva. Tipografías alojadas en el sitio (licencia OFL, ver fonts/). */
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --office: #eef1f4;
  --paper: #ffffff;
  --ink: #1d2125;
  --muted: #5b626c;
  --rule: #d6dbe2;
  --rule-soft: #e7eaee;
  --brand: #4f6110;        /* verde oliva de marca */
  --brand-ink: #ffffff;
  --brand-soft: #eef2dd;
  --in: #eef2dd;           /* columnas de entradas */
  --out: #f7eae3;          /* columnas de salidas */
  --bal: #eceff3;          /* columnas de saldo */
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --office: #14171b; --paper: #1d2126; --ink: #e8eaed; --muted: #a3aab4; --rule: #343b45; --rule-soft: #2a3038;
    --brand: #c2d46a; --brand-ink: #1a2004; --brand-soft: #2a3116; --in: #252c16; --out: #33231c; --bal: #262b32; --bad: #ff9b92; --bad-soft: #3a1a17; }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: var(--sans); font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--office); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--paper); z-index: 99; border-radius: 6px; font-weight: 700; }
.skip-link:focus-visible { top: 1rem; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); }

/* ---------- Cabecera ---------- */
.top { background: var(--paper); border-bottom: 1px solid var(--rule); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { padding: 6px 12px; font-size: .95rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }
@media (max-width: 640px) { .top nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -6px; } .top nav a { white-space: nowrap; } }

.hero { padding: 26px 0 16px; }
.hero h1 { font-size: clamp(1.6rem, 3vw + .7rem, 2.4rem); font-weight: 700; letter-spacing: -.015em; max-width: 26ch; }
.sub { color: var(--muted); margin-top: 8px; max-width: 66ch; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; min-height: 44px; border-radius: 6px; font-weight: 600; font-size: .95rem; border: 1px solid var(--rule); background: var(--paper); text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: progress; }

/* ---------- Herramienta ---------- */
.tool { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; }
.tool[data-state="idle"] .res, .tool[data-state="working"] .res { display: none; }
.tool[data-state="done"] .drop, .tool[data-state="working"] .drop { display: none; }
.tool:not([data-state="working"]) .trabajando { display: none; }
.drop { position: relative; display: grid; justify-items: center; text-align: center; gap: 10px; padding: 34px 20px 28px; }
.drop::before { content: ""; position: absolute; inset: 10px; border: 1.5px dashed var(--rule); border-radius: 8px; pointer-events: none; transition: border-color .15s, background-color .15s; }
.drop.over::before { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.drop-ico { color: var(--brand); }
.drop-t { font-size: 1.2rem; font-weight: 600; }
.drop-s { color: var(--muted); font-size: .93rem; max-width: 52ch; }
.drop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; position: relative; }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.carga-error { position: relative; max-width: 60ch; padding: 8px 12px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-size: .92rem; }
.trabajando { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Opciones de cálculo */
.opciones { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.opciones .lbl { font-weight: 600; font-size: .95rem; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg label + label { border-left: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; font-size: .93rem; color: var(--muted); }
.seg input:checked + span { background: var(--ink); color: var(--paper); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -3px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--brand); }

.res-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.res-sum { font-weight: 600; overflow-wrap: anywhere; }
.res-sum small { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; }
.res-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.problemas { margin: 14px 16px 0; padding: 10px 14px; border-radius: 6px; background: color-mix(in srgb, var(--brand) 8%, var(--paper)); font-size: .9rem; }
.problemas.con-error { background: var(--bad-soft); }
.problemas summary { cursor: pointer; font-weight: 600; }
.problemas.con-error summary { color: var(--bad); }
.problemas ul { margin: 8px 0 2px; padding-left: 18px; max-height: 260px; overflow-y: auto; }
.problemas li { margin-bottom: 4px; }
.problemas li.err strong { color: var(--bad); }

.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 16px; }
.cifra { border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; display: grid; gap: 2px; }
.c-l { font-size: .88rem; color: var(--muted); }
.c-v { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.c-n { font-size: .8rem; color: var(--muted); }

.vistas { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.vistas button { padding: 10px 14px; font-size: .95rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.vistas button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }
.panel { padding: 16px; display: grid; gap: 14px; min-width: 0; }
.ayuda { font-size: .88rem; color: var(--muted); }
.sel-prod { display: grid; gap: 4px; max-width: 520px; }
.sel-prod span { font-weight: 600; font-size: .92rem; }
.sel-prod select { min-height: 44px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: .95rem; }

/* Tablas */
.tbl { overflow-x: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 72%, var(--ink)); font-weight: 700; text-align: center; white-space: nowrap; border-bottom: 2px solid var(--brand); }
.tbl td.n { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: .84rem; font-variant-numeric: tabular-nums; }
.tbl td.nw { white-space: nowrap; }
.tbl td.fuerte { font-weight: 600; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--ink); background: color-mix(in srgb, var(--brand) 6%, var(--paper)); }
.tbl small { display: block; font-size: .78rem; }
.alerta { color: var(--bad); }
table.resumen { min-width: 860px; }
.fila-prod { cursor: pointer; }
.fila-prod:hover td, .fila-prod:focus td { background: var(--brand-soft); }
.fila-prod:focus { outline: none; }
.fila-prod:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* La tarjeta kardex (elemento propio de esta web) */
.tarjeta { border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); overflow: hidden; }
.t-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 14px 10px; border-top: 6px solid var(--brand); }
.t-cod { font-size: .85rem; padding: 1px 8px; border-radius: 4px; background: var(--brand-soft); color: var(--ink); }
.t-head h3 { font-size: 1.1rem; }
.t-meta { font-size: .85rem; color: var(--muted); }
.tarjeta .tbl { border: 0; border-top: 1px solid var(--rule); border-radius: 0; }
table.kardex { min-width: 1100px; }
table.kardex tr.grupos th { background: var(--paper); color: var(--ink); border-bottom: 0; font-size: .8rem; padding: 6px 10px 2px; }
table.kardex tr.grupos th.g-ent { background: var(--in); }
table.kardex tr.grupos th.g-sal { background: var(--out); }
table.kardex tr.grupos th.g-sal2 { background: var(--bal); }
table.kardex td.e { background: color-mix(in srgb, var(--in) 55%, var(--paper)); }
table.kardex td.s { background: color-mix(in srgb, var(--out) 55%, var(--paper)); }
table.kardex td.b { background: color-mix(in srgb, var(--bal) 70%, var(--paper)); }
table.kardex td.rojo { color: var(--bad); }
table.kardex td.det { min-width: 240px; color: var(--muted); }
table.kardex td.mono, table.resumen td.mono { white-space: nowrap; }
table.resumen td:nth-child(2) { min-width: 200px; }
table.kardex td.capas { font-family: var(--mono); font-size: .78rem; min-width: 150px; }
table.kardex tr.con-aviso td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.t-pie { padding: 10px 14px 12px; font-size: .92rem; border-top: 1px solid var(--rule); }

.badge { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; font-size: .92rem; }
.badge svg { flex: none; margin-top: 4px; color: var(--brand); }
.limits { margin-top: 6px; font-size: .88rem; color: var(--muted); max-width: 88ch; }

.ad-slot { min-height: 90px; margin: 30px 0; border: 1px dashed var(--rule); border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }

/* ---------- Contenido ---------- */
.prose { padding: 8px 0; width: min(70ch, 100% - 32px); margin-inline: auto; }
.prose h2 { font-size: 1.45rem; margin: 30px 0 10px; }
.prose h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.prose p, .prose li { margin-bottom: 10px; }
.prose ol, .prose ul { padding-left: 22px; margin-bottom: 12px; }
.prose a { color: var(--brand); text-underline-offset: 3px; }
.prose .tbl { margin: 12px 0 18px; }
.prose .tbl table { font-size: .9rem; }
.prose .tbl.ancha table { min-width: 620px; }
.faq details { border-bottom: 1px solid var(--rule); padding: 13px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 8px; color: var(--muted); }
.legal { padding: 32px 0; }
.legal h1 { font-size: 2rem; margin-bottom: 16px; }
.descargas { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }

.more-sec { width: min(70ch, 100% - 32px); margin: 10px auto 40px; }
.more-h { font-size: 1.3rem; margin: 26px 0 8px; }
.more { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.more li { border-bottom: 1px solid var(--rule); }
.more a { display: grid; gap: 2px; padding: 12px 0; text-decoration: none; }
.more a strong { color: var(--brand); font-weight: 600; }
.more a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.more a span { color: var(--muted); font-size: .92rem; }

.foot { border-top: 1px solid var(--rule); background: var(--paper); padding: 26px 0 96px; color: var(--muted); font-size: .92rem; }
.foot .wrap { display: grid; gap: 10px; }
.foot-contact { color: var(--ink); font-weight: 600; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; padding: 0; }
.foot a { text-underline-offset: 3px; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 6px; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: var(--paper); border-top: 1px solid var(--rule); box-shadow: 0 -4px 24px rgba(31, 35, 40, .14); }
.cookie-bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 0; }
.cookie-bar p { flex: 1 1 320px; font-size: .9rem; color: var(--muted); }
.cookie-bar a { color: var(--ink); }
.cookie-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 560px) { .cookie-bar-inner { flex-direction: column; align-items: stretch; } .cookie-bar p { flex: 0 1 auto; } .cookie-actions { justify-content: flex-end; } }

@media (max-width: 640px) {
  .hero { padding-top: 18px; }
  .drop { padding: 26px 14px 22px; }
  .res-actions { width: 100%; }
  .res-actions .btn { flex: 1 1 auto; }
  .panel { padding: 12px; }
  .cifras { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media print {
  .top, .hero, .badge, .limits, .ad-slot, .prose, .more-sec, .foot, .toast, .skip-link, .cookie-bar, .res-head, .opciones, .vistas, .sel-prod, .ayuda { display: none !important; }
  body { background: #fff; color: #000; }
  .tool { border: 0; }
  .panel[hidden] { display: none !important; }
}
