/* Oprisia DB — tema oscuro con la paleta de marca (#070B24 · #FF5C5C · #3D7BFF · #4F5BD5) */
:root {
  --bg: #070B24;
  --bg-2: #0B1030;
  --surface: #0F1537;
  --surface-2: #151C45;
  --surface-3: #1C2455;
  --line: rgba(160, 175, 255, 0.10);
  --line-2: rgba(160, 175, 255, 0.18);
  --text: #EEF0FF;
  --text-2: #C4C9EA;
  --muted: #8E96C2;
  --red: #FF5C5C;
  --blue: #3D7BFF;
  --indigo: #4F5BD5;
  --violet: #A06CFF;
  --green: #2ECC8F;
  --amber: #FFB547;
  --pink: #E86BD8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: #9DB8FF; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; color: var(--text-2); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.pad { padding: 14px 18px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Botones e inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); border-color: rgba(160, 175, 255, .3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--blue), var(--indigo)); border-color: transparent; box-shadow: 0 6px 18px rgba(61, 123, 255, .3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red); border-color: transparent; color: #fff; }
.btn.danger.ghost { background: transparent; color: #FF8A8A; border-color: rgba(255, 92, 92, .35); }
.btn.danger.ghost:hover { background: rgba(255, 92, 92, .1); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; height: 42px; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.wa { background: rgba(46, 204, 143, .12); border-color: rgba(46, 204, 143, .35); color: #7FE8BF; }
.btn.wa:hover { background: rgba(46, 204, 143, .2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link { font-size: 12.5px; font-weight: 600; }

.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  font: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 90px; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(61, 123, 255, .2); }
.input::placeholder { color: #5E6693; }
input[type="datetime-local"].input, input[type="date"].input, input[type="time"].input { color-scheme: dark; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 42px; }
.in-input { position: absolute; right: 3px; top: 2px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); }
.form-error { background: rgba(255, 92, 92, .12); border: 1px solid rgba(255, 92, 92, .35); color: #FFB3B3; padding: 9px 12px; border-radius: 10px; font-size: 13px; }
.notice { background: rgba(61, 123, 255, .12); border: 1px solid rgba(61, 123, 255, .3); color: #BFD0FF; padding: 9px 12px; border-radius: 10px; font-size: 13px; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap .icon { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 34px; width: 260px; }

/* ---------- Pantallas de acceso ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; position: relative; overflow: hidden; }
.auth-glow { position: absolute; inset: -20%; background:
  radial-gradient(40% 35% at 20% 20%, rgba(79, 91, 213, .35), transparent 70%),
  radial-gradient(35% 30% at 85% 80%, rgba(255, 92, 92, .22), transparent 70%),
  radial-gradient(30% 30% at 70% 15%, rgba(61, 123, 255, .18), transparent 70%);
  filter: blur(10px); pointer-events: none; }
.auth-card {
  position: relative; width: 100%; max-width: 410px; padding: 32px 28px;
  background: rgba(15, 21, 55, .82); backdrop-filter: blur(18px);
  border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: 12px;
}
.auth-card h1 { font-size: 22px; margin-top: 10px; }
.auth-card form { margin-top: 8px; }
.auth-foot { position: relative; margin-top: 18px; display: flex; align-items: center; gap: 4px; }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.meter-wrap { display: flex; align-items: center; gap: 10px; }
.meter { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 99px; transition: width .2s, background .2s; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand b { background: linear-gradient(90deg, #8FA3FF, var(--red)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--indigo), var(--red)); box-shadow: 0 6px 16px rgba(255, 92, 92, .25); }
.brand.big { font-size: 22px; }
.brand.big .brand-mark { width: 42px; height: 42px; border-radius: 13px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 12px; background: linear-gradient(180deg, #0B1030, #080C28); border-right: 1px solid var(--line);
}
.sidebar > .brand { padding: 4px 10px 18px; }
.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #5E6693; padding: 16px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; text-decoration: none !important; position: relative; }
.nav-item:hover { background: rgba(160, 175, 255, .07); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(61, 123, 255, .22), rgba(79, 91, 213, .08)); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.nav-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-alert { flex: none !important; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(255, 92, 92, .2); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--line); margin-top: 10px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me .small { display: flex; align-items: center; gap: 3px; color: var(--green); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, var(--blue), var(--violet)); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.main { flex: 1; padding: 28px 32px 60px; max-width: 1500px; width: 100%; outline: none; }
.scrim { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin-top: 4px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; }
.card-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(61, 123, 255, .14); color: #9DB8FF; flex: none; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.stack-cards { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.note { padding: 0 18px 14px; display: flex; align-items: center; gap: 4px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpi { position: relative; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--k, var(--blue)); opacity: .10; filter: blur(4px); }
.kpi-blue { --k: var(--blue); } .kpi-violet { --k: var(--violet); } .kpi-green { --k: var(--green); } .kpi-red { --k: var(--red); } .kpi-amber { --k: var(--amber); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.kpi-top .icon { color: var(--k); }
.kpi-label { font-size: 12.5px; font-weight: 600; }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-extra { font-size: 12px; color: var(--text-2); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.kpi-extra b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }

/* Embudo */
.funnel { padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.funnel-row { display: grid; grid-template-columns: 190px 1fr 44px 130px 86px; align-items: center; gap: 12px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; color: var(--text); text-decoration: none !important; }
.funnel-row:hover { background: var(--surface-2); }
.funnel-row.zero { color: var(--muted); }
.funnel-label { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.funnel-track { height: 12px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 0 4px 4px 0; background: linear-gradient(90deg, #3D7BFF, #6E8DFF); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.funnel-fill.other { background: #5A628F; }
.funnel-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Barras por día */
.chart-tip { position: absolute; bottom: calc(100% + 6px); background: #fff; color: #0B1030; font-size: 12px; padding: 5px 9px; border-radius: 8px; white-space: nowrap; box-shadow: var(--shadow); pointer-events: none; z-index: 2; }

/* Canales */
.canal-list { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.canal-row { display: grid; grid-template-columns: 110px 1fr 30px 40px; align-items: center; gap: 10px; }
.canal-bar { height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.canal-bar span { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; }
.canal-row b { text-align: right; font-variant-numeric: tabular-nums; }

/* Listas */
.list { list-style: none; margin: 0; padding: 0 8px 10px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px; cursor: pointer; }
.list-item:hover { background: var(--surface-2); }
.list-item.static { cursor: default; }
.list-item.static:hover { background: transparent; }
.list-item .icon { color: var(--muted); }
.list-item .strong { display: flex; align-items: center; gap: 8px; }
.when { display: flex; flex-direction: column; min-width: 64px; }
.when b { font-size: 16px; font-variant-numeric: tabular-nums; }
.days-badge { font-size: 12px; font-weight: 700; color: #FF8A8A; background: rgba(255, 92, 92, .12); padding: 2px 8px; border-radius: 99px; }

/* Chips */
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip-green { background: rgba(46, 204, 143, .14); color: #7FE8BF; }
.chip-red { background: rgba(255, 92, 92, .14); color: #FF9E9E; }
.chip-amber { background: rgba(255, 181, 71, .14); color: #FFCF85; }
.chip-blue { background: rgba(61, 123, 255, .16); color: #A9C2FF; }
.chip-violet { background: rgba(160, 108, 255, .16); color: #CDB0FF; }
.chip-pink { background: rgba(232, 107, 216, .15); color: #F5B0EC; }
.chip-stage { --c: #6B7394; background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 55%, white); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.canal { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.canal.wa { color: #7FE8BF; }
.canal.ig { color: #F5B0EC; }
.bool { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; }
.bool.yes { color: #7FE8BF; }
.bool.no { color: var(--muted); }
.bool.warn { color: #FFCF85; }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; min-height: 60vh; scroll-snap-type: x proximity; }
.kcol { --c: var(--blue); flex: 0 0 280px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 190px); scroll-snap-align: start; transition: border-color .15s, background .15s; }
.kcol.over { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--bg-2)); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
.kcol-head::before { content: ""; position: absolute; top: -1px; left: 14px; right: 14px; height: 2px; background: var(--c); border-radius: 0 0 2px 2px; }
.kcol-title { flex: 1; font-weight: 700; font-size: 13px; }
.kcol-count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 1px 8px; border-radius: 99px; }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; }
.kcol-empty { border: 1px dashed var(--line-2); border-radius: 10px; padding: 18px; text-align: center; color: #5E6693; font-size: 12px; }
.board.is-dragging .kcol-empty { border-color: var(--c); color: var(--text-2); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; cursor: grab; display: flex; flex-direction: column; gap: 6px; transition: transform .12s, border-color .12s, box-shadow .12s; }
.kcard:hover { border-color: var(--line-2); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.kcard.dragging { opacity: .45; }
.kcard.stale { border-left: 3px solid var(--red); }
.kcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.kcard-top strong { font-size: 13.5px; line-height: 1.3; }
.kcard-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.kcard-meta span { font-size: 11px; color: var(--text-2); background: var(--surface-2); padding: 1px 7px; border-radius: 6px; }
.kcard-notes { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kcard-foot { display: flex; justify-content: space-between; align-items: center; }
.kcard-foot .small { display: inline-flex; align-items: center; gap: 3px; }
.stale-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: #FF9E9E; }

/* ---------- Reuniones ---------- */
.tabs { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); padding: 3px; border-radius: 11px; gap: 2px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 6px 13px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-3); color: var(--text); }
.tabs.small .tab { padding: 4px 10px; font-size: 12px; }
.callout { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 11px; background: rgba(255, 181, 71, .08); border: 1px solid rgba(255, 181, 71, .25); color: #FFD9A0; font-size: 13px; margin-bottom: 18px; }
.agenda { display: flex; flex-direction: column; gap: 22px; }
.day { display: flex; flex-direction: column; gap: 8px; }
.day-head { font-size: 14px; padding-left: 2px; }
.day-head::first-letter { text-transform: uppercase; }
.day-head.today { color: #9DB8FF; }
.meeting { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .12s, background .12s; }
.meeting:hover { border-color: var(--line-2); background: var(--surface-2); }
.meeting.cancelled { opacity: .55; }
.meeting.cancelled .meeting-title strong { text-decoration: line-through; }
.meeting-time { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding-right: 12px; }
.meeting-time b { font-size: 18px; font-variant-numeric: tabular-nums; }
.meeting-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meeting-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.rem { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; color: #5E6693; font-weight: 600; }
.rem.on { color: #7FE8BF; }
.wa-link { color: #7FE8BF; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--text); background: var(--surface-2); }
.seg-btn.on.green { background: rgba(46, 204, 143, .18); color: #7FE8BF; }
.seg-btn.on.red { background: rgba(255, 92, 92, .18); color: #FF9E9E; }
.seg-btn.on.amber { background: rgba(255, 181, 71, .18); color: #FFCF85; }

/* ---------- Tabla genérica ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 220px); transition: opacity .15s; }
.table-wrap.loading { opacity: .55; pointer-events: none; }
.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; border-bottom: 1px solid var(--line-2); padding: 0; white-space: nowrap; }
.th-btn { all: unset; box-sizing: border-box; display: flex; gap: 6px; align-items: center; width: 100%; padding: 10px 14px; cursor: pointer; color: var(--text-2); font-size: 12.5px; }
.th-btn:hover { color: var(--text); }
.th-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.sorted .th-btn { color: #fff; }
.sort-ind { color: var(--blue); font-weight: 800; }
.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; max-width: 340px; }
.grid tbody tr { cursor: pointer; transition: background .1s; }
.grid tbody tr:hover { background: rgba(61, 123, 255, .07); }
.grid tbody tr:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.grid td.pk { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.num { font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }

/* ---------- Drawer / formulario ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(3, 5, 20, 0); transition: background .2s; }
.drawer-backdrop.open { background: rgba(3, 5, 20, .55); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg-2); border-left: 1px solid var(--line-2); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); box-shadow: -20px 0 60px rgba(0, 0, 0, .4); }
.drawer-backdrop.open .drawer { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.drawer-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drawer-head h2 { font-size: 19px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; }
.record { display: flex; flex-direction: column; gap: 18px; }
.summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.summary-item { display: flex; flex-direction: column; }
.summary .btn { margin-left: auto; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field-control { display: flex; gap: 8px; align-items: center; }
.hint { display: flex; gap: 5px; align-items: flex-start; font-size: 11.5px; color: #FFCF85; line-height: 1.4; }
.hint .icon { margin-top: 2px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; height: 38px; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 40px; height: 22px; background: var(--surface-3); border-radius: 99px; position: relative; transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch-input:checked + .switch-track { background: var(--green); }
.switch-input:checked + .switch-track::after { transform: translateX(18px); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--blue); outline-offset: 2px; }
.toggle-group { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); padding: 6px 12px; border-radius: 99px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.toggle.on { background: rgba(61, 123, 255, .2); border-color: var(--blue); color: #fff; }
.record-actions { position: sticky; bottom: -28px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 0 4px; margin-top: 18px; background: linear-gradient(180deg, transparent, var(--bg-2) 30%); }
.sys { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-top: 16px; }
.sys summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.sys-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 4px; font-size: 12.5px; }
.sys-list dt { color: var(--muted); }
.sys-list dd { margin: 0; word-break: break-all; }
.related { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.related-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.related-list li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.related-list li:hover { background: var(--surface-2); }

/* ---------- Modal ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 20, .65); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: pop .18s cubic-bezier(.2, .8, .2, 1); max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { width: min(620px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.modal-body { padding: 4px 18px 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }

/* ---------- Ajustes ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-card > :not(.card-head) { margin: 0 18px 18px; }
.settings-card .card-head { align-items: flex-start; }
.settings-card form .input { flex: 1; min-width: 200px; }
.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 900px; overflow-y: auto; }
.audit-item { display: flex; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.audit-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; flex: none; background: var(--surface-2); color: var(--muted); }
.tone-green .audit-icon { background: rgba(46, 204, 143, .14); color: #7FE8BF; }
.tone-red .audit-icon { background: rgba(255, 92, 92, .14); color: #FF9E9E; }
.tone-amber .audit-icon { background: rgba(255, 181, 71, .14); color: #FFCF85; }
.tone-blue .audit-icon { background: rgba(61, 123, 255, .16); color: #A9C2FF; }
.changes { margin: 6px 0 0; padding: 8px 10px; list-style: none; background: var(--bg-2); border-radius: 8px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; word-break: break-word; }
.changes .old { color: #FF9E9E; text-decoration: line-through; }
.changes .new { color: #7FE8BF; }
.snapshot { margin-top: 6px; font-size: 12px; }
.snapshot summary { cursor: pointer; color: var(--muted); }
.snapshot pre { background: var(--bg-2); padding: 10px; border-radius: 8px; overflow: auto; max-height: 260px; font-size: 11.5px; }

/* ---------- Estados ---------- */
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--blue); animation: spin .7s linear infinite; margin: 30px auto; }
.spinner.page { margin: 20vh auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--text); }
.empty.error .icon { color: var(--red); }
.empty .btn { margin-top: 8px; }

/* Toasts */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 15px; border-radius: 12px; background: #F4F6FF; color: #0B1030; font-weight: 600; font-size: 13px; box-shadow: var(--shadow); animation: pop .2s; max-width: 380px; transition: opacity .4s, transform .4s; }
.toast-ok .icon { color: #16A36B; }
.toast-error { background: #FFE9E9; color: #7A1010; }
.toast-error .icon { color: #E03A3A; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Responsive ---------- */
@media (max-width: 1250px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 30; left: 0; transform: translateX(-100%); transition: transform .2s; }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(3, 5, 20, .6); }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; background: rgba(7, 11, 36, .92); backdrop-filter: blur(10px); }
  .main { padding: 18px 16px 50px; }
  h1 { font-size: 22px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 26px; }
  .search-wrap, .search-wrap .input { width: 100%; }
  .head-actions { width: 100%; }
  .fields { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 130px 1fr 28px; }
  .meeting { grid-template-columns: 60px 1fr; }
  .meeting .seg { grid-column: 1 / -1; justify-self: start; }
  .kcol { flex-basis: 84vw; }
  #toasts { left: 16px; right: 16px; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Análisis con IA ---------- */
.ai-card { background: linear-gradient(180deg, rgba(79, 91, 213, .10), rgba(15, 21, 55, .6)); border: 1px solid rgba(124, 140, 255, .25); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; transition: opacity .2s; }
.ai-card.busy { opacity: .6; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-head h4 { display: flex; align-items: center; gap: 4px; color: #BFC8FF; }
.ai-overview { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px; }
.ai-score, .ai-kpi { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 10px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.ai-score b { font-size: 30px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.ai-kpi b { font-size: 22px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.ai-score span, .ai-kpi > span:last-child { font-size: 11px; color: var(--muted); }
.ai-kpi .chip { align-self: flex-start; font-size: 13px; }
.score-hot b { color: #7FE8BF; } .score-warm b { color: #FFCF85; } .score-cold b { color: #FF9E9E; }
.temp-hot { background: rgba(46, 204, 143, .16); color: #7FE8BF; }
.temp-warm { background: rgba(255, 181, 71, .16); color: #FFCF85; }
.temp-cold { background: rgba(255, 92, 92, .14); color: #FF9E9E; }
.ai-diag { font-weight: 600; color: var(--text); }
.metrics { display: flex; flex-direction: column; gap: 9px; }
.metric-top { display: flex; justify-content: space-between; font-size: 12.5px; }
.metric-label { color: var(--text-2); font-weight: 600; }
.metric-val { font-variant-numeric: tabular-nums; }
.metric-track { height: 7px; margin-top: 4px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.metric-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.metric-fill.tone-hot { background: var(--green); } .metric-fill.tone-warm { background: var(--amber); } .metric-fill.tone-cold { background: var(--red); }
.metric-note { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ai-block h5, .ai-msg h5 { margin: 0 0 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.ai-block p { color: var(--text-2); }
.ai-block ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; color: var(--text-2); font-size: 13px; }
.ai-block.warn li::marker { color: var(--amber); }
.ai-block.ask li::marker { color: var(--blue); }
.ai-block.tips li::marker { color: var(--green); }
.ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-next { display: flex; gap: 6px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: rgba(61, 123, 255, .10); border: 1px solid rgba(61, 123, 255, .25); font-size: 13px; }
.ai-next .icon { margin-top: 2px; color: #9DB8FF; }
.ai-msg { padding: 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ai-msg p { white-space: pre-wrap; font-size: 13px; }
.ai-stale { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-radius: 9px; background: rgba(255, 181, 71, .1); color: #FFD9A0; font-size: 12.5px; }
.ai-foot { border-top: 1px solid var(--line); padding-top: 8px; }
.ai-chat summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.bubbles { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.bubble { max-width: 85%; padding: 7px 10px; border-radius: 12px; font-size: 13px; background: var(--surface-2); }
.bubble p { white-space: pre-wrap; word-break: break-word; }
.bubble .who { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.bubble.lead { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.bot, .bubble.abdiel { align-self: flex-end; border-bottom-right-radius: 4px; background: rgba(61, 123, 255, .16); }
.bubble.abdiel { background: rgba(46, 204, 143, .14); }
.bubble.desconocido { align-self: center; background: var(--bg-2); border: 1px dashed var(--line-2); }
.kcard-badges { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.score { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
.score-hot { background: rgba(46, 204, 143, .16); color: #7FE8BF; }
.score-warm { background: rgba(255, 181, 71, .16); color: #FFCF85; }
.score-cold { background: rgba(255, 92, 92, .14); color: #FF9E9E; }
@media (max-width: 860px) {
  .ai-overview { grid-template-columns: 1fr 1fr; }
  .ai-overview .ai-score { grid-column: 1 / -1; }
  .ai-cols { grid-template-columns: 1fr; }
}

/* ---------- Vista del lead en pestañas ---------- */
.drawer.wide { width: min(760px, 100%); }
.lead-view { display: flex; flex-direction: column; gap: 16px; }
.lead-tabs { align-self: flex-start; }
.lead-tabs .tab { display: inline-flex; align-items: center; gap: 4px; }
.lead-pane { display: flex; flex-direction: column; gap: 16px; }
.lead-section { margin-bottom: -6px; }
.lm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lm-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--line-2); }
.lm-tile.tone-good { border-top-color: var(--green); }
.lm-tile.tone-mid { border-top-color: var(--amber); }
.lm-tile.tone-bad { border-top-color: var(--red); }
.lm-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.lm-value { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lm-sub { font-size: 11.5px; color: var(--text-2); }
.lead-pane .ai-chat[open] summary { margin-bottom: 4px; }
.lead-pane .bubbles { max-height: none; }
@media (max-width: 860px) { .lm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Página completa del lead ---------- */
.lead-page { display: flex; flex-direction: column; gap: 18px; }
.lead-head { margin-bottom: 0; align-items: center; }
.lead-title { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.lead-title h1 { margin-right: 4px; }
.lead-title p { margin-top: 4px; }
.icon-btn.back { margin-top: 2px; border: 1px solid var(--line-2); }
.icon-btn.back .icon { transform: rotate(180deg); }
.lead-page .lead-view { gap: 18px; }
.lead-page .lm-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.lead-page .ai-card { padding: 18px 20px; }
.ai-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.ai-left, .ai-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lead-page .ai-split { grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr); gap: 24px; }
.lead-page .ai-left { padding-right: 24px; border-right: 1px solid var(--line); }
.lead-page .ai-chat .bubbles, .lead-page .lead-pane > .ai-chat .bubbles { max-width: 900px; }
.lead-page .record-form, .lead-page .related { max-width: 980px; }
.lead-page .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1250px) {
  .lead-page .lm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lead-page .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .lead-page .ai-split { grid-template-columns: minmax(0, 1fr); }
  .lead-page .ai-left { padding-right: 0; border-right: 0; }
}
@media (max-width: 860px) {
  .lead-page .lm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-page .fields { grid-template-columns: 1fr; }
}

/* ---------- Leads por secciones ---------- */
.canal-filter { width: auto; }
.leads-board { display: flex; flex-direction: column; gap: 16px; }
.leads-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.leads-stats { margin-top: -6px; }
.lk { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--line-2); color: var(--text); text-decoration: none !important; }
a.lk:hover { background: var(--surface-2); }
.lk-label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.lk b { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lk-hot { border-top-color: var(--green); } .lk-hot .icon { color: var(--green); }
.lk-warm { border-top-color: var(--amber); } .lk-warm .icon { color: var(--amber); }
.lk-cold { border-top-color: var(--red); } .lk-cold .icon { color: var(--red); }
.lk-won { border-top-color: var(--violet); } .lk-won .icon { color: var(--violet); }
.lk-avg, .lk-ai { border-top-color: var(--blue); }
.leads-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.leads-sec > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.leads-sec > summary::-webkit-details-marker { display: none; }
.leads-sec > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.leads-sec:not([open]) > summary::after { transform: rotate(-90deg); }
.sec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.sec-hot .sec-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(46, 204, 143, .15); }
.sec-warm .sec-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(255, 181, 71, .15); }
.sec-cold .sec-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 92, 92, .15); }
.sec-won .sec-dot { background: var(--violet); box-shadow: 0 0 0 4px rgba(160, 108, 255, .15); }
.sec-count { font-size: 12px; font-weight: 700; color: var(--text-2); background: var(--surface-3); padding: 1px 9px; border-radius: 99px; }
.lead-rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.lead-row { display: grid; grid-template-columns: 96px minmax(0, 1.4fr) minmax(0, 1.2fr) 170px 40px; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.lead-row:last-child { border-bottom: 0; }
.lead-row:hover { background: rgba(61, 123, 255, .06); }
.lead-row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.lr-prob { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 6px; }
.lr-prob b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.src { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; justify-self: start; }
.src-ia { color: #BFC8FF; }
.src-reglas { color: var(--muted); }
.prob-track { grid-column: 1 / -1; height: 5px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
.prob-fill { display: block; height: 100%; border-radius: 0 3px 3px 0; }
.prob-fill.tone-hot { background: var(--green); } .prob-fill.tone-warm { background: var(--amber); } .prob-fill.tone-cold { background: var(--red); }
.lr-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lr-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lr-meta { font-size: 12px; color: var(--text-2); }
.lr-diag { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-next { display: flex; flex-direction: column; font-size: 13px; min-width: 0; }
.lr-next-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.lr-side { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.lr-side .small { display: inline-flex; align-items: center; gap: 3px; }
.stale-text { color: #FF9E9E; }
.lr-wa { color: #7FE8BF; }
.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 1250px) {
  .leads-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lead-row { grid-template-columns: 90px minmax(0, 1fr) 150px 36px; row-gap: 6px; }
  .lr-prob { grid-row: span 2; }
  .lr-next { grid-column: 2 / 4; grid-row: 2; flex-direction: row; gap: 6px; align-items: baseline; }
}
@media (max-width: 860px) {
  .leads-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-row { grid-template-columns: 80px minmax(0, 1fr) 36px; gap: 6px 10px; padding: 12px 14px; }
  .lr-next { grid-column: 2 / 3; }
  .lr-side { display: none; }
  .canal-filter { width: 100%; }
}

/* Gráfica de leads nuevos por día (SVG) */
.trend { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 10px 18px 0; }
.trend-axis { display: flex; flex-direction: column; justify-content: space-between; height: 140px; font-size: 11px; color: var(--muted); text-align: right; line-height: 1; margin-top: -5px; margin-bottom: -5px; }
.trend-plot { position: relative; min-width: 0; }
.trend-svg { display: block; width: 100%; height: 140px; overflow: visible; }
.trend-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.trend-base { stroke: var(--line-2); stroke-width: 1; }
.trend-bar { fill: var(--blue); }
.trend-bar.today { fill: #6E8DFF; }
.trend-hit { fill: transparent; cursor: default; }
.trend-hit.on { fill: rgba(160, 175, 255, .08); }
.trend-foot { display: flex; justify-content: space-between; padding: 6px 18px 14px calc(18px + 22px); }

.lk-new { border-top-color: var(--blue); } .lk-new .icon { color: var(--blue); }
.lk-revive { border-top-color: var(--pink); } .lk-revive .icon { color: var(--pink); }
.sec-new .sec-dot { background: var(--blue); box-shadow: 0 0 0 4px rgba(61, 123, 255, .15); }
.sec-revive .sec-dot { background: var(--pink); box-shadow: 0 0 0 4px rgba(232, 107, 216, .15); }
.lr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.lr-reason { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.reason-hot { background: rgba(46, 204, 143, .14); color: #7FE8BF; }
.reason-new { background: rgba(61, 123, 255, .16); color: #A9C2FF; }
.reason-warm { background: rgba(255, 181, 71, .14); color: #FFCF85; }
.reason-revive { background: rgba(232, 107, 216, .15); color: #F5B0EC; }
.reason-cold { background: rgba(255, 92, 92, .12); color: #FF9E9E; }
.lr-prob.won { display: flex; align-items: center; gap: 6px; color: #CDB0FF; }

.funnel-pct { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.funnel-step { text-align: left; white-space: nowrap; }
.kcol-title { display: flex; flex-direction: column; line-height: 1.25; }
.kcol-reach { font-size: 11px; font-weight: 600; color: var(--muted); }
@media (max-width: 860px) { .funnel-row { grid-template-columns: 120px 1fr 40px; } .funnel-step { display: none; } }

/* ---------- Negocio ---------- */
.biz-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; align-items: start; }
.biz-grid > .biz-card:nth-child(-n+2) { grid-column: 1 / -1; }
.biz-card .card-head { align-items: flex-start; }
.pad-x { padding: 0 18px 16px; }
.biz-inner { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.biz-history { width: auto; align-self: flex-start; }
.biz-analysis { display: flex; flex-direction: column; gap: 16px; }
.biz-summary { font-size: 15px; line-height: 1.6; color: var(--text); }
.biz-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.biz-block h4 { margin-bottom: 8px; }
.biz-block ul, .biz-block ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.biz-block.good li::marker { color: var(--green); }
.biz-block.bad li::marker { color: var(--red); }
.biz-recs li p, .biz-ads li p { margin-top: 2px; }
.biz-ads { list-style: none; padding-left: 0 !important; }
.biz-ads li .chip { margin-right: 6px; }
.change-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.change-form input[type="text"], .change-form textarea { grid-column: 1 / -1; }
.change-form textarea { min-height: 60px; }
.change-form .btn { grid-column: 1 / -1; justify-self: start; }
.change-list { list-style: none; margin: 0; padding: 0 8px 12px; border-top: 1px solid var(--line); }
.change-item { display: flex; gap: 14px; align-items: flex-start; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.change-item:last-child { border-bottom: 0; }
.change-date { display: flex; flex-direction: column; min-width: 110px; }
.cmp-table th { white-space: pre-line; }
.cmp-table th, .cmp-table td { padding: 8px 12px; }
.cmp-table tbody tr { cursor: default; }
.cmp-ads { margin-top: 16px; }
.cmp-ads h4 { margin-bottom: 8px; }
.cmp .note { padding: 10px 0 0; }
.delta { font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.delta.good { color: #7FE8BF; }
.delta.bad { color: #FF9E9E; }
@media (max-width: 1250px) { .biz-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .biz-cols { grid-template-columns: 1fr; } .change-form { grid-template-columns: 1fr; } }

/* Acción recomendada, notas y reuniones del lead */
.ai-action { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); display: flex; flex-direction: column; gap: 4px; }
.ai-action-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ai-action-label { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
.ai-when { font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 99px; background: var(--surface-3); }
.ai-action p { font-size: 13px; color: var(--text-2); }
.act-hot { border-color: rgba(46, 204, 143, .4); } .act-hot .ai-action-label { color: #7FE8BF; }
.act-warm { border-color: rgba(255, 181, 71, .4); } .act-warm .ai-action-label { color: #FFCF85; }
.act-neutral .ai-action-label { color: #A9C2FF; }
.act-cold { border-color: rgba(255, 92, 92, .35); } .act-cold .ai-action-label { color: #FF9E9E; }
.lr-action { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.lr-action.act-hot { color: #7FE8BF; } .lr-action.act-warm { color: #FFCF85; } .lr-action.act-neutral { color: #A9C2FF; } .lr-action.act-cold { color: #FF9E9E; }
.ai-why p { font-size: 13px; }
.ai-flag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.ai-flag.outdated { background: rgba(255, 181, 71, .16); color: #FFCF85; }
.ai-flag.none { background: var(--surface-3); color: var(--text-2); }
.leads-stats { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ai-pending { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: rgba(255, 181, 71, .08); border: 1px solid rgba(255, 181, 71, .25); color: #FFD9A0; font-size: 13px; }
.meeting-links { gap: 8px; }
.notes-editor { display: flex; flex-direction: column; gap: 6px; }
.notes-editor .field-label { display: flex; align-items: center; gap: 3px; }
.notes-area { min-height: 70px; }
.notes-actions { justify-content: space-between; }
.lead-meetings { display: flex; flex-direction: column; gap: 10px; }
.lead-meeting { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.lead-meeting.upcoming { border-color: rgba(61, 123, 255, .35); }
.lead-meeting-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }

.money-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.money-cats { list-style: none; margin: 14px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.money-cats li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
@media (max-width: 1250px) { .money-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lead-btn-slot { display: none; }
.meeting-meta .btn.small { height: 24px; padding: 0 8px; font-size: 11.5px; }
.funnel-cost { text-align: right; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; color: #FFCF85; white-space: nowrap; }
.kcol-cost { font-size: 11px; font-weight: 700; color: #FFCF85; }
@media (max-width: 860px) { .funnel-cost { display: none; } }

/* ---------- Datos guardados ---------- */
.storage { display: flex; flex-direction: column; gap: 16px; }
.storage-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.storage-files td { vertical-align: top; }
.storage-files tbody tr { cursor: default; }
.storage-files code { margin-right: 6px; }
.months { display: flex; flex-direction: column; gap: 12px; padding: 0 18px 18px; }
.month { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg-2); }
.month-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.month-head h3 { font-size: 15px; }
.month-list { display: grid; grid-template-columns: 1fr auto; gap: 5px 16px; margin: 0; font-size: 13px; }
.month-list dt { color: var(--text-2); }
.month-list dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.month-list .strong { color: var(--text); font-weight: 700; border-top: 1px solid var(--line); padding-top: 5px; }
@media (max-width: 1100px) { .storage-grid { grid-template-columns: minmax(0, 1fr); } }

/* Anuncio de origen */
.lead-ad a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.lead-ad { display: flex; align-items: center; gap: 2px; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.lead-ad b { color: var(--text); font-weight: 600; }
.ad-link { display: flex; align-items: center; gap: 6px; }
.ad-link select { max-width: 220px; height: 32px; font-size: 13px; }
.ad-sources td { vertical-align: middle; }
.ad-sources tr.muted b { font-weight: 500; }
.card-head .tabs { flex-shrink: 0; white-space: nowrap; }

/* Página de anuncios */
.ads-page { display: flex; flex-direction: column; gap: 16px; }
.ads-section { margin: 8px 0 -4px; }
.ad-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 28px; padding: 0 18px 8px; }
.ad-chart h4 { margin-bottom: 8px; }
.ad-bars, .ad-funnel { display: flex; flex-direction: column; gap: 6px; }
.ad-bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; min-height: 22px; }
.ad-funnel .ad-bar-row { grid-template-columns: minmax(110px, 30%) 1fr 74px 96px; }
.ad-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ad-bar-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.ad-bar { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }
.ad-bar.best { background: var(--green); }
.ad-bar-value { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ad-bar-cost { text-align: right; white-space: nowrap; }
.ad-table td { vertical-align: top; }
.ad-card .card-head h2 { font-size: 17px; }
.ad-card.organic { border-style: dashed; }
.ad-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.ad-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ad-kpis .lk b { font-size: 22px; }
.ad-cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.ad-col h4 { margin-bottom: 10px; }
.ad-list { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.ad-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; }
.ad-meta dt { font-size: 11.5px; color: var(--muted); }
.ad-meta dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ad-leads summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.ad-leads-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ad-lead { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none !important; flex-wrap: wrap; }
.ad-lead:hover { background: var(--surface-2); }
.ad-verdicts { display: flex; flex-direction: column; gap: 12px; }
.ad-verdict { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 760px) {
  .ad-cols { grid-template-columns: 1fr; }
  .ad-funnel .ad-bar-row { grid-template-columns: 96px 1fr 64px; }
  .ad-funnel .ad-bar-cost { display: none; }
}

/* Gasto en IA */
.usage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.usage-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--surface-2); border-radius: 10px; }
.usage-stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.usage-kinds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.usage-kinds li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.usage-kinds li b { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.usage-recent summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.usage-months td.num, .usage-months th { font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .usage-grid { grid-template-columns: 1fr; } .usage-kinds li { grid-template-columns: 1fr auto; } .usage-kinds li > span:nth-child(2) { grid-column: 1 / -1; order: 3; } }
/* Gráficas por anuncio: el nombre completo va arriba de la barra, nunca recortado. */
.ad-bars .ad-bar-row { grid-template-columns: 1fr auto; row-gap: 4px; padding: 2px 0 4px; }
.ad-bars .ad-bar-label { grid-column: 1 / -1; white-space: normal; overflow: visible; color: var(--text); line-height: 1.35; }
.ad-funnel .ad-bar-label { white-space: normal; line-height: 1.25; }

/* Comparación: controles de modo */
.cmp-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 18px 12px; }
.cmp-controls select { width: auto; max-width: 100%; }
.cmp-same { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
#cmp .card-head { flex-wrap: wrap; gap: 10px; }
.chat-actions { justify-content: flex-end; margin-bottom: 8px; }

/* Costo del bot */
.bot-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.bot-group { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--line-2); }
.bot-group.good { border-left-color: var(--green); }
.bot-group.bad { border-left-color: var(--red); }
.bot-big { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bot-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-bottom: 10px; }
.bot-cols h4 { margin-bottom: 6px; }
.bot-cols .money-cats a { color: inherit; text-decoration: none; }
.bot-cols .money-cats a:hover span:first-child { text-decoration: underline; }
@media (max-width: 760px) { .bot-compare, .bot-cols { grid-template-columns: 1fr; } }

/* ---------- Demo de llamada ---------- */
.ll-acceso { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.ll-clave { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: .14em; color: #fff; line-height: 1.1; word-break: break-all; }
.ll-clave.off { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.ll-propia { max-width: 460px; margin-top: 6px; }
.ll-propia .input { flex: 1; min-width: 0; }
.ll-tabla th { padding: 10px 14px; }
.ll-tabla tbody tr { cursor: default; }

/* ---------- Ficha de instalación: vista de respuestas ---------- */
.fv { display: grid; gap: 14px; }

.fv-head {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 12px;
}
.fv-head-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fv-barra { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.fv-barra > i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--indigo));
}
.fv-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.fv-stat {
  display: flex; gap: 7px; align-items: baseline;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 13px;
}
.fv-stat > b { font-size: 15px; font-variant-numeric: tabular-nums; }
.fv-stat > span { font-size: 12px; color: var(--muted); }
.fv-stat.bien > b { color: var(--green); }
.fv-stat.mal > b { color: var(--red); }
.fv-cuando { font-size: 12.5px; color: var(--muted); }

.fv-sec {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.fv-sec-head {
  display: flex; gap: 10px; align-items: center;
  padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.fv-sec-head > b { font-size: 15px; }
.fv-num {
  font-family: var(--mono); font-size: 11px; color: var(--blue);
  background: rgba(61, 123, 255, 0.12); border: 1px solid rgba(61, 123, 255, 0.3);
  border-radius: 7px; padding: 3px 7px; display: inline-flex; align-items: center; gap: 4px;
}

.fv-q { padding: 12px 0; border-top: 1px solid var(--line); }
.fv-q:first-of-type { border-top: 0; }
.fv-etq { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.fv-cod { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-right: 8px; }
.fv-val { white-space: pre-wrap; font-weight: 500; }
.fv-na { font-size: 13px; color: var(--muted); font-style: italic; }
.fv-na.pend { color: var(--red); font-style: normal; }

.fv-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.fv-scroll { overflow-x: auto; }
.fv-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.fv-tabla th {
  text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 0 12px 6px 0; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.fv-tabla td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.fv-tabla tr:last-child td { border-bottom: 0; }

.fv-dias { display: grid; gap: 4px; max-width: 360px; }
.fv-dia { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.fv-dia > span { color: var(--muted); }
.fv-dia.cerrado > b { color: var(--muted); font-weight: 400; }

.fv-files { display: grid; gap: 6px; }
.fv-file {
  display: flex; gap: 10px; align-items: center; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px;
}
.fv-file:hover { border-color: var(--line-2); text-decoration: none; background: var(--surface-3); }
.fv-file > span:nth-child(3) { margin-left: auto; white-space: nowrap; }

.fv-ent { display: grid; gap: 2px; }
.fv-ent-row { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.fv-ent-row:first-child { border-top: 0; }
.fv-caja {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px;
  border: 1.5px solid var(--line-2); border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.fv-ent-row.listo .fv-caja { background: var(--blue); border-color: var(--blue); }
.fv-ent-row.listo > div > div:first-child { color: var(--text); }
.fv-ent-row:not(.listo) > div > div:first-child { color: var(--text-2); }

/* ---------- Respuestas de una ficha (página completa) ---------- */
.fp { display: flex; flex-direction: column; gap: 16px; }
.fp-head .head-actions { align-items: center; }
.fp-summary { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr) 1.3fr; gap: 12px; }
.fp-kpi { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; text-align: left; font: inherit; color: var(--text); border: 1px solid var(--line); }
button.fp-kpi { cursor: pointer; transition: border-color .15s, background .15s; }
button.fp-kpi:hover { border-color: var(--line-2); background: var(--surface-2); }
.fp-kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.fp-kpi-num { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fp-kpi.mal .fp-kpi-num { color: var(--red); }
.fp-kpi.bien .fp-kpi-num { color: var(--green); }
.fp-kpi-prog { flex-direction: row; align-items: center; gap: 14px; }
.fp-kpi-prog > div { display: flex; flex-direction: column; gap: 2px; }
.fp-kpi-prog .fp-kpi-num { font-size: 20px; }
.fp-kpi-act > span:nth-child(2) { font-weight: 600; }
.fp-ring-box { position: relative; width: 64px; height: 64px; flex: none; }
.fp-ring { width: 64px; height: 64px; }
.fp-ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.fp-ring-fg { fill: none; stroke: var(--blue); stroke-width: 7; stroke-linecap: round; }
.fp-ring-box > b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-variant-numeric: tabular-nums; }

.fp-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.fp-aside { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 40px); overflow-y: auto; }
.fp-filtro { display: flex; flex-wrap: wrap; }
.fp-filtro .tab { flex: 1 1 auto; }
.fp-index { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.fp-idx { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.fp-idx:hover { background: var(--surface-2); color: var(--text); }
.fp-idx-n { flex: none; width: 24px; height: 20px; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 6px; }
.fp-idx-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-idx-c { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fp-idx-c.ok { color: var(--green); }
.fp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex: none; }

.fp-content { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fp-sec { padding: 16px 18px 6px; scroll-margin-top: 12px; }
.fp-sec.star { border-color: rgba(61, 123, 255, .35); }
.fp-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.fp-sec-head h2 { font-size: 16px; margin: 0; flex: 1; }
.fp-num { flex: none; min-width: 30px; height: 24px; padding: 0 6px; display: grid; place-items: center; font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--blue); background: rgba(61, 123, 255, .12); border-radius: 7px; }
.fp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; column-gap: 28px; }
.fp-q { padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; scroll-margin-top: 12px; }
.fp-q.ancha { grid-column: 1 / -1; }
.fp-etq { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; line-height: 1.4; }
.fp-cod { font-family: var(--mono); font-size: 10.5px; color: var(--muted); opacity: .7; white-space: nowrap; }
.fp-val { white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.fp-na { font-size: 13px; color: var(--muted); font-style: italic; }
.fp-q.falta { background: linear-gradient(90deg, rgba(255, 92, 92, .08), transparent 70%); padding-left: 12px; box-shadow: inset 2px 0 var(--red); }
.fp-q.falta .fp-na { color: #FF8A8A; font-style: normal; font-weight: 600; }
.fp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.fp-scroll { overflow-x: auto; }
.fp-tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fp-tabla th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.fp-tabla td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.fp-tabla tr:last-child td { border-bottom: 0; }
.fp-dias { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.fp-dia { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); font-size: 13px; }
.fp-dia > span { font-size: 11.5px; color: var(--muted); }
.fp-dia.cerrado > b { color: var(--muted); font-weight: 500; }
.fp-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.fp-file { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none !important; min-width: 0; }
.fp-file:hover { border-color: var(--line-2); background: var(--surface-3); }
.fp-thumb { flex: none; width: 56px; height: 56px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.fp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fp-file-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fp-file-txt b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-gallery .fp-thumb { width: 72px; height: 72px; }
.fp-gallery { padding-bottom: 12px; }
.fp-meta-list { display: flex; flex-direction: column; padding-bottom: 8px; }
.fp-meta-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.fp-meta-row:first-child { border-top: 0; }
.fp-meta-row .chip { flex: none; min-width: 58px; justify-content: center; }
.fp-ent { display: flex; flex-direction: column; padding-bottom: 8px; }
.fp-ent-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.fp-ent-row:first-child { border-top: 0; }
.fp-ent-row:not(.listo) b { color: var(--text-2); font-weight: 600; }
.fp-ent-meta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fp-caja { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: #fff; }
.fp-ent-row.listo .fp-caja { background: var(--green); border-color: var(--green); }

@media (max-width: 1180px) {
  .fp-summary { grid-template-columns: repeat(3, 1fr); }
  .fp-kpi-prog, .fp-kpi-act { grid-column: span 3; }
}
@media (max-width: 900px) {
  .fp-layout { grid-template-columns: 1fr; }
  .fp-aside { position: static; max-height: none; }
  .fp-index { flex-direction: row; overflow-x: auto; }
  .fp-idx { width: auto; flex: none; }
  .fp-idx-t { max-width: 140px; }
  .fp-grid { grid-template-columns: 1fr; }
  .fp-summary { grid-template-columns: 1fr 1fr; }
  .fp-kpi-prog, .fp-kpi-act { grid-column: span 2; }
}

/* Visor de imágenes de las fichas */
.fp-file.es-imagen { cursor: zoom-in; }
.fp-lb { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: rgba(3, 5, 20, .92); animation: fade .15s; }
.fp-lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fp-lb-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fp-lb-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.fp-lb-img { max-width: calc(100% - 120px); max-height: 100%; object-fit: contain; border-radius: 8px; background: repeating-conic-gradient(#ffffff10 0 25%, transparent 0 50%) 50% / 20px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.fp-lb-nav { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.fp-lb-nav:hover { background: var(--surface-2); }
.fp-lb-nav.prev svg { transform: rotate(180deg); }
@media (max-width: 600px) {
  .fp-lb-img { max-width: 100%; }
  .fp-lb-stage { position: relative; padding: 8px; }
  .fp-lb-nav { position: absolute; bottom: 16px; }
  .fp-lb-nav.prev { left: 16px; }
  .fp-lb-nav.next { right: 16px; }
}

/* ---------- Clientes de Oprisia ---------- */
.cl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.cl-card { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; color: var(--text); text-decoration: none !important; transition: border-color .15s, background .15s; }
.cl-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.cl-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cl-card-head h2 { font-size: 17px; margin: 0 0 2px; }
.cl-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cl-mini > div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.cl-mini span { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cl-mini b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cl-mini b.warn { color: var(--amber); }
.cl-mini small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.cl-card-foot { border-top: 1px solid var(--line); padding-top: 10px; }

.cl-detail { display: flex; flex-direction: column; gap: 14px; }
.cl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cl-sec { padding: 16px 18px; }
.cl-sec h3 { display: flex; align-items: center; gap: 4px; margin: 0 0 10px; font-size: 15px; }
.cl-stats { margin: 0; display: flex; flex-direction: column; }
.cl-stats > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.cl-stats > div:first-child { border-top: 0; }
.cl-stats dt { color: var(--text-2); }
.cl-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cl-stats dd.good { color: var(--green); }
.cl-stats dd.warn { color: var(--amber); }

.cl-chart { display: flex; flex-direction: column; gap: 8px; }
.cl-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.cl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cl-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cl-legend i.wa, .cl-bar-stack .wa { background: var(--blue); }
.cl-legend i.ll, .cl-bar-stack .ll { background: var(--violet); }
.cl-bars { display: grid; gap: 3px; align-items: end; height: 170px; }
.cl-bar { display: flex; flex-direction: column; height: 100%; min-width: 0; }
.cl-bar-stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.cl-bar-stack span { display: block; border-radius: 3px 3px 0 0; min-height: 0; }
.cl-bar-stack span + span { border-radius: 0; }
.cl-bar:hover .cl-bar-stack span { filter: brightness(1.25); }
.cl-bar-x { height: 16px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: visible; }

.cl-rank { display: flex; flex-direction: column; gap: 8px; }
.cl-rank-row { display: grid; grid-template-columns: minmax(100px, 40%) 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.cl-rank-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.cl-rank-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.cl-rank-track i { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }
.cl-rank-row b { text-align: right; font-variant-numeric: tabular-nums; }
.cl-table td { vertical-align: top; }
.cl-table .nowrap { white-space: nowrap; }
.cl-table .mono { font-family: var(--mono); font-size: 12px; }

@media (max-width: 900px) {
  .cl-cols { grid-template-columns: 1fr; }
  .cl-list { grid-template-columns: 1fr; }
  .cl-mini { grid-template-columns: repeat(2, 1fr); }
}

/* Clientes: consumo del plan, extensiones y avisos */
.cl-cons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.cl-cons-grid > .muted { grid-column: 1 / -1; margin-bottom: -4px; }
.cl-cons { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cl-cons.empty { opacity: .6; }
.cl-cons-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.cl-cons-pct { font-weight: 800; font-variant-numeric: tabular-nums; }
.cl-cons-pct.green { color: var(--green); }
.cl-cons-pct.amber { color: var(--amber); }
.cl-cons-pct.red { color: var(--red); }
.cl-cons-track { position: relative; height: 9px; border-radius: 5px; background: var(--surface-3); }
.cl-cons-track > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.cl-cons-track > i.green { background: var(--green); }
.cl-cons-track > i.amber { background: var(--amber); }
.cl-cons-track > i.red { background: var(--red); }
.cl-cons-track > em { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; opacity: .8; }
.cl-cons-sub { line-height: 1.4; }
.cl-cons-alert { font-size: 12px; font-weight: 600; color: #FF8A8A; }
.cl-cons-alert.amber { color: var(--amber); }
.cl-plan-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cl-plan-head h3 { margin: 0; text-transform: none; }
.cl-plan .cl-cons-grid.wide { gap: 14px 28px; margin-bottom: 10px; }
.cl-ext { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.cl-ext-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; }
.cl-avisos { margin-top: 10px; }
.cl-avisos summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.cl-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cl-form-sub { margin: 6px 0 -4px; }
.cl-check { gap: 8px; font-size: 13.5px; cursor: pointer; }
.btn.warn-dot { position: relative; }
.btn.warn-dot::after { content: ''; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
@media (max-width: 600px) { .cl-cons-grid, .cl-form-row { grid-template-columns: 1fr; } }

.cl-vig { display: flex; flex-direction: column; gap: 6px; }
.cl-vig-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.cl-vig-opt:has(input:checked) { border-color: var(--blue); background: rgba(61, 123, 255, .08); }
.cl-vig-opt input { margin-top: 3px; }
.cl-vig-opt span { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }

/* Portal del cliente (administración desde el panel) */
.pa-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin: 6px 0 16px; }
.pa-sub { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 8px; }
h4.pa-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pa-sub h4 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pa-users { display: flex; flex-direction: column; }
.pa-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.pa-user:first-child { border-top: 0; }
.pa-checks { display: flex; flex-direction: column; gap: 8px; }
.pa-tablas .pa-base { width: auto; min-width: 240px; }
.pa-tlist { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pa-tabla { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.pa-tabla.on, .pa-tabla:has(> label input:checked) { border-color: rgba(61, 123, 255, .45); background: rgba(61, 123, 255, .05); }
.pa-tdet { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.pa-tdet .input.small { width: auto; min-width: 180px; height: 32px; font-size: 13px; }
.pa-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; }
.pa-campo { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; min-width: 0; }
.pa-campo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pa-temp { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.pa-temp code { font-size: 20px; letter-spacing: .06em; }
.pa-msg { white-space: pre-wrap; font-size: 12.5px; background: var(--surface-2); border-radius: 10px; padding: 12px; margin: 0; color: var(--text-2); }
@media (max-width: 900px) { .pa-grid { grid-template-columns: 1fr; } }
.cl-table th { padding: 10px 14px; font-size: 12px; color: var(--muted); }
.pa-user > .grow { flex: 1 1 100%; }
