* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f7f7f6; color: #1c1c1e; }

.view { height: 100vh; }

/* Login */
#login-view { display: flex; align-items: center; justify-content: center; }
.login-card { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04); width: 320px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; font-weight: 600; }
.subtitle { color: #767671; font-size: 14px; margin: 0 0 24px; }
.login-card label { display: block; font-size: 13px; margin: 12px 0 4px; color: #444; }
.login-card input { width: 100%; padding: 9px 10px; border: 1px solid #ddd; border-radius: 7px; font-size: 14px; }
.login-card button { width: 100%; margin-top: 20px; padding: 10px; background: #ff7a2f; color: white; border: none; border-radius: 7px; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-card button:hover { background: #e5691f; }
.error { color: #c0392b; font-size: 13px; margin-top: 12px; min-height: 16px; }

/* App shell: sidebar + main area */
.app { min-height: 100vh; display: flex; }

.sidebar {
  width: 168px; flex: 0 0 auto; background: #16161a; color: #cfcfd2;
  display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; align-self: flex-start;
}
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 0 4px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: #ff7a2f; color: white; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.brand-name { font-size: 13.5px; font-weight: 600; color: white; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.nav-item {
  text-align: left; background: none; border: none; color: #9d9da2; font-size: 12.5px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-family: inherit;
}
.nav-item:hover { background: #232328; color: white; }
.nav-item.active { background: #ff7a2f; color: white; font-weight: 600; }
.nav-calculadora {
  margin: 8px 0 12px; padding: 9px 10px; border: 1px solid #ff7a2f; border-radius: 7px;
  background: transparent; color: #ff7a2f; font-size: 12.5px; font-weight: 600; font-family: inherit;
  text-align: left; cursor: pointer;
}
.nav-calculadora:hover { background: #ff7a2f; color: white; }
/* ⓘ al lado de la Calculadora y de "Ver ventas" */
.nav-calculadora-fila { display: flex; align-items: center; gap: 6px; margin: 8px 0 12px; }
.nav-calculadora-fila .nav-calculadora { flex: 1; margin: 0; }
.ver-ventas-fila { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.ver-ventas-fila .ver-ventas { margin-top: 0; }
.calc-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(20,20,24,0.55); display: flex; flex-direction: column; padding: 16px; }
.calc-overlay[hidden] { display: none; }
.calc-overlay-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #1c1c1e; color: white; font-size: 12px; font-weight: 600; padding: 8px 12px; border-radius: 10px 10px 0 0;
}
.calc-overlay-bar button { background: #ff7a2f; color: white; border: none; border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer; }
.calc-overlay iframe { flex: 1 1 auto; width: 100%; border: none; background: white; border-radius: 0 0 10px 10px; }
.sidebar-footer { font-size: 10px; color: #6c6c72; line-height: 1.5; padding: 0 4px; }

.main-area { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.topbar { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 7px 18px; background: white; border-bottom: 1px solid #eaeae8; }
.topbar h1 { font-size: 14.5px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.range-label { font-size: 10px; color: #767671; display: flex; flex-direction: column; gap: 2px; }
.range-label input[type="date"] { padding: 3px 6px; border: 1px solid #ddd; border-radius: 5px; font-size: 11.5px; background: white; }
#user-label { font-size: 12px; color: #444; }
#logout-btn { background: none; border: 1px solid #ddd; border-radius: 5px; padding: 4px 10px; cursor: pointer; font-size: 11.5px; color: #444; }
#logout-btn:hover { background: #f2f2f0; }
#sync-btn {
  background: #ff7a2f; border: none; border-radius: 5px; padding: 5px 12px;
  cursor: pointer; font-size: 11.5px; color: white; font-weight: 600;
}
#sync-btn:hover { background: #e5691f; }
#sync-btn:disabled { background: #ffc199; cursor: wait; }

.nav-toast {
  flex: 0 0 auto; background: #fff3e6; color: #a34e00; font-size: 12px; text-align: center;
  padding: 6px; border-bottom: 1px solid #ffd9ad;
}

/* Contenido del Resumen: grilla con scroll normal de página. Antes era una sola
   pantalla fija con overflow oculto y las etapas del embudo se comprimían. */
.content {
  flex: 0 0 auto;
  padding: 12px 16px 24px;
  display: grid;
  gap: 10px;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "funnel   funnel    funnel     funnel"
    "sources  sources   sources    sources"
    "ventas   inversion meta       meta"
    "analytics topserv  asistencia tendencia";
}
.gp-funnel     { grid-area: funnel; }
.gp-sources    { grid-area: sources; }
.gp-ventas     { grid-area: ventas; }
.gp-inversion  { grid-area: inversion; }
.gp-meta       { grid-area: meta; }
.gp-analytics  { grid-area: analytics; }
.gp-topserv    { grid-area: topserv; }
.gp-asistencia { grid-area: asistencia; }
.gp-tendencia  { grid-area: tendencia; }

/* ── Embudo auditado ───────────────────────────────────────────────────── */
:root {
  --naranja: #ff7a2f;
  --naranja-osc: #c2410c;
  --naranja-claro: #fff1e7;
  --texto: #1c1c1e;
  --texto-2: #4b4b47;
  --borde: #e6e3de;
  --fs-titulo-tarjeta: 12px;
  --fs-valor: 24px;
  --fs-meta: 11px;
}
.embudo { background: white; border: 1px solid var(--borde); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 16px; }
.embudo-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.embudo-header h2 { font-size: 16px; font-weight: 700; color: var(--texto); margin: 0; }
.embudo-sub { margin: 0; font-size: 12px; color: var(--texto-2); flex: 1 1 320px; }
.leyenda-estados { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--texto-2); }
.leyenda-estados li { display: flex; align-items: center; gap: 4px; }
.embudo-bloque { border-top: 1px solid var(--borde); padding-top: 12px; }
.embudo-bloque:first-of-type { border-top: none; padding-top: 0; }
.bloque-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 4px; }
.bloque-header h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--texto); }
.bloque-opcional { font-size: 11px; font-weight: 600; color: var(--naranja-osc); background: var(--naranja-claro); border-radius: 20px; padding: 2px 8px; margin-left: 4px; }
.bloque-badge { font-size: 11px; color: var(--texto-2); background: #f4f3f0; border-radius: 20px; padding: 3px 10px; }
.bloque-nota { margin: 0 0 10px; font-size: 12px; line-height: 1.45; color: var(--texto-2); max-width: 110ch; }
.bloque-nota:empty { display: none; }

/* Tarjetas de igual ancho y alto: el valor no cambia el tamaño, la barra sí */
.emb-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); grid-auto-rows: 1fr; }
.emb-card {
  background: #fcfbf9; border: 1px solid var(--borde); border-top: 3px solid var(--naranja);
  border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.emb-card-simple { border-top-color: #f4b400; }
.emb-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.emb-card-head h4 { margin: 0; font-size: var(--fs-titulo-tarjeta); font-weight: 600; color: var(--texto-2); line-height: 1.3; }
.emb-valor { margin: 2px 0 0; font-size: var(--fs-valor); font-weight: 750; color: var(--texto); line-height: 1.1; font-variant-numeric: tabular-nums; }
.emb-unidad { margin: 0; font-size: var(--fs-meta); color: #77756f; }
.emb-barra { height: 6px; background: #efece7; border-radius: 4px; overflow: hidden; margin: 4px 0 2px; }
.emb-barra span { display: block; height: 100%; background: var(--naranja); border-radius: 4px; }
.emb-metricas { margin: 0; display: grid; gap: 2px; font-size: var(--fs-meta); }
.emb-metricas div { display: flex; justify-content: space-between; gap: 8px; }
.emb-metricas dt { color: #6b6964; }
.emb-metricas dd { margin: 0; font-weight: 700; color: var(--texto); font-variant-numeric: tabular-nums; }
.emb-detalle, .emb-motivo { margin: 4px 0 0; font-size: var(--fs-meta); color: var(--texto-2); line-height: 1.4; }
.emb-aviso { margin: 6px 0 0; font-size: var(--fs-meta); line-height: 1.4; color: #7c2d12; background: #fff4e5; border-left: 3px solid #f59e0b; padding: 5px 7px; border-radius: 4px; }
.emb-card.con-aviso { border-top-color: #f59e0b; }
.emb-card.emb-estado-desconectada, .emb-card.emb-estado-faltante { border-top-color: #a8a29e; background: #f7f7f5; }
.emb-card.emb-estado-desconectada .emb-barra, .emb-card.emb-estado-faltante .emb-barra { display: none; }

.estado-pill { display: inline-block; font-size: 11px; font-weight: 700; line-height: 1.3; padding: 2px 8px; border-radius: 20px; white-space: nowrap; vertical-align: middle; }
.emb-valor .estado-pill { font-size: 13px; }
.estado-pill.estado-cero { background: #e8f0fe; color: #1e3a8a; }
.estado-pill.estado-faltante { background: #fef3c7; color: #78350f; }
.estado-pill.estado-desconectada { background: #e7e5e4; color: #44403c; }
.estado-pill.estado-aviso { background: #ffedd5; color: #9a3412; }
.estado-pill.estado-ok { background: #dcfce7; color: #14532d; }

/* Botón de información y globo */
.info-btn {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #9a958d; background: white;
  color: #57534e; font: italic 700 11px/1 Georgia, serif; cursor: help; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; vertical-align: middle; margin-left: 3px;
}
.info-btn:hover, .info-btn[aria-expanded="true"] { border-color: var(--naranja); color: var(--naranja-osc); }
.info-btn:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }
.info-tip {
  position: absolute; z-index: 1100; background: #1f1f22; color: #f5f5f4; border-radius: 10px; padding: 12px 14px;
  font-size: 12px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.info-tip strong { display: block; font-size: 13px; margin-bottom: 6px; color: white; }
.info-tip dl { margin: 0; display: grid; gap: 5px; }
.info-tip dt { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #fdba74; }
.info-tip dd { margin: 0; color: #e7e5e4; }

/* Diagnóstico por fuente */
.tabla-wrap { overflow-x: auto; }
.diag-tabla { width: 100%; border-collapse: collapse; font-size: 12px; }
.diag-tabla th, .diag-tabla td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #efedea; vertical-align: top; }
.diag-tabla thead th { font-size: 11px; color: #6b6964; font-weight: 600; white-space: nowrap; }
.diag-tabla tbody th { font-weight: 600; color: var(--texto); white-space: nowrap; }
.diag-detalle { display: block; font-size: 10.5px; color: #78716c; margin-top: 2px; max-width: 34ch; }

/* Asistencia por estado */
.asistencia-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.asistencia-lista li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 5px 0; border-bottom: 1px solid #f0eeea; }
.as-titulo { font-size: 11.5px; color: var(--texto-2); display: flex; align-items: center; gap: 2px; }
.as-valor { font-size: 15px; font-weight: 700; color: var(--texto); text-align: right; grid-row: span 2; align-self: center; }
.as-fuente { font-size: 10.5px; color: #8a8782; }

/* Fila de fuentes (Sheets / Calendar / Kaptor resumidas) */
.source-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 0; min-height: 0; }
.source-box { background: white; border-radius: 7px; padding: 6px 9px; border: 1px solid #ececea; border-left-width: 3px; border-left-style: solid; border-left-color: var(--source-color); display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.source-box h3 { font-size: 9.5px; font-weight: 600; margin: 0 0 1px; display: flex; align-items: center; gap: 5px; color: #3c3c3a; }
.source-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--source-color); flex-shrink: 0; }
.source-status { margin-left: auto; font-size: 8.5px; font-weight: 600; color: var(--source-color); background: color-mix(in srgb, var(--source-color) 12%, white); padding: 1px 5px; border-radius: 20px; }
.source-sheets   { --source-color: #34a853; }
.source-calendar { --source-color: #f4b400; }
.source-kaptor   { --source-color: #14b8a6; }
.mini-stat { display: flex; align-items: baseline; gap: 6px; }
.mini-stat .label { font-size: 9px; color: #6a6a66; flex: 1 1 auto; }
.mini-stat .value { font-size: 12.5px; font-weight: 700; }
.mini-stat .trend { font-size: 8.5px; font-weight: 600; }

/* Paneles generales */
.panel { margin-bottom: 0; background: white; border-radius: 9px; padding: 8px 11px; border: 1px solid #ececea; min-height: 0; display: flex; flex-direction: column; }
.panel h2 { font-size: 10.5px; font-weight: 600; color: #3c3c3a; margin: 0 0 6px; display: flex; align-items: baseline; gap: 6px; flex-shrink: 0; }
.panel-sub { font-size: 9px; font-weight: 400; color: #9a9a95; }
.panel-sub.pending { color: #e8710a; font-weight: 600; }

.grid { display: grid; gap: 5px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.card { background: #fafaf9; border-radius: 7px; padding: 5px 8px; display: flex; flex-direction: column; gap: 0; border: 1px solid #f0f0ee; overflow: hidden; }
.card .label { font-size: 9px; color: #5a5a56; font-weight: 500; line-height: 1.15; }
.card .value { font-size: 13.5px; font-weight: 650; color: #1c1c1e; letter-spacing: -0.01em; line-height: 1.15; }
.card .sub { font-size: 8px; color: #8a8a85; }
.card .trend { font-size: 8px; font-weight: 600; }

.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 4px; background: #d8d8d4; flex-shrink: 0; }
.status-dot.up { background: #2e9e5b; box-shadow: 0 0 0 2px rgba(46,158,91,0.15); }
.status-dot.down { background: #c0392b; box-shadow: 0 0 0 2px rgba(192,57,43,0.15); }

.last-sync { font-size: 8px; font-weight: 400; color: #a3a39d; margin-left: 3px; white-space: nowrap; }

.trend.up { color: #2e9e5b; }
.trend.down { color: #c0392b; }
.trend.flat { color: #9a9a95; }

.campaign-table-wrap { background: #fafaf9; border-radius: 7px; padding: 6px 8px; border: 1px solid #f0f0ee; margin-top: 5px; overflow: hidden; }
.campaign-table-title { font-size: 9px; font-weight: 600; color: #5a5a56; margin-bottom: 3px; }
.campaign-table { width: 100%; border-collapse: collapse; font-size: 8.5px; }
.campaign-table th { text-align: left; color: #8a8a85; font-weight: 500; padding: 2px 3px; border-bottom: 1px solid #e5e5e2; }
.campaign-table td { padding: 3px 3px; border-bottom: 1px solid #f0f0ee; }
.ver-ventas { margin-top: 6px; font: inherit; font-size: 10px; font-weight: 600; color: var(--naranja-osc); background: none; border: none; padding: 2px 0; cursor: pointer; }
.ver-ventas:hover { text-decoration: underline; }

/* Sección Ventas */
.vt-fuente { font-size: 11.5px; color: #8a8782; border-top: 1px dashed #ebe8e3; padding-top: 6px; margin-top: 4px; }
.vt-fuente b { color: var(--texto-2); font-weight: 700; }
.vt-consultas { display: grid; gap: 16px 28px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.vt-consultas h4 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--texto-2); }
.vt-consultas .bar-list { max-height: none; }
.vt-medicos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.vt-medico { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--borde); border-radius: 12px; background: white; cursor: pointer; }
.vt-medico:hover { border-color: var(--naranja); }
.vt-medico.activo { border-color: var(--texto); box-shadow: inset 0 0 0 1px var(--texto); }
.vt-medico:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }
.vt-medico-nombre { font-size: 13.5px; font-weight: 700; color: var(--texto); }
.vt-medico-monto { font-size: 22px; font-weight: 800; color: var(--texto); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.vt-medico-sub { font-size: 12px; color: #6b6964; }
.vt-medico-barra { height: 5px; border-radius: 3px; background: #f0eeea; overflow: hidden; margin-top: 4px; }
.vt-medico-barra span { display: block; height: 100%; background: var(--naranja); border-radius: 3px; }
.vt-tabla .vt-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vt-tabla td small { display: block; font-size: 12px; color: #8a8782; margin-top: 2px; }
.vt-tabla tfoot td { font-weight: 800; padding: 12px 10px; border-top: 2px solid var(--borde); border-bottom: none; }
.vt-pago { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: #f4f3f0; color: var(--texto-2); }
.vt-pago-pagada { background: var(--ok-fondo); color: var(--ok); }
.vt-pago-pendiente, .vt-pago-parcial { background: var(--pend-fondo); color: var(--pend); }
@media (max-width: 700px) {
  .ventas-view .vt-num { text-align: left; }
  .vt-tabla tfoot tr { border: none; }
}
.campaign-table td.muted { color: #a3a39d; font-style: italic; }

.mini-list { margin: 0; padding-left: 12px; font-size: 9.5px; color: #333; max-height: 46px; overflow-y: auto; }
.mini-list li { margin-bottom: 1px; }

/* Listas con barra horizontal (estilo "ranking") */
.bar-list { list-style: none; padding-left: 0; max-height: 92px; }
.bar-list li { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; font-size: 9.5px; }
.bar-list .bar-label { flex: 0 0 auto; min-width: 68px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #444; }
.bar-list .bar-track { flex: 1 1 auto; height: 5px; background: #f0ede9; border-radius: 3px; overflow: hidden; }
.bar-list .bar-fill { display: block; height: 100%; background: #ff7a2f; border-radius: 3px; }
.bar-list .bar-value { flex: 0 0 auto; font-weight: 600; color: #1c1c1e; min-width: 22px; text-align: right; font-size: 9px; }

.donut-legend { display: flex; flex-direction: column; gap: 3px; font-size: 9.5px; }
.donut-legend .legend-row { display: flex; align-items: center; gap: 5px; }
.donut-legend .legend-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.sparkline { width: 100%; flex: 1 1 auto; min-height: 0; }

.donut-layout { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-height: 0; }
.donut { width: 64px; height: 64px; flex: 0 0 auto; }

.footnote { text-align: center; color: #a3a39d; font-size: 9px; padding: 2px 0; flex: 0 0 auto; }

/* Sección extra debajo del resumen fijo - acá sí hay scroll normal de página */
.content-extra {
  padding: 18px 16px 30px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.content-extra .section-title {
  grid-column: 1 / -1;
  font-size: 13px; font-weight: 700; color: #3c3c3a;
  margin: 14px 0 2px; padding-top: 10px; border-top: 1px solid #e5e5e2;
}
.content-extra .section-title:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.content-extra .panel { min-height: 140px; }
#view-clientes .panel:first-of-type { min-height: 0; }
.cli-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cli-list { max-height: none; }
.cli-list .bar-label { max-width: 130px; min-width: 90px; }
.cli-nota { font-size: 9.5px; color: #8a8a85; margin: 6px 0 0; }
.cli-tabla-wrap { overflow-x: auto; }
.cli-tabla { border-collapse: collapse; font-size: 10px; width: 100%; }
.cli-tabla th, .cli-tabla td { padding: 4px 8px; text-align: right; border-bottom: 1px solid #f0f0ee; white-space: nowrap; }
.cli-tabla th:first-child, .cli-tabla td:first-child { text-align: left; }
.cli-tabla th { color: #8a8a85; font-weight: 600; }
.cli-tabla .delta.up { color: #16a34a; font-weight: 600; }
.cli-tabla .delta.down { color: #dc2626; font-weight: 600; }
.cli-tabla .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
@media (max-width: 900px) { .cli-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.content-extra .panel h2 { font-size: 11.5px; }
.content-extra .bar-list, .content-extra .mini-list { max-height: 130px; }
.deudor-row { display: flex; flex-direction: column; gap: 0; padding: 4px 0; border-bottom: 1px solid #f0f0ee; }
.deudor-row:last-child { border-bottom: none; }
.deudor-row .deudor-nombre { font-size: 10px; font-weight: 600; color: #1c1c1e; }
.deudor-row .deudor-detalle { font-size: 9px; color: #6a6a66; display: flex; justify-content: space-between; }
.alerta-chip { display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 20px; margin-top: 2px; }
.alerta-chip.ok { background: #e6f4ea; color: #2e9e5b; }
.alerta-chip.warn { background: #fde8e8; color: #c0392b; }

/* ── Tipografía uniforme de tarjetas y paneles (antes 8–10px, difícil de leer) ── */
.panel { padding: 12px 14px; border-radius: 12px; border-color: var(--borde, #e6e3de); }
.panel h2 { font-size: 13px; font-weight: 700; color: #1c1c1e; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.panel-sub { font-size: 11px; color: #77756f; font-weight: 400; }
.grid { gap: 8px; }
.card { padding: 8px 10px; border-radius: 9px; gap: 2px; border-color: #ece9e4; overflow: visible; }
.card .label { font-size: 11px; color: #4b4b47; line-height: 1.3; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.card .value { font-size: 17px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.card .sub, .card .trend { font-size: 10.5px; }
.last-sync { font-size: 10.5px; }
.mini-list { font-size: 11px; max-height: none; }
.bar-list { max-height: none; }
.bar-list li { font-size: 11px; margin-bottom: 5px; }
.bar-list .bar-label { max-width: 150px; min-width: 80px; }
.bar-list .bar-value { font-size: 11px; }
.campaign-table, .campaign-table-title { font-size: 11px; }
.donut-legend { font-size: 11px; }
.donut { width: 84px; height: 84px; }
.sparkline { min-height: 110px; }
.footnote { font-size: 11px; padding: 8px 0 16px; }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

/* ── Tablet ── */
@media (max-width: 1100px) {
  .content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "funnel funnel" "sources sources" "ventas inversion" "meta meta"
      "analytics topserv" "asistencia tendencia";
  }
}

/* ── Celular: menú arriba, una columna, tarjetas de a dos sin comprimir ── */
@media (max-width: 700px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; }
  .brand { margin-bottom: 0; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; gap: 4px; }
  .nav-item { white-space: nowrap; padding: 7px 10px; }
  .nav-calculadora-fila { margin: 0 0 0 auto; }
  .sidebar-footer { display: none; }
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .topbar-right { flex-wrap: wrap; gap: 8px; }
  .content { padding: 10px 10px 20px; grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "funnel" "sources" "ventas" "inversion" "meta" "analytics" "topserv" "asistencia" "tendencia"; }
  .embudo { padding: 12px; }
  .emb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-extra { grid-template-columns: minmax(0, 1fr); padding: 12px 10px 24px; }
  .content-extra .panel { grid-column: 1 / -1 !important; }
  .diag-tabla { font-size: 11.5px; }
}
@media (max-width: 380px) {
  .emb-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── Sección Agenda: confirmación de asistencia ─────────────────────────── */
:root {
  --ok: #15803d; --ok-fondo: #dcfce7;
  --pend: #b45309; --pend-fondo: #fef3c7;
  --cancel: #b91c1c; --cancel-fondo: #fee2e2;
  --reprog: #c2410c; --reprog-fondo: #ffedd5;
  --neutro: #57534e; --neutro-fondo: #e7e5e4;
}
.agenda-view { padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 14px; width: 100%; }
.ag-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 20px; }
.ag-header h2 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -0.01em; color: var(--texto); }
.ag-sub { margin: 4px 0 0; font-size: 13px; color: var(--texto-2); }
.ag-aviso { margin: 0; font-size: 12.5px; color: #7c2d12; background: #fff4e5; border-left: 3px solid #f59e0b; padding: 7px 10px; border-radius: 6px; max-width: 60ch; }

.ag-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
/* Evolución: tarjetas en grupos con título (A) y fila de foco (B) */
.evo-kpi-grupos { display: flex; flex-direction: column; gap: 18px; }
.evo-grupo-tit { margin: 0 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-2); }
.evo-foco { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 13px 18px; margin-bottom: 16px; border: 1px solid #fed7aa; border-radius: 14px; background: #fff7ed; }
.evo-foco.evo-foco-ok { border-color: #bbf7d0; background: #f0fdf4; }
.evo-foco-lead { font-size: 16px; font-weight: 800; color: var(--texto); letter-spacing: -0.01em; }
.evo-foco-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.evo-foco-chip { font-size: 13px; font-weight: 600; color: var(--texto-2); background: white; border: 1px solid var(--borde); border-radius: 999px; padding: 4px 12px; }
.evo-foco-chip strong { color: var(--texto); font-weight: 800; }
.ag-kpi { background: white; border: 1px solid var(--borde); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.ag-kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--acento, var(--naranja)); }
.ag-kpi-label { font-size: 13px; font-weight: 600; color: var(--texto-2); display: flex; align-items: center; gap: 4px; }
.ag-kpi-valor { font-size: 34px; font-weight: 800; line-height: 1.05; color: var(--texto); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ag-kpi-valor small { font-size: 15px; font-weight: 700; color: var(--acento-texto, var(--texto-2)); margin-left: 6px; letter-spacing: 0; }
.ag-kpi-sub { font-size: 12.5px; color: #6b6964; }
.ag-kpi.k-ok { --acento: var(--ok); --acento-texto: var(--ok); }
.ag-kpi.k-pend { --acento: #f59e0b; --acento-texto: var(--pend); }
.ag-kpi.k-cancel { --acento: #dc2626; --acento-texto: var(--cancel); }
.ag-kpi.k-neutro { --acento: #a8a29e; }

.ag-fila { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.ag-panel { background: white; border: 1px solid var(--borde); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.ag-panel h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--texto); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.ag-panel-sub { font-size: 12px; font-weight: 400; color: #77756f; }
.ag-panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-bottom: 12px; }
.ag-panel-head h3 { margin: 0; }
.ag-nota { margin: -4px 0 12px; font-size: 12.5px; line-height: 1.45; color: var(--texto-2); }
.ag-nota:empty { display: none; }

/* Barra apilada de estados: 2px de separación entre segmentos */
.ag-stack { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; background: #f4f3f0; }
.ag-stack span { display: block; height: 100%; min-width: 4px; }
.ag-stack .s-confirmada { background: #16a34a; }
.ag-stack .s-pendiente { background: #f59e0b; }
.ag-stack .s-reprogramar { background: #ea580c; }
.ag-stack .s-cancelada { background: #dc2626; }
.ag-stack .s-otro { background: #a8a29e; }
.ag-leyenda { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.ag-leyenda li { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px; font-size: 13.5px; color: var(--texto); padding-bottom: 8px; border-bottom: 1px solid #f0eeea; }
.ag-leyenda li:last-child { border-bottom: none; }
.ag-leyenda .dot { width: 12px; height: 12px; border-radius: 3px; }
.ag-leyenda .n { font-weight: 750; font-variant-numeric: tabular-nums; }
.ag-leyenda .pct { font-size: 12.5px; color: #77756f; min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
.ag-vacio { font-size: 13px; color: #77756f; margin: 8px 0 0; }

/* Embudo horizontal: una fila por paso */
.ag-funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.ag-funnel li { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 3.2em 4.6em; align-items: center; gap: 10px; font-size: 13px; }
.ag-funnel .paso { color: var(--texto); display: flex; align-items: center; gap: 2px; line-height: 1.25; }
.ag-funnel .pista { height: 14px; background: #f4f3f0; border-radius: 4px; overflow: hidden; }
.ag-funnel .pista span { display: block; height: 100%; background: var(--naranja); border-radius: 0 4px 4px 0; }
.ag-funnel li.nuevo .pista span { background: #16a34a; }
.ag-funnel .n { font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
.ag-funnel .conv { font-size: 12px; color: #77756f; text-align: right; font-variant-numeric: tabular-nums; }
.ag-funnel li.aviso .conv { color: #b45309; font-weight: 700; }
.ag-funnel li.sin-dato .pista { background: repeating-linear-gradient(45deg, #f4f3f0 0 6px, #ebe8e3 6px 12px); }

/* Chips de filtro */
.ag-filtros { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-chip { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--borde); background: white; color: var(--texto-2); cursor: pointer; }
.ag-chip:hover { border-color: var(--naranja); color: var(--naranja-osc); }
.ag-chip.activo { background: var(--texto); border-color: var(--texto); color: white; }
.ag-chip:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }

/* Tabla de citas */
.ag-tabla-wrap { overflow-x: auto; }
.ag-tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ag-tabla th { text-align: left; font-size: 12px; font-weight: 600; color: #6b6964; padding: 8px 10px; border-bottom: 1px solid var(--borde); white-space: nowrap; }
.ag-tabla td { padding: 11px 10px; border-bottom: 1px solid #f0eeea; vertical-align: middle; }
.ag-tabla tbody tr:hover { background: #fcfbf9; }
.ag-tabla tr.pasada td:first-child { color: #8a8782; }
.ag-fecha { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ag-fecha small, .ag-tabla small { display: block; font-weight: 400; font-size: 12px; color: #8a8782; }
.ag-persona { font-weight: 600; }
.ag-origen { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: #f4f3f0; color: var(--texto-2); white-space: nowrap; }
.ag-tabla .vacio td { text-align: center; color: #77756f; padding: 24px; }
.st-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.st-confirmada { background: var(--ok-fondo); color: var(--ok); }
.st-pendiente { background: var(--pend-fondo); color: var(--pend); }
.st-cancelada { background: var(--cancel-fondo); color: var(--cancel); }
.st-reprogramar { background: var(--reprog-fondo); color: var(--reprog); }
.st-otro { background: var(--neutro-fondo); color: var(--neutro); }
.ag-kpi.k-asist { --acento: #2563eb; --acento-texto: #1d4ed8; }
/* Cambiar el estado a mano desde el listado */
.ag-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.ag-btn { font: inherit; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--borde); background: white; color: var(--texto-2); cursor: pointer; white-space: nowrap; }
.ag-btn:hover:not(:disabled) { border-color: var(--naranja); color: var(--naranja-osc); }
.ag-btn:focus-visible, .ag-cambiar:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }
.ag-btn:disabled, .ag-cambiar:disabled { opacity: .5; cursor: wait; }
.ag-btn-ok { border-color: #86efac; color: var(--ok); background: var(--ok-fondo); }
.ag-btn-ok:hover:not(:disabled) { border-color: var(--ok); color: var(--ok); }
.ag-btn-wa { border-color: #86efac; color: #128c7e; background: #e9f9f1; }
.ag-btn-wa:hover:not(:disabled) { border-color: #128c7e; color: #0b6b5f; }
/* Acciones de seguimiento en la columna Contacto (Evolución) */
.evo-seg-acciones { margin-top: 8px; }
.evo-seg-intentos { color: var(--cancel); font-weight: 600; }
.cf-mensaje textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 8px; resize: vertical; }
.ag-asist-asistio.activo { background: #dbeafe; border-color: #2563eb; color: #1d4ed8; }
.ag-asist-no_asistio.activo { background: var(--cancel-fondo); border-color: #dc2626; color: var(--cancel); }
.ag-cambiar { font: inherit; font-size: 12px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--borde); background: white; color: var(--texto-2); max-width: 100%; cursor: pointer; }
.ag-espera { font-size: 12px; color: #8a8782; }

/* Topbar más legible */
.topbar { padding: 10px 20px; }
.topbar h1 { font-size: 16px; }
.range-label { font-size: 11.5px; font-weight: 600; color: #57534e; }
.range-label input[type="date"] { font-size: 13px; padding: 5px 8px; border-radius: 7px; }
#sync-btn { font-size: 13px; padding: 8px 14px; border-radius: 8px; }
#logout-btn { font-size: 12.5px; padding: 7px 12px; border-radius: 8px; }
#user-label { font-size: 13px; }
.nav-item { font-size: 13.5px; padding: 9px 11px; }

@media (max-width: 1000px) {
  .ag-fila { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .agenda-view { padding: 12px 16px 24px; }
  .ag-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ag-kpi { padding: 12px; }
  .ag-kpi-valor { font-size: 26px; }
  .ag-funnel li { grid-template-columns: minmax(0, 1fr) 3em 4.2em; }
  .ag-funnel .pista { grid-column: 1 / -1; grid-row: 2; }
  /* Tabla como tarjetas en el celular */
  .ag-tabla thead { display: none; }
  .ag-tabla, .ag-tabla tbody, .ag-tabla tr, .ag-tabla td { display: block; width: 100%; }
  .ag-tabla tr { border: 1px solid var(--borde); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
  .ag-tabla td { border: none; padding: 3px 0; }
  .ag-tabla td[data-col]::before { content: attr(data-col) " · "; font-size: 12px; color: #8a8782; }
}

/* ── Sección Clientes: Clientes PnK, Potenciales, Kaptor ─────────────────── */
.clientes-view { padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 14px; width: 100%; }
.clientes-view .ag-sub { max-width: 95ch; }
.cli-tabs { display: flex; flex-wrap: wrap; gap: 0 4px; border-bottom: 1px solid var(--borde); }
.cli-tab { font: inherit; font-size: 14px; font-weight: 600; color: var(--texto-2); background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 14px 9px; cursor: pointer; margin-bottom: -1px; }
.cli-tab:hover { color: var(--texto); }
.cli-tab.activo { color: var(--texto); border-bottom-color: var(--naranja); }
.cli-tab:focus-visible { outline: 2px solid var(--naranja); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.cli-tab-n { font-size: 12px; font-weight: 700; background: #f4f3f0; color: var(--texto-2); border-radius: 20px; padding: 1px 8px; margin-left: 4px; }
.cli-tab-n:empty { display: none; }
#cli-personas { display: flex; flex-direction: column; gap: 14px; }
#cli-personas[hidden], .cli-kaptor[hidden] { display: none; }
.cli-kaptor { padding: 0; }

.cli-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.cli-toolbar input[type="search"] { flex: 1 1 280px; font: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--borde); border-radius: 9px; }
.cli-toolbar select { font: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 9px; background: white; }
.cli-toolbar select[hidden] { display: none; }
.cli-toolbar :focus-visible { outline: 2px solid var(--naranja); outline-offset: 1px; }
.cli-cuenta { margin-left: auto; font-size: 13px; color: #77756f; }

.cli-fila { cursor: pointer; }
.cli-fila:focus-visible { outline: 2px solid var(--naranja); outline-offset: -2px; }
.cli-personas-tabla small { display: block; font-size: 12px; color: #8a8782; margin-top: 2px; }
.ct-marca { display: inline-block; font-size: 11px; font-weight: 600; color: var(--texto-2); background: #f4f3f0; border-radius: 20px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.ct-dup { background: var(--pend-fondo); color: var(--pend); }
.ct-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.ct-sin_contactar { background: #f4f3f0; color: var(--texto-2); }
.ct-contactado { background: var(--ok-fondo); color: var(--ok); }
.ct-contactado_whatsapp { background: #dcfce7; color: #166534; }
.ct-interesado { background: #dbeafe; color: #1e40af; }
.ct-no_responde { background: var(--pend-fondo); color: var(--pend); }
.ct-no_interesado { background: var(--neutro-fondo); color: var(--neutro); }
.ct-vencido { color: var(--cancel) !important; font-weight: 600; }
.ct-gris { color: #a8a29e; font-size: 13px; }
.et-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; background: #f4f3f0; color: var(--texto-2); }
.et-completo_datos { background: #fff1e7; color: var(--naranja-osc); }
.et-whatsapp { background: #dcfce7; color: #166534; }
.et-reservo { background: #dbeafe; color: #1e40af; }
.et-cliente, .et-en_control { background: var(--texto); color: white; }

/* Ficha lateral */
.ficha-fondo { position: fixed; inset: 0; background: rgba(20,20,24,0.35); z-index: 900; }
.ficha { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: #fbfaf8; z-index: 901; display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(0,0,0,0.15); }
.ficha[hidden], .ficha-fondo[hidden] { display: none; }
.ficha-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; background: white; border-bottom: 1px solid var(--borde); }
.ficha-head h2 { margin: 0; font-size: 19px; font-weight: 750; color: var(--texto); }
.ficha-sub { margin: 6px 0 0; font-size: 13px; color: var(--texto-2); }
.ficha-acciones { display: flex; gap: 8px; align-items: center; }
.ficha-wa { font-size: 13px; font-weight: 700; color: white; background: #16a34a; border-radius: 8px; padding: 8px 12px; text-decoration: none; }
.ficha-wa:hover { background: #15803d; }
.ficha-cerrar { font: inherit; font-size: 16px; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--borde); background: white; cursor: pointer; }
.ficha-cerrar:hover { background: #f4f3f0; }
.ficha-cuerpo { overflow-y: auto; padding: 16px 20px 32px; display: flex; flex-direction: column; gap: 14px; }
.ficha-seccion { background: white; border: 1px solid var(--borde); border-radius: 12px; padding: 14px 16px; }
.ficha-seccion h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--texto); }
.ficha-seccion h3:not(:first-child) { margin-top: 16px; }
.ficha-campos { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ficha-campos .ficha-campo:first-child { grid-column: 1 / -1; }
.ficha-campos-2 .ficha-campo:first-child { grid-column: auto; }
.ficha-campo { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--texto-2); }
.ficha-campo input, .ficha-campo select { font: inherit; font-size: 14px; font-weight: 400; color: var(--texto); padding: 8px 10px; border: 1px solid #d6d3cd; border-radius: 8px; background: white; }
.ficha-campo input:focus, .ficha-campo select:focus { outline: 2px solid var(--naranja); outline-offset: 0; border-color: transparent; }
.ficha-editado { font-size: 11.5px; font-weight: 500; color: var(--naranja-osc); }
.ficha-guardar { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.ficha-guardar button, .ficha-nota-form button { font: inherit; font-size: 13.5px; font-weight: 700; color: white; background: var(--naranja); border: none; border-radius: 8px; padding: 9px 16px; cursor: pointer; }
.ficha-guardar button:hover, .ficha-nota-form button:hover { background: #e5691f; }
#ficha-msg { font-size: 13px; }
#ficha-msg.ok, #cf-msg.ok { color: var(--ok); font-weight: 600; }
#ficha-msg.error, #cf-msg.error { color: var(--cancel); font-weight: 600; margin-top: 0; }
.ficha-ayuda { margin: 10px 0 0; font-size: 12px; color: #8a8782; }
.ficha-texto { margin: 0; font-size: 13.5px; color: var(--texto); line-height: 1.45; }
.ficha-vacio { margin: 0; font-size: 13px; color: #8a8782; }
.ficha-lista, .ficha-notas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ficha-lista li, .ficha-notas li { font-size: 13.5px; padding-bottom: 8px; border-bottom: 1px solid #f0eeea; }
.ficha-lista li:last-child, .ficha-notas li:last-child { border-bottom: none; padding-bottom: 0; }
.ficha-lista small, .ficha-notas small { display: block; font-size: 12px; color: #8a8782; margin-top: 2px; }
.ficha-notas p { margin: 0; line-height: 1.45; }
.ficha-nota-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.ficha-nota-form textarea { flex: 1; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #d6d3cd; border-radius: 8px; resize: vertical; }
.ficha-nota-form textarea:focus { outline: 2px solid var(--naranja); border-color: transparent; }
.ficha-link { font: inherit; font-size: inherit; color: var(--naranja-osc); background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; }
.ficha-dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.ficha-dl dt { font-size: 12px; color: #8a8782; }
.ficha-dl dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--texto); }
.ficha-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--borde); display: grid; gap: 10px; }
.ficha-timeline li { position: relative; font-size: 13.5px; display: flex; flex-direction: column; }
.ficha-timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: white; border: 2px solid var(--naranja); }
.ficha-t-fecha { font-size: 12px; font-weight: 700; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.ficha-timeline small { font-size: 11.5px; color: #a8a29e; }

@media (max-width: 700px) {
  .clientes-view { padding: 12px 16px 24px; }
  .cli-tab { padding: 9px 10px; font-size: 13.5px; }
  .cli-cuenta { margin-left: 0; }
  .ficha-campos, .ficha-dl { grid-template-columns: minmax(0, 1fr); }
}

/* Configuración: precios de productos */
.cf-form { display: flex; flex-direction: column; gap: 14px; max-width: 920px; }
.cf-tc { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--texto); }
.cf-tc input, .cf-tabla input { font: inherit; font-size: 14px; color: var(--texto); padding: 7px 9px; border: 1px solid #d6d3cd; border-radius: 8px; background: white; width: 96px; }
.cf-tc input:focus, .cf-tabla input:focus { outline: 2px solid var(--naranja); outline-offset: 0; border-color: transparent; }
.cf-tabla td { vertical-align: middle; }
.cf-calc { color: var(--texto-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Ficha: prescripciones */
.presc-nueva { font: inherit; font-size: 13px; font-weight: 700; color: var(--naranja); background: white; border: 1px dashed var(--naranja); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.presc-nueva:hover { background: #fff7f0; }
.presc-lista { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.presc-item { border: 1px solid var(--borde); border-radius: 10px; padding: 12px 14px; }
.presc-item.presc-editando { border-color: var(--naranja); }
.presc-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; }
.presc-cab span { font-size: 12.5px; color: var(--texto-2); }
.presc-pauta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.presc-paso { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: #f3f1ed; color: var(--texto-2); }
.presc-paso.actual { background: #fff1e6; color: #b4500f; font-weight: 700; }
.presc-obs { margin: 8px 0 0; font-size: 13px; color: var(--texto); background: #faf9f6; padding: 8px 10px; border-radius: 8px; }
.presc-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 8px; font-size: 11.5px; color: #8a8782; }
.presc-form h4 { margin: 14px 0 8px; font-size: 13px; font-weight: 700; color: var(--texto); }
.presc-form h4:first-child { margin-top: 0; }
.presc-form h4 small { font-weight: 400; color: #8a8782; margin-left: 4px; }
.presc-tabla { border-collapse: collapse; font-size: 13px; }
.presc-tabla th { text-align: left; font-weight: 600; color: var(--texto-2); padding: 3px 10px 3px 0; }
.presc-tabla td { padding: 3px 6px 3px 0; }
.presc-tabla input, .presc-obs-campo textarea { font: inherit; font-size: 14px; color: var(--texto); padding: 6px 8px; border: 1px solid #d6d3cd; border-radius: 8px; background: white; width: 90px; }
.presc-obs-campo { margin-top: 10px; }
.presc-obs-campo textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.presc-tabla input:focus, .presc-obs-campo textarea:focus { outline: 2px solid var(--naranja); outline-offset: 0; border-color: transparent; }
.presc-sup { border: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.presc-sup legend { font-size: 12.5px; font-weight: 600; color: var(--texto-2); padding: 0; margin-bottom: 6px; }
.presc-sup label { display: inline-flex; align-items: center; gap: 5px; }
.presc-msg.error { color: var(--cancel); font-weight: 600; }
.presc-botones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.presc-pdf { display: inline-block; position: relative; }
.presc-pdf-input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.presc-pdf:focus-within { outline: 2px solid var(--naranja); outline-offset: 2px; }
.presc-form .ag-aviso { margin: 6px 0; max-width: none; }
.presc-leida { margin: 0 0 6px; }

/* Evolución Clientes */
.evo-tabs { border-bottom: none; }
.evo-tabla td { vertical-align: top; }
.evo-tabla small, .evo-compras small { color: #77756f; font-size: 12px; }
.evo-fila { cursor: pointer; }
.evo-fila.abierta td { background: #fff7f0; }
.evo-estimado { color: #8a6d3b; font-style: italic; }
.evo-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.evo-ok { background: var(--ok-fondo); color: var(--ok); }
.evo-pend { background: var(--pend-fondo); color: var(--pend); }
.evo-cancel { background: var(--cancel-fondo); color: var(--cancel); }
.evo-neutro { background: #f3f1ed; color: #57534e; }
.evo-sit-texto { display: inline-block; margin-top: 4px; font-size: 13px; line-height: 1.35; }
.evo-detalle-fila > td { background: #fcfbf9; padding: 14px 16px 18px; }
.evo-detalle { display: flex; flex-direction: column; gap: 12px; }
.evo-detalle .ag-aviso { max-width: none; }
.evo-resumen { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--texto); display: flex; flex-direction: column; gap: 3px; }
.evo-linea { display: flex; flex-direction: column; gap: 6px; }
.evo-linea-fila { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 10px; }
.evo-linea-et { font-size: 12px; font-weight: 600; color: var(--texto-2); text-align: right; }
.evo-linea-pista { position: relative; height: 16px; background: #f1efea; border-radius: 4px; }
.evo-linea-marcas .evo-linea-pista { background: none; height: 20px; }
.evo-tramo { position: absolute; top: 2px; bottom: 2px; background: var(--naranja); border-radius: 3px; box-shadow: inset -1px 0 0 white; }
.evo-tramo.est { background: repeating-linear-gradient(135deg, #ffb27f 0 5px, #ffd2b3 5px 10px); }
.evo-tramo.sup { background: #6b8f71; }
.evo-tramo.sup.est { background: repeating-linear-gradient(135deg, #8fb196 0 5px, #c4d8c8 5px 10px); }
.evo-hoy { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--texto); }
.evo-marca { position: absolute; top: 0; transform: translateX(-50%); font-size: 14px; line-height: 20px; }
.evo-linea-ejes { position: relative; display: flex; justify-content: space-between; font-size: 11.5px; color: #8a8782; min-height: 16px; }
.evo-eje-hoy { position: absolute; transform: translateX(-50%); font-weight: 700; color: var(--texto); white-space: nowrap; }
.evo-leyenda { margin: 2px 0 0; font-size: 11.5px; color: #8a8782; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.evo-tramo-muestra { display: inline-block; width: 18px; height: 9px; border-radius: 2px; background: var(--naranja); }
.evo-tramo-muestra.est { background: repeating-linear-gradient(135deg, #ffb27f 0 4px, #ffd2b3 4px 8px); }
.evo-tramo-muestra.sup { background: #6b8f71; }
.evo-detalle .presc-nueva { align-self: flex-start; }
@media (max-width: 640px) {
  .evo-linea-fila { grid-template-columns: 70px minmax(0, 1fr); }
}
.evo-inicio { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; background: white; border: 1px solid var(--borde); border-radius: 10px; padding: 12px 14px; }
.evo-inicio .ficha-campo { min-width: 200px; }
.evo-inicio .ficha-ayuda { flex-basis: 100%; margin: 0; }
.evo-btn { font: inherit; font-size: 13px; font-weight: 700; color: white; background: var(--naranja); border: none; border-radius: 8px; padding: 9px 14px; cursor: pointer; }
.evo-btn:hover { background: #e5691f; }
.evo-btn-sec { color: var(--texto-2); background: #efede8; }
.evo-btn:disabled { cursor: not-allowed; opacity: .7; }
.evo-btn:disabled:hover { background: #efede8; }
.evo-atajos { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.evo-atajo { font: inherit; font-size: 12px; color: var(--texto); background: #f6f4f0; border: 1px solid var(--borde); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.evo-atajo:hover { border-color: var(--naranja); }
.evo-h4 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--texto); }
.evo-consultas { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.evo-consultas li { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--borde); background: white; }
.evo-consultas small { color: #77756f; }
.evo-c-cumplida { border-color: #bbe5c8 !important; background: var(--ok-fondo) !important; }
.evo-c-agendada { border-color: #c7d7f0 !important; background: #eef4fd !important; }
.evo-c-vencida { border-color: #f5c2c2 !important; background: var(--cancel-fondo) !important; }
.evo-pista-medico { background: none !important; border-bottom: 1px dashed #d6d3cd; border-radius: 0; }
.evo-est-vencida { color: var(--cancel); font-weight: 800; }
.evo-est-pendiente { color: #8a8782; }
.evo-sin-cliente { margin-top: 12px; font-size: 13px; }
.evo-sin-cliente summary { cursor: pointer; font-weight: 600; color: var(--texto-2); }
.evo-sin-cliente ul { margin: 6px 0 0; padding-left: 18px; }
.evo-btn-wa { background: #16a34a; }
.evo-btn-wa:hover { background: #15803d; }
.evo-pedido { color: #1d4ed8 !important; }
/* Evolución: gráfico de peso */
.pg { margin: 0; background: white; border: 1px solid var(--borde); border-radius: 10px; padding: 12px 14px; }
.pg figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13.5px; color: var(--texto); }
.pg figcaption small { color: #8a8782; }
.pg svg { display: block; width: 100%; height: auto; max-width: 720px; margin-top: 6px; overflow: visible; }
.pg .ficha-ayuda { margin-top: 4px; }
.pg-grid { stroke: #ece9e4; stroke-width: 1; }
.pg-eje { font-size: 11px; fill: #8a8782; font-variant-numeric: tabular-nums; }
.pg-obj { fill: var(--ok-fondo); }
.pg-obj-linea { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 4 3; }
.pg-obj-txt { font-size: 11.5px; fill: var(--texto-2); font-weight: 600; }
.pg-linea { fill: none; stroke: var(--naranja); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pg-marca { fill: var(--naranja); stroke: white; stroke-width: 2; }
.pg-hit { fill: transparent; }
.pg-punto:hover .pg-marca { r: 6; }
.pg-valor { font-size: 12px; font-weight: 700; fill: var(--texto); }
/* Ficha: controles de peso */
.cp-sub { font-size: 12px; font-weight: 400; color: #8a8782; }
.cp-lista { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cp-bloque { border: 1px solid var(--borde); border-radius: 10px; padding: 9px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.cp-bloque small { color: #77756f; }
.cp-estado { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.cp-buscar { display: flex; gap: 8px; margin-top: 10px; }
.cp-buscar input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #d6d3cd; border-radius: 8px; }
.cp-buscar button { font: inherit; font-size: 13px; font-weight: 700; color: white; background: var(--naranja); border: none; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.pg-inicio { stroke: #a8a29e; stroke-width: 1; stroke-dasharray: 3 3; }
.pg-trat { margin: 6px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--texto); }
.pg-trat small { color: #8a8782; margin-left: 4px; }

/* Clientes: posibles duplicados */
.dup-vista { display: flex; flex-direction: column; gap: 12px; }
.dup-vista[hidden] { display: none; }
.dup-explica { max-width: 110ch; }
.dup-par { background: white; border: 1px solid var(--borde); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.dup-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--texto-2); }
.dup-alta { background: var(--cancel-fondo); color: var(--cancel); }
.dup-media { background: var(--pend-fondo); color: var(--pend); }
.dup-baja { background: #f3f1ed; color: #57534e; }
.dup-tabla th[scope="row"] { font-weight: 600; color: var(--texto-2); width: 150px; }
.dup-tabla thead th { font-size: 13.5px; color: var(--texto); }
.dup-ok { color: var(--ok); font-weight: 700; font-size: 12px; white-space: nowrap; }
.dup-no { color: var(--cancel); font-weight: 700; font-size: 12px; white-space: nowrap; }
.dup-evidencia { margin: 0; padding-left: 4px; list-style: none; font-size: 12.5px; color: var(--texto); }
.dup-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.dup-historial { font-size: 13px; }
.dup-historial summary { cursor: pointer; font-weight: 600; color: var(--texto-2); }
.dup-historial ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.cf-tomas { margin-top: 10px; font-weight: 500; }
/* Evolución: tipo de consulta debajo de cada 🩺 */
.evo-fila-medico .evo-linea-pista { height: 40px; }
.evo-turno { display: flex; flex-direction: column; align-items: center; z-index: 1; }
.evo-tipo { display: inline-block; font-size: 10.5px; font-weight: 700; line-height: 1.3; padding: 0 5px; border-radius: 999px; white-space: nowrap; font-style: normal; }
.evo-tipo-evaluacion { background: #e0ecfb; color: #1d4ed8; }
.evo-tipo-seguimiento { background: var(--ok-fondo); color: var(--ok); }
.evo-tipo-reinicio { background: #f3e8ff; color: #7e22ce; }
.evo-tipo-otro { background: #f3f1ed; color: #57534e; }
.evo-leyenda .evo-tipo { font-size: 10px; }
.evo-turno.evo-borde-izq { transform: none; align-items: flex-start; }
.evo-turno.evo-borde-der { transform: translateX(-100%); align-items: flex-end; }
.evo-leyenda { gap: 4px 14px; }
.evo-leyenda > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* Facturación total: arriba de las tarjetas de Ventas PNK, destacada */
.card.card-total { margin-bottom: 6px; background: #fff7ed; border-color: #fed7aa; }
.card.card-total .value { font-size: 17px; }
.ag-kpi.k-total { --acento: var(--naranja); background: #fff7ed; }

/* Etiquetas de estado del paciente (Evolución Clientes) */
.evo-et { border: 1px solid transparent; }
.evo-et-nuevo { background: #e0f2fe; color: #075985; }
.evo-et-reinicio { background: #f3e8ff; color: #6b21a8; }
.evo-et-en_tratamiento { background: var(--ok-fondo); color: var(--ok); }
.evo-et-por_terminar { background: var(--pend-fondo); color: var(--pend); }
.evo-et-atrasado { background: #ffedd5; color: #9a3412; }
.evo-et-terminado { background: #dcfce7; color: #166534; border-color: #86efac; }
.evo-et-abandono { background: var(--cancel-fondo); color: var(--cancel); }
.evo-et-pausa { background: #f1f5f9; color: #334155; }
.evo-et-sin_datos { background: #f3f1ed; color: #57534e; }
.evo-et-ex_erp { background: #eef2f6; color: #475569; }
.evo-et-mano { font-weight: 400; opacity: .8; }
.evo-razon { color: #6b6964; display: inline-block; max-width: 30ch; line-height: 1.3; }
.evo-etiqueta { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 10px 12px; margin-bottom: 12px;
  background: #fafaf9; border: 1px solid var(--borde); border-radius: 10px; }
.evo-etiqueta-actual { flex-basis: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.evo-etiqueta-nota { flex: 1 1 200px; }
.evo-etiqueta-nota input { width: 100%; }
.evo-etiqueta .ficha-ayuda { flex-basis: 100%; margin: 0; }

/* Tarjetas de Clientes que filtran la tabla */
.ag-kpi-boton { font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.ag-kpi-boton:hover:not(:disabled) { border-color: var(--acento, var(--naranja)); }
.ag-kpi-boton:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }
.ag-kpi-boton:disabled { cursor: default; }
.ag-kpi-boton.marcada { border-color: var(--acento, var(--naranja)); box-shadow: 0 0 0 2px var(--acento, var(--naranja)) inset; background: #fffaf5; }

/* Filtros por columna (public/filtrosColumnas.js) */
.fc-th-in { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.fc-orden { font: inherit; color: inherit; background: none; border: 0; padding: 2px 0; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.fc-orden:hover { color: var(--naranja); }
.fc-flecha { display: inline-block; min-width: .8em; margin-left: 2px; color: var(--naranja); }
.fc-flecha-libre { color: #b8b5ae; }
.fc-orden:hover .fc-flecha-libre { color: var(--naranja); }
.fc-ord { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-ord-btn { font: inherit; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--borde); background: white; color: var(--texto-2); cursor: pointer; }
.fc-ord-btn:hover { border-color: var(--naranja); color: var(--naranja-osc); }
.fc-ord-btn.activo { background: var(--texto); border-color: var(--texto); color: white; }
.fc-ord-btn:focus-visible { outline: 2px solid var(--naranja); outline-offset: 1px; }
.fc-abrir { font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 5px; border: 1px solid transparent; background: none; color: #8a8a85; cursor: pointer; }
.fc-abrir:hover { background: #f3f1ed; color: var(--texto); }
.fc-abrir.activo { background: var(--naranja); color: white; }
.fc-orden:focus-visible, .fc-abrir:focus-visible, .fc-chip:focus-visible { outline: 2px solid var(--naranja); outline-offset: 1px; }
.fc-pop { position: absolute; z-index: 60; background: white; border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14);
  padding: 8px 10px 10px; max-height: 70vh; overflow: auto; font-size: 13px; }
.fc-pop-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.fc-cerrar { border: 0; background: none; cursor: pointer; font-size: 14px; color: #6b6964; padding: 4px; }
.fc-faceta { border: 0; margin: 0; padding: 6px 0 4px; border-top: 1px solid #f0efec; }
.fc-faceta:first-of-type { border-top: 0; }
.fc-faceta legend { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #8a8a85; padding: 0; margin-bottom: 4px; }
.fc-buscar { width: 100%; margin-bottom: 4px; padding: 5px 8px; border: 1px solid var(--borde); border-radius: 6px; font: inherit; }
.fc-opciones { display: flex; flex-direction: column; max-height: 240px; overflow: auto; }
.fc-opcion { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.fc-opcion:hover { background: #f7f6f3; }
.fc-opcion[hidden] { display: none; }
.fc-opcion small { color: #8a8a85; font-variant-numeric: tabular-nums; }
.fc-todos { margin-top: 4px; border: 0; background: none; color: var(--naranja); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.fc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.fc-chips:not(:has(button)) { display: none; }
.fc-chips > span { display: contents; }
.fc-chip { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid #fed7aa; background: #fff7ed; color: #7c2d12; cursor: pointer; }
.fc-chip:hover { border-color: var(--naranja); }
.fc-chip-tarjeta { background: #fef3c7; border-color: #fcd34d; color: #78350f; }
.fc-limpiar { font: inherit; font-size: 12px; border: 0; background: none; color: #6b6964; text-decoration: underline; cursor: pointer; }
@media (max-width: 700px) {
  /* En el celular la tabla va en tarjetas: los encabezados con filtro quedan como una fila de botones */
  .ag-tabla thead[data-fc] { display: block; }
  .ag-tabla thead[data-fc] tr { display: flex; flex-wrap: wrap; gap: 4px 10px; border: 0; padding: 0; margin-bottom: 8px; }
  .ag-tabla thead[data-fc] th { border: 0; padding: 2px 0; }
}

/* Clientes → Calendario */
.cal-vista[hidden] { display: none; }
.cal-vista { display: flex; flex-direction: column; gap: 14px; }
.cal-lectura .ag-sub { max-width: 90ch; }
.cal-leer-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.cal-leer { font: inherit; font-size: 13.5px; font-weight: 700; color: white; background: var(--naranja); border: none; border-radius: 8px; padding: 9px 16px; cursor: pointer; }
.cal-leer:hover:not(:disabled) { background: #e5691f; }
.cal-leer:disabled { opacity: .6; cursor: progress; }
.cal-leer:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }
.cal-estado { font-size: 13px; color: var(--texto-2); }
.cal-cancelados { color: var(--cancel); }
.cal-no { background: #f4f3f0; color: var(--texto-2); }
.cal-turnos td small { color: var(--texto-2); }
.cf-letras input { font: inherit; font-size: 13.5px; padding: 6px 8px; border: 1px solid var(--borde); border-radius: 7px; }
.cf-letras input[name="letra"] { width: 4.5em; text-transform: uppercase; }
.cf-letras input[name="medico"] { width: 100%; min-width: 12em; }
.cf-agregar { margin-top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Perfil del paciente en Kaptor (Clientes → Kaptor, ficha, Evolución) */
.kp-actualizar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.kp-perfil { margin-top: 12px; }
.kp-perfil-in { display: flex; flex-direction: column; gap: 12px; }
.kp-datos { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.kp-datos dd small { font-weight: 400; color: #8a8782; }
.kp-alerta { color: var(--cancel); }
.ct-marca.kp-debe { background: var(--cancel-fondo); color: var(--cancel); }
.kp-nota { background: #fcfbf9; border: 1px solid var(--borde); border-radius: 8px; padding: 10px 12px; }
.kp-nota span { display: block; font-size: 12px; color: #8a8782; margin-bottom: 4px; }
.kp-nota p { margin: 0; font-size: 13.5px; line-height: 1.45; }
.kp-notas summary, .kp-perfil-evo summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--texto); }
.kp-notas summary:focus-visible, .kp-perfil-evo summary:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }
.kp-historial { margin-top: 8px; }
.kp-perfil-evo > div { margin-top: 10px; }

/* Reportes → Pronokal, toda la empresa */
.content-extra .em-aviso { grid-column: 1 / -1; max-width: none; }
.em-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.em-cards .sub { display: block; font-size: 11.5px; color: #8a8782; margin-top: 2px; }
.em-agendas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.em-agendas li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.em-agendas small { color: #8a8782; }
.content-extra .em-tabla td small { display: block; color: #8a8782; }


/* Configuración: precios de Kaptor y catálogo */
.cf-kaptor { display: block; font-size: 11.5px; color: #8a8782; margin-top: 3px; }
.cf-tabla input[readonly] { background: #f6f5f2; color: var(--texto-2); }
.cf-kaptor-sel { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--borde); border-radius: 7px; max-width: 230px; background: white; }
.cf-catalogo { display: flex; flex-direction: column; gap: 8px; }
.cf-cat-h { margin: 12px 0 0; font-size: 13.5px; font-weight: 700; color: var(--texto); }
.cf-cat-productos { max-height: 360px; overflow-y: auto; }
.cf-cat-lista { margin: 0; padding-left: 18px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }

/* Evolución: botón para traer datos de Kaptor */
.evo-actualizar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* ⓘ de Evolución: al lado de las tarjetas-botón, de las pestañas y de la búsqueda */
.ag-kpi-envuelta { position: relative; display: flex; }
.ag-kpi-envuelta > .ag-kpi-boton { flex: 1; padding-right: 30px; }
.ag-kpi-envuelta > .info-btn { position: absolute; top: 13px; right: 12px; }
.evo-info-tabs { align-self: center; }
.evo-buscar-wrap { flex: 1 1 280px; display: flex; align-items: center; gap: 6px; }
.cli-toolbar .evo-buscar-wrap input[type="search"] { flex: 1 1 auto; min-width: 0; }

/* Clientes → Mapa */
.mp-vista { display: flex; flex-direction: column; gap: 14px; }
.mp-vista[hidden] { display: none; }
.mp-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.mp-filtros input[type="search"], .mp-filtros select { font: inherit; font-size: 13.5px; padding: 7px 10px; border: 1px solid var(--borde); border-radius: 8px; background: white; color: var(--texto); }
.mp-filtros input[type="search"] { flex: 1 1 220px; min-width: 0; }
.mp-leyenda { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.mp-ley { font: inherit; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--borde); background: white; color: var(--texto); cursor: pointer; }
.mp-ley small { color: var(--texto-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.mp-ley.apagado { opacity: .45; text-decoration: line-through; }
.mp-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
.mp-mapa { height: 560px; border-radius: 10px; border: 1px solid var(--borde); background: #f4f3f0; z-index: 0; }
.mp-lado h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--texto); }
.mp-lado h4 + ol { margin-bottom: 18px; }
.mp-pin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid white; box-shadow: 0 0 0 1px rgba(0,0,0,.35); box-sizing: border-box; flex: none; }
.mp-pin-cal { border-radius: 2px; background: white; border: 3px solid var(--c); box-shadow: 0 0 0 1px white; }
.mp-pin-aprox { opacity: .55; }
.mp-grupo { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(28,28,30,.82); color: white; font-size: 12.5px; font-weight: 700; border: 3px solid rgba(255,255,255,.9); box-sizing: border-box; font-variant-numeric: tabular-nums; }
.mp-popup { font-size: 13px; color: var(--texto); min-width: 200px; }
.mp-popup strong { display: block; font-size: 14px; }
.mp-popup p { margin: 6px 0; }
.mp-popup dl { margin: 6px 0; display: grid; gap: 2px; }
.mp-popup dl div { display: flex; gap: 6px; }
.mp-popup dt { color: var(--texto-2); }
.mp-popup dd { margin: 0; font-weight: 600; }
.mp-popup-estado { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--texto-2); margin-top: 2px; }
.mp-popup-estado::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.mp-aprox { font-size: 12px; color: var(--pend); }
.mp-corregir { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--borde); background: white; color: var(--texto); cursor: pointer; white-space: nowrap; }
.mp-corregir:hover { border-color: var(--texto-2); }
.mp-falta { color: var(--texto-2); }
.mp-tabla small { display: block; font-size: 12px; color: var(--texto-2); }
.mp-tabs { margin-bottom: 8px; }
@media (max-width: 900px) {
  .mp-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .mp-mapa { height: 420px; }
}
.mp-base { filter: grayscale(.85) brightness(1.06) contrast(.92); }

/* Kaptor: fechas de cada compra cuando hay varias */
.kp-compras { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; font-size: 12px; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.kp-compras li { white-space: nowrap; }
.kp-compra-n { display: inline-block; min-width: 2.2em; font-weight: 700; color: #8a8782; }
.kp-compra-monto { color: #8a8782; }
.kp-compra-resumen { font-style: italic; }
.kp-compra-marca { font-size: 10px; font-style: normal; padding: 0 5px; border-radius: 8px; background: var(--pend-fondo); color: var(--pend); }
.kp-compra-resto { color: #8a8782; font-style: italic; }

/* ── Módulo Canales (Parte 1) ───────────────────────────────────────────── */
.can-periodo { display: flex; align-items: center; gap: 8px; }
.can-periodo label { font-size: 13px; color: var(--texto-2); font-weight: 600; }
.can-periodo select { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--borde); border-radius: 10px; background: white; color: var(--texto); cursor: pointer; }
.can-tabs { margin: 14px 0 0; }
.can-panel { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.can-panel[hidden] { display: none; }
.can-general-cards { align-items: stretch; }
.can-general-cards .panel { display: flex; flex-direction: column; gap: 8px; }
.can-inline-total { font-weight: 400; color: var(--texto-2); font-size: 11px; }
.can-nota { font-size: 12px; color: var(--texto-2); margin: 8px 0 0; line-height: 1.45; }
.can-nota code { background: #f4f3f0; border-radius: 4px; padding: 0 4px; font-size: 11px; }
.can-aclaracion { font-size: 12px; color: var(--texto-2); margin: 2px 0 0; line-height: 1.45; }
.can-placeholder p { font-size: 14px; color: var(--texto-2); line-height: 1.5; margin: 6px 0 0; max-width: 90ch; }
.can-placeholder code { background: #f4f3f0; border-radius: 4px; padding: 0 4px; font-size: 12px; }
.can-por-conectar { opacity: 0.75; }
.can-por-conectar .value { font-size: 15px; color: var(--texto-2); }
.gp-google .card { min-width: 0; }
@media (max-width: 760px) {
  .can-general-cards { grid-template-columns: 1fr; }
}

/* Canales → Landing (recorrido de conversión) */
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.can-recorrido { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin-top: 4px; }
.can-etapa { flex: 1 1 120px; min-width: 110px; background: #fcfbf9; border: 1px solid var(--borde); border-top: 3px solid var(--naranja); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.can-etapa-nombre { font-size: 11px; font-weight: 700; color: var(--texto-2); text-transform: uppercase; letter-spacing: 0.02em; }
.can-etapa-valor { font-size: 22px; font-weight: 800; color: var(--texto); letter-spacing: -0.02em; }
.can-etapa-badge { align-self: flex-start; font-size: 10px; font-weight: 700; background: #f1efe9; color: var(--texto-2); border-radius: 20px; padding: 1px 8px; }
.can-etapa-fuente { font-size: 10px; color: #9a9a95; }
.can-etapa-vacia { border-top-color: #cfccc6; opacity: 0.8; }
.can-etapa-vacia .can-etapa-valor { font-size: 14px; color: #9a9a95; font-weight: 700; }
.can-flecha { align-self: center; color: #c7c4be; font-size: 20px; font-weight: 700; }
.can-bloque .can-funnel-row { display: grid; grid-template-columns: 1fr auto 56px; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f1efe9; }
.can-bloque .can-funnel-row:last-child { border-bottom: none; }
.can-funnel-nombre { font-size: 13px; color: var(--texto); }
.can-funnel-valor { font-size: 15px; font-weight: 700; color: var(--texto); white-space: nowrap; }
.can-funnel-valor small { font-size: 10px; font-weight: 500; color: #9a9a95; margin-left: 3px; }
.can-funnel-conv { font-size: 12px; font-weight: 700; color: var(--texto-2); text-align: right; }
@media (max-width: 760px) {
  .can-flecha { transform: rotate(90deg); align-self: center; }
  .can-recorrido { flex-direction: column; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Canales → Competencia y representantes */
.can-cuenta-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.can-cuenta-form input, .can-cuenta-form select { font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 9px; background: white; color: var(--texto); }
.can-cuenta-form input#can-c-nombre { flex: 1 1 180px; }
.can-cuenta-form input#can-c-url { flex: 2 1 260px; }
.can-cuenta-form .cal-leer { white-space: nowrap; }
.can-cuentas-lista { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.can-cuenta-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 10px; background: #fcfbf9; }
.can-cuenta-cat { font-size: 16px; width: 26px; text-align: center; flex: none; }
.can-cuenta-datos { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.can-cuenta-nombre { font-size: 14px; font-weight: 700; color: var(--texto); text-decoration: none; }
.can-cuenta-nombre:hover { text-decoration: underline; }
.can-cuenta-meta { font-size: 11px; color: var(--texto-2); }
.can-cuenta-adlib { font-size: 12px; font-weight: 600; color: var(--naranja); text-decoration: none; white-space: nowrap; }
.can-cuenta-adlib:hover { text-decoration: underline; }
.can-cuenta-del { font: inherit; font-size: 13px; color: #b0ada7; background: none; border: none; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.can-cuenta-del:hover { color: #dc2626; background: #fdebeb; }
.can-cat-propia { color: #2563eb; } .can-cat-competidor { color: #ea580c; } .can-cat-representante { color: #16a34a; }
.can-pub-filtros { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.can-pub-filtros select, .can-pub-filtros input { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--borde); border-radius: 9px; background: white; color: var(--texto); }
.can-f-fecha { font-size: 11px; color: var(--texto-2); display: inline-flex; align-items: center; gap: 4px; }
.can-galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 8px; }
.can-pub { border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; background: white; display: flex; flex-direction: column; }
.can-pub-img { display: block; aspect-ratio: 1 / 1; background: #f4f3f0; overflow: hidden; }
.can-pub-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.can-pub-noimg { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #9a9a95; font-size: 12px; text-decoration: none; text-align: center; }
.can-pub-cuerpo { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.can-pub-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.can-pub-cuenta { font-size: 11px; font-weight: 700; color: var(--texto-2); }
.can-pub-tipo { font-size: 10px; font-weight: 700; border-radius: 20px; padding: 1px 8px; white-space: nowrap; }
.can-tipo-ok { background: #e7f6ec; color: #16a34a; } .can-tipo-warn { background: #fdf0e6; color: #ea580c; } .can-tipo-neutro { background: #f1efe9; color: #8a8782; }
.can-pub-fecha { font-size: 11px; color: #9a9a95; }
.can-pub-texto { font-size: 12px; color: var(--texto); margin: 2px 0 0; line-height: 1.4; }
.can-pub-metricas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.can-pub-metrica { font-size: 11px; font-weight: 600; color: var(--texto-2); }
.can-pub-link { font-size: 11px; font-weight: 600; color: var(--naranja); text-decoration: none; margin-left: auto; }
.can-pub-link:hover { text-decoration: underline; }

/* Canales → Orgánico (instructivo por conectar) */
.can-pasos { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.can-pasos li { font-size: 13px; color: var(--texto-2); line-height: 1.45; }
.can-pasos code { background: #f4f3f0; border-radius: 4px; padding: 0 4px; font-size: 11px; }

/* Registro de contactos (Evolución Clientes): "¿Cómo te fue?" e historial */
.evo-resultado { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--borde); border-left: 3px solid var(--naranja); border-radius: 10px; background: #fcfbf9; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.evo-res-tit { font-size: 13px; }
.evo-res-botones { display: flex; flex-wrap: wrap; gap: 6px; }
.evo-res-botones .ag-btn.marcada { outline: 2px solid var(--naranja); outline-offset: 1px; }
.evo-res-extra { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.evo-res-extra label, .evo-res-canal { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.evo-resultado input[name="nota"] { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--borde); border-radius: 8px; width: 100%; box-sizing: border-box; }
.evo-res-pie { display: flex; align-items: center; gap: 10px; }
.evo-historial { margin: 4px 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.evo-historial .ficha-link { margin-left: 6px; font-size: 12px; }
.evo-foco-avance { border-color: var(--naranja); }
