/* Inventario Bar · tokens de tiple.dev (ver DESIGN.md de tiple.dev). Siempre claro. */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-normal.woff2") format("woff2");
  font-weight: 400 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #ffffff; --bg-alt: #f7f8fa; --ink: #1d2433; --ink-soft: #4b5568; --muted: #6b7486; --line: #e8ebf0;
  --line-strong: #d5dae2;
  --green: #0f8a6a; --green-strong: #0b6b52; --green-soft: #dff6ef;
  --coral: #ff7a45; --coral-ink: #c2410c; --coral-soft: #ffe3d6;
  --surface: #ffffff; --on-green: #ffffff;
  --shadow: 0 12px 32px rgba(29, 36, 51, .09);
  --radius: 18px; --maxw: 1160px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.fondo-alt { background: var(--bg-alt); }
body.con-pie { padding-bottom: 120px; }
[hidden] { display: none !important; }
a { color: var(--green); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -0.03em; }
.h2, h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.025em; }
.h3, h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; text-wrap: pretty; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.pequeno { font-size: .9rem; }
.negativo { color: var(--coral-ink); }
.sr-solo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* Barra superior */
.barra { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.barra-in { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.simbolo { width: 34px; height: 34px; flex: none; }
.marca-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.marca-txt strong { font-weight: 800; letter-spacing: -0.02em; }
.marca-txt span { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.nav { display: flex; gap: 4px; order: 3; width: 100%; overflow-x: auto; margin: 0 -4px; padding-bottom: 8px; }
.nav a { text-decoration: none; color: var(--ink-soft); font-weight: 600; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.nav a:hover { background: var(--bg-alt); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--green-soft); color: var(--green-strong); }
@media (min-width: 820px) {
  .nav { order: 0; width: auto; flex: 1; margin: 0; padding: 0; }
  .barra-in { flex-wrap: nowrap; }
}
.cuenta { margin-left: auto; position: relative; }
.cuenta summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 999px; }
.cuenta summary::-webkit-details-marker { display: none; }
.cuenta-nombre { font-weight: 600; font-size: .95rem; display: none; }
@media (min-width: 560px) { .cuenta-nombre { display: inline; } }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green-soft); color: var(--green-strong); display: inline-grid; place-items: center; font-weight: 800; flex: none; }
.cuenta-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 16px; min-width: 220px; display: grid; gap: 8px; z-index: 30; }
.cuenta-menu p { margin: 0; font-size: .85rem; }
.cuenta-menu a { text-decoration: none; font-weight: 600; }

/* Botones y controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .7em 1.25em; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; border: 2px solid transparent; cursor: pointer;
  transition: background .15s ease, border-color .15s ease; white-space: nowrap; line-height: 1.2; }
.btn-primary { background: var(--green); color: var(--on-green); }
.btn-primary:hover { background: var(--green-strong); }
.btn-line { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.btn-line:hover { border-color: var(--green); }
.btn-chico { padding: .5em 1em; font-size: .92rem; }
.btn-bloque { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--green); font-weight: 600; cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }
.link-peligro { color: var(--coral-ink); }
.link-flecha, .link-volver { font-weight: 700; text-decoration: none; }
.link-flecha::after { content: " →"; }
.ctas { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 10px;
  padding: .55em .75em; min-height: 44px; width: 100%;
}
textarea { min-height: 0; resize: vertical; }
input[type="file"] { padding: .45em; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); margin: 0; flex: none; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.form { display: grid; gap: 14px; }
.dos { display: grid; gap: 14px; }
@media (min-width: 560px) { .dos { grid-template-columns: 1fr 1fr; } }
.fila-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.fila-form label { flex: 1 1 160px; }
.fila-form input[type="date"] { width: auto; }
.subir { margin-top: 14px; }
.subir input[type="file"] { flex: 1 1 240px; width: auto; }

/* Bloques */
.encabezado { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.encabezado h1 { margin-bottom: .2em; }
.encabezado p { margin: 0; max-width: 42em; }
.tarjeta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.tarjeta.destacada { background: var(--green-soft); border-color: transparent; }
.tarjeta.destacada p:last-of-type { margin-bottom: 16px; }
.angosta { max-width: 560px; }
.tarjeta.angosta { margin: 0 auto; }
section.angosta { margin-left: auto; margin-right: auto; }
.bloque { margin-top: 32px; }
.bloque-tit { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.centrado { min-height: 100vh; display: grid; place-items: center; padding-top: 32px; }
.tarjeta-login { width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.login-marca { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-marca .simbolo { width: 44px; height: 44px; }
.login-marca div { display: flex; flex-direction: column; line-height: 1.2; }
.login-marca strong { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
.vacio { color: var(--muted); padding: 28px 20px; text-align: center; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
.nota { background: var(--bg-alt); border-radius: 12px; padding: 12px 16px; }

/* Avisos */
.avisos { display: grid; gap: 8px; margin-bottom: 20px; }
.aviso { margin: 0; padding: 10px 14px; border-radius: 12px; font-weight: 500; }
.aviso-ok { background: var(--green-soft); color: var(--green-strong); }
.aviso-error { background: var(--coral-soft); color: #8a2c08; }
.centrado .avisos { width: 100%; max-width: 400px; margin: 0 auto 16px; }

/* Chips */
.chip { display: inline-block; font-size: .8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--bg-alt); color: var(--ink-soft); border: 1px solid var(--line); white-space: nowrap; }
.chip-coral { background: var(--coral-soft); color: #8a2c08; border-color: transparent; }
.chip-verde { background: var(--green-soft); color: var(--green-strong); border-color: transparent; }

/* Cifras */
.cifras { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 12px 0 20px; }
.cifra { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; align-content: start; }
.cifra span { color: var(--muted); font-size: .9rem; font-weight: 600; }
.cifra strong { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.cifra small { color: var(--muted); }
.cifra-alerta { background: var(--coral-soft); border-color: transparent; }
.cifra-alerta strong { color: #8a2c08; }

/* Barras */
.barras { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.barras a { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); padding: 4px 0; }
.barras-fecha { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.barras-svg { width: 100%; height: 14px; }
.barras-svg rect { fill: var(--green); }
.barras a:hover rect { fill: var(--green-strong); }
.barras-valor { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 7.5em; text-align: right; }

/* Tablas */
.tabla-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.tabla { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabla th, .tabla td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla thead th { background: var(--bg-alt); font-size: .82rem; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tfoot th { background: var(--bg-alt); border-top: 2px solid var(--line-strong); border-bottom: 0; }
.tabla .acciones { text-align: right; }
.tabla .acciones a { font-weight: 600; text-decoration: none; }
.tabla tr.inactivo td { color: var(--muted); }
.fila-cat th { background: var(--surface); color: var(--green-strong); font-size: .85rem; padding-top: 16px; }
.tabla-compacta th, .tabla-compacta td { padding: 7px 12px; font-size: .88rem; }

/* Herramientas (filtros) */
.herramientas { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.herramientas input[type="search"] { flex: 1 1 220px; width: auto; }
.herramientas select { flex: 0 1 240px; width: auto; }

/* Desplegable */
.desplegable { position: relative; }
.desplegable summary { list-style: none; }
.desplegable summary::-webkit-details-marker { display: none; }
.desplegable-panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; z-index: 15; }

/* Conteo: una fila por producto. En el celular es una tarjeta; en pantalla grande, una tabla. */
.lineas { display: grid; gap: 10px; }
.linea { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "prod prod prod prod" "a b c d" "res res res res"; }
.linea.es-pendiente { border-left: 4px solid var(--coral); }
.linea-prod { grid-area: prod; display: flex; flex-direction: column; min-width: 0; }
.linea-prod strong { font-weight: 700; }
.linea-prod .muted { font-size: .85rem; }
.campo { font-size: .78rem; color: var(--muted); font-weight: 600; gap: 2px; }
.campo input { text-align: right; font-variant-numeric: tabular-nums; padding: .45em .55em; font-size: 1rem; color: var(--ink); }
.campo-clave input { border-color: var(--green); background: #fbfffd; font-weight: 700; }
.campo input.cambiado { background: #fffbe6; }
.campo input.invalido { border-color: var(--coral-ink); background: var(--coral-soft); }
.fijo { display: block; min-height: 44px; line-height: 44px; text-align: right; padding-right: .55em; font-size: 1rem; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; background: var(--bg-alt); border-radius: 10px; }
.linea-res { grid-area: res; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-variant-numeric: tabular-nums; }
.linea-res::before { content: "Vendido"; color: var(--muted); font-size: .85rem; margin-right: 2px; }
.linea-tit { display: none; }
@media (min-width: 900px) {
  .lineas { gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  .linea { grid-template-columns: minmax(200px, 2.2fr) repeat(4, minmax(84px, 1fr)) minmax(170px, 1.6fr);
    grid-template-areas: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; align-items: center; padding: 8px 14px; }
  .linea:last-child { border-bottom: 0; }
  .linea-prod, .linea-res { grid-area: auto; }
  .linea.es-pendiente { border-left: 0; box-shadow: inset 4px 0 0 var(--coral); }
  .linea-tit { display: grid; background: var(--bg-alt); font-size: .82rem; color: var(--ink-soft); font-weight: 700; padding: 10px 14px; }
  .linea-tit span:not(:first-child) { text-align: right; }
  .linea-tit span:last-child { text-align: left; }
  .campo > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .linea-res::before { content: none; }
}
.notas { margin-top: 20px; max-width: 640px; }

/* Pie fijo con totales del conteo */
.pie { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(29, 36, 51, .07); z-index: 10; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.pie-in { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; }
.pie-totales { display: flex; gap: 18px; }
.pie-totales span { display: flex; flex-direction: column; line-height: 1.2; }
.pie-totales small { color: var(--muted); font-size: .78rem; font-weight: 600; }
.pie-totales strong { font-size: 1.05rem; }
.pie-botones { display: flex; gap: 8px; }
@media (max-width: 520px) {
  .pie-botones { width: 100%; }
  .pie-botones .btn { flex: 1; }
}
.zona-peligro { margin-top: 28px; }

/* Usuarios */
.usuarios { display: grid; gap: 8px; }
.usuario { border: 1px solid var(--line); border-radius: 14px; }
.usuario summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; }
.usuario summary::-webkit-details-marker { display: none; }
.usuario-txt { flex: 1 1 160px; }
.usuario-acceso { flex-basis: 100%; padding-left: 44px; }
@media (min-width: 720px) { .usuario-acceso { flex-basis: auto; padding-left: 0; } }
.usuario.inactivo summary { opacity: .65; }
.usuario-panel { border-top: 1px solid var(--line); padding: 14px 16px; display: grid; gap: 12px; }
.usuario-panel select, .usuario-panel input:not([type="checkbox"]) { width: 100%; }
.credenciales { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 18px 0 22px; padding: 16px; background: var(--bg-alt); border-radius: 12px; }
.credenciales dt { color: var(--muted); font-weight: 600; }
.credenciales dd { margin: 0; word-break: break-all; }
.clave { font-size: 1.15rem; font-weight: 700; background: var(--green-soft); padding: 2px 8px; border-radius: 6px; }
.historial { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
