/* ============================================================
   Clínica dental · hoja de estilos única (v6) · marca: marino Fligo hasta recibir su logo
   Lenguaje visual Fligo (el de Mi Energía / Berny / Comunidad Mérida).
   Lo ÚNICO que cambia por cliente son las 4 variables de "Marca".
   Todas las pantallas usan SOLO estas piezas. Nada suelto en una pantalla.
   Al publicar, subir la versión en el <link>: estilos.css?v=N
   ============================================================ */

:root {
  /* Marca: el color del cliente (su logo). Si todavía no lo manda, el marino de Fligo #1F3A5F. */
  --marca: #1F3A5F;
  --marca-h: #162B47;          /* hover: un paso más oscuro */
  --marca-suave: #E8EDF4;      /* fondo de lo seleccionado */
  --marca-tinta: #FFFFFF;      /* texto sobre la marca */

  /* Superficies (grises cálidos de Fligo) */
  --fondo: #F6F6F3;
  --sup: #FFFFFF;
  --sup2: #F1F0EC;
  --sup3: #E7E5DF;
  --borde: #DDDBD4;
  --borde2: #EAE8E2;

  /* Texto */
  --texto: #1F2732;
  --texto2: #4A5260;
  --texto3: #878C95;

  /* Semáforo: igual en todos los proyectos */
  --ok: #1E8A5C;     --ok-t: #166A46;     --ok-bg: #E4F3EB;     --ok-borde: #BFE3CF;
  --warn: #B27C1B;   --warn-t: #8A5F10;   --warn-bg: #FBF1DA;   --warn-borde: #EBD9A6;
  --bad: #C0442E;    --bad-t: #A33823;    --bad-bg: #FAE8E3;    --bad-borde: #F2C9C2;
  --info: #1F6FA3;   --info-t: #1D5E8A;   --info-bg: #E5F1F9;   --info-borde: #BFD9EC;
  --neutro: #6C7A80; --neutro-t: #54646B; --neutro-bg: #EFEFEC;
  --whats: #1E8A5C;

  /* Serie de gastos ("De cada $100"): tonos de la marca, del gasto más grande al más chico; lo que queda va en --ok */
  --serie-1: #1F3A5F; --serie-2: #4F6C91; --serie-3: #7D96B5; --serie-4: #A9BBD0; --serie-5: #CBD6E2;

  /* Forma */
  --r: 14px;
  --r2: 10px;
  --sombra: 0 1px 2px rgba(17,17,17,.05), 0 6px 20px rgba(17,17,17,.06);
  --sombra-alta: 0 4px 10px rgba(17,17,17,.08), 0 18px 44px rgba(17,17,17,.14);

  /* Medidas fijas (guía Fligo): título 56 · KPI 96 · fila 48 · encabezado 38 · botón y campo 38 · chip 34 */
  --alto-fila: 48px;
  --alto-enc: 38px;
  --alto-kpi: 96px;
  --alto-kpi-cel: 64px;   /* indicador en celular (≤700) */
  --alto-renglon: 72px;   /* renglón de lista en celular y tablet: dos líneas */
  --alto-chip: 34px;
  --alto-boton: 38px;
  --alto-campo: 38px;
  --alto-titulo: 56px;
  --alto-barra-sup: 56px;
  --alto-barra-inf: 66px;
  --ancho-max: 1360px;
  --ancho-lectura: 560px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  font-family: -apple-system, "Segoe UI", "Avenir Next", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14.5px; line-height: 1.55;
  color: var(--texto); background: var(--fondo);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--marca); text-decoration: none; }
b, strong { font-weight: 700; }
img { display: block; max-width: 100%; }

/* ============================================================
   NAVEGACIÓN · dos niveles
   Nivel 1: barra arriba en el color de la marca, pastilla blanca en la sección activa.
   Nivel 2: submenú de la sección como línea subrayada, debajo del título.
   Celular: la barra de arriba solo dice el nombre; las secciones van abajo (4 + Más).
   ============================================================ */
.barra-sup {
  position: sticky; top: 0; z-index: 40;
  height: var(--alto-barra-sup); background: var(--marca); color: var(--marca-tinta);
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 14px rgba(17,17,17,.18);
}
.barra-sup-in {
  height: 100%; max-width: var(--ancho-max); margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; gap: 22px;
}
.barra-sup .marca { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.2px; white-space: nowrap; }
.barra-sup .marca small { font-weight: 500; color: rgba(255,255,255,.6); font-size: 12px; }
.barra-sup .marca .sello { width: 26px; height: 26px; border-radius: 8px; background: #fff; color: var(--marca); display: grid; place-items: center; font-size: 13px; font-weight: 800; letter-spacing: -.5px; }
.barra-sup .marca img { height: 26px; width: auto; }
.menu { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a, .menu button {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: none; color: rgba(255,255,255,.78); font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .12s, color .12s;
}
.menu a:hover, .menu button:hover { background: rgba(255,255,255,.12); color: #fff; }
.menu .activo, .menu .activo:hover { background: #fff; color: var(--marca); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.menu .n { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.18); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.menu .activo .n { background: var(--marca-suave); color: var(--marca); }
.barra-sup .usuario { margin-left: auto; display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.barra-sup .usuario small { display: block; font-weight: 400; color: rgba(255,255,255,.6); line-height: 1.2; }
.barra-sup .usuario .ava { background: #fff; color: var(--marca); }
/* El usuario abre su menú (cambiar de usuario, restablecer): botón sin marco, a la derecha */
.barra-sup .mas { margin-left: auto; }
.barra-sup button.usuario { border: 0; background: none; color: inherit; padding: 0; cursor: pointer; }
.barra-sup .mas-lista { color: var(--texto); }

/* Submenú de sección: línea subrayada */
.submenu { display: flex; gap: 22px; border-bottom: 1px solid var(--borde2); margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.submenu::-webkit-scrollbar { display: none; }
.submenu a { padding: 9px 2px 10px; font-weight: 600; font-size: 13.5px; color: var(--texto2); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.submenu a:hover { color: var(--marca); }
.submenu a.activo { color: var(--marca); border-color: var(--marca); }

/* Píldoras: solo filtros dentro de una pantalla (Hoy · Próximos · Pasados) */
.vista-tabs { display: inline-flex; max-width: 100%; overflow-x: auto; background: var(--sup2); border-radius: 999px; padding: 3px; gap: 2px; scrollbar-width: none; height: var(--alto-chip); }
.vista-tabs::-webkit-scrollbar { display: none; }
.vista-tabs button { border: none; background: none; font-size: 12.5px; font-weight: 600; color: var(--texto2); padding: 0 16px; border-radius: 999px; white-space: nowrap; transition: background .12s, color .12s; }
.vista-tabs button.activo { background: var(--sup); color: var(--texto); box-shadow: var(--sombra); }

/* ============================================================
   ARMAZÓN
   ============================================================ */
.contenido { max-width: var(--ancho-max); margin: 0 auto; padding: 22px 28px 40px; min-width: 0; }
.contenido.lectura { max-width: var(--ancho-lectura); }
.contenido.ancha { max-width: 960px; }

/* Título de pantalla: alto fijo para que las pantallas hermanas no brinquen */
.titulo { height: var(--alto-titulo); display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: 0 0 10px; }
.titulo h1 { font-size: 23px; font-weight: 700; letter-spacing: -.4px; color: var(--marca); margin: 0; line-height: 1.2; white-space: nowrap; }
.titulo .pista { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titulo .acciones { margin-left: auto; }
.pista { color: var(--texto3); font-size: 13px; }
.volver { display: inline-flex; align-items: center; gap: 6px; color: var(--texto2); font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.volver:hover { color: var(--marca); }
.seccion-t { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; }
.seccion-t h3 { font-size: 15px; font-weight: 700; color: var(--texto); margin: 0; }
.seccion-t .pista { font-size: 12.5px; }
.seccion-t .der { margin-left: auto; }

/* Panel (tarjeta) */
.panel { background: var(--sup); border: 1px solid var(--borde2); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--sombra); }
.panel.chico { padding: 14px 16px; }
.panel + .panel { margin-top: 12px; }

/* Avatar con iniciales */
.ava { width: 40px; height: 40px; border-radius: 50%; background: var(--marca-suave); color: var(--marca); font-weight: 700; font-size: 13px; display: grid; place-items: center; flex: none; letter-spacing: -.2px; }
.ava.g { width: 56px; height: 56px; font-size: 18px; }
.ava.xg { width: 88px; height: 88px; font-size: 28px; }
.ava.ch { width: 32px; height: 32px; font-size: 11.5px; }
.ava img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ============================================================
   BOTONES · una acción principal por pantalla, el resto en ⋯
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--alto-boton); padding: 0 16px;
  border: 1px solid var(--borde); border-radius: var(--r2);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  background: var(--sup); color: var(--texto); box-shadow: 0 1px 2px rgba(17,17,17,.05);
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--texto3); }
.btn.sol { background: var(--marca); border-color: var(--marca); color: var(--marca-tinta); }
.btn.sol:hover { background: var(--marca-h); border-color: var(--marca-h); }
.btn.linea { background: none; border-color: var(--borde); color: var(--texto2); box-shadow: none; }
.btn.linea:hover { color: var(--marca); border-color: var(--marca); }
.btn.peligro { color: var(--bad-t); border-color: var(--bad-borde); background: var(--sup); }
.btn.whats { color: var(--ok-t); border-color: var(--ok-borde); background: var(--ok-bg); }
.btn.whats:hover { border-color: var(--ok); }
.btn.chico { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn.grande { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn.ancho { width: 100%; }
.btn.icono { width: var(--alto-boton); padding: 0; font-size: 18px; }
.btn.icono.chico { width: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.acciones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Liga: abre algo que está plegado (ej. "＋ Pagó con dos formas"). No es una acción principal. */
.liga { border: 0; background: none; padding: 0; color: var(--marca); font-weight: 600; font-size: 13px; cursor: pointer; }
.liga:hover { text-decoration: underline; }

/* Menú ⋯ (acciones secundarias) */
.mas { position: relative; display: inline-block; }
.mas-lista {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 220px;
  background: var(--sup); border: 1px solid var(--borde2); border-radius: var(--r2); box-shadow: var(--sombra-alta); padding: 6px;
}
.item-menu { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; font-weight: 600; color: var(--texto); white-space: nowrap; }
.item-menu:hover { background: var(--sup2); }
.item-menu.peligro { color: var(--bad-t); }

/* ============================================================
   ETIQUETAS (estado) · siempre texto, nunca solo color
   Cada proyecto agrega sus estados con las palabras del cliente: .t-abierto, .t-en-ruta, .t-pagada…
   pero SIEMPRE apuntando a uno de estos 5 colores. Nada de colores nuevos por estado.
   ============================================================ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 10px;
  white-space: nowrap; border: 1px solid transparent; line-height: 1.5;
  background: var(--neutro-bg); color: var(--neutro-t);
}
.t-ok       { background: var(--ok-bg);     color: var(--ok-t); }       /* listo, pagado, llegó, activo */
.t-atencion { background: var(--warn-bg);   color: var(--warn-t); }     /* pendiente, por vencer, tal vez */
.t-mal      { background: var(--bad-bg);    color: var(--bad-t); }      /* vencido, cancelado, no llegó */
.t-info     { background: var(--info-bg);   color: var(--info-t); }     /* en proceso, programado, va */
.t-neutro   { background: var(--neutro-bg); color: var(--neutro-t); }   /* cerrado, pasado, no */
.t-marca    { background: var(--marca);     color: var(--marca-tinta); }/* lo propio: miembro, titular */
.t-borde    { background: var(--sup); color: var(--texto2); border-color: var(--borde); } /* categorías del cliente (industria, tipo): sin color */
/* Estados de la clínica (sus palabras), cada uno apunta a un color del semáforo. Nada de colores nuevos. */
.t-pagado, .t-cuadro, .t-meta-lista, .t-sano, .t-activo, .t-rentable, .t-ganado { background: var(--ok-bg);     color: var(--ok-t); }
.t-por-pagar, .t-sin-cerrar, .t-arriba-rango, .t-margen-bajo, .t-por-revisar { background: var(--warn-bg);   color: var(--warn-t); }
.t-vencido, .t-diferencia, .t-muy-alto, .t-en-perdida { background: var(--bad-bg);    color: var(--bad-t); }
.t-programado, .t-juntando, .t-abajo-rango { background: var(--info-bg);   color: var(--info-t); }
.t-usada, .t-apagado, .t-no-ganado                                          { background: var(--neutro-bg); color: var(--neutro-t); }

/* Chips seleccionables (elegir varios) · 34 px */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: var(--alto-chip); padding: 0 14px;
  border: 1px solid var(--borde); border-radius: 999px; background: var(--sup); color: var(--texto2);
  font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 2px rgba(17,17,17,.04); transition: .12s;
}
.chip:hover { border-color: var(--texto3); }
.chip.activo { background: var(--marca); border-color: var(--marca); color: #fff; }
.chip.activo::before { content: "✓"; font-size: 12px; }

/* ============================================================
   INICIO DE ROL · indicadores y "Para hoy" (tablero, no lista)
   ============================================================ */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.kpi {
  height: var(--alto-kpi); background: var(--sup); border: 1px solid var(--borde2); border-radius: var(--r2);
  padding: 11px 14px 10px; box-shadow: var(--sombra); display: flex; flex-direction: column; justify-content: space-between; min-width: 0;
}
.kpi b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.6px; color: var(--marca); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b small { font-size: 14px; color: var(--texto3); font-weight: 600; letter-spacing: 0; }
.kpi .q { font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .p { font-size: 11.5px; color: var(--texto3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.urg b { color: var(--bad-t); }
.kpi.txt b { font-size: 17px; line-height: 1.25; letter-spacing: -.2px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Indicadores que solo salen en monitor grande (≥1601), donde la rejilla es de 6 */
.kpi.solo-monitor { display: none; }
@media (min-width: 1601px) { .kpi.solo-monitor { display: flex; } }
.hoy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hoy {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; text-align: left;
  height: var(--alto-kpi); border: 1px solid var(--borde2); background: var(--sup); border-radius: var(--r);
  padding: 11px 36px 10px 14px; box-shadow: var(--sombra); transition: .12s; width: 100%; min-width: 0;
}
.hoy:hover { border-color: var(--marca); }
.hoy b { font-size: 24px; line-height: 1.05; color: var(--marca); font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.hoy b small { font-size: 14px; color: var(--texto3); font-weight: 600; letter-spacing: 0; }
.hoy .q { font-weight: 700; font-size: 12.5px; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hoy .p { font-size: 11.5px; color: var(--texto3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hoy .fl { position: absolute; right: 14px; top: 12px; color: var(--texto3); font-size: 16px; }
.hoy.urg { border-color: var(--bad-borde); background: linear-gradient(180deg, #FFF5F3, #fff); }
.hoy.urg b { color: var(--bad-t); }
.hoy.cero { opacity: .55; box-shadow: none; }

/* Siguiente paso (tablero) */
.siguiente { display: block; padding: 10px 14px; border-radius: var(--r2); background: var(--marca-suave); color: var(--texto); font-size: 13.5px; margin: 12px 0 0; }
.siguiente b { color: var(--marca); }

/* Avance por área (barra delgada) */
.avance { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 12px; color: var(--texto3); font-weight: 600; white-space: nowrap; }
.avance .pista-barra { flex: 1; height: 4px; border-radius: 2px; background: var(--sup3); overflow: hidden; }
.avance .pista-barra i { display: block; height: 100%; background: var(--marca); border-radius: 2px; }

/* ============================================================
   FILTROS Y BUSCADOR · rejilla fija, nada que agrande el encabezado
   ============================================================ */
.filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.filtro label.f { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texto3); margin: 0 0 5px; white-space: nowrap; }
.filtro select, .filtro input {
  width: 100%; height: var(--alto-campo); padding: 0 12px; background: var(--sup);
  border: 1px solid var(--borde); border-radius: var(--r2); box-shadow: 0 1px 2px rgba(17,17,17,.04);
}
.buscar {
  display: flex; align-items: center; gap: 9px; height: var(--alto-campo); padding: 0 14px;
  background: var(--sup); border: 1px solid var(--borde); border-radius: 999px; box-shadow: var(--sombra);
  color: var(--texto3); width: 100%;
}
.buscar input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--texto); }
.buscar input::placeholder { color: var(--texto3); }
.buscar.grande { height: 48px; padding: 0 18px; font-size: 15px; }
.filtros.dos { grid-template-columns: 1fr; margin-bottom: 10px; align-items: center; }
@media (min-width: 701px) { .filtros.dos { grid-template-columns: 1fr auto; } }

/* ============================================================
   FORMULARIO · campos 38 px · error debajo de su campo
   ============================================================ */
.campo { margin-bottom: 16px; }
.campo:last-child { margin-bottom: 0; }
.campo label.f { display: block; font-size: 13px; font-weight: 700; color: var(--texto); margin: 0 0 6px; }
.campo label.f small { font-weight: 400; color: var(--texto3); margin-left: 6px; }
.campo .ayuda { font-size: 12px; color: var(--texto3); margin: 5px 0 0; }
.campo input, .campo select, .campo textarea {
  width: 100%; height: var(--alto-campo); padding: 0 12px;
  border: 1px solid var(--borde); border-radius: var(--r2); background: var(--sup);
}
.campo textarea { height: auto; min-height: 84px; padding: 9px 12px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--marca); outline-offset: -1px; }
.campo input.error, .campo select.error { border-color: var(--bad); }
.campo .msg-error { font-size: 12px; color: var(--bad-t); margin-top: 5px; font-weight: 600; }
.dos-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.segmentado { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.segmentado button {
  height: var(--alto-boton); border: 1px solid var(--borde); border-radius: var(--r2); background: var(--sup);
  font-weight: 700; color: var(--texto2); box-shadow: 0 1px 2px rgba(17,17,17,.04); font-size: 13.5px;
}
.segmentado button:disabled { opacity: .45; cursor: not-allowed; }
.segmentado button.activo { background: var(--marca); border-color: var(--marca); color: #fff; }

.rejilla-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opcion {
  min-height: 48px; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; gap: 1px;
  background: var(--sup); border: 1px solid var(--borde); border-radius: var(--r2); text-align: left; font-weight: 700; font-size: 13.5px;
  box-shadow: 0 1px 2px rgba(17,17,17,.04);
}
.opcion .pista { font-weight: 400; font-size: 11.5px; }
.opcion.activo { border-color: var(--marca); background: var(--marca-suave); color: var(--marca); }

.casilla { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--texto2); cursor: pointer; }
.casilla input { width: 18px; height: 18px; accent-color: var(--marca); margin: 2px 0 0; flex: none; }
.casilla a { text-decoration: underline; }

/* Interruptor (sí / no) */
.fila-opcion { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--alto-fila); border-bottom: 1px solid var(--borde2); }
.fila-opcion:last-child { border-bottom: 0; }
.fila-opcion .q { font-weight: 600; }
.fila-opcion .p { font-size: 12px; color: var(--texto3); display: block; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--borde); border: 0; flex: none; transition: .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .15s; }
.switch.on { background: var(--ok); }
.switch.on::after { left: 21px; }

/* ============================================================
   DETALLE EN PANTALLA PROPIA (con "← Volver"; nunca lista a la izquierda y detalle a la derecha)
   ============================================================ */
.detalle-cab { display: grid; grid-template-columns: 88px 1fr; gap: 18px; align-items: center; margin-bottom: 16px; }
.detalle-cab.sin-ava { grid-template-columns: 1fr; }
.detalle-cab h2 { margin: 0; font-size: 22px; letter-spacing: -.4px; color: var(--marca); }
.detalle-cab .sub { color: var(--texto2); font-size: 14px; }
.detalle-cab .desde { font-size: 12px; color: var(--texto3); margin-top: 4px; }
.dato { padding: 10px 0; border-bottom: 1px solid var(--borde2); }
.dato:last-child { border-bottom: 0; }
.dato .q { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--texto3); font-weight: 700; display: block; margin-bottom: 3px; }
.dato .v { font-size: 14px; }
.datos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }

/* ============================================================
   TABLA (computadora) · regla Fligo
   Orden: 1) nombre legible en negritas, 2) descripción, 3) estado, 4) números y fechas, 5) Acción.
   Texto y etiquetas a la izquierda; número, fecha e importe a la derecha (.num); nada centrado.
   Acción (.accion) SIEMPRE última, pegada a la derecha. Etiqueta o acción: ancho fijo = pieza más ancha + 36 px, nunca "…".
   Fila 48 y encabezado 38 en computadora (56 / 42 en pantallas chicas). Una línea por celda.
   ============================================================ */
.tabla-wrap { background: var(--sup); border: 1px solid var(--borde2); border-radius: var(--r); overflow: hidden; box-shadow: var(--sombra); }
.tabla { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tabla th, .tabla td {
  height: var(--alto-fila); padding: 0 14px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--borde2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tabla th { height: var(--alto-enc); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texto3); background: #FBFAF8; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla .etiq, .tabla .accion { text-overflow: clip; }
.tabla .accion { text-align: right; }
.tabla .accion .btn { vertical-align: middle; }
.tabla tbody tr:hover td { background: #F5F3EE; cursor: pointer; }
.tabla td b { color: var(--marca); }
.tabla td .ava { display: inline-grid; vertical-align: middle; margin-right: 8px; }
.tabla tfoot td { font-weight: 700; background: #FBFAF8; }
/* Rentabilidad: título de cada parte (alto de encabezado) y renglón de subtotal (como el pie) */
.tabla tr.bloque td { height: var(--alto-fila); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texto3); background: var(--sup2); }
.tabla tr.total td { font-weight: 700; background: #FBFAF8; }
.tabla tbody tr.bloque:hover td { background: var(--sup2); cursor: default; }
.tabla tbody tr.total:hover td { background: #FBFAF8; cursor: default; }
.tabla .secundaria { }   /* columnas que se omiten en laptop (1025–1280) */

/* ============================================================
   FICHA · la tabla en celular y tablet (≤1024): una sola caja con líneas, renglón de ~72 px
   arriba: nombre en negritas y su etiqueta · abajo: descripción y número a la derecha · acción a la orilla
   ============================================================ */
.fichas { background: var(--sup); border: 1px solid var(--borde2); border-radius: var(--r); box-shadow: var(--sombra); overflow: hidden; }
.ficha {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "t e e a" "s s n a";
  column-gap: 10px; row-gap: 4px; align-items: center; min-height: var(--alto-renglon); padding: 10px 14px; width: 100%;
  background: none; border: 0; border-bottom: 1px solid var(--borde2); border-radius: 0; text-align: left; color: var(--texto); min-width: 0;
}
.ficha:last-child { border-bottom: 0; }
a.ficha:active, div.ficha[onclick]:active { background: var(--sup2); }
.ficha .f-t { grid-area: t; font-weight: 700; color: var(--marca); font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ficha .f-e { grid-area: e; display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.ficha .f-s { grid-area: s; font-size: 12.5px; color: var(--texto2); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ficha .f-n { grid-area: n; text-align: right; font-size: 14px; font-weight: 700; color: var(--texto); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ficha .f-a { grid-area: a; display: flex; gap: 6px; align-items: center; }
.ficha .f-fl { grid-area: a; color: var(--texto3); font-size: 20px; line-height: 1; padding-left: 2px; }
.ficha.apagada { opacity: .6; }
.ficha.total { background: var(--sup2); }
.ficha.total .f-t { color: var(--texto); }
.fichas-t { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texto3); padding: 10px 14px 8px; border-bottom: 1px solid var(--borde2); background: var(--sup2); }

/* Páginas: 25 por página, abajo de la tabla o de la lista */
.paginas { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--texto2); font-variant-numeric: tabular-nums; }
.paginas span { margin-right: auto; }

/* ============================================================
   GRÁFICA DE BARRAS · un color, la que gana en verde, el texto nunca del color de la serie
   ============================================================ */
.graficas { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
.grafica { background: var(--sup); border: 1px solid var(--borde2); border-radius: var(--r); padding: 14px 16px 12px; box-shadow: var(--sombra); min-width: 0; }
.g-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.g-cab b { display: block; font-size: 13.5px; }
.g-cab .pista { font-size: 12px; }
.barras { display: grid; gap: 6px; }
.barra { display: grid; grid-template-columns: 120px 1fr 84px; align-items: center; gap: 10px; height: 26px; font-size: 12.5px; border-radius: 6px; }
.barra:hover { background: var(--sup2); }
.b-nombre { color: var(--texto2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-pista { position: relative; height: 14px; background: var(--sup2); border-radius: 0 4px 4px 0; }
.b-pista i { position: absolute; left: 0; top: 0; height: 100%; border-radius: 0 4px 4px 0; display: block; background: var(--marca); }
.barra.gana .b-pista i { background: var(--ok); }
/* Tus meses: la barra gris es lo que entró; lo verde, lo que quedó. El mes que va, más tenue */
.barra.meses .b-pista i { background: var(--sup3); }
.barra.meses .b-pista em { position: absolute; left: 0; top: 0; height: 100%; background: var(--ok); border-radius: 0 4px 4px 0; }
.barra.meses.va .b-pista i { opacity: .55; }
.grafica.ancha { grid-column: 1 / -1; }
.grafica.ancha .barra { grid-template-columns: 140px 1fr 84px; }
.g-nota { font-size: 12px; color: var(--texto2); margin: 10px 0 0; }
/* De cada $100: una barra que suma 100 y su lista; mismo alto de renglón que .barra */
.cien { display: flex; height: 34px; border-radius: 8px; overflow: hidden; background: var(--sup2); margin: 2px 0 12px; }
.cien i { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; white-space: nowrap; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; }
.cien i.g4, .cien i.g5 { color: var(--marca); }
.cien-lista { display: grid; gap: 6px; }
.cien-lista > div { display: grid; grid-template-columns: 12px 1fr 84px; align-items: center; gap: 10px; height: 26px; font-size: 12.5px; }
.cien-lista .c-nombre { color: var(--texto2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cien-lista b { text-align: right; font-variant-numeric: tabular-nums; }
.cien-lista .gana .c-nombre, .cien-lista .gana b { color: var(--ok-t); font-weight: 700; }
.cien-lista .pierde .c-nombre, .cien-lista .pierde b { color: var(--bad-t); font-weight: 700; }
.punto { width: 12px; height: 12px; border-radius: 3px; background: var(--sup3); }
.g1 { background: var(--serie-1); } .g2 { background: var(--serie-2); } .g3 { background: var(--serie-3); } .g4 { background: var(--serie-4); } .g5 { background: var(--serie-5); }
.cien .q, .punto.q { background: var(--ok); } .punto.p { background: var(--bad); }
.b-valor { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--texto); }

/* ============================================================
   AVISOS, VACÍO, TOAST, CONFIRMACIÓN
   ============================================================ */
.aviso-l { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r2); background: var(--info-bg); color: var(--info-t); font-weight: 600; font-size: 13.5px; margin-bottom: 14px; border: 1px solid var(--info-borde); }
.aviso-l.ok { background: var(--ok-bg); color: var(--ok-t); border-color: var(--ok-borde); }
.aviso-l.mal { background: var(--bad-bg); color: var(--bad-t); border-color: var(--bad-borde); }
.aviso-l.atencion { background: var(--warn-bg); color: var(--warn-t); border-color: var(--warn-borde); }
.vacio { text-align: center; padding: 36px 16px; color: var(--texto3); font-size: 13.5px; }
.vacio b { display: block; color: var(--texto2); font-size: 15px; margin-bottom: 4px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--alto-barra-inf) + 14px); transform: translateX(-50%); z-index: 70; background: var(--marca); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: var(--sombra-alta); white-space: nowrap; }

/* Confirmación (lo que no tiene regreso) */
.velo { position: fixed; inset: 0; z-index: 60; background: rgba(17,17,17,.45); display: grid; place-items: end center; padding: 16px; }
.dialogo { width: 100%; max-width: 420px; background: var(--sup); border-radius: var(--r); padding: 20px; box-shadow: var(--sombra-alta); }
.dialogo h3 { margin: 0 0 6px; font-size: 16px; }
.dialogo p { margin: 0 0 16px; color: var(--texto2); font-size: 13.5px; }
.dialogo .acciones { justify-content: flex-end; }

/* Lista simple de opciones (pantalla "Más", ajustes) */
.lista-simple { display: grid; }
.lista-simple a, .lista-simple button { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--alto-fila); padding: 0 4px; border: 0; border-bottom: 1px solid var(--borde2); background: none; text-align: left; font-weight: 600; color: var(--texto); font-size: 14px; width: 100%; }
.lista-simple a:last-child, .lista-simple button:last-child { border-bottom: 0; }
.lista-simple small { display: block; font-weight: 400; color: var(--texto3); font-size: 12px; }
.lista-simple .fl { color: var(--texto3); }

/* ============================================================
   CELULAR · barra fija abajo (4 + Más)
   ============================================================ */
.barra-inf {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--alto-barra-inf) + env(safe-area-inset-bottom)); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--marca); box-shadow: 0 -4px 16px rgba(17,17,17,.18);
}
.barra-inf button, .barra-inf a {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
  border: 0; background: none; color: rgba(255,255,255,.7); font-size: 11px; font-weight: 700; position: relative;
  padding: 0 2px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barra-inf .ico { width: 40px; height: 30px; display: grid; place-items: center; font-size: 18px; border-radius: 999px; }
.barra-inf .activo { color: #fff; }
.barra-inf .activo .ico { background: #fff; color: var(--marca); }
.barra-inf .punto { position: absolute; top: 2px; right: calc(50% - 22px); width: 7px; height: 7px; border-radius: 50%; background: #FF8A73; }
.con-barra-inf { padding-bottom: calc(var(--alto-barra-inf) + 16px + env(safe-area-inset-bottom)); }

/* ============================================================
   TAMAÑOS · celular ≤700 · tablet 701–1024 · laptop 1025–1280 · escritorio 1281–1600 · monitor ≥1601
   La información se reparte en más columnas; nunca se agranda.
   ============================================================ */
.solo-escritorio { display: block; }
.solo-celular { display: none; }

@media (max-width: 1024px) {
  :root { --alto-fila: 56px; --alto-enc: 42px; --alto-barra-sup: 52px; }
  .barra-sup-in { padding: 0 16px; }
  .menu, .barra-sup .usuario span:not(.ava) { display: none; }
  .barra-sup .usuario { margin-left: auto; }
  .contenido { padding: 16px 16px 24px; }
  .contenido.con-barra-inf { padding-bottom: calc(var(--alto-barra-inf) + 16px + env(safe-area-inset-bottom)); }
  .titulo { height: auto; min-height: 44px; margin-bottom: 8px; }
  .titulo h1 { font-size: 21px; }
  .titulo .pista { flex-basis: 100%; }
  .submenu { gap: 16px; margin-bottom: 14px; }
  .submenu a { font-size: 13px; }
  .solo-escritorio { display: none; }
  .solo-celular { display: block; }
  .panel { padding: 14px 16px; }
  .detalle-cab { grid-template-columns: 64px 1fr; gap: 14px; }
  .detalle-cab .ava.xg { width: 64px; height: 64px; font-size: 22px; }
  .datos-2 { grid-template-columns: 1fr; }
  .barra { grid-template-columns: 96px 1fr 76px; }
  .cien-lista > div { grid-template-columns: 12px 1fr 76px; }
  .grafica.ancha .barra { grid-template-columns: 140px 1fr 76px; }
  .dos-campos.apilar { grid-template-columns: 1fr; }
  .velo { place-items: end center; }
}
@media (max-width: 700px) {
  .filtros.apilar { grid-template-columns: 1fr; }
  .kpis, .hoy-grid { gap: 8px; }
  /* celular compacto: lo que estorba no son los botones, es lo apilado antes de la lista */
  .titulo { flex-wrap: wrap; }
  .titulo .acciones { order: 2; }
  .titulo .pista { order: 3; }
  .filtros.sin-etiqueta label.f { display: none; }
  .filtros.sin-etiqueta { gap: 8px; }
  .kpi { height: var(--alto-kpi-cel); padding: 5px 12px 4px; }
  .kpi b { font-size: 20px; line-height: 24px; letter-spacing: -.4px; }
  .kpi b small { font-size: 12px; }
  .kpi .q { font-size: 12px; line-height: 15px; }
  .kpi .p { font-size: 11px; line-height: 14px; }
  /* 12 px de aire entre bloques */
  .kpis, .filtros, .submenu, .titulo { margin-bottom: 12px; }
  .seccion-t { margin: 12px 0 8px; }
  .siguiente { margin-top: 12px; }
  .panel + .panel { margin-top: 12px; }
  .aviso-l, .filtros.dos { margin-bottom: 12px; }
  /* celular: número y pregunta en dos renglones; la pista se omite (menos es más) */
  .hoy { padding-right: 30px; }
  .hoy .q { white-space: normal; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .hoy .p { display: none; }
  .hoy .fl { right: 10px; }
  .kpi.txt b { font-size: 16px; line-height: 1.2; }
  .kpi.txt .p { display: none; }
}
@media (min-width: 1025px) {
  .barra-inf { display: none; }
  .con-barra-inf { padding-bottom: 40px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .hoy-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .filtros { grid-template-columns: repeat(4, 1fr); }
  .graficas { grid-template-columns: 1fr 1fr; }
  .rejilla-opciones { grid-template-columns: repeat(4, 1fr); }
  .rejilla-opciones.dos { grid-template-columns: 1fr 1fr; }
  .velo { place-items: center; }
}
@media (min-width: 1025px) and (max-width: 1280px) {
  /* laptop: se omiten columnas secundarias, no se aplasta la flexible */
  .tabla .secundaria { display: none; }
}
@media (min-width: 1601px) {
  :root { --ancho-max: 1600px; }
  .kpis { grid-template-columns: repeat(6, 1fr); }
}
@media print {
  .barra-sup, .barra-inf, .toast { display: none; }
  .contenido { padding: 0; max-width: none; }
}
