:root{
  --page:        #E8DFCF;   /* crema (marco alrededor del shell) */
  --shell:       #FBF8F2;   /* superficie principal, blanco cálido */
  --sidebar:     #1A2E35;   /* petróleo (como el nav de la web) */
  --surface:     #FFFFFF;
  --surface-alt: #F5EFE4;
  --surface-2:   #EFE7D7;
  --border:      #E4DAC9;   /* línea cálida dorada */
  --border-strong:#D6C8B1;
  --text:        #1A2E35;   /* petróleo */
  --text-soft:   #5C5346;   /* marrón cálido */
  --text-mute:   #9A8F7D;

  /* accent = marca v2 (petróleo + dorado). render.js lo re-aplica en runtime
     desde la paleta _TE de data.js (mismos valores). White-label opcional. */
  --accent:      #1A2E35;   /* petróleo: fondos sólidos con texto blanco */
  --accent-soft: #16282E;
  --accent-bg:   #ECE0CC;   /* crema: fondo de chips/activos */
  --accent-ink:  #8B6F3F;   /* dorado: íconos/textos sobre accent-bg */

  --green:    #15803D; --green-bg:#DCFCE7; --green-soft:#16A34A;
  --amber:    #B45309; --amber-bg:#FEF3C7; --amber-soft:#D97706;
  --blue:     #1D4ED8; --blue-bg:#DBEAFE; --blue-soft:#2563EB;
  --red:      #B91C1C; --red-bg:#FEE2E2;  --red-soft:#DC2626;
  --violet:   #C9A386; --violet-soft:#B8906A;

  --r-lg: 16px; --r-md: 12px; --r-sm: 9px;
  --shadow-card: 0 1px 2px rgba(20,20,30,.04), 0 1px 3px rgba(20,20,30,.03);
  --shadow-pop:  0 12px 32px rgba(20,20,30,.12), 0 4px 10px rgba(20,20,30,.06);
  --shadow-lift: 0 8px 24px rgba(20,20,30,.10);
}

*{ box-sizing:border-box; }
html,body{
  margin:0; padding:0; height:100vh; overflow:hidden;
  background:var(--page);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
  color:var(--text); font-size:13px;
  -webkit-font-smoothing:antialiased;
}
svg{ display:block; }
button{ font-family:inherit; }

/* ── Floating shell ── */
.app{
  position:relative;
  display:grid;
  grid-template-columns:256px 1fr;
  height:calc(100vh - 28px);
  margin:14px;
  background:var(--shell);
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  box-shadow:0 1px 2px rgba(20,20,30,.04), 0 18px 50px rgba(20,20,30,.08);
  overflow:hidden;
}

/* ─────────── Sidebar ─────────── */
.sidebar{
  background:var(--sidebar);
  border-right:1px solid var(--border);
  padding:14px 12px 12px;
  display:flex; flex-direction:column;
  overflow-y:auto; height:100%;
}
.sidebar::-webkit-scrollbar{ width:7px; }
.sidebar::-webkit-scrollbar-thumb{ background:#E2E2E5; border-radius:4px; }

.brand{ display:flex; align-items:center; gap:11px; padding:4px 8px 14px; margin-bottom:10px; border-bottom:1px solid var(--border); }
.brand-logo{ width:34px;height:34px;border-radius:10px;flex-shrink:0; background:var(--accent); color:#fff; display:grid;place-items:center; font-weight:800; font-size:14px; letter-spacing:-.5px; }
.brand-meta{ flex:1; min-width:0; line-height:1.25; }
.brand-name{ font-weight:700; font-size:14px; color:var(--text); letter-spacing:-.2px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.brand-sub{ font-size:11px; color:var(--text-mute); display:inline-flex; align-items:center; gap:5px; }
.brand-sub::before{ content:""; width:6px;height:6px;border-radius:50%; background:var(--green-soft); box-shadow:0 0 0 0 rgba(22,163,74,.5); animation:pulse 2s infinite; }

.nav{ display:flex; flex-direction:column; gap:2px; }
.nav-item{ padding:9px 10px; border-radius:9px; color:var(--text-soft); cursor:pointer; font-size:13px; display:flex; align-items:center; gap:11px; transition:.13s; user-select:none; }
.nav-item svg{ width:18px; height:18px; stroke:currentColor; stroke-width:1.6; fill:none; flex-shrink:0; opacity:.85; }
.nav-item:hover{ background:var(--surface-alt); color:var(--text); }
.nav-item.active{ background:var(--accent-bg); color:var(--accent-ink); font-weight:600; }
.nav-item.active svg{ opacity:1; stroke:var(--accent-ink); }
.nav-item .label{ flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav-item .badge{ font-size:11px; font-weight:700; min-width:18px; text-align:center; padding:1px 7px; border-radius:999px; background:var(--surface-2); color:var(--text-soft); }
.nav-item .badge.live{ background:var(--green-bg); color:var(--green); }
.nav-item.active .badge{ background:#fff; color:var(--accent-ink); }

.nav-section{ margin-top:16px; padding:0 10px 7px; color:var(--text-mute); font-size:10.5px; letter-spacing:.5px; text-transform:uppercase; font-weight:700; }

/* sidebar plan card */
.side-foot{ margin-top:auto; padding-top:12px; }
.plan-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:12px 13px; box-shadow:var(--shadow-card); margin-bottom:10px; }
.plan-card .pc-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.plan-card .pc-top b{ font-size:12px; }
.plan-pill{ font-size:9.5px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; padding:2px 8px; border-radius:999px; background:var(--accent-bg); color:var(--accent-ink); }
.plan-card p{ margin:0 0 9px; font-size:11px; color:var(--text-soft); line-height:1.45; }
.plan-card .pc-by{ display:flex; align-items:center; gap:7px; padding-top:9px; border-top:1px solid var(--border); font-size:10.5px; color:var(--text-mute); }
.plan-card .pc-by b{ color:var(--text-soft); font-weight:700; }
.te-mark{ width:18px;height:18px;border-radius:5px; background:#1A2E35; color:#fff; display:grid;place-items:center; font-size:8px; font-weight:800; letter-spacing:-.3px; }

.founders-row{ display:flex; align-items:center; gap:10px; padding:8px; border-radius:10px; background:var(--surface); border:1px solid var(--border); }
.avatar{ width:32px;height:32px;border-radius:50%; background:var(--accent); color:#fff; display:grid;place-items:center; font-weight:700; font-size:12px; flex-shrink:0; }
.founders-row .meta{ flex:1; min-width:0; }
.founders-row b{ color:var(--text); font-size:12px; display:block; line-height:1.25; }
.founders-row span{ color:var(--text-mute); font-size:10.5px; display:block; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.founders-row .more{ color:var(--text-mute); font-size:14px; }

/* ─────────── Main ─────────── */
.main{ display:flex; flex-direction:column; min-width:0; height:100%; overflow:hidden; }
.topbar{ background:var(--shell); border-bottom:1px solid var(--border); padding:12px 22px; display:flex; align-items:center; gap:14px; flex-shrink:0; }
.tb-title{ min-width:0; }
.tb-title h2{ margin:0; font-size:15px; font-weight:700; letter-spacing:-.2px; white-space:nowrap; }
.tb-title .sub{ font-size:11.5px; color:var(--text-mute); margin-top:1px; display:block; }

.search{ flex:1; max-width:380px; margin-left:8px; position:relative; }
.search input{ width:100%; padding:9px 14px 9px 36px; border:1px solid var(--border); border-radius:10px; background:var(--surface-alt); font-size:12.5px; color:var(--text); outline:none; transition:.12s; }
.search input::placeholder{ color:var(--text-mute); }
.search input:focus{ border-color:var(--accent); background:var(--surface); box-shadow:0 0 0 3px var(--accent-bg); }
.search .s-ic{ position:absolute; left:12px; top:50%; transform:translateY(-50%); width:16px;height:16px; stroke:var(--text-mute); stroke-width:1.7; fill:none; }

.btn{ padding:8px 14px; border-radius:10px; font-size:12.5px; font-weight:600; cursor:pointer; border:1px solid transparent; display:inline-flex; align-items:center; gap:7px; user-select:none; transition:.13s; background:transparent; white-space:nowrap; }
.btn svg{ width:16px;height:16px;stroke:currentColor;stroke-width:1.7;fill:none; }
.btn:active{ transform:scale(.98); }
.btn-primary{ background:var(--accent); color:#fff; }
.btn-primary:hover{ background:var(--accent-soft); }
.btn-ghost{ color:var(--text); border-color:var(--border); background:var(--surface); }
.btn-ghost:hover{ background:var(--surface-alt); border-color:var(--border-strong); }
.btn-sm{ padding:6px 11px; font-size:11.5px; }
.actions{ margin-left:auto; display:flex; gap:8px; align-items:center; }
.icon-btn{ width:38px;height:38px; border-radius:10px; border:1px solid var(--border); background:var(--surface); color:var(--text-soft); display:grid;place-items:center; cursor:pointer; position:relative; transition:.12s; }
.icon-btn:hover{ background:var(--surface-alt); color:var(--text); }
.icon-btn svg{ width:18px;height:18px;stroke:currentColor;stroke-width:1.7;fill:none; }
.icon-btn .nub{ position:absolute; top:8px; right:9px; width:7px;height:7px;border-radius:50%; background:var(--red-soft); border:2px solid var(--surface); }

/* ─────────── Page ─────────── */
.page{ padding:22px 24px 30px; flex:1; overflow-y:auto; background:var(--shell); }
.page::-webkit-scrollbar{ width:9px; }
.page::-webkit-scrollbar-thumb{ background:#E2E2E5; border-radius:5px; }
.view{ display:none; } .view.active{ display:block; animation:mcViewIn .26s ease both; }

.page-head{ display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:18px; gap:16px; flex-wrap:wrap; }
.page-head h1{ margin:0; font-size:22px; font-weight:700; letter-spacing:-.5px; }
.page-head p{ margin:5px 0 0; color:var(--text-soft); font-size:12.5px; max-width:560px; line-height:1.5; }
.seg{ display:inline-flex; background:var(--surface-alt); border:1px solid var(--border); border-radius:10px; padding:4px; gap:3px; }
.seg button{ border:0; background:transparent; padding:6px 13px; border-radius:7px; font-size:12px; font-weight:600; color:var(--text-soft); cursor:pointer; transition:.12s; }
.seg button.active{ background:var(--surface); color:var(--text); box-shadow:var(--shadow-card); }

/* hero — Resultados del mes */
.hero{ position:relative; overflow:hidden; border-radius:var(--r-md); padding:24px 26px; margin-bottom:20px; color:#fff;
  background:
    radial-gradient(120% 140% at 88% -10%, color-mix(in srgb, var(--accent) 78%, #fff 4%) 0%, transparent 55%),
    linear-gradient(135deg, #152228 0%, #243D45 60%, color-mix(in srgb, var(--accent) 40%, #1A2E35) 100%);
}
.hero-glow{ position:absolute; right:-60px; top:-60px; width:260px;height:260px; border-radius:50%; background:radial-gradient(circle, color-mix(in srgb,var(--accent) 60%, transparent) 0%, transparent 70%); filter:blur(8px); opacity:.6; }
.hero-eyebrow{ font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:rgba(255,255,255,.62); display:inline-flex; align-items:center; gap:8px; }
.hero-eyebrow .pulse{ width:7px;height:7px;border-radius:50%; background:#5BE6B0; box-shadow:0 0 0 0 rgba(91,230,176,.6); animation:pulse 2s infinite; }
.hero-main{ display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-top:12px; flex-wrap:wrap; position:relative; z-index:1; }
.hero-figure{ font-size:46px; font-weight:800; letter-spacing:-1.5px; line-height:1; font-variant-numeric:tabular-nums; }
.hero-figure .cur{ font-size:24px; font-weight:700; color:rgba(255,255,255,.7); margin-right:4px; vertical-align:6px; }
.hero-sub{ font-size:13px; color:rgba(255,255,255,.72); margin-top:8px; max-width:380px; line-height:1.5; }
.hero-chips{ display:flex; gap:10px; flex-wrap:wrap; }
.hero-chip{ background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.16); border-radius:12px; padding:12px 16px; min-width:120px; backdrop-filter:blur(4px); }
.hero-chip .v{ font-size:21px; font-weight:700; letter-spacing:-.4px; font-variant-numeric:tabular-nums; }
.hero-chip .l{ font-size:11px; color:rgba(255,255,255,.66); margin-top:3px; display:flex; align-items:center; gap:6px; }
.hero-chip .l svg{ width:14px;height:14px;stroke:currentColor;stroke-width:1.8;fill:none; opacity:.9; }

/* KPI tiles */
.kpis{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.kpi{ position:relative; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:16px; box-shadow:var(--shadow-card); transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.kpi:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lift); border-color:var(--border-strong); }
.kpi .k-top{ display:flex; align-items:center; gap:9px; margin-bottom:11px; }
.kpi .k-ic{ width:30px;height:30px;border-radius:9px; background:var(--accent-bg); color:var(--accent-ink); display:grid;place-items:center; transition:transform .18s ease; }
.kpi:hover .k-ic{ transform:scale(1.08); }
.kpi .k-ic svg{ width:16px;height:16px;stroke:currentColor;stroke-width:1.8;fill:none; }
.kpi .label{ color:var(--text-soft); font-size:11.5px; font-weight:600; }
.kpi .value{ font-size:27px; font-weight:700; line-height:1.02; letter-spacing:-.6px; font-variant-numeric:tabular-nums; }
/* delta como pill de color para leer la tendencia de un vistazo */
.kpi .delta{ display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:700; color:var(--green); background:var(--green-bg); padding:3px 8px 3px 6px; border-radius:999px; margin-top:9px; }
.kpi .delta.down{ color:var(--green); background:var(--green-bg); } /* down can be good (no-show) — set per item */
.kpi .delta.bad{ color:var(--red); background:var(--red-bg); }
.kpi .delta.mute{ color:var(--text-mute); background:var(--surface-2); }
.kpi .delta .arr{ font-size:9px; }

/* generic cards / grids */
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:18px; box-shadow:var(--shadow-card); }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:10px; }
.card-head h3{ margin:0; font-size:14px; font-weight:700; letter-spacing:-.2px; }
.card-head .meta{ font-size:11px; color:var(--text-mute); }
.row-2{ display:grid; grid-template-columns:1.55fr 1fr; gap:16px; margin-bottom:20px; }
.section-title{ display:flex; align-items:center; justify-content:space-between; margin:4px 0 14px; gap:12px; }
.section-title h2{ margin:0; font-size:16px; font-weight:700; letter-spacing:-.3px; }
.section-title p{ margin:2px 0 0; font-size:12px; color:var(--text-mute); }
.section-title .link{ font-size:12px; font-weight:600; color:var(--accent-ink); cursor:pointer; }

/* automation result cards */
.auto-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:22px; }
.auto-rc{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:16px 17px; box-shadow:var(--shadow-card); display:flex; flex-direction:column; gap:13px; transition:transform .16s,box-shadow .16s,border-color .16s; }
.auto-rc:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lift); border-color:var(--border-strong); }
.auto-rc-head{ display:flex; align-items:flex-start; gap:11px; }
.auto-ic{ width:40px;height:40px;border-radius:11px; background:var(--accent-bg); color:var(--accent-ink); display:grid;place-items:center; flex-shrink:0; }
.auto-ic svg{ width:21px;height:21px;stroke:currentColor;stroke-width:1.7;fill:none; }
.auto-rc-head .nm{ flex:1; min-width:0; }
.auto-rc-head .nm b{ font-size:13.5px; display:block; letter-spacing:-.1px; }
.auto-rc-head .nm span{ font-size:11.5px; color:var(--text-soft); line-height:1.4; display:block; margin-top:2px; }
.status-pill{ display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:999px; font-size:10px; font-weight:700; background:var(--green-bg); color:var(--green); flex-shrink:0; }
.status-pill .dot{ width:6px;height:6px;border-radius:50%; background:var(--green-soft); }
.status-pill.paused{ background:var(--amber-bg); color:var(--amber); } .status-pill.paused .dot{ background:var(--amber-soft); }
.auto-impact{ display:flex; gap:8px; }
.auto-impact .imp{ flex:1; background:var(--surface-alt); border:1px solid var(--border); border-radius:9px; padding:9px 10px; }
.auto-impact .imp .v{ font-size:17px; font-weight:700; letter-spacing:-.3px; font-variant-numeric:tabular-nums; }
.auto-impact .imp .l{ font-size:10px; color:var(--text-mute); margin-top:2px; line-height:1.25; }
.auto-rc-foot{ display:flex; align-items:center; justify-content:space-between; padding-top:12px; border-top:1px solid var(--border); }
.auto-rc-foot .save{ font-size:11.5px; color:var(--text-soft); display:inline-flex; align-items:center; gap:6px; }
.auto-rc-foot .save b{ color:var(--green); font-weight:700; }
.auto-rc-foot .save svg{ width:14px;height:14px;stroke:var(--green-soft);stroke-width:1.8;fill:none; }
.auto-rc-foot .go{ font-size:11.5px; font-weight:600; color:var(--accent-ink); cursor:pointer; }

/* timeline */
.timeline .item{ display:grid; grid-template-columns:30px 1fr auto; gap:11px; padding:11px 0; border-bottom:1px solid var(--border); align-items:start; }
.timeline .item:last-child{ border-bottom:none; }
.timeline .t-ic{ width:30px;height:30px;border-radius:9px; background:var(--surface-2); color:var(--text-soft); display:grid;place-items:center; }
.timeline .t-ic svg{ width:16px;height:16px;stroke:currentColor;stroke-width:1.8;fill:none; }
.timeline .t-ic.green{ background:var(--green-bg); color:var(--green); }
.timeline .t-ic.accent{ background:var(--accent-bg); color:var(--accent-ink); }
.timeline .t-ic.blue{ background:var(--blue-bg); color:var(--blue); }
.timeline .t-body{ font-size:12.5px; line-height:1.45; color:var(--text); }
.timeline .t-body b{ font-weight:700; }
.timeline .t-body .money{ color:var(--green); font-weight:700; }
.timeline .ago{ font-size:11px; color:var(--text-mute); white-space:nowrap; }

/* mini bars + lists */
.mini-bars{ display:flex; align-items:stretch; gap:5px; height:120px; }
.mini-bars .col{ flex:1; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:7px; }
.mini-bars .col .bar{ width:100%; min-height:2px; border-radius:5px 5px 0 0; background:var(--accent); opacity:.85; transition:.2s; }
.mini-bars .col:hover .bar{ opacity:1; }
.mini-bars .col .bl{ font-size:10px; color:var(--text-mute); }
.list-row{ display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.list-row:last-child{ border-bottom:none; }
.list-row .lr-name{ font-size:12.5px; font-weight:600; flex:1; }
.bar{ height:8px; background:var(--surface-2); border-radius:4px; overflow:hidden; }
.bar .fill{ height:100%; border-radius:4px; background:var(--accent); }
.lr-bar{ width:120px; }
.lr-val{ font-size:12.5px; font-weight:700; min-width:54px; text-align:right; font-variant-numeric:tabular-nums; }
.insight{ margin-top:14px; padding:12px 14px; border-radius:10px; background:var(--accent-bg); font-size:11.5px; color:var(--accent-ink); line-height:1.5; }
.insight b{ font-weight:700; }

/* charts */
.mc-chart{ width:100%; } .mc-chart svg{ display:block; width:100%; overflow:visible; }
.mc-chart .lbl{ fill:var(--text-mute); font-size:10px; }

/* bar chart minimalista y clásico (Ingresos/Ventas por semana) */
.bchart{ display:flex; align-items:flex-end; gap:26px; height:208px; padding:10px 6px 0; }
.bcol{ flex:1; display:flex; flex-direction:column; align-items:center; height:100%; max-width:96px; margin:0 auto; cursor:pointer; outline:none; }
.bcol-v{ font-size:12.5px; font-weight:700; color:var(--text); font-variant-numeric:tabular-nums; margin-bottom:9px; }
.btrack{ position:relative; flex:1; width:100%; display:flex; align-items:flex-end; justify-content:center; border-bottom:1.5px solid var(--border-strong); }
.bfill{ width:58%; max-width:44px; background:var(--accent); border-radius:5px 5px 0 0; min-height:5px; transition:height .3s cubic-bezier(.22,.61,.36,1), opacity .15s; }
.bfill.top{ background:var(--accent); }
.bcol:hover .bfill, .bcol:focus .bfill, .bcol.show .bfill{ opacity:.82; }
.bcol-l{ font-size:11.5px; color:var(--text-mute); margin-top:11px; }
.view.active .bfill{ transform-origin:bottom center; animation:mcGrowY .7s cubic-bezier(.22,.61,.36,1) both; }
/* tooltip por barra (hover en desktop, tap en móvil) */
.btip{ position:absolute; left:50%; bottom:calc(100% + 8px); transform:translate(-50%,6px); z-index:20;
  background:#1A2E35; color:#fff; padding:9px 12px; border-radius:10px; text-align:left; white-space:nowrap;
  font-size:11px; line-height:1.5; box-shadow:var(--shadow-pop); opacity:0; pointer-events:none; transition:opacity .16s ease, transform .16s ease; }
.btip b{ display:block; font-size:13px; font-weight:700; margin-bottom:3px; letter-spacing:-.2px; }
.btip span{ display:block; color:rgba(255,255,255,.66); }
.btip::after{ content:''; position:absolute; top:100%; left:50%; transform:translateX(-50%); border:5px solid transparent; border-top-color:#1A2E35; }
.bcol:hover .btip, .bcol:focus .btip, .bcol.show .btip{ opacity:1; transform:translate(-50%,0); }

/* ─────────── Conversaciones ─────────── */
.conv-wrap{ display:grid; grid-template-columns:340px 1fr; gap:16px; height:calc(100vh - 210px); min-height:480px; }
.conv-list{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--shadow-card); display:flex; flex-direction:column; overflow:hidden; }
.channel-tabs{ display:flex; gap:4px; padding:12px; border-bottom:1px solid var(--border); }
.channel-tab{ flex:1; display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:8px; border-radius:9px; font-size:11.5px; font-weight:600; color:var(--text-soft); cursor:pointer; border:1px solid transparent; transition:.12s; }
.channel-tab svg{ width:15px;height:15px; }
.channel-tab:hover{ background:var(--surface-alt); }
.channel-tab.active{ background:var(--accent-bg); color:var(--accent-ink); }
.conv-scroll{ flex:1; overflow-y:auto; }
.empty-state{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:4px; padding:46px 24px; }
.empty-state .es-ic{ width:48px;height:48px;border-radius:14px; background:var(--accent-bg); color:var(--accent-ink); display:grid;place-items:center; margin-bottom:8px; }
.empty-state .es-ic svg{ width:24px;height:24px;stroke:currentColor;stroke-width:1.7;fill:none; }
.empty-state b{ font-size:13.5px; }
.empty-state p{ margin:0; font-size:12px; color:var(--text-mute); line-height:1.5; max-width:280px; }
.conv-item{ display:grid; grid-template-columns:38px 1fr auto; gap:11px; padding:13px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:.12s; align-items:center; }
.conv-item:hover{ background:var(--surface-alt); }
.conv-item.active{ background:var(--accent-bg); }
.conv-av{ width:38px;height:38px;border-radius:11px; background:linear-gradient(135deg,#2D4A52,#1A2E35); color:#fff; display:grid;place-items:center; font-weight:700; font-size:13px; position:relative; }
.conv-ch{ position:absolute; bottom:-3px; right:-3px; width:17px;height:17px;border-radius:50%; border:2px solid var(--surface); display:grid;place-items:center; }
.conv-ch svg{ width:9px;height:9px; }
.conv-ch.wa{ background:#25D366; } .conv-ch.ig{ background:#E1306C; } .conv-ch.web{ background:var(--text-soft); }
.conv-meta{ min-width:0; }
.conv-meta b{ font-size:12.5px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.conv-meta .prev{ font-size:11.5px; color:var(--text-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
.conv-right{ display:flex; flex-direction:column; align-items:flex-end; gap:5px; }
.conv-right .tm{ font-size:10.5px; color:var(--text-mute); }
.conv-tag{ font-size:9px; font-weight:700; padding:2px 6px; border-radius:999px; text-transform:uppercase; letter-spacing:.3px; }
.conv-tag.bot{ background:var(--accent-bg); color:var(--accent-ink); }
.conv-tag.you{ background:var(--amber-bg); color:var(--amber); }
.conv-tag.unread{ background:var(--red-soft); color:#fff; }

/* chat panel */
.chat{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); display:flex; flex-direction:column; box-shadow:var(--shadow-card); overflow:hidden; min-width:0; }
.chat-head{ padding:13px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:11px; }
.chat-head .av{ width:38px;height:38px;border-radius:11px; background:linear-gradient(135deg,#2D4A52,#1A2E35); color:#fff; display:grid;place-items:center; font-weight:700; font-size:13px; }
.chat-head .who b{ display:block; font-size:13.5px; font-weight:700; line-height:1.2; }
.chat-head .who span{ font-size:11px; color:var(--text-soft); display:inline-flex; align-items:center; gap:5px; }
.chat-head .who span::before{ content:""; width:6px;height:6px;border-radius:50%; background:var(--green-soft); }
.chat-head .head-actions{ margin-left:auto; display:flex; gap:8px; align-items:center; }
.bot-banner{ display:flex; align-items:center; gap:9px; padding:9px 16px; background:var(--accent-bg); color:var(--accent-ink); font-size:11.5px; font-weight:600; }
.bot-banner svg{ width:15px;height:15px;stroke:currentColor;stroke-width:1.8;fill:none; }
.bot-banner .b-act{ margin-left:auto; }
.chat-body{ flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:10px; background:var(--surface-alt); }
.day-sep{ text-align:center; font-size:10.5px; color:var(--text-mute); margin:4px 0; }
.msg{ max-width:74%; padding:9px 13px; border-radius:14px; font-size:12.5px; line-height:1.5; word-wrap:break-word; }
.msg.in{ background:var(--surface); border:1px solid var(--border); color:var(--text); align-self:flex-start; border-bottom-left-radius:5px; }
.msg.bot{ background:var(--accent); color:#fff; align-self:flex-end; border-bottom-right-radius:5px; }
.msg.you{ background:#2D4A52; color:#fff; align-self:flex-end; border-bottom-right-radius:5px; }
.msg .sender{ display:block; font-size:9.5px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; opacity:.7; margin-bottom:3px; }
.msg .ts{ display:block; margin-top:4px; font-size:10px; opacity:.6; }
.typing{ display:inline-flex; align-items:center; gap:4px; padding:10px 13px; background:var(--surface); border:1px solid var(--border); border-radius:14px; border-bottom-left-radius:5px; align-self:flex-start; }
.typing span{ width:6px;height:6px; background:var(--text-mute); border-radius:50%; animation:blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2){ animation-delay:.15s; } .typing span:nth-child(3){ animation-delay:.3s; }
.chat-composer{ padding:12px 14px; background:var(--surface); border-top:1px solid var(--border); display:flex; gap:9px; align-items:end; }
.chat-composer textarea{ flex:1; resize:none; padding:10px 13px; border:1px solid var(--border); border-radius:11px; background:var(--surface-alt); font:inherit; font-size:12.5px; color:var(--text); outline:none; min-height:40px; max-height:120px; line-height:1.4; }
.chat-composer textarea:focus{ border-color:var(--accent); background:var(--surface); }
.chat-composer .send{ height:40px; width:40px; flex-shrink:0; background:var(--accent); color:#fff; border:0; border-radius:11px; cursor:pointer; display:grid;place-items:center; }
.chat-composer .send svg{ width:18px;height:18px;stroke:currentColor;stroke-width:2;fill:none; }
.chat-composer .send:disabled{ opacity:.4; cursor:not-allowed; }
.chat-locked{ padding:12px 16px; background:var(--surface); border-top:1px solid var(--border); display:flex; align-items:center; gap:10px; font-size:12px; color:var(--text-soft); }
.chat-locked .btn{ margin-left:auto; }
.chat-locked > svg{ width:18px;height:18px;stroke:currentColor;stroke-width:1.7;fill:none; flex-shrink:0; color:var(--accent-ink); }
.bot-banner > svg{ flex-shrink:0; }

/* ─────────── Tables (Contactos / Pedidos) ─────────── */
.table-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--shadow-card); overflow:hidden; }
.filters-bar{ padding:12px 16px; border-bottom:1px solid var(--border); display:flex; gap:7px; flex-wrap:wrap; align-items:center; }
.filter-chip{ padding:6px 13px; border-radius:999px; background:var(--surface); border:1px solid var(--border); font-size:11.5px; font-weight:600; color:var(--text-soft); cursor:pointer; user-select:none; transition:.12s; }
.filter-chip:hover{ background:var(--surface-alt); }
.filter-chip.active{ background:var(--accent); color:#fff; border-color:var(--accent); }
.filters-bar .spacer{ margin-left:auto; }
.dtable{ width:100%; border-collapse:collapse; font-size:12.5px; }
.dtable thead{ background:var(--surface-alt); text-align:left; }
.dtable th{ padding:11px 16px; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--text-soft); border-bottom:1px solid var(--border); white-space:nowrap; }
.dtable td{ padding:13px 16px; border-bottom:1px solid var(--border); color:var(--text); vertical-align:middle; }
.dtable tr:last-child td{ border-bottom:none; }
.dtable tr.clickable:hover td{ background:var(--surface-alt); cursor:pointer; }
.cell-name{ display:flex; align-items:center; gap:11px; }
.cell-av{ width:34px;height:34px;border-radius:10px; background:linear-gradient(135deg,#2D4A52,#1A2E35); color:#fff; display:grid;place-items:center; font-weight:700; font-size:11.5px; flex-shrink:0; }
.cell-name b{ font-weight:600; display:block; }
.cell-name span{ color:var(--text-mute); font-size:11px; }
.pill{ display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:999px; font-size:10.5px; font-weight:600; background:var(--surface-2); color:var(--text-soft); }
.pill::before{ content:""; width:6px;height:6px;border-radius:50%; background:var(--text-mute); }
.pill.green{ background:var(--green-bg); color:var(--green); } .pill.green::before{ background:var(--green-soft); }
.pill.amber{ background:var(--amber-bg); color:var(--amber); } .pill.amber::before{ background:var(--amber-soft); }
.pill.blue{ background:var(--blue-bg); color:var(--blue); } .pill.blue::before{ background:var(--blue-soft); }
.pill.red{ background:var(--red-bg); color:var(--red); } .pill.red::before{ background:var(--red-soft); }
.pill.accent{ background:var(--accent-bg); color:var(--accent-ink); } .pill.accent::before{ background:var(--accent); }
.src-tag{ display:inline-flex; align-items:center; gap:6px; font-size:11.5px; color:var(--text-soft); }
.src-tag svg{ width:14px;height:14px;stroke:currentColor;stroke-width:1.7;fill:none; opacity:.8; }
.money-cell{ font-weight:700; font-variant-numeric:tabular-nums; }

/* ─────────── Automatizaciones (list) ─────────── */
.auto-list{ display:flex; flex-direction:column; gap:12px; }
.auto-li{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:16px 18px; box-shadow:var(--shadow-card); display:grid; grid-template-columns:48px 1fr auto; gap:16px; align-items:center; }
.auto-li.off{ opacity:.62; }
.auto-li .a-ic{ width:48px;height:48px;border-radius:13px; background:var(--accent-bg); color:var(--accent-ink); display:grid;place-items:center; }
.auto-li .a-ic svg{ width:24px;height:24px;stroke:currentColor;stroke-width:1.7;fill:none; }
.auto-li.off .a-ic{ background:var(--surface-2); color:var(--text-mute); }
.auto-li .a-main b{ font-size:14px; display:block; letter-spacing:-.1px; }
.auto-li .a-main p{ margin:3px 0 9px; font-size:12px; color:var(--text-soft); line-height:1.45; max-width:520px; }
.auto-li .a-stats{ display:flex; gap:20px; flex-wrap:wrap; }
.auto-li .a-stats .s .v{ font-size:14px; font-weight:700; font-variant-numeric:tabular-nums; }
.auto-li .a-stats .s .l{ font-size:10.5px; color:var(--text-mute); }
.auto-li .a-right{ display:flex; flex-direction:column; align-items:flex-end; gap:10px; }
.auto-li .a-link{ font-size:11.5px; font-weight:600; color:var(--accent-ink); cursor:pointer; }

/* toggle switch */
.switch{ position:relative; width:44px; height:25px; flex-shrink:0; cursor:pointer; }
.switch input{ position:absolute; opacity:0; width:0;height:0; }
.switch .track{ position:absolute; inset:0; background:var(--surface-2); border:1px solid var(--border-strong); border-radius:999px; transition:.2s; }
.switch .thumb{ position:absolute; top:3px; left:3px; width:19px;height:19px; background:#fff; border-radius:50%; box-shadow:0 1px 3px rgba(0,0,0,.2); transition:.2s; }
.switch input:checked + .track{ background:var(--accent); border-color:var(--accent); }
.switch input:checked + .track + .thumb{ transform:translateX(19px); }

/* ─────────── Agenda (clínica/estudio) ─────────── */
.agenda-grid{ display:grid; grid-template-columns:64px 1fr; gap:0; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--shadow-card); overflow:hidden; }
.agenda-hour{ padding:14px 10px; font-size:11px; color:var(--text-mute); text-align:right; border-bottom:1px solid var(--border); border-right:1px solid var(--border); font-variant-numeric:tabular-nums; }
.agenda-slot{ padding:8px 12px; border-bottom:1px solid var(--border); min-height:56px; display:flex; flex-direction:column; gap:6px; justify-content:center; }
.appt{ border-radius:9px; padding:9px 12px; display:flex; align-items:center; gap:11px; border:1px solid var(--border); background:var(--surface-alt); }
.appt.book{ background:var(--accent-bg); border-color:color-mix(in srgb,var(--accent) 30%, var(--border)); }
.appt.conf{ background:var(--green-bg); border-color:#BBF7D0; }
.appt .a-time{ font-size:11px; font-weight:700; color:var(--text-soft); font-variant-numeric:tabular-nums; min-width:42px; }
.appt .a-pt{ flex:1; min-width:0; } .appt .a-pt b{ font-size:12.5px; display:block; } .appt .a-pt span{ font-size:11px; color:var(--text-soft); }
.appt .a-by{ font-size:10px; font-weight:700; padding:2px 8px; border-radius:999px; background:rgba(255,255,255,.7); color:var(--accent-ink); display:inline-flex; align-items:center; gap:4px; }
.appt .a-by svg{ width:11px;height:11px;stroke:currentColor;stroke-width:2;fill:none; }
.slot-empty{ font-size:11px; color:var(--text-mute); opacity:.6; padding-left:2px; }

/* ─────────── Mis agentes: área (mini-CRM) ─────────── */
.crumbs{ display:flex; align-items:center; gap:8px; margin-bottom:16px; font-size:12.5px; color:var(--text-mute); flex-wrap:wrap; }
.crumbs a{ color:var(--text-soft); cursor:pointer; display:inline-flex; align-items:center; gap:6px; font-weight:600; }
.crumbs a:hover{ color:var(--text); }
.crumbs .sep{ color:var(--border-strong); }
.crumbs b{ color:var(--text); font-weight:700; }
.crumb-back{ display:inline-flex; align-items:center; gap:6px; padding:6px 11px; border-radius:9px; border:1px solid var(--border); background:var(--surface); color:var(--text-soft); cursor:pointer; font-weight:600; }
.crumb-back:hover{ background:var(--surface-alt); color:var(--text); }
.crumb-back svg{ width:15px;height:15px;stroke:currentColor;stroke-width:1.9;fill:none; }

.area-head{ display:flex; align-items:flex-start; gap:14px; margin-bottom:18px; }
.area-head .a-ic{ width:46px;height:46px;border-radius:13px; background:var(--accent-bg); color:var(--accent-ink); display:grid;place-items:center; flex-shrink:0; }
.area-head .a-ic svg{ width:24px;height:24px;stroke:currentColor;stroke-width:1.7;fill:none; }
.area-head .a-meta{ flex:1; min-width:0; }
.area-head h1{ margin:0; font-size:22px; font-weight:700; letter-spacing:-.5px; }
.area-head .crm-tag{ display:inline-block; margin-bottom:6px; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--accent-ink); background:var(--accent-bg); padding:3px 9px; border-radius:999px; }
.area-head p{ margin:6px 0 0; color:var(--text-soft); font-size:12.5px; max-width:600px; line-height:1.5; }

/* agent cards grid */
.agents-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.agent-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:17px; box-shadow:var(--shadow-card); cursor:pointer; transition:transform .16s,box-shadow .16s,border-color .16s; display:flex; flex-direction:column; gap:13px; }
.agent-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lift); border-color:var(--border-strong); }
.agent-card.off{ opacity:.66; }
.agent-card-head{ display:grid; grid-template-columns:44px 1fr auto; gap:12px; align-items:center; }
.agent-av{ width:44px;height:44px;border-radius:12px; background:linear-gradient(135deg,var(--violet),var(--violet-soft)); color:#fff; display:grid;place-items:center; }
.agent-av svg{ width:23px;height:23px;stroke:currentColor;stroke-width:1.7;fill:none; }
.agent-card.off .agent-av{ background:var(--surface-2); color:var(--text-mute); }
.agent-card-head .nm b{ font-size:14px; display:block; letter-spacing:-.1px; }
.agent-card-head .nm span{ font-size:11px; color:var(--text-mute); }
.agent-card .a-sum{ font-size:12px; color:var(--text-soft); line-height:1.5; margin:0; }
.agent-card .a-mini{ display:flex; gap:18px; padding-top:12px; border-top:1px solid var(--border); }
.agent-card .a-mini .v{ font-size:15px; font-weight:700; font-variant-numeric:tabular-nums; }
.agent-card .a-mini .l{ font-size:10px; color:var(--text-mute); margin-top:1px; }
.agent-card .a-go{ margin-left:auto; align-self:center; font-size:11.5px; font-weight:600; color:var(--accent-ink); }

/* ─────────── Detalle de agente ─────────── */
.agent-wrap{ display:grid; grid-template-columns:1.45fr 1fr; gap:16px; align-items:start; }
.agent-hero{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:20px; box-shadow:var(--shadow-card); margin-bottom:14px; }
.agent-hero-head{ display:grid; grid-template-columns:54px 1fr auto; gap:14px; align-items:center; }
.agent-hero-av{ width:54px;height:54px;border-radius:14px; background:linear-gradient(135deg,var(--violet),var(--violet-soft)); color:#fff; display:grid;place-items:center; }
.agent-hero-av svg{ width:28px;height:28px;stroke:currentColor;stroke-width:1.7;fill:none; }
.agent-chat .chat-head .av{ background:linear-gradient(135deg,var(--violet),var(--violet-soft)); color:#fff; }
.agent-hero-name h2{ margin:0; font-size:19px; letter-spacing:-.3px; }
.agent-hero-name p{ margin:3px 0 0; color:var(--text-soft); font-size:12.5px; }
.agent-hero-ctrl{ display:flex; flex-direction:column; align-items:flex-end; gap:9px; }
.agent-hero-ctrl .tog-lbl{ font-size:11px; font-weight:600; color:var(--text-soft); display:flex; align-items:center; gap:8px; }
.agent-section{ margin-top:16px; padding-top:16px; border-top:1px solid var(--border); }
.agent-section h4{ margin:0 0 8px; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--text-soft); }
.agent-section p{ margin:0; font-size:13px; color:var(--text); line-height:1.6; }
.func-list{ list-style:none; padding:0; margin:12px 0 0; display:grid; grid-template-columns:1fr 1fr; gap:8px 16px; }
.func-list li{ font-size:12.5px; color:var(--text-soft); padding-left:22px; position:relative; line-height:1.4; }
.func-list li svg{ position:absolute; left:0; top:1px; width:15px;height:15px;stroke:var(--accent);stroke-width:2.2;fill:none; }
.flow{ display:flex; align-items:stretch; gap:8px; flex-wrap:wrap; }
.flow-step{ flex:1; min-width:150px; display:flex; align-items:center; gap:9px; background:var(--surface-alt); border:1px solid var(--border); border-radius:10px; padding:10px 12px; font-size:12px; color:var(--text); line-height:1.35; }
.flow-n{ width:21px;height:21px;flex-shrink:0; border-radius:50%; background:var(--accent); color:#fff; display:grid;place-items:center; font-size:11px; font-weight:700; }
.flow-arrow{ align-self:center; color:var(--text-mute); font-size:15px; }

.detail-stats{ display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin-bottom:14px; }
.stat-block{ background:var(--surface); border:1px solid var(--border); border-radius:11px; padding:13px 14px; box-shadow:var(--shadow-card); }
.stat-block .l{ font-size:10px; color:var(--text-mute); text-transform:uppercase; letter-spacing:.4px; line-height:1.3; }
.stat-block .v{ font-size:21px; font-weight:700; line-height:1.1; margin-top:5px; letter-spacing:-.4px; font-variant-numeric:tabular-nums; }
.stat-block .d{ font-size:10px; color:var(--green); margin-top:3px; } .stat-block .d.mute{ color:var(--text-mute); }

/* upsell card */
.upsell{ background:linear-gradient(135deg,#1A2E35,#2D4A52); color:#fff; border-radius:var(--r-md); padding:16px 18px; display:flex; align-items:center; gap:14px; margin-top:14px; }
.upsell .u-ic{ width:40px;height:40px;border-radius:11px; background:rgba(255,255,255,.12); display:grid;place-items:center; flex-shrink:0; }
.upsell .u-ic svg{ width:21px;height:21px;stroke:#fff;stroke-width:1.7;fill:none; }
.upsell .u-meta{ flex:1; min-width:0; }
.upsell b{ font-size:13.5px; display:block; }
.upsell span{ font-size:11.5px; color:rgba(255,255,255,.7); line-height:1.45; display:block; margin-top:2px; }
.upsell .btn-primary{ background:#fff; color:var(--text); flex-shrink:0; } .upsell .btn-primary:hover{ background:#EFEFF1; }

.agent-chat{ height:calc(100vh - 200px); min-height:480px; position:sticky; top:0; }
.chat-suggest{ padding:10px 14px 0; display:flex; flex-wrap:wrap; gap:7px; background:var(--surface); border-top:1px solid var(--border); }
.chip{ padding:6px 12px; border-radius:999px; background:var(--surface-alt); border:1px solid var(--border); font-size:11.5px; color:var(--text-soft); cursor:pointer; user-select:none; transition:.13s; line-height:1.2; }
.chip:hover{ background:var(--accent); color:#fff; border-color:var(--accent); }

/* ─────────── Agenda enriquecida (estilo CRM) ─────────── */
.agenda-top{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:14px; padding:12px 14px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--shadow-card); }
.ag-nav{ display:flex; align-items:center; gap:10px; }
.ag-arrow{ width:30px;height:30px;border-radius:8px; border:1px solid var(--border); background:var(--surface); color:var(--text-soft); cursor:pointer; font-size:16px; line-height:1; display:grid;place-items:center; transition:.12s; }
.ag-arrow:hover{ background:var(--surface-2); color:var(--text); border-color:var(--border-strong); }
.ag-day b{ display:block; font-size:13.5px; letter-spacing:-.2px; }
.ag-day span{ font-size:11px; color:var(--text-mute); }
.ag-stats{ display:flex; gap:10px; }
.ag-stat{ text-align:center; padding:6px 14px; border-radius:10px; background:var(--surface-alt); border:1px solid var(--border); min-width:74px; }
.ag-stat b{ display:block; font-size:17px; font-weight:700; letter-spacing:-.4px; font-variant-numeric:tabular-nums; }
.ag-stat span{ font-size:10.5px; color:var(--text-mute); }
.ag-stat.occ b{ color:var(--accent); }
.agenda-grid.rich .agenda-hour{ padding:16px 10px; display:flex; flex-direction:column; gap:3px; align-items:flex-end; }
.agenda-grid.rich .ah-dur{ font-size:9.5px; color:var(--text-mute); opacity:.8; }
.agenda-grid.rich .agenda-slot{ padding:8px 12px; }
.appt2{ display:flex; align-items:center; gap:12px; width:100%; border:1px solid var(--border); border-left:3px solid var(--border-strong); border-radius:10px; padding:10px 12px; background:var(--surface); cursor:pointer; transition:.14s; }
.appt2:hover{ border-color:var(--border-strong); background:var(--surface-alt); box-shadow:var(--shadow-card); }
.appt2.st-conf{ border-left-color:var(--green-soft); }
.appt2.st-pend{ border-left-color:var(--amber-soft); }
.appt2.st-new{ border-left-color:var(--blue-soft); }
.appt2.st-treat{ border-left-color:var(--accent); }
.appt2 .ap-av{ width:38px;height:38px;border-radius:10px; background:linear-gradient(135deg,#2D4A52,#1A2E35); color:#fff; display:grid;place-items:center; font-weight:700; font-size:11.5px; flex-shrink:0; }
.appt2 .ap-main{ flex:1; min-width:0; }
.ap-l1{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ap-l1 b{ font-size:13px; letter-spacing:-.1px; }
.ap-l2{ font-size:11.5px; color:var(--text-soft); margin-top:2px; }
.ap-l3{ display:flex; gap:12px; margin-top:5px; flex-wrap:wrap; }
.ap-l3 .ap-prof,.ap-l3 .ap-by{ display:inline-flex; align-items:center; gap:4px; font-size:10.5px; color:var(--text-mute); }
.ap-l3 svg{ width:12px;height:12px;stroke:currentColor;stroke-width:1.8;fill:none; }
.ap-actions{ display:flex; gap:5px; flex-shrink:0; }
.ap-btn{ width:30px;height:30px;border-radius:8px; border:1px solid var(--border); background:var(--surface); color:var(--text-soft); cursor:pointer; display:grid;place-items:center; transition:.12s; }
.ap-btn svg{ width:15px;height:15px;stroke:currentColor;stroke-width:1.8;fill:none; }
.ap-btn:hover{ background:var(--surface-2); color:var(--text); border-color:var(--border-strong); }
.ap-btn.wa:hover{ background:#25D366; color:#fff; border-color:#25D366; }
.slot-add{ display:inline-flex; align-items:center; gap:7px; width:100%; padding:9px 12px; border:1px dashed var(--border-strong); border-radius:10px; background:transparent; color:var(--text-mute); cursor:pointer; font:inherit; font-size:11.5px; transition:.12s; }
.slot-add svg{ width:15px;height:15px;stroke:currentColor;stroke-width:1.9;fill:none; }
.slot-add:hover{ background:var(--surface-alt); color:var(--text-soft); border-color:var(--text-mute); }

/* ─────────── Ficha de contacto ─────────── */
.cf-stats{ grid-template-columns:repeat(3,1fr); }
.cf-col{ display:flex; flex-direction:column; gap:14px; }
.cf-head{ display:flex; align-items:center; gap:14px; padding-bottom:16px; border-bottom:1px solid var(--border); margin-bottom:16px; }
.cf-av{ width:54px;height:54px;border-radius:14px; background:linear-gradient(135deg,#2D4A52,#1A2E35); color:#fff; display:grid;place-items:center; font-weight:700; font-size:18px; flex-shrink:0; }
.cf-id{ flex:1; min-width:0; } .cf-id h2{ margin:0; font-size:19px; letter-spacing:-.3px; } .cf-id p{ margin:2px 0 0; font-size:12px; color:var(--text-mute); }
.cf-facts{ display:grid; grid-template-columns:repeat(2,1fr); gap:10px 22px; margin-bottom:16px; }
.cf-fact{ display:flex; justify-content:space-between; gap:10px; padding-bottom:9px; border-bottom:1px solid var(--border); font-size:12.5px; }
.cf-fact .l{ color:var(--text-mute); } .cf-fact .v{ font-weight:600; text-align:right; }
.cf-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.cf-actions .btn svg{ width:15px;height:15px;stroke:currentColor;stroke-width:1.7;fill:none; }
.cf-notes{ display:flex; flex-direction:column; gap:10px; margin-bottom:12px; }
.cf-note{ background:var(--surface-alt); border:1px solid var(--border); border-radius:10px; padding:10px 12px; }
.cf-note-h{ display:flex; justify-content:space-between; gap:8px; margin-bottom:4px; }
.cf-note-h b{ font-size:11.5px; } .cf-note-h span{ font-size:10.5px; color:var(--text-mute); }
.cf-note p{ margin:0; font-size:12px; color:var(--text-soft); line-height:1.5; }
.cf-addnote{ display:flex; gap:8px; }
.cf-addnote input{ flex:1; border:1px solid var(--border); border-radius:9px; padding:8px 11px; font:inherit; font-size:12px; color:var(--text); background:var(--surface-alt); outline:none; transition:.12s; }
.cf-addnote input:focus{ border-color:var(--accent); background:var(--surface); }
.cf-addnote .btn svg{ width:15px;height:15px;stroke:currentColor;stroke-width:2;fill:none; }
.cf-item{ display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--border); }
.cf-item:last-child{ border-bottom:none; }
.cf-item-main{ flex:1; min-width:0; } .cf-item-main b{ font-size:12.5px; display:block; letter-spacing:-.1px; } .cf-item-main span{ font-size:11px; color:var(--text-mute); }
.cf-item-val{ font-size:12.5px; font-weight:700; font-variant-numeric:tabular-nums; min-width:62px; text-align:right; }
.cf-empty{ padding:18px 4px; text-align:center; font-size:12px; color:var(--text-mute); }

/* ─────────── responsive ─────────── */
.mobile-menu-btn{ display:none; }
.mobile-nav-overlay{ display:none; }

@media (max-width:1024px){
  .app{ grid-template-columns:1fr; margin:0; height:100vh; border-radius:0; border:0; }
  .sidebar{ position:fixed; top:0; left:0; width:286px; max-width:86vw; height:100vh; z-index:200; transform:translateX(-100%); transition:transform .3s cubic-bezier(.4,0,.2,1); }
  .sidebar.m-open{ transform:translateX(0); box-shadow:var(--shadow-pop); }
  .mobile-nav-overlay{ display:block; position:fixed; inset:0; background:rgba(20,20,30,.4); z-index:150; opacity:0; pointer-events:none; transition:opacity .3s; }
  .mobile-nav-overlay.active{ opacity:1; pointer-events:auto; }
  .mobile-menu-btn{ display:inline-flex; align-items:center; justify-content:center; width:40px;height:40px; min-width:40px; flex-shrink:0; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); cursor:pointer; }
  .mobile-menu-btn svg{ width:20px;height:20px;stroke:currentColor;stroke-width:1.8;fill:none; }
  .kpis{ grid-template-columns:repeat(2,1fr); }
  .auto-grid{ grid-template-columns:repeat(2,1fr); }
  .conv-wrap{ grid-template-columns:280px 1fr; }
  .agents-grid{ grid-template-columns:repeat(2,1fr); }
  .agent-wrap{ grid-template-columns:1fr; }
  .agent-chat{ height:auto; min-height:520px; position:static; order:-1; }
  .detail-stats{ grid-template-columns:repeat(3,1fr); }
  .search{ display:none; }
}
@media (max-width:768px){
  /* móvil compacto: campos más chicos → más info por pantalla, menos scroll */
  html,body{ font-size:14px; }
  .topbar{ padding:9px 12px; gap:9px; }
  .tb-title h2{ font-size:14px; } .tb-title .sub{ display:none; }
  .page{ padding:13px 12px 22px; }
  .page-head{ margin-bottom:12px; } .page-head h1{ font-size:19px; } .page-head p{ font-size:12px; }
  /* hero (resultados del mes) más fino: menos padding, sub a 2 líneas, chips 3-up compactos */
  .hero{ padding:12px 14px; margin-bottom:11px; }
  .hero-eyebrow{ font-size:10px; }
  .hero-main{ margin-top:7px; gap:10px; }
  .hero-figure{ font-size:27px; } .hero-figure .cur{ font-size:15px; vertical-align:2px; }
  .hero-sub{ font-size:11.5px; margin-top:4px; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  .hero-chips{ gap:6px; margin-top:9px; }
  .hero-chip{ flex:1 1 calc(33.33% - 4px); min-width:calc(33.33% - 4px); padding:7px 9px; border-radius:9px; }
  .hero-chip .v{ font-size:15px; } .hero-chip .l{ font-size:9.5px; }
  /* gráfico más bajo en móvil */
  .bchart{ height:150px; gap:14px; padding-top:6px; } .bcol-v{ font-size:11.5px; margin-bottom:6px; } .bcol-l{ margin-top:8px; }
  /* KPIs siempre en 2 columnas y compactos */
  .kpis{ grid-template-columns:repeat(2,1fr); gap:9px; margin-bottom:13px; }
  .kpi{ padding:12px; }
  .kpi .k-top{ margin-bottom:8px; gap:7px; } .kpi .k-ic{ width:26px;height:26px; }
  .kpi .value{ font-size:20px; }
  .kpi .delta{ margin-top:7px; font-size:10.5px; padding:2px 7px; }
  .auto-grid{ grid-template-columns:1fr; }
  .agents-grid{ grid-template-columns:1fr; }
  .detail-stats{ grid-template-columns:repeat(2,1fr); }
  .func-list{ grid-template-columns:1fr; }
  .flow-step{ min-width:100%; }
  .flow-arrow{ display:none; }
  .row-2{ grid-template-columns:1fr; }
  .conv-wrap{ grid-template-columns:1fr; height:auto; }
  .conv-list{ height:auto; max-height:52vh; }
  .chat{ height:72vh; min-height:440px; }
  .auto-li{ grid-template-columns:1fr; gap:12px; }
  .auto-li .a-right{ flex-direction:row; align-items:center; justify-content:space-between; }
  .table-scroll{ overflow-x:auto; } .dtable{ min-width:620px; }
  .agenda-grid{ grid-template-columns:52px 1fr; }
  .actions .btn .lbl-hide{ display:none; }
  .btn,.send,.nav-item,.filter-chip,.channel-tab{ min-height:42px; }
}
@media (max-width:420px){
  /* seguimos densos: 2 KPIs por fila y chips 3-up, no 1 por fila */
  .kpis{ grid-template-columns:repeat(2,1fr); }
  .kpi .value{ font-size:19px; }
  .hero-figure{ font-size:29px; }
  .hero-chip{ flex:1 1 calc(33.33% - 5px); min-width:calc(33.33% - 5px); }
}

/* animations */
@keyframes pulse{ 0%{box-shadow:0 0 0 0 rgba(22,163,74,.5);} 70%{box-shadow:0 0 0 7px rgba(22,163,74,0);} 100%{box-shadow:0 0 0 0 rgba(22,163,74,0);} }
@keyframes blink{ 0%,80%,100%{opacity:.25;} 40%{opacity:1;} }
@keyframes mcViewIn{ from{opacity:0;} to{opacity:1;} }
@keyframes mcFadeUp{ from{opacity:0;transform:translateY(12px);} to{opacity:1;transform:none;} }
.view.active .kpi,.view.active .card,.view.active .auto-rc,.view.active .hero,.view.active .auto-li,.view.active .table-card,.view.active .conv-list,.view.active .chat,.view.active .agenda-grid{ animation:mcFadeUp .42s cubic-bezier(.22,.61,.36,1) both; }
@keyframes mcGrowX{ from{transform:scaleX(0);} to{transform:scaleX(1);} }
.view.active .bar .fill{ transform-origin:left center; animation:mcGrowX .9s cubic-bezier(.22,.61,.36,1) both; }
@keyframes mcGrowY{ from{transform:scaleY(0);} to{transform:scaleY(1);} }
.view.active .mini-bars .bar{ transform-origin:bottom center; animation:mcGrowY .8s cubic-bezier(.22,.61,.36,1) both; }
@keyframes mcDraw{ to{stroke-dashoffset:0;} }
.mc-line{ animation:mcDraw 1.15s cubic-bezier(.22,.61,.36,1) forwards; }
@keyframes mcFadeArea{ from{opacity:0;} to{opacity:1;} }
.mc-area{ animation:mcFadeArea 1s ease forwards; }
@media (prefers-reduced-motion:reduce){ *{ animation:none !important; } }

/* ============================================================
   BRAND v2 (dorado editorial) — overrides
   Sidebar petróleo con texto claro · logo dorado · data-viz dorado.
   Va al final para ganar al sistema tokenizado sin tocar el resto.
   ============================================================ */
.sidebar{ border-right-color:rgba(201,163,134,.18); }
.brand{ border-bottom-color:rgba(201,163,134,.18); }
.brand-logo{ background:#C9A386; color:#1A2E35; }     /* logo dorado (no petróleo sobre petróleo) */
.brand-name{ color:#F4EBDC; }
.brand-sub{ color:#D4B297; }
.nav-item{ color:#C2B6A2; }
.nav-section{ color:#9A8C74; }
.nav-item .badge{ background:rgba(244,235,220,.10); color:#D4B297; }
.sidebar::-webkit-scrollbar-thumb{ background:rgba(201,163,134,.30); }

/* data-viz en dorado (el pop de la marca; el accent sólido sigue petróleo) */
.bfill, .bfill.top,
.mini-bars .col .bar,
.bar .fill{ background:#C9A386; }

/* hero "Resultados del mes": glow dorado sobre el degradé petróleo */
.hero-glow{ background:radial-gradient(circle, rgba(201,163,134,.55) 0%, transparent 70%); }
/* agentes: avatar dorado con ícono petróleo (eran violeta) */
.agent-av, .agent-hero-av, .agent-chat .chat-head .av{ color:#1A2E35; }
