/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  display: flex;
  overflow: hidden;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.2px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--accent-light); text-decoration: none; }
a.attention-item, a.convo-item, a.check-item, a.btn-secondary, a.nav-item { color: inherit; }
a.btn-secondary { color: var(--text-secondary); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-blue); }
.ti { line-height: 1; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--gradient-sidebar);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
}
.sidebar::before {
  content: '';
  position: absolute; left: 0; top: 10%; height: 80%; width: 2px;
  background: linear-gradient(180deg, transparent, var(--accent) 30%, var(--cyan) 70%, transparent);
  opacity: 0.55; border-radius: 2px; pointer-events: none;
}
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 0.5px solid var(--border); }
.logo-mark { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 34px; height: 34px; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(37,99,255,0.5)); transition: filter var(--t-normal); }
.logo-mark:hover .logo-icon { filter: drop-shadow(0 0 14px rgba(34,211,238,0.6)); }
.logo-icon svg { width: 100%; height: 100%; display: block; }
.logo-text {
  font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.3px;
  background: var(--logo-fill); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.logo-text .dot-i { -webkit-text-fill-color: var(--cyan); color: var(--cyan); }
.logo-badge {
  display: inline-block; font-size: 10px; font-weight: 500; color: var(--accent-light);
  background: var(--accent-dim); padding: 2px 6px; border-radius: 4px; margin-top: 1px;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  position: relative; transition: all var(--t-fast);
}
.nav-item:hover { background: var(--hover-subtle); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--text-primary); }
.nav-item.active::after {
  content: ''; position: absolute; right: -10px; top: 20%; height: 60%; width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--cyan)); border-radius: 3px 0 0 3px;
}
.nav-item .ti { font-size: 18px; width: 20px; text-align: center; }
.nav-item.active .ti { color: var(--cyan); }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 500; min-width: 18px; text-align: center;
  padding: 1px 6px; border-radius: var(--radius-pill); background: var(--accent); color: var(--text-on-accent);
}
.nav-badge.amber { background: var(--amber); color: #111; }
.nav-badge.red { background: var(--red); }

.sidebar-bottom { padding: 12px; border-top: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.agent-card { background: var(--gradient-card); border: 0.5px solid var(--border-light); border-radius: var(--radius-md); padding: 12px; }
.agent-card-head { display: flex; align-items: center; justify-content: space-between; }
.agent-card .label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.agent-card .name { font-size: 14px; font-weight: 500; margin-top: 2px; }
.agent-card .sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.usage-mini .row { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 4px 4px 0; font-size: 13px; color: var(--text-secondary); }
.user-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.main::before {
  content: ''; position: absolute; top: -200px; right: -200px; width: 600px; height: 600px; pointer-events: none;
  background: radial-gradient(circle, rgba(37,99,255,0.07), transparent 65%);
}
:root[data-theme="light"] .main::before { display: none; }
.view { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 32px 40px; position: relative; }
.view.full { padding: 0; overflow: hidden; display: flex; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 22px; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.section-title { font-size: 15px; font-family: var(--font-display); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.eyebrow { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: 12px; }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  border: 0.5px solid transparent; transition: all 0.2s ease; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn .ti { font-size: 15px; }
.btn-primary { background: var(--gradient-accent); color: var(--text-on-accent); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--glow-blue-strong); filter: brightness(1.1); }
.btn-secondary { border-color: var(--border-btn); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--hover-subtle); color: var(--text-primary); border-color: var(--border-hover); transform: translateY(-1px); }
.btn-ghost { color: var(--text-secondary); padding: 7px 10px; }
.btn-ghost:hover { background: var(--hover-subtle); color: var(--text-primary); }
.btn-danger { background: var(--red-dim); color: var(--red-text); }
.btn-danger:hover { background: rgba(239,68,68,0.22); }
.btn-amber { background: var(--amber-dim); color: var(--amber-text); }
.btn-amber:hover { background: rgba(245,158,11,0.24); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all var(--t-fast); }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn .ti { font-size: 16px; }

/* Pestañas como los filter-tab de Replai: el activo es azul tenue, nunca sólido. */
.seg { display: inline-flex; gap: 4px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; transition: all 0.18s var(--ease); }
.seg button:hover { background: var(--bg-hover); color: var(--text-secondary); }
.seg button.on { background: var(--accent-dim); color: var(--accent-light); }
.seg button { white-space: nowrap; justify-content: center; }
.seg.icons button { padding: 6px 9px; }
.seg.icons button span { display: none; }

/* ── Cards ── */
.card { background: var(--gradient-card); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; }
.card.hoverable { transition: all 0.2s ease; cursor: pointer; }
.card.hoverable:hover { background: var(--bg-hover); border-color: var(--border-hover); transform: translateY(-1px); }

/* Borde conic animado: el elemento firma del dashboard de Replai. */
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes rotateBorder { to { --angle: 360deg; } }
.card.glow {
  border: 1.5px solid transparent;
  background:
    var(--gradient-card) padding-box,
    conic-gradient(from var(--angle, 0deg), var(--accent), var(--cyan), var(--periwinkle), var(--accent)) border-box;
  animation: rotateBorder 4s linear infinite;
  position: relative;
}
.card.glow::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(ellipse at top left, rgba(37,99,255,0.06) 0%, transparent 60%);
}
@media (prefers-reduced-motion: reduce) { .card.glow { animation: none; } }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-head { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; background: var(--accent-dim); color: var(--accent-light); }
.kpi-icon.green { background: var(--green-dim); color: var(--green-text); }
.kpi-icon.amber { background: var(--amber-dim); color: var(--amber-text); }
.kpi-icon.purple { background: var(--purple-dim); color: var(--purple-text); }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--text-muted); }

/* ── Barras de uso ── */
.bar { height: 6px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--gradient-accent); transition: width var(--t-normal); }
.bar.warn > span { background: var(--amber); }
.bar.danger > span { background: var(--red); }
.bar.lg { height: 8px; }

/* ── Badges ── */
/* Badges como los status-badge de Replai: fondo tenue, sin borde. */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.blue { background: rgba(37,99,255,0.15); color: var(--periwinkle); }
.badge.green { background: rgba(16,185,129,0.15); color: var(--green-text); }
.badge.amber { background: rgba(245,158,11,0.15); color: var(--amber-text); }
.badge.red { background: var(--red-dim); color: var(--red-text); }
.badge.purple { background: rgba(139,92,246,0.15); color: #A78BFA; }
.badge.slate { background: var(--bg-hover); color: var(--text-secondary); }
.badge.whatsapp { background: var(--green-dim); color: var(--green-text); font-size: 12px; }
.badge.instagram { background: var(--instagram-dim); color: var(--instagram); font-size: 12px; }
.badge.sim { background: var(--bg-hover); color: var(--text-secondary); }
.badge.sim .ti { color: var(--amber); }
:root[data-theme="light"] .badge.purple { color: var(--purple-text); }

/* ── Avatar ── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: #fff;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar .ch { position: absolute; right: -2px; bottom: -2px; width: 15px; height: 15px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; border: 2px solid var(--bg-surface); }
.avatar .ch.whatsapp { background: var(--whatsapp); }
.avatar .ch.instagram { background: var(--instagram); }
.avatar .ch.prueba { background: var(--amber); color: #111; }

/* ── Formularios ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.hint { font-size: 12px; color: var(--text-muted); }
.input, .textarea, .select {
  width: 100%; background: var(--bg-input); border: 0.5px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; color: var(--text-primary); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-blue); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice {
  text-align: left; padding: 14px; border-radius: var(--radius-md); background: var(--bg-input);
  border: 0.5px solid var(--border-light); transition: all var(--t-fast); display: flex; flex-direction: column; gap: 6px;
}
.choice:hover { border-color: var(--border-blue); background: var(--hover-subtle); }
.choice.on { border-color: var(--border-blue); background: var(--accent-faint); }
.choice .ti { font-size: 20px; color: var(--accent-light); }
.choice b { font-size: 13px; font-weight: 500; }
.choice span { font-size: 12px; color: var(--text-secondary); }

.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; border-radius: 10px; background: var(--border-light); transition: all 0.25s var(--ease); cursor: pointer; }
.switch .track::after { content: ''; position: absolute; width: 16px; height: 16px; top: 2px; left: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.4); transition: left 0.25s var(--ease); }
.switch input:checked + .track { background: linear-gradient(135deg, #10B981 0%, #34D399 100%); box-shadow: var(--glow-green); }
.switch input:checked + .track::after { left: 18px; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* ── Listas editables (servicios, FAQs) ── */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row-edit { display: grid; gap: 8px; align-items: start; }
.row-edit.svc { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 34px; }
.row-edit.faq { grid-template-columns: minmax(0, 1fr) 34px; }
.row-edit.hours { grid-template-columns: 110px minmax(0, 1fr) 34px; align-items: center; }
.faq-pair { display: flex; flex-direction: column; gap: 6px; }

/* ── Mi agente ── */
.agent-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section + .form-section { margin-top: 14px; }
.form-section .card { display: flex; flex-direction: column; gap: 16px; }
.step-title { display: flex; align-items: center; gap: 10px; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-dim); color: var(--accent-light); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.summary { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 56px); }
.summary > .card { overflow-y: auto; min-height: 0; }
.summary-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.summary-list li { display: flex; gap: 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.summary-list li .ti { font-size: 16px; margin-top: 2px; flex-shrink: 0; color: var(--green-text); }
.summary-list li.warn .ti { color: var(--amber-text); }
.summary-list li b { color: var(--text-primary); font-weight: 500; }
.save-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--bg-card); border: 0.5px solid var(--border-blue); flex-shrink: 0; }

/* ── Chat ── */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-base); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 0.5px solid var(--border); background: var(--bg-surface); }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head .title { font-size: 14px; font-weight: 500; }
.chat-head .meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.messages { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 65%; display: flex; flex-direction: column; gap: 3px; }
.msg .bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg .info { font-size: 11px; color: var(--text-muted); display: flex; gap: 5px; align-items: center; padding: 0 4px; }
.msg.in { align-self: flex-start; }
.msg.in .bubble { background: var(--bubble-in); border-radius: 16px 16px 16px 4px; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.out .bubble { background: var(--bubble-agent); border: 0.5px solid var(--bubble-agent-b); border-radius: 16px 16px 4px 16px; }
.msg.out.persona .bubble { background: var(--bubble-team); border-color: var(--bubble-team-b); }
.msg-system {
  align-self: center; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary);
  background: var(--bg-surface); border: 0.5px solid var(--border); padding: 6px 14px; border-radius: var(--radius-pill); margin: 4px 0;
}
.msg-system .ti { color: var(--amber); font-size: 14px; }
.msg-system.ok .ti { color: var(--green); }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--bubble-in); border-radius: 16px 16px 16px 4px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
/* Caja de mensaje como chat-input-box de Replai. */
.composer { padding: 12px 16px; border-top: 0.5px solid var(--border); background: var(--bg-surface); }
.input-box { background: var(--bg-card); border: 0.5px solid var(--border); border-radius: 12px; display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px; transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.input-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.input-box textarea { flex: 1; background: none; border: none; outline: none; font-size: 14px; resize: none; max-height: 120px; line-height: 1.5; padding: 6px 0; }
.input-box textarea::placeholder { color: var(--text-muted); }
.send-btn { width: 34px; height: 34px; border-radius: 10px; background: var(--gradient-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; transition: all 0.25s var(--ease); }
.send-btn:hover { transform: translateY(-1px); box-shadow: var(--glow-blue-strong); filter: brightness(1.1); }
.send-btn:active { transform: scale(0.97); }
.handoff-bar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--bg-surface); border-bottom: 0.5px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.handoff-bar > .ti { color: var(--amber); font-size: 16px; }
.handoff-bar b { color: var(--text-primary); }
.handoff-bar .grow { flex: 1; }

/* Pastilla de quién responde, como el ai-pill de Replai. */
.who-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 500; border: 0.5px solid var(--green); color: var(--green); background: var(--green-dim); transition: all 0.25s var(--ease); }
.who-pill:hover { background: rgba(16,185,129,0.24); box-shadow: var(--glow-green); transform: translateY(-1px); }
.who-pill.paused { border-color: var(--amber); color: var(--amber); background: var(--amber-dim); }
.who-pill.paused:hover { background: rgba(245,158,11,0.24); box-shadow: 0 0 20px rgba(245,158,11,0.15); }
.who-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.who-pill.paused .dot { animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── Conversaciones ── */
.inbox-list { width: 320px; flex-shrink: 0; border-right: 0.5px solid var(--border); display: flex; flex-direction: column; background: var(--bg-surface); }
.inbox-top { padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 0.5px solid var(--border); }
.inbox-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.convo-item { display: flex; align-items: flex-start; gap: 11px; padding: 14px 16px; min-height: 72px; border-bottom: 0.5px solid var(--border); cursor: pointer; transition: background 0.2s var(--ease); text-align: left; width: 100%; }
.convo-item:hover { background: var(--hover-subtle); }
.convo-item.active { background: rgba(37,99,255,0.12); border-left: 2px solid var(--accent); padding-left: 14px; }
.card .convo-item { border-radius: var(--radius-md); border-bottom: none; }
.convo-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.convo-item .top { display: flex; justify-content: space-between; gap: 8px; }
.convo-item .name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-item .time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.convo-item .preview { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

.contact-panel { width: 300px; flex-shrink: 0; border-left: 0.5px solid var(--border); background: var(--bg-surface); overflow-y: auto; padding: 22px 18px; display: flex; flex-direction: column; gap: 20px; }
.contact-panel .who { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.facts { display: flex; flex-direction: column; gap: 10px; }
.fact { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.fact .k { color: var(--text-muted); }
.fact .v { text-align: right; font-weight: 500; }
.empty-slot { color: var(--text-muted); font-weight: 400; }

/* Tablero por estado (el "CRM") */
.board { flex: 1; display: flex; gap: 14px; padding: 20px 24px 24px; overflow-x: auto; min-height: 0; }
/* Columnas como kanban-col de Replai. */
.col { width: 278px; min-width: 278px; display: flex; flex-direction: column; background: rgba(255,255,255,0.02); border: 0.5px solid var(--border); border-top: 3px solid var(--c, var(--border)); border-radius: 16px; min-height: 0; overflow: hidden; transition: background 0.2s ease; }
:root[data-theme="light"] .col { background: rgba(15,23,42,0.02); }
.col.drop { background: rgba(37,99,255,0.06); outline: 2px dashed var(--accent); }
.col-head { padding: 14px 16px 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.col-head b { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--c, var(--text-primary)); }
.col-head .hint { font-size: 11px; margin-top: 4px; }
.col-count { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 99px; background: var(--bg-hover); color: var(--text-secondary); }
.col-items { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.lead-card { background: var(--gradient-card); border: 0.5px solid var(--border); border-radius: 14px; padding: 14px; cursor: grab; user-select: none; transition: all 0.2s ease; display: flex; flex-direction: column; gap: 11px; text-align: left; width: 100%; }
.lead-card:hover { background: var(--bg-hover); box-shadow: 0 6px 18px rgba(0,0,0,0.35); transform: translateY(-2px); border-color: var(--border-hover); }
.lead-card.dragging { opacity: 0.35; cursor: grabbing; transform: none; box-shadow: none; }
.lead-card .top { display: flex; gap: 11px; align-items: center; }
.lead-card .avatar { width: 40px; height: 40px; font-size: 14px; }
.lead-card .name { font-size: 14px; font-weight: 500; line-height: 1.3; }
.lead-card .what { font-size: 12px; color: var(--text-secondary); }
.col-empty { font-size: 12px; color: var(--text-secondary); text-align: center; padding: 16px; border: 1.5px dashed var(--border-hover); border-radius: 12px; }

/* ── Inicio ── */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
.agent-hero { display: flex; flex-direction: column; gap: 16px; }
.agent-hero .head { display: flex; align-items: center; gap: 14px; }
.agent-orb { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-dim); border: 0.5px solid var(--border-blue); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--cyan); box-shadow: var(--glow-blue); }
.did-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.did { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.did b { font-family: var(--font-display); font-size: 16px; color: var(--text-primary); min-width: 26px; font-weight: 600; }
.checklist { display: flex; flex-direction: column; gap: 4px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); transition: background var(--t-fast); text-align: left; width: 100%; }
.check-item:hover { background: var(--hover-subtle); }
.check-item .circle { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-light); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.check-item.done .circle { background: var(--green); border-color: var(--green); color: #fff; }
.check-item.done .t { color: var(--text-muted); text-decoration: line-through; }
.check-item .t { flex: 1; font-size: 13px; }
.attention { display: flex; flex-direction: column; gap: 8px; }
/* Como pending-card de Replai: tarjeta neutra, el color solo en la pastilla. */
.attention-item { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 14px; background: var(--gradient-card); border: 0.5px solid var(--border); transition: all 0.2s ease; width: 100%; text-align: left; }
.attention-item:hover { background: var(--bg-hover); border-color: var(--border-hover); transform: translateY(-1px); }
.attention-item .grow { flex: 1; min-width: 0; }
.attention-item .name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attention-item .why { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attention-item .right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.attention-item .right .time { font-size: 11px; color: var(--text-muted); }
.sec-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* ── Canales ── */
.channel { display: flex; flex-direction: column; gap: 16px; }
.channel-head { display: flex; align-items: center; gap: 14px; }
.channel-logo { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.channel-logo.whatsapp { background: var(--whatsapp-dim); color: var(--whatsapp); }
.channel-logo.instagram { background: var(--instagram-dim); color: var(--instagram); }
.channel ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.channel li { display: flex; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.channel li .ti { color: var(--green-text); margin-top: 3px; }
.states { display: flex; flex-wrap: wrap; gap: 8px; }
.notice { display: flex; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--bg-surface); border: 0.5px solid var(--border); font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.notice .ti { color: var(--accent-light); font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.notice.amber .ti { color: var(--amber); }
.notice b { color: var(--text-primary); font-weight: 500; }

/* ── Estado vacío ── */
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 8px; margin: auto; }
.empty .ti { font-size: 32px; color: var(--text-muted); }
.empty b { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.empty p { font-size: 13px; max-width: 320px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; background: var(--bg-card); border: 0.5px solid var(--border-light); box-shadow: var(--shadow-modal); padding: 10px 16px; border-radius: var(--radius-md); font-size: 13px; display: flex; align-items: center; gap: 8px; transition: all var(--t-normal); pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .ti { color: var(--green-text); font-size: 16px; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .agent-layout { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .contact-panel { display: none; }
}
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .hero, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { flex-direction: column-reverse; }
  .sidebar { width: 100%; flex-direction: row; border-right: none; border-top: 0.5px solid var(--border); }
  .sidebar::before, .sidebar-logo, .sidebar-bottom, .nav-item .label-text, .nav-badge { display: none; }
  .sidebar-nav { flex-direction: row; justify-content: space-around; padding: 6px; }
  .nav-item { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 8px; }
  .nav-item.active::after { display: none; }
  .nav-item .short { display: block; }
  .view { padding: 20px 16px 32px; }
  .inbox-list { width: 100%; }
  .inbox-list.hide-mobile, .chat.hide-mobile { display: none; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .did-list { grid-template-columns: minmax(0, 1fr); }
  .row-edit.svc { grid-template-columns: minmax(0, 1fr) 34px; }
  .row-edit.svc .price { grid-column: 1; }
}
.nav-item .short { display: none; }

/* ---------- Entrar / crear cuenta ---------- */
body.public .sidebar { display: none; }
.auth { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand svg { width: 34px; height: 34px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; padding: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field { margin: 0; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: rgba(239, 68, 68, 0.12); color: #FCA5A5; }
:root[data-theme="light"] .auth-error { color: #B91C1C; }
.boot { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); gap: 10px; }

/* ---------- Panel de administrador ---------- */
.user-row { gap: 4px; }
.user-row .avatar { margin-right: 6px; }
.user-row .icon-btn { width: 28px; height: 28px; flex-shrink: 0; }
.admin-bar {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0; position: relative; z-index: 1;
  padding: 10px 32px; font-size: 13px; color: var(--amber-text);
  background: var(--amber-dim); border-bottom: 0.5px solid var(--border-light);
}
.admin-bar[hidden] { display: none; }
.admin-bar .ti-eye-cog { font-size: 17px; }
.admin-bar .grow { flex: 1; min-width: 0; }
.admin-bar b { font-weight: 600; }

.client-table { padding: 6px 0; }
.client-head, .client-row {
  display: grid; align-items: center; gap: 16px; padding: 14px 20px;
  grid-template-columns: minmax(220px, 2fr) 128px minmax(150px, 1fr) minmax(150px, 1fr) 156px;
}
.client-head { padding-block: 10px; font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.client-row { border-top: 0.5px solid var(--border); transition: background var(--t-fast); }
.client-row:hover { background: var(--hover-subtle); }
.client-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.client-main .grow { flex: 1; min-width: 0; }
.client-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-sub { margin-top: 3px; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-cell { min-width: 0; }
.client-cell .badge { max-width: 100%; }
.client-usage { margin-bottom: 5px; font-size: 12px; color: var(--text-secondary); }
.client-plan { padding: 6px 10px; font-size: 13px; }
.client-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

.dialog {
  margin: auto; width: calc(100% - 32px); max-width: 480px; padding: 26px;
  color: var(--text-primary); background: var(--bg-surface);
  border: 0.5px solid var(--border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal);
}
.dialog[open] { display: flex; flex-direction: column; gap: 14px; }
.dialog::backdrop { background: var(--bg-overlay); backdrop-filter: blur(4px); }
.dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.cred-box { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; margin: 0; border-radius: var(--radius-md); background: var(--bg-input); border: 0.5px solid var(--border-light); }
.cred-box dt { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.cred-box dd { margin: 3px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.cred-box .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; }

@media (max-width: 980px) {
  .client-head { display: none; }
  .client-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .client-main, .client-actions { grid-column: 1 / -1; }
  .client-actions { justify-content: flex-start; }
  .client-cell::before { content: attr(data-label); display: block; margin-bottom: 5px; font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
  .client-cell[data-label="Consumo del mes"] { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .admin-bar { padding: 10px 16px; flex-wrap: wrap; }
  .admin-bar .grow { flex-basis: calc(100% - 30px); }
  .dialog { padding: 20px; }
  .dialog-grid { grid-template-columns: minmax(0, 1fr); }
}

.client-quota.amber { color: var(--amber-text); }
.client-quota.red { color: var(--red-text); }
.notice.red { border-color: var(--red); background: var(--red-dim); }
.notice.red .ti { color: var(--red-text); }

/* ---------- Conexión de WhatsApp (administrador) ---------- */
.wa-admin-grid { align-items: start; gap: 28px; }
.wa-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.wa-copy { align-items: center; gap: 8px; }
.wa-copy .k { flex-shrink: 0; }
.wa-copy .v { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-align: right; }
.wa-copy .icon-btn { width: 28px; height: 28px; flex-shrink: 0; }
.wa-side .check-item.done .t { text-decoration: none; color: var(--text-secondary); }
