:root {
  /* 1. Superficies y Fondos */
  --bg-app: #f4f6f9;            /* Fondo general de la aplicación */
  --bg-surface: #ffffff;        /* Fondo de tarjetas, tablas y modales */
  --bg-surface-subtle: #f8fafc; /* Headers de tabla, hover y cajas secundarias */
  --bg-surface-inset: #f1f5f9;  /* Inputs, chips inactivos y divisores */

  /* 2. Bordes */
  --border-subtle: #e2e8f0;     /* Líneas de separación de tablas y cards */
  --border-strong: #94a3b8;     /* Bordes de inputs interactivos y botones (cumple 3:1) */
  --border-focus: #2563eb;      /* Anillo de foco accesible */

  /* 3. Tipografía (Color) */
  --text-primary: #0f172a;      /* Títulos, cifras y datos clave (alto contraste) */
  --text-secondary: #475569;    /* Descripciones, labels y cuerpo de texto */
  --text-muted: #64748b;        /* Fechas, metadatos y placeholders */
  --text-inverse: #ffffff;      /* Texto sobre botones sólidos y badges oscuros */

  /* 4. Acento y Marca (Fintech Blue) */
  --brand-primary: #1e40af;     /* Botones principales y navegación activa */
  --brand-hover: #1d4ed8;       /* Hover de acciones primarias */
  --brand-subtle: #eff6ff;      /* Fondos activos suaves */
  --brand-border: #bfdbfe;      /* Bordes de acento */

  /* 5. Semánticos (Éxito, Error, Alerta) */
  --status-success-text: #166534;
  --status-success-bg: #dcfce7;
  --status-success-border: #86efac;

  --status-error-text: #991b1b;
  --status-error-bg: #fee2e2;
  --status-error-border: #fca5a5;

  --status-warning-text: #9a3412;
  --status-warning-bg: #ffedd5;
  --status-warning-border: #fed7aa;

  /* 6. Escala Modular de Tipografía (Sin decimales) */
  --font-2xs: 11px;             /* Badges, micro-tags, labels en mayúsculas */
  --font-xs: 12px;              /* Metadata secundaria, fechas */
  --font-sm: 13px;              /* Celdas de tabla, descripciones de apoyo */
  --font-base: 14px;            /* Texto base, botones, inputs */
  --font-md: 16px;              /* Títulos de sección, headers de card */
  --font-lg: 20px;              /* Títulos de modal y vistas */
  --font-xl: 24px;              /* Cifras KPI primarias */

  /* 7. Escala de Espaciado (Múltiplos de 4px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* 8. Radios de Borde Unificados */
  --radius-sm: 6px;             /* Badges, chips, botones pequeños */
  --radius-md: 10px;            /* Inputs, botones normales, tarjetas internas */
  --radius-lg: 14px;            /* Tarjetas principales y modales */
  --radius-full: 9999px;        /* Píldoras redondas y avatares */

  /* 9. Sombras Profesionales (Discretas y modernas) */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);

  /* Aliasing de compatibilidad hacia atrás */
  --bg: var(--bg-app);
  --card: var(--bg-surface);
  --line: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --blue: var(--brand-primary);
  --blue-soft: var(--brand-subtle);
  --green: #16a34a;
  --green-soft: var(--status-success-bg);
  --green-line: var(--status-success-border);
  --red: #dc2626;
  --red-soft: var(--status-error-bg);
  --amber: #b45309;
  --amber-soft: var(--status-warning-bg);
  --dark: var(--text-primary);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-app); color: var(--text-primary); font: var(--font-base)/1.5 'Outfit', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.page { flex: 1; min-width: 0; max-width: 1700px; padding: var(--space-6) var(--space-8) 60px; }

.top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-4); }
.actions { display: flex; gap: var(--space-2); }
.prodtable td { vertical-align: top; }
.prodtable input { width: 100%; }
.prodtable .status { font-size: var(--font-xs); margin-top: var(--space-1); }
.prodtable .status.ok { color: var(--status-success-text); } .prodtable .status.bad { color: var(--status-error-text); }
.ok-icon { display: inline-flex; vertical-align: -3px; }
.ok-icon svg { width: 14px; height: 14px; }
h1 { margin: 0; font-size: var(--font-xl); font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); }
h2 { margin: 0; font-size: var(--font-lg); font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
h3 { margin: 0; font-size: var(--font-md); font-weight: 600; color: var(--text-primary); }
.sub { margin: var(--space-1) 0 0; color: var(--text-muted); font-size: var(--font-sm); line-height: 1.5; max-width: 70ch; }

.card { background: var(--bg-surface); border-radius: var(--radius-lg); padding: var(--space-6); margin-bottom: var(--space-4); box-shadow: var(--shadow-card); border: 1px solid var(--border-subtle); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font: 500 var(--font-base) 'Outfit', sans-serif;
  color: var(--text-inverse);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, opacity 0.15s ease;
  vertical-align: middle;
  text-decoration: none;
  line-height: 1.2;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.dark { background: var(--text-primary); } .btn.blue { background: var(--brand-primary); } .btn.green { background: #16a34a; }
.btn.ghost { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-subtle); }
.btn.ghost:hover { background: var(--bg-surface-subtle); border-color: var(--border-strong); }
.btn.danger,
.btn.danger-soft {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.btn.danger:hover,
.btn.danger-soft:hover {
  background: #fecaca;
  color: #991b1b;
  border-color: #fca5a5;
}
.btn.danger .sb-ico,
.btn.danger svg,
.btn.danger-soft .sb-ico,
.btn.danger-soft svg {
  color: #dc2626;
}
.btn.danger:hover .sb-ico,
.btn.danger:hover svg,
.btn.danger-soft:hover .sb-ico,
.btn.danger-soft:hover svg {
  color: #991b1b;
}
.btn.sm, .btn-sm { padding: 5px 10px; font-size: var(--font-sm); border-radius: var(--radius-sm); gap: 6px; }
.btn.icon { background: none; color: var(--text-muted); padding: 6px 8px; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.btn.icon:hover { background: var(--bg-surface-subtle); color: var(--text-primary); }
.btn.icon svg, .btn svg, .btn .sb-ico, .btn-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; vertical-align: middle; }
.btn svg { width: 15px; height: 15px; max-width: 15px; max-height: 15px; }
.btn.sm svg, .btn-sm svg, .btn .sb-ico svg { width: 14px; height: 14px; }

.num, .tabular-nums { font-variant-numeric: tabular-nums; }

.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); margin-bottom: var(--space-4); font-size: var(--font-sm); border: 1px solid transparent; }
.alert.error { background: var(--status-error-bg); color: var(--status-error-text); border-color: var(--status-error-border); }
.alert.warn { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: var(--status-warning-border); }

.drop { display: flex; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 2px dashed var(--border-strong); border-radius: var(--radius-md); cursor: pointer; text-align: center; transition: .15s; background: var(--bg-surface-subtle); color: var(--text-primary); }
.drop:hover, .drop.over { border-color: var(--brand-primary); background: var(--brand-subtle); }
.drop.busy { opacity: .6; pointer-events: none; }
.drop small { color: var(--text-muted); font-size: var(--font-xs); }

.result { margin-top: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--status-success-bg); border: 1px solid var(--status-success-border); border-radius: var(--radius-md); font-size: var(--font-sm); }
.result.err { background: var(--status-error-bg); border-color: var(--status-error-border); color: var(--status-error-text); }
.result b { font-weight: 600; }
.result .chips { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 6px; }

.filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field.grow { flex: 1; min-width: 220px; }
.field label { font-size: var(--font-xs); color: var(--text-muted); font-weight: 500; }
input, select { font: var(--font-base) 'Outfit', sans-serif; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--border-focus); border-color: var(--border-focus); }

.stats { margin: var(--space-4) 0 var(--space-2); color: var(--text-muted); font-size: var(--font-sm); }
.stats b { color: var(--text-primary); font-weight: 600; }
.stats .sep { margin: 0 8px; opacity: .4; }

.tablewrap { position: relative; overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
table { width: 100%; border-collapse: collapse; min-width: 1240px; }
th { text-align: left; font-size: var(--font-2xs); letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; padding: 10px 12px; background: var(--bg-surface-subtle); border-bottom: 1px solid var(--border-subtle); }
td { padding: 10px 12px; border-top: 1px solid var(--border-subtle); vertical-align: middle; font-size: var(--font-sm); }
td:nth-child(2) { white-space: nowrap; }
td small, .muted { color: var(--muted); font-size: 12px; }
.num { text-align: right; white-space: nowrap; }
td.num { font-weight: 600; }
.c-check { width: 36px; } .c-actions { width: 250px; text-align: right; }
td.c-actions { text-align: right; white-space: nowrap; }

@media (min-width: 640px) {
  .tablewrap table th.c-check,
  .tablewrap table td.c-check {
    position: sticky;
    left: 0;
    background-color: var(--bg-surface);
    z-index: 2;
  }
  .tablewrap table th.c-actions,
  .tablewrap table td.c-actions {
    position: sticky;
    right: 0;
    background-color: var(--bg-surface);
    z-index: 2;
    box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.05);
  }
  .tablewrap table th.c-check,
  .tablewrap table th.c-actions {
    background-color: var(--bg-surface-subtle);
  }
  tr.row.enviado td.c-check,
  tr.row.enviado td.c-actions {
    background-color: var(--green-soft);
  }
  tr.row.error td.c-check,
  tr.row.error td.c-actions {
    background-color: var(--red-soft);
  }
  tr.row.enviando td.c-check,
  tr.row.enviando td.c-actions {
    background-color: var(--amber-soft);
  }
  tr.row:hover td.c-check,
  tr.row:hover td.c-actions {
    background-color: #f8fafc;
  }
}

@media (max-width: 768px) {
  .page { padding: var(--space-4) var(--space-3) 40px; }
  .top { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  .actions .btn { flex: 1 1 calc(50% - var(--space-2)); justify-content: center; }
  .filters { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
  .field.grow { grid-column: 1 / -1; }
}

tr.row { box-shadow: inset 4px 0 0 #3b82f6; }
tr.row.enviado { background: var(--green-soft); box-shadow: inset 4px 0 0 var(--green); }
tr.row.error { background: var(--red-soft); box-shadow: inset 4px 0 0 var(--red); }
tr.row.enviando { background: var(--amber-soft); box-shadow: inset 4px 0 0 #f59e0b; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--bg-surface-inset); font-size: var(--font-2xs); font-weight: 600; letter-spacing: 0.02em; }
.chip.blue { background: var(--brand-subtle); color: var(--brand-primary); border: 1px solid var(--brand-border); }
.chip.green { background: var(--status-success-bg); color: var(--status-success-text); border: 1px solid var(--status-success-border); }
.chip.red { background: var(--status-error-bg); color: var(--status-error-text); border: 1px solid var(--status-error-border); }
.chip.amber { background: var(--status-warning-bg); color: var(--status-warning-text); border: 1px solid var(--status-warning-border); }
.errtxt { color: #991b1b; font-size: 12px; margin-top: 4px; max-width: 340px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.prod { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { padding: var(--space-6); text-align: center; color: var(--text-muted); font-size: var(--font-sm); }
.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-6);
  color: var(--text-secondary);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-inset);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin: 0 auto var(--space-3) auto;
}
.empty-state-icon .sb-ico,
.empty-state-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  color: inherit;
}
.empty-state-title {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.empty-state-desc {
  font-size: var(--font-sm);
  color: var(--text-muted);
  max-width: 48ch;
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

.offline-banner {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #fde68a;
  font-size: var(--font-sm);
  font-weight: 600;
  padding: 8px 16px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 14px; color: var(--muted); }

/* ================================================================
   SKELETON LOADING (SHIMMER)
================================================================ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm, 6px);
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-shimmer {
    animation: none;
    background: #e2e8f0;
  }
}

.sk-bar {
  display: block;
  height: 12px;
  background: inherit;
  border-radius: 4px;
}
.sk-bar.title { height: 14px; width: 75%; margin-bottom: 6px; }
.sk-bar.sub { height: 11px; width: 45%; }
.sk-chip { height: 22px; width: 68px; border-radius: 12px; }
.sk-btn { height: 26px; width: 64px; border-radius: 6px; }
.sk-check { width: 16px; height: 16px; border-radius: 4px; }

.skeleton-row td {
  padding: 12px 10px;
  vertical-align: middle;
}

/* modales */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0,0,0,.25); font-family: inherit; color: var(--text); }
.modal.narrow { width: min(640px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(17,24,39,.45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.modal-body { padding: 20px 24px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }

.sec { margin-bottom: 22px; }
.sec h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 20px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { word-break: break-word; }
.kv.wide { grid-column: 1 / -1; }
.mini { width: 100%; border-collapse: collapse; min-width: 0; }
.mini th { background: none; padding: 6px 8px; }
.mini td { padding: 8px; }
.banner { padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; }
.banner.enviado { background: var(--green-soft); border: 1px solid var(--green-line); }
.banner.error { background: var(--red-soft); color: #991b1b; }

.form { display: grid; gap: 14px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .field input, .form .field select { width: 100%; }
.form .hint { font-size: 12px; color: var(--muted); }
.form .check { display: flex; gap: 8px; align-items: flex-start; }
.form .check input { margin-top: 3px; }
.form hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.probe { padding: 10px 12px; border-radius: 8px; background: #f9fafb; font-size: 13px; }

#toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 10px; max-width: 440px; box-shadow: 0 10px 25px rgba(0,0,0,.2); font-size: 13.5px; font-weight: 500; border: 1px solid rgba(255,255,255,.08); border-left: 4px solid #3b82f6; animation: toastSlideIn .22s cubic-bezier(0.16, 1, 0.3, 1); transition: opacity .2s, transform .2s; }
.toast .toast-icon { width: 18px; height: 18px; flex: none; display: flex; align-items: center; justify-content: center; }
.toast .toast-icon svg { width: 18px; height: 18px; }
.toast.ok { border-left-color: #22c55e; }
.toast.ok .toast-icon { color: #22c55e; }
.toast.bad { border-left-color: #ef4444; }
.toast.bad .toast-icon { color: #ef4444; }
.toast.info { border-left-color: #3b82f6; }
.toast.info .toast-icon { color: #60a5fa; }
@keyframes toastSlideIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 640px) { .form .two { grid-template-columns: 1fr; } .top { flex-direction: column; } }

/* confirmación */
.modal.confirm { width: min(480px, calc(100vw - 32px)); text-align: center; overflow-x: hidden; }
.confirm .cbody { padding: 28px 28px 20px; }
.confirm .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }
.confirm .ico svg { width: 26px; height: 26px; }
.confirm h2 { margin: 0 0 10px; font-size: 20px; font-weight: 600; }
.confirm p { margin: 0 0 8px; color: var(--muted); }
.confirm p b { color: var(--text); }
.confirm .note { font-size: 12px; }
.confirm .modal-foot { justify-content: center; }
.btn.red { background: var(--red); }

/* confirmación: variantes */
.confirm .ico.send { background: var(--blue-soft); color: var(--blue); }
.confirm .summary { text-align: left; background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px; margin: 14px 0 0; }
.confirm .sum-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.confirm .sum-row:last-child { border-bottom: 0; }
.confirm .sum-row span { color: var(--muted); flex-shrink: 0; }
.confirm .sum-row b { font-weight: 500; text-align: right; word-break: break-word; }
.confirm .sum-row small { color: var(--muted); font-weight: 400; }
.confirm .callout { text-align: left; margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--amber-soft); border: 1px solid #fde68a; color: var(--amber); font-size: 13px; }

/* spinner y barra de progreso de envío */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { flex: none; width: 22px; height: 22px; border: 3px solid #cbd5e1; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { display: inline-block; width: 12px; height: 12px; border-width: 2px; border-color: #f59e0b55; border-top-color: #b45309; vertical-align: -2px; margin-right: 4px; }
.btn .spinner { display: inline-block; width: 15px; height: 15px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; vertical-align: -3px; margin-right: 2px; }
.btn:disabled .spinner { opacity: 1; }
.sending-chip { white-space: nowrap; }
.sendbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; margin: 14px 0 4px; padding: 12px 16px; border-radius: 12px; background: var(--blue-soft); border: 1px solid #bfd3f8; }
.sendbar #btnStopSend { padding: 6px 14px; }
.sendbar #btnStopSend:disabled { opacity: .6; }
.sendbar .sb-text { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; }
.sendbar .sb-text span { color: var(--muted); font-size: 13px; }
.sendbar .sb-track { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: #fff; overflow: hidden; }
.sendbar #sbFill { height: 100%; width: 0; background: var(--blue); border-radius: 6px; transition: width .35s ease; }
.sendbar.done { background: var(--green-soft); border-color: var(--green-line); }
.sendbar.done .spinner { animation: none; border-color: var(--green); }
.sendbar.done #sbFill { background: var(--green); }

/* envío por lotes */
.batch-sizes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 4px 0 14px; }
.batch-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border: 1px solid #d1d5db; border-radius: 10px; cursor: pointer; font-weight: 600; transition: .12s; }
.batch-opt:hover { border-color: var(--blue); }
.batch-opt.sel { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.batch-opt.disabled { opacity: .5; cursor: not-allowed; }
.batch-opt input { margin: 0; }
.batch-summary { text-align: center; color: var(--muted); margin: 0; }
.batch-summary b { color: var(--text); }
@media (max-width: 560px) { .batch-sizes { grid-template-columns: repeat(3, 1fr); } }

/* login y selector de empresa */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-container { width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; }
.login-container .login-box { width: 100%; }
.login-back-link {
  align-self: flex-start;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .15s ease;
}
.login-back-link:hover { color: var(--blue); }
.login-back-link svg { width: 14px; height: 14px; stroke-width: 2.2; }
.login-legal-footer { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.login-legal-footer a { color: var(--muted); text-decoration: none; transition: .15s; }
.login-legal-footer a:hover { color: var(--blue); text-decoration: underline; }
.login-legal-footer .sep { opacity: .4; }
.login-box { background: var(--card); border-radius: 16px; padding: 32px; width: min(440px, 100%); box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.login-box .form { margin-top: 18px; gap: 14px; }
.login-box .btn { width: 100%; padding: 12px; }
.login-box .btn.sm, .login-box .btn-sm { width: auto; padding: 0 16px; }
.auth-toggle-group {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 18px;
}
.auth-tab-btn {
  flex: 1;
  border: 0;
  background: none;
  font: 600 13.5px 'Outfit', sans-serif;
  color: #64748b;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
  text-align: center;
}
.auth-tab-btn:hover {
  color: #0f172a;
}
.auth-tab-btn.active {
  background: #fff;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.auth-plan-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #1e40af;
  margin-bottom: 14px;
}
.auth-plan-badge b {
  color: #1d4ed8;
}
/* Selector de empresa (después de iniciar sesión) */
.login-container.is-selector { width: min(768px, 100%); }
.login-container.is-selector .login-back-link { align-self: flex-start; }
.login-container.is-selector .login-box { padding: 32px; border-radius: 20px; box-shadow: 0 20px 25px -5px rgba(15, 23, 42, .06), 0 8px 10px -6px rgba(15, 23, 42, .04); }
.is-selector .login-box h1 { font-size: 24px; letter-spacing: -.02em; }
.is-selector .login-box .sub { margin: 6px 0 0; max-width: none; }
.sel-list { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.sel-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 18px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-surface); box-shadow: var(--shadow-sm); text-align: left; font: inherit; color: var(--text-primary); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
.sel-card:hover { background: var(--bg-surface-subtle); border-color: var(--brand-border); box-shadow: var(--shadow-card); }
.sel-card:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.sel-radio { position: relative; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cbd5e1; flex: none; transition: border-color .15s; }
.sel-radio::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: transparent; transition: background .15s; }
.sel-card:hover .sel-radio, .sel-card:focus-visible .sel-radio { border-color: var(--brand-hover); }
.sel-card:hover .sel-radio::after, .sel-card:focus-visible .sel-radio::after { background: var(--brand-hover); }
.sel-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font-weight: 700; font-size: 15px; letter-spacing: .02em; flex: none; }
.sel-avatar.tone0 { background: #dbeafe; color: #1e3a8a; }
.sel-avatar.tone1 { background: #e2e8f0; color: #334155; }
.sel-avatar.tone2 { background: #ccfbf1; color: #115e59; }
.sel-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-card:hover .sel-name { color: var(--brand-hover); }
.sel-go { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 12px; background: var(--bg-surface-inset); color: var(--text-primary); font-size: var(--font-sm); font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
.sel-arrow { display: inline-grid; transition: transform .15s; }
.sel-arrow svg { width: 16px; height: 16px; }
.sel-card:hover .sel-go, .sel-card:focus-visible .sel-go { background: var(--brand-hover); color: #fff; }
.sel-card:hover .sel-arrow { transform: translateX(2px); }
.sel-form { margin-top: 16px; padding: 14px; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--bg-surface-subtle); text-align: left; }
.sel-form[hidden] { display: none; }
.sel-form label { display: block; margin-bottom: 6px; font-size: var(--font-sm); font-weight: 600; color: var(--text-secondary); }
.sel-form-row { display: flex; gap: 8px; }
.sel-form-row input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: var(--font-sm); background: #fff; }
.sel-form-row input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.sel-form-row .btn { width: auto; flex: none; margin: 0; height: 40px; padding: 0 18px; }
.sel-form p { margin: 8px 0 0; font-size: var(--font-xs); color: #55627a; }
.sel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.sel-create, .sel-logout { display: inline-flex; align-items: center; gap: 8px; padding: 6px 4px; border: 0; background: none; font: inherit; font-size: var(--font-base); font-weight: 600; cursor: pointer; text-decoration: none; border-radius: 8px; }
.sel-create { color: var(--brand-hover); } .sel-create:hover { text-decoration: underline; }
.sel-create[hidden] { display: none; }
.sel-logout { color: #b91c1c; margin-left: auto; font-size: var(--font-sm); } .sel-logout:hover { text-decoration: underline; }
.sel-create:focus-visible, .sel-logout:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.sel-ico svg { width: 18px; height: 18px; }
@media (max-width: 560px) {
  .login-container.is-selector .login-box { padding: 22px 16px; }
  .sel-card { flex-wrap: wrap; padding: 14px; }
  .sel-name { white-space: normal; flex-basis: calc(100% - 100px); }
  .sel-go { width: 100%; justify-content: center; }
  .sel-form-row { flex-direction: column; } .sel-form-row .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sel-card, .sel-go, .sel-arrow, .sel-radio, .sel-radio::after { transition: none; } }
.switch-link { text-align: center; margin-top: 18px; }
.switch-link a { color: var(--blue); text-decoration: none; font-size: 13px; }

/* barra de usuario/empresa en el encabezado */
/* barra lateral */
.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }
.sidebar { width: 240px; flex: none; background: #111827; color: #e5e7eb; display: flex; flex-direction: column; padding: 22px 0 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sb-brand { padding: 0 20px 18px; font-size: 17px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 16px; }
.sb-empresa { padding: 0 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 10px; }
.sb-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9ca3af; margin-bottom: 4px; }
.sb-empresa-name { font-weight: 600; color: #fff; margin-bottom: 10px; word-break: break-word; line-height: 1.3; }
.sb-swap { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: #93c5fd; font: 500 12.5px 'Outfit', sans-serif; padding: 0; cursor: pointer; }
.sb-swap:hover { color: #bfdbfe; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }
.sb-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #d1d5db; text-decoration: none; font: 500 14px 'Outfit', sans-serif; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.sb-item:hover { background: #1f2937; color: #fff; }
.sb-item.active { background: var(--blue); color: #fff; }
.sb-item.hidden { display: none !important; }
.sb-ico, .btn-ico { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; line-height: 1; flex-shrink: 0; }
.sb-ico svg { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.sb-swap .sb-ico svg { width: 15px; height: 15px; }
.sb-foot { padding: 14px 10px 0; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 6px; }
.sb-user { padding: 0 12px; font-size: 12.5px; color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar, .sb-backdrop, .hamb-float { display: none; }
.sb-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hamb-hide { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: #9ca3af; cursor: pointer; }
.hamb-hide:hover { background: #1f2937; color: #fff; }
.hamb-hide svg, .hamb-float svg { width: 22px; height: 22px; }
@media (min-width: 861px) {
  body.sb-collapsed .sidebar { display: none; }
  body.sb-collapsed .hamb-float { display: grid; place-items: center; position: fixed; z-index: 30; top: 12px; left: 12px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: #111827; color: #fff; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
  body.sb-collapsed .page { padding-top: 64px; }
}
@media (max-width: 860px) {
  body .hamb-hide, body .hamb-float { display: none !important; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; height: 52px; padding: 0 14px; background: #111827; color: #fff; }
  .topbar-title { font-weight: 700; font-size: 16px; }
  .hamb { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 8px; background: none; color: #fff; cursor: pointer; }
  .hamb:hover { background: #1f2937; }
  .hamb svg { width: 24px; height: 24px; }
  .sidebar { position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; height: 100vh; width: min(280px, 85vw); transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; }
  body.menu-open .sidebar { transform: none; box-shadow: 8px 0 30px rgba(0,0,0,.35); }
  .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  body.menu-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .app-shell { display: block; min-height: 0; }
  .page { padding: 20px 16px 50px; }
}

/* administración */
.sec-title { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.inline-form { display: flex; gap: 10px; margin-bottom: 14px; }
.inline-form input { flex: 1; }
.chips-list { display: flex; flex-wrap: wrap; gap: 8px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f9fafb; }
.check-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.check-item input { margin: 0; }

/* ojito y generador de contraseña */
.pwd-field-container { display: flex; flex-direction: column; width: 100%; }
.pwd-wrap { position: relative; display: block; width: 100%; }
.pwd-wrap input { width: 100%; padding-right: 42px; box-sizing: border-box; }
.pwd-actions { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 2px; }
.pwd-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 6px; display: grid; place-items: center; transition: .12s; z-index: 2; }
.pwd-actions .pwd-eye { position: static; transform: none; right: auto; top: auto; }
.pwd-gen { width: 28px; height: 28px; border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 6px; display: grid; place-items: center; transition: .12s; }
.pwd-eye:hover, .pwd-gen:hover { background: #f3f4f6; color: var(--text); }
.pwd-gen:hover { color: #d97706; }
.pwd-eye svg, .pwd-gen svg { width: 16px; height: 16px; }
.pwd-field-container .pwd-wrap input { padding-right: 68px; }

/* Medidor de fortaleza de contraseña */
.pwd-strength { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }
.pwd-meter { height: 4px; width: 100%; background: #e2e8f0; border-radius: 2px; overflow: hidden; }
.pwd-meter-fill { height: 100%; width: 0%; transition: width .2s ease, background-color .2s ease; border-radius: 2px; }
.pwd-meter-text { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.pwd-meter-fill.lvl-0 { width: 15%; background: #ef4444; }
.pwd-meter-fill.lvl-1 { width: 35%; background: #f97316; }
.pwd-meter-fill.lvl-2 { width: 65%; background: #eab308; }
.pwd-meter-fill.lvl-3 { width: 100%; background: #22c55e; }

/* resumen de cartera */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.stat-n { font-size: 26px; font-weight: 600; }
.stat-l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.ok .stat-n { color: var(--green); }
.stat.warn { background: var(--amber-soft); border-color: #fde68a; }
.stat.warn .stat-n { color: var(--amber); }

.modal-foot { flex-wrap: wrap; }

/* buscador de productos de Siigo (productos.html) */
.combo-pop { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); overflow-y: auto; padding: 4px; }
.combo-opt { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; align-items: baseline; }
.combo-opt:hover { background: #f1f5f9; }
.combo-opt b { flex: none; min-width: 110px; font-weight: 600; }
.combo-opt span { color: #475569; font-size: 13px; overflow-wrap: anywhere; }
.combo-empty { padding: 10px; color: #64748b; font-size: 13px; }

.iva-tag { font-style: normal; font-size: 11px; background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 1px 6px; margin-left: 8px; white-space: nowrap; }

/* formas de pago del pedido */
.payrow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 10px; margin-bottom: 8px; align-items: center; }
.payrow select, .payrow input { width: 100%; box-sizing: border-box; }
.paysum { font-size: 13px; color: #475569; margin: 4px 0 12px; }
.paysum .bad { color: #991b1b; }
@media (max-width: 640px) { .payrow { grid-template-columns: 1fr auto; } .payrow .pay-val { grid-column: 1; } }

/* --- Estilos de Suscripción y Planes (SaaS) --- */
.sb-sub-card {
  margin: 12px 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.sb-sub-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.sb-sub-name {
  font-weight: 600;
  font-size: 13px;
  color: #f1f5f9;
}
.sb-sub-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  text-transform: uppercase;
}
.sb-sub-badge.warn {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.sb-sub-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.sb-sub-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.sb-sub-fill.danger {
  background: #ef4444;
}
.sb-sub-fill.warning {
  background: #f59e0b;
}
.sb-sub-info {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
}

.modal.wide {
  max-width: 900px;
  width: 95%;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.plan-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.plan-card.featured {
  border: 2px solid #3b82f6;
  box-shadow: 0 8px 28px rgba(59, 130, 246, 0.15);
}
.plan-ribbon {
  position: absolute;
  top: -11px;
  right: 18px;
  background: #3b82f6;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 12px;
}
.plan-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.plan-desc {
  font-size: 12px;
  color: #64748b;
  min-height: 32px;
  margin-bottom: 12px;
}
.plan-price {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 16px;
}
.plan-price span {
  font-size: 13px;
  font-weight: 400;
  color: #64748b;
}
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  flex-grow: 1;
}
.plan-features li {
  font-size: 13px;
  color: #334155;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.plan-features li::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 9px;
  border: solid #10b981;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-right: 8px;
  flex-shrink: 0;
}
.plan-btn {
  width: 100%;
}
.sub-status-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ================================================================
   PANEL ADMINISTRACIÓN (REDESIGN)
================================================================ */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.admin-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.admin-header .sub {
  color: #64748b;
  font-size: 14px;
  margin-top: 4px;
}
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tarjetas de Métricas KPI */
.admin-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f1f5f9;
  color: #475569;
}
.kpi-icon .sb-ico {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon .sb-ico svg,
.kpi-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}
.kpi-icon.blue { background: #eff6ff; color: #2563eb; }
.kpi-icon.purple { background: #faf5ff; color: #7c3aed; }
.kpi-icon.green { background: #f0fdf4; color: #16a34a; }
.kpi-icon.emerald { background: #ecfdf5; color: #059669; }
.kpi-icon.amber { background: #fffbeb; color: #d97706; }
.kpi-icon.orange { background: #fff7ed; color: #ea580c; }
.kpi-icon.red { background: #fef2f2; color: #dc2626; }
.kpi-icon.indigo { background: #e0e7ff; color: #4338ca; }
.kpi-content {
  flex: 1;
  min-width: 0;
}
.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}
.kpi-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Pestañas de Navegación */
.admin-nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.admin-nav-tabs::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  padding: 10px 18px;
  font: 600 14px 'Outfit', sans-serif;
  color: #64748b;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s ease;
  margin-bottom: -1px;
  flex-shrink: 0;
}
.tab-btn svg {
  width: 17px;
  height: 17px;
}
.tab-btn:hover {
  color: #0f172a;
}
.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}
.tab-badge {
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.tab-btn.active .tab-badge {
  background: #dbeafe;
  color: #1e40af;
}

.admin-profile-box {
  padding-bottom: 14px;
  margin-bottom: 12px;
}
.admin-profile-name {
  font-weight: 700;
  color: var(--text-inverse, #fff);
  font-size: var(--font-base);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
}
.admin-profile-name .sb-ico {
  color: #c084fc;
}
.admin-tab-card {
  padding: var(--space-6, 24px);
}
.kpi-status-wompi {
  font-size: 18px;
  color: var(--status-success-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 640px) {
  table.admin-table th:last-child,
  table.admin-table td:last-child {
    position: sticky;
    right: 0;
    background-color: var(--bg-surface);
    z-index: 2;
    box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.05);
  }
  table.admin-table th:last-child {
    background-color: #f8fafc;
  }
  table.admin-table tr:hover td:last-child {
    background-color: #f8fafc;
  }
}

@media (max-width: 768px) {
  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .admin-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .admin-header-actions .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }
  .admin-kpis {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .admin-kpis {
    grid-template-columns: 1fr;
  }
}

/* Barra de herramientas / Búsqueda y Filtros */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  flex: 1;
  max-width: 360px;
}
.search-box .sb-ico,
.search-box > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
  pointer-events: none;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-box .sb-ico svg {
  width: 16px;
  height: 16px;
  display: block;
}
.search-box input {
  width: 100%;
  padding-left: 38px !important;
  padding-right: 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 13px;
  height: 38px;
  box-sizing: border-box;
}
.search-box input:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter-group select {
  height: 38px;
  font-size: 13px;
}

/* Estilos de Tabla de Usuarios Sin Scroll Horizontal */
.tablewrap.admin-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}
table.admin-table {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: fixed;
}
table.admin-table th {
  padding: 9px 10px;
  font-size: 11px;
  background: #f8fafc;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid var(--line);
}
table.admin-table td {
  padding: 8px 10px;
  font-size: 12.5px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
table.admin-table th:nth-child(1), table.admin-table td:nth-child(1) { width: 30%; }
table.admin-table th:nth-child(2), table.admin-table td:nth-child(2) { width: 14%; }
table.admin-table th:nth-child(3), table.admin-table td:nth-child(3) { width: 23%; }
table.admin-table th:nth-child(4), table.admin-table td:nth-child(4) { width: 13%; }
table.admin-table th:nth-child(5), table.admin-table td:nth-child(5) { width: 20%; text-align: right; }

/* Estilos de Tabla de Descuentos Sin Scroll Innecesario */
table.data-table {
  min-width: 0 !important;
  width: 100% !important;
}
table.data-table th {
  padding: 9px 12px;
  font-size: 11px;
  background: #f8fafc;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #64748b;
  border-bottom: 1px solid var(--line);
}
table.data-table td {
  padding: 9px 12px;
  font-size: 12.5px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
table.data-table td:nth-child(2) {
  white-space: normal !important;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  text-transform: uppercase;
  border: 1px solid #bae6fd;
}
.user-avatar.admin {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.user-avatar.banned {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-name {
  font-weight: 600;
  color: #0f172a;
  font-size: 13.5px;
}
.user-email {
  font-size: 12px;
  color: #64748b;
}
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.role-badge svg {
  width: 13px;
  height: 13px;
}
.role-badge.admin {
  background: #faf5ff;
  color: #7e22ce;
  border: 1px solid #f3e8ff;
}
.role-badge.usuario {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.company-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  color: #334155;
  font-weight: 500;
  margin: 2px;
}
.company-tag svg {
  width: 13px;
  height: 13px;
  color: #64748b;
}

/* Grid de Empresas */
.empresas-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.empresa-admin-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: all .15s ease;
}
.empresa-admin-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.empresa-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.empresa-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.empresa-card-icon svg {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
}
.empresa-card-meta {
  flex: 1;
  min-width: 0;
}
.empresa-card-name {
  font-weight: 700;
  font-size: 15.5px;
  color: #0f172a;
  margin: 0 0 2px;
  line-height: 1.25;
  word-break: break-word;
}
.empresa-card-id {
  font-size: 11.5px;
  color: #94a3b8;
}
.empresa-card-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid #f1f5f9;
}
.btn-manage-sub {
  margin-top: auto;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  width: 100% !important;
}
.btn-manage-sub svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
}
.plan-badge {
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}
.plan-badge.pro { background: #dbeafe; color: #1e40af; }
.plan-badge.free { background: #f1f5f9; color: #475569; }
.plan-badge.enterprise { background: #fae8ff; color: #86198f; }

/* Selección visual de empresas en modales */
.check-grid-visual {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.check-card-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  transition: all .12s ease;
  user-select: none;
}
.check-card-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.check-card-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
}
.check-card-item:has(input:checked) {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e40af;
  font-weight: 600;
}

/* Indicadores de Vencimiento de Planes */
.sub-expiry {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
}
.expiry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.expiry-date {
  font-weight: 600;
  color: #334155;
}
.expiry-days {
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.expiry-days.ok { color: #16a34a; }
.expiry-days.warning { color: #d97706; }
.expiry-days.danger { color: #dc2626; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.activo { background: #dcfce7; color: #166534; }
.status-badge.suspendido { background: #fee2e2; color: #991b1b; }

.btn.amber { background: #d97706; color: #fff; }
.btn.amber:hover { background: #b45309; }
.btn.sm.icon { padding: 4px 8px; font-size: 12px; }



/* ==========================================================================
   Analíticas & APM (Monitoreo en Tiempo Real)
   ========================================================================== */
.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.analytics-time-group,
.time-range-picker {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  align-items: center;
}
.btn-time {
  border: 0;
  background: none;
  font: 500 12.5px 'Outfit', sans-serif;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: .12s;
}
.btn-time:hover { color: var(--text); }
.btn-time.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  font-weight: 600;
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #16a34a;
  font-weight: 600;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 4px 10px;
  border-radius: 12px;
}
.live-indicator .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  animation: pulseLive 1.8s infinite;
}
@keyframes pulseLive {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.analytics-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
}
.alert-banner.critical { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; }
.alert-banner.warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-banner.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-banner svg { width: 18px; height: 18px; flex: none; }

.charts-row,
.analytics-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.charts-row > *,
.analytics-charts-grid > * {
  min-width: 0;
}
.chart-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.chart-title { font-size: 14px; font-weight: 600; color: var(--text); }
.chart-meta { font-size: 12px; color: var(--muted); }
.svg-chart-container,
.chart-container {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.svg-chart-container svg,
.chart-container svg { width: 100%; height: 100%; }

.endpoints-grid,
.analytics-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.endpoints-grid > *,
.analytics-details-grid > * {
  min-width: 0;
}
@media (max-width: 1024px) {
  .endpoints-grid,
  .analytics-details-grid { grid-template-columns: 1fr; }
}

/* Tablas y Contenedores APM / Analíticas */
.table-wrap,
.tablewrap.analytics-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

table.analytics-table {
  min-width: 0 !important;
  width: 100% !important;
}
table.analytics-table.endpoints-table {
  min-width: 480px !important;
}
table.analytics-table.errors-table {
  min-width: 820px !important;
}
table.analytics-table th {
  padding: 9px 12px;
  font-size: 11px;
  background: #f8fafc;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid var(--line);
}
table.analytics-table td {
  padding: 8px 12px;
  font-size: 12.5px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
}
.status-pill.s2xx { background: #dcfce7; color: #166534; }
.status-pill.s3xx { background: #e0f2fe; color: #0369a1; }
.status-pill.s4xx { background: #fef3c7; color: #92400e; }
.status-pill.s429 { background: #ffedd5; color: #c2410c; }
.status-pill.s5xx { background: #fee2e2; color: #991b1b; }

.method-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
}
.method-pill.GET { background: #e0f2fe; color: #0284c7; }
.method-pill.POST { background: #dcfce7; color: #16a34a; }
.method-pill.PUT { background: #fef3c7; color: #d97706; }
.method-pill.DELETE { background: #fee2e2; color: #dc2626; }

.log-table td { padding: 9px 12px; font-size: 12.5px; vertical-align: middle; }
.log-table th { padding: 10px 12px; font-size: 12px; }
.log-message-preview {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #4b5563;
}

/* Transacciones y Pagos */
.kpi-icon.emerald { background: #ecfdf5; color: #059669; }
.kpi-icon.indigo { background: #e0e7ff; color: #4338ca; }

.tx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tx-badge.aprobado { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.tx-badge.pendiente { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.tx-badge.rechazado, .tx-badge.fallido { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.tx-method {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
}

.tx-ref-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  color: #334155;
}
.tx-ref-code {
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-copy-mini {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
}
.btn-copy-mini:hover {
  color: #1e40af;
  background: #eff6ff;
}
.btn-copy-mini svg {
  width: 13px !important;
  height: 13px !important;
}

.spin-fast {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}


/* ------------------------------------------------------------------ Configuración (modal con pestañas verticales) */
.modal.cfg { width: min(1040px, calc(100vw - 32px)); max-height: none; border-radius: 20px; overflow: hidden; }
.modal.cfg[open] { display: flex; flex-direction: column; height: min(780px, calc(100vh - 48px)); }
.modal.cfg::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); }
.cfg svg { width: 16px; height: 16px; flex: none; }

.cfg-head { display: flex; align-items: center; gap: var(--space-4); padding: 20px 24px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface); }
.cfg-head-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-subtle); border: 1px solid var(--brand-border); color: var(--brand-primary); flex: none; }
.cfg-head-ico svg { width: 22px; height: 22px; }
.cfg-head-text { flex: 1; min-width: 0; }
.cfg-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 20px; letter-spacing: -.015em; }
.cfg-head p { margin: 2px 0 0; color: var(--text-muted); font-size: var(--font-sm); }

.cfg-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--radius-full); font-size: var(--font-2xs); font-weight: 600; letter-spacing: .02em; line-height: 16px; background: var(--bg-surface-inset); color: var(--text-secondary); border: 1px solid transparent; white-space: nowrap; }
.cfg-pill.ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.cfg-pill.warn { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: var(--status-warning-border); }
.cfg-pill.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.cfg-main { flex: 1; min-height: 0; display: flex; margin: 0; }
.cfg-nav { width: 280px; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 20px 16px; background: var(--bg-surface-subtle); border-right: 1px solid var(--border-subtle); overflow-y: auto; }
.cfg-nav-title { padding: 0 10px 6px; font-size: var(--font-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.cfg-tab { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-md); background: none; color: var(--text-secondary); font-family: inherit; font-size: var(--font-base); font-weight: 500; line-height: 1.2; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.cfg-tab:hover { background: var(--bg-surface-inset); color: var(--text-primary); }
.cfg-tab:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.cfg-tab.active { background: var(--brand-hover); color: #fff; box-shadow: 0 4px 10px -4px rgba(37, 99, 235, .5); }
.cfg-tab-ico { display: grid; place-items: center; }
.cfg-tab-label { flex: 1; min-width: 0; }
.cfg-tab.active .cfg-pill { background: rgba(255, 255, 255, .2); color: #fff; border-color: transparent; }

.cfg-panels { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 28px 28px; }
.cfg-panel[hidden] { display: none; }
.cfg-panel { display: flex; flex-direction: column; gap: 18px; animation: cfgIn .18s ease-out; }
@keyframes cfgIn { from { opacity: 0; transform: translateY(4px); } }

.cfg-sec-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); margin-top: 6px; }
.cfg-panel > .cfg-sec-head:first-child { margin-top: 0; }
.cfg-sec-ico { display: grid; place-items: center; color: var(--brand-hover); }
.cfg-sec-head h3 { flex: 1; font-size: var(--font-sm); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.cfg-sec-aside { font-size: var(--font-xs); color: var(--text-muted); }
.cfg-note { margin: -6px 0 0; font-size: var(--font-sm); color: var(--text-muted); }
.cfg-link { border: 0; background: none; padding: 0; font: inherit; color: var(--brand-hover); text-decoration: underline; cursor: pointer; }

.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
.cfg-grid .span2 { grid-column: 1 / -1; }
.cfg .field { gap: 6px; }
.cfg .field label { display: flex; justify-content: space-between; align-items: center; font-size: var(--font-sm); font-weight: 500; color: var(--text-primary); }
.cfg input:not([type="checkbox"]):not([type="radio"]), .cfg select { height: 42px; width: 100%; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid #cbd5e1; font-size: var(--font-base); }
.cfg input:not([type="checkbox"]):not([type="radio"]):focus, .cfg select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.cfg .hint { font-size: var(--font-xs); color: var(--text-muted); }
.cfg-saved { font-size: var(--font-xs); font-weight: 600; color: var(--status-success-text); }
.cfg-saved::before { content: '✓ '; }
.cfg-pass { position: relative; }
.cfg-pass input { padding-right: 42px !important; }
.cfg-eye { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); cursor: pointer; }
.cfg-eye:hover { background: var(--bg-surface-inset); color: var(--text-primary); }
.cfg-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.cfg-actions .btn { height: 40px; padding: 0 16px; border-radius: var(--radius-md); }
.cfg-ok { color: var(--status-success-text); } .cfg-err { color: var(--status-error-text); }

.cfg-status { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border-subtle); background: var(--bg-surface-subtle); }
.cfg-status-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--text-muted); color: #fff; flex: none; }
.cfg-status-text { display: flex; flex-direction: column; gap: 2px; font-size: var(--font-sm); color: var(--text-secondary); min-width: 0; overflow-wrap: anywhere; }
.cfg-status-text b { font-size: var(--font-base); color: var(--text-primary); }
.cfg-status.ok { background: linear-gradient(135deg, #ecfdf5, #f0fdf9); border-color: #a7f3d0; } .cfg-status.ok .cfg-status-ico { background: #10b981; }
.cfg-status.warn { background: var(--status-warning-bg); border-color: var(--status-warning-border); } .cfg-status.warn .cfg-status-ico { background: #f59e0b; }
.cfg-status.bad { background: #fef2f2; border-color: #fecaca; } .cfg-status.bad .cfg-status-ico { background: #ef4444; }

.cfg-check { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-top: 22px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface-subtle); font-size: var(--font-sm); cursor: pointer; }
.cfg-check span { display: flex; flex-direction: column; font-weight: 500; }
.cfg-check small { font-weight: 400; color: var(--text-muted); font-size: var(--font-xs); }
.cfg-check input { width: 18px; height: 18px; accent-color: var(--brand-hover); flex: none; }

.cfg-switch { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--brand-border); border-radius: 14px; background: var(--brand-subtle); cursor: pointer; }
.cfg-switch-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #dbeafe; color: var(--brand-hover); flex: none; }
.cfg-switch-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cfg-switch-text b { font-size: var(--font-base); }
.cfg-switch-text small { color: var(--text-secondary); font-size: var(--font-sm); }
.cfg-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.cfg-track { position: relative; width: 44px; height: 24px; border-radius: var(--radius-full); background: #cbd5e1; flex: none; transition: background .2s; }
.cfg-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.cfg-switch input:checked ~ .cfg-track { background: var(--brand-hover); }
.cfg-switch input:checked ~ .cfg-track::after { transform: translateX(20px); }
.cfg-switch input:focus-visible ~ .cfg-track { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.cfg-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cfg-choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cfg-choice { position: relative; display: flex; gap: 10px; padding: 16px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.cfg-choice:hover { border-color: #93c5fd; }
.cfg-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cfg-choice-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cfg-choice-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 600; font-size: var(--font-base); color: var(--text-primary); }
.cfg-choice-desc { font-size: var(--font-sm); color: var(--text-secondary); line-height: 1.45; }
.cfg-choice-mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #cbd5e1; color: transparent; flex: none; }
.cfg-choice-mark svg { width: 12px !important; height: 12px !important; }
.cfg-choice:has(input:checked) { border-color: var(--brand-hover); background: var(--brand-subtle); box-shadow: 0 0 0 1px var(--brand-hover); }
.cfg-choice:has(input:checked) .cfg-choice-mark { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.cfg-choice:has(input:focus-visible) { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.cfg-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--font-xs); color: var(--text-muted); }
.cfg-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-full); background: var(--bg-surface); color: var(--text-primary); font-family: inherit; font-size: var(--font-xs); font-weight: 500; cursor: pointer; transition: border-color .15s, background .15s; }
.cfg-chip small { color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.cfg-chip:hover { border-color: var(--brand-hover); background: var(--brand-subtle); }

.cfg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border-subtle); background: var(--bg-surface-subtle); }
.cfg-foot-note { display: inline-flex; align-items: center; gap: 8px; font-size: var(--font-sm); color: var(--text-muted); }
.cfg-foot-btns { display: flex; gap: 10px; }
.cfg-foot .btn { height: 40px; padding: 0 18px; border-radius: var(--radius-md); }
.cfg-foot .btn.blue { box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .55); }

@media (max-width: 900px) {
  .cfg-choices.three { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .modal.cfg[open] { height: calc(100vh - 24px); }
  .cfg-main { flex-direction: column; }
  .cfg-nav { width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .cfg-nav-title, .cfg-tab .cfg-pill { display: none; }
  .cfg-tab { width: auto; white-space: nowrap; flex: none; }
  .cfg-panels { padding: 18px 16px 24px; }
  .cfg-grid, .cfg-choices { grid-template-columns: 1fr; }
  .cfg-head { padding: 16px; } .cfg-head-ico { display: none; }
  .cfg-foot { padding: 12px 16px; } .cfg-foot-note { display: none; } .cfg-foot-btns { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .cfg-panel { animation: none; } .cfg-track, .cfg-track::after, .cfg-choice, .cfg-tab { transition: none; }
}


/* ------------------------------------------------------------------ Productos: homologación Dropi → Siigo (página con paginación) */
.pr-page svg { width: 16px; height: 16px; flex: none; }
.pr-page { --text-muted: #55627a; padding-bottom: 120px; } /* gris más oscuro: 4,5:1 sobre el fondo de la app */ /* espacio para que la barra de cambios sin guardar no tape el paginador */
.pr-actions .btn { height: 40px; padding: 0 16px; border-radius: var(--radius-md); }
.pr-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: var(--space-4); }
.pr-kpi { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: var(--shadow-card); min-width: 0; }
.pr-kpi > div:last-child { display: flex; flex-direction: column; min-width: 0; }
.pr-kpi small { font-size: var(--font-2xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.pr-kpi b { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pr-kpi b i { font-style: normal; font-size: var(--font-sm); font-weight: 500; color: var(--text-muted); }
.pr-kpi em { font-style: normal; font-size: var(--font-xs); color: var(--text-muted); }
.pr-kpi-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-subtle); color: var(--brand-hover); flex: none; }
.pr-kpi.warn .pr-kpi-ico { background: var(--status-warning-bg); color: var(--status-warning-text); } .pr-kpi.warn b { color: var(--status-warning-text); }
.pr-kpi.combo { border-color: var(--brand-border); background: var(--brand-subtle); }
.pr-ring { --p: 0; position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none; background: conic-gradient(#10b981 calc(var(--p) * 1%), #e2e8f0 0); display: grid; place-items: center; }
.pr-ring::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg-surface); }
.pr-ring span { position: relative; font-size: 11px; font-weight: 700; color: #065f46; }

.pr-card { padding: var(--space-4) var(--space-6) var(--space-6); }
.pr-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.pr-search { position: relative; flex: 1; min-width: 240px; max-width: 440px; display: flex; align-items: center; }
.pr-search .sb-ico { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
.pr-search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border: 1px solid #cbd5e1; border-radius: var(--radius-md); background: var(--bg-surface); }
.pr-search input:focus, .pr-row input:focus, .pr-size select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.pr-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pr-tab { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-full); background: var(--bg-surface); color: var(--text-secondary); font-family: inherit; font-size: var(--font-sm); font-weight: 500; cursor: pointer; }
.pr-tab span { font-size: var(--font-2xs); font-weight: 600; padding: 1px 7px; border-radius: var(--radius-full); background: var(--bg-surface-inset); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.pr-tab:hover { border-color: #93c5fd; }
.pr-tab.active { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.pr-tab.active span { background: rgba(255, 255, 255, .22); color: #fff; }
.pr-tab:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.pr-hint { margin: 0 0 14px; }

.pr-list { display: flex; flex-direction: column; gap: 10px; transition: opacity .15s; }
.pr-list.loading { opacity: .55; pointer-events: none; }
.pr-added { margin-bottom: 10px; padding: 10px; border: 1px dashed var(--brand-border); border-radius: 14px; background: var(--brand-subtle); }
.pr-row { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: var(--shadow-sm); border-left: 4px solid transparent; }
.pr-row.pending { border-left-color: #f59e0b; }
.pr-row.simple { border-left-color: #10b981; }
.pr-row.combo { border-left-color: var(--brand-hover); }
.pr-row.combo.open { border-color: var(--brand-border); border-left-color: var(--brand-hover); box-shadow: var(--shadow-card); }
.pr-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 20px; padding: 14px 16px; align-items: start; }
.pr-name { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; color: var(--text-primary); }
.pr-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; color: var(--text-muted); }
.pr-info input + input { margin-top: 6px; }
.pr-row input:not([type="checkbox"]) { width: 100%; height: 38px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: var(--radius-md); font-size: var(--font-sm); background: var(--bg-surface); }
.pr-map { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pr-map .desc-in { color: var(--text-secondary); }
.pr-row input.sug-alta { background: #f0fdf4; border-color: #86efac; }
.pr-row input.sug-media { background: #fffbeb; border-color: #fcd34d; }
.pr-status { font-size: var(--font-xs); color: var(--text-muted); overflow-wrap: anywhere; margin-top: 2px; }
.pr-status:empty { display: none; }
.pr-status.ok { color: var(--status-success-text); } .pr-status.bad { color: var(--status-error-text); }
.pr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pr-side .btn { white-space: nowrap; }
.pr-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-full); font-size: var(--font-2xs); font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.pr-badge svg { width: 12px !important; height: 12px !important; }
.pr-badge.ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.pr-badge.warn { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: var(--status-warning-border); }
.pr-badge.combo { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.pr-combo-sum { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--radius-md); background: var(--brand-subtle); border: 1px solid var(--brand-border); color: #1e40af; font-size: var(--font-sm); }

.pr-break { margin: 0 16px 16px; padding: 14px; border-radius: 12px; background: var(--bg-surface-subtle); border: 1px solid var(--border-subtle); }
.pr-break-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-weight: 600; font-size: var(--font-sm); }
.pr-break-head > span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--text-primary); }
.pr-break-head small { font-weight: 400; color: var(--text-muted); }
.pr-sum { padding: 3px 10px; border-radius: var(--radius-full); font-size: var(--font-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.pr-sum.ok { background: #ecfdf5; color: #065f46; } .pr-sum.bad { background: #fef2f2; color: #991b1b; }
.pr-table-wrap { overflow-x: auto; }
.pr-table { width: 100%; table-layout: fixed; min-width: 560px; border-collapse: collapse; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 10px; }
.pr-table th { padding: 8px 10px; text-align: left; font-size: var(--font-2xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); background: var(--bg-surface-subtle); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.pr-table th:nth-child(1) { width: 40px; } .pr-table th:nth-child(3) { width: 130px; } .pr-table th:nth-child(4) { width: 130px; } .pr-table th:nth-child(5) { width: 52px; }
.pr-table td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid var(--border-subtle); }
.pr-table tr:last-child td { border-bottom: 0; }
.pr-table .pr-n { color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: 16px; }
.pr-row .pr-table .qty-in { width: 100px; }
.pr-pct { display: inline-flex; align-items: center; gap: 6px; } .pr-row .pr-pct input { width: 84px; } .pr-pct b { color: var(--text-muted); font-weight: 500; }
.pr-break-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.pr-skel { display: grid; grid-template-columns: 1fr 1.2fr 140px; gap: 20px; padding: 18px 16px; }
.pr-skel div { height: 38px; border-radius: 8px; background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9); background-size: 200% 100%; animation: prShimmer 1.2s linear infinite; }
@keyframes prShimmer { to { background-position: -200% 0; } }
.pr-empty { padding: 28px; text-align: center; color: var(--text-muted); background: var(--bg-surface-subtle); border: 1px dashed var(--border-subtle); border-radius: 14px; }
.pr-addrow { margin: 14px 0 0; }

.pr-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.pr-pager-info, .pr-size { font-size: var(--font-sm); color: var(--text-muted); }
.pr-pager-info b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pr-pager-nav { display: flex; align-items: center; gap: 4px; }
.pr-pager-nav .btn.sm { width: 34px; height: 34px; padding: 0; justify-content: center; }
.pr-pg { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-md); background: none; color: var(--text-secondary); font-family: inherit; font-size: var(--font-sm); font-weight: 500; cursor: pointer; font-variant-numeric: tabular-nums; }
.pr-pg:hover { background: var(--bg-surface-inset); }
.pr-pg.active { background: var(--brand-hover); color: #fff; }
.pr-pg:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.pr-gap { padding: 0 4px; color: var(--text-muted); }
.pr-size { display: inline-flex; align-items: center; gap: 8px; }
.pr-size select { height: 34px; padding: 0 8px; border-radius: var(--radius-md); }

.pr-savebar { position: fixed; left: 50%; bottom: 20px; z-index: 40; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: 16px; background: var(--text-primary); color: #fff; box-shadow: 0 10px 15px -3px rgba(15, 23, 42, .25), 0 4px 6px -4px rgba(15, 23, 42, .2); transition: opacity .18s, transform .18s; max-width: calc(100vw - 24px); }
.pr-savebar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.pr-savebar .pr-dot { width: 8px; height: 8px; border-radius: 50%; background: #60a5fa; flex: none; }
.pr-savebar #prDirty { font-size: var(--font-sm); font-weight: 500; white-space: nowrap; }
.pr-savebar .btn { height: 38px; padding: 0 16px; border-radius: var(--radius-md); }
.pr-savebar .btn.ghost { background: transparent; color: #e2e8f0; border-color: #475569; }
.pr-savebar .btn.ghost:hover { background: #1e293b; }
.pr-savebar kbd { margin-left: 4px; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .2); font: 600 11px ui-monospace, Consolas, monospace; }

@media (max-width: 980px) {
  .pr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pr-head { grid-template-columns: 1fr; gap: 10px; }
  .pr-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .pr-kpis { grid-template-columns: 1fr; }
  .pr-card { padding: var(--space-3); }
  .pr-pager { justify-content: center; } .pr-savebar kbd { display: none; }
  .pr-savebar { flex-wrap: wrap; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .pr-savebar, .pr-list { transition: none; } .pr-skel div { animation: none; }
}

/* ------------------------------------------------------------------ Mi perfil y cuenta */
.sb-user { display: block; text-decoration: none; border-radius: var(--radius-md); padding: 6px 12px; transition: background .15s, color .15s; }
a.sb-user:hover, a.sb-user.active { background: rgba(255,255,255,.08); color: #fff; }
a.sb-user:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.pf-page { --text-muted: #55627a; max-width: 1280px; }
.pf-page svg { width: 16px; height: 16px; flex: none; }
.pf-page [hidden] { display: none !important; }
.pf-top { align-items: center; }
.pf-env { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); box-shadow: var(--shadow-sm); min-width: 0; }
.pf-env-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--brand-subtle); color: var(--brand-hover); flex: none; }
.pf-env small { display: block; font-size: var(--font-xs); color: var(--text-muted); }
.pf-env-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pf-env-name b { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-sm); }


.pf-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-full); font-size: var(--font-2xs); font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--bg-surface-inset); color: var(--text-secondary); border: 1px solid transparent; }
.pf-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pf-pill.ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.pf-pill.warn { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: var(--status-warning-border); }
.pf-pill.bad { background: var(--status-error-bg); color: var(--status-error-text); border-color: var(--status-error-border); }
.pf-pill.brand { background: #dbeafe; color: #1e3a8a; border-color: #bfdbfe; text-transform: uppercase; letter-spacing: .04em; }
.pf-pill svg { width: 13px !important; height: 13px !important; }
.pf-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-sm); background: var(--bg-surface-inset); color: var(--text-secondary); font-size: var(--font-xs); font-weight: 600; white-space: nowrap; }
.pf-tag.right { margin-left: auto; }
.pf-muted { color: var(--text-muted); font-size: var(--font-sm); }

.pf-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-4); }
.pf-card { margin: 0; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pf-profile { grid-column: span 4; justify-content: space-between; }
.pf-plan { grid-column: span 8; }
.pf-companies { grid-column: span 5; }
.pf-activity { grid-column: span 7; }
.pf-integrations, .pf-payments { grid-column: span 6; }

.pf-profile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pf-avatar { position: relative; display: grid; place-items: center; width: 80px; height: 80px; border-radius: 20px; background: var(--brand-subtle); border: 1px solid var(--brand-border); color: var(--brand-primary); font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.pf-avatar-ok { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #10b981; color: #fff; border: 2px solid var(--bg-surface); }
.pf-avatar-ok svg { width: 12px !important; height: 12px !important; }
.pf-name { font-size: 22px; letter-spacing: -.015em; overflow-wrap: anywhere; }
.pf-mail { margin: 2px 0 0; color: var(--text-muted); font-size: var(--font-sm); overflow-wrap: anywhere; }
.pf-since { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-md); background: var(--bg-surface-subtle); border: 1px solid var(--border-subtle); color: var(--text-muted); }
.pf-since small, .pf-mini small { display: block; font-size: var(--font-xs); color: var(--text-muted); }
.pf-since b { font-size: var(--font-sm); color: var(--text-primary); font-weight: 600; }
.pf-actions { display: flex; flex-direction: column; gap: 6px; }
.pf-wide { width: 100%; justify-content: center; height: 40px; border-radius: var(--radius-md); }
.btn.pf-link { background: none; border: 0; color: var(--text-secondary); height: 36px; }
.btn.pf-link:hover { background: var(--bg-surface-subtle); color: var(--brand-hover); }
.btn.pf-link.danger:hover { color: var(--status-error-text); }
.pf-card .btn:not(.pf-link):not(.pf-wide) { height: 38px; padding: 0 14px; border-radius: var(--radius-md); }

.pf-plan-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pf-plan-id { display: flex; align-items: center; gap: 12px; }
.pf-plan-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-hover); color: #fff; flex: none; }
.pf-plan-ico svg { width: 20px !important; height: 20px !important; }
.pf-plan-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.pf-plan-name h2 { font-size: 20px; letter-spacing: -.015em; }
.pf-plan small, .pf-card-head small { color: var(--text-muted); font-size: var(--font-xs); }
.pf-price { text-align: right; } .pf-price b { font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .pf-price small { font-size: var(--font-sm); }
.pf-usage { padding: 16px; border-radius: 14px; background: var(--bg-surface-subtle); border: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 10px; }
.pf-usage-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: var(--font-sm); }
.pf-usage-head > span { display: inline-flex; align-items: center; gap: 8px; }
.pf-usage-head b { color: var(--brand-hover); font-variant-numeric: tabular-nums; }
.pf-bar { height: 12px; border-radius: var(--radius-full); background: var(--bg-surface-inset); overflow: hidden; }
.pf-bar > div { height: 100%; border-radius: var(--radius-full); background: var(--brand-hover); transition: width .4s ease; }
.pf-bar.warn > div { background: #d97706; } .pf-bar.bad > div { background: #dc2626; }
.pf-plan a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.pf-usage-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: var(--font-xs); color: var(--text-muted); }
.pf-usage-foot code { font: 600 12px ui-monospace, Consolas, monospace; color: var(--text-primary); }
.pf-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pf-mini { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
.pf-mini b { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-sm); font-weight: 600; }
.pf-mini b.ok { color: #047857; }
.pf-mini .pf-tag { align-self: flex-start; background: var(--brand-subtle); color: #1e40af; }
.pf-mini .pf-muted { font-size: var(--font-xs); }
.pf-plan-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
/* Los 4 botones van en una sola fila; solo saltan de línea si la pantalla es muy angosta. */
.pf-plan-btns { display: contents; }
.pf-plan-foot .btn { white-space: nowrap; height: 38px; padding: 0 12px; font-size: var(--font-sm); }
.pf-plan-foot #pfUpgrade { margin-left: auto; }

.pf-card-head { display: flex; align-items: center; gap: 12px; }
.pf-card-head h3 { font-size: var(--font-md); }
.pf-card-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-subtle); color: var(--brand-hover); flex: none; }
.pf-card-ico.sm { width: 32px; height: 32px; }
.pf-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-subtle); font-size: var(--font-sm); color: var(--text-muted); }
.pf-card-foot b { color: var(--text-primary); }
.pf-card-foot.end { justify-content: flex-end; }
.pf-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: var(--font-sm); color: var(--brand-hover); text-decoration: none; }
.pf-more:hover { text-decoration: underline; }

.pf-co-list, .pf-int-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pf-co { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
.pf-co.active { background: var(--brand-subtle); border-color: var(--brand-border); }
.pf-co > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pf-co b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-sm); }
.pf-co code, .pf-int-list small { font: 500 12px ui-monospace, Consolas, monospace; color: var(--text-muted); }
.pf-co-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--bg-surface-inset); color: var(--text-secondary); font-weight: 700; font-size: var(--font-sm); flex: none; }
.pf-co.active .pf-co-ico { background: var(--brand-hover); color: #fff; }

.pf-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pf-metric { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; background: var(--bg-surface-subtle); border: 1px solid var(--border-subtle); }
.pf-metric-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pf-metric small { font-size: var(--font-2xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.pf-metric b { font-size: 28px; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pf-metric b.bad, .pf-metric em.bad { color: var(--status-error-text); }
.pf-metric em { font-style: normal; font-size: var(--font-xs); color: var(--text-muted); }
.pf-metric em.ok { color: #047857; }
.pf-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--bg-surface-inset); color: var(--text-secondary); flex: none; }
.pf-dot.ok { background: #d1fae5; color: #065f46; } .pf-dot.bad { background: var(--status-error-bg); color: var(--status-error-text); }
.pf-dot svg { width: 14px !important; height: 14px !important; }
.pf-dot.bad.muted { background: var(--bg-surface-inset); color: var(--text-muted); }

.pf-int-list li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-md); background: var(--bg-surface-subtle); border: 1px solid var(--border-subtle); }
.pf-int-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pf-int-list b { font-size: var(--font-sm); }
.pf-int-list small { font-family: inherit; font-size: var(--font-xs); }
.pf-int-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--brand-subtle); color: var(--brand-hover); flex: none; }

.pf-table-wrap { overflow-x: auto; margin-top: -8px; }
.pf-table { width: 100%; min-width: 0; border-collapse: collapse; font-size: var(--font-sm); } .pf-table td:nth-child(2) { white-space: nowrap; }
.pf-table th { padding: 8px 10px; text-align: left; font-size: var(--font-xs); font-weight: 600; color: var(--text-muted); background: var(--bg-surface-subtle); }
.pf-table th:first-child { border-radius: 8px 0 0 8px; } .pf-table th:last-child { border-radius: 0 8px 8px 0; }
.pf-table td { padding: 10px; border-bottom: 1px solid var(--border-subtle); font-variant-numeric: tabular-nums; }
.pf-table tr:last-child td { border-bottom: 0; }
.pf-table .r { text-align: right; }
.pf-table code { font: 600 12px ui-monospace, Consolas, monospace; }

@media (max-width: 1100px) {
  .pf-profile, .pf-plan, .pf-companies, .pf-activity, .pf-integrations, .pf-payments { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .pf-trio, .pf-metrics { grid-template-columns: 1fr; }
  .pf-price { text-align: left; }
  .pf-env { width: 100%; }
}

/* Mi perfil: formularios (editar nombre / actualizar contraseña) */
.modal.pf-modal { width: min(480px, calc(100vw - 32px)); max-height: none; border-radius: 20px; overflow: hidden; }
.modal.pf-modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); }
.pf-modal svg { width: 16px; height: 16px; flex: none; }
.pf-modal-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--border-subtle); }
.pf-modal-head > div { flex: 1; min-width: 0; }
.pf-modal-head h2 { font-size: 18px; letter-spacing: -.01em; }
.pf-modal-head p { margin: 2px 0 0; font-size: var(--font-sm); color: #55627a; }
.pf-modal-body { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; }
.pf-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border-subtle); background: var(--bg-surface-subtle); }
.pf-modal-foot .btn { height: 40px; padding: 0 18px; border-radius: var(--radius-md); }
.pf-modal .field { gap: 6px; }
.pf-modal .field label { font-size: var(--font-sm); font-weight: 500; color: var(--text-primary); }
.pf-modal input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: var(--radius-md); font-size: var(--font-base); background: var(--bg-surface); }
.pf-modal input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.pf-modal input:disabled { background: var(--bg-surface-inset); color: #55627a; cursor: not-allowed; }
.pf-modal .hint { font-size: var(--font-xs); color: #55627a; }
.pf-pass { position: relative; }
.pf-pass input { padding-right: 44px; }
.pf-eye { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none; color: #55627a; cursor: pointer; }
.pf-eye:hover { background: var(--bg-surface-inset); color: var(--text-primary); }
.pf-eye:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.pf-rules { list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; border-radius: var(--radius-md); background: var(--bg-surface-subtle); border: 1px solid var(--border-subtle); font-size: var(--font-sm); color: #55627a; }
.pf-rules li { display: flex; align-items: center; gap: 8px; }
.pf-rules li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #cbd5e1; flex: none; }
.pf-rules li.ok { color: #065f46; }
.pf-rules li.ok::before { background: #10b981 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat; border-color: #10b981; }
.pf-form-error { padding: 10px 12px; border-radius: var(--radius-md); background: var(--status-error-bg); border: 1px solid var(--status-error-border); color: var(--status-error-text); font-size: var(--font-sm); }
.pf-form-error[hidden] { display: none; }
@media (max-width: 520px) { .pf-modal-head, .pf-modal-body, .pf-modal-foot { padding-left: 16px; padding-right: 16px; } }

/* Mi perfil: tarjeta de cobro */
.pf-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pf-brand { position: absolute; right: 12px; top: 0; height: 42px; display: flex; align-items: center; font-size: var(--font-2xs); font-weight: 700; letter-spacing: .06em; color: var(--brand-hover); pointer-events: none; }
.pf-modal .pf-pass input { padding-right: 96px; }
.pf-secure { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: var(--font-xs); color: #55627a; }
.pf-secure svg { margin-top: 2px; color: #047857; }
.pf-test-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--brand-subtle); border: 1px solid var(--brand-border); color: #1e3a8a; font-size: var(--font-sm); }
.pf-test-note[hidden] { display: none; }
.pf-test-note svg { margin-top: 3px; }
.pf-test-note code { font: 600 12px ui-monospace, Consolas, monospace; background: #dbeafe; padding: 1px 5px; border-radius: 4px; }
.pf-card-ico.warn { background: var(--status-warning-bg); color: var(--status-warning-text); }
.pf-confirm-text { margin: 0; font-size: var(--font-sm); color: var(--text-secondary); line-height: 1.55; }
.btn.red { color: #fff; }
.btn.red:disabled { opacity: .6; }
@media (max-width: 520px) { .pf-two { grid-template-columns: 1fr; } }

.pf-pay-empty { margin: 0; padding: 18px; text-align: center; border: 1px dashed var(--border-subtle); border-radius: var(--radius-md); }
.pf-pay-empty[hidden], .pf-table-wrap[hidden] { display: none; }
.pf-table td.num { text-align: right; } .pf-table th.num { text-align: right; }
.pf-pay-plan { display: block; font-weight: 500; }
.pf-table .pf-pay-method { display: block; color: var(--text-muted); font-size: var(--font-xs); }
.pf-payments .pf-table td, .pf-payments .pf-table th { white-space: nowrap; }
