:root {
  --carbon: #1f1d1b; --tinta: #2b2926; --suave: #6f6a63; --linea: #e6dfd3;
  --crema: #f7f2ea; --papel: #fffdf9; --oro: #b8923f; --oro-claro: #f1e6cc;
  --verde: #2f7a4f; --verde-f: #e3f1e8; --ambar: #a86a12; --ambar-f: #fbeed6;
  --rojo: #b23b30; --rojo-f: #f8e1de; --gris-f: #efebe4;
  --radio: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--crema); color: var(--tinta);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
header.barra { background: var(--carbon); color: #f3ede2; display: flex; align-items: center; gap: 28px;
  padding: 0 28px; height: 60px; position: sticky; top: 0; z-index: 5; }
.marca { font-family: "Cormorant Garamond", Georgia, serif; font-size: 22px; letter-spacing: .5px; }
.marca b { color: var(--oro); font-weight: 600; }
nav a { text-decoration: none; color: #cfc6b8; margin-right: 18px; font-size: 14px; padding: 19px 0;
  border-bottom: 2px solid transparent; }
nav a.activo, nav a:hover { color: #fff; border-bottom-color: var(--oro); }
.usuario { margin-left: auto; font-size: 13px; color: #a79e90; }
.usuario a { color: #cfc6b8; }
main { max-width: 1320px; margin: 0 auto; padding: 28px; }
h1 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 32px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; letter-spacing: .2px; }
.sub { color: var(--suave); margin: 0 0 22px; }
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 20px; }
.fila { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.contadores a { text-decoration: none; background: var(--papel); border: 1px solid var(--linea);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.contadores a.activo { border-color: var(--oro); background: var(--oro-claro); }
.contadores b { margin-left: 6px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--suave);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--linea); }
td { padding: 12px; border-bottom: 1px solid var(--linea); vertical-align: top; }
tr.click:hover td { background: #fbf7f0; cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip.verde { background: var(--verde-f); color: var(--verde); }
.chip.ambar { background: var(--ambar-f); color: var(--ambar); }
.chip.rojo { background: var(--rojo-f); color: var(--rojo); }
.chip.gris { background: var(--gris-f); color: var(--suave); }
.chip.oro { background: var(--oro-claro); color: #8a6a22; }
.motivo { font-size: 12.5px; color: var(--suave); margin-top: 3px; }
.btn { display: inline-block; border: 1px solid var(--carbon); background: var(--carbon); color: #fff;
  border-radius: 8px; padding: 9px 16px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn.sec { background: transparent; color: var(--carbon); }
.btn.oro { background: var(--oro); border-color: var(--oro); }
.btn.peligro { background: transparent; color: var(--rojo); border-color: var(--rojo); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.subida { border: 1.5px dashed #cdbfa6; border-radius: var(--radio); padding: 18px; background: var(--papel);
  display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.dos { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 22px; align-items: start; }
.visor { position: sticky; top: 84px; height: calc(100vh - 110px); border-radius: var(--radio); overflow: hidden;
  border: 1px solid var(--linea); background: #fff; }
.visor iframe, .visor img { width: 100%; height: 100%; border: 0; object-fit: contain; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
label { font-size: 12px; color: var(--suave); display: block; margin-bottom: 3px; }
input, select, textarea { width: 100%; font: inherit; font-size: 14px; padding: 7px 9px; border: 1px solid #d9d0c1;
  border-radius: 7px; background: #fff; color: var(--tinta); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--oro-claro); border-color: var(--oro); }
.baja { opacity: .65; }
.lineas td { padding: 6px 4px; border: 0; }
.lineas input, .lineas select { padding: 5px 6px; font-size: 13px; }
.incid { list-style: none; padding: 0; margin: 0; }
.incid li { padding: 9px 12px; border-radius: 8px; margin-bottom: 6px; font-size: 13.5px; }
.incid li.bloquea { background: var(--rojo-f); color: #7d2a22; }
.incid li.aviso { background: var(--gris-f); color: var(--tinta); }
.ok { background: var(--verde-f); color: var(--verde); padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.nota { background: var(--oro-claro); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
pre { background: #f4efe6; border-radius: 8px; padding: 12px; font-size: 12px; overflow: auto; max-height: 320px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.historial { font-size: 13px; color: var(--suave); }
.historial li { margin-bottom: 4px; }
.matriz td, .matriz th { vertical-align: middle; }
.error { background: var(--rojo-f); color: #7d2a22; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.login { max-width: 380px; margin: 12vh auto; }
.vacio { text-align: center; color: var(--suave); padding: 40px; }
details summary { cursor: pointer; color: var(--suave); font-size: 13px; }
@media (max-width: 900px) {
  .dos { grid-template-columns: 1fr; } .visor { position: static; height: 70vh; }
  header.barra { gap: 12px; padding: 0 14px; overflow-x: auto; } main { padding: 16px; }
  .campos { grid-template-columns: 1fr; }
}
.lineas { table-layout: fixed; }
/* Los importes nunca se cortan: «999.999,99» cabe en Base y Cuota; si no hay sitio, la tabla se desplaza. */
@media (max-width: 1100px) { .tabla-scroll { overflow-x: auto; } }
.lineas:not(.vtos) { min-width: 500px; }
.lineas th:nth-child(1), .lineas td:nth-child(1) { width: 24%; }
.lineas th:nth-child(2), .lineas td:nth-child(2) { width: 15%; }
.lineas th:nth-child(3), .lineas td:nth-child(3) { width: 17%; min-width: 96px; }
.lineas th:nth-child(4), .lineas td:nth-child(4) { width: 8%; }
.lineas th:nth-child(5), .lineas td:nth-child(5) { width: 15%; min-width: 86px; }
.lineas th:nth-child(6), .lineas td:nth-child(6) { width: 15%; }
.lineas th:nth-child(7), .lineas td:nth-child(7) { width: 6%; }
.lineas td input { padding-left: 5px; padding-right: 5px; }
.lineas input { font-variant-numeric: tabular-nums; }
.vtos { max-width: 420px; }
.vtos th:nth-child(1), .vtos td:nth-child(1) { width: 50%; }
.vtos th:nth-child(2), .vtos td:nth-child(2) { width: 42%; }
.vtos th:nth-child(3), .vtos td:nth-child(3) { width: 8%; }
.lineas input, .lineas select { width: 100% !important; }
