/* FacturaBlack · Familia Black, blanco minimalista */
:root {
  --fondo: #ffffff;
  --papel: #ffffff;
  --tinta: #111111;
  --tenue: #6b6b6b;
  --linea: #ebebeb;
  --linea-fuerte: #d9d9d9;
  --campo: #8a8a8a;
  --grafito: #111111;
  --grafito-2: #2b2b2b;
  --oro: #c9a24a;
  --oro-hover: #b08a35;
  --oro-texto: #7a5c12;
  --oro-suave: #faf6ec;
  --suave: #f7f7f7;
  --verde: #1f7a4a;
  --rojo: #b3261e;
  --azul: #2c5f8a;
  --acento: var(--grafito);
  --oro-claro: #c9a24a;
  --radio: 12px;
  --radio-ctl: 8px;
  --foco: 0 0 0 2px #fff, 0 0 0 4px var(--azul);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--tinta);
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
a { color: var(--tinta); text-decoration: underline; text-decoration-color: var(--linea-fuerte); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--tinta); }
h1 { font-size: 1.5rem; font-weight: 600; margin: .2rem 0 1.4rem; letter-spacing: -.02em; line-height: 1.25; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 1rem; letter-spacing: -.01em; }
h3 { font-size: .95rem; font-weight: 600; margin: 1.4rem 0 .6rem; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.tenue { color: var(--tenue); }
.chico { font-size: .85rem; }
.centro { text-align: center; }
.der { text-align: right; }
.sin-salto { white-space: nowrap; }
.mayus { text-transform: uppercase; }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: 6px; }

/* Barra superior: blanca, separada por una línea */
.barra { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--papel); color: var(--tinta); padding: .7rem 2rem; border-bottom: 1px solid var(--linea); }
.barra nav { display: flex; gap: .15rem; align-items: center; flex-wrap: wrap; }
.barra nav a { color: var(--tenue); text-decoration: none; padding: .45rem .7rem; border-radius: var(--radio-ctl); font-weight: 500; font-size: .9rem; }
.barra nav a:hover { color: var(--tinta); background: var(--suave); }
.barra nav a.activo { color: var(--tinta); box-shadow: inset 0 -2px 0 var(--oro); border-radius: 0; background: none; }
.barra nav a.btn { background: var(--grafito); color: #fff; margin-right: .5rem; box-shadow: none; border-radius: var(--radio-ctl); }
.barra nav a.btn:hover { background: var(--grafito-2); color: #fff; }
.barra nav a.oro { color: var(--oro-texto); }
.barra nav a.tenue { color: #8f8f8f; }
.marca { font-weight: 600; color: inherit; display: inline-flex; align-items: center; gap: .55rem; font-size: 1rem;
  text-decoration: none; letter-spacing: -.01em; }
.marca:hover { text-decoration: none; }
.marca.grande { font-size: 1.35rem; color: var(--tinta); }
.logo { display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 7px;
  background: var(--grafito); color: var(--oro); font-size: .78em; font-weight: 600; letter-spacing: -.02em; }
.subbarra { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .55rem 2rem; background: var(--papel); border-bottom: 1px solid var(--linea); font-size: .85rem; color: var(--tenue); }
.subbarra strong { color: var(--tinta); font-weight: 600; }

/* Estructura: mucho aire, bordes finos, sin sombras */
.contenido { max-width: 1120px; margin: 0 auto; padding: 2.5rem 2rem 4rem; }
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--fondo); }
.acceso-caja { width: min(400px, 100%); padding: 2rem; }
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 1.5rem; margin-bottom: 1.5rem; }
.destacado { background: var(--suave); }
.fila-entre { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.cifra { color: var(--tenue); font-size: .85rem; }
.cifra strong { display: block; font-size: 1.6rem; margin-top: .35rem; color: var(--tinta); font-weight: 600; letter-spacing: -.02em; }
.enorme { font-size: 1.75rem; font-weight: 600; margin: .2rem 0; letter-spacing: -.02em; }

/* Formularios */
label { display: flex; flex-direction: column; gap: .4rem; font-size: .82rem; font-weight: 500; color: var(--tinta); }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, textarea { font: inherit; font-weight: 400; padding: .55rem .75rem; min-height: 40px;
  border: 1px solid var(--campo); border-radius: var(--radio-ctl); background: #fff; color: var(--tinta);
  width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #9e9e9e; }
input:hover, select:hover, textarea:hover { border-color: var(--tinta); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--tinta); box-shadow: var(--foco); }
input[type=checkbox], input[type=radio] { width: 1rem; height: 1rem; min-height: 0; accent-color: var(--grafito); }
input[type=file] { padding: .45rem; background: var(--suave); }
.pila { display: grid; gap: 1rem; margin: 1.4rem 0; }
.rejilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem 1.2rem; align-items: end; }
.ancho2 { grid-column: span 2; }
.ancho3 { grid-column: 1 / -1; }
.nota { background: var(--suave); padding: .75rem 1rem; border-radius: var(--radio-ctl); font-size: .88rem; color: var(--tenue); }
.filtros { display: flex; gap: .8rem; flex-wrap: wrap; align-items: end; }
.filtros label { min-width: 160px; }
.filtros label:first-child { flex: 1; }
fieldset { border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.1rem 1.2rem; margin: 1.2rem 0;
  display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; }
fieldset.rejilla { display: grid; }
legend { padding: 0 .4rem; color: var(--tenue); font-size: .82rem; font-weight: 500; }

/* Botones: principal negro, los demás de borde */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px;
  background: var(--grafito); color: #fff; border: 1px solid var(--grafito); border-radius: var(--radio-ctl);
  padding: .5rem 1.1rem; font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; text-align: center; text-decoration: none;
  transition: background .15s, border-color .15s; }
.btn:hover { background: var(--grafito-2); border-color: var(--grafito-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--foco); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn-chico { min-height: 32px; padding: .25rem .75rem; font-size: .84rem; }
.btn-grande { min-height: 46px; padding: .7rem 1.4rem; font-size: .98rem; width: 100%; }
.btn-claro { background: #fff; color: var(--tinta); border: 1px solid var(--linea-fuerte); }
.btn-claro:hover { background: var(--suave); border-color: var(--campo); }
.btn-oscuro, .btn-oro { }
.btn-oscuro { background: var(--grafito); color: #fff; border-color: var(--grafito); }
.btn-oscuro:hover { background: var(--grafito-2); }
.acciones { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Tablas */
.tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.tabla th { text-align: left; font-size: .78rem; font-weight: 500; color: var(--tenue);
  background: var(--suave); border-bottom: 1px solid var(--linea); padding: .6rem .8rem; }
.tabla th:first-child { border-top-left-radius: var(--radio-ctl); }
.tabla th:last-child { border-top-right-radius: var(--radio-ctl); }
.tabla th.der { text-align: right; }
.tabla td { padding: .8rem .8rem; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla tbody tr:hover td { background: #fafafa; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla td a { font-weight: 500; text-decoration: none; }
.tabla td a:hover { text-decoration: underline; }
.tabla tfoot td { border: 0; padding-top: .8rem; }
.clic { cursor: pointer; }

/* Etiquetas y avisos */
.etiqueta { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; padding: .16rem .6rem; border-radius: 99px;
  background: #eef7f2; color: var(--verde); font-weight: 500; text-transform: capitalize; white-space: nowrap; }
.etiqueta::before { content: ""; width: .38rem; height: .38rem; border-radius: 50%; background: currentColor; }
.etiqueta.cancelado { background: #fdf0ef; color: var(--rojo); }
.etiqueta.aviso { background: var(--oro-suave); color: var(--oro-texto); margin-left: .4rem; }
.aviso-ok, .aviso-error, .aviso-alerta { padding: .75rem 1rem; border-radius: var(--radio-ctl); margin-bottom: 1.2rem;
  border: 1px solid; font-weight: 400; font-size: .92rem; }
.aviso-ok { background: #f3faf6; color: #155c37; border-color: #d3eadc; }
.aviso-error { background: #fdf4f3; color: #8f1c13; border-color: #f2d4d0; }
.aviso-alerta { background: var(--oro-suave); color: #5e4708; border-color: #efe3c4; }

/* Factura */
.concepto { display: grid; grid-template-columns: 1.1fr .7fr 1.1fr 1fr 2fr; gap: .7rem .9rem; align-items: end;
  padding: 1.1rem 2.6rem 1.1rem 1.1rem; border: 1px solid var(--linea); border-radius: var(--radio); margin-bottom: .8rem;
  position: relative; background: var(--papel); }
.concepto .desc { grid-column: 1 / -1; order: -1; }
.concepto .importe { display: flex; flex-direction: column; text-align: right; font-size: .84rem; color: var(--tenue); }
.concepto .importe strong { font-size: 1.05rem; color: var(--tinta); font-weight: 600; }
.quitar { position: absolute; top: .45rem; right: .55rem; border: 0; background: none; font-size: 1.3rem;
  color: #9e9e9e; cursor: pointer; line-height: 1; border-radius: 6px; padding: 0 .3rem; }
.quitar:hover { color: var(--rojo); background: #fdf0ef; }
.totales-caja { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: end; }
.totales { justify-self: end; min-width: 320px; border-collapse: collapse; }
.totales td { padding: .35rem .6rem; } .totales td:last-child { text-align: right; font-weight: 500; }
.totales .total td { font-size: 1.25rem; font-weight: 600; border-top: 1px solid var(--tinta); padding-top: .7rem; }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.6rem; margin: 0 0 1.4rem; }
.datos dt { color: var(--tenue); } .datos dd { margin: 0; font-weight: 500; }

@media (max-width: 800px) {
  .contenido { padding: 1.4rem 1rem 3rem; }
  .barra, .subbarra { padding-left: 1rem; padding-right: 1rem; }
  .rejilla, .concepto { grid-template-columns: 1fr 1fr; }
  .ancho2 { grid-column: 1 / -1; }
  .totales-caja { grid-template-columns: 1fr; }
  .totales { justify-self: stretch; min-width: 0; width: 100%; }
  .tabla { display: block; overflow-x: auto; }
  h1 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.acciones-factura { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.acciones-factura .enviar { display: flex; gap: .5rem; flex: 1; min-width: 280px; }
.acciones-factura .enviar input { flex: 1; }
.tipo { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 6px;
  font-size: .72rem; font-weight: 600; background: var(--suave); color: var(--tinta); }
.tipo-E { background: #fdf0ef; color: var(--rojo); }
.tipo-P { background: #eef7f2; color: var(--verde); }
.importe-pago { max-width: 140px; text-align: right; }

/* ---- Módulo timbres / despacho / admin ---- */
.paquetes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.paquete { border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; background: #fff; transition: border-color .15s; }
.paquete:hover { border-color: var(--tinta); }
.paquete .btn { margin-top: 8px; }
.desliza { overflow-x: auto; }
.tabla tfoot th { border-top: 1px solid var(--tinta); text-align: inherit; background: none; }
.tabla tfoot th.der { text-align: right; }

[hidden] { display: none !important; }
.rejilla.cuatro { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .rejilla.cuatro { grid-template-columns: 1fr 1fr; } }

select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b6b6b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .8rem center; }
.cifras > .tarjeta { margin-bottom: 0; }
.cifras { margin-bottom: 1.5rem; }
@media (max-width: 800px) {
  .barra { padding-top: .6rem; padding-bottom: .5rem; }
  .barra nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem; }
  .barra nav::-webkit-scrollbar { display: none; }
  .barra nav a { white-space: nowrap; flex-shrink: 0; }
  .subbarra { font-size: .8rem; padding-top: .45rem; padding-bottom: .45rem; }
  .cifras { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .cifras > .tarjeta { padding: 1rem; }
  .cifra strong { font-size: 1.3rem; }
  .tarjeta { padding: 1.1rem 1rem; }
}

/* ContaBlack */
.subnav { display: flex; gap: .3rem; margin: 0 0 1.4rem; border-bottom: 1px solid var(--linea); overflow-x: auto; }
.subnav a { padding: .6rem .9rem; color: var(--tenue); font-weight: 500; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--tinta); }
.subnav a.activo { color: var(--tinta); border-bottom-color: var(--oro); }
.barra-filtros { display: flex; gap: 1rem; align-items: end; margin-bottom: 1rem; max-width: 260px; }
.barra-filtros label { flex: 1; }
.fila-mayor td { font-weight: 600; background: var(--suave); }
.etiqueta.pendiente { background: var(--oro-suave); color: var(--oro-texto); margin-left: .4rem; text-transform: none; }
.rejilla .doble { grid-column: span 2; }
.casilla { display: flex; gap: .5rem; align-items: center; }
.casilla input { width: auto; }
.rejilla.dos-col { grid-template-columns: 1fr 1fr; align-items: start; }
.rejilla.dos-col > .tarjeta { margin-bottom: 0; }
.rejilla.dos-col .rejilla { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .rejilla.dos-col, .rejilla.dos-col .rejilla { grid-template-columns: 1fr; } }

/* ContaBlack etapa 3: estados financieros */
.tabla tr.subtotal td { border-top: 1px solid var(--linea-fuerte); font-weight: 500; }
.tabla tr.total td { border-top: 1px solid var(--tinta); font-weight: 600; }
@media print {
  header, nav, .subnav, .barra-filtros, .no-imprimir, .aviso-ok, .aviso-alerta, footer { display: none !important; }
  body { background: #fff; color: #000; }
  .tarjeta { box-shadow: none; border: 0; break-inside: avoid; }
}
@media (max-width: 800px) { .tabla td, .tabla th { white-space: nowrap; } }
