/*!*****************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./src/app/globals.css ***!
  \*****************************************************************************************************************************************************************************************************************************************************************/
/* ===== Tokens ===== */
/* Estilo: carbón neutro + violeta (principal), menta (IA / positivo), coral (peligro), naranja (aviso), azul (info). */
:root {
  --violet: #7B2FF7; --mint: #14B88A;
  --bg: #EFEFF3; --rail: #1C1C20; --rail-text: #A3A3AD;
  --surface: #FFFFFF; --surface-2: #F5F5F8; --line: #E2E2E8; --text: #1C1C22; --muted: #6B6B77;
  --accent: #7B2FF7; --accent-soft: #F1E9FF; --accent-on-soft: #6A1FE6;
  --ai: #0E9E77; --ai-on: #FFFFFF; --ai-soft: #DFF7EF; --ai-bub: #DCE8F6; --ai-bub-text: #16324F;
  --out: #E8E0F8; --out-text: #2A1B4D; --in: #FFFFFF; --note: #FFF1D6; --note-text: #6A4508;
  --ok: #128A66; --ok-soft: #DCF5EC; --warn: #F07A1A; --warn-text: #A8520A; --warn-soft: #FFEEDD;
  --danger: #DC3D45; --danger-soft: #FDE6E7; --info: #1E88E5;
  --scroll-thumb: #C6C6CF; --scroll-thumb-hover: #A3A3AD;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --violet: #9B5CFF; --mint: #2DD4A0;
    --bg: #1A1A1D; --rail: #141416; --rail-text: #9C9CA6;
    --surface: #242427; --surface-2: #2D2D31; --line: #36363B; --text: #F1F1F3; --muted: #9B9BA5;
    --accent: #8E4BFF; --accent-soft: #3A2A5E; --accent-on-soft: #FFFFFF;
    --ai: #2DD4A0; --ai-on: #0B2A20; --ai-soft: #18392F; --ai-bub: #263A52; --ai-bub-text: #E1ECF8;
    --out: #3F3557; --out-text: #EEE9F8; --in: #2D2D31; --note: #3A3220; --note-text: #F3DE9A;
    --ok: #2DD4A0; --ok-soft: #17372D; --warn: #FF8A3D; --warn-text: #FFB278; --warn-soft: #3B2A1C;
    --danger: #F0545B; --danger-soft: #3D2124; --info: #3B9BF0;
    --scroll-thumb: #4A4A50; --scroll-thumb-hover: #6A6A72;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --violet: #9B5CFF; --mint: #2DD4A0;
  --bg: #1A1A1D; --rail: #141416; --rail-text: #9C9CA6;
  --surface: #242427; --surface-2: #2D2D31; --line: #36363B; --text: #F1F1F3; --muted: #9B9BA5;
  --accent: #8E4BFF; --accent-soft: #3A2A5E; --accent-on-soft: #FFFFFF;
  --ai: #2DD4A0; --ai-on: #0B2A20; --ai-soft: #18392F; --ai-bub: #263A52; --ai-bub-text: #E1ECF8;
  --out: #3F3557; --out-text: #EEE9F8; --in: #2D2D31; --note: #3A3220; --note-text: #F3DE9A;
  --ok: #2DD4A0; --ok-soft: #17372D; --warn: #FF8A3D; --warn-text: #FFB278; --warn-soft: #3B2A1C;
  --danger: #F0545B; --danger-soft: #3D2124; --info: #3B9BF0;
  --scroll-thumb: #4A4A50; --scroll-thumb-hover: #6A6A72;
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.icon { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Barras de desplazamiento finas y redondeadas, sin fondo (como Respond IO), en toda la plataforma */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }
::-webkit-scrollbar-button { display: none; }
/* Firefox no tiene los pseudo-elementos de arriba; Chrome ignora esos si ve scrollbar-width, por eso va solo acá */
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
}

/* ===== Layout ===== */
/* Ocupa exactamente la ventana (dvh: descuenta la barra del navegador en celulares); cada columna scrollea por dentro */
.app { display: grid; grid-template-columns: 60px 236px 330px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; height: 100dvh; overflow: hidden; }
.app > * { min-height: 0; }
.app.no-contact { grid-template-columns: 60px 236px 330px minmax(0, 1fr); }
.app.no-contact .contact { display: none; }

/* ===== Rail ===== */
.rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 6px; }
.brand { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(140deg, var(--violet), var(--mint)); color: #fff; font-weight: 800; display: grid; place-items: center; margin-bottom: 14px; letter-spacing: -.5px; }
.rail > button, .rail > a, .rail-settings > button { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--rail-text); }
.rail > button:hover, .rail > a:hover, .rail-settings > button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail .on { background: color-mix(in srgb, var(--accent) 30%, transparent); color: #fff; }
.rail-settings { position: relative; }
.rail-menu { position: absolute; left: 50px; bottom: 0; z-index: 50; width: 300px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25); padding: 6px; }
.rail-menu a { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.rail-menu a + a { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.rail-menu a:hover { background: var(--surface-2); }
.rail-menu .icon { margin-top: 1px; color: var(--muted); }
.rail-menu strong { display: block; font-size: 13.5px; }
.rail-menu small { display: block; color: var(--muted); font-size: 12px; }
.rail .spacer { flex: 1 1; }
.rail .me { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

/* ===== Inbox nav ===== */
.nav { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 10px; }
.nav h1 { font-size: 17px; margin: 2px 8px 14px; font-weight: 800; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.on { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 700; }
.nav-item .lbl { flex: 1 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .n { font-size: 12px; color: var(--muted); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.nav-item.on .n { color: var(--accent-on-soft); }
.nav-item .em { width: 18px; text-align: center; }
.nav-sec { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 16px 0 4px; padding: 0 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.nav-sec .icon { transition: transform .15s; }
.nav-sec.closed .icon { transform: rotate(-90deg); }

/* ===== Conversation list ===== */
.list { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.list-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); flex: none; }
.tabs { display: flex; gap: 18px; margin-bottom: 10px; }
.tabs button { padding: 4px 0; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--accent); border-color: var(--accent); }
.tools { display: flex; gap: 8px; align-items: center; }
.tools select, .search { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.search { flex: 1 1; min-width: 0; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.toggle input { accent-color: var(--accent); }
.items { overflow-y: auto; flex: 1 1; }
.item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.item:hover { background: var(--surface-2); }
.item.on { background: var(--accent-soft); color: var(--accent-on-soft); }
.item.on .prev, .item.on .time { color: color-mix(in srgb, var(--accent-on-soft) 72%, transparent); }
.item .body { flex: 1 1; min-width: 0; }
.item .top { display: flex; justify-content: space-between; gap: 8px; }
.item .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.item .prev { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 6px; }
.item .meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.meta-right { display: flex; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.who { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); }
.who.ai { background: var(--ai-soft); border-color: transparent; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty.center { margin: auto; }

/* ===== Avatar ===== */
.av { border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; position: relative; flex: none; }
.av .ch { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface); display: grid; place-items: center; }
.av .ch-icon { stroke: #fff; stroke-width: 3; }
.av-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ===== Conversation ===== */
.convo { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.c-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 60px; }
.c-head .grow { flex: 1 1; min-width: 0; }
.c-head .name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-head .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-head select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 13px; max-width: 180px; }
.c-head .assign { font-size: 13px; color: var(--muted); white-space: nowrap; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 6px 11px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.back { display: none; }

.msgs { flex: 1 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.msg-wrap { display: contents; }
.ev { align-self: center; font-size: 12px; color: var(--muted); text-align: center; max-width: 90%; }
.ev b { color: var(--text); font-weight: 600; }
.day { align-self: center; font-size: 11.5px; background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: flex-end; max-width: min(560px, 82%); }
.row.out { align-self: flex-end; flex-direction: row-reverse; }
.bub { padding: 9px 13px; border-radius: 14px; background: var(--in); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.row.in .bub { border-bottom-left-radius: 4px; }
/* Archivo en un mensaje (foto, video, audio, documento) */
.bub.has-media { padding: 5px; }
.bub.has-media .msg-caption { padding: 4px 8px 2px; }
.bub.has-media .dlv { margin: 0 6px 2px auto; display: block; text-align: right; width: max-content; }
.msg-img { display: block; }
.msg-img img, .msg-video { display: block; max-width: min(320px, 100%); max-height: 320px; border-radius: 10px; object-fit: cover; background: var(--surface); }
.msg-audio { display: block; width: 280px; max-width: 100%; height: 40px; }
.msg-file { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 70%, transparent); color: inherit; text-decoration: none; min-width: 200px; }
a.msg-file:hover { text-decoration: underline; }
.msg-file-icon { font-size: 22px; line-height: 1; }
.msg-file-name { flex: 1 1; font-weight: 600; overflow-wrap: anywhere; }
.msg-file-size { font-size: 11.5px; opacity: .75; white-space: nowrap; }
.msg-file.loading, .msg-file.missing { font-size: 12.5px; opacity: .8; min-width: 0; }
.row.out .bub { background: var(--out); color: var(--out-text); border-color: transparent; border-bottom-right-radius: 4px; }
.row.ai .bub { background: var(--ai-bub); color: var(--ai-bub-text); }
.row.ai .mini { border-color: var(--ai); }
.row.ai .bmeta { color: var(--ai); }
.row.note .bub { background: var(--note); color: var(--note-text); border: 1px dashed currentColor; }
/* @mención en un comentario interno */
.row.note .bub .mention { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.bmeta { font-size: 11px; color: var(--muted); margin-top: 3px; text-align: right; }
.row.in .bmeta { text-align: left; }
/* Estado en WhatsApp de una respuesta (tildes) */
.dlv { display: inline-block; margin-left: 8px; font-size: 11px; line-height: 1; opacity: .75; letter-spacing: -2px; vertical-align: baseline; white-space: nowrap; }
.dlv.pending { letter-spacing: 0; }
.dlv.read { color: var(--info); opacity: 1; }
.dlv-failed { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; font-size: 11.5px; color: var(--danger); }
.dlv-failed .dlv.failed { margin: 0; letter-spacing: 0; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 700; opacity: 1; }
.dlv-failed button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.dlv-failed button:disabled { opacity: .6; cursor: default; }
.mini { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); flex: none; }

.foot { padding: 12px 16px 14px; flex: none; }
.ai-bar { display: flex; align-items: center; gap: 12px; background: var(--ai-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.ai-bar .ai-emoji { font-size: 20px; }
.ai-bar p { margin: 0; flex: 1 1; font-size: 13px; }
.ai-bar strong { display: block; font-size: 13.5px; }
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.composer.note-mode { background: var(--note); border-color: transparent; }
.comp-top { display: flex; align-items: center; gap: 14px; padding: 8px 12px 0; font-size: 12.5px; }
.comp-top button { color: var(--muted); font-weight: 600; padding-bottom: 4px; border-bottom: 2px solid transparent; }
.comp-top button.on { color: var(--text); border-color: var(--accent); }
.comp-top .via { margin-left: auto; color: var(--muted); }
.composer textarea { width: 100%; border: 0; background: transparent; resize: none; padding: 10px 12px; min-height: 56px; max-height: 160px; outline: none; }
.composer textarea:disabled { cursor: not-allowed; opacity: .55; }
/* Ventana de 24 h de WhatsApp vencida: solo plantillas */
.comp-window { display: flex; align-items: center; gap: 14px; margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.comp-window p { margin: 0; flex: 1 1; font-size: 13px; }
.comp-window strong { display: block; margin-bottom: 2px; }
.comp-window .btn { flex: none; }
/* Mensaje que salió con una plantilla de WhatsApp */
.msg-tpl { display: block; font-size: 11px; font-weight: 600; opacity: .75; margin-bottom: 3px; }
/* Archivo adjunto que sale con el mensaje */
.comp-file { display: flex; align-items: center; gap: 8px; margin: 8px 12px 0; padding: 6px 6px 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; width: -moz-fit-content; width: fit-content; max-width: calc(100% - 24px); }
.comp-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-file .icon-btn { width: 24px; height: 24px; }
.comp-bot { display: flex; align-items: center; gap: 4px; padding: 4px 8px 8px; }
.comp-bot .grow { flex: 1 1; }

/* ===== Contact panel ===== */
.contact { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.contact h2 { font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }
.card { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.card .nm { font-weight: 800; font-size: 15px; }
.card .id { font-size: 12px; color: var(--muted); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.field input { width: calc(100% + 7px); border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 5px 7px; margin-left: -7px; }
.field input:hover { border-color: var(--line); }
.field input:focus { border-color: var(--accent); background: var(--surface-2); outline: none; }
.field .ro { padding: 5px 0; }
.sec-t { font-size: 12px; font-weight: 700; color: var(--muted); margin: 18px 0 8px; }
.sec-row { display: flex; align-items: center; justify-content: space-between; }
.sec-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; text-decoration: none; }
.sec-link:hover { text-decoration: underline; }
.channels { list-style: none; margin: 0; padding: 0; display: grid; grid-gap: 8px; gap: 8px; }
.channels li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ch-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ch-dot .ch-icon { stroke: #fff; stroke-width: 2.6; }
.ch-name { font-weight: 600; flex: none; }
.ch-handle { color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone { display: flex; gap: 4px; }
.field .phone select { width: auto; flex: none; margin-left: -7px; }
.field .phone input { width: auto; flex: 1 1; min-width: 0; margin-left: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 600; }
.tag button { color: inherit; opacity: .7; font-size: 13px; line-height: 1; }
.tag-add { border: 1px dashed var(--line); background: transparent; border-radius: 999px; padding: 3px 9px; font-size: 12px; width: 130px; }

/* ===== Login / setup ===== */
.login, .setup { height: 100%; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.login-card { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: flex; flex-direction: column; }
.login-card .brand { margin: 0 0 14px; }
.login-card h1 { font-size: 18px; margin: 0 0 18px; }
.login-card .field input { width: 100%; margin: 0; border-color: var(--line); background: var(--surface-2); padding: 8px 10px; }
.login-card .btn { justify-content: center; padding: 9px; margin-top: 6px; }
.form-error { color: var(--danger); font-size: 13px; margin: 0 0 8px; }
.setup { max-width: 520px; margin: 0 auto; text-align: center; }
.setup code { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 13px; }

/* ===== Error / simulador ===== */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); background: var(--danger); color: #fff; border-radius: 10px; padding: 10px 10px 10px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 13px; }
.toast button { color: #fff; font-size: 18px; line-height: 1; padding: 2px 6px; }
.list-head .sim-btn { margin-left: auto; font-size: 12px; padding: 4px 9px; }
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(8, 8, 12, .55); display: grid; place-items: center; padding: 16px; }
.sim { width: min(420px, 100%); background: var(--surface); border-radius: 14px; padding: 18px; max-height: 100%; overflow-y: auto; }
.sim h2 { font-size: 15px; margin: 0 0 4px; }
.sim .hint { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
.sim .field input, .sim .field select, .sim .field textarea { width: 100%; margin: 0; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 7px 9px; }
.sim .field textarea { resize: vertical; min-height: 70px; }
.sim .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ===== Ajustes ===== */
.set-app { display: grid; grid-template-columns: 60px 260px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; height: 100dvh; overflow: hidden; }
.set-app > * { min-height: 0; }
.set-nav { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 10px; }
.set-back { display: none; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; margin: 0 8px 10px; }
.set-nav h1 { font-size: 16px; font-weight: 800; margin: 2px 8px 12px; }
.set-group { margin-bottom: 14px; }
.set-group-t { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 10px 4px; }
.set-link { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-link:hover { background: var(--surface-2); }
.set-link.on { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 700; }
.set-main { overflow-y: auto; background: var(--surface); }
.set-head { padding: 18px 28px 14px; border-bottom: 1px solid var(--line); }
.set-head h2 { font-size: 17px; margin: 0; }
.set-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.set-body { padding: 24px 28px 40px; max-width: 900px; }
.set-soon { color: var(--muted); padding: 40px 0; }
.set-stack { display: flex; flex-direction: column; gap: 28px; }
.set-stack fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.set-field label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; }
.set-field input, .set-field select, .ws-form select { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.set-field input:disabled, .set-field select:disabled { opacity: .6; cursor: not-allowed; }
.info { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font-size: 10px; font-style: italic; display: inline-grid; place-items: center; cursor: help; }
.set-actions { display: flex; justify-content: flex-end; gap: 10px; }
.set-actions.start { justify-content: flex-start; }
.set-note { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.form-ok { color: var(--ok); font-size: 13px; margin: 0; }
.ws-form { max-width: 620px; }

.profile { display: grid; grid-template-columns: 180px minmax(0, 1fr); grid-gap: 24px; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.profile-side { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.profile-av { width: 92px; height: 92px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 30px; font-weight: 800; display: grid; place-items: center; }
.status-select { border: 1px solid var(--accent); background: var(--surface); border-radius: 8px; padding: 6px 8px; font-weight: 600; }
.status-select.online { color: var(--ok); }
.status-select.away { color: var(--muted); }
.profile-fields { display: flex; flex-direction: column; gap: 16px; }

.set-block h3 { font-size: 14px; margin: 0 0 12px; }
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch-row.disabled { color: var(--muted); }
.soon-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ai-soft); color: var(--ai); }
.switch { -webkit-appearance: none; -moz-appearance: none; appearance: none; width: 40px; height: 22px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { cursor: not-allowed; opacity: .6; }

.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 16px; gap: 16px; }
.theme-card { display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: 13px; }
.theme-preview { display: block; height: 110px; border-radius: 10px; border: 2px solid var(--line); position: relative; overflow: hidden; background: #fff; }
.theme-card.dark .theme-preview { background: #262629; }
.theme-card.system .theme-preview { background: linear-gradient(90deg, #fff 50%, #262629 50%); }
.theme-preview i { position: absolute; left: 30%; right: 10%; height: 5px; border-radius: 3px; background: #D6D6DD; }
.theme-card.dark .theme-preview i { background: #3E3E45; }
.theme-preview i:nth-child(1) { top: 30%; width: 20%; }
.theme-preview i:nth-child(2) { top: 50%; }
.theme-preview i:nth-child(3) { top: 70%; }
.theme-card.on .theme-preview { border-color: var(--accent); }

.set-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.set-card-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; width: 100%; }
.set-card-row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.set-card-t { font-weight: 700; font-size: 13px; }
.set-card .hint { margin: 0; color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-x { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.chip-x button { font-size: 15px; line-height: 1; padding: 0 4px; color: var(--muted); }
.add-btn { width: 34px; height: 34px; justify-content: center; padding: 0; font-size: 18px; }

/* ===== Campos de contacto ===== */
.set-body.wide { max-width: none; }
.field select { width: calc(100% + 7px); border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 5px 7px; margin-left: -7px; }
.field select:hover { border-color: var(--line); }
.field .switch { margin-top: 4px; }
.cf { display: flex; flex-direction: column; gap: 16px; }
.cf-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cf-search { margin-left: auto; width: min(320px, 100%); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cf-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
/* Con un menú ⋮ abierto, la tabla no lo recorta (el scroll horizontal corta lo que se sale por abajo) */
.cf-table-wrap:has(.row-menu-pop) { overflow: visible; }
.key-cell { display: inline-flex; align-items: center; gap: 6px; }
.copy-var { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity .1s; }
tr:hover .copy-var, .copy-var:focus-visible { opacity: 1; }
.copy-var:hover { background: var(--surface-2); color: var(--accent); }
@media (hover: none) { .copy-var { opacity: 1; } }
.cf-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cf-table th { text-align: left; background: var(--surface-2); font-weight: 700; padding: 0; white-space: nowrap; }
.cf-table th button, .cf-table th.actions-col { display: flex; align-items: center; gap: 6px; padding: 12px; width: 100%; font-weight: 700; }
.cf-table th .sort { color: var(--muted); font-size: 11px; }
.cf-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.cf-table tbody tr:hover { background: var(--surface-2); }
.cf-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.cf-table .muted { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-table .actions-col { width: 90px; text-align: center; }
.cf-empty { text-align: center; color: var(--muted); padding: 40px 12px !important; }
.cf-pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; font-size: 13px; color: var(--muted); }
.cf-pager .icon-btn { font-size: 18px; }
.row-menu { position: relative; display: inline-block; }
.row-menu .icon-btn { font-size: 18px; font-weight: 800; }
.row-menu-pop { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 140px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .2); padding: 4px; display: flex; flex-direction: column; }
.row-menu-pop button { text-align: left; padding: 8px 10px; border-radius: 7px; }
.row-menu-pop button:hover { background: var(--surface-2); }
.danger-text { color: var(--danger); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }

.modal { width: min(520px, 100%); max-height: 100%; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; margin: 0; }
.modal-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.modal-body p { margin: 0; }
.modal-body textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.field-hint { font-size: 12px; margin: 4px 0 0; color: var(--muted); }
.field-hint.error { color: var(--danger); }
.view-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.view-head, .view-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 190px; align-items: center; grid-gap: 10px; gap: 10px; }
.view-head { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.view-row { padding: 4px 0; border-radius: 8px; }
.view-row.dragging { opacity: .5; background: var(--surface-2); }
.view-row .drag { display: flex; flex-direction: column; align-items: center; cursor: -webkit-grab; cursor: grab; color: var(--muted); font-size: 9px; line-height: 1.1; }
.view-row .drag button { padding: 1px 4px; }
.view-row select { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }

/* ===== Responsive ===== */
@media (max-width: 1240px) {
  .app, .app.no-contact { grid-template-columns: 60px 236px 320px minmax(0, 1fr); }
  .app .contact, .app.no-contact .contact {
    display: flex; position: fixed; top: 0; right: 0; bottom: 0; width: 344px; z-index: 20;
    box-shadow: -12px 0 30px rgba(0, 0, 0, .18); padding-top: calc(16px + env(safe-area-inset-top, 0px));
    transform: translateX(105%); transition: transform .2s;
  }
  .app.show-contact .contact { transform: none; }
}
@media (max-width: 960px) {
  .app, .app.no-contact { grid-template-columns: 60px 300px minmax(0, 1fr); }
  .nav { display: none; }
}
@media (max-width: 700px) {
  .app, .app.no-contact { grid-template-columns: minmax(0, 1fr); }
  .rail, .convo { display: none; }
  .app.in-convo .list { display: none; }
  .app.in-convo .convo { display: grid; }
  .back { display: grid; }
  .c-head .assign { display: none; }
  .app .contact { width: 100%; }
  .row { max-width: 90%; }
  .set-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .set-app .rail { display: none; }
  .set-nav { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .set-back { display: flex; }
  .set-head, .set-body { padding-left: 16px; padding-right: 16px; }
  .profile { grid-template-columns: minmax(0, 1fr); }
  .theme-cards { grid-template-columns: minmax(0, 1fr); }
  .theme-preview { height: 70px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===== Ajustes → Ciclo de vida ===== */
.lc { display: flex; flex-direction: column; gap: 18px; }
.lc-toggle { flex-direction: row; }
.lc-toggle p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.lc-head h3 { margin: 0; font-size: 17px; }
.lc-notice { margin: 0; color: var(--ok); font-size: 13px; }
.lc-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 18px; gap: 18px; align-items: start; }
.lc-col { border: 1px solid var(--line); border-radius: 12px; overflow: visible; background: var(--surface); }
.lc-col-head { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px 12px 0 0; }
.lc-col-head.stages { background: var(--surface-2); }
.lc-col-head.lost { background: var(--note); color: var(--note-text); }
.lc-col-head > span { font-size: 18px; line-height: 1.3; }
.lc-col-head h4 { margin: 0; font-size: 15px; }
.lc-col-head p { margin: 4px 0 0; font-size: 13px; opacity: .85; }
.lc-list { list-style: none; margin: 0; padding: 12px 16px 4px; display: flex; flex-direction: column; gap: 14px; }
.lc-item.dragging { opacity: .5; }
.lc-step { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 4px 74px; }
.lc-row { display: flex; align-items: center; gap: 8px; }
.lc-drag { cursor: -webkit-grab; cursor: grab; color: var(--muted); font-size: 18px; width: 18px; text-align: center; -webkit-user-select: none; -moz-user-select: none; user-select: none; flex: none; }
.lc-name { flex: 1 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 0 6px 0 0; }
.lc-name:focus-within { border-color: var(--accent); }
.lc-name.invalid { border-color: var(--danger); }
.lc-name input { flex: 1 1; min-width: 0; border: 0; background: transparent; padding: 8px 10px; font-weight: 600; outline: none; }
.lc-badge { flex: none; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.lc-badge.default { background: var(--accent-soft); color: var(--accent-on-soft); }
.lc-badge.won { background: var(--ok-soft); color: var(--ok); }
.lc-more { width: 32px; height: 32px; font-size: 13px !important; letter-spacing: -1px; border: 1px solid var(--line); }
.lc-under { margin-left: 74px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 4px; }
.lc-under .field-hint { margin: 0; }
.lc-under textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 8px 10px; resize: vertical; }
.lc-link { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.lc-link:hover { color: var(--text); }
.lc-add { display: block; width: calc(100% - 32px); margin: 8px 16px 16px; border: 1px solid var(--line); border-radius: 9px; padding: 8px; font-weight: 600; background: var(--surface); }
.lc-add:hover:not(:disabled) { background: var(--surface-2); }
.lc-add:disabled { opacity: .5; cursor: not-allowed; }
.row-menu-pop button:disabled { opacity: .45; cursor: not-allowed; }
.emoji-picker { position: relative; flex: none; }
.emoji-btn { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 18px; display: grid; place-items: center; }
.emoji-btn:hover:not(:disabled) { border-color: var(--accent); }
.emoji-pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, .28); padding: 8px; }
.emoji-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 6px; overflow-x: auto; }
.emoji-tabs button { flex: none; width: 32px; height: 30px; border-radius: 7px; font-size: 16px; opacity: .6; border-bottom: 2px solid transparent; }
.emoji-tabs button.on { opacity: 1; border-bottom-color: var(--ai); }
.emoji-custom input { width: 100%; margin: 8px 0 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 12.5px; }
.emoji-title { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 6px 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); max-height: 210px; overflow-y: auto; }
.emoji-grid button { height: 34px; font-size: 20px; border-radius: 7px; }
.emoji-grid button:hover { background: var(--surface-2); }
@media (max-width: 960px) {
  .lc-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .lc-step, .lc-under { margin-left: 0; }
  .lc-name { flex-wrap: wrap; }
}

/* ===== Ajustes → Conversaciones ===== */
.conv { display: flex; flex-direction: column; gap: 14px; }
.conv-card { flex-direction: column; align-items: stretch; }
.conv-card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.conv-card .set-card-row > div { min-width: 0; }
.conv-duration { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.conv-duration label { color: var(--muted); font-size: 13.5px; }
.conv-duration input, .conv-duration select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.conv-duration input { width: 110px; }
.conv-duration select { min-width: 150px; }
.conv-duration .field-hint { width: 100%; margin: 0; }
.conv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.conv-chip { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.conv-advanced { align-self: flex-start; color: var(--accent); font-weight: 600; padding: 4px 0; }
.conv-modes { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cat-list li { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) auto; grid-gap: 8px; gap: 8px; align-items: center; }
.cat-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-list input, .cat-add input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.cat-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; grid-gap: 8px; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.close-summarize { padding: 3px 9px; font-size: 12px; }
.close-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 400; }
.close-tools .icon-btn { width: 30px; height: 30px; }
#close-summary { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
@media (max-width: 560px) {
  .cat-list li, .cat-add { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Bandeja estilo Respond IO ===== */
.muted { color: var(--muted); }
/* Lista: Chats / Llamadas + íconos; filtro de estado + interruptor "Sin responder" */
.tabs { align-items: center; }
.tabs-tools { margin-left: auto; display: flex; gap: 2px; }
.icon-btn.on { color: var(--accent-on-soft); background: var(--accent-soft); }
.list-head .search { display: block; width: 100%; margin-bottom: 8px; }
.tools { justify-content: space-between; }
.tools select { flex: 1 1; min-width: 0; max-width: 170px; }
.tools .toggle { margin-top: 0; white-space: nowrap; }
.switch.sm { width: 32px; height: 18px; }
.switch.sm::after { width: 12px; height: 12px; }
.switch.sm:checked::after { transform: translateX(14px); }
/* Encabezado de la conversación */
.c-head { gap: 10px; }
.c-title { min-width: 0; flex: 0 1 auto; }
.c-head .grow { flex: 1 1; }
.lc-picker { position: relative; display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.lc-current { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 13px; font-weight: 600; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-next { display: grid; place-items: center; width: 30px; border-left: 1px solid var(--line); color: var(--muted); }
.lc-next:hover:not(:disabled), .lc-current:hover { color: var(--text); background: var(--surface); }
.lc-next:disabled { opacity: .4; }
.lc-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 230px; max-height: 360px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .28); padding: 4px; display: flex; flex-direction: column; }
.lc-menu-t { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; }
.lc-menu button { text-align: left; padding: 7px 10px; border-radius: 7px; }
.lc-menu button:hover { background: var(--surface-2); }
.lc-menu button.on { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 700; }
.lc-menu .lc-clear { color: var(--muted); border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 4px; }
.assign-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.assign-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); flex: none; }
.assign-av.ai { border-color: var(--ai); }
.close-btn { gap: 6px; }
/* Hilo */
.row.in { align-items: flex-end; }
.row .av { flex: none; font-size: 11px; }
.day { background: var(--surface-2); border: 0; padding: 3px 14px; border-radius: 6px; font-weight: 600; }
/* Compositor */
.comp-top { padding: 10px 12px 0; }
.comp-to { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--muted); }
.comp-to .ch-dot { width: 16px; height: 16px; }
.send-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; }
.send-btn:disabled { background: var(--surface-2); color: var(--muted); }
.comp-under { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 0; }
.comp-under button { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.comp-under button:hover:not(:disabled) { color: var(--text); }
.comp-under .comp-ai { color: var(--ai); }
/* Panel de contacto */
.contact h2 .h2-l { display: inline-flex; align-items: center; gap: 6px; }
.card .id { display: flex; align-items: center; gap: 6px; }
.card .cc { color: var(--text); font-size: 12px; }
.ch-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ch-icons { display: flex; gap: 6px; flex-wrap: wrap; }
.ch-label { font-weight: 600; font-size: 13px; }
.tag-btn { padding: 4px 10px; font-size: 12.5px; }
.assign-av.none { display: none; color: var(--muted); }
/* Angosto: solo el avatar y la flecha (el nombre queda en el título del botón) */
@media (max-width: 960px) {
  .assign-chip .assign-name { display: none; }
  .assign-av.none { display: grid; }
}

/* ===== Encabezado: acciones (asignar, colaboradores, buscar, silenciar, llamar, cerrar, más) ===== */
.h-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.pop { position: relative; display: inline-flex; }
.pop-panel { position: absolute; top: calc(100% + 6px); z-index: 30; min-width: 240px; max-width: 320px; max-height: 380px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .28); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.pop-panel.right { right: 0; }
.pop-panel.left { left: 0; }
.pop-t { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 8px 4px; }
.pop-note { margin: 0; padding: 2px 8px 6px; font-size: 12.5px; color: var(--muted); }
.pop-note.strong { color: var(--text); padding: 8px; }
.pop-note a { color: var(--accent); font-weight: 700; text-decoration: none; }
.pop-item { display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 8px; border-radius: 7px; font-size: 13.5px; }
.pop-item:hover { background: var(--surface-2); }
.pop-item.on { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 700; }
.pop-item.check { cursor: pointer; }
.pop-item.check input { accent-color: var(--accent); }
.pop-search { margin: 2px 2px 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.pop-custom { display: flex; gap: 6px; padding: 6px 4px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.pop-custom input { flex: 1 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color-scheme: light dark; }
button.assign-chip { padding: 4px 8px 4px 4px; border-radius: 9px; color: var(--text); }
button.assign-chip:hover { background: var(--surface-2); }
.assign-name { overflow: hidden; text-overflow: ellipsis; }
.badge-host { position: relative; }
.mini-badge { position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 3px; }
.calls-btn { width: auto; padding: 0 6px; gap: 2px; display: inline-flex; align-items: center; }
.close-btn { margin-left: 6px; }
/* Buscar en la conversación */
.msg-search { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); }
.msg-search input { flex: 1 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); }
.msg-search .muted { font-size: 12.5px; white-space: nowrap; }
/* Panel derecho con barra vertical de pestañas */
.contact { display: flex; padding: 0; overflow: hidden; }
.contact-body { flex: 1 1; min-width: 0; overflow-y: auto; padding: 16px; }
.contact-tabs { order: 2; flex: none; width: 48px; border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; }
.contact-tabs .icon-btn.on { background: var(--accent); color: #fff; }
/* Actividades */
.activity { display: flex; flex-direction: column; gap: 10px; }
.activity-wrap { display: contents; }
.activity .day { align-self: center; }
.activity-range { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-weight: 600; text-align: center; }
.activity-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.activity-card header { font-weight: 700; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.activity-card p { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; }
.activity-card b { font-weight: 800; }
.activity-card time { font-size: 12px; color: var(--muted); }
@media (max-width: 960px) {
  .h-actions .calls-btn { display: none; }
}
@media (max-width: 700px) {
  .h-actions .badge-host, .panel-btn { display: none; }
}

/* ===== Ajustes finos para igualar la barra superior de Respond IO ===== */
.c-head { min-height: 52px; padding: 6px 14px; }
.c-title .name { font-size: 15px; }
.c-title .sub { font-size: 12px; }
.lc-picker { background: var(--surface-2); border-color: transparent; }
.lc-current { font-weight: 700; color: var(--text); }
/* Íconos del encabezado más grandes y claros, como en Respond IO */
.h-actions { gap: 4px; }
.h-actions .icon-btn { color: var(--text); width: 34px; height: 34px; }
.h-actions .icon-btn .icon { width: 21px; height: 21px; }
.h-actions .calls-btn { width: auto; }
.h-actions .calls-btn .icon:last-child { width: 13px; height: 13px; }
.h-actions .close-btn { padding: 6px 12px; font-size: 14px; }
.h-actions > .pop:last-child .icon-btn .icon { width: 22px; height: 22px; }
button.assign-chip { font-size: 13.5px; font-weight: 600; }
.panel-btn { display: none; }
.panel-btn.show { display: grid; }
@media (max-width: 1240px) {
  .panel-btn { display: grid; }
}
/* Filtro de la lista como texto con flecha (sin caja) */
.tools select { background: transparent; border-color: transparent; font-weight: 600; font-size: 13.5px; padding-left: 2px; cursor: pointer; }
.tools select:hover { background: var(--surface-2); }
.tabs-tools .icon-btn { color: var(--text); }

/* ===== Área de conversación: barra arriba a todo el ancho; abajo el hilo y el panel de contacto (como Respond IO) ===== */
.convo { display: grid; grid-template-columns: minmax(0, 1fr) 344px; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.convo > .c-head { grid-column: 1 / -1; grid-row: 1; }
.convo > .msg-search { grid-column: 1; grid-row: 2; }
.convo > .msgs { grid-column: 1; grid-row: 3; min-height: 0; }
.convo > .foot { grid-column: 1; grid-row: 4; }
.convo > .contact { grid-column: 2; grid-row: 2 / 5; min-height: 0; }
.convo.convo-empty { display: flex; }
.app.no-contact .convo { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1240px) {
  /* El panel pasa a ser un cajón flotante: el hilo usa todo el ancho */
  .convo { grid-template-columns: minmax(0, 1fr); }
}

/* Aviso "IA … está gestionando" dentro del compositor, como en Respond IO */
.comp-ai-bar { display: flex; align-items: center; gap: 14px; margin: 10px 12px 12px; padding: 12px 14px; border-radius: 10px; background: var(--ai-bub); color: var(--ai-bub-text); }
.comp-ai-bar p { margin: 0; flex: 1 1; font-size: 13.5px; }
.comp-ai-bar strong { display: block; margin-bottom: 2px; }
.comp-ai-bar .btn.primary { background: var(--ai); border-color: var(--ai); color: var(--ai-on); }

/* ───────────── Fragmentos (Ajustes y "/" en el compositor) ───────────── */
.snip-topic-filter { width: 180px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cf-toolbar .snip-topic-filter + .icon-btn { border: 1px solid var(--line); border-radius: 8px; }
.cf-table th .th-plain { display: block; padding: 12px; }
.snip-table td { vertical-align: top; }
.snip-msg { max-width: 420px; }
.snip-msg .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.snip-msg div { white-space: pre-wrap; word-break: break-word; }
.snip-file-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.snip-file-links .sec-link { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; }
.snip-message { display: flex; align-items: flex-start; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.snip-message .emoji-btn { width: 30px; height: 30px; border: 0; font-size: 16px; }
.modal-body .snip-message textarea { border: 0; background: transparent; padding: 6px 4px; min-height: 64px; outline: none; }
.snip-vars .icon-btn { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; font-weight: 800; }
.snip-vars .row-menu-pop { max-height: 260px; overflow-y: auto; min-width: 260px; }
.snip-vars .row-menu-pop button { display: flex; justify-content: space-between; gap: 12px; }
.snip-vars .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.snip-files { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.snip-file { display: flex; align-items: flex-end; gap: 8px; }
.snip-file .drag { display: flex; flex-direction: column; color: var(--muted); font-size: 9px; line-height: 1.1; padding-bottom: 6px; }
.snip-file .drag button { padding: 1px 4px; }
.snip-file .drag button:disabled { opacity: .3; }
.snip-file-main { flex: 1 1; min-width: 0; }
.snip-file-main label { font-weight: 600 !important; }
.snip-file-pick { cursor: pointer; }
.snip-file .icon-btn.on { color: var(--accent); }
.snip-add-file { width: 100%; justify-content: center; }
.composer { position: relative; }
.snip-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); padding: 4px; display: flex; flex-direction: column; }
.snip-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 7px; }
.snip-menu button.on { background: var(--surface-2); }
.snip-menu-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.snip-menu-msg { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.snip-menu-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ───────────── Etiquetas (colores de Respond IO) ───────────── */
.tag { border-radius: 6px; border: 1px solid transparent; font-weight: 700; padding: 3px 8px; white-space: nowrap; }
.tag-grey { background: #EDEDF0; color: #3A3A3F; border-color: #C9C9CF; }
.tag-red { background: #FFE3E0; color: #9E2A20; border-color: #FF9C94; }
.tag-orange { background: #FFEBD1; color: #8A4D0A; border-color: #FFBE6B; }
.tag-yellow { background: #FFF5CC; color: #6E5A05; border-color: #FFE173; }
.tag-green { background: #DDF5E1; color: #1D5428; border-color: #8FDB9C; }
.tag-blue { background: #E1EDFF; color: #1B3F73; border-color: #A8CCFF; }
.tag-indigo { background: #ECECFF; color: #33357A; border-color: #C9CBFF; }
.tag-purple { background: #F4E6FC; color: #52266E; border-color: #D9B3F5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag-grey { background: #3A3A3F; color: #E6E6EA; border-color: #55555B; }
  :root:not([data-theme="light"]) .tag-red { background: #7A1F17; color: #FFD9D4; border-color: #C2483D; }
  :root:not([data-theme="light"]) .tag-orange { background: #6E3E08; color: #FFE2BD; border-color: #C27A22; }
  :root:not([data-theme="light"]) .tag-yellow { background: #5E4D06; color: #FFF2BF; border-color: #B89A1F; }
  :root:not([data-theme="light"]) .tag-green { background: #1D5428; color: #D6F5DC; border-color: #3E9A50; }
  :root:not([data-theme="light"]) .tag-blue { background: #1B3F73; color: #DCEAFF; border-color: #4A7FCC; }
  :root:not([data-theme="light"]) .tag-indigo { background: #33357A; color: #E4E5FF; border-color: #6D70D1; }
  :root:not([data-theme="light"]) .tag-purple { background: #52266E; color: #F1E0FC; border-color: #9558BD; }
}
:root[data-theme="dark"] .tag-grey { background: #3A3A3F; color: #E6E6EA; border-color: #55555B; }
:root[data-theme="dark"] .tag-red { background: #7A1F17; color: #FFD9D4; border-color: #C2483D; }
:root[data-theme="dark"] .tag-orange { background: #6E3E08; color: #FFE2BD; border-color: #C27A22; }
:root[data-theme="dark"] .tag-yellow { background: #5E4D06; color: #FFF2BF; border-color: #B89A1F; }
:root[data-theme="dark"] .tag-green { background: #1D5428; color: #D6F5DC; border-color: #3E9A50; }
:root[data-theme="dark"] .tag-blue { background: #1B3F73; color: #DCEAFF; border-color: #4A7FCC; }
:root[data-theme="dark"] .tag-indigo { background: #33357A; color: #E4E5FF; border-color: #6D70D1; }
:root[data-theme="dark"] .tag-purple { background: #52266E; color: #F1E0FC; border-color: #9558BD; }
.tag-preview { display: flex; }
.tag-name-row { display: flex; gap: 12px; align-items: flex-start; }
.tag-name-row .grow { flex: 1 1; }
.tag-emoji { display: flex; align-items: center; gap: 6px; }
.set-field input.invalid { border-color: var(--danger); }
.tag-colors { display: flex; gap: 12px; flex-wrap: wrap; }
.tag-colors button { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #1B1B1F; outline-offset: 2px; }
.tag-colors button.on { outline: 2px solid var(--text); }
.tag-picker { position: relative; margin-top: 8px; }
.tag-picker input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.tag-picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); padding: 4px; display: flex; flex-direction: column; }
.tag-picker-list button { text-align: left; padding: 6px 8px; border-radius: 7px; font-size: 13px; font-weight: 600; }
.tag-picker-list button.on { background: var(--surface-2); }
.tag-picker-empty { font-size: 12.5px; margin: 6px 2px 0; }

/* ───────────── Asistente IA ───────────── */
.assist { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-gap: 24px; gap: 24px; align-items: start; }
.assist-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.assist-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.assist-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.assist-persona { width: 100%; margin-top: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; resize: vertical; }
.assist-side { display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: var(--muted); }
.assist-side p { margin: 0; line-height: 1.5; }
.assist-side .sec-link { display: inline; }
.assist-demo { border-radius: 12px; padding: 14px; background: linear-gradient(135deg, var(--ai) 0%, color-mix(in srgb, var(--ai) 55%, var(--violet)) 100%); display: flex; flex-direction: column; gap: 10px; }
.assist-demo-msg { align-self: flex-start; background: var(--surface); color: var(--text); font-size: 11.5px; padding: 6px 9px; border-radius: 8px; }
.assist-demo-box { background: var(--surface); color: var(--muted); font-size: 11px; padding: 8px; border-radius: 8px; display: flex; align-items: flex-end; gap: 8px; }
.assist-demo-btn { color: var(--ai); flex-shrink: 0; }
.assist-reply { min-height: 90px; white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.assist-reply.empty { color: var(--muted); }
.comp-assist { color: var(--ai); }
@media (max-width: 900px) { .assist { grid-template-columns: 1fr; } }

/* ───────────── Fuentes de conocimiento de IA ───────────── */
.set-head h2 { display: flex; align-items: center; gap: 6px; }
.set-back { margin-left: -8px; text-decoration: none; color: inherit; }
.ks-usage-chip { margin-left: auto; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.cf-toolbar .ks-search { margin-left: 0; }
.ks-status { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }
.ks-completed { background: var(--ok-soft); color: var(--ok); }
.ks-processing { background: var(--warn-soft); color: var(--warn-text); }
.ks-failed { background: var(--danger-soft); color: var(--danger); cursor: help; }
.ks-partial { background: var(--warn-soft); color: var(--warn-text); cursor: help; }
.ks-log-ok { background: var(--ok-soft); color: var(--ok); }
.ks-log-error { background: var(--danger-soft); color: var(--danger); }
.ks-log-skipped { background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ks-completed,
  :root:not([data-theme="light"]) .ks-log-ok { background: var(--ok-soft); color: var(--ok); }
  :root:not([data-theme="light"]) .ks-processing { background: var(--warn-soft); color: var(--warn-text); }
  :root:not([data-theme="light"]) .ks-failed,
  :root:not([data-theme="light"]) .ks-log-error { background: var(--danger-soft); color: var(--danger); }
  :root:not([data-theme="light"]) .ks-partial { background: var(--warn-soft); color: var(--warn-text); }
}
:root[data-theme="dark"] .ks-completed,
:root[data-theme="dark"] .ks-log-ok { background: var(--ok-soft); color: var(--ok); }
:root[data-theme="dark"] .ks-processing { background: var(--warn-soft); color: var(--warn-text); }
:root[data-theme="dark"] .ks-failed,
:root[data-theme="dark"] .ks-log-error { background: var(--danger-soft); color: var(--danger); }
:root[data-theme="dark"] .ks-partial { background: var(--warn-soft); color: var(--warn-text); }
.ks-paths { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 12px; gap: 12px; }
.ks-paths textarea { width: 100%; resize: vertical; font-family: inherit; }
@media (max-width: 600px) { .ks-paths { grid-template-columns: 1fr; } }
.ks-log { display: flex; flex-direction: column; gap: 6px; }
.ks-log > p { margin: 0; font-size: 13px; }
.ks-log .cf-table-wrap { max-height: 320px; overflow: auto; }
.ks-log-table td { vertical-align: top; font-size: 12.5px; }
.ks-log-table td:first-child { white-space: nowrap; }
.ks-log-table .ks-link-cell .sec-link { max-width: 280px; }
.ks-table td { white-space: nowrap; }
.ks-link-cell .sec-link { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.ks-dialog > p.muted { margin: 0; font-size: 13px; }
.ks-kinds { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 10px; gap: 10px; }
.ks-kind-opt { display: flex !important; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14px !important; font-weight: 600 !important; cursor: pointer; margin: 0 !important; }
.ks-kind-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.ks-kind-opt.off { opacity: .5; cursor: not-allowed; }
.ks-drop { min-height: 150px; display: grid; place-items: center; text-align: center; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; padding: 16px; }
.ks-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.ks-drop .sec-link { display: inline; }
.ks-files { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ks-files li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.ks-file-name { flex: 1 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-advanced { display: flex; justify-content: space-between; width: 100%; font-weight: 700; font-size: 14px; padding: 4px 0; }
.ks-url-row { display: flex; gap: 6px; margin-bottom: 6px; }
.ks-url-row input { flex: 1 1; }
.ks-foot { align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.ks-usage { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.ks-usage.over { color: var(--danger); font-weight: 700; }

/* ───────────── Prompts IA ───────────── */
.prompt-count { align-self: center; font-size: 12.5px; }
.prompt-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.prompt-demo-box { flex-direction: column; align-items: stretch; }
.prompt-demo-menu { display: flex; flex-wrap: wrap; gap: 4px; }
.prompt-demo-menu span { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 10.5px; }
.pop-panel.up { top: auto; bottom: calc(100% + 6px); }
.prompt-menu { min-width: 220px; }
.prompt-menu .pop-item .grow { flex: 1 1; }
.pop-back { font-weight: 700; color: var(--muted); }

/* ───────────── Archivos ───────────── */
.files-export { border: 1px solid var(--line); border-radius: 8px; }
.files-lead { margin: 0; color: var(--muted); font-size: 13.5px; }
.files-lead .sec-link { display: inline; }
.files-types { margin: 0; padding: 10px 12px 10px 28px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.files-picked { display: inline-flex; align-items: center; gap: 6px; }
.files-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-align: left; }
.files-name:hover { color: var(--accent); }
.files-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 64px 16px; color: var(--muted); }
.files-empty strong { color: var(--text); font-size: 15px; }
.files-empty p { margin: 0; max-width: 420px; font-size: 13.5px; }
.files-empty-icon { font-size: 40px; }

/* ───────────── Importar contactos ───────────── */
.imp { display: flex; flex-direction: column; gap: 16px; padding: 24px 28px; min-height: 100%; }
.imp-back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; font-size: 13.5px; text-decoration: none; width: -moz-fit-content; width: fit-content; }
.imp-title { margin: 0; font-size: 20px; }
.imp-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.imp-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 8px; background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.imp-steps li.on { background: var(--accent); color: #fff; }
.imp-step-n { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .35); color: #fff; font-size: 11.5px; }
.imp-steps li.done .imp-step-n { background: var(--accent); }
.imp-body { display: flex; flex-direction: column; gap: 16px; flex: 1 1; }
.imp-lead { margin: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.imp-info { display: flex; align-items: center; gap: 10px; max-width: 640px; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.imp-info .sec-link { display: inline; }
.imp-info-i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; flex: none; }
.imp-file { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.imp-file .btn { display: inline-flex; align-items: center; gap: 6px; }
.imp-file-name { font-weight: 600; font-size: 13.5px; }
.imp-options { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.imp-narrow { max-width: 360px; }
.imp-purposes { display: flex; flex-direction: column; gap: 8px; }
.imp-purpose { display: flex !important; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400 !important; margin: 0 !important; }
.imp-purpose.on { border-color: var(--accent); background: var(--accent-soft); }
.imp-purpose input { margin-top: 3px; width: auto !important; flex: none; padding: 0 !important; }
.imp-purpose span { display: flex; flex-direction: column; gap: 2px; }
.imp-purpose small { color: var(--muted); font-size: 12.5px; }
.imp-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; cursor: text; }
.imp-tags input { flex: 1 1; min-width: 120px; border: 0 !important; padding: 2px !important; background: transparent !important; width: auto !important; }
.imp-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; }
.imp-tag button { color: var(--muted); font-size: 14px; line-height: 1; }
.imp-instructions { font-size: 13.5px; }
.imp-instructions ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.imp-overwrite { align-items: flex-start; font-size: 13px; max-width: 760px; }
.imp-map select { width: 100%; min-width: 200px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.imp-map tr.off td { opacity: .5; }
.imp-map .imp-check { width: 40px; text-align: center; }
.imp-progress { display: flex; flex-direction: column; gap: 8px; max-width: 480px; font-size: 13.5px; }
.imp-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.imp-bar div { height: 100%; background: var(--accent); transition: width .2s; }
.imp-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 160px)); grid-gap: 12px; gap: 12px; }
.imp-counts div { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.imp-counts strong { font-size: 24px; }
.imp-counts span { color: var(--muted); font-size: 12.5px; }
.imp-counts .bad strong { color: var(--danger); }
.imp-done { display: flex; flex-wrap: wrap; gap: 10px; }
.imp-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 700px) { .imp-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────────── Exportación de datos ───────────── */
.exp { gap: 16px; }
.exp-field { max-width: 300px; }
.exp-text { margin: 0; font-size: 13.5px; line-height: 1.6; max-width: 1100px; }
.exp-history-head { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.exp-dl { display: inline; }
.exp-page-size { display: inline-flex; align-items: center; gap: 8px; }
.exp-page-size select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.drp { position: relative; }
.drp-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; text-align: left; }
.drp-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); padding: 10px; }
.drp-presets { display: flex; flex-direction: column; gap: 2px; min-width: 140px; padding-right: 10px; }
.drp-presets button { text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; }
.drp-presets button:hover, .drp-presets button.on { background: var(--surface-2); }
.drp-presets button.on { color: var(--accent); }
.drp-cal { display: flex; flex-direction: column; gap: 8px; width: 290px; }
.drp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.drp-head select { background: transparent; border: 0; font-weight: 600; }
.drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-gap: 4px; gap: 4px; text-align: center; }
.drp-wd { color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 0; }
.drp-grid button { height: 34px; border-radius: 8px; font-size: 13px; border: 1px solid transparent; }
.drp-grid button:hover:not(:disabled) { background: var(--surface-2); }
.drp-grid button:disabled { opacity: .35; cursor: not-allowed; }
.drp-grid button.today { border-color: var(--accent); }
.drp-grid button.in { background: var(--accent-soft); }
.drp-grid button.edge { background: var(--accent); color: #fff; }
.drp-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
@media (max-width: 600px) { .drp-pop { flex-direction: column; } .drp-presets { flex-direction: row; flex-wrap: wrap; padding: 0 0 8px; } }

/* ───────────── Menús de la barra lateral, como Respond IO: espacios (arriba), engranaje y cuenta (avatar) ───────────── */
.rail-pop-host { position: relative; }
.rail-pop-host > button { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--rail-text); }
.rail-pop-host > button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail-ws-host { margin-bottom: 14px; }
.rail-ws-host > button.brand { width: 38px; height: 38px; border-radius: 11px; color: #fff; font-size: 16px; border: 2px solid transparent; }
.rail-ws-host > button.brand:hover, .rail-ws-host > button.brand.open { background: linear-gradient(140deg, var(--violet), var(--mint)); border-color: rgba(255, 255, 255, .55); color: #fff; }
.rail-menu.top, .rail-menu.mid { top: 0; bottom: auto; }
.rail-menu.bottom { bottom: 0; }
.rail-menu .grow { flex: 1 1; min-width: 0; }
.rail-search { display: flex; align-items: center; gap: 8px; margin: 2px 2px 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.rail-search input { flex: 1 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font-size: 13.5px; }
.rail-search:focus-within { border-color: var(--accent); }
.rail-org { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.rail-org .icon-btn { width: 30px; height: 30px; }
.rail-ws-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.rail-ws-list button { padding: 9px 10px; border-radius: 8px; text-align: left; font-size: 14px; font-weight: 600; width: 100%; }
.rail-ws-list button:hover { background: var(--surface-2); }
.rail-ws-list button.on { background: var(--accent-soft); color: var(--accent-on-soft); }
.rail-quick { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.rail-quick-t { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 10px; }
.rail-menu .rail-quick a, .rail-menu > button { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 14px; width: 100%; text-align: left; }
.rail-menu .rail-quick a + a { border-top: 0; border-radius: 8px; }
.rail-menu > button:hover { background: var(--surface-2); }
.rail-menu > a + button, .rail-menu > a + a { border-top: 1px solid var(--line); }
.rail-me-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.rail-me-head strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-me-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; flex: none; }
.rail-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.rail-status.online i { background: var(--ok); }
.rail-status.away i { background: var(--warn); }
.rail-status select { border: 0; background: none; color: var(--text); font-size: 13px; font-weight: 600; padding: 0; cursor: pointer; }
.rail .me { position: relative; }
.me-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--rail); background: var(--muted); }
.me-dot.online { background: var(--ok); }
.me-dot.away { background: var(--warn); }
.rail-menu-note { margin: 6px 10px; color: var(--muted); font-size: 12px; }
.rail-menu-note.error { color: var(--danger); }
/* Estadísticas de un flujo */
.wf-stats-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-gap: 10px; gap: 10px; margin-bottom: 14px; }
.wf-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.wf-stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.wf-stat strong { font-size: 24px; line-height: 1.2; }
.wf-stat small { font-size: 12px; color: var(--muted); }
.wf-stat.bad strong { color: var(--danger); }
.wf-stat-bar-col { width: 30%; }
.wf-stat-bar { display: block; height: 8px; min-width: 2px; border-radius: 4px; background: var(--accent); opacity: .7; }
/* Campanita de avisos ("Avisar al equipo" de los flujos) */
.rail-settings > button { position: relative; }
.bell-badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; line-height: 16px; text-align: center; }
.bell-menu { width: 340px; max-height: min(520px, 80vh); display: flex; flex-direction: column; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.bell-head .sec-link { font-size: 12px; }
.bell-permission { margin: 0 10px 6px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; font-size: 12.5px; text-align: left; color: var(--accent); }
.bell-permission:hover { background: var(--surface-2); }
.bell-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.bell-list li + li { border-top: 1px solid var(--line); }
.bell-list button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px; border-radius: 8px; text-align: left; }
.bell-list button:hover { background: var(--surface-2); }
.bell-list button.unread { background: var(--accent-soft); }
.bell-list button span { font-size: 13px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.bell-list button small { font-size: 11.5px; color: var(--muted); }

/* ───────────── Configuración de la organización ───────────── */
.org-users { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.org-user { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.org-user .btn { display: inline-flex; align-items: center; gap: 6px; }
.org-user select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.org-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; flex: none; }
.org-user-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1; min-width: 0; font-size: 13.5px; }
.org-user-main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-user-date { font-size: 12.5px; }
.org-add-row { display: flex; gap: 12px; align-items: flex-start; }
.org-add-row .grow { flex: 1 1; }
.org-role-help { margin: 0; font-size: 13px; }
.org-ws-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.org-ws-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.org-ws-row select { width: auto !important; }
.org-ws-row input[type=checkbox] { width: auto !important; }
.org-ws-name { display: inline-flex; align-items: center; gap: 8px; }
.org-ws-actions { text-align: right; white-space: nowrap; }
.org-ws-actions .btn + .btn { margin-left: 6px; }
.org-ws-help { font-size: 12.5px; margin: 0; }
.org-add-select { min-width: 280px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ───────────── Páginas con barra lateral (Agentes IA, más adelante Flujos de trabajo) ───────────── */
.page-app { display: grid; grid-template-columns: 60px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; height: 100dvh; overflow: hidden; }
.page-app > * { min-height: 0; }
.page-main { overflow-y: auto; background: var(--surface); }
.page-phone-back { display: none; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; padding: 12px 16px 0; }
@media (max-width: 700px) {
  .page-app { grid-template-columns: minmax(0, 1fr); }
  .page-app .rail { display: none; }
  .page-phone-back { display: inline-flex; }
}

/* ───────────── Agentes IA ───────────── */
.ag-name { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.ag-name:hover strong { text-decoration: underline; }
.ag-emoji { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--ai-soft); font-size: 18px; flex: none; }
.ag-name small { display: block; color: var(--muted); font-size: 12.5px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.ag-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ag-status.active { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
:root[data-theme="dark"] .ag-status.active { background: var(--ok-soft); color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-status.active { background: var(--ok-soft); color: var(--ok); } }
.ag-empty { border: 1px dashed var(--line); border-radius: 12px; padding: 32px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ag-empty strong { color: var(--text); font-size: 15px; }

.ag-templates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 10px; gap: 10px; }
.ag-template { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.ag-template:hover { background: var(--surface-2); }
.ag-template.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ag-template strong { font-size: 13.5px; }
.ag-template span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 520px) { .ag-templates { grid-template-columns: minmax(0, 1fr); } }

.ag-editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100%; min-height: 0; }
.ag-editor-main { overflow-y: auto; min-width: 0; }
.ag-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ag-head h1 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ag-head h1 span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-head .grow { flex: 1 1; }
/* Los botones quedan juntos en una línea; si no entran, se achica el nombre y después se oculta "Cambios sin guardar" */
.ag-head-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; white-space: nowrap; }
.ag-head:has(.ag-head-actions) { flex-wrap: nowrap; }
.ag-head:has(.ag-head-actions) h1 { flex: 0 1 auto; }
@media (max-width: 1000px) { .ag-head-actions .ag-dirty { display: none; } }
@media (max-width: 640px) { .ag-head:has(.ag-head-actions) { flex-wrap: wrap; } .ag-head-actions { flex-wrap: wrap; white-space: normal; } }
.ag-body { padding: 22px 24px 40px; max-width: 1000px; display: flex; flex-direction: column; gap: 18px; }
.ag-body textarea, .ag-body input[type="text"], .ag-body input[type="number"] { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.ag-body textarea { resize: vertical; line-height: 1.5; }
.ag-instructions { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; min-height: 360px; }
.ag-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ag-row > .set-field { flex: 1 1; min-width: 160px; }
.ag-emoji-input { width: 72px !important; text-align: center; font-size: 18px; }
.ag-hint { margin: 0; color: var(--muted); font-size: 12.5px; }
.ag-errors { margin: 0; padding: 10px 14px 10px 30px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
:root[data-theme="dark"] .ag-errors { background: var(--danger-soft); color: var(--danger); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-errors { background: var(--danger-soft); color: var(--danger); } }
.ag-choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; }
.ag-choice.on { border-color: var(--accent); background: var(--accent-soft); }
.ag-choice input { margin-top: 3px; accent-color: var(--accent); }
.ag-choice p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
/* Revisión del agente (referencias que no existen, acciones apagadas), como el "Review" de Respond IO */
.ag-review-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
/* Pedidos HTTP del agente */
.ag-http { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.ag-http-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ag-http-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ag-http-url { display: flex; gap: 8px; }
.ag-http-url select { width: 110px; flex: none; }
.ag-http-url input { flex: 1 1; min-width: 0; }
.ag-http-row, .ag-http-input { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.ag-http-row input { flex: 1 1; min-width: 120px; }
.ag-http-input input:first-child { width: 130px; flex: none; }
.ag-http-input select { width: 110px; flex: none; }
.ag-http-input input[aria-label="Descripción del dato"] { flex: 1 1; min-width: 160px; }
.set-field .ag-http-check { display: inline-flex; align-items: center; gap: 4px; width: auto; margin: 0; font-size: 12.5px; font-weight: 400; white-space: nowrap; }
.set-field .ag-http-check input { width: auto; margin: 0; }
.ag-http-add { align-self: flex-start; }
.ag-http-body { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
/* Acción del agente: título de la instrucción y menú para insertar un nombre exacto */
.ag-sec { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); }
.ag-sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ag-sec-head h2 { margin: 0; font-size: 15px; }
.ag-sec-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.ag-sub { font-size: 13px; }
.ag-seg { display: inline-flex; align-self: flex-start; border: 1px solid var(--line); border-radius: 9px; padding: 2px; background: var(--surface-2); }
.ag-seg button { padding: 5px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ag-seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ag-src-list { display: flex; flex-direction: column; gap: 8px; }
.ag-src { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); max-width: 520px; }
.ag-src .grow { flex: 1 1; min-width: 0; }
.ag-src strong, .ag-src small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-src strong { font-size: 13px; }
.ag-src small { color: var(--muted); font-size: 12px; }
.ag-switches { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.ag-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.ag-switch-row strong { display: block; font-size: 13px; }
.ag-switch-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ag-skill { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.ag-skill-head { display: flex; align-items: flex-start; gap: 12px; }
.ag-skill-head .grow { flex: 1 1; min-width: 0; }
.ag-skill-head strong { font-size: 14px; }
.ag-skill-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.ag-skill-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-on-soft); flex: none; }
.ag-skill-names { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.ag-skill-names-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 700; }
.ag-skill-field { display: flex; flex-direction: column; gap: 6px; }
.ag-skill-q { font-size: 12.5px; font-weight: 700; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); }
.ag-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ag-chip.add { padding: 6px 11px; border-radius: 9px; font-weight: 600; background: var(--surface); }
.ag-more-skills { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.ag-more-title { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ag-add-skill { position: relative; flex: none; }
/* Editor con referencias (@ $ % !) como chips, como en Respond IO */
.ref-editor-box { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.ref-editor-box:focus-within { border-color: var(--accent); }
.ref-editor-box.disabled { opacity: .75; }
.ref-editor-wrap { position: relative; }
.ref-editor { min-height: 110px; max-height: 420px; overflow-y: auto; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; font-size: 13.5px; outline: none; }
.ref-editor.tall { min-height: 320px; max-height: 640px; }
.ref-editor-ph { position: absolute; inset: 0; padding: 10px 12px; color: var(--muted); white-space: pre-wrap; line-height: 1.75; font-size: 13.5px; pointer-events: none; opacity: .7; overflow: hidden; }
.ref-chip { display: inline-block; padding: 0 6px; margin: 0 1px; border-radius: 5px; font-size: 12.5px; line-height: 1.6; white-space: nowrap; cursor: default; }
.ref-chip.variable { background: var(--accent); color: #fff; }
.ref-chip.mention { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 600; }
.ref-chip.tag, .ref-chip.flow { background: color-mix(in srgb, var(--muted) 22%, transparent); color: var(--text); }
.ref-chip.file { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--text); }
/* No existe en el espacio (rojo) o existe con un aviso (ámbar: agente en borrador, flujo que no se puede disparar) */
.ref-chip.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); -webkit-text-decoration: underline wavy color-mix(in srgb, var(--danger) 70%, transparent); text-decoration: underline wavy color-mix(in srgb, var(--danger) 70%, transparent); text-underline-offset: 3px; cursor: help; }
.ref-chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-text); cursor: help; }
.ref-editor-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line); }
.ref-editor-bar .grow { flex: 1 1; }
.ref-tool { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: var(--muted); border: 1px solid transparent; }
.ref-tool:hover, .ref-tool.on { background: var(--surface); color: var(--accent); border-color: var(--line); }
.ref-count { font-size: 11.5px; color: var(--muted); }
/* Plantillas y Optimizar (punto 7): botones con texto en la barra */
.ref-tool.wide { width: auto; display: inline-flex; gap: 5px; padding: 0 9px; font-size: 12.5px; font-weight: 700; }
.ref-tool.ai { color: var(--ai); }
.ref-tool.ai:hover:not(:disabled) { color: var(--ai); }
.ref-tool:disabled { opacity: .45; cursor: not-allowed; }
.ref-tool:disabled:hover { background: none; border-color: transparent; }
.modal.wide { width: min(860px, 100%); }
.pt-body { display: grid; grid-template-columns: 260px 1fr; grid-gap: 14px; gap: 14px; min-height: 360px; }
.pt-list { display: flex; flex-direction: column; min-height: 0; }
.pt-list [role="listbox"] { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; max-height: 52vh; }
.pt-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; }
.pt-item strong { font-size: 13.5px; }
.pt-item span { font-size: 12px; color: var(--muted); }
.pt-item:hover { background: var(--surface-2); }
.pt-item.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pt-item.on strong { color: var(--accent); }
.pt-preview, .opt-cols > div { display: flex; flex-direction: column; min-width: 0; }
.pt-preview-t { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.pt-preview .ref-preview, .opt-cols .ref-preview { margin: 0; flex: 1 1; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 13px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-y: auto; max-height: 52vh; }
.pt-foot { flex-direction: row; align-items: center; justify-content: space-between; padding-top: 0; }
.opt-cols { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 12px; gap: 12px; }
.opt-changes { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.opt-warn { font-size: 12.5px; color: var(--warn-text); background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 8px; padding: 7px 10px; }
.modal-actions .grow { flex: 1 1; }
@media (max-width: 720px) { .pt-body, .opt-cols { grid-template-columns: 1fr; } .pt-body { min-height: 0; } }
.ref-count.over { color: var(--danger); font-weight: 700; }
.ref-menu { position: absolute; z-index: 30; top: calc(100% - 4px); left: 8px; width: 300px; max-width: calc(100vw - 40px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ref-menu.right { left: auto; right: 0; top: calc(100% + 6px); }
.ref-menu-title { font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 4px; }
.ref-menu-search { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.ref-menu-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.ref-menu-group { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 6px 4px; text-transform: uppercase; letter-spacing: .03em; }
.ref-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 8px; font-size: 13px; }
.ref-menu-item.on, .ref-menu-item:hover:not(:disabled) { background: var(--accent-soft); }
.ref-menu-item:disabled { opacity: .55; cursor: not-allowed; }
.ref-menu-item small { display: block; color: var(--muted); font-size: 11.5px; }
.ref-menu-label { display: block; }
.ref-menu-emoji { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); flex: none; font-size: 14px; }
.ref-menu-empty { color: var(--muted); font-size: 12.5px; padding: 8px; margin: 0; }

.ag-side { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.ag-side-tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ag-side-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--muted); }
.ag-side-tabs button.on { background: var(--accent-soft); color: var(--accent-on-soft); }
.ag-side-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
.ag-side-body { flex: 1 1; min-height: 0; display: flex; flex-direction: column; }
.ag-side-body[hidden] { display: none; }
.ag-test { flex: 1 1; display: flex; flex-direction: column; min-height: 0; }
.ag-review-panel { flex: 1 1; min-height: 0; display: flex; flex-direction: column; }
.ag-review-title { padding: 14px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ag-review-list { flex: 1 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; }
.ag-review-where { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.ag-review-item { padding: 10px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--warn); font-size: 13px; margin-bottom: 6px; overflow-wrap: anywhere; }
.ag-review-item.error { border-left-color: var(--danger); }
.ag-review-confirm { margin: 12px; padding: 12px; border-radius: 10px; border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); font-size: 13px; }
/* Revisión con IA (punto 8) */
.ag-ai-review { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.ag-ai-review .ag-review-confirm { margin: 0; }
.ag-ai-review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ag-ai-review-head .btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.ag-review-state { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.ag-review-state.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: transparent; }
.ag-review-state.attention { color: var(--warn-text); background: color-mix(in srgb, var(--warn) 15%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
:root[data-theme="dark"] .ag-review-state.ok { color: var(--ok); }
:root[data-theme="dark"] .ag-review-state.attention { color: var(--warn-text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ag-review-state.ok { color: var(--ok); }
  :root:not([data-theme="light"]) .ag-review-state.attention { color: var(--warn-text); }
}
.ag-status-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-review-item.ai { border-left-color: var(--ai); display: flex; flex-direction: column; gap: 6px; }
.ag-review-item.ai p { margin: 0; }
.ag-review-item.ai .ag-review-actions { margin-top: 2px; }
.ag-review-cat { align-self: flex-start; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--ai-soft); color: var(--ai); }
.ag-review-fix { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); white-space: pre-wrap; }
.ag-review-fix del { color: var(--danger); -webkit-text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.ag-review-fix ins { color: var(--ok); text-decoration: none; }
:root[data-theme="dark"] .ag-review-fix ins { color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-review-fix ins { color: var(--ok); } }
.ag-review-chip.muted { color: var(--muted); }
/* AI Assist sobre un mensaje y 👍 / 👎 (punto 17) */
.row.in { position: relative; }
.msg-assist { align-self: center; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ai) 40%, var(--line)); background: var(--surface); color: var(--ai); font-size: 12px; font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity .12s; }
.row.in:hover .msg-assist, .msg-assist:focus-visible { opacity: 1; }
.msg-assist:hover { background: var(--ai-soft); }
@media (hover: none) { .msg-assist { opacity: 1; } }
.msg-assist.busy { opacity: 1; cursor: progress; }
.row.in .msg-assist + .msg-assist { margin-left: -4px; }
/* Traducir un mensaje del cliente (punto 19): pie de la burbuja con "Ver original" */
.msg-tr { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.msg-tr button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.msg-tr button:hover { text-decoration: underline; }
.msg-tr.err { color: var(--danger); }
/* Sentimiento (punto 20): ícono en la lista, línea del hilo y filtro "Último sentimiento" */
.senti { font-size: 13px; line-height: 1; cursor: default; }
.senti-pill { display: inline-flex; align-items: center; gap: 4px; margin: 0 2px; padding: 1px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.senti-pill.positive { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.senti-pill.neutral { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--text); }
.senti-pill.negative { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.list-head .tools select.on { border-color: var(--accent); color: var(--accent); }
.tools.senti-tools { justify-content: flex-start; }
.tools.senti-tools select { flex: 0 1 auto; max-width: 100%; }
.comp-suggest { display: flex; align-items: center; gap: 8px; margin: 8px 12px 0; padding: 6px 6px 6px 10px; border-radius: 9px; background: var(--ai-soft); color: var(--ai); font-size: 12.5px; }
.comp-suggest .grow { flex: 1 1; min-width: 0; color: var(--text); }
.comp-suggest .muted { white-space: nowrap; }
.comp-suggest .icon-btn { width: 28px; height: 28px; font-size: 15px; }
/* Agentes IA: lista como Respond IO (tarjetas, banner del predeterminado y panel lateral; punto 9) */
.ag-list { display: flex; flex-direction: column; gap: 16px; }
.ag-list-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-list-toolbar .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.ag-list-toolbar .grow { flex: 1 1; }
.ag-search { display: inline-flex; align-items: center; gap: 8px; width: min(280px, 100%); padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.ag-search input { flex: 1 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); }
.ag-search:focus-within { border-color: var(--accent); }
.ag-default-banner { display: flex; align-items: center; gap: 14px; max-width: 760px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.ag-default-banner .grow { flex: 1 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ag-default-banner strong { font-size: 14px; }
.ag-default-banner span { font-size: 13px; color: var(--muted); }
.ag-default-banner .btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.ag-default-off { color: var(--warn-text); font-style: normal; }
.ag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); grid-gap: 16px; gap: 16px; }
.ag-card { display: flex; flex-direction: column; min-height: 250px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.ag-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.ag-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; row-gap: 4px; }
.ag-card-top .grow { flex: 1 1; }
.ag-pill { font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.ag-pill.active { background: var(--ok-soft); color: var(--ok); }
.ag-pill.default { background: var(--accent-soft); color: var(--accent-on-soft); }
:root[data-theme="dark"] .ag-pill.active { background: var(--ok-soft); color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-pill.active { background: var(--ok-soft); color: var(--ok); } }
.ag-card-review { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ag-card-review.attention { color: var(--warn-text); }
.ag-card-review.ok { color: var(--ok); }
:root[data-theme="dark"] .ag-card-review.ok { color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-card-review.ok { color: var(--ok); } }
.ag-card-main { flex: 1 1; display: flex; flex-direction: column; gap: 6px; padding: 12px 0 10px; color: inherit; text-decoration: none; min-width: 0; }
.ag-card-main strong { font-size: 14.5px; overflow-wrap: anywhere; }
.ag-card-main p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ag-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ai-soft); font-size: 16px; flex: none; }
.ag-avatar.sm { width: 22px; height: 22px; font-size: 12px; }
.ag-card-foot { display: flex; align-items: center; gap: 6px; }
.ag-card-foot .grow { flex: 1 1; }
.ag-card-foot .btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; text-decoration: none; }
.btn.icon { padding: 5px 7px; display: inline-grid; place-items: center; }
.ag-card-open { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ag-card-menu { position: relative; }
.ag-card-pop { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 20; min-width: 190px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 30px rgba(0, 0, 0, .28); display: flex; flex-direction: column; }
.ag-card-pop button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; text-align: left; font-size: 13.5px; }
.ag-card-pop button + button { border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; }
.ag-card-pop button:hover:not(:disabled) { background: var(--surface-2); }
.ag-card-pop button.danger:not(:disabled) { color: var(--danger); }
.ag-card-pop button:disabled { opacity: .45; cursor: not-allowed; }
/* Panel lateral (drawer) */
.drawer-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(8, 8, 12, .55); display: flex; justify-content: flex-end; }
.drawer { width: min(440px, 100%); height: 100%; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -12px 0 30px rgba(0, 0, 0, .25); animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1 1; overflow-y: auto; display: flex; flex-direction: column; }
.drawer-sec { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.drawer-sec + .drawer-sec { border-top: 1px solid var(--line); }
.drawer-sec h3 { margin: 0; font-size: 14.5px; }
.drawer-sec > p { margin: 0; font-size: 13px; color: var(--muted); }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.drawer-foot .grow { flex: 1 1; }
.btn-link { background: none; border: 0; padding: 4px 2px; font-weight: 600; font-size: 13.5px; color: var(--accent); }
.btn-link.danger { color: var(--danger); }
.btn-link:disabled { opacity: .5; }
.ag-picker { position: relative; width: min(320px, 100%); margin-top: 4px; }
.ag-picker-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); text-align: left; }
.ag-picker-btn .grow { flex: 1 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-picker-btn.open, .ag-picker-btn:focus-visible { border-color: var(--accent); }
.ag-picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; max-height: 300px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 30px rgba(0, 0, 0, .28); display: flex; flex-direction: column; }
.ag-picker-list button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; text-align: left; font-size: 13.5px; }
.ag-picker-list button:hover { background: var(--surface-2); }
.ag-picker-list button.on { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 700; }
.ag-scope-list { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.ag-scope { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ag-scope input { margin-top: 3px; accent-color: var(--accent); }
.ag-scope strong { display: block; font-size: 13.5px; font-weight: 600; }
.ag-scope small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ag-clash { display: flex; gap: 10px; margin-top: 8px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn-text); }
.ag-clash > div { display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: 13px; }
.ag-clash strong { font-size: 13.5px; }
.ag-clash p { margin: 0; }
.ag-clash ul { margin: 2px 0; padding-left: 18px; }
.ag-clash li span { color: var(--muted); }
.ag-clash a { color: var(--accent); font-weight: 700; }
.ag-clash-none { color: var(--muted); }
.ag-clash .ag-clash-link { align-self: flex-end; display: inline-flex; align-items: center; gap: 5px; color: var(--text); text-decoration: none; margin-top: 4px; }
.ag-clash .ag-clash-link:hover { color: var(--accent); }
/* "Escribiendo…" del agente IA (punto 10) */
.row.typing .bub { padding: 10px 14px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 10px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; animation: typing-dot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: .7; } }
.prev.typing { color: var(--ai); font-style: italic; }
.ag-review-chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ok); background: var(--surface); }
.ag-review-chip.warn { color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
:root[data-theme="dark"] .ag-review-chip.warn { color: var(--warn-text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-review-chip.warn { color: var(--warn-text); } }
.ag-test-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ag-test-head strong { font-size: 14px; }
.ag-test-log { flex: 1 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ag-test-note { color: var(--muted); font-size: 12.5px; text-align: center; margin: auto 10px; }
.ag-bub { max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ag-bub.user { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.ag-bub.assistant { align-self: flex-end; background: var(--ai-bub); color: var(--ai-bub-text); }
.ag-act { align-self: flex-end; font-size: 12px; color: var(--ai); background: var(--ai-soft); border-radius: 8px; padding: 4px 9px; max-width: 85%; }
.ag-test-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.ag-test-form textarea { flex: 1 1; resize: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; max-height: 120px; }
/* Probar completo (punto 13): campos del contacto, adjuntos y fuentes usadas */
.ag-test-tabs { display: flex; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ag-test-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ag-test-tabs button.on { background: var(--accent-soft); color: var(--accent-on-soft); }
.ag-test-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
.ag-test-contact { flex: 1 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ag-test-contact .ag-test-note { margin: 0; text-align: left; }
.ag-test-contact label small { font-weight: 400; margin-left: 4px; }
.ag-test-contact .btn { align-self: flex-start; }
.ag-test-media { display: flex; flex-wrap: wrap; gap: 6px; max-width: 85%; }
.ag-test-media.user { align-self: flex-start; }
.ag-test-media img { max-width: 160px; max-height: 120px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.ag-test-file { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-test-file img { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; }
.ag-test-file button { display: grid; place-items: center; color: var(--muted); }
.ag-test-pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; border-top: 1px solid var(--line); background: var(--surface); }
.ag-test-pending + .ag-test-form { border-top: 0; }
.ag-test-form .btn.icon { align-self: center; }
.ag-sources { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 85%; }
.ag-sources > button { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.ag-sources ul { margin: 0; padding: 6px 10px 6px 26px; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.ag-act.muted { color: var(--muted); background: var(--surface-2); }
@media (max-width: 1100px) {
  .ag-editor { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; height: auto; }
  .ag-editor-main { overflow: visible; }
  .ag-side { border-left: 0; border-top: 1px solid var(--line); height: 560px; }
}
@media (max-width: 700px) {
  .ag-head, .ag-body { padding-left: 16px; padding-right: 16px; }
}
.cf-table th .th-pad { display: block; padding: 12px; }
.ag-editor .ag-head h1 .ag-emoji { width: 30px; height: 30px; font-size: 16px; }

/* Ajustes → Canales */
.channels { display: flex; flex-direction: column; gap: 16px; }
.channels .set-card { align-items: stretch; }
.channels .cf-table select { max-width: 260px; }
.channels .set-note.warn { color: var(--text); background: var(--accent-soft); padding: 8px 12px; border-radius: 8px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row code { flex: 1 1; min-width: 0; overflow-wrap: anywhere; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }

/* ───────────── Flujos de trabajo ───────────── */
.ag-status.wf-published { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ag-status.wf-stopped { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
:root[data-theme="dark"] .ag-status.wf-published { background: var(--ok-soft); color: var(--ok); }
:root[data-theme="dark"] .ag-status.wf-stopped { background: var(--warn-soft); color: var(--warn-text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ag-status.wf-published { background: var(--ok-soft); color: var(--ok); }
  :root:not([data-theme="light"]) .ag-status.wf-stopped { background: var(--warn-soft); color: var(--warn-text); }
}

.wf-editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wf-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.wf-head .grow { flex: 1 1; }
.wf-title { display: flex; flex-direction: column; min-width: 0; flex: 0 1 420px; }
.wf-title input { border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 2px 6px; font-weight: 800; font-size: 15px; min-width: 0; }
.wf-title input.wf-desc { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.wf-title input:hover:not(:disabled), .wf-title input:focus { border-color: var(--line); background: var(--surface-2); outline: none; }
.wf-errors { color: var(--danger); font-weight: 800; font-size: 13px; }
/* Avisos (punto 31 del plan): no impiden publicar */
.wf-warns, .wf-node-warn { color: var(--warn-text); font-weight: 800; font-size: 13px; }
.wf-warn { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn-text); font-size: 13px; line-height: 1.4; }
.wf-node.warn { border-color: var(--warn); }
.wf-review { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.wf-review li { display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.4; }
.wf-review-step { align-self: flex-start; font-weight: 700; color: var(--accent); text-align: left; }
.wf-review-step:hover { text-decoration: underline; }
:root[data-theme="dark"] .wf-warns, :root[data-theme="dark"] .wf-node-warn { color: var(--warn-text); }
:root[data-theme="dark"] .wf-warn { background: var(--warn-soft); color: var(--warn-text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wf-warns, :root:not([data-theme="light"]) .wf-node-warn { color: var(--warn-text); }
  :root:not([data-theme="light"]) .wf-warn { background: var(--warn-soft); color: var(--warn-text); }
}
.wf-banner { margin: 8px 16px 0; }

.wf-body { flex: 1 1; min-height: 0; display: flex; position: relative; }
.wf-canvas { flex: 1 1; min-width: 0; position: relative; overflow: hidden; cursor: -webkit-grab; cursor: grab; touch-action: none;
  background-color: var(--surface-2); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 18px 18px; }
.wf-canvas:active { cursor: -webkit-grabbing; cursor: grabbing; }
.wf-plane { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.wf-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.wf-edges path { fill: none; stroke: var(--muted); stroke-width: 1.6; opacity: .6; }
.wf-edges path.open { stroke-dasharray: 4 4; }
.wf-port { position: absolute; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.wf-add { position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--accent); font-weight: 800; line-height: 1; display: grid; place-items: center; z-index: 2; }
.wf-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.wf-add.end { width: 28px; height: 28px; border-style: dashed; }
/* "Mover": los + son destinos y el paso que se mueve queda marcado */
.wf-add.target { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.wf-node.moving { opacity: .55; border-style: dashed; border-color: var(--accent); }
.wf-moving { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); }
.wf-body { position: relative; }
.wf-node { position: absolute; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 1px 3px rgba(20, 24, 40, .06); z-index: 1; }
.wf-node:hover { border-color: var(--accent); }
.wf-node.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.wf-node.err { border-color: var(--danger); }
.wf-node.trigger { background: var(--accent-soft); }
.wf-node-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wf-node-t strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1; }
.wf-node-err { color: var(--danger); }
.wf-node-s { color: var(--muted); font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.wf-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.wf-zoom .icon-btn { width: 30px; height: 30px; font-size: 17px; font-weight: 700; color: var(--text); }

.wf-drawer { width: 400px; max-width: 100%; border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.wf-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.wf-drawer-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.wf-drawer-body .set-field { margin: 0; }
.wf-drawer-body select, .wf-drawer-body input:not([type="checkbox"]), .wf-drawer-body textarea { width: 100%; }
.wf-drawer-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.wf-drawer-foot span { flex: 1 1; font-size: 13px; }

.wf-options { display: grid; grid-template-columns: minmax(0, 1fr); grid-gap: 8px; gap: 8px; }
.modal .wf-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wf-option { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; background: var(--surface); }
.wf-option:hover:not(:disabled) { background: var(--surface-2); }
.wf-option.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.wf-option strong { font-size: 13.5px; }
/* Versiones de un flujo */
.wf-version-now { margin-left: 8px; }
.wf-run-version { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; margin-left: 6px; }
.wf-draft-chip { margin-left: 6px; font-size: 11.5px; padding: 1px 6px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent); background: var(--warn-soft); white-space: nowrap; }
.wf-pending { border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent); background: var(--warn-soft); color: inherit; }
/* "Probar el flujo": lista de conversaciones */
.wf-test-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.wf-test-list .wf-test-conv { cursor: pointer; position: relative; padding-left: 34px; align-items: flex-start; text-align: left; }
.wf-test-conv input { position: absolute; left: 12px; top: 13px; width: auto !important; margin: 0; }
.wf-run-test { font-size: 11px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 0 5px; margin-left: 6px; }
.wf-option span { color: var(--muted); font-size: 12.5px; }
.wf-checks { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.wf-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; cursor: pointer; }
/* Los inputs del panel van a todo el ancho: la casilla no */
.wf-check input { width: auto !important; flex: none; margin: 3px 0 0; }
.wf-row { display: flex; align-items: center; gap: 8px; }
.wf-row > * { min-width: 0; }
.wf-row input[type="number"] { max-width: 110px; }
.wf-num { color: var(--muted); font-weight: 700; width: 22px; flex: none; }
.wf-group + .wf-group { margin-top: 14px; }
.wf-group-t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.wf-day { min-height: 34px; }
.wf-day .wf-check { width: 110px; flex: none; align-items: center; justify-content: flex-start; }
.wf-day .wf-check input { margin: 0; }
.wf-day input[type="time"] { width: 110px; }
/* Plantilla de WhatsApp en "Enviar mensaje" */
.wf-tpl-preview { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; white-space: pre-line; }
/* Solo muestra "$": sin ancho fijo tomaría el de la variable más larga de la lista */
.wf-param-var { width: 58px !important; flex: none; }
/* Pedido HTTP: método, nombre de cabecera y ruta angostos; el campo con "$" ocupa el resto */
.wf-row > .wf-row { flex: 1 1; }
.wf-row > .wf-row > input { flex: 1 1; }
.wf-http-method { width: 92px !important; flex: none; }
.wf-http-key { width: 120px !important; flex: none; }
.wf-gs-header { width: 120px; flex: none; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-gs-account { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; margin-bottom: 8px; }
.wf-gs-title { flex: 1 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; }
/* Atajos (⚡) en el encabezado de la conversación */
.shortcut-pop { width: 280px; }
.shortcut-form { display: flex; flex-direction: column; gap: 8px; padding: 0 4px 4px; }
.shortcut-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 0 4px; }
.shortcut-field input, .shortcut-field select { width: 100%; max-width: none; }
.shortcut-field.check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.shortcut-field.check input { width: auto; flex: none; margin: 0; }
.shortcut-field small { font-weight: 400; }
.shortcut-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 4px; }
/* Galería de plantillas al crear un flujo */
.wf-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-gap: 10px; gap: 10px; }
.wf-template { min-height: 96px; justify-content: flex-start; }
/* Pestañas Editor / Ejecuciones y filtros */
.wf-tabs { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.wf-tab { border: 0; background: transparent; border-radius: 7px; padding: 5px 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.wf-tab:hover { color: var(--text); }
.wf-tab.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(20, 24, 40, .1); }
/* Ejecuciones */
.wf-runs { flex: 1 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
/* Sin recorte: el menú "Acciones" de una fila se abre por fuera de la tabla */
.wf-runs .cf-table-wrap { overflow: visible; }
.wf-runs-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wf-runs-bar .grow { flex: 1 1; }
.wf-run-row { cursor: pointer; }
.wf-run-name { display: inline-flex; align-items: center; gap: 8px; }
.wf-caret { color: var(--muted); font-size: 11px; transition: transform .15s; }
.wf-caret.on { transform: rotate(90deg); }
.wf-run-detail { color: var(--muted); max-width: 360px; }
.wf-run-log-row td { background: var(--surface-2); }
.wf-runs-more { margin: 8px 12px; }
.ag-status.run-running, .ag-status.run-waiting { background: var(--accent-soft); color: var(--accent-on-soft); border-color: transparent; }
.ag-status.run-completed { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ag-status.run-failed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.ag-status.run-stopped, .ag-status.run-exited { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.wf-timeline { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; }
.wf-timeline li { display: grid; grid-template-columns: 64px 14px 1fr; grid-gap: 10px; gap: 10px; align-items: start; position: relative; padding-bottom: 12px; }
.wf-timeline li:not(:last-child)::after { content: ""; position: absolute; left: 80px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.wf-tl-time { color: var(--muted); font-size: 12px; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; padding-top: 1px; }
.wf-tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 4px; justify-self: center; position: relative; z-index: 1; }
.wf-timeline li.err .wf-tl-dot { background: var(--danger); }
.wf-tl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wf-tl-body strong { font-size: 13px; }
.wf-tl-body span { color: var(--muted); font-size: 12.5px; white-space: pre-line; overflow-wrap: anywhere; }
.wf-timeline li.err .wf-tl-body span { color: var(--danger); }
/* Flujos en curso en el panel del contacto */
.cw { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cw-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--accent-soft); }
.cw-main { flex: 1 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cw-name { font-weight: 700; font-size: 13px; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-name:hover { text-decoration: underline; }
.cw-pos { color: var(--muted); font-size: 12px; }
.cw-item.paused { background: var(--surface-2); }
.cw-main .wf-run-test { align-self: flex-start; margin-left: 0; }
/* Intervenir una ejecución: opciones rápidas de "Posponer la espera" */
.run-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-text { display: flex; flex-direction: column; gap: 6px; }
.wf-text textarea { resize: vertical; min-height: 96px; }
.wf-text-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.wf-text-tools select { width: auto !important; font-size: 12.5px; }
.wf-case { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
/* Una condición de "Ramificar": cajita con el ✕ arriba a la derecha (no se va a otra línea) */
.wf-cond { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 32px 8px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.wf-cond select, .wf-cond input { width: auto !important; flex: 1 1 120px; }
.wf-cond > select:first-child { flex-basis: 100%; }
.wf-cond > .icon-btn { position: absolute; top: 8px; right: 4px; }

@media (max-width: 900px) {
  .wf-drawer { position: absolute; inset: 0 0 0 auto; width: min(400px, 100%); z-index: 5; box-shadow: -8px 0 24px rgba(0, 0, 0, .15); }
}
@media (max-width: 520px) {
  .modal .wf-options { grid-template-columns: minmax(0, 1fr); }
  .wf-title { flex-basis: 100%; }
}

/* ───────────── Equipos (Ajustes → Configuración del equipo) ───────────── */
.team-count { margin-left: 6px; font-weight: 500; color: var(--muted); font-size: 12px; }
.team-search { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin-bottom: 6px; }
.team-people { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.set-field .team-people label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500; }
.team-people label:hover { background: var(--surface-2); }
.set-field .team-people input { width: auto; margin: 0; padding: 0; accent-color: var(--accent); }
.team-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.team-av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-on-soft); font-size: 11px; font-weight: 700; border: 2px solid var(--surface); }
.team-members { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.team-stack { display: inline-flex; }
.team-stack .team-av + .team-av { margin-left: -8px; }

/* ───────────── Contactos (docs/plan-contactos.md) ───────────── */
.ct { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100%; min-height: 0; }
.ct-nav { border-right: 1px solid var(--line); }
.ct-nav-sub { margin: 8px 10px 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.ct-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.ct-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ct-toolbar .grow { flex: 1 1; }
.ct-search { display: flex; align-items: center; gap: 8px; width: min(340px, 100%); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; color: var(--muted); }
.ct-search input { flex: 1 1; min-width: 0; border: 0; background: none; padding: 8px 0; outline: none; color: var(--text); }
.ct-add { position: relative; display: inline-flex; }
.ct-add > .btn:first-child { border-radius: 9px 0 0 9px; }
.ct-add-more { border-radius: 0 9px 9px 0; border-left: 1px solid color-mix(in srgb, #fff 30%, transparent) !important; padding: 6px 8px; }
.ct-add .row-menu-pop { min-width: 180px; }
.ct-add .row-menu-pop a { display: block; padding: 8px 10px; border-radius: 7px; color: inherit; text-decoration: none; }
.ct-add .row-menu-pop a:hover { background: var(--surface-2); }
.ct-notice { margin: 10px 16px 0; padding: 8px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 13px; }
.ct-table-wrap { flex: 1 1; min-height: 0; overflow: auto; margin: 12px 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.ct-table th { position: -webkit-sticky; position: sticky; top: 0; z-index: 1; }
.ct-table td { white-space: nowrap; }
.ct-row { cursor: pointer; }
.ct-name { display: inline-flex; align-items: center; gap: 10px; max-width: 260px; }
.ct-name-text { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ct-av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700; overflow: hidden; }
.ct-av img { width: 100%; height: 100%; object-fit: cover; }
.ct-channels { display: inline-flex; gap: 4px; }
.ct-ch { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.ct-ch .ch-icon { stroke: #fff; stroke-width: 2.4; }
.ct-tags { display: inline-flex; gap: 4px; align-items: center; }
.ct-more { font-size: 12px; color: var(--muted); }
.ct-country { font-size: 11.5px; font-weight: 700; letter-spacing: .3px; }
.ct-mono { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.ct-na { color: var(--muted); }
.ct-form-row { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 12px; gap: 12px; }
.ct .cf-pager { padding: 10px 16px 14px; }
@media (max-width: 900px) {
  .ct { grid-template-columns: minmax(0, 1fr); }
  .ct-nav { display: none; }
}
/* Filtros y segmentos de Contactos */
.ct.with-filters { grid-template-columns: 250px minmax(0, 1fr) 360px; }
.ct-filter-btn { position: relative; }
.ct-filter-btn.on { background: var(--accent-soft); color: var(--accent-on-soft); }
.ct-filter-n { position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; line-height: 15px; text-align: center; }
.ct-seg { position: relative; }
.ct-seg .nav-item { padding-right: 34px; }
.ct-seg-menu { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); opacity: 0; }
.ct-seg:hover .ct-seg-menu, .ct-seg-menu:focus-within { opacity: 1; }
.ct-seg-menu .icon-btn { width: 26px; height: 26px; }
.ct-seg-menu .row-menu-pop { right: auto; left: 0; }
.ctf { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.ctf-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ctf-head h2 { flex: 1 1; min-width: 0; margin: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctf-total { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ctf-body { flex: 1 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.ctf-intro { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.ctf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ctf-add { position: relative; }
.ctf-menu { position: absolute; left: 0; top: calc(100% + 4px); z-index: 20; width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); padding: 4px; display: flex; flex-direction: column; }
.ctf-menu button { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 13px; }
.ctf-menu button:hover { background: var(--surface-2); }
.ctf-new { font-size: 11px; font-weight: 700; color: var(--warn-text); background: var(--warn-soft); border-radius: 5px; padding: 1px 6px; }
.ctf-cond { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.ctf-cond.incomplete { border-style: dashed; }
.ctf-cond-head, .ctf-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.ctf-cond-head .icon-btn, .ctf-group-head .icon-btn { width: 24px; height: 24px; }
.ctf-cond select, .ctf-cond input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.ctf-duration { display: grid; grid-template-columns: 90px 1fr; grid-gap: 6px; gap: 6px; }
.ctf-group { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 12px; }
.ctf-group .ctf-add { align-self: flex-start; }
.ctf-op { display: inline-flex; align-self: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 2px auto; }
.ctf-op button { padding: 3px 14px; font-size: 12px; font-weight: 700; color: var(--muted); }
.ctf-op button.on { background: var(--accent); color: #fff; }
.ctf-join { margin: 0; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.ctf-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ctf-foot .grow { flex: 1 1; }
@media (max-width: 1240px) {
  .ct.with-filters { grid-template-columns: minmax(0, 1fr) 340px; }
  .ct.with-filters .ct-nav { display: none; }
}
/* Acciones sobre varios, columnas y exportar (Contactos, etapa 3) */
.ct-check { width: 40px; padding-left: 14px !important; padding-right: 0 !important; }
.ct-check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.ct-table th.ct-check { padding: 12px 0 12px 14px; }
.ct-table tr.on td { background: var(--accent-soft); }
.ct-bulkbar { gap: 8px; background: var(--accent-soft); }
.ct-bulkbar strong { color: var(--accent-on-soft); margin-right: 6px; }
.btn.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn.danger-outline:hover:not(:disabled) { background: var(--danger-soft); }
.ct-select-all { margin: 10px 16px 0; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; text-align: center; }
.ct-more-menu .row-menu-pop { right: 0; min-width: 190px; }
.ct-cols { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 10px; max-height: 360px; overflow-y: auto; }
.ct-cols li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; }
.ct-cols li:hover { background: var(--surface-2); }
.ct-cols li.fixed { justify-content: space-between; padding: 8px 10px; font-weight: 600; }
.ct-cols li.fixed small { color: var(--muted); font-weight: 400; }
.ct-cols label { flex: 1 1; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px; }
.ct-cols input { accent-color: var(--accent); }
.ct-cols-move { display: inline-flex; gap: 2px; }
.ct-cols-move .icon-btn { width: 26px; height: 26px; }
.modal-actions .grow { flex: 1 1; }

/* Esqueleto de carga al cambiar de sección (components/PageSkeleton.tsx) */
@keyframes sk-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.sk { background: var(--surface-2); border-radius: 6px; animation: sk-pulse 1.2s ease-in-out infinite; }
.sk-title { width: 180px; height: 18px; margin-bottom: 8px; }
.sk-line { height: 12px; margin: 6px 0; }
.sk-line.sm { height: 10px; }
.sk-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.sk-grow { flex: 1 1; min-width: 0; }
.sk-inbox .sk-col { padding: 16px 14px; border-right: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.sk-inbox .sk-chat { background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
@media (max-width: 960px) { .sk-inbox > :nth-child(2) { display: none; } }
@media (max-width: 700px) { .sk-inbox .rail, .sk-inbox .sk-chat { display: none; } }

/* ───────────── Reportes (components/reports) ─────────────
   Paleta de los gráficos: la de referencia de la guía de visualización, validada contra las superficies de la app
   (blanco y #242427). Slot 1 azul, 2 naranja; rampa azul para los mapas de calor. */
:root {
  --viz-1: #2a78d6; --viz-2: #eb6834;
  --viz-q1: #cde2fb; --viz-q2: #9ec5f4; --viz-q3: #6da7ec; --viz-q4: #3987e5; --viz-q5: #256abf; --viz-q6: #184f95;
  --viz-grid: #ECECF0; --viz-axis: #C9C9D1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --viz-1: #3987e5; --viz-2: #d95926;
    --viz-q1: #184f95; --viz-q2: #1c5cab; --viz-q3: #256abf; --viz-q4: #3987e5; --viz-q5: #5598e7; --viz-q6: #86b6ef;
    --viz-grid: #313136; --viz-axis: #44444A;
  }
}
:root[data-theme="dark"] {
  --viz-1: #3987e5; --viz-2: #d95926;
  --viz-q1: #184f95; --viz-q2: #1c5cab; --viz-q3: #256abf; --viz-q4: #3987e5; --viz-q5: #5598e7; --viz-q6: #86b6ef;
  --viz-grid: #313136; --viz-axis: #44444A;
}
.rep-soon { color: var(--muted); cursor: default; }
.rep-soon:hover { background: none; }
.rep-soon small { font-size: 11px; margin-left: 4px; opacity: .8; }
.rep-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rep-head .rep-tz { font-size: 12.5px; }
.rep-intro { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; max-width: 900px; }
.rep-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.rep-error { color: var(--danger); font-size: 13.5px; }
.rep-empty { color: var(--muted); font-size: 13px; margin: 8px 0; }
.rep-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.rep-menu-host { position: relative; }
.rep-filter-btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 13.5px; font-weight: 600; }
.rep-filter-btn:hover { background: var(--surface-2); }
.rep-link-btn { font-size: 13.5px; font-weight: 600; padding: 7px 8px; border-radius: 8px; color: var(--text); }
.rep-link-btn:hover { background: var(--surface-2); }
.rep-link-btn.muted { color: var(--muted); }
.rep-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 230px; max-height: 360px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); padding: 5px; }
.rep-menu > button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; }
.rep-menu > button:hover { background: var(--surface-2); }
.rep-menu > button.on { font-weight: 700; }
.rep-check { width: 16px; font-weight: 800; color: var(--accent); }
.rep-menu-foot { border-top: 1px solid var(--line); margin-top: 5px; padding: 8px 6px 4px; display: grid; grid-gap: 8px; gap: 8px; }
.rep-menu-sub { font-size: 12px; color: var(--muted); padding: 4px 6px; }
.rep-custom { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.rep-custom input { border: 1px solid var(--line); border-radius: 7px; padding: 5px 6px; background: var(--surface); color: var(--text); font: inherit; }
.rep-menu-check { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; font-size: 13.5px; cursor: pointer; }
.rep-menu-check:hover { background: var(--surface-2); }
.rep-chip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 13px; }
.rep-chip > button:first-child { padding: 6px 4px 6px 10px; }
.rep-chip strong { font-weight: 700; }
.rep-chip-x { padding: 6px 9px; color: var(--muted); font-size: 15px; line-height: 1; }
.rep-chip-x:hover { color: var(--text); }
.rep-body { display: grid; grid-gap: 16px; gap: 16px; transition: opacity .15s; }
.rep-body.loading { opacity: .55; }
.rep-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 16px; gap: 16px; }
@media (max-width: 1100px) { .rep-grid2 { grid-template-columns: minmax(0, 1fr); } }
.rep-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.rep-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rep-card-head h3 { font-size: 14.5px; margin: 0; display: flex; align-items: center; gap: 6px; }
.rep-info { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 10.5px; font-weight: 800; font-style: italic; cursor: help; }
.rep-groupby { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.rep-groupby select { border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.rep-stats { display: flex; gap: 40px; margin-bottom: 10px; flex-wrap: wrap; }
.rep-stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.rep-stat-value { font-size: 32px; font-weight: 700; line-height: 1.15; }
.rep-stat-delta { font-size: 12.5px; color: var(--muted); }
.rep-chart { position: relative; }
.rep-scroll { position: relative; overflow-x: auto; }
.rep-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.rep-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rep-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.rep-key { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.s1.rep-swatch, .s1.rep-key, .rep-hbar.s1 { background: var(--viz-1); }
.s2.rep-swatch, .s2.rep-key { background: var(--viz-2); }
.rep-bar.s1 { fill: var(--viz-1); }
.rep-bar.s2 { fill: var(--viz-2); }
.rep-grid { stroke: var(--viz-grid); stroke-width: 1; }
.rep-axis { stroke: var(--viz-axis); stroke-width: 1; }
.rep-tick { fill: var(--muted); font-size: 11px; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.rep-band { fill: transparent; }
.rep-band.on { fill: var(--surface-2); }
g[tabindex]:focus { outline: none; }
g[tabindex]:focus-visible .rep-band { fill: var(--accent-soft); }
.rep-tip { position: absolute; top: 18px; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 22px rgba(0, 0, 0, .16); padding: 8px 10px; font-size: 12.5px; white-space: nowrap; }
.rep-tip-title { font-weight: 700; margin-bottom: 4px; }
.rep-tip-row { display: flex; align-items: center; gap: 6px; }
.rep-tip-row span, .rep-tip span { color: var(--muted); }
.rep-heat { display: grid; grid-template-columns: 34px repeat(24, minmax(9px, 1fr)); grid-gap: 2px; gap: 2px; font-size: 10.5px; color: var(--muted); }
.rep-heat-row { display: contents; }
.rep-heat-hour { text-align: left; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.rep-heat-day { display: flex; align-items: center; }
.rep-heat-cell { position: relative; aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.rep-heat-cell.q1 { background: var(--viz-q1); }
.rep-heat-cell.q2 { background: var(--viz-q2); }
.rep-heat-cell.q3 { background: var(--viz-q3); }
.rep-heat-cell.q4 { background: var(--viz-q4); }
.rep-heat-cell.q5 { background: var(--viz-q5); }
.rep-heat-cell.q6 { background: var(--viz-q6); }
.rep-heat-cell.on, .rep-heat-cell:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.rep-tip-cell { top: auto; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); color: var(--text); }
.rep-heat-scale { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 8px; font-size: 11px; color: var(--muted); }
.rep-heat-scale .rep-heat-cell { width: 14px; aspect-ratio: 1; }
.rep-heat-scale span { margin: 0 4px; }
.rep-hbars { list-style: none; margin: 0; padding: 0; display: grid; grid-gap: 8px; gap: 8px; }
.rep-hbars li { display: grid; grid-template-columns: minmax(90px, 32%) minmax(0, 1fr) auto; align-items: center; grid-gap: 10px; gap: 10px; font-size: 13px; }
.rep-hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-hbar-track { height: 14px; }
.rep-hbar { display: block; height: 14px; min-width: 2px; border-radius: 0 4px 4px 0; }
.rep-hbar-value { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rep-hbar-value span { color: var(--muted); margin-left: 4px; }
.rep-table-toggle { margin-top: 10px; font-size: 12.5px; }
.rep-table-toggle summary { cursor: pointer; color: var(--muted); width: -moz-fit-content; width: fit-content; }
.rep-table-wrap { overflow-x: auto; margin-top: 8px; }
.rep-table { border-collapse: collapse; width: 100%; font-size: 12.5px; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.rep-table th, .rep-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep-table th { color: var(--muted); font-weight: 600; }
.rep-table .num { text-align: right; }
.rep-list td a { color: var(--text); font-weight: 600; text-decoration: none; }
.rep-list td a:hover { text-decoration: underline; }
.rep-list td small { display: block; color: var(--muted); font-size: 11px; }
.rep-pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.rep-key.prev { background: var(--muted); }
.rep-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rep-line.s1 { stroke: var(--viz-1); }
.rep-line.prev { stroke: var(--muted); opacity: .7; }
.rep-dot { stroke: var(--surface); stroke-width: 2; }
.rep-dot.s1 { fill: var(--viz-1); }
.rep-dot.prev { fill: var(--muted); }
.rep-cross { stroke: var(--viz-axis); stroke-width: 1; }
.rep-section-t { font-size: 13px; font-weight: 700; color: var(--muted); margin: 6px 0 -4px; }
.rep-stat-value.small { font-size: 22px; padding-top: 6px; }
.rep-tag { margin-left: 6px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }
.rep-rank-n { display: inline-block; min-width: 18px; color: var(--muted); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.rep-toolbar { display: flex; justify-content: flex-end; margin: -8px 0 12px; }
.rep-wrap { white-space: normal !important; min-width: 260px; }
.rep-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; } .rep-seg button { padding: 5px 12px; font-size: 13px; } .rep-seg button.on { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 700; }
.rep-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ───────────── Difusiones (components/broadcasts) ───────────── */
.bc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bc-head h2 { display: flex; align-items: center; gap: 8px; }
.bc-head-actions { display: flex; align-items: center; gap: 8px; }
.bc-search { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 200px; color: var(--text); }
.bc-back { display: inline-block; font-size: 12.5px; color: var(--muted); text-decoration: none; margin-bottom: 4px; }
.bc-back:hover { color: var(--text); }
.bc-empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.bc-empty p { margin: 4px 0; }
.bc-empty strong { color: var(--text); }
.bc-table td { vertical-align: middle; }
.bc-name { color: var(--text); font-weight: 700; text-decoration: none; }
.bc-name:hover { text-decoration: underline; }
.bc-label { display: inline-block; font-size: 11.5px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-right: 4px; }
.bc-row-actions { text-align: right; white-space: nowrap; }
.bc-row-actions .btn { padding: 4px 8px; font-size: 12.5px; }
.bc-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.bc-status::before, .bc-dot { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.bc-status.scheduled::before, .bc-dot.scheduled { background: var(--warn); }
.bc-status.sending::before, .bc-dot.sending { background: var(--info); }
.bc-status.completed::before, .bc-dot.completed { background: var(--ok); }
.bc-status.failed::before, .bc-dot.failed { background: var(--danger); }
.bc-dot.all { background: var(--accent); }
.set-link .bc-dot { margin-right: 6px; }
.bc-count { float: right; color: var(--muted); font-weight: 400; }
.bc-editor { max-width: 900px; display: grid; grid-gap: 16px; gap: 16px; }
.bc-fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-gap: 16px; gap: 16px; min-width: 0; }
.bc-section { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; grid-gap: 12px; gap: 12px; background: var(--surface); }
.bc-section h3 { margin: 0; font-size: 14.5px; }
.bc-row { display: flex; gap: 12px; flex-wrap: wrap; }
.bc-row .grow { flex: 1 1; min-width: 220px; }
.bc-section textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; color: var(--text); font: inherit; }
.bc-audience { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-on-soft); font-size: 13px; }
.bc-audience span { color: inherit; opacity: .85; }
.bc-params { display: grid; grid-gap: 8px; gap: 8px; }
.bc-params-t, .bc-preview-t { font-size: 12.5px; font-weight: 700; }
.bc-param { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bc-param-n { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--muted); min-width: 36px; }
.bc-param select, .bc-param input { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: var(--text); }
.bc-param .grow { flex: 1 1; min-width: 180px; }
.bc-preview { display: grid; grid-gap: 6px; gap: 6px; }
/* Difusiones, etapa 2: cuándo, envío de prueba y avance */
.bc-when { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13.5px; }
.bc-when label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.bc-when input[type="datetime-local"] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: var(--text); }
.bc-test { align-items: center; }
.bc-test-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.bc-test-search { position: relative; max-width: 420px; }
.bc-test-results { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); display: grid; grid-gap: 2px; gap: 2px; }
.bc-test-results button { width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.bc-test-results button:hover, .bc-test-results button:focus-visible { background: var(--surface-2); }
.bc-test-results span { color: var(--muted); margin-left: 6px; }
.bc-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; }
.bc-facts dt { font-size: 12px; color: var(--muted); }
.bc-facts dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; }
.bc-failure { margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.bc-bar { position: relative; height: 22px; border-radius: 11px; background: var(--surface-2); overflow: hidden; }
.bc-bar span { position: absolute; inset: 0 auto 0 0; background: var(--info); opacity: .35; transition: width .4s ease; }
.bc-bar em { position: relative; display: block; text-align: center; font-style: normal; font-size: 12px; line-height: 22px; font-weight: 700; }
.bc-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.bc-stat { display: grid; grid-gap: 2px; gap: 2px; min-width: 96px; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--text); cursor: pointer; }
.bc-stat strong { font-size: 18px; }
.bc-stat span { font-size: 12px; color: var(--muted); }
.bc-stat.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.bc-stat.failed strong { color: var(--danger); }
.bc-stat.read strong, .bc-stat.delivered strong { color: var(--ok); }
.bc-rstatus { font-size: 12px; font-weight: 700; }
.bc-rstatus.pending { color: var(--muted); }
.bc-rstatus.sent { color: var(--info); }
.bc-rstatus.delivered, .bc-rstatus.read { color: var(--ok); }
.bc-rstatus.failed { color: var(--danger); }
.bc-error { color: var(--danger); font-size: 12.5px; }
.bc-stat.replied strong { color: var(--accent); }
/* Reportes → Panel */
.pn-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pn-col { display: grid; grid-gap: 16px; gap: 16px; align-content: start; }
.pn-list { list-style: none; margin: 0; padding: 0; display: grid; grid-gap: 6px; gap: 6px; }
.pn-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pn-list li:last-child { border-bottom: 0; }
.pn-list small { color: var(--muted); white-space: nowrap; }
.pn-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.pn-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pn-status.online::before { background: var(--ok); }
.pn-status.away::before { background: var(--warn); }
.pn-waiting { color: var(--warn-text); }
.pn-unassigned { color: var(--danger); font-weight: 600; }
/* Difusiones, etapa 4: calendario */
.bc-cal { display: grid; grid-gap: 10px; gap: 10px; }
.bc-cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.bc-cal-head .btn { padding: 4px 10px; }
.bc-cal-month { font-size: 15px; min-width: 150px; text-align: center; }
.bc-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bc-cal-wd { padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.bc-cal-day { min-height: 96px; padding: 6px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.bc-cal-day:nth-child(7n) { border-right: 0; }
.bc-cal-day.out { background: var(--surface-2); opacity: .5; }
.bc-cal-day.today .bc-cal-n { background: var(--accent); color: #fff; }
.bc-cal-n { align-self: flex-start; font-size: 12px; font-weight: 700; border-radius: 10px; padding: 1px 6px; }
.bc-cal-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text); text-decoration: none; border-radius: 6px; padding: 2px 4px; background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-cal-item:hover { background: var(--accent-soft); }
.bc-cal-time { color: var(--muted); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.bc-cal-more { font-size: 12px; padding: 0 4px; align-self: flex-start; }
.bc-replied { margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 0 5px; }
.bc-list-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.bc-list-head .btn { margin-left: auto; }
.bc-tag { display: grid; grid-gap: 10px; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.bc-tag h4 { margin: 0; font-size: 13.5px; }
.bc-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.rep-list td small.bc-error { display: block; }
.bc-muted { color: var(--muted); }
.bc-bubble { max-width: 420px; white-space: pre-wrap; background: var(--out); color: var(--out-text); border-radius: 10px 10px 2px 10px; padding: 10px 12px; font-size: 13.5px; justify-self: end; }
.set-note.warn { background: var(--warn-soft); color: var(--warn-text); }

