/* DITRONICS Business OS — estilos base. Sin paso de compilación: funciona igual en local y en Hostinger. */
[hidden] { display: none !important; }
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --sunk: #e9edf2;
  --line: #d6dce4;
  --fg: #16202c;
  --muted: #5b6878;
  --accent: #1f5fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e3ecfb;
  --rail: #121a24;
  --rail-fg: #c9d3df;
  --rail-muted: #7d8b9b;
  --rail-active: #22303f;
  --good: #1d7f4e;
  --good-soft: #dcf1e6;
  --warn: #a86400;
  --warn-soft: #fbecd2;
  --bad: #b8322a;
  --bad-soft: #f8dedb;
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b; --surface: #16202b; --sunk: #1c2835; --line: #2a3848; --fg: #e6ecf2; --muted: #93a1b2;
    --accent: #6f9cf0; --accent-ink: #0b1220; --accent-soft: #1b2c48; --rail: #0a0f15; --rail-fg: #aab6c4; --rail-active: #1a2531;
    --good: #5cc98f; --good-soft: #163427; --warn: #e9a947; --warn-soft: #3a2a12; --bad: #ef7a70; --bad-soft: #3d1c1a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: 24px; line-height: 1.2; margin: 0; text-wrap: balance; }
h2 { font-family: var(--font-display); font-stretch: 90%; font-weight: 650; font-size: 16px; margin: 0; }
h3 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--rail); color: var(--rail-fg); padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 2px 10px 14px; text-decoration: none; }
.brand b { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 19px; letter-spacing: .04em; color: #fff; }
.brand span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--rail-muted); white-space: nowrap; }
.nav-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; padding: 12px 10px 4px; color: var(--rail-muted); }
.nav a, .nav span.soon { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 7px; color: var(--rail-fg); text-decoration: none; }
.nav a:hover { background: var(--rail-active); color: #fff; }
.nav a.active { background: var(--rail-active); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav a.sub, .nav span.sub { padding-left: 24px; }
.nav span.soon { color: var(--rail-muted); cursor: default; }
.nav .tag { font-size: 10px; border: 1px solid #33465b; border-radius: 99px; padding: 0 6px; color: var(--rail-muted); }
.rail-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #22303f; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 12px; flex: none; }
.rail-foot .who { min-width: 0; font-size: 12.5px; }
.rail-foot .who b { display: block; color: #fff; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-foot button { background: none; border: 0; color: var(--rail-muted); padding: 0; cursor: pointer; text-decoration: underline; font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(10, 20, 35, .18); padding: 8px; max-height: 60vh; overflow: auto; z-index: 30; }
.results h4 { margin: 8px 8px 4px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.results a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 8px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.results a:hover { background: var(--sunk); }
.env-badge { font-size: 11.5px; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.page { padding: 22px 24px 48px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card.flush { padding: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.g-23 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.kpi .label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi .value { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: 26px; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 8px; font-weight: 500; text-decoration: none; color: var(--fg); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 99px; background: var(--sunk); color: var(--fg); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.flash { border-radius: 8px; padding: 10px 14px; font-size: 13.5px; }
.flash.ok { background: var(--good-soft); color: var(--good); }
.flash.err { background: var(--bad-soft); color: var(--bad); }
.flash ul { margin: 0; padding-left: 18px; }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; }
.row .meta { font-size: 12.5px; color: var(--muted); }
.stripe { width: 3px; align-self: stretch; border-radius: 3px; flex: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td a.strong { color: var(--fg); font-weight: 500; text-decoration: none; }
td a.strong:hover { color: var(--accent); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* Formularios */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea, .input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); width: 100%; }
.field textarea { min-height: 84px; resize: vertical; }
.field .help { font-size: 12px; color: var(--muted); }
.field.error input, .field.error select, .field.error textarea { border-color: var(--bad); }
.field .err { font-size: 12px; color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters .field { width: auto; min-width: 140px; }
.filters .field input, .filters .field select { padding: 6px 8px; }
.inline-form { display: inline; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--sunk); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 420px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { padding: 2px 4px 8px; border-bottom: 3px solid var(--stage, var(--line)); }
.col-head b { font-family: var(--font-display); font-stretch: 90%; font-weight: 650; }
.col-head .sum { font-size: 12px; color: var(--muted); display: block; font-variant-numeric: tabular-nums; }
.deal { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 5px; cursor: grab; }
.deal[draggable="false"] { cursor: default; }
.deal.dragging { opacity: .5; }
.deal.alert { border-left: 3px solid var(--bad); }
.deal .t { font-weight: 500; color: var(--fg); text-decoration: none; }
.deal .t:hover { color: var(--accent); }
.deal .f { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.timeline .ico.won { background: var(--good-soft); color: var(--good); }
.timeline .ico.lost { background: var(--bad-soft); color: var(--bad); }
.timeline .what small { display: block; color: var(--muted); font-size: 12px; }

.dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--sunk); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 3px; }
.bar .fill.bad { background: var(--bad); }
.bar .v { text-align: right; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; font-weight: 500; }
.tabs a.active { color: var(--fg); border-bottom-color: var(--accent); }

dialog { border: 0; border-radius: 12px; padding: 20px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); }
dialog::backdrop { background: rgba(8, 14, 22, .55); }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
.reasons label { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 60; }

.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; padding: 12px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); text-decoration: none; color: var(--fg); font-size: 13px; }
.pagination span.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pagination span.disabled { color: var(--muted); }

.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Lanzador ERP */
.launcher { max-width: 1080px; margin: 0 auto; padding: 32px 24px; display: flex; flex-direction: column; gap: 22px; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; gap: 6px; }
a.module:hover { border-color: var(--accent); }
.module.off { opacity: .6; }
.module b { font-family: var(--font-display); font-stretch: 88%; font-size: 18px; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(400px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-32, .g-23, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; }
  .menu-btn { display: grid; place-items: center; width: 36px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
  .top { padding: 10px 16px; }
  .page { padding: 18px 16px 40px; }
  .g-2, .g-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 96px minmax(0, 1fr) 56px; }
  .env-badge { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Edición de etapas en el tablero */
.col-edit { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 10px; border-bottom: 3px solid var(--stage, var(--line)); }
.col-edit .input { padding: 5px 8px; font-size: 13px; }
.col-edit input[type="color"] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); flex: none; }
.stage-line { display: flex; align-items: center; gap: 6px; }
.stage-line form { display: inline; }
.col-new { background: transparent; border: 2px dashed var(--line); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.col-head .tip { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.35; }

/* ---------- Inbox de chats (1C) ---------- */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 280px; gap: 12px; height: calc(100vh - 120px); min-height: 480px; }
.inbox:not(.has-chat) { grid-template-columns: 320px minmax(0, 1fr); }
.inbox-list, .inbox-chat, .inbox-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 0; }
.inbox-list { display: flex; flex-direction: column; overflow: hidden; }
.inbox-filters { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.inbox-filters input[type=search] { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg a { font-size: 12.5px; padding: 3px 9px; border-radius: 99px; text-decoration: none; color: var(--muted); background: var(--sunk); }
.seg a.active { background: var(--accent); color: var(--accent-ink); }
.chats { overflow-y: auto; flex: 1; }
.chat { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; align-items: flex-start; }
.chat:hover { background: var(--sunk); }
.chat.active { background: var(--accent-soft); }
.chat .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat .top-line { display: flex; justify-content: space-between; gap: 6px; }
.chat .top-line b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat time { font-size: 11.5px; color: var(--muted); flex: none; }
.chat .preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat.unread .preview { color: var(--fg); font-weight: 500; }
.chat .tags { display: flex; gap: 4px; }
.chat .badge { background: var(--good); color: #fff; border-radius: 99px; font-size: 11px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; }
.inbox-chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head .back { display: none; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.bubble { max-width: min(78%, 560px); padding: 7px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; word-wrap: break-word; }
.bubble.out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.bubble.failed { border-color: var(--bad); }
.bubble img, .bubble video { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; }
.bubble audio { max-width: 260px; }
.bubble .meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.bubble .ticks.st-read { color: #2a8af6; }
.bubble .ticks.st-failed { color: var(--bad); }
.bubble .err { color: var(--bad); }
.chat-foot { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; }
.chat-foot form#replyForm { display: flex; gap: 8px; align-items: flex-end; }
.chat-foot textarea { flex: 1; resize: vertical; min-height: 42px; max-height: 200px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.window-note { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.tpl summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.tpl-form { display: grid; gap: 6px; margin-top: 6px; }
.tpl-form select, .tpl-form textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.inbox-side { padding: 10px; overflow-y: auto; display: grid; gap: 10px; align-content: start; background: transparent; border: 0; }
.inbox-side h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
@media (max-width: 1100px) { .inbox, .inbox.has-chat { grid-template-columns: 300px minmax(0, 1fr); } .inbox-side { display: none; } }
@media (max-width: 760px) {
  .inbox, .inbox.has-chat { grid-template-columns: 1fr; height: calc(100vh - 110px); }
  .inbox.has-chat .inbox-list { display: none; }
  .inbox:not(.has-chat) .inbox-chat { display: none; }
  .chat-head .back { display: inline-flex; }
}

/* ===== Tablero estilo Kommo: un pipeline para todas las redes, logo del canal en cada tarjeta ===== */
:root { --kb-link: #0057a9; --kb-border: rgba(0, 0, 0, .2); --kb-tag: #92989b; --kb-tag-line: #e8eaeb; --kb-bubble: #e5eeff; }
@media (prefers-color-scheme: dark) { :root { --kb-link: #7fb0f0; --kb-border: rgba(255, 255, 255, .16); --kb-tag: #9aa6b4; --kb-tag-line: #2f3d4d; --kb-bubble: #1d2c44; } }
.kanban { grid-auto-columns: minmax(260px, 300px); gap: 10px; }
.kanban .col { background: transparent; padding: 0 1px 8px; gap: 6px; border-radius: 0; }
.kanban .col.over { background: var(--accent-soft); }
.kanban .col-head { text-align: center; padding: 4px 4px 7px; border-bottom: 2px solid var(--stage, var(--line)); }
.kanban .col-head b { display: block; font: 700 12px/1.4 var(--font); text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.kanban .col-head .sum { font-size: 13px; color: var(--muted); }
.col-tip { margin: 4px 4px 2px; font-size: 12.5px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.deal.kb { border: 1px solid var(--kb-border); border-radius: 4px; padding: 6px 8px; gap: 1px; }
.deal.kb:hover { border-color: var(--accent); }
.kb-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 16px; }
.kb-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kb-date { color: var(--kb-tag); white-space: nowrap; flex: none; }
.kb-title { color: var(--kb-link); font-size: 15px; line-height: 19px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-title:hover { text-decoration: underline; }
.kb-price { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kb-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 18px; margin-top: 2px; }
.kb-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.kb-tag { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 5px; border: 1px solid var(--kb-tag-line); border-radius: 4px; font-size: 12px; color: var(--kb-tag); white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.kb-tag.kb-ch { color: var(--fg); border-color: color-mix(in srgb, var(--ch) 45%, transparent); background: color-mix(in srgb, var(--ch) 10%, transparent); }
.kb-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; background: #e4b248; }
.kb-dot.ok { background: #6bbf59; }
.kb-dot.late { background: #e4574b; }
.kb-in-row { display: flex; gap: 8px; align-items: flex-start; }
.kb-ava { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--sunk); color: var(--muted); display: grid; place-items: center; font: 700 14px var(--font); margin-top: 2px; }
.kb-ava-ch { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--surface); }
.kb-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.kb-msg { align-self: flex-start; max-width: 100%; margin-top: 3px; padding: 4px 9px 4px 9px; border-radius: 50px; background: var(--kb-bubble); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-wait { font-size: 12px; font-variant-numeric: tabular-nums; }
.kb-wait.good { color: var(--good); } .kb-wait.warn { color: var(--warn); } .kb-wait.bad { color: var(--bad); font-weight: 600; }
.kb-actions { display: inline-flex; gap: 4px; }
.btn.xs { padding: 1px 7px; font-size: 12px; border-radius: 4px; }
.ch-ico { flex: none; display: block; }
.ch-filter { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.ch-filter a { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; font-size: 13px; color: var(--muted); text-decoration: none; border-right: 1px solid var(--line); }
.ch-filter a:last-child { border-right: 0; }
.ch-filter a span { font-variant-numeric: tabular-nums; }
.ch-filter a.on { background: var(--accent-soft); color: var(--fg); font-weight: 600; }

/* Respuestas rápidas en el chat */
.qr { position: relative; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.qr-chip { font-size: 12.5px; background: var(--accent-soft); color: var(--fg); border-radius: 50px; padding: 2px 10px; cursor: pointer; }
.qr-panel { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; width: min(460px, 100%); max-height: 340px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 8px; }
.qr-panel input { width: 100%; margin-bottom: 6px; }
.qr-panel ul { list-style: none; margin: 0; padding: 0; }
.qr-panel li button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 8px; cursor: pointer; color: var(--fg); }
.qr-panel li button:hover, .qr-panel li button:focus-visible { background: var(--sunk); }
.qr-panel li button span:last-child { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-panel .pill { font-size: 10.5px; margin-left: 4px; }
.bot-step .card-head h2 { font-size: 15px; }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.chat-foot form#replyForm { flex-wrap: wrap; }
.chat-foot form#replyForm .qr { flex: 0 0 100%; }
.chat-foot form#replyForm textarea { flex: 1 1 200px; }

/* Editor de bots */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bot-step { scroll-margin-top: 70px; }
.bot-step:target { outline: 2px solid var(--accent); outline-offset: 2px; }
.bot-buttons { display: grid; gap: 8px; margin-top: 10px; }
.bot-button { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(180px, 2fr) minmax(130px, 1fr) auto; gap: 8px; align-items: end; padding: 8px; background: var(--sunk); border-radius: 8px; }
.bot-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 10px; }
.bot-links select, .bot-button select { width: 100%; }
.bot-add { margin-top: 10px; }
.bot-add summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.bot-add .actions { margin-top: 8px; }
.bot-save { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; z-index: 5; }
.bot-question { border-left: 3px solid var(--accent); }
.bot-wait { border-left: 3px solid var(--warn); }
.bot-ai { border-left: 3px solid #8b5cf6; }
@media (max-width: 760px) { .bot-button { grid-template-columns: 1fr; } }

/* Inteligencia artificial */
.ai-meter { height: 6px; background: var(--sunk); border-radius: 99px; overflow: hidden; margin-top: 4px; max-width: 260px; }
.ai-meter span { display: block; height: 100%; background: var(--accent); }
.ai-howto { margin-top: 10px; background: var(--sunk); border-radius: 8px; padding: 10px 12px; }
.ai-howto summary { cursor: pointer; }
.ai-howto ol { margin: 8px 0; padding-left: 18px; display: grid; gap: 4px; }
.ai-features { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; margin: 0; }
.ai-features legend { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
.ai-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ai-tools .btn[disabled] { opacity: .55; cursor: not-allowed; }
.ai-summary { white-space: pre-wrap; font-size: 13px; margin: 6px 0; }
.qr-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-size: 12.5px; }
.qr-foot input { flex: 1 1 160px; margin: 0 !important; }
.qr-empty { padding: 6px 8px; font-size: 12.5px; color: var(--muted); }
