/* Gastos El Encino: tablero sobrio, legible al sol. Fondo gris frío, tinta casi negra,
   un solo acento cobalto. Las cifras van en monoespaciada con numerales tabulares. */
:root {
  --bg: #e9edf1;
  --panel: #ffffff;
  --ink: #0e1620;
  --muted: #4b5866;
  --line: #c6cfd8;
  --linea-suave: #e1e6eb;
  --acento: #0a52c9;
  --acento-claro: #4c8cff;
  --rojo: #b3261e;
  --rojo-bg: #fde8e6;
  --ambar: #6b4700;
  --ambar-bg: #ffe9a8;
  --azul: #0a3f9c;
  --azul-bg: #dce8ff;
  --verde: #0a5a2f;
  --verde-bg: #d3f0df;
  --gris: #4b5866;
  --gris-bg: #e1e6eb;
  --radio: 10px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 var(--sans); min-height: 100vh;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.oculto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.espacio { flex: 1; }
.num, .cifra { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

:focus-visible { outline: 3px solid var(--acento-claro); outline-offset: 2px; }

/* ---------- marca y barra ---------- */
.marca { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 700; letter-spacing: .01em; }
.marca-visor {
  width: 22px; height: 22px; flex: none; background:
    linear-gradient(var(--acento-claro), var(--acento-claro)) top left / 9px 3px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) top left / 3px 9px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) top right / 9px 3px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) top right / 3px 9px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom left / 9px 3px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom left / 3px 9px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom right / 9px 3px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom right / 3px 9px no-repeat;
}
.barra {
  background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; gap: 12px;
}
.barra-der { display: flex; align-items: center; gap: 8px; margin: 0; }
.quien { font-family: var(--mono); font-size: 13px; color: #b8c4d2; }
.barra .btn-texto { color: #fff; }

/* ---------- pestañas ---------- */
.tabs {
  display: flex; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.tab {
  flex: 1; min-height: 52px; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 16px;
  color: var(--muted); cursor: pointer; border-bottom: 4px solid transparent; padding: 0 8px;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--acento); }
.tab:hover { background: #f3f6f9; }

.contenido { max-width: 1500px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.vista h2.sr-only + * { margin-top: 0; }

/* ---------- botones y campos ---------- */
.btn {
  min-height: 48px; padding: 0 18px; border-radius: var(--radio); border: 2px solid var(--ink); background: var(--panel);
  color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: #f1f4f7; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-principal { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn-principal:hover { background: #0846ae; }
.btn-peligro { border-color: var(--rojo); color: var(--rojo); }
.btn-peligro:hover { background: var(--rojo-bg); }
.btn-texto { border-color: transparent; background: transparent; min-height: 44px; padding: 0 10px; }
.btn-grande { min-height: 56px; font-size: 18px; width: 100%; }
.btn-chico { min-height: 40px; padding: 0 12px; font-size: 14px; border-width: 1.5px; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 8px;
  min-height: 48px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--acento); outline: none; box-shadow: 0 0 0 3px rgba(76,140,255,.35); }
input[disabled], select[disabled] { background: var(--gris-bg); color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 650; color: var(--muted); letter-spacing: .02em; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); font-weight: 400; font-size: 16px; }
.error { color: var(--rojo); background: var(--rojo-bg); border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-weight: 600; }
.vacio { color: var(--muted); padding: 24px 4px; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; font-size: 15px; color: var(--ink); font-weight: 500; }
.check input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--acento); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login-caja {
  width: min(400px, 100%); background: var(--panel); border-radius: 14px; padding: 28px 24px 24px; display: grid; gap: 6px;
  box-shadow: 0 0 0 1px #2a3746;
}
.login-caja .marca { color: var(--ink); margin-bottom: 8px; }
.login-caja h1 { font-size: 28px; margin: 0 0 12px; letter-spacing: -.01em; }
.login-caja label { margin-top: 8px; }
.login-caja #login-pin { font-family: var(--mono); font-size: 26px; letter-spacing: .5em; text-align: center; min-height: 58px; }
.login-caja .btn { margin-top: 14px; }

/* ---------- captura ---------- */
.btn-foto {
  position: relative; width: 100%; min-height: 190px; border: 0; border-radius: 16px; background: var(--ink); color: #fff;
  cursor: pointer; display: grid; place-content: center; gap: 6px; text-align: center; padding: 24px; font: inherit;
}
.btn-foto::before {
  content: ""; position: absolute; inset: 14px; pointer-events: none; background:
    linear-gradient(var(--acento-claro), var(--acento-claro)) top left / 34px 4px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) top left / 4px 34px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) top right / 34px 4px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) top right / 4px 34px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom left / 34px 4px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom left / 4px 34px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom right / 34px 4px no-repeat,
    linear-gradient(var(--acento-claro), var(--acento-claro)) bottom right / 4px 34px no-repeat;
}
.btn-foto:hover { background: #17222f; }
.btn-foto:active { background: #0a1119; }
.btn-foto-titulo { font-size: 34px; font-weight: 750; letter-spacing: -.01em; }
.btn-foto-sub { font-size: 15px; color: #b8c4d2; }
.cola-estado { margin: 12px 0 0; padding: 10px 12px; background: var(--ambar-bg); color: var(--ambar); border-radius: 8px; font-weight: 650; }
.capturas { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.captura { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.captura-fila { display: flex; gap: 10px; flex-wrap: wrap; }
.hoja-mini { width: 92px; }
.hoja-mini img { display: block; width: 92px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--gris-bg); }
.hoja-mini .chip { margin-top: 6px; width: 100%; justify-content: center; white-space: normal; text-align: center; font-size: 12px; }
.captura-pie { display: flex; gap: 10px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.captura-pie p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; min-width: 160px; }

/* ---------- chips de estado ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  white-space: nowrap; line-height: 1.5;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-por_leer, .chip-espera { background: var(--ambar-bg); color: var(--ambar); }
.chip-leida, .chip-subiendo { background: var(--azul-bg); color: var(--azul); }
.chip-confirmada, .chip-subida { background: var(--verde-bg); color: var(--verde); }
.chip-anulada { background: var(--gris-bg); color: var(--gris); }
.chip-error { background: var(--rojo-bg); color: var(--rojo); }

/* ---------- planilla ---------- */
.filtros { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.campo-filtro { min-width: 150px; }
.campo-filtro select { min-width: 160px; }
.subtotales { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.subtotales li {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; display: flex; gap: 8px; align-items: baseline;
}
.subtotales .cifra { font-weight: 700; font-size: 14px; }
.subtotales .total-gen { background: var(--ink); color: #fff; border-color: var(--ink); }

.tarjetas { display: grid; gap: 10px; }
.tarjeta {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 12px; align-items: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  min-height: 84px;
}
.tarjeta:hover { border-color: var(--ink); }
.tarjeta.anulada { opacity: .55; }
.tarjeta.anulada .tarjeta-titulo, .tarjeta.anulada .cifra { text-decoration: line-through; }
.tarjeta-img, .tarjeta-sinfoto { width: 64px; height: 72px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; background: var(--gris-bg); display: block; }
.tarjeta-sinfoto { display: grid; place-items: center; font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.tarjeta-titulo { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tarjeta-sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tarjeta-total { font-size: 18px; font-weight: 700; text-align: right; align-self: start; }
.tarjeta-cuerpo { min-width: 0; display: grid; gap: 4px; }

.tabla-caja { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: clip; }
table.planilla { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.planilla th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700;
  padding: 10px 6px; background: #f3f6f9; border-bottom: 1px solid var(--line); position: sticky; top: 52px; z-index: 2;
}
.planilla th.der { text-align: right; }
.planilla td { padding: 5px 4px; border-bottom: 1px solid var(--linea-suave); vertical-align: middle; }
.planilla tr:last-child td { border-bottom: 0; }
.planilla tr.anulada { opacity: .5; }
.planilla tr.sucia td { background: #fff8e1; }
.planilla tr.guardando td { background: #eef4ff; }
.planilla td input, .planilla td select {
  min-height: 38px; padding: 4px 6px; font-size: 14px; border-width: 1px; border-color: transparent; background: transparent; border-radius: 6px;
}
.planilla td input:hover, .planilla td select:hover { border-color: var(--line); background: #fff; }
.planilla td input:focus, .planilla td select:focus { border-color: var(--acento); background: #fff; }
.planilla td input.num { text-align: right; }
.planilla td input[type="date"], .planilla td input[type="time"] { padding: 4px 2px; }
.planilla .col-foto img, .planilla .col-foto .sin { width: 36px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; background: var(--gris-bg); cursor: zoom-in; }
.planilla .col-foto .sin { cursor: default; }
.planilla .col-foto button { border: 0; background: none; padding: 0; }
.planilla .chip { font-size: 12px; padding: 2px 8px; }
.planilla .err-fila td { background: var(--rojo-bg); color: var(--rojo); font-weight: 600; padding: 8px 12px; }

/* ---------- resumen ---------- */
.aviso-caja { background: var(--ambar-bg); color: var(--ambar); border-radius: 8px; padding: 10px 14px; margin: 0 0 10px; font-weight: 600; }
.estado-res { max-width: 760px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 18px 14px; }
.linea { display: flex; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--linea-suave); }
.linea:last-child { border-bottom: 0; }
.linea .rot { flex: 1; min-width: 0; }
.linea .rot small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.linea .cifra { font-size: 18px; text-align: right; white-space: nowrap; }
.linea.total { border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 4px; }
.linea.total .rot { font-weight: 750; }
.linea.total .cifra { font-size: 26px; font-weight: 750; }
.linea.sub .rot { padding-left: 16px; font-size: 15px; color: var(--ink); }
.linea.sub .cifra { font-size: 15px; }
.linea.info { color: var(--muted); }
.linea.info .cifra { font-size: 16px; }
.linea .menos { color: var(--muted); font-family: var(--mono); width: 14px; flex: none; }
.positivo { color: var(--verde); }
.negativo { color: var(--rojo); }
.barra-cat { display: block; height: 5px; background: var(--azul-bg); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.barra-cat > i { display: block; height: 100%; background: var(--acento-claro); }
.sep { margin: 14px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.notas { max-width: 760px; margin: 14px 0 0; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }
.notas p { margin: 0; }

/* ---------- hoja inferior, visor, confirmar ---------- */
dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(14, 22, 32, .6); }
.hoja {
  width: min(640px, 100%); max-width: 100%; max-height: 92vh; border-radius: 16px; overflow: auto; background: var(--panel);
  margin: auto;
}
.hoja form { padding: 14px 16px 16px; }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hoja-cab h2 { margin: 0; font-size: 20px; }
.hoja-fotos { display: flex; gap: 8px; overflow-x: auto; }
.hoja-fotos button { border: 0; padding: 0; background: none; cursor: zoom-in; }
.hoja-fotos img { height: 110px; width: auto; border-radius: 6px; border: 1px solid var(--line); display: block; }
.hoja-estado { margin: 8px 0; }
.rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rejilla .ancho { grid-column: 1 / -1; }
.hoja-pie { display: flex; gap: 10px; margin-top: 14px; align-items: center; }
.confirmar { width: min(420px, calc(100% - 32px)); border-radius: 14px; padding: 20px; margin: auto; }
.confirmar h2 { margin: 0 0 8px; }
.visor { width: min(96vw, 900px); max-height: 96vh; background: #000; border-radius: 10px; margin: auto; overflow: auto; padding: 8px; }
.visor img { width: 100%; height: auto; display: block; border-radius: 6px; background: #222; min-height: 120px; }
.visor-cerrar { position: sticky; top: 0; float: right; margin: 0 0 8px 8px; z-index: 2; }
.visor-pie { color: #b8c4d2; margin: 8px 4px 2px; font-size: 14px; }
.aviso {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-weight: 650; z-index: 50; max-width: calc(100% - 32px);
}
.aviso.mal { background: var(--rojo); }

/* ---------- celular ---------- */
@media (max-width: 899px) {
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; top: auto; border-top: 1px solid var(--line); border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
  .tab { min-height: 58px; border-bottom: 0; border-top: 4px solid transparent; }
  .tab[aria-selected="true"] { border-top-color: var(--acento); }
  .contenido { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .aviso { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .hoja { margin: auto 0 0; border-radius: 16px 16px 0 0; width: 100%; max-height: 94vh; }
  .filtros .campo-filtro { flex: 1 1 140px; }
  .filtros .btn { flex: 1 1 calc(50% - 6px); padding: 0 8px; }
  .filtros .check { flex: 1 1 100%; min-height: 40px; }
  .subtotales { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  .subtotales li { flex: none; }
  .btn-foto { min-height: 36vh; }
}
@media (min-width: 900px) {
  .contenido { padding: 20px 24px 40px; }
  .btn-foto { max-width: 560px; min-height: 220px; }
  .capturas { max-width: 560px; }
  .vacio { max-width: 560px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .tab { transition: background-color .15s, border-color .15s; }
}

/* anchos de la planilla de escritorio */
col.c-foto { width: 52px; } col.c-estado { width: 150px; } col.c-fecha { width: 126px; } col.c-hora { width: 80px; }
col.c-cat { width: 140px; } col.c-tipo { width: 90px; } col.c-prov { width: auto; } col.c-neto { width: 106px; }
col.c-iva { width: 88px; } col.c-otros { width: 88px; } col.c-total { width: 106px; } col.c-nota { width: 96px; } col.c-acc { width: 76px; }

/* pie de la hoja siempre visible */
.hoja .hoja-pie { position: sticky; bottom: 0; background: var(--panel); padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); margin-top: 8px; border-top: 1px solid var(--linea-suave); }
.linea.sub .cifra { min-width: 112px; }

/* ---------- ronda 3: alertas, IVA y proveedores, año ---------- */
.titulo-vista { margin: 0 0 10px; font-size: 22px; }
.sub-titulo { margin: 22px 0 2px; font-size: 18px; }
.ayuda { margin: 2px 0 10px; color: var(--muted); font-size: 14px; }
.alertas { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin-top: 4px; }
.tarjeta-cuerpo .alertas { flex-direction: row; flex-wrap: wrap; }
.chip-alerta { background: var(--rojo-bg); color: var(--rojo); }
.chip-alerta::before { border-radius: 2px; transform: rotate(45deg); }
.linea .enlace {
  border: 0; background: none; padding: 0; font: inherit; color: var(--acento); font-weight: 650; text-align: left; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; min-height: 28px;
}
.linea .enlace:hover { color: #0846ae; }
.enlace-fila { margin: 12px 0 2px; }
.avisos-iva { max-width: 760px; margin-top: 12px; }

.tabla-prov-caja { max-width: 860px; }
.tabla-prov { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-prov th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 8px; background: #f3f6f9; border-bottom: 1px solid var(--line); }
.tabla-prov td, .tabla-prov tfoot th { padding: 9px 8px; border-bottom: 1px solid var(--linea-suave); }
.tabla-prov .der { text-align: right; }
.tabla-prov .nom { overflow-wrap: anywhere; }
.tabla-prov tfoot th, .tabla-prov tfoot td { font-weight: 750; background: #f3f6f9; border-bottom: 0; text-transform: none; font-size: 14px; letter-spacing: 0; color: var(--ink); }

.admin-caja { max-width: 860px; margin-top: 26px; padding: 14px 18px 18px; background: var(--panel); border: 2px dashed var(--line); border-radius: 14px; }
.admin-caja h3 { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.admin-bloque { padding: 10px 0 4px; border-top: 1px solid var(--linea-suave); margin: 0; }
.admin-bloque:first-of-type { border-top: 0; }
.admin-tit { margin: 0; font-weight: 700; }
.rcv-resultado { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--verde-bg); color: var(--verde); font-weight: 600; }
.rcv-resultado.mal { background: var(--rojo-bg); color: var(--rojo); }
.rejilla-rem { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.rejilla-rem label { flex: 1 1 160px; }

/* estado de resultados anual: el scroll horizontal vive solo dentro de la caja; la primera columna queda fija */
.anual-caja { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; overscroll-behavior-x: contain; max-width: 100%; }
table.anual { border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 1180px; width: 100%; }
.anual th, .anual td { padding: 8px 10px; border-bottom: 1px solid var(--linea-suave); white-space: nowrap; }
.anual thead th { background: #f3f6f9; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.anual .der { text-align: right; }
.anual tbody th, .anual thead th:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--panel); min-width: 190px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); font-weight: 600; }
.anual thead th:first-child { background: #f3f6f9; z-index: 2; }
.anual .total-col { font-weight: 750; background: #f7f9fb; border-left: 1px solid var(--line); }
.anual .vacia { color: #8793a0; }
.anual .neg { color: var(--rojo); }
.anual .sub-total th, .anual .sub-total td { font-weight: 750; border-top: 1px solid var(--ink); }
.anual .destacada th, .anual .destacada td { background: var(--ink); color: #fff; font-weight: 750; border-bottom-color: var(--ink); }
.anual .destacada .neg { color: #ffb4ad; }
.anual .destacada .total-col { background: #1b2a3a; border-left-color: #1b2a3a; }
.anual .info th, .anual .info td { color: var(--muted); }
.anual .sep-fila th, .anual .sep-fila td { background: #eef2f6; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 6px 10px; }
.anual .celda-enlace { border: 0; background: none; padding: 2px 0; font: inherit; color: var(--acento); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 28px; }
.anual .celda-enlace:hover { color: #0846ae; }

@media (max-width: 899px) {
  .tab { font-size: 15px; padding: 0 2px; }
  .tabla-prov .ocultable { display: none; }
  .anual tbody th, .anual thead th:first-child { min-width: 128px; max-width: 128px; font-size: 13px; }
  .tarjeta-cuerpo .alertas { margin-top: 2px; }
  .anual tbody th { white-space: normal; line-height: 1.2; }
}

/* subtotales con dos cifras (pagado y gasto para la utilidad) */
.subtotales li { flex-wrap: wrap; align-items: baseline; }
.subtotales .sub-rot { font-weight: 600; }
.subtotales small { color: var(--muted); font-size: 12px; }
.subtotales small.sec { flex-basis: 100%; }
.subtotales li.informativo { background: var(--gris-bg); }
.subtotales .total-gen small { color: #b8c4d2; }
.subtotales .gasto-util { background: var(--acento); border-color: var(--acento); }
.subtotales .gasto-util.destacado { outline: 3px solid var(--acento-claro); outline-offset: 1px; order: -1; }
.nota-sub { margin: -4px 0 12px; font-size: 13px; color: var(--muted); max-width: 900px; }
.aviso-fuerte { margin: 12px 0 0; padding: 12px 14px; background: var(--ambar-bg); color: var(--ambar); border-left: 6px solid var(--ambar); border-radius: 8px; font-weight: 700; }


/* =====================================================================================
   Ronda 4: la planilla. Aspecto de hoja de cálculo: fondo claro, grilla fina, filas de 34 px,
   cifras tabulares a la derecha, ingresos en verde sobrio, gastos neutros, cebra casi invisible.
   ===================================================================================== */
:root { --bg: #f3f5f8; --grid: #dde3ea; --grid-suave: #e9edf2; --ing: #15633a; --cebra: #f8fafc; --grupo: #e8eef5; --cab: #f0f3f7; }
body { background: var(--bg); }
.barra { background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--grid); }
.quien { color: var(--muted); }
.barra .btn-texto { color: var(--ink); }
.tab-foto { color: var(--acento); }
.vista-planilla { display: flex; flex-direction: column; min-height: 0; }
.contenido { padding-top: 12px; }

/* controles */
.controles { background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; padding: 8px 10px; display: grid; gap: 8px; }
.ctl-fila { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.ctl-rango { display: contents; }
.ctl > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.controles select, .controles input[type="date"], .controles input[type="search"], .multi summary {
  min-height: 34px; padding: 4px 8px; font-size: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: auto; min-width: 0;
}
.ctl-busca input { min-width: 220px; }
.controles .check { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.controles .check input { width: 18px; height: 18px; }
.controles .btn-chico { min-height: 34px; font-size: 13.5px; padding: 0 12px; border-radius: 6px; border-width: 1px; }
.multi { position: relative; }
.multi summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; user-select: none; }
.multi summary::-webkit-details-marker { display: none; }
.multi summary::after { content: "▾"; margin-left: 8px; font-size: 11px; color: var(--muted); }
.multi[open] summary { border-color: var(--acento); }
.multi-lista { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(14, 22, 32, .16); padding: 6px 8px; max-height: 320px; overflow: auto; min-width: 270px; }
.multi-op { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 14px; min-height: 30px; }
.solo-movil { display: none; }

/* tres números */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.kpi { background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; padding: 8px 14px; display: grid; gap: 1px; min-width: 0; }
.kpi-rot { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.kpi-num { font: 700 27px/1.15 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.kpi-num.ing { color: var(--ing); }
.kpi-num.res { font-weight: 800; }
.kpi-num.neg, .neg { color: var(--rojo); }
.kpi-sub { font-size: 12px; color: var(--muted); min-height: 15px; }
.kpi-pie { margin: 6px 2px 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 16px; }
.kpi-pie strong { color: var(--ink); }
.kpi-avisos { color: var(--ambar); font-weight: 600; }
.enlace-chico { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--acento); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* la hoja */
.hoja-calculo { flex: 1; min-height: 120px; overflow: auto; background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; overscroll-behavior: contain; }
table.hoja-tabla { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
.hoja-tabla th, .hoja-tabla td { height: 34px; padding: 0 10px; border-bottom: 1px solid var(--grid-suave); border-right: 1px solid var(--grid-suave); white-space: nowrap; background: inherit; }
.hoja-tabla th:last-child, .hoja-tabla td:last-child { border-right: 0; }
.hoja-tabla thead th { position: sticky; top: 0; z-index: 4; background: var(--cab); border-bottom: 1px solid var(--grid); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; text-align: left; padding: 0; }
.hoja-tabla thead th.der { text-align: right; }
.hoja-tabla thead th:not(.ordenable) { padding: 0 10px; }
.th-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%; height: 34px; padding: 0 10px; cursor: pointer; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; }
.der .th-btn { justify-content: flex-end; }
.th-btn:hover { color: var(--ink); background: #e6ebf1; }
.th-btn:focus-visible { outline: 2px solid var(--acento-claro); outline-offset: -2px; }
.flecha-orden { font-size: 9px; min-width: 9px; color: var(--acento); }
.hoja-tabla tbody tr { background: #fff; }
.hoja-tabla tbody tr.cebra { background: var(--cebra); }
.hoja-tabla tbody tr.fila { cursor: pointer; }
.hoja-tabla tbody tr.fila:hover { background: #eaf2ff; }
.hoja-tabla tr:focus-visible { outline: 2px solid var(--acento-claro); outline-offset: -2px; }
.hoja-tabla td:first-child, .hoja-tabla thead th:first-child { position: sticky; left: 0; z-index: 2; border-right: 1px solid var(--grid); }
.hoja-tabla thead th:first-child { z-index: 5; }
.c-num { text-align: right; min-width: 108px; }
.c-hora { width: 64px; color: var(--muted); }
.c-fecha { min-width: 98px; }
.c-cat { min-width: 150px; }
.c-doc { min-width: 120px; }
.c-detalle { width: 100%; min-width: 230px; }
.c-foto { width: 56px; }
.detalle-txt { display: inline-block; max-width: 36ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.cifra { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.ing .cifra { color: var(--ing); }
td.gas .cifra { color: #26303b; }
td.res .cifra { font-weight: 800; }
td.neg .cifra { color: var(--rojo); font-weight: 800; }
.f-costo { color: #46515d; }
.f-info td { color: #8591a0; }
.f-info td .cifra, .f-leer td .cifra { color: #8591a0; }
.f-info { font-style: italic; }
.f-leer, .hoja-tabla tbody tr.f-leer.cebra { background: #eeeff1; color: #7b8794; }
.etq { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 17px; background: var(--gris-bg); color: var(--gris); font-style: normal; }
.etq-leer { background: var(--ambar-bg); color: var(--ambar); }
.etq-rev { background: var(--azul-bg); color: var(--azul); }
.etq-leer-txt { font-size: 12px; color: var(--ambar); font-weight: 700; }
.mini-alertas { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.chip-alerta-mini { padding: 0 7px; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 17px; background: var(--rojo-bg); color: var(--rojo); font-style: normal; }
.foto-btn { border: 0; background: none; padding: 0; cursor: zoom-in; display: block; }
.foto-mini { display: block; height: 26px; width: 20px; object-fit: cover; border: 1px solid var(--line); border-radius: 2px; background: var(--gris-bg); }

/* grupos y total */
.hoja-tabla tr.fila-grupo { background: var(--grupo); font-weight: 700; cursor: pointer; }
.hoja-tabla tr.fila-grupo:hover { background: #dbe5f0; }
.hoja-tabla tr.fila-grupo td { border-bottom-color: var(--grid); }
.hoja-tabla tr.fila-grupo td.g-rot { text-overflow: ellipsis; }
.g-flecha { display: inline-block; width: 16px; color: var(--muted); font-size: 11px; }
.g-n { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.hoja-tabla tfoot td { position: sticky; bottom: 0; z-index: 3; background: #fff; border-top: 3px double var(--ink); border-bottom: 0; font-weight: 750; height: 38px; }
.hoja-tabla tfoot td:first-child { z-index: 5; }
.fila-vacia td { white-space: normal; color: var(--muted); padding: 24px; text-align: center; }
.pl-pie { margin-top: 8px; display: flex; gap: 8px; align-items: center; }

/* panel de edición: lateral en escritorio, hoja inferior en celular */
.hoja-alertas { background: var(--rojo-bg); color: var(--rojo); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.alerta-linea { margin: 3px 0; }
.hoja-fotos { flex-wrap: wrap; }
.hoja-fotos img { height: 240px; max-width: 100%; object-fit: contain; background: var(--gris-bg); }
.detalle-venta .estado-res { border: 0; padding: 0; max-width: none; }

@media (min-width: 900px) {
  dialog.hoja { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100%); border-radius: 0; }
  .hoja form { min-height: 100%; display: flex; flex-direction: column; }
  .hoja .rejilla { flex: none; }
  .hoja .hoja-pie { margin-top: auto; }
}

@media (max-width: 899px) {
  .contenido { padding: 8px 8px calc(78px + env(safe-area-inset-bottom)); }
  .solo-movil { display: inline-flex; }
  .ctl-mas { display: none; }
  .ctl-mas.abierta { display: flex; }
  .controles { padding: 6px 8px; gap: 6px; }
  .ctl-fila { gap: 6px 8px; }
  .ctl-fila > .ctl { flex: 1 1 28%; min-width: 0; }
  .controles select, .controles input[type="date"] { width: 100%; }
  .ctl-busca { flex: 1 1 100%; }
  .ctl-busca input { width: 100%; min-width: 0; }
  .controles .check { flex: 1 1 100%; }
  .kpis { gap: 5px; margin-top: 6px; }
  .kpi { padding: 5px 8px; }
  .kpi-rot { font-size: 10px; letter-spacing: .04em; }
  .kpi-num { font-size: 15px; }
  .kpi-sub { font-size: 10.5px; min-height: 0; }
  .kpi-pie { font-size: 12px; margin: 4px 2px 6px; }
  .no-movil { display: none; }
  .hoja-tabla th, .hoja-tabla td { height: 40px; padding: 0 8px; }
  .th-btn { height: 40px; padding: 0 8px; }
  .hoja-tabla thead th:not(.ordenable) { padding: 0 8px; }
  .c-fecha { min-width: 96px; max-width: 120px; white-space: normal; }
  .c-detalle { min-width: 150px; }
  .detalle-txt { max-width: 22ch; }
  .c-num { min-width: 92px; }
  .hoja-tabla tr.fila-grupo td.g-rot { line-height: 1.15; }
  .tab-foto { background: var(--acento); color: #fff; }
  .tab-foto:hover { background: #0846ae; }
  .tab-foto[aria-selected="true"] { border-top-color: var(--ink); }
  .hoja-fotos img { height: 200px; }
}
@media (prefers-reduced-motion: no-preference) {
  .hoja-tabla tr { transition: background-color .1s; }
}

/* ajustes de la ronda 4 (controles en dos filas, celular sin recortes) */
.f-corto { display: none; }
.cifra.cero { color: #aab4bf !important; font-weight: 400 !important; }
.ctl-cats > span { margin-bottom: 2px; }
.salto { display: none; }
@media (min-width: 900px) {
  .controles { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
  .ctl-fila { display: contents; }
  .salto { display: block; flex-basis: 100%; height: 0; order: 20; }
  .ctl-mas .check { order: 30; }
  .ctl-mas .espacio { order: 9; flex: 1 1 0; }
  .ctl-mas .btn { order: 10; }
  .ctl-busca input { min-width: 200px; }
}
@media (max-width: 899px) {
  .f-largo { display: none; }
  .f-corto { display: inline; }
  .hoja-tabla { font-size: 12.5px; }
  .hoja-tabla th, .hoja-tabla td { padding: 0 6px; }
  .th-btn { padding: 0 6px; }
  .c-fecha { min-width: 70px; max-width: 70px; }
  .c-detalle { width: auto; min-width: 96px; max-width: 120px; }
  .detalle-txt { max-width: 13ch; }
  .hoja-tabla thead th { font-size: 10.5px; letter-spacing: .02em; }
  .hoja-tabla tfoot td { white-space: normal; line-height: 1.15; font-size: 12px; }
  .c-num { min-width: 78px; }
  .hoja-tabla .mini-alertas, .hoja-tabla .etq { display: none; }
  .hoja-tabla tr.fila-grupo td.g-rot { white-space: normal; }
  .g-n-movil { font-size: 11.5px; }
}

/* ronda 5: vista caja/ganancia, chips de grupo, filtro jerárquico */
.chips-grupo { display: flex; gap: 6px; margin: 0 0 8px; overflow-x: auto; padding: 2px 1px 4px; scrollbar-width: thin; }
.chip-grupo { flex: 0 0 auto; min-height: 32px; padding: 0 12px; border: 1px solid var(--grid); border-radius: 16px; background: var(--panel); color: var(--ink); font: 600 13px var(--sans); cursor: pointer; white-space: nowrap; }
.chip-grupo:hover { border-color: var(--muted); }
.chip-grupo[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-grupo:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
.multi-grupo { border-bottom: 1px solid var(--grid-suave); padding: 2px 0 4px; }
.multi-grupo:last-child { border-bottom: 0; }
.multi-g { font-weight: 700; }
.multi-c { padding-left: 24px; font-weight: 400; }
@media (min-width: 900px) { .f-doc td:nth-child(4) .detalle-txt { max-width: 44ch; } }
@media (max-width: 899px) {
  .chip-grupo { min-height: 36px; }
  .controles .ctl-base { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controles .ctl-base .solo-movil { grid-column: 1 / -1; }
}

/* ronda 5: ajustes de ancho */
.hoja-tabla .c-cat { max-width: 330px; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) { .hoja-tabla .c-detalle { min-width: 190px; } }
.hoja-tabla .c-doc { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) {
  .ctl-busca input { min-width: 150px; }
  .controles .btn-chico { padding: 0 10px; }
}
@media (max-width: 899px) {
  .hoja-tabla th, .hoja-tabla td { padding: 0 5px; }
  .th-btn { padding: 0 5px; }
  .c-num { min-width: 0; }
  .hoja-tabla td.c-num { font-size: 12px; }
  .c-detalle { min-width: 84px; max-width: 100px; }
  .detalle-txt { max-width: 11ch; }
  .c-fecha { min-width: 66px; max-width: 66px; }
  .hoja-tabla thead th { font-size: 10px; letter-spacing: 0; }
}

/* ---------- modo embebido (?embebido=1): dentro de la pestaña del panel de análisis ---------- */
.solo-emb { display: none; }
.embebido .solo-emb { display: inline-flex; }
.embebido .barra { background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--line); padding: 4px 12px; justify-content: flex-end; }
.embebido .barra .marca { display: none; }
.embebido .barra .btn-texto { color: var(--acento); min-height: 36px; font-size: 14px; font-weight: 600; text-decoration: underline; }
.embebido .quien { color: var(--muted); font-size: 12px; }
.embebido .tab-foto, .embebido #v-captura { display: none !important; }
@media (min-width: 900px) { .embebido .tabs { top: 0; } }
.embebido .contenido { padding-top: 10px; }
