/* TissueArg - Gestión comercial. Rukan - Orden y desarrollo a medida */
/* Marca TissueArg (del MVP y de tissuearg.com). Todo lo de marca se cambia acá, en :root. */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --marino: #153e76;     /* azul TISSUEARG: texto de títulos, encabezado y pie */
  --primario: #153e76;   /* botones */
  --acento: #006a9c;     /* links y destacados (el celeste de la web, oscurecido para AA: 5,6:1 sobre blanco) */
  --bg: #eef2f6;         /* gris claro del MVP */
  --panel: #ffffff;
  --panel2: #f4f7fa;
  --fila-hover: #f3f6fa;
  --line: #dde4ec;
  --line2: #b6c3d3;
  --txt: #1d2330;
  --mute: #4f5b6c;
  --dim: #5e6a7d;        /* gris secundario: 5,5:1 sobre blanco (AA) */
  --ok: #1d7a4b;
  --warn: #9a6400;
  --bad: #b3362b;
  --acc: var(--primario);
  --acc-hover: #0f2d57;
  --acc-suave: #e8eef7;
  --on-acc: #ffffff;
  --graf: var(--primario);
  --graf-claro: #9fb6d8;
  --pie-bg: #211f20;     /* negro del logo */
  --pie-txt: #ffffff;
  --firma: #9aa5b5;
  --r: 4px;              /* esquinas de botones, tarjetas y campos (núcleo de Rukan, igual que el resto de los sistemas) */
  --f-display: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --f-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  font-family: var(--f-body);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--txt); }
html { -webkit-text-size-adjust: 100%; }
/* columna a toda la altura: el contenido crece y el pie queda siempre abajo */
body { -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.5; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
body > .pie { flex: none; }
a { color: inherit; }
.mute { color: var(--mute); } .dim { color: var(--dim); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.hidden { display: none !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
::selection { background: var(--acc); color: var(--on-acc); }

.wrap { width: 100%; max-width: 1344px; margin: 0 auto; padding: 32px 32px 48px; } /* 1280 de contenido + 2 x 32 */
h1 { font-family: var(--f-display); font-size: 28px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
h2 { font-family: var(--f-display); font-size: 17px; font-weight: 600; margin-bottom: 2px; line-height: 1.3; }
.sub { color: var(--mute); font-size: 14px; }
.cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; box-shadow: 0 1px 2px rgba(7, 36, 81, .05); }
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .g2 { grid-template-columns: minmax(0, 1fr); } }

.kpi { display: flex; flex-direction: column; }
.kpi span { display: block; color: var(--mute); font-size: 14px; font-weight: 600; }
.kpi b { display: block; font-family: var(--f-display); font-size: 30px; font-weight: 600; letter-spacing: -.01em; margin: 8px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi small { display: block; color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .var { display: inline; font-size: inherit; font-weight: 600; }
.kpi .var.sube { color: var(--ok); } .kpi .var.baja { color: var(--bad); }
@media (max-width: 480px) { .g4 { gap: 10px; } .kpi { padding: 14px 12px; } .kpi b { font-size: 18px; letter-spacing: -.02em; } .kpi span, .kpi small { font-size: 12px; } }

button, .btn {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--txt); background: var(--panel);
  border: 1px solid var(--line2); padding: 10px 16px; border-radius: var(--r); cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover, .btn:hover { border-color: var(--acc); color: var(--acc); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: default; }
.btn-ok { background: var(--acc); color: var(--on-acc); border-color: var(--acc); }
.btn-ok:hover { background: var(--acc-hover); color: var(--on-acc); border-color: var(--acc-hover); }
.seg { display: inline-flex; }
.seg button { padding: 7px 12px; font-size: 13px; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: var(--r) 0 0 var(--r); }
.seg button:last-child { border-radius: 0 var(--r) var(--r) 0; }
.seg button + button { border-left: 0; }
.seg button.on { background: var(--acc); color: var(--on-acc); border-color: var(--acc); }

input, select { font: inherit; color: var(--txt); background: var(--panel); border: 1px solid var(--line2); padding: 10px 12px; width: 100%; border-radius: var(--r); }
input::placeholder { color: var(--dim); }
input:focus, select:focus { border-color: var(--acc); outline: none; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--mute); margin-bottom: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--mute); font-weight: 600; font-size: 12px; letter-spacing: .02em; padding: 10px 12px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr > td { transition: background-color .12s; }
tbody tr:hover > td:not(.vacio) { background: var(--fila-hover); }
/* en pantallas angostas la tabla se desplaza dentro de su caja, nunca la página */
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border: 1px solid currentColor; border-radius: var(--r); color: var(--mute); white-space: nowrap; }
.tag.acento { color: var(--acento); }
.tag.ok { color: var(--ok); } .tag.bad { color: var(--bad); } .tag.warn { color: var(--warn); }
.cuota { height: 4px; background: var(--acc-suave); margin-top: 6px; }
.cuota i { display: block; height: 100%; background: var(--graf-claro); }
.vacio { padding: 44px 16px; text-align: center; color: var(--mute); font-size: 14px; }
td.vacio { background: transparent; }
/* esqueleto de carga: barras grises suaves mientras llegan los datos */
.esq { display: block; height: 12px; border-radius: var(--r); background: linear-gradient(90deg, #edf1f6 25%, #f6f8fb 50%, #edf1f6 75%); background-size: 200% 100%; animation: esq 1.3s ease-in-out infinite; }
.esq + .esq { margin-top: 8px; }
.esq.chico { height: 10px; }
.esq.bloque { height: 100%; min-height: 200px; }
tr.esq-fila td { padding-top: 16px; padding-bottom: 16px; }
@keyframes esq { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .esq { animation: none; } }
.cargando { opacity: .5; transition: opacity .15s; pointer-events: none; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--marino); color: #fff; padding: 12px 18px; border-radius: var(--r); z-index: 80; font-size: 14px; max-width: 92vw; }
.toast.bad { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(7, 36, 81, .55); display: flex; align-items: center; justify-content: center; z-index: 70; padding: 20px; }
.modal { background: var(--panel); border-radius: var(--r); padding: 28px; width: min(360px, 100%); max-height: 92vh; overflow: auto; }

a { color: var(--acento); }
h1, h2 { color: var(--marino); }
.logo { display: block; height: auto; }
/* pie de marca: marino con texto blanco; la firma de Rukan va discreta, en gris */
.pie { background: var(--pie-bg); color: var(--pie-txt); padding: 18px 32px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.pie .firma { color: var(--firma); font-size: 12px; }

/* ---------- Tarjetas navegables (common.js → tarjetasRel). Estándar de todo el sistema ---------- */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tarjeta { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--txt); text-decoration: none; box-shadow: 0 1px 2px rgba(7, 36, 81, .05); transition: border-color .12s, box-shadow .12s, transform .12s; min-width: 0; min-height: 44px; }
.tarjeta:hover { border-color: var(--acento); box-shadow: 0 4px 14px rgba(7, 36, 81, .10); transform: translateY(-1px); }
.tarjeta:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
.tarjeta small { color: var(--dim); font-size: 12px; }
.t-navs { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.t-nav .t-ic { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--acc-suave, #e8f1fd); color: var(--primario); font-weight: 700; margin-bottom: 6px; }
.t-nav .t-dato-g { font-family: var(--f-display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.t-nav .t-nota { margin-top: 4px; color: var(--warn); }
.rel { margin-top: 18px; }
.rel-tit { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.link-ficha { color: inherit; text-decoration: none; font-weight: 700; } .link-ficha:hover { color: var(--acento); text-decoration: underline; }
tr.clic { cursor: pointer; } tr.clic:hover td { background: rgba(4, 113, 229, .05); }
@media (max-width: 520px) { .tarjetas, .t-navs { grid-template-columns: minmax(0, 1fr); } }
@media print { .rel { display: none; } }

/* ---------- Sales Hub: entorno aparte (body.hub) ----------
   Celeste suave de la misma familia que el azul de TissueArg (#0153BB / #0471E5): todo el fondo,
   el menú y las barras cambian, las tarjetas quedan blancas. Contraste de texto sin cambios (AA). */
body.hub { --bg: #eaf3fc; --panel2: #dcebfa; --line: #c9dff4; --hub-suave: #ffffff; background: var(--bg); }
body.hub .sb, body.hub .tb, body.hub .bb { background: #e1eefb; border-color: #c9dff4; }
body.hub .sb a.sb-item:hover { background: #d3e6f9; }
body.hub .card { border-color: #cfe2f5; box-shadow: 0 1px 3px rgba(1, 83, 187, .08); }
body.hub .pie { background: transparent; }

/* «Pedir un cambio» flotante (nav.js), en todas las pantallas. En el celular va arriba de la barra inferior y queda
   solo el ícono, para no tapar contenido. Debajo de los modales (70) y del toast (80). Igual que Granaderos. */
.pc-flot { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px 10px 13px; border-radius: 999px; background: var(--panel); color: var(--primario); border: 1px solid var(--line2, var(--line));
  box-shadow: 0 4px 16px rgba(7, 36, 81, .16); font-size: 14px; font-weight: 700; cursor: pointer; width: auto; }
.pc-flot svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.pc-flot:hover { border-color: var(--acento); color: var(--acento); }
.pc-flot:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
@media (max-width: 900px) {
  .pc-flot { padding: 0; width: 48px; height: 48px; justify-content: center; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .pc-flot span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body.con-sb .pc-flot { bottom: calc(var(--bb, 62px) + 14px + env(safe-area-inset-bottom, 0px)); }
  body.sb-abierto .pc-flot { display: none; }
}
@media print { .pc-flot { display: none; } }
/* que el flotante no tape «Hecho por Rukan» al llegar al pie */
body:has(> .pc-flot) > .pie { padding-right: 230px; }
@media (max-width: 900px) { body:has(> .pc-flot) > .pie { padding-right: 76px; } }

/* Trabajos en curso (trabajos.js, la monta nav.js): tira fija abajo con un chip por formulario sin terminar.
   Al lado del «Pedir un cambio» (no lo tapa), debajo de los modales y del toast. Sin trabajos no se ve. */
.trab { position: fixed; z-index: 39; bottom: 20px; left: 20px; right: 230px; display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 5px 6px; background: var(--panel); border: 1px solid var(--line2, var(--line)); border-radius: var(--r, 4px); box-shadow: 0 4px 16px rgba(7, 36, 81, .14); font-size: 13.5px; }
body.con-sb .trab { left: calc(var(--sb, 240px) + 20px); }
.trab.plegada { right: auto; }
.trab-pleg { width: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: none; color: var(--txt); border: 0; font-weight: 700; font-size: 13px; cursor: pointer; }
.trab-n { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--acento); color: #fff; font-size: 12px; text-align: center; }
.trab-chips { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.trab-chip { flex: none; display: flex; align-items: center; max-width: 340px; border: 1px solid var(--line); border-radius: var(--r, 4px); background: var(--panel2, #f4f7fa); }
.trab-chip a { display: block; min-width: 0; padding: 7px 4px 7px 10px; color: var(--txt); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trab-chip a:hover { color: var(--acento); }
.trab-x { width: 32px; height: 32px; flex: none; padding: 0; background: none; border: 0; color: var(--mute); font-size: 13px; cursor: pointer; }
.trab-x:hover { color: var(--bad); }
.trab-chip.preg { padding: 4px 6px 4px 10px; gap: 6px; background: rgba(179, 54, 43, .07); border-color: var(--bad); max-width: none; }
.trab-chip.preg span { white-space: nowrap; }
.trab-si, .trab-no { width: auto; padding: 5px 10px; font-size: 13px; flex: none; }
.trab-si { background: var(--bad); border-color: var(--bad); color: #fff; }
.trab-no { background: none; color: var(--txt); border: 1px solid var(--line); }
.trab a:focus-visible, .trab button:focus-visible { outline: 3px solid var(--acento); outline-offset: 1px; }
body.con-trab { padding-bottom: 72px; }
@media (max-width: 900px) {
  .trab { left: 8px; right: 72px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); padding: 3px 4px; }
  body.con-sb .trab { left: 8px; bottom: calc(var(--bb, 62px) + 10px + env(safe-area-inset-bottom, 0px)); }
  .trab-chip { max-width: 250px; }
  .trab-tit { display: none; }
  body.sb-abierto .trab { display: none; }
  body.con-trab { padding-bottom: 66px; }
  body.con-sb.con-trab { padding-bottom: calc(var(--bb, 62px) + 66px + env(safe-area-inset-bottom, 0px)); }
}
@media print { .trab { display: none; } }

/* Buscador con desplegable propio (public/buscador.js): reemplaza los <datalist> del navegador. Diseño aprobado por Fede. */
.bc { position: relative; min-width: 0; }
.bc > input.bc-input { padding-left: 38px; padding-right: 38px; width: 100%; }
.bc-lupa { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--dim); pointer-events: none; }
.bc-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; width: 30px; height: 30px; min-height: 0; padding: 0;
  border-radius: 50%; color: var(--dim); font-size: 18px; line-height: 1; cursor: pointer; }
.bc-x:hover { background: var(--panel2); color: var(--txt); }
.bc-x[hidden] { display: none; }
/* fixed: no la cortan las tablas con scroll ni los modales (la ubica buscador.js debajo del campo, o arriba si no entra) */
.bc-lista { position: fixed; z-index: 75; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: 0 8px 24px rgba(7, 36, 81, .14);
  max-height: 360px; overflow-y: auto; list-style: none; margin: 0; padding: 4px 0; text-align: left; }
.bc-lista[hidden] { display: none; }
.bc-grupo { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); padding: 8px 14px 4px; }
.bc-op { padding: 8px 14px; cursor: pointer; border-left: 3px solid transparent; }
.bc-op .bc-rs { font-weight: 600; font-size: 15px; line-height: 1.3; color: var(--txt); overflow-wrap: anywhere; }
.bc-op .bc-dt { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bc-op mark { background: #fde9a6; color: inherit; border-radius: 2px; padding: 0 1px; }
.bc-op:hover { background: var(--fila-hover); }
.bc-op[aria-selected="true"] { background: var(--acc-suave); border-left-color: var(--marino); }
.bc-op.prueba .bc-rs { color: var(--mute); }
.bc-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 3px; background: #fff3d6; color: var(--warn); margin-left: 6px; vertical-align: 1px; }
.bc-alta { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--acento); font-weight: 700; cursor: pointer; }
.bc-alta[aria-selected="true"], .bc-alta:hover { background: var(--acc-suave); }
.bc-vacio { padding: 10px 14px; color: var(--mute); font-size: 14px; }
@media (max-width: 600px) { .bc-op { padding: 11px 14px; } .bc-lista { max-height: 55vh; } }
