/* SkyVentas — panel */
:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9edf2;
  --border: #e2e6eb;
  --border-strong: #cdd4dc;
  --text: #0f1720;
  --text-2: #4a5563;
  --muted: #7b8794;
  --brand: #0c8f63;
  --brand-hover: #0a7a55;
  --brand-ink: #ffffff;
  --brand-soft: #e3f5ee;
  --brand-text: #08724f;
  --bot: #6250d6;
  --bot-soft: #eeebfc;
  --out-bubble: #dff6ea;
  --out-bubble-bot: #ecebfb;
  --in-bubble: #ffffff;
  --note: #fff6d6;
  --note-border: #f1dc8a;
  --good: #0a8a0a;
  --good-soft: #e3f6e3;
  --warn: #9a6400;
  --warn-soft: #fff1d2;
  --bad: #c62f2f;
  --bad-soft: #fde7e7;
  --info: #2a78d6;
  --info-soft: #e5effc;
  --shadow: 0 1px 2px rgba(15, 23, 32, .06), 0 4px 16px rgba(15, 23, 32, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 32, .18);
  --radius: 14px;
  --radius-sm: 10px;
  /* gráficas (paleta validada) */
  --viz-surface: #fcfcfb;
  --viz-series: #2a78d6;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-muted: #898781;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f14;
    --surface: #121821;
    --surface-2: #18202b;
    --surface-3: #212b38;
    --border: #243041;
    --border-strong: #33425a;
    --text: #e8eef5;
    --text-2: #a9b6c6;
    --muted: #708096;
    --brand: #1fb27e;
    --brand-hover: #27c58c;
    --brand-ink: #04140d;
    --brand-soft: #0f2c21;
    --brand-text: #4fd3a0;
    --bot: #9085e9;
    --bot-soft: #221f3d;
    --out-bubble: #123526;
    --out-bubble-bot: #232046;
    --in-bubble: #18202b;
    --note: #2f2a14;
    --note-border: #5b4f1d;
    --good: #3cc23c;
    --good-soft: #10291a;
    --warn: #f0b23a;
    --warn-soft: #2e2410;
    --bad: #ef6a6a;
    --bad-soft: #341616;
    --info: #5d9ff0;
    --info-soft: #14243a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
    --viz-surface: #1a1a19;
    --viz-series: #3987e5;
    --viz-grid: #2c2c2a;
    --viz-axis: #383835;
    --viz-muted: #898781;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #121821;
  --surface-2: #18202b;
  --surface-3: #212b38;
  --border: #243041;
  --border-strong: #33425a;
  --text: #e8eef5;
  --text-2: #a9b6c6;
  --muted: #708096;
  --brand: #1fb27e;
  --brand-hover: #27c58c;
  --brand-ink: #04140d;
  --brand-soft: #0f2c21;
  --brand-text: #4fd3a0;
  --bot: #9085e9;
  --bot-soft: #221f3d;
  --out-bubble: #123526;
  --out-bubble-bot: #232046;
  --in-bubble: #18202b;
  --note: #2f2a14;
  --note-border: #5b4f1d;
  --good: #3cc23c;
  --good-soft: #10291a;
  --warn: #f0b23a;
  --warn-soft: #2e2410;
  --bad: #ef6a6a;
  --bad-soft: #341616;
  --info: #5d9ff0;
  --info-soft: #14243a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
  --viz-surface: #1a1a19;
  --viz-series: #3987e5;
  --viz-grid: #2c2c2a;
  --viz-axis: #383835;
  --viz-muted: #898781;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--brand-soft); }

/* ------------------------------------------------------------ estructura */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; height: 100dvh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 17px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #2a78d6); color: #fff;
}
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text-2);
  font-weight: 500; margin: 1px 0; text-decoration: none; position: relative;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.nav a .count {
  margin-left: auto; background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 11px;
  font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav a .count.alert { background: var(--bad); color: #fff; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sidebar-foot .who span { font-size: 12px; color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 20px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex: none;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 22px; min-height: 0; }
.content.flush { padding: 0; overflow: hidden; display: flex; }
.page { max-width: 1180px; margin: 0 auto; }
.banner {
  background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--border); padding: 8px 20px;
  font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.banner > span { flex: 1; min-width: 0; }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }

/* ------------------------------------------------------------ controles */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.sm svg { width: 15px; height: 15px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span, .field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date],
input[type=time], input[type=tel], select, textarea {
  width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  padding: 0 11px; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; margin-bottom: 10px; }
.check input { margin-top: 2px; flex: none; }
.check small { display: block; color: var(--muted); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; margin: 0; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { left: 19px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card h2, .section-title { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
.card h3 { font-size: 14px; margin: 0 0 8px; }
.card + .card { margin-top: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { max-width: 280px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs button {
  border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand-text); border-bottom-color: var(--brand); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-weight: 600;
  font-size: 13px; cursor: pointer; color: var(--text-2);
}
.pill.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.pill svg, .chip svg { width: 14px; height: 14px; }
.pill .n { margin-left: 4px; color: var(--muted); font-weight: 700; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.5;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.bot { background: var(--bot-soft); color: var(--bot); }
.chip.brand { background: var(--brand-soft); color: var(--brand-text); }
.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.tag i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .55; margin-bottom: 8px; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  color: #fff; flex: none; text-transform: uppercase;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }

/* ------------------------------------------------------------ indicadores */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hero { font-size: 52px; font-weight: 650; letter-spacing: -.02em; line-height: 1.05; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

.viz { background: transparent; border-radius: 10px; position: relative; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz .gridline { stroke: var(--viz-grid); stroke-width: 1; }
.viz .baseline { stroke: var(--viz-axis); stroke-width: 1; }
.viz .tick { fill: var(--viz-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .bar { fill: var(--viz-series); }
.viz .hit { fill: transparent; cursor: default; }
.viz .hit:hover + .bar, .viz g.on .bar { opacity: .85; }
.viz-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 5;
}
.viz-tip b { display: block; font-size: 13px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; margin-bottom: 10px; }
.hbar .name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .val { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: transparent; border-radius: 0 4px 4px 0; }
.hbar .fill { height: 8px; background: var(--viz-series); border-radius: 0 4px 4px 0; min-width: 2px; }

/* ------------------------------------------------------------ modales y avisos */
.overlay {
  position: fixed; inset: 0; background: rgba(8, 12, 18, .45); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 50; animation: fade .12s ease-out;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column; border: 1px solid var(--border); animation: pop .14s ease-out;
}
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 12px; padding: 11px 14px;
  box-shadow: var(--shadow-lg); animation: pop .16s ease-out; cursor: pointer; font-weight: 500;
}
.toast.error { border-left-color: var(--bad); }
.toast.info { border-left-color: var(--info); }
.toast.sale { border-left-color: var(--good); }
.secret-box { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 15px; display: flex; align-items: center; gap: 10px; word-break: break-all; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 8px; }
.callout { border-radius: 12px; padding: 12px 14px; background: var(--info-soft); color: var(--text); border: 1px solid var(--border); margin-bottom: 14px; font-size: 13px; }
.callout.warn { background: var(--warn-soft); }
.callout.bad { background: var(--bad-soft); }
.callout.good { background: var(--good-soft); }

/* ------------------------------------------------------------ login */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card .brand { padding: 0 0 18px; font-size: 20px; }
.auth-card .brand-logo { width: 40px; height: 40px; border-radius: 12px; }
.err { color: var(--bad); font-weight: 600; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ------------------------------------------------------------ bandeja */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; width: 100%; height: 100%; min-height: 0; }
.inbox.no-details { grid-template-columns: 340px minmax(0, 1fr); }
.inbox.no-details .details { display: none; }
.conv-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }
.conv-list .head { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.conv-list .filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.conv-list .filters .pill { padding: 4px 10px; font-size: 12.5px; }
.conv-items { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 11px; padding: 11px 12px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--brand-soft); }
.conv-item .body { min-width: 0; flex: 1; }
.conv-item .top { display: flex; align-items: baseline; gap: 6px; }
.conv-item .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv-item .time { font-size: 11.5px; color: var(--muted); flex: none; }
.conv-item .preview { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.conv-item .meta { display: flex; gap: 5px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.conv-item .unread { background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.conv-item.has-unread .name { color: var(--text); }
.conv-item.has-unread .preview { color: var(--text); font-weight: 500; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); container-type: inline-size; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 58px; }
.chat-head .btn, .chat-head select { flex: none; }
@container (max-width: 700px) {
  .chat-head .lbl, .composer .q-hint { display: none; }
  .chat-head select { max-width: 120px; }
}
.chat-head .who { min-width: 70px; flex: 1; }
.chat-head .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 480px) {
  .chat-head { gap: 6px; padding: 8px 10px; }
  .chat-head .avatar { display: none; }
  .chat-head select { max-width: 96px; }
}
.back-btn { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 12px; margin: 10px 0; font-weight: 600; }
.bubble-row { display: flex; flex-direction: column; max-width: min(78%, 560px); }
.bubble-row.in { align-self: flex-start; }
.bubble-row.out { align-self: flex-end; align-items: flex-end; }
.bubble-row.note { align-self: center; max-width: min(90%, 620px); }
.who-label { font-size: 11px; color: var(--muted); margin: 6px 6px 2px; font-weight: 600; }
.who-label.bot { color: var(--bot); }
.bubble {
  padding: 7px 10px 6px; border-radius: 12px; background: var(--in-bubble); border: 1px solid var(--border);
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; position: relative; box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}
.bubble-row.out .bubble { background: var(--out-bubble); border-color: transparent; }
.bubble-row.out.bot .bubble { background: var(--out-bubble-bot); }
.bubble-row.note .bubble { background: var(--note); border: 1px solid var(--note-border); font-size: 13px; }
.bubble .foot { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 2px; float: right; margin-left: 10px; position: relative; top: 4px; }
.bubble .foot .ticks { font-size: 12px; letter-spacing: -3px; margin-right: 2px; }
.bubble .foot .ticks.read { color: #2a9df4; }
.bubble.failed { border: 1px solid var(--bad) !important; }
.bubble .fail { color: var(--bad); font-size: 12px; font-weight: 600; display: block; margin-top: 4px; }
.bubble img.media { display: block; max-width: 280px; max-height: 320px; border-radius: 8px; margin-bottom: 4px; cursor: zoom-in; background: var(--surface-3); }
.bubble audio { width: 260px; max-width: 100%; display: block; }
.bubble .doc { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(127, 127, 127, .12); margin-bottom: 4px; }
.bubble .transcript { font-size: 12.5px; color: var(--text-2); font-style: italic; margin-top: 4px; display: block; }
.typing { align-self: flex-start; color: var(--bot); font-size: 12.5px; font-weight: 600; padding: 4px 8px; }
.typing i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-left: 3px; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 12px; position: relative; }
.composer .modes { display: flex; gap: 6px; margin-bottom: 8px; align-items: center; }
.composer .box { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 42px; max-height: 180px; height: 42px; resize: none; border-radius: 12px; }
.composer.note-mode textarea { background: var(--note); border-color: var(--note-border); }
.quick-pop { position: absolute; bottom: calc(100% - 4px); left: 12px; right: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; z-index: 10; }
.quick-pop div { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.quick-pop div:hover, .quick-pop div.sel { background: var(--surface-2); }
.quick-pop b { color: var(--brand-text); margin-right: 6px; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }

.details { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 16px; min-height: 0; }
.details .close-details { display: none; float: right; }
.details h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.details h4:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.mini-order { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; font-size: 13px; cursor: pointer; }
.mini-order:hover { background: var(--surface-2); }

/* ------------------------------------------------------------ catálogo, tablero, simulador */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.product { overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: transform .12s; }
.product:hover { transform: translateY(-2px); }
.product .ph { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.product .ph img { width: 100%; height: 100%; object-fit: cover; }
.product .info { padding: 12px 14px 14px; }
.product .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product .price { font-weight: 700; font-size: 16px; margin-top: 2px; }
.product .price s { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }
.product.off { opacity: .55; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 92px; height: 92px; border-radius: 10px; overflow: hidden; position: relative; border: 1px solid var(--border); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .acts { position: absolute; inset: auto 4px 4px 4px; display: flex; gap: 3px; justify-content: center; }
.thumb .acts button { border: 0; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; width: 24px; height: 22px; cursor: pointer; font-size: 12px; }
.thumb.add { display: grid; place-items: center; border-style: dashed; cursor: pointer; color: var(--muted); }
.var-row { display: grid; grid-template-columns: 1fr 120px 100px 34px; gap: 8px; margin-bottom: 8px; }
.faq-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 160px; }
.col.drop { outline: 2px dashed var(--brand); outline-offset: -4px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 650; }
.lead { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 10px 11px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.lead:active { cursor: grabbing; }
.lead b { display: block; }
.lead .meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }

.bot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.phone { background: var(--surface); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; height: min(680px, calc(100dvh - 190px)); position: sticky; top: 0; }
.phone-head { background: var(--brand); color: var(--brand-ink); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.phone-head b { flex: 1; }
.phone .msgs { background: var(--bg); }
.phone .composer { border-top: 1px solid var(--border); }

.qr-box { display: grid; place-items: center; min-height: 290px; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.qr-box img { width: 264px; height: 264px; image-rendering: pixelated; }
.channel { display: flex; gap: 14px; align-items: flex-start; }
.channel .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.channel .ic svg { width: 22px; height: 22px; }
.perm-group { margin-bottom: 12px; }
.perm-group > b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); display: grid; place-items: center; z-index: 90; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { padding: 40px; text-align: center; color: var(--muted); }

svg.i { width: 19px; height: 19px; flex: none; }

/* ------------------------------------------------------------ móvil */
@media (max-width: 1440px) {
  .inbox, .inbox.no-details { grid-template-columns: 320px minmax(0, 1fr); }
  .inbox .details { display: none; }
  .inbox.show-details .details { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 92vw); z-index: 40; box-shadow: var(--shadow-lg); }
  .inbox.show-details .details .close-details { display: inline-flex; }
}
@media (max-width: 1180px) {
  .bot-layout { grid-template-columns: 1fr; }
  .phone { position: static; height: 560px; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 60; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 55; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
  .inbox, .inbox.no-details { grid-template-columns: minmax(0, 1fr); }
  .banner { padding: 6px 12px; font-size: 12.5px; }
  .banner .btn { height: 28px; }
  .inbox .chat { display: none; }
  .inbox.open .conv-list { display: none; }
  .inbox.open .chat { display: flex; }
  .back-btn { display: inline-flex; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .var-row { grid-template-columns: 1fr 1fr; }
  .bubble-row { max-width: 88%; }
  .hero { font-size: 44px; }
  .toolbar .search { max-width: none; flex: 1 1 100%; }
}
