/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --border: rgba(11,11,11,0.10);
  --grid: #e1e0d9;

  --accent: #5b4fe8;
  --accent-ink: #ffffff;
  --accent-soft: #edebfe;
  --accent-600: #4438c9;

  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */
  --series-7: #4a3aa7; /* violet */

  --good: #0ca30c;
  --good-bg: #e7f7e7;
  --warning: #fab219;
  --warning-bg: #fff6e2;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-bg: #fbe9e9;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11,11,11,.05), 0 1px 1px rgba(11,11,11,.03);
  --shadow-md: 0 8px 24px rgba(11,11,11,.08);
  --shadow-lg: 0 24px 64px rgba(11,11,11,.14);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, serif;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.02em; font-weight: 650; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem;
  background: var(--ink); color: #fff; z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.tiny { font-size: .8rem; color: var(--ink-muted); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-xs { gap: 8px; } .gap-sm { gap: 12px; } .gap-md { gap: 20px; } .gap-lg { gap: 32px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* =============================================================
   4. Buttons & form controls
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), background .18s var(--ease-out);
  white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-600); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 14px; font-size: .85rem; border-radius: 999px; }
.btn-danger { background: var(--critical-bg); color: var(--critical); }
.btn-danger:hover { background: #f6d3d3; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 80px; }
.field-error { color: var(--critical); font-size: .8rem; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; }

/* =============================================================
   5. Cards, badges, pills
   ============================================================= */
.card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card-sm { padding: 16px; border-radius: var(--radius-sm); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-demo { background: var(--warning-bg); color: #8a5a00; }
.badge-good { background: var(--good-bg); color: #0a6b0a; }
.badge-accent { background: var(--accent-soft); color: var(--accent-600); }
.badge-muted { background: var(--grid); color: var(--ink-2); }
.badge-critical { background: var(--critical-bg); color: var(--critical); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; font-weight: 600; }

/* estado de cita/conversación */
.estado { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.estado::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.estado-pendiente, .estado-nueva { background: var(--warning-bg); color: #8a5a00; }
.estado-confirmada, .estado-reservas { background: var(--good-bg); color: #0a6b0a; }
.estado-en_espera, .estado-seguimiento { background: var(--accent-soft); color: var(--accent-600); }
.estado-atendida, .estado-cerrada { background: var(--grid); color: var(--ink-2); }
.estado-cancelada, .estado-no_asistio { background: var(--critical-bg); color: var(--critical); }
.estado-reprogramada, .estado-cotizaciones { background: #f1eaff; color: #5a3fc0; }
.estado-requiere_humano { background: var(--critical-bg); color: var(--critical); }

/* =============================================================
   6. Landing sections
   ============================================================= */
.nav {
  position: sticky; top: 0; z-index: 50; background: rgba(249,249,247,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.1rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 1.1rem; }
.nav-links { display: none; gap: 28px; font-weight: 600; font-size: .92rem; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
@media (min-width: 860px) { .nav-links { display: flex; } }

.hero { padding-block: 72px 56px; }
.hero-inner { display: grid; gap: 40px; align-items: center; }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-600); font-weight: 700; font-size: .8rem; margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin-bottom: 20px; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 46ch; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.hero-proof { display: flex; gap: 20px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-muted); }
@media (min-width: 960px) { .hero-inner { grid-template-columns: 1.1fr .9fr; } }

.phone-mock { background: var(--ink); border-radius: 34px; padding: 14px; box-shadow: var(--shadow-lg); max-width: 360px; margin-inline: auto; }
.phone-screen { background: #e9edf3; border-radius: 22px; overflow: hidden; }
.wa-header { background: #075e54; color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.wa-avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.1rem; }
.wa-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 340px; background: #e9edf3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3C/svg%3E"); }
.bubble { max-width: 84%; padding: 10px 13px; border-radius: 14px; font-size: .86rem; line-height: 1.4; box-shadow: var(--shadow-sm); }
.bubble.in { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { background: #dcf8c6; align-self: flex-end; border-bottom-right-radius: 4px; }

.section { padding-block: 64px; }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head .eyebrow { color: var(--accent-600); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; display: block; }
.section-head h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin-bottom: 12px; }
.section-head p { color: var(--ink-2); font-size: 1.05rem; }

.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature-card { padding: 26px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
/* Reveal-on-scroll es una mejora progresiva: visible por defecto, solo se oculta
   brevemente cuando JS confirma que va a animarlo (clase añadida por main.js). */
.will-reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
.will-reveal.is-revealed { opacity: 1; transform: none; }
.feature-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-600); display: grid; place-items: center; margin-bottom: 14px; font-size: 1.2rem; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.feature-card p { color: var(--ink-2); font-size: .92rem; }

.cycle { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.cycle-step { padding: 10px 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: .85rem; }
.cycle-arrow { color: var(--ink-muted); }

.pricing-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: stretch; }
.plan-card { padding: 30px 26px; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; }
.plan-card.featured { border-color: var(--ink); box-shadow: var(--shadow-md); position: relative; }
.plan-badge { position: absolute; top: -12px; left: 26px; background: var(--ink); color: #fff; font-size: .72rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.plan-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.plan-price { font-size: 2.2rem; font-weight: 750; margin-bottom: 4px; }
.plan-price span { font-size: .95rem; font-weight: 500; color: var(--ink-muted); }
.plan-list { margin: 22px 0; display: flex; flex-direction: column; gap: 10px; font-size: .9rem; }
.plan-list li { display: flex; gap: 8px; align-items: flex-start; }
.plan-list li::before { content:"✓"; color: var(--good); font-weight: 700; }

.faq-item { border-bottom: 1px solid var(--border); padding-block: 18px; }
.faq-q { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-weight: 650; cursor: pointer; }
.faq-a { color: var(--ink-2); margin-top: 10px; font-size: .93rem; display: none; }
.faq-item.open .faq-a { display: block; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.chev { transition: transform .2s var(--ease-out); }

.footer { border-top: 1px solid var(--border); padding-block: 40px; margin-top: 40px; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; font-size: .88rem; color: var(--ink-2); }

.demo-banner { background: var(--warning-bg); color: #8a5a00; text-align: center; padding: 8px 16px; font-size: .82rem; font-weight: 700; }

/* =============================================================
   7. App shell (calm, fast, zero marketing)
   ============================================================= */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.app-sidebar .brand { padding: 6px 8px 20px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem; color: var(--ink-2); transition: background .15s;
}
.side-link:hover { background: var(--bg); color: var(--ink); }
.side-link.active { background: var(--ink); color: #fff; }
.side-link .ic { width: 18px; text-align: center; }
.side-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 10px; font-size: .82rem; color: var(--ink-muted); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 28px;
  border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20;
  gap: 16px; flex-wrap: wrap;
}
.app-view { padding: 28px; flex: 1; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h1 { font-size: 1.5rem; }

.mobile-nav-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
@media (min-width: 900px) { .mobile-nav-toggle { display: none; } }
@media (max-width: 899px) {
  .app-sidebar { position: fixed; left: -260px; top: 0; z-index: 60; transition: left .2s var(--ease-out); box-shadow: var(--shadow-lg); }
  .app-sidebar.open { left: 0; }
  .app-shell.sidebar-open::after { content:""; position: fixed; inset:0; background: rgba(0,0,0,.3); z-index: 55; }
}

/* stat tiles */
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 24px; }
.stat-tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { font-size: .8rem; color: var(--ink-2); font-weight: 600; margin-bottom: 8px; }
.stat-value { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.02em; }
.stat-value small { font-size: 1rem; font-weight: 600; color: var(--ink-muted); }
.stat-sub { font-size: .78rem; color: var(--ink-muted); margin-top: 4px; }

/* bar chart (vanilla, per dataviz skill mark specs) */
.viz-root { --surface-1: var(--surface-2); }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-col .bar { width: 100%; max-width: 24px; background: var(--accent); border-radius: 4px 4px 0 0; transition: height .3s var(--ease-out); position: relative; }
.bar-col .bar-cap { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: .72rem; font-weight: 700; color: var(--ink-2); }
.bar-col .bar-x { font-size: .72rem; color: var(--ink-muted); text-align: center; }
.bar-track { width: 100%; max-width: 24px; background: var(--grid); border-radius: 4px 4px 0 0; position: relative; display: flex; align-items: flex-end; }

.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: .85rem; }
.donut-legend .k { display: flex; align-items: center; gap: 8px; }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .n { margin-left: auto; font-weight: 700; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg); }
.data-table .num { font-variant-numeric: tabular-nums; }

/* conversations inbox */
.inbox { display: grid; grid-template-columns: 300px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; height: calc(100vh - 190px); min-height: 480px; background: var(--surface-2); }
.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; }
.inbox-filters { display: flex; gap: 6px; padding: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.inbox-filters button { font-size: .75rem; padding: 5px 10px; border-radius: 999px; background: var(--bg); font-weight: 700; }
.inbox-filters button.active { background: var(--ink); color: #fff; }
.conv-item { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-bottom: 1px solid var(--grid); cursor: pointer; }
.conv-item:hover { background: var(--bg); }
.conv-item.active { background: var(--accent-soft); }
.conv-item .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: .9rem; }
.conv-item .prev { font-size: .82rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-empty { padding: 40px 20px; text-align: center; color: var(--ink-muted); font-size: .9rem; }

.chat-pane { display: flex; flex-direction: column; height: 100%; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: #f3f4f2; }
.chat-empty { flex:1; display:grid; place-items:center; color: var(--ink-muted); }
.msg-row { display: flex; flex-direction: column; max-width: 74%; }
.msg-row.cliente { align-self: flex-start; }
.msg-row.agente_ia, .msg-row.humano { align-self: flex-end; }
.msg-bubble { padding: 10px 14px; border-radius: 14px; font-size: .9rem; line-height: 1.45; box-shadow: var(--shadow-sm); }
.msg-row.cliente .msg-bubble { background: #fff; border-bottom-left-radius: 4px; }
.msg-row.agente_ia .msg-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-row.humano .msg-bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg-row.sistema { align-self: center; }
.msg-row.sistema .msg-bubble { background: transparent; color: var(--ink-muted); font-size: .78rem; box-shadow: none; }
.msg-meta { font-size: .68rem; color: var(--ink-muted); margin-top: 3px; padding-inline: 4px; }
.msg-actions { font-size: .72rem; color: var(--ink-muted); margin-top: 4px; padding-inline: 4px; }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--border); }
.chat-input button { flex-shrink: 0; }

/* kanban-ish agenda list day */
.agenda-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.day-group { margin-bottom: 22px; }
.day-group h3 { font-size: .9rem; color: var(--ink-2); margin-bottom: 10px; text-transform: capitalize; }
.appt-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; }
.appt-time { font-weight: 750; font-size: .95rem; min-width: 56px; }
.appt-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.appt-info { flex: 1; min-width: 0; }
.appt-info .who { font-weight: 700; font-size: .92rem; }
.appt-info .what { font-size: .82rem; color: var(--ink-2); }
.appt-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* automations */
.rule-card { padding: 20px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 14px; }
.rule-flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .85rem; margin: 10px 0; }
.rule-flow .step { padding: 6px 12px; border-radius: 8px; background: var(--bg); font-weight: 700; }
.rule-flow .step.when { color: var(--accent-600); background: var(--accent-soft); }
.rule-flow .step.wait { color: #8a5a00; background: var(--warning-bg); }
.rule-flow .step.then { color: #0a6b0a; background: var(--good-bg); }

.toggle { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--grid); flex-shrink: 0; transition: background .2s; }
.toggle::after { content:""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left .2s; }
.toggle.on { background: var(--good); }
.toggle.on::after { left: 21px; }

/* modal + toast */
.modal-overlay { position: fixed; inset: 0; background: rgba(11,11,11,.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal { background: var(--surface-2); border-radius: var(--radius-lg); padding: 28px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-close { font-size: 1.3rem; color: var(--ink-muted); }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); font-size: .88rem; box-shadow: var(--shadow-md); animation: toast-in .25s var(--ease-out); }
.toast.err { background: var(--critical); }
.toast.ok { background: #0a6b0a; }
@keyframes toast-in { from { opacity:0; transform: translateY(8px);} to { opacity:1; transform: none; } }

/* onboarding wizard */
.wizard-shell { min-height: 100vh; display: flex; flex-direction: column; }
.wizard-topbar { padding: 18px 24px; border-bottom: 1px solid var(--border); display:flex; align-items:center; justify-content: space-between; }
.wizard-steps { display: flex; gap: 6px; padding: 16px 24px; }
.wizard-steps .dot { flex: 1; height: 4px; border-radius: 999px; background: var(--grid); }
.wizard-steps .dot.done { background: var(--good); }
.wizard-steps .dot.active { background: var(--accent); }
.wizard-body { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 24px; }
.wizard-card { max-width: 620px; width: 100%; padding: 36px; }
.wizard-card h2 { font-size: 1.4rem; margin-bottom: 8px; }
.wizard-card > p.muted { margin-bottom: 26px; }
.wizard-actions { display: flex; justify-content: space-between; margin-top: 28px; gap: 12px; }
.repeatable-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.repeatable-row .field { flex: 1; min-width: 120px; }
.day-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.day-row label { width: 110px; font-weight: 600; font-size: .88rem; }
.day-row input[type=time] { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }

/* auth pages */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { max-width: 420px; width: 100%; padding: 36px; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 6px; }

@media (max-width: 720px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { display: none; }
  .inbox.show-list .inbox-list { display: block; }
  .inbox.show-list .chat-pane { display: none; }
}

/* =============================================================
   8. Radar IA — insights, oportunidades, competidores, agentes
   ============================================================= */

/* tipo_dato: observado / inferencia / recomendación — SIEMPRE visualmente distinto */
.tipo-dato { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tipo-dato-observado { background: var(--good-bg); color: #0a6b0a; }
.tipo-dato-inferencia { background: var(--accent-soft); color: var(--accent-600); }
.tipo-dato-recomendacion { background: var(--warning-bg); color: #8a5a00; }

.confianza-dot { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--ink-2); }
.confianza-dot::before { content:""; width: 8px; height: 8px; border-radius: 50%; }
.confianza-alta::before { background: var(--good); }
.confianza-media::before { background: var(--warning); }
.confianza-baja::before { background: var(--ink-muted); }

.categoria-tag { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--grid); color: var(--ink-2); }

.insight-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.insight-card .insight-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.insight-card h3 { font-size: 1rem; margin: 4px 0 6px; }
.insight-card p { color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.insight-evidencia { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.insight-evidencia summary { cursor: pointer; font-size: .78rem; font-weight: 700; color: var(--accent-600); }
.insight-evidencia ul { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.insight-evidencia li { font-size: .82rem; color: var(--ink-2); background: var(--bg); border-radius: var(--radius-sm); padding: 8px 12px; }
.insight-evidencia li .fuente { font-weight: 700; color: var(--ink); display: block; margin-bottom: 2px; }

/* score de oportunidad — barra + número + razón siempre visible */
.score-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.score-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.score-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--good)); border-radius: 999px; }
.score-num { font-weight: 800; font-size: 1rem; min-width: 42px; text-align: right; }
.score-razon { font-size: .82rem; color: var(--ink-muted); margin-top: 6px; font-style: italic; }

/* competidores */
.competidor-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.competidor-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.competidor-card .avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-600); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }

/* agentes / agent control center */
.agente-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.agente-card .row.top { justify-content: space-between; margin-bottom: 8px; }
.agente-estado-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.agente-estado-dot.completado { background: var(--good); }
.agente-estado-dot.error { background: var(--critical); }
.agente-estado-dot.ejecutando { background: var(--warning); }
.agente-estado-dot.nunca { background: var(--ink-muted); }
.agentes-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 24px; }

/* mapa de posicionamiento — plano 2 ejes, puntos posicionados a ojo desde la evidencia del insight */
.posmap { position: relative; width: 100%; aspect-ratio: 4/3; max-width: 640px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); margin: 20px auto; }
.posmap::before, .posmap::after { content:""; position: absolute; background: var(--grid); }
.posmap::before { left: 50%; top: 8%; bottom: 8%; width: 1px; }
.posmap::after { top: 50%; left: 8%; right: 8%; height: 1px; }
.posmap-axis { position: absolute; font-size: .72rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .03em; }
.posmap-axis.x-right { right: 10px; top: calc(50% + 8px); }
.posmap-axis.x-left { left: 10px; top: calc(50% + 8px); }
.posmap-axis.y-top { left: calc(50% + 8px); top: 10px; }
.posmap-axis.y-bottom { left: calc(50% + 8px); bottom: 10px; }
.posmap-dot { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.posmap-dot .pt { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface-2); box-shadow: var(--shadow-sm); }
.posmap-dot.propio .pt { background: var(--ink); width: 18px; height: 18px; }
.posmap-dot .lbl { font-size: .72rem; font-weight: 700; background: var(--surface-2); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }

/* war room */
.warroom-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.warroom-col h3 { font-size: 1rem; margin-bottom: 4px; }
.warroom-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* content lab / plan de contenido */
.contenido-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.contenido-card .plataforma-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--accent-600); }
.week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.week-day { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; min-height: 90px; }
.week-day h4 { font-size: .78rem; text-transform: capitalize; color: var(--ink-muted); margin-bottom: 8px; }
.week-day-item { font-size: .78rem; padding: 6px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-600); margin-bottom: 6px; font-weight: 600; }

/* MODO DEMO ético — sin clave IA configurada */
.aviso-ia { background: var(--warning-bg); border: none; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; }
.aviso-ia strong { color: #8a5a00; }
.aviso-ia p { color: #8a5a00; font-size: .85rem; margin-top: 4px; }
