/* Toro Negro · Canal Mayorista
   Layout: barra lateral oscura con la navegación del rol + área de trabajo clara con encabezado de página y bloques.
   Todo color, espacio, tamaño de texto y radio sale de los tokens de :root. Para espaciar o alinear algo en los JS
   se usan las utilidades del final (mt-3, entre, crece…), no style="…". */
:root {
  /* Color */
  --bg: #F1F0ED;
  --surface: #FFFFFF;
  --surface2: #F7F6F3;
  --ink: #1D1B1A;
  --muted: #6B6560;
  --line: #E2DED8;
  --accent: #B3171E;          /* rojo de marca: acción principal */
  --accent-ink: #FFFFFF;
  --accent-soft: #FBE5E5;
  --accent-strong: #C4161C;   /* opción activa del menú */
  --accent-bright: #E3262E;   /* badge y acento del ingreso */
  --focus: var(--accent);     /* contorno de foco sobre fondo claro */
  --focus-side: #FF5A50;      /* contorno de foco sobre la barra oscura */
  --brass: #9A7128;
  --good: #2F7A4B;
  --good-ink: #FFFFFF;        /* texto sobre --good (botón Aprobar) */
  --good-soft: #E3F1E8;
  --warn: #866300;            /* ocre: distinto del error y del rojo de marca */
  --warn-soft: #FBEFD9;
  --bad: #B33A0A;             /* bermellón: el error no se confunde con el rojo de marca */
  --bad-soft: #FBE6DC;
  --info: #2B5C8A;
  --info-soft: #E3EDF7;
  --side: #121111;
  --side-ink: #ECE6E1;
  --side-muted: #9C948D;
  --side-hover: #242020;
  --side-line: #3A3331;
  /* Espaciado */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  /* Texto: 2xs etiquetas en mayúscula y badges · xs secundario · sm tablas y botones · md cuerpo · lg/xl títulos chicos */
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 19px;
  --fs-d1: 22px; --fs-d2: 28px; --fs-d3: 34px; --fs-kpi: 31px;
  /* Radios y sombras */
  --r-sm: 6px; --r: 8px; --r-lg: 10px; --r-pill: 99px;
  --shadow: 0 1px 2px rgba(30, 20, 18, .06), 0 4px 16px rgba(30, 20, 18, .05);
  --shadow-pop: 0 6px 24px rgba(0, 0, 0, .25);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, .3);
  --scrim: rgba(20, 14, 12, .5);
  /* Tipografía */
  --f-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "Public Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141211; --surface: #1D1A19; --surface2: #24201F; --ink: #EEE9E4; --muted: #A39B94; --line: #36312F;
    --accent: #F0504F; --accent-ink: #1A0E10; --accent-soft: #3A1C1C; --brass: #CFA45A;
    --good: #5FBF84; --good-ink: #0F1F15; --good-soft: #1C3325; --warn: #DDB345; --warn-soft: #362D14; --bad: #F2865C; --bad-soft: #3A2118;
    --info: #74A8DA; --info-soft: #1C2A38; --side: #0E0C0B; --side-ink: #ECE6E1; --side-muted: #8E8680; --side-hover: #221E1D;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--fs-md)/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: .01em; margin: 0; text-wrap: balance; }
a { color: var(--accent); }
.num, td.n, .kpi .v { font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-brand { background: var(--side); color: var(--side-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-6); }
.login-brand .mark { font-family: var(--f-display); font-size: var(--fs-md); letter-spacing: .22em; text-transform: uppercase; color: var(--side-muted); }
.login-brand h1 { font-size: clamp(40px, 6vw, 72px); line-height: .95; text-transform: uppercase; }
.login-brand h1 em { font-style: normal; color: var(--accent-bright); }
.login-brand p { color: var(--side-muted); max-width: 46ch; }
.login-brand .cuts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.login-brand .cuts span { border: 1px solid var(--side-line); border-radius: var(--r-pill); padding: 3px 10px; font-size: var(--fs-xs); color: var(--side-muted); }
.login-form { padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 20px; max-width: 480px; width: 100%; margin: 0 auto; }
.login-form h2 { font-size: var(--fs-d2); }
.login-logo { width: min(260px, 70%); height: auto; display: block; }
.demo-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-2); }
.demo-users button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: var(--sp-2) 10px; cursor: pointer; }
.demo-users button:hover { border-color: var(--accent); }
.demo-users b { display: block; font-size: var(--fs-sm); }
.demo-users small { color: var(--muted); font-size: var(--fs-xs); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side); color: var(--side-ink); padding: 20px var(--sp-3); display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 0 var(--sp-2); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.side .brand img { width: 100%; max-width: 180px; height: auto; display: block; }
.side .brand b { font-family: var(--f-display); font-size: var(--fs-d1); letter-spacing: .06em; text-transform: uppercase; display: block; line-height: 1; }
.side .brand small { text-align: center; color: var(--side-muted); font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav .sep { color: var(--side-muted); font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase; padding: 14px 10px var(--sp-1); }
.side nav button { all: unset; cursor: pointer; padding: 7px 10px; border-radius: var(--r-sm); color: var(--side-ink); display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); }
.side nav button:hover { background: var(--side-hover); }
.side nav button.on { background: var(--accent-strong); color: #fff; box-shadow: inset 3px 0 0 var(--focus-side); }
.side .badge { background: var(--accent-bright); color: #fff; border-radius: var(--r-pill); font-size: var(--fs-2xs); padding: 0 7px; line-height: 18px; }
/* Menú agrupado (grupos plegables) */
.side nav .grp { display: flex; flex-direction: column; gap: 2px; margin-top: var(--sp-2); }
.side nav .grp-t { color: var(--side-muted); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: var(--sp-2) 10px; justify-content: flex-start; }
.side nav .grp-t > span:first-child { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side nav .grp-t > i { flex: none; width: 6px; height: 6px; margin: 0 3px 0 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.side nav .grp.abierto .grp-t > i { transform: rotate(45deg); margin-bottom: var(--sp-1); }
.side nav .grp-t:hover { color: var(--side-ink); }
.side nav .grp-t[aria-disabled="true"] { cursor: default; color: var(--side-ink); }
.side nav .grp-t[aria-disabled="true"]:hover { background: none; }
.side nav .grp-t[aria-disabled="true"] > i { visibility: hidden; }
.side nav .grp-xs { display: flex; flex-direction: column; gap: 2px; padding-left: var(--sp-2); margin-left: 10px; border-left: 1px solid var(--side-line); }
.side .me { margin-top: auto; border-top: 1px solid var(--side-line); padding: 14px var(--sp-2) 0; display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-sm); }
.side .me small { color: var(--side-muted); }
.side .me button { all: unset; cursor: pointer; color: var(--side-muted); font-size: var(--fs-xs); text-decoration: underline; border-radius: var(--r-sm); }
.main { min-width: 0; padding: var(--sp-5) 28px 64px; display: flex; flex-direction: column; gap: 20px; }
.demo-banner { background: var(--warn-soft); color: var(--warn); border-radius: var(--r); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); }

.ph { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; }
.ph h1 { font-size: var(--fs-d3); line-height: 1.05; letter-spacing: .005em; }
.ph .sub { color: var(--muted); font-size: var(--fs-sm); }
.ph .acts { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------- Bloques ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4) 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h3 { font-size: var(--fs-xl); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card > h3 small { font-family: var(--f-body); font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.grid { display: grid; gap: var(--sp-4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-xs); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 13px 15px var(--sp-3); display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.kpi.good::before { background: var(--good); } .kpi.warn::before { background: var(--warn); } .kpi.bad::before { background: var(--bad); }
.kpi .l { font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-family: var(--f-display); font-size: var(--fs-kpi); font-weight: 600; line-height: 1.1; }
.kpi .d { font-size: var(--fs-xs); color: var(--muted); }

.bar { height: 10px; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r-pill); position: relative; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: var(--r-pill); }
.bar i.good { background: var(--good); } .bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); }
.bar .mk { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }
.mini-bar { width: 90px; display: inline-block; vertical-align: middle; height: 7px; }

.pill { display: inline-flex; align-items: center; gap: var(--sp-1); border-radius: var(--r-pill); padding: 1px 9px; font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.t-good { color: var(--good); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); }

/* ---------- Tablas ---------- */
.tw { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th { text-align: left; font-weight: 600; font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: var(--sp-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
td { padding: var(--sp-2); border-bottom: 1px solid var(--line); vertical-align: middle; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface2); }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: var(--fs-xs); }
td.celda-grupo, tbody tr:hover td.celda-grupo { background: var(--surface2); font-weight: 600; }   /* fila que agrupa (familia, sucursal) */
.u-in { display: block; width: 100%; min-width: 190px; border-color: transparent; background: transparent; padding: 2px 6px; }
.u-in:hover:not(:disabled), .u-in:focus { border-color: var(--line); background: var(--surface); }
.u-in.sub { font-size: var(--fs-xs); margin-top: 2px; }
.u-in:disabled { opacity: 1; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Formularios ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px var(--sp-3); cursor: pointer; font-weight: 500; font-size: var(--fs-sm); white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.btn.pri:hover { filter: brightness(1.08); }
.btn.ok { background: var(--good); border-color: var(--good); color: var(--good-ink); }
.btn.no { color: var(--bad); }
.btn.sm { padding: 2px 9px; font-size: var(--fs-xs); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px 9px; min-width: 0; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3) 14px; }
.form label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.form .full { grid-column: 1 / -1; }
.form label input, .form label select, .form label textarea { color: var(--ink); font-size: var(--fs-md); }
.form .hint { font-weight: 400; font-size: var(--fs-xs); }
.form .err { color: var(--bad); font-weight: 400; font-size: var(--fs-xs); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-3) 14px 14px; margin: 0; }
legend { font-family: var(--f-display); font-size: var(--fs-lg); font-weight: 600; padding: 0 6px; }
.in-sm { width: 90px; padding: 3px 6px; text-align: right; }
.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-pill); padding: var(--sp-1) var(--sp-3); cursor: pointer; font-size: var(--fs-sm); }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
select.falta { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.dropzone { display: flex; flex-direction: column; gap: var(--sp-2); align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: var(--r); padding: var(--sp-5) var(--sp-4); text-align: center; cursor: pointer; background: var(--surface2); }

/* ---------- Foco del teclado: visible en todo lo que se puede usar ---------- */
.btn:focus-visible, .chip:focus-visible, .x:focus-visible, .demo-users button:focus-visible, .pass-ojo:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.side nav button:focus-visible, .side .me button:focus-visible, .menu-btn:focus-visible { outline: 2px solid var(--focus-side); outline-offset: 1px; }

/* ---------- Gráficos ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: var(--fs-2xs); font-family: var(--f-body); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }

/* ---------- Ficha / modal ---------- */
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding: var(--sp-6) var(--sp-4); overflow-y: auto; z-index: 50; }
.modal { background: var(--bg); border-radius: var(--r-lg); width: min(980px, 100%); padding: 20px 22px var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); box-shadow: var(--shadow-modal); }
.modal.narrow { width: min(560px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.modal-h h2 { font-size: var(--fs-d2); line-height: 1.05; }
.x { all: unset; cursor: pointer; font-size: var(--fs-d1); line-height: 1; padding: 2px var(--sp-2); border-radius: var(--r-sm); color: var(--muted); }
.x:hover { background: var(--surface2); }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-1) 14px; margin: 0; font-size: var(--fs-sm); }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.tl { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
.tl div { border-left: 2px solid var(--line); padding-left: 10px; font-size: var(--fs-sm); }
.tl div b { font-weight: 600; }
.tl div small { color: var(--muted); display: block; }
.msg { background: var(--surface2); border: 1px dashed var(--line); border-radius: var(--r); padding: var(--sp-3); white-space: pre-wrap; font-size: var(--fs-sm); max-height: 300px; overflow-y: auto; }
.msg.normal { white-space: normal; }
.alert-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.alert-list > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: var(--sp-2) 10px; border-radius: var(--r-sm); background: var(--surface2); font-size: var(--fs-sm); flex-wrap: wrap; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px var(--sp-4); border-radius: var(--r); font-size: var(--fs-md); z-index: 80; box-shadow: var(--shadow-pop); max-width: calc(100% - 32px); }

/* ---------- Ayudas (viñeta al pasar el mouse) ---------- */
.i-tip { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 5px; border-radius: 50%; border: 1px solid currentColor; font: 600 10px/1 var(--f-body); font-style: italic; text-transform: none; letter-spacing: 0; color: var(--muted); opacity: .7; cursor: help; vertical-align: 1px; flex: none; }
.i-tip:hover, .i-tip:focus-visible { opacity: 1; color: var(--accent); outline: none; }
.card > h3 .i-tip { margin-right: auto; }
.tip-box { position: fixed; z-index: 1000; max-width: 300px; background: var(--ink); color: var(--surface); font: var(--fs-xs)/1.45 var(--f-body); padding: var(--sp-2) 11px; border-radius: var(--r-sm); box-shadow: var(--shadow-pop); pointer-events: none; display: none; }

/* ---------- Mensajes ---------- */
.msg-card.nuevo { border-left: 4px solid var(--accent); }
.msg-para { display: flex; flex-direction: column; gap: var(--sp-1); max-height: 210px; overflow: auto; padding: var(--sp-2) 10px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: var(--sp-1); }
.msg-para label { display: flex; gap: var(--sp-2); align-items: center; flex-direction: row; font-weight: 400; }
.steps { margin: var(--sp-1) 0 var(--sp-3); padding-left: 20px; line-height: 1.7; }

/* ---------- Invitación a instalar la app ---------- */
.inst { text-align: center; padding: 6px var(--sp-1) 2px; }
.inst-ico { border-radius: 16px; margin: 0 auto 10px; display: block; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.inst h2 { margin: 0 0 6px; }
.inst .steps { text-align: left; }
.inst-btn { width: 100%; justify-content: center; padding: var(--sp-3); font-size: var(--fs-lg); margin: 6px 0 var(--sp-1); }
.inst-pie { justify-content: center; margin-top: 10px; }
.push-card.inactivo, .push-card.ios_instalar { border-left: 4px solid var(--accent); }
.push-card.activo { border-left: 4px solid var(--good); }
.push-card.bloqueado, .push-card.no_soporta { border-left: 4px solid var(--warn); }

/* ---------- Ver contraseña ---------- */
.pass-wrap { position: relative; display: block; }
.pass-wrap input { width: 100%; padding-right: 42px; }
.pass-ojo { position: absolute; right: var(--sp-1); top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--r-sm); }
.pass-ojo:hover, .pass-ojo.on { color: var(--accent); }

/* ---------- Responsive ---------- */
.menu-btn { display: none; }
@media (max-width: 1100px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-side { grid-template-columns: minmax(0, 1fr); } }
/* Celular (también la app instalada): barra superior con logo y botón ☰; el menú se abre hacia abajo. */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 40; height: auto; padding: calc(var(--sp-2) + env(safe-area-inset-top)) var(--sp-4) var(--sp-2); gap: var(--sp-2); }
  .side .brand { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--sp-3); text-align: left; padding: 0; margin: 0; }
  .side .brand img { width: 92px; max-width: 92px; height: auto; }
  .side .brand small { display: none; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 44px; height: 44px; border-radius: var(--r-lg); border: 1px solid rgba(255,255,255,.18); background: transparent; color: #fff; font-size: var(--fs-d1); line-height: 1; cursor: pointer; }
  .menu-btn .badge { position: absolute; top: -4px; right: -4px; }
  .side nav, .side .me { display: none; }
  .side.abierta nav { display: flex; flex-direction: column; max-height: calc(100vh - 160px); overflow-y: auto; }
  .side.abierta nav button { padding: 11px var(--sp-3); font-size: var(--fs-lg); }
  .side.abierta nav .grp-t { font-size: var(--fs-xs); padding: var(--sp-3); }
  .side.abierta .me { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; padding-top: var(--sp-2); margin-top: 0; }
  .main { padding: var(--sp-4) var(--sp-4) calc(48px + env(safe-area-inset-bottom)); }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-brand, .login-form { padding: 28px var(--sp-4); }
  .ph h1 { font-size: var(--fs-d2); }
  .msg-form { order: -1; }
  input, select, textarea { font-size: var(--fs-lg); }   /* evita el zoom automático del iPhone */
}
/* Pantallas táctiles: botones y casillas que se puedan tocar con el dedo. */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; padding: 6px var(--sp-3); }
  .chip { min-height: 36px; }
  .x { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .side .me button { padding: 10px 0; }
  input[type=checkbox] { width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Utilidades ----------
   Reemplazan a los style="…" de los JS. Llevan !important para pesar lo mismo que un estilo en línea. */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--sp-1) !important; } .mt-2 { margin-top: var(--sp-2) !important; } .mt-3 { margin-top: var(--sp-3) !important; } .mt-4 { margin-top: var(--sp-4) !important; }
.mb-1 { margin-bottom: var(--sp-1) !important; } .mb-2 { margin-bottom: var(--sp-2) !important; } .mb-3 { margin-bottom: var(--sp-3) !important; }
.ml-auto { margin-left: auto !important; }
.gap-3 { gap: var(--sp-3) !important; } .gap-4 { gap: var(--sp-4) !important; } .gap-5 { gap: var(--sp-5) !important; }
.linea { display: flex !important; align-items: center !important; gap: var(--sp-2) !important; }   /* casilla o ícono + texto */
label.check { display: flex !important; align-items: center !important; gap: var(--sp-2) !important; cursor: pointer; }
label.en-linea { flex-direction: row !important; align-items: center !important; gap: var(--sp-2) !important; }   /* casilla dentro de un .form */
.flex-1 { flex: 1 !important; }
.crece { flex: 1 !important; min-width: 200px !important; }   /* buscador o campo que ocupa el resto de la fila */
.crece.sm { min-width: 150px !important; }
.entre { justify-content: space-between !important; } .al-fin { justify-content: flex-end !important; }
.al-inicio { align-items: flex-start !important; } .al-centro { align-items: center !important; }
.una-col { grid-template-columns: minmax(0, 1fr) !important; } .dos-col { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.nowrap { white-space: nowrap !important; } .pre-line { white-space: pre-line !important; }
.centro { text-align: center !important; } .der { text-align: right !important; }
.w-sm { width: 80px !important; } .w-md { width: 110px !important; } .w-lg { width: 130px !important; }
.recuadro { padding: var(--sp-3) !important; background: var(--surface2) !important; border-radius: var(--r-sm) !important; }
.tono-warn { background: var(--warn-soft) !important; color: var(--warn) !important; }
.tono-info { background: var(--info-soft) !important; color: var(--info) !important; }
.tono-bad { background: var(--bad-soft) !important; color: var(--bad) !important; }
.borde-acento { border-left: 4px solid var(--accent) !important; }
.archivo-oculto { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

/* ---------- Producción ---------- */
.form [hidden], .rec-linea [hidden] { display: none !important; }
label.check > input[type=checkbox] { flex: none; }
.firma { display: block; width: 100%; height: 170px; background: #fff; border: 1px dashed var(--line); border-radius: var(--r); touch-action: none; cursor: crosshair; }
.firma-ver { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.rec-linea { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-3); align-items: end; padding: var(--sp-3); background: var(--surface2); border-radius: var(--r-sm); }
.rec-linea label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.rec-linea label input:not([type=checkbox]), .rec-linea label select { color: var(--ink); font-size: var(--fs-md); width: 100%; }
.rec-linea label.check { color: var(--ink); font-size: var(--fs-sm); }
.rec-linea .rec-full, .rec-linea .rec-quitar { grid-column: 1 / -1; }
.rec-linea .rec-quitar { justify-self: start; }
.rec-ev { font-weight: 600; }
@media (max-width: 860px) {
  .rec-linea { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-linea .rec-prod { grid-column: 1 / -1; }
}

/* ---------- Rutas diarias: una tarjeta por cliente de la ruta ---------- */
.paradas { display: flex; flex-direction: column; gap: var(--sp-2); }
.parada { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--sp-1) var(--sp-3); align-items: start; padding: var(--sp-3); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r); background: var(--surface); }
.parada.hecho { border-left-color: var(--good); } .parada.no { border-left-color: var(--warn); } .parada.sin { border-left-color: var(--bad); }
.parada-n { font-family: var(--f-display); font-size: var(--fs-xl); font-weight: 600; color: var(--muted); line-height: 1.2; }
.parada-res, .parada-acc { grid-column: 2 / -1; }
.parada-acc { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-1); }
.parada-h:empty { display: none; }
.parada-h input { width: 120px; }
@media (max-width: 860px) {
  .parada { grid-template-columns: 22px minmax(0, 1fr); padding: 10px; }
  .parada-h { grid-column: 2; }
}

/* ---------- Pedidos: tarjeta, timeline y nuevo pedido ---------- */
.peds { display: flex; flex-direction: column; gap: var(--sp-3); }
.ped { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ped.pendiente_validacion, .ped.pausado { border-left-color: var(--warn); } .ped.en_produccion, .ped.aceptado, .ped.parcial { border-left-color: var(--info); }
.ped.listo, .ped.facturado, .ped.despachado, .ped.entregado { border-left-color: var(--good); } .ped.rechazado { border-left-color: var(--bad); }
.ped .tw { margin: 0; padding: 0; }
.ped-h { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); flex-wrap: wrap; }
.ped-h .sub, .ped-ent .sub { display: block; color: var(--muted); font-size: var(--fs-xs); }
.ped-ent { text-align: right; font-size: var(--fs-sm); }
.tl { list-style: none; margin: 0; padding: 0; overflow: visible; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tl li { position: relative; padding-top: 18px; display: flex; flex-direction: column; font-size: var(--fs-xs); color: var(--muted); min-width: 0; }
.tl li::before { content: ""; position: absolute; top: 4px; left: 0; right: 0; height: 2px; background: var(--line); }
.tl li::after { content: ""; position: absolute; top: 0; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); box-sizing: border-box; }
.tl li b { font-weight: 600; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: var(--sp-1); }
.tl li small { font-size: var(--fs-2xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl li.ok { color: var(--ink); } .tl li.ok::before, .tl li.ok::after { background: var(--good); border-color: var(--good); }
.tl li.actual { color: var(--info); } .tl li.actual::after { background: var(--info); border-color: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.tl li.pausa { color: var(--warn); } .tl li.pausa::after { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.tl-fin { font-size: var(--fs-sm); }
.pn-ls { display: flex; flex-direction: column; gap: var(--sp-2); }
.pn-l { display: grid; grid-template-columns: minmax(0, 2.2fr) repeat(2, minmax(0, 1fr)) auto minmax(0, 1.2fr); gap: var(--sp-2) var(--sp-3); align-items: end; padding: var(--sp-3); background: var(--surface2); border-radius: var(--r-sm); }
.pn-l .pn-in { grid-column: 1 / 5; } .pn-l .pn-x { justify-self: end; } .pn-l .pn-va { flex-direction: row; padding-bottom: 8px; color: var(--ink); }
@media (max-width: 860px) {
  .pn-l { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pn-l .pn-p, .pn-l .pn-in { grid-column: 1 / -1; }
  .tl li b { font-size: 10px; padding-right: 0; letter-spacing: -.01em; text-overflow: clip; } .tl li small { display: none; }
  .ped-ent { text-align: left; }
}

/* ---------- Tablet de producción: pantalla completa, oscura y táctil ---------- */
body.modo-tablet {
  --bg: #0F0D0C; --surface: #1B1817; --surface2: #262120; --ink: #F3EEE9; --muted: #A9A099; --line: #3A3331;
  --accent: #F0504F; --accent-ink: #1A0E10; --accent-soft: #3A1C1C; --good: #5FBF84; --good-ink: #0F1F15; --good-soft: #1C3325;
  --warn: #E5BC4E; --warn-soft: #3A3016; --bad: #F2865C; --bad-soft: #3A2118; --info: #74A8DA; --info-soft: #1C2A38; --focus: #F3EEE9;
  color-scheme: dark; background: var(--bg); color: var(--ink);
}
body.modo-tablet .app { grid-template-columns: minmax(0, 1fr); }
body.modo-tablet .side, body.modo-tablet .ph { display: none; }
body.modo-tablet .main { padding: var(--sp-4) var(--sp-5) var(--sp-6); gap: var(--sp-4); }
.tab-h { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.tab-h h1 { font-size: var(--fs-d2); line-height: 1.1; }
.tab-reloj { font-family: var(--f-display); font-size: var(--fs-d2); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: var(--sp-2); }
.tts { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--sp-4); }
.tt { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--line); border-radius: var(--r-lg); }
.tt.en_curso { border-top-color: var(--good); } .tt.pausada { border-top-color: var(--warn); }
.tt header { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); }
.tt .tt-tarde { color: var(--bad); font-weight: 600; }
.tt h2 { font-size: var(--fs-d2); line-height: 1.05; }
.tt-kg { font-family: var(--f-display); font-size: var(--fs-d3); font-weight: 600; line-height: 1; }
.tt-corte { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.tt-corte span { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: var(--sp-1) var(--sp-3); font-size: var(--fs-md); }
.tt-crono { display: flex; flex-direction: column; min-height: 58px; justify-content: center; color: var(--muted); }
.tt-reloj { font-family: var(--f-display); font-size: 44px; font-weight: 600; line-height: 1; color: var(--good); font-variant-numeric: tabular-nums; }
.tt-reloj.pausa { color: var(--warn); }
.tt footer { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: auto; }
.tt footer .btn { flex: 1 1 140px; }
.btn.xl { min-height: 60px; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-lg); font-weight: 600; border-radius: var(--r); white-space: normal; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #1B1300; }
.tt-vacio { padding: 80px var(--sp-4); text-align: center; color: var(--muted); font-size: var(--fs-xl); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.tt-hechas { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-md); }
.tt-hechas h3 { font-size: var(--fs-xl); margin-bottom: var(--sp-1); }
.quien { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-3); border: 0; padding: 0; margin: 0; }
.quien legend { grid-column: 1 / -1; margin-bottom: var(--sp-2); }
.quien-op { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); cursor: pointer; }
.quien-op:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.quien-op input { position: absolute; opacity: 0; pointer-events: none; }
.tt-peso { font-family: var(--f-display); font-size: var(--fs-d3) !important; font-weight: 600; padding: var(--sp-2) var(--sp-3); max-width: 240px; }
/* Tablet por pedido: tarjeta de la cola y pedido abierto con equipo y pesos */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tt.tp { cursor: pointer; } .tt.tp:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tp-res { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-lg); }
.tp-barra { height: 8px; background: var(--surface2); border-radius: var(--r-pill); overflow: hidden; }
.tp-barra i { display: block; height: 100%; background: var(--good); }
.tp-prods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-md); }
.tp-prods li { display: flex; justify-content: space-between; gap: var(--sp-2); padding-left: 18px; position: relative; }
.tp-prods li::before { content: ''; position: absolute; left: 2px; top: .5em; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--muted); }
.tp-prods li.en_curso::before { background: var(--good); border-color: var(--good); } .tp-prods li.pausada::before { background: var(--warn); border-color: var(--warn); }
.tp-prods li.terminada { color: var(--muted); text-decoration: line-through; } .tp-prods li.terminada::before { background: var(--muted); }
.tp-prods li span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tp-tit { align-items: center; gap: var(--sp-4); flex-wrap: nowrap; }
.tp-obs { background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--r); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-lg); }
.tp-ls { display: flex; flex-direction: column; gap: var(--sp-4); }
.tt.tp-l { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: var(--sp-5); align-items: start; }
.tt.tp-l.terminada { border-top-color: var(--good); opacity: .8; }
.tp-prod { display: flex; flex-direction: column; gap: var(--sp-2); }
.tp-cuerpo { display: flex; flex-direction: column; gap: var(--sp-3); }
.tp-paso { font-size: var(--fs-lg); font-weight: 600; } .tp-paso .muted { font-weight: 400; font-size: var(--fs-md); margin-left: var(--sp-2); }
.tp-gente { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--sp-2); }
.tp-chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tp-acc { display: flex; flex-wrap: wrap; gap: var(--sp-2); } .tp-acc .btn { flex: 1 1 180px; }
.tp-estado { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; }
.tp-estado .tp-acc { flex: 1 1 320px; }
.tp-partes { display: flex; flex-direction: column; gap: var(--sp-2); }
.tp-parte { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r); }
.tp-parte.hecho { border-color: var(--good); background: var(--good-soft); }
.tp-parte.pausa { border-color: var(--warn); background: var(--warn-soft); }
.tp-parte.hecho.sin { border-color: var(--line); background: var(--surface2); opacity: .75; }
.tp-quien { display: flex; flex-direction: column; min-width: 150px; }
.tp-pz { color: var(--warn); font-weight: 600; font-variant-numeric: tabular-nums; } .tp-tr { color: var(--good); }
.tp-parte.hecho b { font-family: var(--f-display); font-size: var(--fs-d1); }
.tp-nom { font-size: var(--fs-xl); font-weight: 600; }
.tp-peso { width: 100%; min-height: 60px; font-family: var(--f-display); font-size: var(--fs-d2) !important; font-weight: 600; padding: var(--sp-1) var(--sp-3); text-align: right; }
.tp-parte .btn.xl { flex: 0 0 auto; min-width: 130px; }
.tp-parte .tp-quien { flex: 1 1 150px; }
.tp-parte .tp-peso-l { flex: 0 0 130px; }
.tp-quitar { min-height: 60px; }
.tp-tot { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; font-size: var(--fs-lg); }
.tp-listo b { font-size: var(--fs-xl); color: var(--good); }
@media (max-width: 900px) { .tt.tp-l { grid-template-columns: minmax(0, 1fr); } .tp-tit { flex-wrap: wrap; } }

/* ---------- Vendedor en el celular (vendedor.js) ---------- */
.acc-rapidas { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.acc-rapidas a.btn { text-decoration: none; color: var(--ink); }
@media (max-width: 860px) {
  .acc-rapidas .btn { flex: 1 1 auto; justify-content: center; }
  .modal .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }   /* ficha: indicadores de a dos */
  /* Mis clientes: cada cliente como tarjeta con lo que se usa en terreno; venta, promedio y crédito quedan en la ficha. */
  .lista-cli .tw { margin: 0; padding: 0; overflow: visible; }
  .lista-cli table, .lista-cli tbody { display: block; }
  .lista-cli thead { display: none; }
  .lista-cli tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-1) var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
  .lista-cli td { display: block; padding: 0; border: 0; max-width: none !important; }
  .lista-cli td:nth-child(n+5):not(:last-child) { display: none; }
  .lista-cli td:nth-child(2) { text-align: right; }
  .lista-cli td:nth-child(4), .lista-cli td:last-child { grid-column: 1 / -1; }
  .lista-cli td:last-child { display: flex; gap: var(--sp-2); }
  .lista-cli td:last-child .btn { flex: 1; justify-content: center; }
  .lista-cli td.empty { grid-column: 1 / -1; }
  /* Mi ruta del día: los indicadores en una franja corta para que la ruta quede a la vista. */
  .kpis-ruta { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
  .kpis-ruta .kpi { padding: var(--sp-2) 10px; }
  .kpis-ruta .kpi .v { font-size: var(--fs-d1); }
  .kpis-ruta .kpi .d { display: none; }
}

/* ---------- Bodega: entrada y merma con varias filas (compras.js) ---------- */
.bo-ls { display: flex; flex-direction: column; gap: var(--sp-2); }
.bo-l { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: var(--sp-2); }
.bo-cab { font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--sp-1); }
@media (max-width: 860px) { .bo-l { grid-template-columns: minmax(0, 1fr) 88px; } }

/* ---------- Turnos del personal (turnos.js) ---------- */
th.tu-area { background: var(--surface2); color: var(--ink); padding-top: var(--sp-3); }
.tu-hoy { background: var(--surface2); font-weight: 600; }

/* Compras: comprar en partes, listas de proveedores (compras_plan.js) */
.pc-it { border: 1px solid var(--line, #ddd); border-radius: var(--r-sm); padding: var(--sp-3); margin: 0; min-width: 0; }
.pc-it legend { padding: 0 var(--sp-2); }
.pc-ls { display: grid; gap: var(--sp-2); }
.pc-l { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, .9fr)) minmax(0, 1.2fr) minmax(0, 1.2fr) auto; gap: var(--sp-2); align-items: end; padding: var(--sp-2) var(--sp-3); background: var(--surface2); border-radius: var(--r-sm); }
.pc-l .btn { justify-self: end; }
@media (max-width: 860px) { .pc-l { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pc-l label:first-child { grid-column: 1 / -1; } }
.pre-lista { white-space: pre-wrap; font-size: 13px; background: var(--surface2); padding: var(--sp-3); border-radius: var(--r-sm); max-height: 60vh; overflow: auto; }
.chip .badge { background: var(--accent-bright); color: #fff; border-radius: var(--r-pill); font-size: var(--fs-2xs); padding: 0 6px; line-height: 16px; margin-left: 4px; }
.fila-warn td { background: var(--warn-soft); }

/* Salidas del día: avisos de estado */
.msg.warn { border-color: var(--warn); background: var(--warn-soft); white-space: normal; }
.msg.bad { border-color: var(--bad); background: var(--bad-soft); white-space: normal; }

/* Despacho propio: mapa y paradas del chofer */
.rep-mapa { height: 60vh; min-height: 320px; border-radius: var(--r); border: 1px solid var(--line); margin-bottom: var(--sp-3); }
.rep-sel { height: 42vh; min-height: 260px; margin-top: var(--sp-2); cursor: crosshair; }
.form .rep-sel, .form .rep-sel-acc { grid-column: 1 / -1; }
.rep-pin { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent, #A62B23); color: #fff; font-weight: 700; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.rep-pin.good { background: var(--good); } .rep-pin.warn { background: var(--warn); } .rep-pin.bad { background: var(--bad); }
.rep-pin.dep, .rep-pin.camion { background: #fff; font-size: 18px; }
.rep-vivo { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-2); }
.rep-vivo-r { display: inline-flex; align-items: center; gap: 6px; }
.rep-vivo-r i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.pill.vivo { font-size: 12px; vertical-align: middle; animation: rep-latido 2s ease-in-out infinite; }
@keyframes rep-latido { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .pill.vivo { animation: none; } }
.btn.ancho { width: 100%; }
.rep-paradas { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-3); }
.rep-parada { border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-3); background: var(--surface); }
.rep-parada.hecha { opacity: .75; } .rep-parada.hecha.good { border-left: 4px solid var(--good); } .rep-parada.hecha.warn { border-left: 4px solid var(--warn); } .rep-parada.hecha.bad { border-left: 4px solid var(--bad); }
.rep-parada header { display: flex; gap: var(--sp-3); align-items: flex-start; }
.rep-parada header > div { flex: 1; display: flex; flex-direction: column; }
.rep-n { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--accent, #A62B23); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.rep-acc { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rep-acc .btn { min-height: 48px; flex: 1 1 auto; }
.rep-res { display: flex; flex-wrap: wrap; gap: var(--sp-3); border: 0; padding: 0; }
.rep-res label { flex-direction: row; align-items: center; gap: var(--sp-1); font-weight: 600; }

/* ---------- Mapa de clientes (mapa_clientes.js) ---------- */
.mc-mapa { height: 62vh; min-height: 340px; border-radius: var(--r); border: 1px solid var(--line); margin: var(--sp-2) 0; }
.mc-sucs.dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: var(--sp-3); align-items: start; }
.mc-sucs .mc-mapa { height: 52vh; }
.mc-barra { justify-content: space-between; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.mc-der { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-left: auto; }
.mc-ley { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.mc-ley span { display: inline-flex; align-items: center; gap: 6px; }
.mc-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); margin-right: 3px; vertical-align: -1px; }
.mc-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.mc-chk select { width: auto; }
.mc-pop-acc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mc-falta summary { cursor: pointer; }
.leaflet-popup-content { font-size: 13px; line-height: 1.4; }
.leaflet-popup-content a.btn { color: inherit; text-decoration: none; }

/* Crédito de desarrollo: una línea pequeña y tenue al final de cada pantalla y del ingreso */
.vt-cred { margin: auto 0 0; padding-top: var(--sp-4); text-align: center; font-size: 11px; color: var(--muted); opacity: .7; }
.vt-cred a { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; margin-left: 3px; }
.vt-cred a:hover { opacity: 1; text-decoration: underline; }
.vt-cred b { font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.login-brand .vt-cred { margin: 0; padding: 0; text-align: left; color: var(--side-muted); max-width: none; }
@media print { .vt-cred { display: none; } }

/* Análisis · Reporte de gestión: matriz ancha con la primera columna fija */
.an-mx { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md, 8px); }
.an-mx table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: var(--fs-sm); }
.an-mx th, .an-mx td { padding: 6px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.an-mx td.n, .an-mx th.n { text-align: right; font-variant-numeric: tabular-nums; }
.an-mx thead th { background: var(--surface2); font-weight: 600; text-align: center; }
.an-mx .g { border-left: 2px solid var(--line); }
.an-mx th[scope=row], .an-mx thead th[rowspan] { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--surface); }
.an-mx thead th[rowspan] { background: var(--surface2); z-index: 2; }
.an-mx tr.det th[scope=row] { font-weight: 400; padding-left: 22px; }
.an-mx tr.suc th, .an-mx tr.suc td { background: var(--surface2); }
.an-mx tr.tot th, .an-mx tr.tot td { background: var(--surface2); border-top: 2px solid var(--ink); border-bottom: 0; }
.an-mx thead th.g[colspan] { text-align: left; }
