/* ============================================================
   VEPOX — Tributario (cada noche con sus ventas y sus documentos)
   Paleta de la caja nueva (css/caja.css). Calendario del mes, la noche
   elegida con todas sus ventas y, abajo, el mes contra el SII.
   Rojo solo para lo que no cuadra; amarillo solo en la acción principal.
   ============================================================ */
.tr-raiz {
  --tr-s1: var(--surface, #1a1d27);
  --tr-s2: var(--surface2, #242835);
  --tr-line: var(--border, #2e3345);
  --tr-text: var(--text, #e1e4eb);
  --tr-muted: var(--muted, #8b90a0);
  --tr-faint: #5b5f6d;
  --tr-acc: var(--brand-primary, #FDC80F);
  --tr-ok: #4ade80; --tr-ok-bg: rgba(34, 197, 94, .10);
  --tr-bad: #ff8a8a; --tr-bad-bg: rgba(240, 82, 82, .09); --tr-bad-tx: #ffb4b4;
  max-width: 1200px; margin: 0 auto; padding: 8px 0 48px;
  color: var(--tr-text); font-family: 'DM Sans', sans-serif; font-variant-numeric: tabular-nums;
}
html:not([data-theme="dark"]) .tr-raiz { --tr-faint: #a3a7b3; --tr-ok: #15803d; --tr-ok-bg: rgba(34, 197, 94, .12); --tr-bad: #b91c1c; --tr-bad-bg: rgba(239, 68, 68, .07); --tr-bad-tx: #b91c1c; }
.tr-raiz *, .tr-raiz *::before, .tr-raiz *::after { box-sizing: border-box; }
.tr-raiz button { font-family: inherit; }
.tr-raiz button:focus-visible, .tr-raiz .tr-nota:focus-visible { outline: 2px solid var(--tr-acc); outline-offset: 2px; }

/* Cabecera */
.tr-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.tr-titulo { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 34px; letter-spacing: .5px; line-height: 1; margin: 0; text-transform: uppercase; }
.tr-sub { color: var(--tr-muted); font-size: 13.5px; margin-top: 6px; }
.tr-acciones { display: flex; gap: 10px; align-items: center; }
.tr-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--tr-line); background: var(--tr-s1); color: var(--tr-text);
  font: 600 13.5px 'DM Sans', sans-serif; height: 42px; padding: 0 16px; border-radius: 11px; cursor: pointer; white-space: nowrap; }
.tr-btn:hover:not(:disabled) { border-color: var(--tr-muted); }
.tr-btn:disabled { opacity: .5; cursor: default; }
.tr-mes { display: inline-flex; align-items: center; height: 42px; border: 1px solid var(--tr-line); background: var(--tr-s1); border-radius: 11px; }
.tr-mes span { font: 600 13.5px 'DM Sans', sans-serif; min-width: 120px; text-align: center; }
.tr-mes button { background: none; border: 0; color: var(--tr-text); font-size: 19px; width: 38px; height: 40px; cursor: pointer; }
.tr-mes button:disabled { color: var(--tr-line); cursor: default; }

/* Calendario y resumen de la noche */
.tr-arriba { display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.tr-cal, .tr-dia-res, .tr-mes-sec, .tr-vacio, .tr-ajustes { background: var(--tr-s1); border: 1px solid var(--tr-line); border-radius: 16px; }
.tr-cal { padding: 16px 18px 14px; }
.tr-cal-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.tr-cal-dn { color: var(--tr-muted); font-size: 12px; text-align: center; padding-bottom: 2px; }
.tr-d { height: 56px; border-radius: 10px; background: var(--tr-s2); border: 0; padding: 7px 8px; color: var(--tr-text);
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; font-size: 12.5px; min-width: 0; }
.tr-d .n { font-weight: 600; }
.tr-d .c { font-size: 11.5px; color: var(--tr-muted); line-height: 1.15; }
.tr-d .c b { font-weight: 600; }
.tr-d .c i { font-style: normal; }
.tr-d.vacio { background: transparent; }
.tr-d.nada, .tr-d.hoy { background: transparent; box-shadow: inset 0 0 0 1px var(--tr-line); color: var(--tr-faint); }
.tr-d.hoy { color: var(--tr-muted); }
.tr-d.fut { color: var(--tr-faint); opacity: .55; }
button.tr-d { cursor: pointer; transition: background-color .12s; }
button.tr-d:hover { background: var(--tr-line); }
.tr-d.ok { box-shadow: inset 0 -3px 0 var(--tr-ok); }
.tr-d.espera { box-shadow: inset 0 -3px 0 var(--tr-muted); }
.tr-d.mal { background: var(--tr-bad-bg); }
.tr-d.mal .c { color: var(--tr-bad); }
.tr-d.mal:hover { background: rgba(240, 82, 82, .16); }
.tr-d.sel { box-shadow: inset 0 0 0 2px var(--tr-text); }
.tr-d.ok.sel { box-shadow: inset 0 0 0 2px var(--tr-text), inset 0 -5px 0 var(--tr-ok); }
.tr-d.espera.sel { box-shadow: inset 0 0 0 2px var(--tr-text), inset 0 -5px 0 var(--tr-muted); }
.tr-d.mal.sel { box-shadow: inset 0 0 0 2px var(--tr-bad); }
.tr-cal-pie { color: var(--tr-muted); font-size: 13px; margin-top: 12px; }
.tr-cal-pie b, .tr-dia-r b { font-weight: 600; }
.tr-raiz b.mal { color: var(--tr-bad); }
.tr-raiz b.ok { color: var(--tr-ok); }
.tr-dia-res { padding: 22px 26px; display: flex; flex-direction: column; gap: 26px; }
.tr-dia-res.vacia { justify-content: center; }
.tr-dia-t { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.2px; }
.tr-dia-r { color: var(--tr-muted); font-size: 14px; margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.tr-cifras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tr-cifras > div { font-size: 13px; color: var(--tr-muted); background: var(--tr-s2); border-radius: 12px; padding: 14px 16px; }
.tr-cifras b { display: block; font-size: 26px; color: var(--tr-text); margin: 4px 0 6px; font-weight: 700; letter-spacing: -.3px; }
.tr-cifras span { display: block; font-size: 12.5px; }
.tr-filtro { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.tr-temas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.tr-temas li { display: flex; align-items: baseline; gap: 10px; }
.tr-temas li b { color: var(--tr-bad); font-weight: 700; min-width: 18px; text-align: right; }
.tr-temas.ok { flex-direction: row; align-items: center; gap: 8px; color: var(--tr-ok); font-weight: 600; }
.tr-chip { border: 1px solid var(--tr-line); background: transparent; color: var(--tr-text); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.tr-chip:hover:not(.on) { border-color: var(--tr-muted); }
.tr-chip.on { background: var(--tr-text); border-color: var(--tr-text); color: var(--tr-s1); }

/* Las ventas de la noche */
.tr-tabla { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--tr-line); border-radius: 16px; overflow: hidden; background: var(--tr-s1); font-size: 13.5px; }
/* main.css fuerza mayúsculas y espaciado en todo th con !important */
.tr-raiz .tr-tabla th { text-align: left; font-weight: 500 !important; color: var(--tr-muted); font-size: 12.5px !important; padding: 12px; border-bottom: 1px solid var(--tr-line); text-transform: none; letter-spacing: 0 !important; background: none; }
.tr-raiz .tr-tabla th.der { text-align: right; }
.tr-tabla td { padding: 11px 12px; border-top: 1px solid var(--tr-line); vertical-align: top; }
.tr-tabla tbody tr:first-child td { border-top: 0; }
.tr-tabla tr.tr-exp td { border-top: 0; padding-top: 0; }
.tr-c-h { color: var(--tr-muted); width: 58px; }
.tr-c-n { font-weight: 600; width: 72px; white-space: nowrap; }
.tr-cli { font-weight: 600; }
.tr-cli-s { color: var(--tr-muted); font-size: 12.5px; margin-top: 2px; }
.tr-c-ped { color: var(--tr-muted); font-size: 13px; max-width: 250px; }
.tr-c-med { white-space: nowrap; }
.tr-c-m { font-weight: 700; text-align: right; white-space: nowrap; }
.tr-c-doc { color: var(--tr-muted); white-space: nowrap; }
.tr-c-est { text-align: right; white-space: nowrap; }
.tr-nada { color: var(--tr-faint); }
.tr-doc { background: none; border: 0; padding: 0; color: var(--tr-text); font-size: inherit; text-decoration: underline; text-decoration-color: var(--tr-line); text-underline-offset: 3px; cursor: pointer; }
.tr-doc:hover { text-decoration-color: var(--tr-text); }
.tr-est { font-size: 12.5px; font-weight: 600; }
.tr-est.calza { color: var(--tr-ok); }
.tr-est.mal { color: var(--tr-bad); font-weight: 700; }
.tr-est.revisado, .tr-est.espera { color: var(--tr-muted); }
.tr-tabla tr.mal td { background: var(--tr-bad-bg); }
.tr-tabla tr.mal td:first-child { box-shadow: inset 3px 0 0 var(--tr-bad); }
.tr-tabla tr.revisado td:first-child { box-shadow: inset 3px 0 0 var(--tr-line); }
.tr-exp-in { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.tr-exp-t { color: var(--tr-bad-tx); font-size: 13px; }
.tr-exp.revisado .tr-exp-t { color: var(--tr-muted); }
.tr-q { color: var(--tr-muted); }
.tr-acc { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.tr-mini { border: 1px solid var(--tr-line); background: var(--tr-s1); color: var(--tr-text); font: 600 12.5px 'DM Sans', sans-serif;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tr-mini:hover:not(:disabled) { border-color: var(--tr-muted); }
.tr-mini.acc { background: var(--tr-acc); color: #111; border-color: var(--tr-acc); }
.tr-mini:disabled { opacity: .55; cursor: default; }
.tr-nota { border: 1px solid var(--tr-line); background: var(--tr-s1); color: var(--tr-text); font: 13px 'DM Sans', sans-serif; padding: 6px 10px; border-radius: 8px; width: 220px; }
.tr-vacio { color: var(--tr-muted); font-size: 14px; padding: 28px 24px; text-align: center; }
/* La historia de una boleta automática (14-10) */
.tr-tz-b { margin-left: 8px; font-size: 12.5px; }
.tr-tz { list-style: none; margin: 2px 0 6px; padding: 0 0 0 14px; border-left: 2px solid var(--tr-line); display: grid; gap: 5px; }
.tr-tz li { display: flex; gap: 12px; font-size: 13px; color: var(--tr-text); }
.tr-tz li.ok { color: var(--tr-ok); }
.tr-tz li.mal { color: var(--tr-bad-tx); font-weight: 600; }
.tr-tz-h { color: var(--tr-muted); min-width: 92px; font-variant-numeric: tabular-nums; }

/* El mes */
.tr-mes-sec { margin-top: 20px; padding: 2px 24px; }
.tr-ms-fila { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--tr-line); }
.tr-mes-sec > :first-child { border-top: 0; }
.tr-ms-t { font-weight: 600; font-size: 14.5px; width: 170px; flex: 0 0 auto; }
.tr-ms-d { color: var(--tr-muted); font-size: 13.5px; flex: 1 1 auto; }
.tr-ms-item { display: flex; align-items: center; gap: 14px; padding: 0 0 12px 186px; font-size: 13.5px; }
.tr-ms-ip { font-weight: 600; white-space: nowrap; }
.tr-ms-id { color: var(--tr-muted); flex: 1 1 auto; }
.tr-pie { color: var(--tr-muted); font-size: 12.5px; padding: 14px 0; border-top: 1px solid var(--tr-line); display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.tr-pie .mal { color: var(--tr-bad); }
.tr-pie i { font-style: normal; }
.tr-pie i.ok { color: var(--tr-ok); }
.tr-pie-acc { margin-left: auto; display: flex; gap: 16px; }
.tr-link { background: none; border: 0; padding: 0; color: var(--tr-text); font: 600 12.5px 'DM Sans', sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tr-link:disabled { color: var(--tr-muted); text-decoration: none; cursor: default; }
.tr-aviso { border-radius: 10px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 14px; }
.tr-aviso.mal { color: var(--tr-bad); background: var(--tr-bad-bg); }
.tr-esq { height: 52px; border-radius: 12px; margin-bottom: 8px; background: linear-gradient(90deg, var(--tr-s1) 0%, var(--tr-s2) 50%, var(--tr-s1) 100%);
  background-size: 200% 100%; animation: tr-brillo 1.4s linear infinite; }
.tr-esq.alto { height: 250px; margin: 0; border-radius: 16px; }
@keyframes tr-brillo { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .tr-esq { animation: none; } button.tr-d { transition: none; } }

/* Ajustes */
.tr-ajustes { margin-top: 16px; padding: 4px 24px; }
.tr-aj-fila { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--tr-line); }
.tr-ajustes > .tr-aj-fila:first-child { border-top: 0; }
.tr-aj-l { font-weight: 600; font-size: 14px; }
.tr-aj-d { color: var(--tr-muted); font-size: 12.5px; margin-top: 3px; max-width: 560px; }
.tr-switch { position: relative; width: 44px; height: 26px; border-radius: 999px; border: 0; background: var(--tr-line); cursor: pointer; flex: 0 0 auto; }
.tr-switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.tr-switch.on { background: var(--tr-ok); }
.tr-switch.on span { transform: translateX(18px); }
.tr-switch:disabled { opacity: .45; cursor: default; }
.tr-confirma { display: flex; gap: 8px; align-items: center; font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }

/* Entre tablet y escritorio angosto: el calendario arriba, el resumen al lado se achica */
@media (max-width: 1080px) {
  .tr-arriba { grid-template-columns: minmax(0, 1fr); }
  .tr-c-ped { max-width: 190px; }
}

/* Teléfono: cada venta es una tarjeta */
@media (max-width: 760px) {
  .tr-acciones { width: 100%; justify-content: space-between; }
  .tr-cal { padding: 12px 10px 12px; }
  .tr-cal-dias { gap: 5px; }
  .tr-d { height: 46px; padding: 5px 6px; }
  .tr-d .c i { display: none; }
  .tr-d .c b { font-size: 12px; }
  .tr-dia-res { padding: 16px 18px; }
  .tr-dia-t { font-size: 19px; }
  .tr-cifras { gap: 8px; }
  .tr-cifras > div { padding: 12px; }
  .tr-cifras b { font-size: 20px; }
  .tr-dia-res { gap: 18px; }
  .tr-tabla, .tr-tabla tbody { display: block; }
  .tr-tabla thead { display: none; }
  .tr-tabla { border-radius: 14px; font-size: 13.5px; }
  .tr-tabla tr.tr-f { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px; padding: 12px 14px;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas: "h cli m" "n cli est" ". ped ped" ". med doc"; border-top: 1px solid var(--tr-line); }
  .tr-tabla tbody tr.tr-f:first-child { border-top: 0; }
  .tr-tabla tr.tr-f td { display: block; padding: 0; border: 0; width: auto; max-width: none; background: none; box-shadow: none; }
  .tr-c-h { grid-area: h; } .tr-c-n { grid-area: n; font-size: 12.5px; } .tr-c-cli { grid-area: cli; } .tr-c-m { grid-area: m; }
  .tr-c-est { grid-area: est; } .tr-c-ped { grid-area: ped; font-size: 12.5px; } .tr-c-med { grid-area: med; color: var(--tr-muted); font-size: 12.5px; }
  .tr-c-doc { grid-area: doc; text-align: right; font-size: 12.5px; }
  .tr-tabla tr.tr-f.mal, .tr-tabla tr.tr-exp.mal { background: var(--tr-bad-bg); box-shadow: inset 3px 0 0 var(--tr-bad); }
  .tr-tabla tr.tr-f.revisado, .tr-tabla tr.tr-exp.revisado { box-shadow: inset 3px 0 0 var(--tr-line); }
  .tr-tabla tr.mal td:first-child, .tr-tabla tr.revisado td:first-child { box-shadow: none; }
  .tr-c-n, .tr-c-est, .tr-c-m { align-self: start; }
  .tr-tabla tr.tr-exp { display: block; padding: 0 14px 12px 66px; }
  .tr-tabla tr.tr-exp td { display: block; padding: 0; background: none; box-shadow: none; }
  .tr-tabla tr.tr-exp td.tr-c-h { display: none; }
  .tr-exp-in { align-items: flex-start; }
  .tr-acc { justify-content: flex-start; }
  .tr-nota { width: 100%; }
  .tr-mes-sec { padding: 2px 16px; }
  .tr-ms-fila { flex-wrap: wrap; gap: 4px 12px; }
  .tr-ms-t { width: auto; }
  .tr-ms-d { flex-basis: 100%; }
  .tr-ms-item { padding-left: 0; flex-wrap: wrap; }
  .tr-pie-acc { margin-left: 0; }
  .tr-aj-fila { flex-wrap: wrap; }
}
