/* Appt CRM · prototipo — paleta tomada de la presentación BDC */
:root {
  --navy: #102C3F;
  --navy-2: #173A52;
  --navy-3: #22475F;
  --teal: #1D97A0;
  --teal-ink: #11727A;      /* turquesa para texto sobre blanco (contraste AA) */
  --teal-50: #EBF6F8;
  --teal-100: #DAEBEF;
  --slate: #5B707B;
  --bg: #F2F6F8;
  --surface: #FFFFFF;
  --surface-2: #F7FAFB;
  --line: #E1E9ED;
  --line-2: #CBD8DE;
  --text: #13232E;
  --muted: #5B707B;
  --faint: #8A9BA4;
  --chart-a: #009AA6;       /* serie 1 (validada) */
  --chart-b: #C8641F;       /* serie 2 (validada) */
  --good: #1E7F55;
  --good-bg: #E6F4EC;
  --warn: #9A6212;
  --warn-bg: #FBF1DE;
  --bad: #B2352A;
  --bad-bg: #FBE9E7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 44, 63, .06), 0 2px 8px rgba(16, 44, 63, .05);
  --shadow-lg: 0 12px 40px rgba(16, 44, 63, .22);
  --head: "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--head); margin: 0; letter-spacing: .01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal-ink); }
svg.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-ico] { display: inline-flex; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy);
  color: #D7E4EA;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 34px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--head); font-size: 18px; color: #fff; letter-spacing: .02em; }
.brand-text span { font-size: 11px; color: #9FB6C2; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; overflow-y: auto; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #7F9AA8; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 8px;
  color: #D7E4EA; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.active { background: var(--teal); color: #fff; }
.nav a .badge { margin-left: auto; background: rgba(255,255,255,.16); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; font-weight: 600; }
.nav a.active .badge { background: rgba(16,44,63,.28); }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; }
.model-chip { font-size: 11.5px; color: #9FB6C2; display: flex; align-items: center; gap: 8px; }
.model-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #E5A33B; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; background: rgba(242,246,248,.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input {
  width: 100%; padding: 9px 12px 9px 36px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--surface);
}
.search input:focus { outline: 2px solid var(--teal); outline-offset: -1px; border-color: transparent; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; max-height: 360px; overflow: auto;
}
.search-results button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.search-results button:hover { background: var(--teal-50); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-switch { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.role-switch select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; color: var(--text); }

.view { padding: 24px; outline: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { font-size: 28px; color: var(--navy); }
.view-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { font-family: var(--head); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-ink); font-weight: 600; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h3 { font-size: 17px; color: var(--navy); }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }

.btn {
  text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--teal); color: var(--teal-ink); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: #17858D; color: #fff; }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-3); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn svg.ico { width: 16px; height: 16px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
.btn:focus-visible, .icon-btn:focus-visible, .nav a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--teal-50); color: var(--teal-ink); white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.gray { background: #EEF2F4; color: var(--slate); }
.pill.navy { background: var(--navy); color: #fff; }
.pill svg.ico { width: 13px; height: 13px; }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff; background: var(--navy-3); flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Canal */
.ch { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; flex: none; color: #fff; }
.ch svg.ico { width: 13px; height: 13px; }
.ch-whatsapp { background: #1F9D57; }
.ch-instagram { background: #B8407A; }
.ch-facebook { background: #2D5FB0; }
.ch-web { background: var(--navy-3); }
.ch-telefono { background: var(--teal-ink); }
.ch-correo { background: #6B5BA8; }

/* ---------- Tablero ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12.5px; color: var(--muted); }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; color: var(--navy); font-family: var(--body); }
.kpi .delta { font-size: 12px; margin-top: 2px; }
.kpi .delta.up { color: var(--good); }
.kpi .delta.down { color: var(--bad); }
.hero-kpi { background: var(--navy); color: #fff; border-color: var(--navy); }
.hero-kpi .label { color: #A9C2CE; }
.hero-kpi .value { color: #fff; font-size: 30px; }
.hero-kpi .delta.up { color: #7FD8B0; }

.funnel { padding: 6px 18px 18px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 84px; align-items: center; gap: 12px; padding: 7px 0; }
.funnel-row .stage { font-weight: 500; }
.funnel-row .stage small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.funnel-track { position: relative; height: 22px; }
.funnel-bar { position: absolute; left: 0; top: 0; height: 22px; background: var(--chart-a); border-radius: 0 4px 4px 0; cursor: default; }
.funnel-bar:hover { filter: brightness(1.08); }
.funnel-val { position: absolute; top: 50%; transform: translateY(-50%); font-weight: 600; font-size: 12.5px; padding-left: 8px; white-space: nowrap; }
.funnel-conv { text-align: right; font-size: 12px; color: var(--muted); }
.funnel-conv b { color: var(--text); font-weight: 600; }

.chart-wrap { padding: 8px 18px 16px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); padding: 10px 18px 0; flex-wrap: wrap; }
.legend .key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-svg text { font-family: var(--body); font-size: 11px; fill: var(--muted); }
.chart-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis-line { stroke: var(--line-2); stroke-width: 1; }

.alert-list { display: flex; flex-direction: column; }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-top: 1px solid var(--line); cursor: pointer; }
.alert-item:hover { background: var(--surface-2); }
.alert-item .ai-ico { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.alert-item .ai-ico.bad { background: var(--bad-bg); color: var(--bad); }
.alert-item .ai-ico.warn { background: var(--warn-bg); color: var(--warn); }
.alert-item .ai-ico.good { background: var(--good-bg); color: var(--good); }
.alert-item .ai-ico.teal { background: var(--teal-50); color: var(--teal-ink); }
.alert-item strong { display: block; font-weight: 600; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; }
.minibar { display: inline-block; height: 8px; border-radius: 4px; background: var(--teal-100); width: 70px; vertical-align: middle; position: relative; overflow: hidden; margin-right: 8px; }
.minibar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--chart-a); border-radius: 4px; }

.ai-card { background: linear-gradient(180deg, #F0FAFB 0%, #FFFFFF 100%); border-color: #C9E6EA; }
.ai-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--teal-ink); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Embudo kanban ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #E8EFF2; border-radius: 12px; padding: 10px; min-height: 240px; }
.col.drop { outline: 2px dashed var(--teal); outline-offset: -2px; background: var(--teal-50); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.col-head h3 { font-size: 14px; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; }
.col-head .n { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--slate); background: #fff; border-radius: 99px; padding: 1px 8px; }
.col-head .step { width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.col.lost .col-head .step { background: var(--slate); }
.col-sum { font-size: 11.5px; color: var(--muted); padding: 0 4px 8px; }
.lead-card { background: var(--surface); border-radius: 9px; padding: 11px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; border: 1px solid transparent; }
.lead-card:hover { border-color: var(--teal-100); }
.lead-card.dragging { opacity: .45; }
.lead-card .t { font-weight: 600; }
.lead-card .co { font-size: 12.5px; color: var(--muted); }
.lead-card .meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.lead-card .next { margin-top: 8px; font-size: 12px; display: flex; align-items: center; gap: 6px; color: var(--slate); }
.lead-card .next.overdue { color: var(--bad); font-weight: 600; }
.lead-card .next.none { color: var(--bad); font-weight: 600; }
.lead-card .next svg.ico { width: 14px; height: 14px; }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 20px; padding: 0 6px; border-radius: 6px; font-size: 11.5px; font-weight: 700; }
.score.hi { background: var(--good-bg); color: var(--good); }
.score.mid { background: var(--warn-bg); color: var(--warn); }
.score.lo { background: #EEF2F4; color: var(--slate); }

/* ---------- Bandeja ---------- */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; height: calc(100vh - 215px); min-height: 520px; overflow: hidden; }
.inbox > div { min-height: 0; }
.conv-list { border-right: 1px solid var(--line); overflow-y: auto; }
.conv-tabs { display: flex; gap: 4px; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conv-tabs button { border: 0; background: none; padding: 5px 9px; border-radius: 7px; font-size: 12.5px; cursor: pointer; color: var(--muted); font-weight: 500; }
.conv-tabs button.on { background: var(--teal-50); color: var(--teal-ink); }
.conv { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv:hover { background: var(--surface-2); }
.conv.on { background: var(--teal-50); }
.conv .body { min-width: 0; flex: 1; }
.conv .name { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.conv .name time { font-weight: 400; font-size: 11.5px; color: var(--faint); }
.conv .last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .unread { background: var(--teal); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 6px; }
.conv .sla { font-size: 11px; font-weight: 600; color: var(--bad); }
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-body { flex: 1; overflow-y: auto; padding: 18px; background: #F4F8F9; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 74%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.msg.in { background: #fff; align-self: flex-start; border-top-left-radius: 4px; }
.msg.out { background: #D9F1EE; align-self: flex-end; border-top-right-radius: 4px; }
.msg.sys { align-self: center; background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; }
.msg time { display: block; font-size: 10.5px; color: var(--faint); margin-top: 3px; text-align: right; }
.composer { border-top: 1px solid var(--line); padding: 10px; display: flex; gap: 8px; align-items: flex-end; background: #fff; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; min-height: 42px; max-height: 140px; }
.composer textarea:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
.copilot { border-left: 1px solid var(--line); overflow-y: auto; padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }
.copilot .box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.copilot .box h4 { font-size: 13.5px; color: var(--navy); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.suggest { background: var(--teal-50); border-radius: 8px; padding: 10px; font-size: 13px; white-space: pre-wrap; }
.thinking { display: inline-flex; gap: 4px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* Calificación N/I/U/C */
.qual { display: grid; grid-template-columns: 92px 1fr 22px; gap: 6px 10px; align-items: center; font-size: 12.5px; }
.dots { display: flex; gap: 4px; }
.dots button { width: 18px; height: 8px; border-radius: 4px; border: 0; background: var(--teal-100); padding: 0; cursor: pointer; }
.dots button.on { background: var(--chart-a); }
.dots.ro button { cursor: default; }

/* ---------- Ficha ---------- */
.stepper { display: flex; gap: 0; margin: 4px 0 18px; overflow-x: auto; }
.stepper .st { flex: 1; min-width: 120px; position: relative; padding: 10px 12px 10px 26px; background: #E8EFF2; color: var(--slate); font-weight: 600; font-size: 12.5px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); cursor: pointer; border: 0; text-align: left; }
.stepper .st:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); padding-left: 14px; }
.stepper .st.done { background: var(--teal-100); color: var(--teal-ink); }
.stepper .st.cur { background: var(--navy); color: #fff; }
.stepper .st small { display: block; font-weight: 400; font-size: 11px; opacity: .85; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.tl-ico { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--teal-50); color: var(--teal-ink); flex: none; }
.tl-ico svg.ico { width: 15px; height: 15px; }
.next-action { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.next-action.missing { border-color: #EDC1BB; background: var(--bad-bg); }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--slate); }
.form input, .form select, .form textarea { padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; font-size: 14px; color: var(--text); }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--teal); outline-offset: -1px; border-color: transparent; }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; display: grid; gap: 10px; }
.form legend { font-family: var(--head); font-weight: 600; color: var(--navy); padding: 0 6px; font-size: 14px; }
.form .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.form .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.rule { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 9px 11px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); }
.rule svg.ico { width: 16px; height: 16px; margin-top: 1px; }

/* ---------- Modal y toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,44,63,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 20px; color: var(--navy); }
.modal-body { padding: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 60; font-weight: 500; max-width: calc(100vw - 32px); }
.tooltip { position: fixed; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 7px; z-index: 70; box-shadow: var(--shadow-lg); white-space: nowrap; }

/* ---------- Citas, tareas, guiones, academia ---------- */
.day-group h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--slate); padding: 14px 18px 8px; }
.appt { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.appt .hour { font-weight: 700; color: var(--navy); font-size: 15px; }
.appt .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-top: 1px solid var(--line); }
.task input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); cursor: pointer; }
.script-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 11px 14px; border-radius: 8px; cursor: pointer; }
.script-list button:hover { background: var(--surface-2); }
.script-list button.on { background: var(--teal-50); color: var(--teal-ink); font-weight: 600; }
.script-step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.script-step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; }
.script-step blockquote { margin: 6px 0 0; padding: 9px 12px; background: var(--teal-50); border-radius: 8px; font-style: italic; color: var(--navy); }
.rubric { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, 38%); gap: 6px 12px; font-size: 13px; align-items: center; }
.meter { height: 8px; border-radius: 4px; background: var(--teal-100); position: relative; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--chart-a); }
.module { display: grid; grid-template-columns: 44px minmax(0, 1fr) 150px; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.module .mn { font-family: var(--head); font-size: 20px; font-weight: 700; color: var(--teal-ink); }
.sector-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sector { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; background: #fff; text-align: left; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; }
.sector:hover { border-color: var(--teal); }
.sector.on { border-color: var(--teal); background: var(--teal-50); }
.sector strong { display: block; color: var(--navy); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.setting { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
.integr { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.integr:first-child { border-top: 0; }

/* ---------- Responsivo ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inbox { grid-template-columns: 260px minmax(0, 1fr); }
  .copilot { display: none; }
  .inbox.show-copilot { grid-template-columns: minmax(0, 1fr) 320px; }
  .inbox.show-copilot .conv-list { display: none; }
  .inbox.show-copilot .copilot { display: flex; }
}
@media (max-width: 1000px) {
  .g-main, .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .sector-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .view { padding: 16px; }
  .role-switch span, .hide-sm { display: none; }
  .inbox { grid-template-columns: minmax(0, 1fr); height: auto; }
  .inbox .conv-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .inbox .thread { height: 70vh; }
  .inbox.show-copilot { grid-template-columns: minmax(0, 1fr); }
  .inbox.show-copilot .copilot { border-left: 0; border-top: 1px solid var(--line); }
  .module { grid-template-columns: 36px minmax(0, 1fr); }
  .module > :last-child { grid-column: 2; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { display: none; }
  .funnel-row { grid-template-columns: 96px 1fr 60px; gap: 8px; }
  .funnel-row .stage small { display: none; }
  .form .two { grid-template-columns: 1fr; }
  .appt { grid-template-columns: 52px minmax(0, 1fr); }
  .appt .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .sector-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px 1fr; }
  .view-head h1 { font-size: 24px; }
}

/* ---------- Búsqueda rápida (⌘K) ---------- */
kbd { font-family: var(--body); font-size: 11px; font-weight: 500; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; line-height: 1.5; }
.search { position: relative; }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.cmdk-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10, 28, 40, .45); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: fadeIn .14s ease-out; }
.cmdk { width: min(640px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: popIn .16s cubic-bezier(.2,.8,.2,1); }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-input input { flex: 1; border: 0; outline: 0; font-size: 16px; color: var(--text); background: transparent; }
.cmdk-list { max-height: min(56vh, 440px); overflow: auto; padding: 6px; }
.cmdk-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--text); }
.cmdk-item .sub { color: var(--muted); font-size: 12px; }
.cmdk-item .grow { flex: 1; min-width: 0; }
.cmdk-item .grow b, .cmdk-item .grow .sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item.on { background: var(--teal-50); }
.cmdk-item.on .ico-wrap { color: var(--teal-ink); }
.cmdk-item .ico-wrap { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface-2); color: var(--muted); flex: none; }
.cmdk-empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.cmdk-foot kbd { margin-right: 3px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .search-kbd, .cmdk-foot { display: none; } .cmdk-backdrop { padding-top: 8vh; } }
@media (prefers-reduced-motion: reduce) { .cmdk-backdrop, .cmdk { animation: none; } }

/* ---------- Transiciones ---------- */
.view.enter { animation: viewIn .2s cubic-bezier(.2,.8,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pill.live svg { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .view.enter, .pill.live svg { animation: none; } }

/* =====================================================================
   Rediseño 2 · más limpio y fluido (patrones de Kommo, Attio y Pipedrive
   adaptados al método BDC). Estas reglas ajustan las anteriores.
   ===================================================================== */
:root {
  --bg: #F5F8FA;
  --line: #E3EAEE;
  --shadow: none;
  --shadow-hover: 0 4px 12px rgba(16, 44, 63, .08);
  --shadow-pop: 0 16px 40px rgba(16, 44, 63, .18);
  --r-sm: 6px; --r-md: 8px; --r-card: 12px;
}
body { line-height: 1.43; }
.view-head h1 { font-size: 24px; line-height: 30px; }
.card { box-shadow: none; border-color: var(--line); border-radius: var(--r-card); }
.btn { transition: border-color .12s ease-out, background .12s ease-out, color .12s ease-out, transform .12s ease-out; }
.btn:active { transform: translateY(1px); }
.kpi .value { font-weight: 600; font-size: 28px; line-height: 32px; }

/* Barra lateral: ítem activo discreto, el turquesa solo como acento */
.nav a { min-height: 36px; padding: 8px 10px; transition: background .12s ease-out, color .12s ease-out; }
.nav a.active { background: rgba(255,255,255,.09); color: #fff; box-shadow: inset 3px 0 0 var(--teal); }
.nav a.active .badge { background: rgba(255,255,255,.16); }
.nav a .badge { background: rgba(255,255,255,.14); }

/* Definición de cada KPI */
.info { display: inline-flex; width: 14px; height: 14px; border-radius: 50%; border: 1px solid currentColor; font-size: 9px; font-weight: 700; align-items: center; justify-content: center; opacity: .55; cursor: help; margin-left: 3px; font-style: normal; vertical-align: 1px; }
.info:hover { opacity: 1; }

/* ---------- Embudo ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar select, .toolbar input { height: 32px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; }
.seg { display: inline-flex; background: #E7EEF1; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-btn { border: 0; background: transparent; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .12s ease-out, color .12s ease-out, box-shadow .12s ease-out; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--surface); color: var(--navy); box-shadow: 0 1px 2px rgba(16,44,63,.12); }
.seg-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.seg-n { font-size: 11px; font-weight: 600; background: rgba(16,44,63,.07); border-radius: 99px; padding: 0 6px; min-width: 18px; text-align: center; }
.seg-btn.alert .seg-n { background: var(--bad-bg); color: var(--bad); }
.board { grid-auto-columns: minmax(264px, 1fr); gap: 12px; }
.col { background: #EEF3F5; border-radius: var(--r-card); padding: 0 8px 8px; border-top: 3px solid var(--stage); min-height: 260px; transition: background .12s ease-out; }
.col-head { padding: 10px 4px 2px; }
.col-head h3 { font-size: 13px; letter-spacing: .06em; }
.col-head .step { background: var(--stage); width: 18px; height: 18px; font-size: 10.5px; }
.col.lost .col-head .step { background: var(--slate); }
.col-head .n { background: var(--surface); }
.col-sum { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 10px; }
.col-conv { font-size: 11.5px; font-weight: 600; color: var(--teal-ink); background: var(--surface); border-radius: 99px; padding: 1px 7px; cursor: help; }
.col-body { display: flex; flex-direction: column; gap: 8px; }
.col-empty { border: 1px dashed var(--line-2); border-radius: 10px; padding: 18px 8px; text-align: center; font-size: 12px; color: var(--faint); }
.col.drop { outline: 2px dashed var(--teal); outline-offset: -2px; background: var(--teal-50); }
.lead-card { margin: 0; border-radius: 10px; padding: 12px; border: 1px solid var(--line); box-shadow: none; cursor: pointer; transition: border-color .12s ease-out, box-shadow .12s ease-out, transform .12s ease-out; }
.lead-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-hover); }
.lead-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.lead-card.dragging { opacity: .92; transform: rotate(2deg); box-shadow: var(--shadow-hover); cursor: grabbing; }
.lead-card.risk { background: #FDF3F2; border-color: #F3D3CF; box-shadow: inset 3px 0 0 var(--bad); }
.lead-card.flash { animation: cardFlash .6s ease-out; }
@keyframes cardFlash { 0% { background: var(--teal-100); border-color: var(--teal); } 100% { background: var(--surface); } }
.lc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lead-card .t { font-weight: 600; font-size: 14px; line-height: 20px; }
.lead-card .co { font-size: 12px; line-height: 16px; margin-top: 2px; }
.lc-sla { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 11.5px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: 99px; }
.lc-sla.late { color: var(--bad); background: #FBE1DE; }
.lc-sla svg.ico { width: 13px; height: 13px; animation: pulse 2s ease-in-out infinite; }
.lc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.lc-who { display: inline-flex; align-items: center; gap: 6px; }
.nx { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; padding: 2px 8px; border-radius: 99px; }
.nx i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.nx svg.ico { width: 13px; height: 13px; }
.nx.good { color: var(--good); background: var(--good-bg); }
.nx.bad { color: var(--bad); background: var(--bad-bg); }
.nx.warn { color: var(--warn); background: var(--warn-bg); }
.nx.gray { color: var(--slate); background: #EEF2F4; }
.nx.teal { color: var(--teal-ink); background: var(--teal-50); }

/* ---------- Panel lateral del prospecto ---------- */
.drawer { position: fixed; inset: 0; z-index: 45; background: rgba(10,28,40,0); transition: background .2s ease; }
.drawer.open { background: rgba(10,28,40,.18); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--surface); box-shadow: var(--shadow-pop); overflow-y: auto; transform: translateX(24px); opacity: 0; transition: transform .24s cubic-bezier(.2,.8,.2,1), opacity .2s cubic-bezier(.2,.8,.2,1); border-radius: 16px 0 0 16px; }
.drawer.open .drawer-panel { transform: none; opacity: 1; }
#drawerBody { padding: 18px 20px 28px; outline: none; display: flex; flex-direction: column; gap: 14px; }
.dr-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dr-head h2 { font-size: 20px; line-height: 26px; color: var(--navy); }
.dr-head .ch { margin-top: 3px; }
.segs { display: flex; gap: 4px; margin-bottom: 8px; }
.sg { flex: 1; height: 6px; border-radius: 99px; background: #E3EAEE; }
.sg.on { background: var(--stage); }
.dr-alert { display: flex; gap: 8px; align-items: center; background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.dr-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.dr-next { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px; }
.dr-next.late { border-color: #F3D3CF; background: #FDF3F2; }
.dr-next .grow, .grow { flex: 1; min-width: 0; }
.q-ico { width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--slate); flex: none; }
.q-ico svg.ico { width: 16px; height: 16px; }
.q-ico.bad, .dr-next.late .q-ico { background: var(--bad-bg); color: var(--bad); }
.q-ico.warn { background: var(--warn-bg); color: var(--warn); }
.dr-ai { border: 1px solid #C9E6EA; background: linear-gradient(180deg, #F0FAFB, #fff); border-radius: var(--r-card); padding: 12px 14px; }
.dr-ai p { margin: 6px 0 0; font-size: 13px; }
.dr-sec h4 { font-family: var(--head); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.qrow { display: grid; grid-template-columns: 90px 1fr 20px; gap: 10px; align-items: center; font-size: 13px; margin: 6px 0; }
.qbar { height: 6px; border-radius: 99px; background: #E3EAEE; overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.qrow b { text-align: right; }
.dr-ev { display: flex; gap: 10px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dr-ev:last-child { border-bottom: 0; }
.ev-ico { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); color: var(--slate); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ev-ico svg.ico { width: 13px; height: 13px; }

/* ---------- Mi día ---------- */
.today-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 16px; display: flex; align-items: baseline; gap: 10px; }
.ts b { font-size: 26px; line-height: 30px; font-weight: 600; color: var(--navy); }
.ts span { color: var(--muted); font-size: 13px; }
.ts.bad { border-color: #F3D3CF; background: #FDF6F5; }
.ts.bad b { color: var(--bad); }
.ts.warn b { color: var(--warn); }
.ts.good b { color: var(--good); }
.midia { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.q-col { display: flex; flex-direction: column; gap: 16px; }
.q-sec { padding: 0 0 4px; overflow: hidden; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 10px; }
.q-head h3 { font-size: 16px; color: var(--navy); }
.q-head .sub { font-size: 12.5px; color: var(--muted); }
.q-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); transition: background .12s ease-out; }
.q-item:hover { background: var(--surface-2); }
.q-title { font-weight: 600; color: var(--text); text-decoration: none; }
.q-title:hover { color: var(--teal-ink); }
.q-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-when { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.q-time { font-weight: 600; font-size: 14px; color: var(--navy); }
.q-acts { display: flex; gap: 6px; justify-content: flex-end; }
.q-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.side-h { font-size: 15px; color: var(--navy); margin-bottom: 12px; }
.meter-row { margin-bottom: 12px; }
.meter-row .meter { margin-top: 6px; }
.tip-card h3 { font-size: 18px; color: var(--navy); margin: 6px 0 4px; }
.tip-card p { margin: 0 0 10px; color: var(--muted); }
.empty-big { text-align: center; padding: 40px 20px; }
.empty-big svg.ico { width: 40px; height: 40px; color: var(--good); }

/* ---------- Citas ---------- */
.now-line { position: relative; height: 0; border-top: 2px solid var(--bad); margin: 14px 0 10px; }
.now-line span { position: absolute; left: 0; top: -11px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; }
.appt.pending { background: #FFFBF2; }

/* ---------- Adopción ---------- */
.adopt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px 18px 18px; }
.adopt { border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 14px; }
.adopt .v { font-size: 24px; font-weight: 600; color: var(--navy); margin: 4px 0 6px; }

@media (max-width: 1100px) {
  .midia { grid-template-columns: minmax(0, 1fr); }
  .q-side { position: static; }
  .adopt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .today-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .q-item { grid-template-columns: 32px minmax(0, 1fr); }
  .q-when, .q-acts { grid-column: 2; justify-content: flex-start; align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; }
  .toolbar-right { margin-left: 0; }
  .drawer-panel { border-radius: 0; }
  .adopt-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-panel, .lead-card, .seg-btn, .nav a, .col { transition: none; }
  .lead-card.flash, .lc-sla svg.ico { animation: none; }
}
.col[data-stage="contacto"] .col-head .step { color: var(--navy); }
