/* Granaderos - Sistema de gestión (heredado de TissueArg). Rukan */
/* TODO marca: colores provisorios heredados de TissueArg hasta tener la marca de Granaderos. 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 provisorio: 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: 8px;
  --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; }
