/* ============================================================
   dashboard.css — estilos específicos que no viven en el DS base.
   Pace cards, month tabs, chart legends, sync UI.
   ============================================================ */

/* ── View container ── */
.view { display: none; }
.view.visible { display: block; }

/* ── Strip de KPIs acumulados (modo Acumulado del gráfico combinado) ── */
.cum-kpi-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.cum-kpi-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  text-align: center;
}
.cum-kpi-card-current {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.cum-kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
}
.cum-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}
.cum-kpi-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* KPIs YoY se expanden de 4 a N meses según haya datos.
   auto-fit + minmax mantiene cards parejas y baja a 2x2 / 3x2 si hace falta. */
#kpi-yoy {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.section-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 16px;
  max-width: 720px;
}

/* ── Chart helpers ── */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap.h-200 { height: 200px; }
.chart-wrap.h-220 { height: 220px; }
.chart-wrap.h-240 { height: 240px; }
.chart-wrap.h-260 { height: 260px; }
.chart-wrap.h-300 { height: 300px; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
}
.chart-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-2);
}
.chart-legend .ld  { display: inline-block; width: 14px; height: 2.5px; border-radius: 2px; }
.chart-legend .lsq { display: inline-block; width: 10px; height: 10px;  border-radius: 2px; }

.sub-val    { font-size: 13px; color: var(--muted); font-weight: 400; display: block; margin-top: 2px; }

/* ── Canal pip ── */
.ch-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.ch-pip {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Month tabs (dentro de Objetivos) ── */
.month-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.month-tab {
  font-size: 13px;
  font-weight: 500;
  padding: 9px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  font-family: inherit;
}
.month-tab.past {
  color: var(--text);
  font-weight: 600;
}
.month-tab:hover { background: #F8FAFC; color: var(--text); border-color: #cbd5e1; }
.month-tab.active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: #fca5a5;
  font-weight: 700;
}
.month-tab.active-current {
  background: var(--amber-soft);
  color: var(--amber-text);
  border-color: var(--amber);
  font-weight: 700;
}
.month-tab.future { color: var(--muted); font-weight: 400; }
.month-tab.future:hover { color: var(--text-2); }
.month-tab.future.active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: #fca5a5;
  font-weight: 700;
}
.mpanel { display: none; }
.mpanel.visible { display: block; }

/* ── Period note ── */
.period-note {
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--amber-text);
  margin-bottom: 16px;
}

/* ── Pace cards ── */
.pace-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.pace-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--sh);
  position: relative;
}
.pace-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.pace-card-head .pace-lbl { margin-bottom: 0; }
.pace-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pace-badge.green { background: var(--green-soft);  color: var(--green-text); }
.pace-badge.amber { background: var(--amber-soft);  color: var(--amber-text); }
.pace-badge.red   { background: var(--red-soft);    color: var(--red-text);   }
.pace-badge.brand { background: var(--brand-soft);  color: var(--brand-text); }
.pace-badge.muted { background: #f1f5f9; color: var(--muted); }

.pace-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
}
.pace-val {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}
.pace-val.red    { color: var(--red); }
.pace-val.green  { color: var(--green); }
.pace-val.amber  { color: var(--amber); }
.pace-val.brand  { color: var(--brand); }
.pace-sub {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 4px;
}

.pace-footnote {
  margin-top: 10px;
  background: #F8FAFC;
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* ── Sync indicator (usa .topbar-pill como base, agrega estados) ── */
.topbar-pill.sync      { transition: background .2s, color .2s; }
.topbar-pill.sync.ok   { background: var(--green-soft); color: var(--green-text); }
.topbar-pill.sync.loading { background: var(--amber-soft); color: var(--amber-text); }
.topbar-pill.sync.err  { background: var(--red-soft);   color: var(--red-text); }
.topbar-pill.sync .sync-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.topbar-pill.sync.loading .sync-dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ── Channel select (desplegable de canal en el gráfico combinado) ── */
.ch-select {
  height: 32px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 100px;
}
.ch-select:hover { border-color: var(--brand); }
.ch-select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(185,28,28,.12); }

/* ── View toggle (Semanal / Mensual) ── */
.view-toggle {
  display: inline-flex;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.vt-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  letter-spacing: 0.02em;
}
.vt-btn.active {
  background: #b91c1c;
  color: #ffffff;
}
.vt-btn:not(.active):hover {
  background: #f8fafc;
  color: var(--text);
}

/* ── Weekly alert rows — Alerta semanal colapsable ── */
.wa-panel { }
.wa-rows  { display: flex; flex-direction: column; }

/* Fila resumen (clickeable) */
.wa-row {
  display: grid;
  /* label | bar | amount | pct | gap | badge | chevron */
  grid-template-columns: 90px 1fr 130px 58px 110px 100px 22px;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background .12s;
}
.wa-row:hover               { background: #f8fafc; }
.wa-row:last-of-type        { border-bottom: none; }

.wa-row-current {
  background: var(--amber-soft) !important;
  border-bottom-color: transparent;
  border-radius: var(--r-sm);
  margin: 2px 0;
}
.wa-row-current:hover { background: #fde68a44 !important; }

.wa-row-future { cursor: default; }
.wa-row-future:hover { background: transparent; }

/* Label: "Sem. N" + rango de fechas */
.wa-lbl  { display: flex; flex-direction: column; gap: 2px; }
.wa-sem  { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1; }
.wa-wnum { font-size: 12px; color: var(--muted); letter-spacing: 0.01em; }

/* Barra de progreso */
.wa-track {
  position: relative;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.wa-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}

.wa-amount { font-size: 14px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.wa-pct    { font-size: 14px; font-weight: 700; text-align: right; }
.wa-gap    { text-align: right; font-size: 13px; }

/* Chevron */
.wa-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: transform .2s ease, color .15s;
}
.wa-chevron-open  { transform: rotate(90deg); color: var(--brand); }
.wa-chevron-hide  { visibility: hidden; }

/* Panel de detalle por canal (oculto por defecto) */
.wa-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.wa-detail.wa-detail-open {
  max-height: 600px;
}
.wa-detail-inner {
  padding: 12px 8px 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}

/* Cabecera del detalle */
.wa-ch-head {
  display: grid;
  grid-template-columns: 12px 120px 1fr 90px 50px 100px;
  gap: 10px;
  padding: 0 4px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.wa-ch-head .r { text-align: right; }

/* Fila por canal en el detalle */
.wa-ch-row {
  display: grid;
  grid-template-columns: 12px 120px 1fr 90px 50px 100px;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid #f1f5f9;
}
.wa-ch-row:last-of-type { border-bottom: none; }

.wa-ch-name { font-size: 14px; font-weight: 500; color: var(--text); }
.wa-ch-track {
  position: relative; height: 5px;
  background: #e2e8f0; border-radius: 3px; overflow: hidden;
}
.wa-ch-fill {
  position: absolute; left: 0; top: 0;
  height: 100%; border-radius: 3px;
  transition: width .3s ease;
}
.wa-ch-amt  { font-size: 14px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.wa-ch-pct  { font-size: 14px; font-weight: 700; text-align: right; }
.wa-ch-tgt  { font-size: 13px; color: var(--muted); text-align: right; }

/* Footer del detalle */
.wa-detail-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-2);
}

/* ── Panel de alertas: objetivo cumplido + brecha a mitad de mes ── */
.obj-alerts-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.obj-alert {
  border-radius: var(--r);
  border: 1px solid transparent;
  padding: 14px 16px;
  font-size: 13px;
}
.obj-alert-green {
  background: var(--green-soft);
  border-color: #6ee7b7;
}
.obj-alert-amber {
  background: var(--amber-soft);
  border-color: #fbbf24;
}

.obj-alert-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.obj-alert-icon { font-size: 16px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.obj-alert-text { flex: 1; }
.obj-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}
.obj-alert-sub {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.obj-alert-rows {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.obj-alert-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}
.obj-alert-sug {
  margin-top: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,0.7);
  border-radius: var(--r-sm);
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 12px;
  color: var(--text);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}

/* ── Barra de avance con escala de días y marcador de hoy ── */

/* Wrapper que reemplaza a pb-bg como flex-child */
.pb-outer {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 56px;
}

/* pb-bg dentro de pb-outer: ocupa ancho completo (no flex:1) */
.pb-outer .pb-bg {
  flex: none !important;
  width: 100%;
  min-width: 0;
}

/* Contenedor relativo para posicionar el pin sobre la barra */
.pb-ruler {
  position: relative;
  padding-top: 18px;   /* espacio para número + triángulo */
}

/* Contenedor del pin: número arriba + triángulo abajo */
.pb-today-pin {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
}

/* Número del día */
.pb-today-day {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* Triángulo apuntando hacia la barra */
.pb-today-tri {
  width: 0;
  height: 0;
  border-left:  4px solid transparent;
  border-right: 4px solid transparent;
  border-top:   6px solid #0f172a;
}

/* Escala "1 … 31" debajo de la barra */
.pb-day-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
  user-select: none;
  letter-spacing: 0.01em;
}

/* ── Detalle semanal por canal (expandible desde la tabla de objetivos) ── */

/* Celda del nombre del canal con botón › */
.ch-cell {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Botón chevron por canal */
.ch-weeks-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  padding: 0;
  transition: background .1s, color .15s, transform .2s ease;
}
.ch-weeks-toggle:hover { background: var(--border); color: var(--brand); }
.ch-weeks-toggle.open  { transform: rotate(90deg); color: var(--brand); }

/* Fila detalle (oculta por defecto vía style="display:none") */
.ch-weeks-row td { padding: 0 !important; border: none !important; }

/* Contenedor interno con acento lateral */
.ch-weeks-inner {
  padding: 10px 16px 12px 36px;
  background: #f8fafc;
  border-left: 3px solid var(--brand);
  border-bottom: 1px solid var(--border);
}

/* Encabezado del desplegable */
.ch-weeks-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Fila semanal dentro del desplegable */
.ch-week-row {
  display: grid;
  /* label | bar | real+meta | pct | badge */
  grid-template-columns: 82px 1fr 1fr 46px 88px;
  align-items: center;
  gap: 10px;
  padding: 5px 4px;
  border-bottom: 1px solid #f1f5f9;
}
.ch-week-row:last-child { border-bottom: none; }

.ch-week-current {
  background: var(--amber-soft);
  border-radius: 4px;
  border-bottom-color: transparent;
}
.ch-week-future { opacity: 0.5; }

/* Etiqueta Sem N + rango */
.ch-wk-lbl   { display: flex; flex-direction: column; gap: 1px; }
.ch-wk-sem   { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1; }
.ch-wk-range { font-size: 12px; color: var(--muted); }

/* Barra */
.ch-wk-track {
  position: relative;
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.ch-wk-fill {
  position: absolute; left: 0; top: 0;
  height: 100%; border-radius: 3px;
  transition: width .35s ease;
}

/* Columna "Real / Meta" agrupada */
.ch-wk-amt-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ch-wk-amt { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.ch-wk-meta-lbl { font-size: 12px; color: var(--muted); line-height: 1.3; }
.ch-wk-meta-base { font-weight: 600; color: var(--text-2); }
.ch-wk-meta-carry { color: var(--amber-text); font-size: 12px; }
.ch-wk-pct { font-size: 14px; font-weight: 700; text-align: right; }

/* Cabecera de columnas del detalle semanal */
.ch-wk-col-head {
  display: grid;
  grid-template-columns: 82px 1fr 1fr 46px 88px;
  gap: 10px;
  padding: 0 4px 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.ch-wk-col-head .r { text-align: right; }

/* Indicador de traspaso de brecha */
.ch-wk-traspaso {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--red-text);
  background: var(--red-soft);
  border-radius: 4px;
  padding: 4px 10px 4px 20px;
  margin: 2px 0 4px;
  border-left: 3px solid var(--red-text);
  line-height: 1.4;
}
.ch-wk-traspaso-ok {
  color: var(--green-text);
  background: var(--green-soft);
  border-left-color: var(--green-text);
}

/* ── Obj toolbar (exportar / restablecer) ── */
.obj-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.obj-toolbar-info {
  font-size: 11px;
  color: var(--muted);
  flex: 1;
}
.obj-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn-sm {
  font-size: 12px !important;
  padding: 5px 12px !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ── MÓDULO ACTIVO (sidebar) ── */
.s-modulo-activo {
  margin: 8px 14px 18px;
  background: var(--nav-accent-soft);
  border: 1px solid var(--nav-accent-border);
  border-radius: 12px;
  padding: 14px 16px;
}
.s-ma-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--nav-accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.s-ma-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 3px;
}
.s-ma-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Config view — formulario agregar ── */
.cfg-add-form {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 0 0 4px;
}
.cfg-field { display: flex; flex-direction: column; gap: 5px; }
.cfg-field-sm { max-width: 80px; }
.cfg-field-action { min-width: 160px; }
.cfg-field-check { justify-content: flex-end; }
.cfg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* Checkbox con texto en línea */
.cfg-check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
  user-select: none;
  white-space: nowrap;
}
.cfg-check-label input[type="checkbox"] {
  accent-color: var(--brand);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.cfg-btn-add { width: 100%; }

/* ── Config view — mensaje feedback ── */
.cfg-msg {
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
}
.cfg-msg-ok  { background: var(--green-soft);  color: var(--green-text);  border: 1px solid #6ee7b7; }
.cfg-msg-err { background: var(--red-soft);    color: var(--red-text);    border: 1px solid #fca5a5; }

/* ── Config view — user card ── */
.cfg-user-card { overflow: hidden; }
.cfg-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cfg-user-info { min-width: 0; }
.cfg-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.cfg-user-email {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.cfg-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Pills de rol / estado ── */
.cfg-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.cfg-pill-green  { background: var(--green-soft);  color: var(--green-text); }
.cfg-pill-amber  { background: var(--amber-soft);  color: var(--amber-text); }
.cfg-pill-brand  { background: var(--brand-soft);  color: var(--brand-text); }
.cfg-pill-muted  { background: #f1f5f9;            color: var(--muted);      }

/* ── Config view — edit form ── */
.cfg-edit-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.cfg-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 120px 1fr;
  gap: 12px;
  margin-bottom: 14px;
  align-items: end;
}
.cfg-edit-actions {
  display: flex;
  gap: 8px;
}

/* ── Site footer ── */
.site-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Reportes Ads ── */
.rep-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0 16px;
}
.rep-period-meta { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; }
.rep-open { margin-left: auto; }
.rep-open svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rep-stack { display: grid; gap: 16px; }
.rep-sec { margin-top: 28px; }

.rep-pb { height: 6px; background: #E2E8F0; border-radius: 4px; margin-top: 10px; overflow: hidden; }
.rep-pb-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }

.rep-ch-head { display: flex; align-items: center; gap: 10px; }
.rep-ch-badge {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.rep-share { height: 4px; background: #F1F5F9; border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.rep-share > div { height: 100%; border-radius: 3px; }

.rep-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.rep-metrics > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.rep-metrics dt { font-size: 12px; color: var(--text-2); }
.rep-metrics dd { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; }
.rep-metrics-wide { grid-template-columns: 1fr; margin-bottom: 4px; }

.rep-table { font-size: 13px; }
.rep-table th { font-size: 10px; letter-spacing: .14em; padding: 8px 10px; }
.rep-table td { padding: 9px 10px; vertical-align: middle; }
.rep-table .sub-val { font-size: 11px; }
.rep-camp-name { font-weight: 500; }
.rep-bar { height: 4px; background: #F1F5F9; border-radius: 3px; margin-top: 6px; overflow: hidden; max-width: 220px; }
.rep-bar > div { height: 100%; background: var(--brand); border-radius: 3px; }
.rep-star { color: var(--amber); margin-right: 6px; }
.rep-subttl {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em;
  color: #64748b; margin: 16px 0 8px;
}
.rep-actions { padding-left: 18px; display: grid; gap: 8px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.rep-actions li::marker { color: var(--brand); font-weight: 700; }
.rep-foot-note { font-size: 11px; color: var(--muted); margin-top: 10px; }

@media (max-width: 900px) {
  .rep-open { margin-left: 0; }
  .rep-metrics { grid-template-columns: 1fr; }
  #rep-period { flex-wrap: wrap; }
}

/* ── Archivo de Reportes ── */
.arch-kpis { margin: 18px 0 16px; }
.arch-kpis .kpi-lbl { letter-spacing: .08em; font-size: 11px; padding-right: 0; }
.arch-kpis .kpi-val { font-size: 28px; font-weight: 700; margin-top: 10px; }
.arch-kpis .kpi-sub { font-size: 12px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.arch-filters {
  display: grid;
  grid-template-columns: minmax(200px, 1.6fr) repeat(3, minmax(140px, 1fr)) auto;
  gap: 10px;
  margin-bottom: 16px;
}
.arch-search, .arch-select { height: 40px; width: 100%; }
.arch-select { font-size: 13px; background-color: #fff; }
.arch-check {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; cursor: pointer;
}

.arch-table-wrap { overflow-x: auto; }
.arch-table { font-size: 13px; }
.arch-table th { font-size: 11px; letter-spacing: .08em; padding: 12px 14px; white-space: nowrap; }
.arch-table td { padding: 14px; vertical-align: middle; }
.arch-doc-name { font-weight: 600; color: var(--text); font-size: 14px; }
.arch-doc-file { font-size: 11px; color: var(--muted); margin-top: 2px; }
.arch-nowrap { white-space: nowrap; color: var(--text-2); }
.arch-fmt {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 8px; border-radius: var(--r-xs);
  color: var(--red-text); background: var(--red-soft); border: 1px solid #fecaca;
}
.arch-ver { font-size: 11px; font-weight: 600; margin-top: 2px; }
.arch-ver.ok  { color: var(--green-text); }
.arch-ver.old { color: var(--muted); font-weight: 500; }
.arch-ver.new { color: var(--brand-text); }
.arch-actions { display: flex; gap: 6px; }
.arch-empty { padding: 32px; text-align: center; font-size: 13px; color: var(--muted); }

.modal.arch-preview {
  max-width: 1100px; width: 94%; height: 88vh;
  display: flex; flex-direction: column; padding: 16px 18px;
}
.arch-preview-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.arch-preview-head h3 { margin-bottom: 2px; }
.arch-preview-file { font-size: 11px; color: var(--muted); }
.arch-preview-actions { display: flex; gap: 6px; flex-shrink: 0; }
#arch-preview-frame { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm); background: #F8FAFC; }

@media (max-width: 1200px) {
  .arch-filters { grid-template-columns: 1fr 1fr; }
  .arch-search { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .arch-filters { grid-template-columns: 1fr; }
  .arch-preview-head { flex-direction: column; }
}

/* ── Gasto publicitario: pestañas por fuente ── */
.gp-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
.gp-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; cursor: pointer; text-align: left; font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.gp-tab:hover { border-color: #cbd5e1; background: #f8fafc; }
.gp-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(185,28,28,.25); }
.gp-tab.active { border-color: #94a3b8; box-shadow: 0 1px 3px rgba(15, 23, 42, .08); background: #fff; }
.gp-tab-ic {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.gp-tab-name { display: block; font-size: 13px; font-weight: 700; color: var(--text); }
.gp-tab-src { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.gp-source {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  font-size: 12px; color: var(--text-2);
}
.gp-source-l, .gp-source-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.gp-dot.ok   { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.gp-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.gp-dot.busy { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); animation: pulse 1.2s ease-in-out infinite; }

/* Barra de sincronización de las carpetas de Drive */
.gp-sync {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 10px 10px 14px; margin: 18px 0 12px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  font-size: 12px; color: var(--text-2);
}
.gp-sync-l { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 320px; }
.gp-sync-l a { color: var(--brand); }
.gp-sync .btn { flex-shrink: 0; }

.gp-empty { text-align: center; padding: 40px 24px; margin-top: 14px; }
.gp-empty-ic {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px;
  background: var(--amber-soft); color: var(--amber-text);
  display: flex; align-items: center; justify-content: center;
}
.gp-empty-ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gp-empty-title { font-size: 15px; font-weight: 700; color: var(--text); }
.gp-empty-text { max-width: 560px; margin: 8px auto 16px; font-size: 13px; color: var(--text-2); line-height: 1.6; }

.gp-table-wrap { overflow-x: auto; }
.gp-total-row td { background: #F8FAFC; font-weight: 600; }
.gp-av { min-width: 130px; }
.gp-av-wrap { display: flex; align-items: center; gap: 8px; }
.gp-av-wrap .rep-pb { flex: 1; margin-top: 0; }
.gp-ld-dash { background: transparent !important; border-top: 2px dashed var(--text); height: 0 !important; }
.gp-note { font-size: 12px; color: var(--text-2); margin-top: 12px; }

/* Embudo */
.gp-funnel-row {
  display: grid; grid-template-columns: 150px 1fr 80px 52px; gap: 10px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.gp-funnel-row:last-of-type { border-bottom: none; }
.gp-funnel-name { color: var(--text-2); }
.gp-funnel-bar { height: 10px; background: #F1F5F9; border-radius: 5px; overflow: hidden; }
.gp-funnel-bar > div { height: 100%; background: var(--brand); border-radius: 5px; }
.gp-funnel-val { text-align: right; font-weight: 600; color: var(--text); }
.gp-funnel-rate { text-align: right; color: var(--muted); font-size: 11px; }

/* Público */
.gp-aud-row { display: grid; grid-template-columns: 64px 1fr 150px; gap: 10px; align-items: center; padding: 5px 0; font-size: 12px; }
.gp-aud-name { color: var(--text-2); }
.gp-aud-bar { height: 10px; background: #F1F5F9; border-radius: 5px; overflow: hidden; }
.gp-aud-bar > div { height: 100%; background: var(--brand); border-radius: 5px; }
.gp-aud-val { text-align: right; white-space: nowrap; }

@media (max-width: 900px) {
  .gp-funnel-row { grid-template-columns: 110px 1fr 64px 44px; }
  .gp-aud-row { grid-template-columns: 52px 1fr 120px; }
}
