/* ============================================================
   Magic Realm – Design System (Light)
   Sidebar: Deep purple  |  Content: White/light gray
   Accent: Purple #7c3aed + Teal #10b981
   Font: Inter (body) + Poppins (display) + Roboto Mono (data)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@600;700;800&family=Roboto+Mono:wght@500;700&display=swap');

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:           #f0f2fa;
  --surface:      #ffffff;
  --surface-2:    #f8f9fd;
  --border:       #e2e8f0;
  --text:         #1e1b4b;
  --text-muted:   #64748b;

  --accent:       #7c3aed;
  --accent-dark:  #5b21b6;
  --accent-glow:  rgba(124,58,237,.1);
  --teal:         #10b981;
  --teal-dark:    #059669;

  --positive:     #059669;
  --negative:     #dc2626;
  --warning:      #d97706;

  --sidebar-bg:   #1a0f3c;

  --font-body:    'Inter', sans-serif;
  --font-display: 'Poppins', sans-serif;
  --font-mono:    'Roboto Mono', monospace;

  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 10px rgba(30,16,64,.07);
  --shadow-md:    0 4px 24px rgba(30,16,64,.12);
  --transition:   .2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4 { font-family: var(--font-display); line-height: 1.2; }
a { color: var(--accent); text-decoration: none; }

::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--surface-2); }
::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }

/* ── App Layout ─────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR (stays dark)
══════════════════════════════════════════════════════════════ */
.sidebar {
  grid-row: 1 / -1;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo--admin {
  padding: 28px 20px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar-brand-img {
  height: 62px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
  display: block;
  margin-bottom: 4px;
  /* Invierte logo oscuro a blanco para el sidebar púrpura oscuro */
  filter: brightness(0) invert(1);
}

.sidebar-logo--admin .sidebar-brand-img {
  height: 62px;
  max-width: 210px;
  margin-bottom: 0;
}

/* Si el logo ya tiene colores propios (ej. logo en color), quitar el filtro */
.sidebar-brand-img.logo-color {
  filter: none;
  background: rgba(255,255,255,.08);
  border-radius: 6px;
  padding: 3px 6px;
}

.sidebar-logo .tagline {
  font-size: .66rem;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 4px;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: .82rem;
  color: #fff; flex-shrink: 0;
}

.sidebar-user .user-name { font-weight: 600; font-size: .85rem; color: #fff; }
.sidebar-user .user-role { font-size: .7rem; color: rgba(255,255,255,.4); }
.sidebar-user-hint       { font-size: .63rem; color: rgba(255,255,255,.28); margin-top: 2px; }

.sidebar-nav { padding: 14px 10px; flex: 1; }

.nav-label {
  font-size: .62rem; text-transform: uppercase;
  letter-spacing: 1.5px; color: rgba(255,255,255,.28);
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: .87rem; font-weight: 500;
  color: rgba(255,255,255,.55); transition: var(--transition);
  margin-bottom: 2px; border: 1px solid transparent; background: none;
  width: 100%; text-align: left;
}
.nav-item i { font-size: 1.05rem; }
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.nav-item.active {
  background: rgba(124,58,237,.22);
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(124,58,237,.35);
}
.nav-item.active i { color: rgba(167,139,250,.9); }

.sidebar-footer { padding: 0 10px; }

.btn-logout {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  border-radius: var(--radius-sm); border: none;
  background: none; color: rgba(255,255,255,.35);
  font-size: .85rem; cursor: pointer; transition: var(--transition);
}
.btn-logout:hover { color: #f87171; background: rgba(248,113,113,.08); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex; align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}
.topbar-meta  { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  padding: 28px 32px;
  overflow-y: auto;
  background: var(--bg);
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════════════════════════════
   KPI CARDS — Hero (gradient)
══════════════════════════════════════════════════════════════ */
.kpi-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.kpi-hero {
  border-radius: var(--radius);
  padding: 28px 26px 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.kpi-hero::after {
  content: '';
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  top: -70px; right: -60px;
  pointer-events: none;
}
.kpi-hero--purple { background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%); }
.kpi-hero--teal   { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }

.kpi-hero-icon {
  font-size: 1.15rem;
  opacity: .75;
  display: block;
  margin-bottom: 10px;
}
.kpi-hero .kpi-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.7);
  margin-bottom: 10px;
}
.kpi-hero .kpi-value {
  font-family: var(--font-mono);
  font-size: 2.5rem; font-weight: 800;
  color: #fff; line-height: 1;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.04em;
}
.kpi-hero .kpi-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: .73rem; font-weight: 500;
  padding: 4px 11px; border-radius: 20px;
}

/* ══════════════════════════════════════════════════════════════
   KPI CARDS — Secondary (bordered)
══════════════════════════════════════════════════════════════ */
.kpi-sec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.kpi-sec-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.kpi-sec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.kpi-sec:hover { box-shadow: var(--shadow-md); }
.kpi-sec--purple { background: rgba(124,58,237,.03); }
.kpi-sec--teal   { background: rgba(16,185,129,.03); }
.kpi-sec--orange { background: rgba(217,119,6,.03);  }
.kpi-sec--red    { background: rgba(220,38,38,.03);  }

.kpi-sec-top {
  display: flex; align-items: center; gap: 7px;
  color: var(--text-muted); font-size: .76rem;
  margin-bottom: 10px;
}
.kpi-sec-top i { font-size: .95rem; }
.kpi-sec--purple .kpi-sec-top i { color: var(--accent); }
.kpi-sec--teal   .kpi-sec-top i { color: var(--teal); }
.kpi-sec--orange .kpi-sec-top i { color: var(--warning); }
.kpi-sec--red    .kpi-sec-top i { color: var(--negative); }

.kpi-sec .kpi-value {
  font-family: var(--font-mono);
  font-size: 1.9rem; font-weight: 800;
  line-height: 1; margin-bottom: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.04em;
}
.kpi-sec--purple .kpi-value { color: var(--accent); }
.kpi-sec--teal   .kpi-value { color: var(--teal); }
.kpi-sec--orange .kpi-value { color: var(--warning); }
.kpi-sec--red    .kpi-value { color: var(--negative); }

.kpi-sec-sub { font-size: .74rem; color: var(--text-muted); }

/* Generic KPI (kept for compatibility) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 16px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative; overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow);
}
.kpi-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.kpi-label {
  font-size: .71rem; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-muted); margin-bottom: 8px;
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.75rem; font-weight: 700;
  line-height: 1; margin-bottom: 6px; color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.04em;
}
.kpi-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .73rem; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
}
.kpi-badge.positive { background: rgba(5,150,105,.1);  color: var(--positive); }
.kpi-badge.negative { background: rgba(220,38,38,.1);  color: var(--negative); }

/* ══════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.015em;
}

/* ── Progress bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 99px; height: 10px;
  overflow: hidden; margin: 8px 0;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.progress-label-inside { display: none; }
.progress-legend { font-size: .77rem; color: var(--text-muted); margin-top: 6px; }
.progress-legend strong { color: var(--accent); }

/* ── Chart grid ─────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px,1fr));
  gap: 16px; margin-bottom: 16px;
}
.chart-wrap {
  position: relative; height: 260px;
  display: flex; align-items: center; justify-content: center;
}

.agent-sales-ranking {
  position: relative;
  min-height: 392px;
  max-height: 392px;
  overflow-x: auto;
  overflow-y: auto;
  padding: 6px 22px 28px 0;
}

.agent-sales-chart {
  position: relative;
  min-width: 860px;
  min-height: 346px;
  padding: 0 18px 26px 0;
}

.agent-sales-axis,
.agent-sales-grid {
  position: absolute;
  left: 360px;
  right: 160px;
  top: 0;
  bottom: 28px;
  pointer-events: none;
}

.agent-sales-axis {
  top: auto;
  bottom: 0;
  height: 20px;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: .78rem;
}

.agent-sales-tick {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.agent-sales-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed rgba(148,163,184,.36);
}

.agent-sales-gridline:first-child {
  border-left-color: rgba(148,163,184,.65);
}

.agent-sales-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-sales-row {
  display: grid;
  grid-template-columns: 52px 280px minmax(260px, 1fr) 172px;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 31px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.agent-sales-rank {
  width: 34px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  background: #eef2f7;
  color: #475569;
  border: 1px solid rgba(203,213,225,.95);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: .86rem;
}

.agent-sales-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1f2937;
  font-size: .95rem;
  font-weight: 700;
}

.agent-sales-track {
  position: relative;
  height: 18px;
  border-radius: 5px;
}

.agent-sales-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(124,58,237,.26), rgba(167,139,250,.56));
  box-shadow: 0 6px 14px rgba(124,58,237,.10);
}

.agent-sales-amount {
  justify-self: end;
  padding-right: 12px;
  color: #1f2937;
  font-family: var(--font-mono);
  font-size: .96rem;
  font-weight: 800;
  white-space: nowrap;
}

.agent-sales-row--rank-1 .agent-sales-fill {
  background: linear-gradient(90deg, #7c3aed, #6d28d9);
  box-shadow: 0 8px 18px rgba(109,40,217,.22);
}

.agent-sales-row--rank-1 .agent-sales-rank {
  background: #f1ecff;
  border-color: rgba(124,58,237,.2);
  color: #7c3aed;
}

.agent-sales-row--rank-1 .agent-sales-name,
.agent-sales-row--rank-1 .agent-sales-amount {
  color: #6d28d9;
}

.agent-sales-row--soft .agent-sales-rank {
  background: rgba(124,58,237,.07);
  border-color: rgba(124,58,237,.16);
  color: #5b21b6;
}

.agent-sales-row--soft .agent-sales-name,
.agent-sales-row--soft .agent-sales-amount {
  color: #312e81;
}

/* ══════════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
thead th {
  background: var(--surface-2);
  padding: 10px 14px; text-align: left;
  font-size: .67rem; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-muted);
  white-space: nowrap; border-bottom: 1px solid var(--border);
  font-weight: 600;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 11px 14px; vertical-align: middle; white-space: nowrap; color: var(--text); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.badge-green  { background: rgba(5,150,105,.1);  color: var(--positive); }
.badge-orange { background: rgba(217,119,6,.1);  color: var(--warning); }
.badge-red    { background: rgba(220,38,38,.1);  color: var(--negative); }
.badge-purple { background: rgba(124,58,237,.1); color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  border: none; font-family: var(--font-body);
  font-size: .86rem; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 16px;
}
.form-grid--users {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--phone {
  grid-column: auto;
  width: 100%;
  max-width: none;
  justify-self: stretch;
}
.form-group label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.form-group input,
.form-group select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text);
  font-family: var(--font-body);
  font-size: .88rem; transition: var(--transition); outline: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group select option { background: var(--surface); }

.phone-input-group {
  display: grid;
  grid-template-columns: minmax(118px, .92fr) minmax(112px, 1.08fr);
  gap: 10px;
  align-items: stretch;
}

.phone-input-group > * {
  min-width: 0;
}

.phone-country-picker {
  position: relative;
}

.phone-country-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .84rem;
  transition: var(--transition);
  outline: none;
  cursor: pointer;
}

.phone-country-trigger:hover,
.phone-country-picker.is-open .phone-country-trigger,
.phone-country-trigger:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.phone-country-trigger-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}

.phone-country-flag {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.phone-country-trigger-copy,
.phone-country-option-copy {
  min-width: 0;
  display: flex;
  align-items: flex-start;
}

.phone-country-trigger-copy {
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.phone-country-option-copy {
  flex-direction: column;
}

.phone-country-trigger-label,
.phone-country-option-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-country-trigger-label {
  max-width: 100%;
  line-height: 1;
  text-align: left;
}

.phone-country-trigger-dial,
.phone-country-option-dial {
  font-size: .74rem;
  color: var(--text-muted);
}

.phone-country-trigger-dial {
  display: none;
}

.phone-country-trigger .phone-country-flag {
  display: none;
}

#f-tel {
  min-width: 0;
  font-size: .84rem;
  letter-spacing: .02em;
}

.phone-country-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.phone-country-picker.is-open .phone-country-menu {
  display: block;
}

.phone-country-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: .88rem;
}

.phone-country-option:hover,
.phone-country-option.is-active {
  background: var(--surface-2);
}

.currency-input { font-variant-numeric: tabular-nums; }

.user-inline-input {
  width: 100%;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .88rem;
  transition: var(--transition);
  outline: none;
}
.user-inline-input:disabled {
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  color: var(--text);
  font-weight: 600;
}
.user-inline-input:not(:disabled):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.user-last-access {
  display: inline-block;
  min-width: 150px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.user-reset-password-btn {
  min-width: 142px;
  justify-content: center;
  white-space: nowrap;
}
.user-banking-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.user-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.icon-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.icon-btn--save {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.icon-btn--save:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}
.row-editing td {
  background: rgba(124,58,237,.04);
}
.row-dirty td {
  background: rgba(124,58,237,.08);
}

.section-title {
  font-size: .72rem; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-muted);
  margin-bottom: 14px; margin-top: 28px;
}

/* ── Agent list ─────────────────────────────────────────────── */
.agent-list { display: flex; flex-direction: column; gap: 10px; padding: 2px 0; }
.agent-item { display: flex; align-items: center; gap: 12px; }
.agent-rank {
  font-family: var(--font-mono); font-size: .72rem;
  font-weight: 800; color: var(--text-muted);
  min-width: 28px; text-align: center; flex-shrink: 0;
  font-variant-numeric: tabular-nums lining-nums;
}
.agent-bar-wrap { flex: 1; min-width: 0; }
.agent-name { font-size: .82rem; font-weight: 600; margin-bottom: 4px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-bar {
  height: 5px; background: var(--surface-2);
  border-radius: 99px; overflow: hidden;
  border: 1px solid var(--border);
}
.agent-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #818cf8);
}
.agent-amount {
  font-size: .78rem; font-weight: 700;
  color: var(--accent); white-space: nowrap;
  min-width: 90px; text-align: right; flex-shrink: 0;
}

/* ── Provider selector tabs ─────────────────────────────────── */
.provider-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

.provider-tab {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 20px 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: .87rem; font-weight: 600;
  cursor: pointer; transition: all .22s ease; min-width: 180px;
}
.provider-tab:hover {
  border-color: var(--accent); color: var(--text);
  box-shadow: var(--shadow);
}
.provider-tab.active {
  background: var(--accent-glow);
  color: var(--accent); border-color: var(--accent);
}

/* Provider logos — light mode: mostrar logo sin invertir */
.prov-tab-logo {
  width: 46px; height: 36px;
  object-fit: contain; border-radius: 0;
  background: transparent; flex-shrink: 0;
  transition: transform .2s ease;
  filter: none;
}
/* Disney logo es negro → se ve bien en fondo claro */
/* Royal Caribbean puede necesitar oscurecer un poco si está en blanco */
.provider-tab[data-logo="royal"] .prov-tab-logo { filter: brightness(0.7) saturate(1.2); }
/* Universal logo puede ser colorido, sin filtro */

.provider-tab:hover .prov-tab-logo,
.provider-tab.active .prov-tab-logo { transform: scale(1.06); }

.prov-tab-emoji { font-size: 1.4rem; flex-shrink: 0; }
.prov-tab-name  { white-space: nowrap; font-size: .88rem; }

.provider-overview {
  display: block;
  margin-bottom: 22px;
}

.provider-overview-metrics {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.provider-overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

.provider-overview-metrics--wide .provider-mini-kpi {
  min-height: 158px;
}

.provider-mini-kpi {
  padding: 24px 28px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.provider-mini-kpi:last-child {
  border-right: none;
}

.provider-mini-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
}

.provider-mini-value {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 2.8vw, 2.65rem);
  line-height: 1;
  color: #0f172a;
}

.provider-mini-foot {
  font-size: .8rem;
  color: #64748b;
}

.provider-insights-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.1fr) minmax(400px, .95fr);
  gap: 24px;
}

.provider-stack--products {
  gap: 18px;
}

.product-breakdown-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
  align-items: stretch;
}

.product-breakdown-hero {
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-pie-shell {
  width: min(100%, 360px);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-pie-chart {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(226,232,240,.9), 0 20px 42px rgba(15,23,42,.12);
}

.product-pie-center {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  width: 43%;
  height: 43%;
  border-radius: 50%;
  background: rgba(255,255,255,.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
  padding: 12px;
}

.product-pie-label {
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #64748b;
}

.product-pie-total {
  font-family: var(--font-mono);
  font-size: 1.12rem;
  color: #0f172a;
  line-height: 1.1;
}

.product-pie-foot {
  font-size: .76rem;
  color: #64748b;
  margin-top: 4px;
}

.product-breakdown-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  min-width: 0;
}

.product-breakdown-item {
  padding: 16px 18px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.92);
}

.product-breakdown-item-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.product-breakdown-share {
  font-family: var(--font-mono);
  font-size: .84rem;
  font-weight: 700;
  color: #475569;
}

.product-breakdown-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
  margin-bottom: 10px;
}

.product-breakdown-bar-fill {
  height: 100%;
  border-radius: inherit;
}

.product-breakdown-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.product-breakdown-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.product-breakdown-name {
  font-weight: 800;
  color: #0f172a;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.product-breakdown-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 14px;
  color: #0f172a;
}

.product-breakdown-meta strong {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 1.02rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.product-breakdown-count {
  color: #64748b;
  font-size: .82rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.provider-ranking {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.provider-ranking-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.9);
}

.provider-ranking-item--top {
  background: linear-gradient(90deg, rgba(124,58,237,.10), rgba(255,255,255,.98));
  border-color: rgba(124,58,237,.28);
}

.provider-ranking-rank {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #334155;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .88rem;
}

.provider-ranking-item--top .provider-ranking-rank {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: #fff;
}

.provider-ranking-main {
  min-width: 0;
}

.provider-ranking-name {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.provider-ranking-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
}

.provider-ranking-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #6366f1);
}

.provider-ranking-amount {
  font-family: var(--font-mono);
  font-size: .94rem;
  font-weight: 700;
  color: #7c3aed;
}

@media (max-width: 1180px) {
  .provider-insights-grid {
    grid-template-columns: 1fr;
  }

  .product-breakdown-card {
    grid-template-columns: 1fr;
  }

  .product-breakdown-hero {
    align-items: center;
  }
}

@media (max-width: 720px) {
  .provider-overview-metrics {
    grid-template-columns: 1fr;
  }

  .provider-mini-kpi {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .provider-mini-kpi:last-child {
    border-bottom: none;
  }

  .product-breakdown-card {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .product-breakdown-hero {
    justify-content: center;
  }

  .product-pie-shell {
    width: min(100%, 320px);
  }

  .product-breakdown-meta {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .product-breakdown-count {
    text-align: left;
  }
}

/* ── Payment ────────────────────────────────────────────────── */
.pay-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.pay-obs {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  color: var(--text); font-size: .8rem;
  font-family: var(--font-body); width: 180px;
}
.pay-obs:focus { outline: none; border-color: var(--accent); }

/* ── Commission detail table ────────────────────────────────── */
.com-detail-row td:first-child { color: var(--text-muted); }
.com-detail-row td:nth-child(2){ font-weight: 700; color: var(--accent); }

/* ── Listado header + filters ───────────────────────────────── */
.listado-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 20px;
}
.listado-count {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.listado-sub { font-size: .76rem; color: var(--text-muted); margin-top: 3px; }

.listado-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  color: var(--text); font-family: var(--font-body);
  font-size: .84rem; cursor: pointer; outline: none;
  transition: var(--transition);
}
.filter-select:focus { border-color: var(--accent); }

/* ── Utilities ──────────────────────────────────────────────── */
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.text-positive{ color: var(--positive); }
.text-negative{ color: var(--negative); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(124,58,237,.12) 0%, transparent 28%),
    radial-gradient(circle at bottom right, rgba(14,165,233,.12) 0%, transparent 24%),
    linear-gradient(135deg, #f4f6ff 0%, #ece8fb 52%, #eef2ff 100%);
  position: relative;
  padding: 32px 18px;
}
.login-wrap::before {
  content: '';
  position: fixed;
  width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,.1) 0%, transparent 70%);
  top: -140px; right: -120px; pointer-events: none;
}
.login-wrap::after {
  content: '';
  position: fixed;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,.08) 0%, transparent 70%);
  bottom: -140px; left: -100px; pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 24px;
  padding: 40px 42px 30px;
  width: 100%;
  max-width: 448px;
  box-shadow: 0 24px 60px rgba(49, 46, 129, .12);
  backdrop-filter: blur(14px);
}
.login-brand-shell {
  width: fit-content;
  margin: 0 auto 16px;
  padding: 14px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(26,15,60,.96) 0%, rgba(76,29,149,.96) 100%);
  box-shadow: 0 18px 34px rgba(76,29,149,.18);
  border: 1px solid rgba(255,255,255,.18);
}
.login-brand-img {
  height: 68px; width: auto; max-width: 250px;
  object-fit: contain; display: block; margin: 0 auto;
}
.login-logo { /* legacy fallback */
  font-family: var(--font-display); font-size: 2rem;
  font-weight: 800; color: var(--accent); margin-bottom: 6px;
}
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(124,58,237,.1);
  color: var(--accent-dark);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0 auto 16px;
}
.login-title {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: -.03em;
  margin-bottom: 10px;
  color: #20115a;
}
.login-sub {
  color: var(--text-muted);
  font-size: .92rem;
  margin-bottom: 28px;
  text-align: center;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-group label {
  font-size: .8rem;
  font-weight: 700;
  color: #4c1d95;
  margin-bottom: 8px;
  display: block;
}
.login-card input {
  height: 48px;
  border-radius: 14px;
  border: 1px solid #d9e0f0;
  background: rgba(255,255,255,.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.login-card input:focus {
  outline: none;
  border-color: rgba(124,58,237,.45);
  box-shadow: 0 0 0 4px rgba(124,58,237,.08);
}
.login-error {
  background: rgba(220,38,38,.07); border: 1px solid rgba(220,38,38,.22);
  color: var(--negative); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .82rem;
  margin-top: 12px; display: none;
}
.login-success {
  background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.24);
  color: var(--teal-dark); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .82rem;
  margin-top: 12px; display: none;
}
.login-link-btn {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--accent-dark);
  font-family: var(--font-body);
  font-size: .86rem;
  font-weight: 800;
  margin-top: 14px;
  padding: 8px 10px;
  cursor: pointer;
  transition: var(--transition);
}
.login-link-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}
.login-card .ri-loader-4-line {
  animation: spin .7s linear infinite;
}
.login-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(148,163,184,.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: var(--text-muted);
  font-size: .76rem;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30,16,64,.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-md);
}
.modal-box--reset-password {
  max-width: 480px;
  padding: 30px;
}
.modal-box--reset-password .modal-title {
  margin-bottom: 16px;
}
.modal-box--reset-password .modal-title i {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  color: var(--accent);
}
.reset-password-body p {
  margin: 0 0 16px;
  color: var(--text);
  font-size: .98rem;
  line-height: 1.55;
}
.reset-password-result {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(124,58,237,.18);
  border-radius: var(--radius-sm);
  background: #faf8ff;
}
.reset-password-result label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.reset-password-value-row {
  display: flex;
  gap: 8px;
}
.reset-password-value-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: .94rem;
  font-weight: 700;
}
.reset-password-msg {
  min-height: 20px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.45;
}
.modal-box--reset-password .ri-loader-4-line,
.user-reset-password-btn .ri-loader-4-line {
  animation: spin .7s linear infinite;
}
.modal-box--bank-profile {
  width: min(980px, calc(100vw - 40px));
  max-width: min(980px, calc(100vw - 40px));
  max-height: 88vh;
  overflow-y: auto;
  padding: 38px;
}
.modal-box--agent-detail {
  width: min(920px, 92vw);
  max-width: min(920px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
}
.modal-box--agent-detail .kpi-sec-grid.cols-4 {
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.modal-box--agent-detail .chart-grid--dashboard {
  grid-template-columns: 1fr;
  gap: 18px;
}
.modal-box--agent-detail .card.dashboard-card {
  box-shadow: none;
}
.modal-box--agent-detail .card.dashboard-card--collapsible {
  position: relative;
  padding: 18px 22px;
}
.modal-box--agent-detail .card.dashboard-card--collapsible .card-header {
  margin-bottom: 0;
  padding-right: 44px;
}
.modal-box--agent-detail .card.dashboard-card--collapsible .provider-ranking,
.modal-box--agent-detail .card.dashboard-card--collapsible #agent-provider-summary-body {
  min-height: 0;
}
.modal-box--agent-detail .chart-wrap {
  min-height: 320px;
}
.modal-box--agent-detail .table-wrap {
  max-height: 280px;
  overflow: auto;
}
.modal-box--agent-detail .provider-ranking {
  gap: 12px;
}
.modal-box--agent-detail .provider-insights-grid {
  grid-template-columns: 1fr;
}
.agent-expandable-card {
  margin: 0;
  display: block;
}
.agent-expandable-card__summary {
  list-style: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  min-height: 32px;
  position: absolute;
  top: 18px;
  right: 22px;
}
.agent-expandable-card__summary::-webkit-details-marker {
  display: none;
}
.agent-expandable-card__toggle-text {
  display: none;
}
.agent-expandable-card__title {
  font-weight: 800;
  color: #0f172a;
  font-size: 1.02rem;
}
.agent-expandable-card__meta {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.agent-expandable-card__icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  flex-shrink: 0;
}
.agent-expandable-card[open] .agent-expandable-card__icon i {
  transform: rotate(180deg);
}
.agent-expandable-card__icon i {
  transition: transform .2s ease;
}
.agent-expandable-card__body {
  padding: 12px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-expandable-card:not([open]) .agent-expandable-card__body {
  display: none;
}
.agent-expandable-card[open] .agent-expandable-card__body {
  margin-top: 12px;
}
.modal-box--agent-detail .modal-actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), var(--surface) 32%);
  padding-top: 14px;
}
.modal-title {
  font-family: var(--font-display); font-size: 1.05rem;
  font-weight: 700; margin-bottom: 22px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.modal-title--split {
  justify-content: space-between;
}

.modal-title--split > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bank-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}

.profile-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 28px;
  align-items: start;
}

.profile-modal-section {
  min-width: 0;
}

.profile-modal-section + .profile-modal-section {
  border-left: 1px solid var(--border);
  padding-left: 28px;
}

.profile-modal-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-size: .96rem;
  font-weight: 800;
  color: var(--text);
}

.password-profile-grid {
  display: grid;
  gap: 16px;
}

.bank-profile-grid .form-group {
  margin-bottom: 0;
}

.bank-profile-grid input:disabled,
.bank-profile-grid select:disabled {
  background: #f8fafc;
  color: #475569;
  cursor: not-allowed;
}

.modal-box--bank-profile .modal-title {
  font-size: 1.22rem;
  margin-bottom: 28px;
}

.modal-box--bank-profile .form-group label {
  margin-bottom: 8px;
}

.modal-box--bank-profile input,
.modal-box--bank-profile select {
  min-height: 48px;
  font-size: .98rem;
}

.modal-box--bank-profile #profile-msg {
  margin-top: 14px;
}

.modal-box--bank-profile #profile-password-msg {
  margin-top: 14px;
}

.profile-password-btn {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.password-strength {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(124,58,237,.14);
  border-radius: var(--radius-sm);
  background: #faf8ff;
}
.password-strength__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.password-strength__label strong {
  color: var(--accent-dark);
}
.password-strength__bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ddff;
}
.password-strength__bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--negative);
  transition: width .2s ease, background .2s ease;
}
.password-requirements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
  margin-top: 10px;
}
.password-requirements span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 700;
}
.password-requirements span.is-complete {
  color: var(--teal-dark);
}
.password-field-hint {
  min-height: 18px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
}
.password-field-hint.is-ok {
  color: var(--teal-dark);
}
.password-field-hint.is-error {
  color: var(--negative);
}

.modal-box--bank-profile .modal-actions {
  margin-top: 28px;
}
.modal-actions {
  display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end;
}

/* ── Metas proveedor (admin) ────────────────────────────────── */
.meta-prov-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.meta-prov-item:last-child { border-bottom: none; }
.meta-prov-logo {
  width: 56px; height: 42px;
  object-fit: contain; flex-shrink: 0;
  filter: none;                /* light mode: logos a color natural */
}
.meta-prov-info { flex: 1; min-width: 0; }
.meta-prov-name { font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.meta-prov-nums {
  display: flex; justify-content: space-between;
  font-size: .76rem; color: var(--text-muted); margin-bottom: 6px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .kpi-sec-grid.cols-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 20px 16px 80px; } /* bottom pad for mobile nav */
  .kpi-hero-grid { grid-template-columns: 1fr; }
  .kpi-sec-grid, .kpi-sec-grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .mobile-nav { display: flex; }
  .topbar-period { flex-direction: column; align-items: flex-end; gap: 2px; }
  .modal-box--agent-detail {
    width: 94vw;
    max-width: 94vw;
    max-height: 90vh;
    padding: 20px 18px 18px;
  }
  .modal-box--agent-detail .kpi-sec-grid.cols-4 {
    grid-template-columns: 1fr;
  }
  .modal-box--agent-detail .chart-wrap {
    min-height: 260px;
  }
}
@media (max-width: 560px) {
  .kpi-hero-grid, .kpi-sec-grid, .kpi-sec-grid.cols-4, .kpi-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 22px 24px; }
  .login-title { font-size: 1.35rem; }
  .form-group--phone {
    max-width: none;
  }
  .phone-input-group {
    grid-template-columns: 1fr;
  }
}

/* ── Topbar period selector ─────────────────────────────────── */
.topbar { justify-content: space-between; }
.topbar-period {
  display: flex; align-items: center; gap: 6px;
}
.period-btn {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  cursor: pointer; color: var(--text-muted); font-size: .82rem;
  transition: var(--transition); line-height: 1;
}
.period-btn:hover { border-color: var(--accent); color: var(--accent); }
.period-label {
  font-family: var(--font-mono);
  font-size: .85rem; font-weight: 600; color: var(--text);
  min-width: 110px; text-align: center;
  font-variant-numeric: tabular-nums lining-nums;
}

/* ── Toast notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  box-shadow: var(--shadow-md); font-size: .85rem;
  pointer-events: auto; min-width: 260px;
  animation: toastIn .25s ease;
}
.toast--success { border-left: 3px solid var(--positive); }
.toast--error   { border-left: 3px solid var(--negative); }
.toast i { font-size: 1.1rem; flex-shrink: 0; }
.toast--success i { color: var(--positive); }
.toast--error   i { color: var(--negative); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 48px 24px; gap: 10px;
  color: var(--text-muted); text-align: center;
}
.empty-state i { font-size: 2rem; opacity: .4; }
.empty-state p { font-size: .84rem; margin: 0; }

/* ── Error inline state ──────────────────────────────────────── */
.kpi-error {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; color: var(--negative);
}
.kpi-error a { color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ── Mobile bottom nav ───────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100; justify-content: space-around;
}
.mobile-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .65rem; font-weight: 500;
  padding: 6px 16px; border-radius: var(--radius-sm);
  transition: color var(--transition); min-width: 60px;
}
.mobile-nav-btn i { font-size: 1.3rem; }
.mobile-nav-btn.active { color: var(--accent); }
.mobile-nav-btn.active i { color: var(--accent); }

/* Numeric rhythm across dashboards, tables and summaries */
#meta-pct-label,
#meta-legend,
#meta-faltante,
.agent-amount,
.meta-prov-nums,
.com-detail-row td:nth-child(2),
tbody td:nth-last-child(-n+3) {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
}

/* Admin dashboard refresh */
.admin-dashboard .kpi-hero-grid {
  gap: 24px;
  margin-bottom: 24px;
}

.admin-dashboard .kpi-hero {
  min-height: 180px;
  padding: 30px 32px;
  box-shadow: 0 16px 34px rgba(76, 29, 149, .18);
}

.admin-dashboard .kpi-hero--teal {
  box-shadow: 0 16px 34px rgba(4, 120, 87, .18);
}

.kpi-hero-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.admin-dashboard .kpi-hero-icon {
  margin: 0;
  font-size: 1.05rem;
}

.admin-dashboard .kpi-hero .kpi-label {
  margin: 0;
  font-size: .94rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.admin-dashboard .kpi-hero .kpi-value {
  font-size: clamp(2.35rem, 3vw, 3.35rem);
  margin-bottom: 12px;
}

.kpi-hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-meta-text {
  color: rgba(255,255,255,.88);
  font-size: 1rem;
  font-weight: 500;
}

.admin-dashboard .kpi-hero .kpi-badge {
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.08);
  font-weight: 700;
}

.admin-dashboard .kpi-sec-grid {
  gap: 22px;
  margin-bottom: 30px;
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(280px, .9fr) minmax(280px, .9fr);
  gap: 24px;
  align-items: stretch;
}

.admin-dashboard .dashboard-card {
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.admin-dashboard .dashboard-card .card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-dashboard .kpi-sec {
  min-height: 210px;
  padding: 22px 24px;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.admin-dashboard .kpi-sec-top {
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  color: #334155;
}

.kpi-sec-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.kpi-sec--orange .kpi-sec-icon {
  background: rgba(245, 158, 11, .18);
  color: #ea580c;
}

.kpi-sec--red .kpi-sec-icon {
  background: rgba(248, 113, 113, .18);
  color: #ef4444;
}

.kpi-sec--teal .kpi-sec-icon {
  background: rgba(16, 185, 129, .14);
  color: #16a34a;
}

.kpi-sec--purple .kpi-sec-icon {
  background: rgba(168, 85, 247, .14);
  color: #9333ea;
}

.admin-dashboard .kpi-sec .kpi-value {
  font-size: clamp(2rem, 2vw, 2.45rem);
  color: #0f172a;
}

.admin-dashboard .kpi-sec-sub {
  font-size: .98rem;
  color: #64748b;
}

.kpi-sec-sub--highlight {
  font-weight: 700;
}

.kpi-sec-sub--positive {
  color: #16a34a;
}

.kpi-sec-sub--purple {
  color: #9333ea;
}

.chart-grid--dashboard {
  grid-template-columns: 1.08fr 1.08fr 1fr;
  gap: 24px;
}

.dashboard-card {
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.dashboard-card .card-header {
  margin-bottom: 22px;
}

.dashboard-card .card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
}

.dashboard-card-icon {
  font-size: 1.15rem;
}

.dashboard-card-icon--gold {
  color: #f59e0b;
}

.dashboard-card-icon--blue {
  color: #3b82f6;
}

.dashboard-card-icon--purple {
  color: #9333ea;
}

.chart-grid--campaigns {
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
}

.campaign-message-group {
  grid-column: 1 / -1;
}

.campaign-message-group textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .92rem;
  resize: vertical;
  min-height: 140px;
  outline: none;
  transition: var(--transition);
}

.campaign-message-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.campaign-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.campaign-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.campaign-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.campaign-item-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.campaign-item-dates {
  font-family: var(--font-mono);
  color: #64748b;
  font-size: .84rem;
}

.campaign-item-message {
  color: #475569;
  font-size: .92rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.campaign-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.campaign-state {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}

.campaign-state--activa {
  background: rgba(34, 197, 94, .12);
  color: #16a34a;
}

.campaign-state--programada {
  background: rgba(59, 130, 246, .12);
  color: #2563eb;
}

.campaign-state--finalizada {
  background: rgba(148, 163, 184, .14);
  color: #475569;
}

.campaign-state--inactiva {
  background: rgba(239, 68, 68, .10);
  color: #dc2626;
}

.campaign-banner {
  border: 1px solid rgba(124,58,237,.18);
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(255,255,255,.96));
  border-radius: 18px;
  padding: 20px 22px;
}

.campaign-banner-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.campaign-banner-sub {
  color: #64748b;
  font-size: .9rem;
  margin-bottom: 10px;
}

.campaign-popup-box {
  max-width: 520px;
}

.campaign-popup-message {
  color: #475569;
  line-height: 1.7;
  white-space: pre-wrap;
}

@media (max-width: 1280px) {
  .chart-grid--campaigns {
    grid-template-columns: 1fr;
  }
}

.dashboard-card--provider {
  display: flex;
  flex-direction: column;
}

.chart-wrap--compact {
  display: none;
}

.vendedor-dashboard .chart-wrap--compact {
  display: flex;
  min-height: 320px;
}

.vendedor-dashboard #seller-provider-stack {
  justify-content: center;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-layout {
  grid-template-columns: minmax(280px, 390px) minmax(320px, 1fr);
  gap: 28px;
  align-items: center;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-hero {
  padding-top: 6px;
  justify-content: center;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-shell--seller {
  width: min(100%, 360px);
}

.vendedor-dashboard #seller-provider-stack .provider-pie-chart--seller {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.48), 0 24px 52px rgba(124,58,237,.11), 0 14px 30px rgba(15,23,42,.09);
}

.vendedor-dashboard #seller-provider-stack .provider-pie-center--seller {
  width: 39%;
  height: 39%;
  background: rgba(255,255,255,.985);
}

.vendedor-dashboard #seller-provider-stack .product-pie-total {
  font-size: 1.5rem;
}

.vendedor-dashboard #seller-provider-stack .product-pie-foot {
  margin-top: 6px;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend {
  gap: 18px;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-item--seller {
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.vendedor-dashboard #seller-provider-stack .provider-name {
  color: #0f172a;
  font-weight: 700;
  font-size: 1rem;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-share {
  font-family: var(--font-mono);
  font-size: .92rem;
  font-weight: 700;
  color: #475569;
  flex-shrink: 0;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 14px 0 12px;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-progress-fill {
  height: 100%;
  border-radius: inherit;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-row--bottom {
  align-items: baseline;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-amount {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: #0f172a;
}

.vendedor-dashboard #seller-provider-stack .provider-pie-legend-foot {
  color: #64748b;
  font-size: .88rem;
}

.provider-pie-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.provider-pie-legend {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.provider-pie-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
}

.provider-pie-legend-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.provider-pie-legend-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.provider-pie-legend-meta strong {
  color: #0f172a;
  font-size: .96rem;
}

.provider-pie-legend-meta span {
  color: #64748b;
  font-size: .8rem;
}

.provider-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: auto;
}

.provider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.provider-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.provider-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.provider-name {
  font-weight: 600;
  color: #334155;
}

.provider-value {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #0f172a;
}

.provider-share {
  color: #64748b;
  font-size: .82rem;
  font-weight: 500;
}

.provider-bar {
  grid-column: 1 / -1;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.provider-bar-fill {
  height: 100%;
  border-radius: inherit;
}

.agent-podium {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agent-podium-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 18px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid transparent;
}

.agent-podium-item--top {
  background: linear-gradient(90deg, rgba(254, 240, 138, .26), rgba(255,255,255,.98));
  border-color: rgba(245, 158, 11, .45);
}

.agent-podium-item--month-top {
  background: linear-gradient(90deg, rgba(59, 130, 246, .12), rgba(255,255,255,.98));
  border-color: rgba(96, 165, 250, .45);
}

.agent-podium-item--campaign {
  transition: transform .18s ease, box-shadow .18s ease;
}

.agent-podium-item--campaign-1 {
  transform: scale(1);
  box-shadow: 0 18px 34px rgba(245, 158, 11, .16);
}

.agent-podium-item--campaign-2 {
  transform: scale(.96);
}

.agent-podium-item--campaign-3 {
  transform: scale(.92);
}

.agent-rank-badge {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
}

.agent-rank-badge--1 {
  background: linear-gradient(135deg, #f59e0b, #fb7185);
}

.agent-rank-badge--2 {
  background: #94a3b8;
}

.agent-rank-badge--3 {
  background: #d9480f;
}

.agent-details {
  min-width: 0;
}

.campaign-self-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(59, 130, 246, .18);
  background: linear-gradient(135deg, rgba(59,130,246,.08), rgba(255,255,255,.98));
}

.campaign-self-rank {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
}

.campaign-self-name {
  font-weight: 700;
  color: #0f172a;
}

.campaign-self-stats {
  color: #475569;
  margin-top: 4px;
}

.campaign-self-note {
  margin-top: 8px;
  font-size: .86rem;
  color: #1d4ed8;
}

.agent-details .agent-name {
  margin-bottom: 2px;
  white-space: normal;
  font-size: .98rem;
  color: #0f172a;
}

.agent-subtext {
  color: #64748b;
  font-size: .9rem;
}

.agent-side {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}

.agent-delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .12);
  color: #16a34a;
  font-size: .82rem;
  font-weight: 700;
}

.agent-side .agent-amount {
  min-width: 0;
  color: #0f172a;
  font-size: 1rem;
}

@media (max-width: 1280px) {
  .chart-grid--dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .admin-dashboard .kpi-sec {
    min-height: 180px;
  }

  .agent-sales-chart {
    min-width: 720px;
  }

  .agent-sales-row {
    grid-template-columns: 46px 220px minmax(220px, 1fr) 146px;
    gap: 14px;
  }

  .agent-sales-axis,
  .agent-sales-grid {
    left: 294px;
    right: 138px;
  }
}

@media (max-width: 560px) {
  .admin-dashboard .kpi-hero {
    min-height: auto;
    padding: 24px;
  }

  .admin-dashboard .kpi-sec {
    min-height: auto;
  }

  .agent-podium-item {
    grid-template-columns: auto 1fr;
  }

  .agent-side {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: space-between;
  }

  .agent-sales-ranking {
    min-height: 330px;
  }

  .agent-sales-chart {
    min-width: 640px;
  }

  .agent-sales-row {
    grid-template-columns: 42px 190px minmax(190px, 1fr) 132px;
    gap: 10px;
  }

  .agent-sales-axis,
  .agent-sales-grid {
    left: 252px;
    right: 118px;
  }

  .agent-sales-name,
  .agent-sales-amount {
    font-size: .86rem;
  }
}

/* Seller dashboard refresh */
.vendedor-dashboard .kpi-hero-grid {
  gap: 24px;
  margin-bottom: 24px;
}

.vendedor-dashboard .kpi-hero {
  min-height: 176px;
  padding: 28px 30px;
  box-shadow: 0 14px 30px rgba(76, 29, 149, .16);
}

.vendedor-dashboard .kpi-hero--teal {
  box-shadow: 0 14px 30px rgba(4, 120, 87, .16);
}

.vendedor-dashboard .kpi-hero .kpi-label {
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.vendedor-dashboard .kpi-hero .kpi-value {
  font-size: clamp(2.2rem, 2.8vw, 3rem);
  margin-bottom: 12px;
}

.dashboard-card--meta {
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.meta-hero-copy {
  font-size: 1rem;
  color: #475569;
  margin-bottom: 10px;
}

.meta-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.meta-highlight {
  font-size: .88rem;
  font-weight: 700;
  color: var(--warning);
}

.dashboard-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 8px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: .88rem;
  font-weight: 700;
}

.dashboard-pill--purple {
  background: rgba(124,58,237,.12);
  color: #7c3aed;
}

.provider-collections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.provider-collection-card {
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(15,23,42,.05);
}

.provider-collection-summary {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.provider-collection-summary::-webkit-details-marker {
  display: none;
}

.provider-collection-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.provider-collection-title strong {
  display: block;
  color: #0f172a;
  font-family: var(--font-display);
  font-size: 1.04rem;
}

.provider-collection-title > div > span {
  display: block;
  color: #64748b;
  font-size: .84rem;
}

.provider-collection-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(226,232,240,.9);
  overflow: hidden;
  flex: 0 0 auto;
  padding: 7px;
}

.provider-collection-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.provider-collection-icon[data-logo="royal"] .provider-collection-logo {
  filter: brightness(.8) saturate(1.15);
}

.provider-collection-logo-fallback {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(217,119,6,.12);
  color: var(--warning);
  font-size: .78rem;
  font-weight: 800;
}

.provider-collection-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, auto));
  gap: 10px;
}

.provider-collection-metrics span {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.9);
  color: #0f172a;
  font-family: var(--font-mono);
  font-weight: 800;
  text-align: right;
}

.provider-collection-metrics small {
  display: block;
  color: #64748b;
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.provider-collection-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 20px 20px;
  border-top: 1px solid rgba(226,232,240,.75);
  align-items: stretch;
}

.provider-collection-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 18px;
}

.provider-collection-panel[hidden] {
  display: none;
}

.provider-collection-section {
  min-width: 0;
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
}

.provider-collection-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 42px;
}

.provider-collection-section-head h4 {
  color: #0f172a;
  font-size: .95rem;
  display: flex;
  align-items: center;
}

.provider-collection-section-head .btn {
  min-height: 38px;
  white-space: nowrap;
}

.provider-collection-head-spacer {
  width: 1px;
  height: 38px;
}

.provider-collection-table {
  max-height: 520px;
  overflow: auto;
  align-self: start;
}

.provider-collection-table table {
  font-size: .8rem;
}

.provider-collection-table .empty-state {
  padding: 18px;
}

.reports-panel {
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(520px, 1.15fr);
  gap: 22px;
  align-items: start;
}

.reports-copy {
  max-width: 680px;
}

.reports-title {
  color: #0f172a;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.reports-copy p {
  color: #64748b;
  font-size: .95rem;
}

.reports-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
}

.reports-controls .form-group {
  margin-bottom: 0;
}

.reports-range-presets,
.report-datepicker,
.reports-history-option,
.reports-download-btn {
  grid-column: 1 / -1;
}

.reports-range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.reports-range-presets .btn {
  min-height: 38px;
}

.report-date-trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .88rem;
  cursor: pointer;
  transition: var(--transition);
}

.report-date-trigger:hover,
.report-date-trigger:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.report-date-trigger:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.report-date-trigger i {
  color: var(--accent);
  font-size: 1.05rem;
}

.report-datepicker {
  position: relative;
}

.report-calendar {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.report-calendar-header,
.report-calendar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-calendar-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #0f172a;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 800;
}

.report-calendar-title button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 4px 6px;
  border-radius: 10px;
  cursor: pointer;
  text-transform: capitalize;
  transition: var(--transition);
}

.report-calendar-title button:hover,
.report-calendar-title button:focus {
  background: var(--accent-glow);
  color: var(--accent);
}

.report-calendar-nav {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  color: #111827;
  font-size: 1.18rem;
  cursor: pointer;
  transition: var(--transition);
}

.report-calendar-nav:hover,
.report-calendar-nav:focus {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.report-calendar-weekdays,
.report-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.report-calendar-weekdays {
  margin: 16px 0 8px;
}

.report-calendar-weekdays span {
  color: #64748b;
  font-size: .74rem;
  font-weight: 800;
  text-align: center;
}

.report-calendar-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #1f2937;
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.report-calendar-day:hover {
  background: var(--accent-glow);
  color: var(--accent);
}

.report-calendar-day.is-muted {
  color: #cbd5e1;
}

.report-calendar-day.is-today {
  border-color: var(--accent);
}

.report-calendar-day.is-selected {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(124, 58, 237, .24);
}

.report-calendar-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.report-calendar-actions .btn {
  min-height: 40px;
  min-width: 110px;
  justify-content: center;
  font-size: .88rem;
}

.report-calendar-picker-grid {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.report-calendar-picker-grid--months,
.report-calendar-picker-grid--years {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-calendar-choice {
  min-height: 48px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #1f2937;
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 800;
  text-transform: capitalize;
  cursor: pointer;
  transition: var(--transition);
}

.report-calendar-choice:hover,
.report-calendar-choice:focus {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.report-calendar-choice.is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(124, 58, 237, .24);
}

.reports-history-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: #334155;
  font-size: .86rem;
  font-weight: 600;
}

.reports-history-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.reports-download-btn {
  justify-content: center;
}

.vendedor-dashboard .kpi-sec-grid {
  gap: 22px;
  margin-bottom: 24px;
}

.vendedor-dashboard .kpi-sec {
  min-height: 180px;
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.vendedor-dashboard .kpi-sec-top {
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  color: #334155;
}

.vendedor-dashboard .kpi-sec .kpi-value {
  font-size: clamp(1.95rem, 2vw, 2.4rem);
  color: #0f172a;
}

.vendedor-dashboard .kpi-sec-sub {
  font-size: .96rem;
}

.chart-grid--seller {
  grid-template-columns: 1.05fr .95fr;
  gap: 24px;
}

.vendedor-dashboard .dashboard-card {
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.vendedor-dashboard .dashboard-card .card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 1280px) {
  .chart-grid--seller {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .provider-pie-layout {
    grid-template-columns: 1fr;
  }

  .reports-panel {
    grid-template-columns: 1fr;
  }

  .provider-collection-metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

}

@media (max-width: 560px) {
  .vendedor-dashboard .kpi-hero {
    min-height: auto;
    padding: 24px;
  }

  .vendedor-dashboard .kpi-sec {
    min-height: auto;
  }

  .provider-collection-summary {
    grid-template-columns: 1fr;
  }

  .provider-collection-metrics {
    grid-template-columns: 1fr;
  }

  .reports-panel,
  .reports-controls {
    grid-template-columns: 1fr;
  }

  .report-calendar {
    padding: 14px;
  }

  .report-calendar-nav {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .report-calendar-title {
    font-size: 1rem;
  }

  .report-calendar-grid,
  .report-calendar-weekdays {
    gap: 6px;
  }

  .report-calendar-day {
    border-radius: 10px;
    font-size: .82rem;
  }

  .report-calendar-picker-grid--months,
  .report-calendar-picker-grid--years {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .report-calendar-choice {
    min-height: 44px;
  }

  .report-calendar-actions .btn {
    min-width: 0;
    flex: 1;
  }

  .bank-profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .modal-box--bank-profile {
    padding: 28px 22px 24px;
  }

  .profile-modal-layout,
  .bank-profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-modal-section + .profile-modal-section {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 24px;
  }
}

/* ── Parche 14A — login / reset sin style= inline ─────────────── */
.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

#forgot-panel {
  display: none;
}

/* ── Parche 14C — elementos ocultos inicialmente (admin) ────────── */
#metas-list             { display: none; }
#subtab-provs2          { display: none; }
#banking-hide-all-btn   { display: none; }
#report-datepicker      { display: none; }
#report-history-option  { display: none; }
#profile-bank-save-btn  { display: none; }
#reset-password-result  { display: none; }

/* ── Parche 14C — elementos ocultos inicialmente (vendedor) ─────── */
#registro-edit-badge      { display: none; font-size: .78rem; padding: 6px 12px; margin-top: 10px; }
#bloque-cliente-existente { display: none; margin-bottom: 20px; }
#cliente-seleccionado-badge { display: none; font-size: .82rem; padding: 6px 12px; }
#btn-cancelar-edicion     { display: none; }
#seller-campaign-self-card { display: none; }

/* ── Parche 14D — estilos inline estáticos → CSS ──────────────── */

/* Page shell */
.page-shell { display: flex; flex-direction: column; min-height: 100vh; overflow: hidden; }

/* TD estados vacíos / carga */
.td-center    { padding: 24px; text-align: center; }
.td-center-sm { padding: 20px; text-align: center; }

/* Modal widths */
.modal-box--xl { max-width: 1100px; }
.modal-box--lg { max-width: 760px; }
.modal-box--md { max-width: 620px; }
.modal-box--sm { max-width: 520px; }

/* Layout utilities */
.flex-bar        { display: flex; align-items: center; gap: 10px; }
.flex-filters    { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.flex-toggle-row { display: flex; gap: 10px; margin-bottom: 20px; }
.flex-col-gap-24 { display: flex; flex-direction: column; gap: 24px; }
.form-footer     { display: flex; justify-content: flex-end; margin-top: 10px; }
.form-actions    { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.card-header--wrap { gap: 12px; flex-wrap: wrap; }
.card-header--mb10 { margin-bottom: 10px; }
.ml-auto   { margin-left: auto; }
.span-full { grid-column: 1 / -1; }
.mt-0      { margin-top: 0; }

/* Iconos inline con color semántico */
.icon-accent-inline  { color: var(--accent);  margin-right: 6px; }
.icon-warning-inline { color: var(--warning); margin-right: 6px; }

/* Líneas de feedback / mensajes */
.msg-line    { font-size: .82rem; min-height: 20px; margin-top: 10px; }
.msg-line-sm { font-size: .82rem; min-height: 20px; margin-top: 4px; }

/* Form-groups en modales */
.form-group--modal { margin-bottom: 14px; }

/* Subtítulos en modales */
.modal-subtitle { margin-bottom: 16px; }

/* Textos de ayuda */
.hint-text-sm   { font-size: .85rem; }
.hint-text-form { font-size: .82rem; margin-top: 8px; }

/* Reglas por ID — valores únicos */
#meta-fill          { width: 0; }
#registro-sub       { font-size: .82rem; margin-top: 6px; }
#form-msg           { font-size: .83rem; }
#reportes-msg       { font-size: .86rem; min-height: 22px; }
#camp-detalle-dates { margin-bottom: 6px; }
#banking-reveal-msg { margin-top: 12px; }
