/* ============================================================
   Botix · sistema de diseño
   Paleta de datos validada para daltonismo y contraste.
   ============================================================ */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f2ef;
  --surface-3: #ecebe6;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #686661;   /* 5,1:1 sobre surface-2; antes #898781 (3,2:1) */
  --line: #e1e0d9;
  --line-2: #c3c2b7;

  --accent: #4a3aa7;
  --accent-hover: #3d3090;
  --accent-ink: #ffffff;
  --accent-soft: rgba(74, 58, 167, 0.10);
  --accent-soft-2: rgba(74, 58, 167, 0.16);

  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-soft: rgba(12, 163, 12, 0.12);
  --warn-soft: rgba(250, 178, 25, 0.18);
  --serious-soft: rgba(236, 131, 90, 0.18);
  --critical-soft: rgba(208, 59, 59, 0.12);
  /* Texto de estado sobre su fondo suave: todos ≥ 4,5:1 en las dos apariencias. */
  --good-ink: #0a7d0a;
  --warn-ink: #8a5c00;
  --serious-ink: #a04a22;
  --critical-ink: #b42e2e;
  --good-strong: #0a7d0a;

  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --grid: #e1e0d9;
  --axis: #c3c2b7;

  --r-lg: 16px;
  --r: 12px;
  --r-sm: 8px;
  --r-xs: 6px;

  --sh-1: 0 1px 2px rgba(11, 11, 11, .04), 0 1px 3px rgba(11, 11, 11, .04);
  --sh-2: 0 12px 32px rgba(11, 11, 11, .10), 0 2px 8px rgba(11, 11, 11, .06);
  --sh-3: 0 24px 60px rgba(11, 11, 11, .18), 0 4px 12px rgba(11, 11, 11, .08);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --nav-w: 258px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232320;
    --surface-3: #2c2c2a;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-3: #898781;
    --line: #2c2c2a;
    --line-2: #383835;
    --accent: #9085e9;
    --accent-hover: #a49bef;
    --accent-ink: #14121f;
    --accent-soft: rgba(144, 133, 233, 0.14);
    --accent-soft-2: rgba(144, 133, 233, 0.22);
    --good-ink: #4fce4f;
    --warn-ink: #fab219;
    --serious-ink: #ec835a;
    --critical-ink: #f07070;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --grid: #2c2c2a;
    --axis: #383835;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-2: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .4);
    --sh-3: 0 24px 60px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232320;
  --surface-3: #2c2c2a;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-3: #898781;
  --line: #2c2c2a;
  --line-2: #383835;
  --accent: #9085e9;
  --accent-hover: #a49bef;
  --accent-ink: #14121f;
  --accent-soft: rgba(144, 133, 233, 0.14);
  --accent-soft-2: rgba(144, 133, 233, 0.22);
  --good-ink: #4fce4f;
  --warn-ink: #fab219;
  --serious-ink: #ec835a;
  --critical-ink: #f07070;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --grid: #2c2c2a;
  --axis: #383835;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .4);
  --sh-3: 0 24px 60px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--plane);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.012em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft-2); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------- arranque */
.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--ink-3); }
.boot-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.9); } 50% { opacity: 1; transform: scale(1); } }

/* ------------------------------------------------ estructura */
.app-shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); height: 100vh; }

.sidebar {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 16px 12px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--s1)));
  display: grid; place-items: center; color: #fff; box-shadow: var(--sh-1);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); }

.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; cursor: pointer; transition: background .12s, color .12s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item .count {
  margin-left: auto; font-size: 11px; font-weight: 650; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
}
.nav-item .count.alert { background: var(--critical); color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 0 24px; height: 66px; flex: none;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; }
.topbar .sub { font-size: 12.5px; color: var(--ink-3); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.page { flex: 1; overflow-y: auto; padding: 24px; }
.page-inner { max-width: 1280px; margin: 0 auto; }
.page.flush { padding: 0; overflow: hidden; }

/* ------------------------------------------------- componentes */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: background-color .12s, border-color .12s, transform 160ms var(--ease-out); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 35%, var(--line)); }
.btn.danger:hover { background: var(--critical-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn.lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: border-color .12s, box-shadow .12s; font-size: 13.5px;
}
.textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.select { appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 32px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2);
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.serious { background: var(--serious-soft); color: var(--serious-ink); }
.badge.critical { background: var(--critical-soft); color: var(--critical-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-size: 15px; background: var(--surface-3); color: var(--ink-2); font-weight: 600;
}
.avatar.round { border-radius: 50%; font-size: 12.5px; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; border-radius: 8px; }
.avatar.lg { width: 46px; height: 46px; font-size: 21px; border-radius: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 12.5px; font-weight: 550; cursor: pointer; color: var(--ink-2); transition: border-color .12s, color .12s, background-color .12s, transform 160ms var(--ease-out);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip:active, .pick:active { transform: scale(0.97); }
.toggle-row:active { transform: scale(0.99); }
.switch:active::after { width: 20px; }
.switch.on:active::after { transform: translateX(12px); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  padding: 10px 13px; font-size: 13.5px; font-weight: 550; color: var(--ink-3); cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.empty { display: grid; place-items: center; gap: 10px; padding: 52px 20px; text-align: center; color: var(--ink-3); }
.empty .mark { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.empty h4 { font-size: 14.5px; color: var(--ink); }
.empty p { font-size: 13px; max-width: 340px; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-2); font-size: 13.5px;
  animation: slideUp 320ms var(--ease-out); max-width: 380px;
}
.toast .bar { width: 3px; align-self: stretch; border-radius: 3px; background: var(--accent); }
.toast.ok .bar { background: var(--good); }
.toast.error .bar { background: var(--critical); }
@keyframes slideUp { from { opacity: 0; transform: translateY(100%) scale(0.96); } }
.toast { transition: opacity 160ms ease, transform 200ms var(--ease-out); }
.toast.saliendo { opacity: 0; transform: translateX(16px) scale(0.98); }

.overlay {
  position: fixed; inset: 0; background: rgba(11, 11, 11, .38); backdrop-filter: blur(3px);
  z-index: 100; display: grid; place-items: center; padding: 24px; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-3); width: min(620px, 100%);
  max-height: 88vh; display: flex; flex-direction: column; animation: pop 220ms var(--ease-out);
  border: 1px solid var(--line);
}
.modal.wide { width: min(900px, 100%); }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }
.overlay.saliendo, .drawer-wrap.saliendo { animation: fadeOut 160ms ease forwards; pointer-events: none; }
.overlay.saliendo .modal { animation: popOut 140ms ease forwards; }
.drawer-wrap.saliendo .drawer { animation: slideOut 200ms var(--ease-out) forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes popOut { to { opacity: 0; transform: scale(0.97); } }
@keyframes slideOut { to { transform: translateX(100%); } }

/* Cada sección aparece sin saltos: solo opacidad y muy breve, que se navega mucho. */
.page-inner { animation: fade 160ms ease-out; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-head .sub { font-size: 12.5px; color: var(--ink-3); }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }

.drawer-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(11,11,11,.38); backdrop-filter: blur(3px); animation: fade .15s; }
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(480px, 100%); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--sh-3); display: flex; flex-direction: column;
  animation: slideIn 340ms var(--ease-drawer);
}
@keyframes slideIn { from { transform: translateX(100%); } }

/* ------------------------------------------------------ panel */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px;
  box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.stat .label { font-size: 12.5px; color: var(--ink-3); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 28px; font-weight: 640; letter-spacing: -0.02em; line-height: 1.15; }
.stat .foot { font-size: 12px; color: var(--ink-3); }
.stat .foot strong { color: var(--ink-2); font-weight: 600; }
.stat.alert { border-color: color-mix(in srgb, var(--critical) 40%, var(--line)); }
.stat.alert .value { color: var(--critical-ink); }
.stat .ico { position: absolute; right: 14px; top: 14px; color: var(--ink-3); opacity: .5; }
.stat .ico svg { width: 18px; height: 18px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1080px) { .dash-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------- gráficas */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart .bar { transition: opacity .12s; }
.chart .bar:hover { opacity: .8; }
.chart .hover-band { fill: transparent; cursor: crosshair; }
.chart .hover-band:hover { fill: var(--surface-2); opacity: .6; }
.chart .crosshair { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 0 4px 10px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-item .val { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.tip {
  position: absolute; pointer-events: none; z-index: 30; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sh-2); border-radius: var(--r-sm); padding: 9px 11px; font-size: 12.5px; min-width: 130px;
  transform: translate(-50%, -100%); opacity: 0; transition: opacity .1s;
}
.tip.on { opacity: 1; }
.tip .t-title { font-weight: 650; margin-bottom: 5px; font-size: 12px; color: var(--ink); }
.tip .t-row { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.tip .t-row .val { margin-left: auto; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; }
.hbar-label { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { grid-column: 1 / -1; height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; background: var(--s1); }
.hbar-val { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------- chatbots */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.bot-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1);
  cursor: pointer; transition: border-color .14s, box-shadow .14s, transform .14s; overflow: hidden; position: relative;
}
.bot-card:active { transform: scale(0.99); }
@media (hover: hover) and (pointer: fine) {
  .bot-card:hover { border-color: var(--line-2); box-shadow: var(--sh-2); transform: translateY(-2px); }
  .bot-card:hover:active { transform: translateY(-2px) scale(0.99); }
}
.bot-card .stripe { height: 3px; }
.bot-card .top { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px 12px; }
.bot-card .name { font-weight: 640; font-size: 15px; letter-spacing: -0.015em; }
.bot-card .company { font-size: 12.5px; color: var(--ink-3); }
.bot-card .desc { padding: 0 18px 14px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bot-card .metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.bot-card .metric { padding: 11px 14px; text-align: center; border-right: 1px solid var(--line); }
.bot-card .metric:last-child { border-right: none; }
.bot-card .metric .n { font-size: 16px; font-weight: 640; font-variant-numeric: tabular-nums; }
.bot-card .metric .l { font-size: 11px; color: var(--ink-3); }
.bot-card .chan { display: flex; gap: 5px; padding: 0 18px 14px; flex-wrap: wrap; }

/* ----------------------------------------------------- bandeja */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; height: 100%; }
@media (max-width: 1180px) { .inbox { grid-template-columns: 300px minmax(0, 1fr); } .inbox .ficha { display: none; } }
@media (max-width: 860px) { .inbox { grid-template-columns: 1fr; } .inbox .conv-list { display: none; } .inbox.list-mode .conv-list { display: flex; } .inbox.list-mode .chat { display: none; } }
.conv-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--surface); min-height: 0; }
.conv-filters { padding: 12px; display: flex; flex-direction: column; gap: 9px; border-bottom: 1px solid var(--line); }
.conv-filters .chips { display: flex; gap: 5px; flex-wrap: wrap; }
.conv-items { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-item .body { min-width: 0; flex: 1; }
.conv-item .line1 { display: flex; align-items: baseline; gap: 8px; }
.conv-item .who { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .when { margin-left: auto; font-size: 11px; color: var(--ink-3); flex: none; }
.conv-item .prev { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.conv-item .meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.conv-item .unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 650; display: grid; place-items: center; }

.chat { display: flex; flex-direction: column; min-width: 0; background: var(--plane); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.chat-head .who { font-weight: 640; font-size: 14.5px; }
.chat-head .sub { font-size: 12px; color: var(--ink-3); }
.chat-head .right { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 9px; max-width: 74%; }
.msg .bubble { padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg.cliente { align-self: flex-start; }
.msg.cliente .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.bot, .msg.agente { align-self: flex-end; flex-direction: row-reverse; }
.msg.bot .bubble { background: var(--surface-3); border-bottom-right-radius: 5px; }
.msg.agente .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.msg .stamp { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }
.msg.sistema { align-self: center; max-width: 90%; }
.msg.sistema .bubble { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-3); font-size: 12px; padding: 5px 12px; border-radius: 999px; text-align: center; }
.msg.nota { align-self: center; max-width: 82%; }
.msg.nota .bubble { background: var(--warn-soft); color: var(--warn-ink); font-size: 12.5px; border-radius: 10px; }
.chat-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 6px; }
.chat-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 12px 16px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 40px; max-height: 140px; resize: none; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
.composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mode-switch { display: flex; gap: 4px; }
.ficha { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.ficha .sect { display: flex; flex-direction: column; gap: 8px; }
.ficha .sect h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 4px 0; }
.kv .k { color: var(--ink-3); }
.kv .v { font-weight: 550; text-align: right; }

/* ------------------------------------------------------ agenda */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-dow { padding: 9px 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--surface-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: background .1s; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.out { background: var(--plane); }
.cal-day.out .n { color: var(--ink-3); opacity: .55; }
.cal-day.today .n { background: var(--accent); color: var(--accent-ink); }
.cal-day .n { font-size: 12px; font-weight: 600; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.cal-ev { font-size: 11.5px; padding: 3px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 2px solid var(--accent); }
.cal-ev.cancelada { background: var(--surface-3); color: var(--ink-3); text-decoration: line-through; border-left-color: var(--line-2); }
.cal-ev.completada { background: var(--good-soft); color: var(--good-ink); border-left-color: var(--good); }
.cal-ev.pendiente { background: var(--warn-soft); color: var(--warn-ink); border-left-color: var(--warn); }
.cal-more { font-size: 11px; color: var(--ink-3); padding-left: 6px; }
.agenda-split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.cal-day .n { flex: none; }
@media (max-width: 1080px) { .agenda-split { grid-template-columns: minmax(0, 1fr); } }
.appt-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: center; }
.appt-row:last-child { border-bottom: none; }
.appt-time { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13.5px; width: 46px; flex: none; }
.appt-main { min-width: 0; flex: 1; }
.appt-main .n { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-main .s { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------- asistente */
.wizard { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 0; min-height: 560px; }
@media (max-width: 860px) { .wizard { grid-template-columns: 1fr; } .wizard-steps { display: none; } }
.wizard-steps { background: var(--surface-2); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 3px; border-radius: var(--r-lg) 0 0 var(--r-lg); }
.wstep { display: flex; gap: 11px; align-items: flex-start; padding: 9px 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--ink-3); }
.wstep .num { width: 21px; height: 21px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 11.5px; font-weight: 650; flex: none; }
.wstep.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--sh-1); }
.wstep.on .num { background: var(--accent); color: var(--accent-ink); }
.wstep.done .num { background: var(--good-strong); color: #fff; }
.wstep .t { line-height: 1.35; }
.wstep .d { display: block; font-size: 11.5px; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.wizard-body { padding: 24px; overflow-y: auto; max-height: 72vh; display: flex; flex-direction: column; gap: 18px; }
.wizard-body > header h3 { font-size: 18px; }
.wizard-body > header p { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.pick {
  border: 1px solid var(--line); border-radius: var(--r); padding: 13px; cursor: pointer; background: var(--surface);
  display: flex; flex-direction: column; gap: 5px; transition: border-color .15s, background-color .15s, box-shadow .2s var(--ease-out), transform 160ms var(--ease-out); text-align: left;
}
.pick:hover { border-color: var(--line-2); background: var(--surface-2); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.pick .e { font-size: 21px; }
.pick .t { font-weight: 600; font-size: 13.5px; }
.pick .d { font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }

.toggle-row { display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); transition: border-color .15s, background-color .15s, transform 160ms var(--ease-out); }
.toggle-row:hover { background: var(--surface-2); }
.toggle-row.on { border-color: var(--accent); background: var(--accent-soft); }
.toggle-row .t { font-weight: 600; font-size: 13.5px; }
.toggle-row .d { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; margin-top: 1px; background: var(--surface); transition: background-color .15s, border-color .15s; }
.toggle-row.on .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.check svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.6); transition: opacity .15s ease, transform 220ms var(--ease-out); }
.toggle-row.on .check svg { opacity: 1; transform: none; }

.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background-color .2s ease; flex: none; border: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 240ms var(--ease-out), width 160ms var(--ease-out); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }

.list-editor { display: flex; flex-direction: column; gap: 8px; }
.le-row { display: flex; gap: 8px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.le-row .grow { flex: 1; min-width: 0; }
.le-row .t { font-weight: 600; font-size: 13.5px; }
.le-row .d { font-size: 12px; color: var(--ink-3); }

.hours-grid { display: flex; flex-direction: column; gap: 7px; }
.hours-day { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.hours-day .dn { font-weight: 600; font-size: 13px; }
.hours-ranges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.hours-range { display: flex; gap: 4px; align-items: center; }
.hours-range .input { width: 84px; height: 30px; font-size: 12.5px; padding: 0 6px; }

.code {
  font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 11px 13px; overflow-x: auto; white-space: pre; color: var(--ink-2); line-height: 1.6;
}
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.sm { gap: 8px; }
.stack.lg { gap: 22px; }
.sep { height: 1px; background: var(--line); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--nav-w); z-index: 90; transform: translateX(-100%); transition: transform 320ms var(--ease-drawer); }
  .sidebar.open { transform: none; box-shadow: var(--sh-3); }
  .page { padding: 16px; }
  .topbar { padding: 0 14px; }
}
.menu-btn { display: none; }
@media (max-width: 860px) { .menu-btn { display: inline-flex; } }

/* ============================================================
   Accesibilidad (auditoría de diseño)
   ============================================================ */

/* Estado de la cita también por forma, no solo por color. */
.cal-ev.no_asistio { background: var(--critical-soft); color: var(--critical-ink); border-left-color: var(--critical); }
.cal-ev.pendiente::before { content: '◷ '; }
.cal-ev.completada::before { content: '✓ '; }
.cal-ev.no_asistio::before { content: '✕ '; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }

/* Foco visible y coherente en todo lo que se puede usar con el teclado. */
:where(button, a, [tabindex], .select):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.conv-item:focus-visible, tr.clickable:focus-visible, tr[data-bot]:focus-visible,
.cal-day:focus-visible, .appt-row:focus-visible { outline-offset: -2px; }
.modal:focus, .drawer:focus { outline: none; }

/* Avisos: botón para cerrarlos (los de error ya no se van solos). */
.toast .toast-x { margin-left: auto; margin-right: -6px; color: var(--ink-3); }
.toast .toast-x svg { width: 14px; height: 14px; }

/* Bandeja: sin conversación elegida no se reserva sitio para la ficha vacía. */
.inbox:has(.ficha:empty) { grid-template-columns: 330px minmax(0, 1fr); }
.inbox .ficha:empty { display: none; }

/* Aumentar contraste del sistema. */
@media (prefers-contrast: more) {
  :root { --ink-2: #3a3936; --ink-3: #4f4d49; --line: #b9b8ae; --line-2: #8d8c82; }
  :root[data-theme="dark"] { --ink-2: #e0dfd6; --ink-3: #c3c2b7; --line: #55554f; --line-2: #6e6e67; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ink-2: #e0dfd6; --ink-3: #c3c2b7; --line: #55554f; --line-2: #6e6e67; }
}

/* Reducir movimiento: sin pulsos, rebotes ni desplazamientos. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .boot-mark { opacity: 1; transform: none; }
  .bot-card:hover, .btn:active, .chip:active, .pick:active, .toggle-row:active { transform: none; }
}

/* Pantallas táctiles: controles de al menos 40–44 px. */
@media (pointer: coarse) {
  .btn { height: 44px; }
  .btn.sm { height: 40px; }
  .btn.icon { width: 44px; }
  .btn.icon.sm { width: 40px; }
  .input, .select { height: 44px; font-size: 16px; }   /* 16px evita el zoom automático de iOS */
  .textarea, .composer textarea { font-size: 16px; }
  .chip { height: 36px; }
  .nav-item { padding: 11px 10px; }
  .switch { width: 46px; height: 28px; }
  .switch::after { width: 22px; height: 22px; }
  .switch.on::after { transform: translateX(18px); }
  .hours-range .input { height: 40px; }
}

@media (max-width: 860px) {
  /* Cabecera del chat: el nombre arriba, las acciones en su propia fila. */
  .chat-head { flex-wrap: wrap; row-gap: 8px; }
  .chat-head > div[style*="min-width:0"] { flex: 1; }
  .chat-head .right { margin-left: 0; width: 100%; }
}

/* Agenda en móvil: mes compacto con puntos; el detalle va en la lista del día. */
@media (max-width: 720px) {
  .cal-day { min-height: 54px; padding: 5px 2px; display: grid; grid-template-columns: repeat(auto-fill, 8px); grid-auto-rows: 8px; justify-content: center; align-content: start; gap: 3px; }
  .cal-day .n { grid-column: 1 / -1; grid-row: span 3; justify-self: center; width: 26px; height: 26px; }
  .cal-dow { padding: 7px 0; text-align: center; font-size: 11px; letter-spacing: 0; }
  .cal-ev { font-size: 0; padding: 0; width: 8px; height: 8px; border-radius: 50%; border: none; background: var(--accent); }
  .cal-ev::before { content: none !important; }
  .cal-ev.pendiente { background: transparent; box-shadow: inset 0 0 0 2px var(--warn); }
  .cal-ev.completada { background: var(--good); }
  .cal-ev.cancelada { background: var(--line-2); }
  .cal-ev.no_asistio { background: var(--critical); border-radius: 1px; }
  .cal-more { font-size: 10px; line-height: 1; padding: 0; grid-column: 1 / -1; grid-row: span 2; text-align: center; }
  #mes-titulo { min-width: 0 !important; flex: 1; }
}

/* ── SEO y SEM ─────────────────────────────────────────────── */
.solo-lector { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.seo-form { display: flex; gap: 10px; align-items: center; }
.seo-buscar { flex: 1; min-width: 0; }
.seo-buscar .input { font-size: 16px; }
@media (max-width: 560px) { .seo-form { flex-direction: column; align-items: stretch; } }
.seo-cabecera { display: flex; gap: 22px; align-items: center; }
@media (max-width: 560px) { .seo-cabecera { flex-direction: column; text-align: center; } .seo-cabecera .row { justify-content: center; } }
.seo-anillo {
  flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--n) * 1%), color-mix(in srgb, var(--ink) 9%, transparent) 0);
  animation: seo-llenar 900ms var(--ease-out) both;
}
.seo-anillo-in {
  width: 76%; height: 76%; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: var(--surface); box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.seo-anillo-in strong { font-size: 34px; line-height: 1; letter-spacing: -0.03em; }
.seo-anillo-in span { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
@property --n { syntax: '<number>'; inherits: false; initial-value: 0; }
@keyframes seo-llenar { from { --n: 0; } }
.seo-item { display: grid; grid-template-columns: 10px 1fr; gap: 12px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.seo-item:last-child { border-bottom: 0; }
.seo-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.seo-barra { display: grid; grid-template-columns: minmax(0, 1fr) 40% 34px; gap: 12px; align-items: center; font-size: 13px; }
.seo-barra .hbar-track { grid-column: auto; }
.seo-barra strong { text-align: right; font-variant-numeric: tabular-nums; }
.seo-detalle > summary { cursor: pointer; list-style: none; }
.seo-detalle > summary::-webkit-details-marker { display: none; }
.seo-giro { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--accent-soft-2); border-top-color: var(--accent); animation: seo-girar 800ms linear infinite; flex: none; }
@keyframes seo-girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .seo-anillo { animation: none; } .seo-giro { animation-duration: 2.4s; } }

/* ═══ Mi web ═════════════════════════════════════════════════════ */
.mw-cabecera { gap: 10px; align-items: center; }
.mw-pestanas { max-width: 100%; }
.mw-asistente { max-width: 760px; margin: 0 auto; overflow: hidden; }
.mw-asistente h2 { font-size: 24px; letter-spacing: -0.02em; }
.mw-progreso { height: 4px; background: var(--surface-3); }
.mw-progreso span { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; transition: width 380ms var(--ease-out); }
.mw-pasos { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 14px 20px 0; color: var(--ink-3); }
.mw-pasos li { display: inline-flex; align-items: center; gap: 6px; }
.mw-pasos li > span { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; background: var(--surface-3); }
.mw-pasos li.on { color: var(--ink); font-weight: 600; }
.mw-pasos li.on > span { background: var(--accent); color: var(--accent-ink); }
.mw-pasos li.hecho { color: var(--good-ink); }
.mw-pie { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.mw-elecciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.mw-eleccion, .mw-plantilla { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform 140ms var(--ease-out); }
.mw-eleccion:active, .mw-plantilla:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .mw-eleccion:hover, .mw-plantilla:hover { border-color: var(--line-2); } }
.mw-eleccion.on, .mw-plantilla.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.mw-eleccion .t, .mw-plantilla .t { font-weight: 650; display: inline-flex; gap: 6px; align-items: center; }
.mw-eleccion .d, .mw-plantilla .d { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.mw-plantillas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.mw-plantilla .mock { position: relative; display: block; height: 104px; border-radius: 8px; overflow: hidden; margin-bottom: 8px; background: #0e0f16; padding: 14px; }
.mw-plantilla .mock.claro { background: #f4f4f8; }
.mw-plantilla .mock > i { position: absolute; inset: -30% 30% 30% -30%; background: radial-gradient(circle, var(--c), transparent 65%); opacity: .7; filter: blur(8px); }
.mw-plantilla .mock > b { position: relative; display: block; height: 9px; width: 70%; border-radius: 4px; background: #fff; margin-bottom: 6px; }
.mw-plantilla .mock.claro > b { background: #1c1d26; }
.mw-plantilla .mock > b.corta { width: 45%; background: var(--c); }
.mw-plantilla .mock .fila { position: absolute; left: 14px; right: 14px; bottom: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mw-plantilla .mock u { height: 26px; border-radius: 6px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); }
.mw-plantilla .mock.claro u { background: rgba(255,255,255,.8); border-color: rgba(0,0,0,.08); }
.mw-plantilla .mock-nitida { background: #15171d; }
.mw-plantilla .mock-nitida.claro { background: #fbfaf7; }
.mw-plantilla .mock-nitida > i { display: none; }
.mw-plantilla .mock-nitida > b { font-family: Georgia, serif; border-radius: 1px; }
.mw-plantilla .mock-nitida u { border-radius: 2px; border-width: 2px 0 0; border-color: var(--c); background: transparent; }
.mw-plantilla .mock-escaparate { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 55%, #333), #111 75%); }
.mw-plantilla .mock-escaparate.claro { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 55%, #333), #111 75%); }
.mw-plantilla .mock-escaparate > i { inset: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 6px, transparent 6px 12px); filter: none; opacity: 1; }
.mw-plantilla .mock-escaparate > b, .mw-plantilla .mock-escaparate.claro > b { background: #fff; }
.mw-plantilla .mock-escaparate .fila { display: none; }
.mw-colores { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mw-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; position: relative; overflow: hidden; transition: transform 140ms var(--ease-out); }
.mw-color:active { transform: scale(.92); }
.mw-color.on { box-shadow: 0 0 0 2px var(--ink); }
.mw-color.otro { background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #f43f5e); }
.mw-color.otro.on { background: var(--c); }
.mw-color.otro input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.mw-check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.mw-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.mw-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.mw-resumen > div { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.mw-resumen strong { overflow-wrap: anywhere; }
.mw-presupuesto { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mw-presupuesto .fila { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mw-presupuesto .fila:last-child { border-bottom: 0; }
.mw-presupuesto .fila > span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.mw-presupuesto .fila small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.mw-presupuesto .fila.pagada > span:last-child { color: var(--ink-3); text-decoration: line-through; font-weight: 400; }
.mw-presupuesto .fila.pagada small { color: var(--good-ink); }
.mw-presupuesto .fila.total { background: var(--surface-2); font-weight: 650; }
.mw-progreso-lista { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }
.mw-progreso-lista li { display: flex; gap: 12px; align-items: center; color: var(--ink-3); }
.mw-progreso-lista li.curso { color: var(--ink); font-weight: 600; }
.mw-progreso-lista li.hecho { color: var(--good-ink); }
.mw-progreso-lista .punto { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); margin: 0 4px; }
.girando { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent-soft-2); border-top-color: var(--accent); animation: mw-giro .8s linear infinite; }
@keyframes mw-giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .girando { animation-duration: 2.4s; } .mw-progreso span { transition: none; } }
.mw-barra { height: 6px; background: var(--surface-3); margin: 0 18px; border-radius: 6px; overflow: hidden; }
.mw-barra span { display: block; height: 100%; background: var(--good); border-radius: 6px; }
.mw-tarea { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; cursor: pointer; border-radius: 0; }
.mw-tarea:last-child { border-bottom: 0; }
.mw-tarea .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mw-tarea .ico { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; }
.mw-tarea.hecha .ico { background: var(--good); border-color: var(--good); color: #fff; }
.mw-tarea.hecha strong { color: var(--ink-3); font-weight: 500; }
.mw-tarea .ir { color: var(--ink-3); font-size: 20px; }
@media (hover: hover) and (pointer: fine) { .mw-tarea:hover { background: var(--surface-2); } }
.mw-mini { height: 300px; overflow: hidden; border-top: 1px solid var(--line); position: relative; }
.mw-mini iframe { width: 250%; height: 750px; border: 0; transform: scale(.4); transform-origin: 0 0; pointer-events: none; }
.mw-marco { background: var(--surface-2); display: grid; place-items: center; padding: 12px; border-top: 1px solid var(--line); }
.mw-marco iframe { width: 100%; height: min(78vh, 760px); border: 0; border-radius: 10px; background: #fff; box-shadow: var(--sh-2); transition: width .3s var(--ease-out); }
.mw-publicar { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
@media (max-width: 1100px) { .mw-publicar { grid-template-columns: 1fr; } }
.mw-falta { margin: 6px 0 0; padding-left: 18px; }
.mw-versiones summary { cursor: pointer; color: var(--ink-2); }
.mw-registro { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.mw-registro .nombre, .mw-registro .valor { display: flex; align-items: center; gap: 4px; min-width: 0; grid-column: 2; }
.mw-registro .nombre { grid-row: 1; }
.mw-registro .badge { grid-row: 1 / span 2; align-self: start; }
.mw-registro code { font: 12.5px var(--mono); overflow-wrap: anywhere; }
.mw-redir { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.mw-guardado-barra { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 8px 14px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); }
.mw-guardado-barra .small { display: inline-flex; gap: 6px; align-items: center; }
.mw-error { color: var(--critical-ink); }
.mw-contador { font-weight: 500; font-size: 11.5px; margin-left: 6px; }
.mw-contador.bien { color: var(--good-ink); }
.mw-contador.aviso { color: var(--warn-ink); }
.mw-google { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--r-sm); background: #fff; border: 1px solid #e2e2e2; font-family: Arial, sans-serif; color: #202124; }
.mw-google .u { font-size: 12.5px; color: #4d5156; }
.mw-google .t { font-size: 19px; color: #1a0dab; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mw-google .d { font-size: 13.5px; color: #4d5156; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mw-item { align-items: flex-start; }
.mw-item-campos { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.mw-l-servicios { grid-template-columns: minmax(0, 2fr) minmax(90px, .7fr) minmax(90px, .7fr); }
.mw-sub { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; min-width: 0; }
.mw-sub.ancho { grid-column: 1 / -1; }
@media (max-width: 640px) { .mw-l-servicios { grid-template-columns: 1fr 1fr; } .mw-l-servicios .mw-sub:first-child { grid-column: 1 / -1; } }
.mw-soltar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; border: 2px dashed var(--line-2); border-radius: var(--r); color: var(--ink-3); font-size: 14px; transition: border-color .15s, background .15s; }
.mw-soltar.encima { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (pointer: coarse) { .mw-soltar { display: none; } }
.mw-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.mw-foto { margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.mw-foto.portada { border-color: var(--good); box-shadow: 0 0 0 1px var(--good); }
.mw-foto .img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.mw-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mw-foto-etq { position: absolute; left: 8px; top: 8px; }
.mw-foto figcaption { padding: 8px; display: grid; gap: 6px; }
.mw-foto .input { font-size: 13px; }
.mw-precio .card-body .btn.primary { width: 100%; justify-content: center; }

.mw-tarea .badge { align-self: flex-start; }
.mw-tarea .grow > strong { display: inline; }

/* ── negocio: lo que sabe el asistente, entrevista y carta ── */
.ng-nivel-cab { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ng-nivel h3 { font-size: 16px; }
.ng-barra { height: 8px; background: var(--surface-3); border-radius: 8px; overflow: hidden; margin-top: 14px; }
.ng-barra span { display: block; height: 100%; border-radius: 8px; transition: width 420ms var(--ease-out); }
.ng-faltan { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.ng-falta { display: flex; gap: 8px; align-items: center; width: 100%; min-height: 36px; padding: 6px 8px; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 13px; text-align: left; border-radius: var(--r-sm); cursor: pointer; touch-action: manipulation; }
.ng-falta svg { width: 14px; height: 14px; color: var(--accent); flex: none; }
.ng-falta:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .ng-falta:hover { background: var(--surface-2); color: var(--ink); } }
.ng-pregunta > label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink); }
.ng-marca { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-grid; place-items: center; flex: none; color: transparent; transition: background-color .2s ease, border-color .2s ease; }
.ng-marca svg { width: 11px; height: 11px; }
.ng-pregunta.hecha .ng-marca { background: var(--good-strong, var(--good)); border-color: transparent; color: #fff; }
.ng-rapidas { margin-top: 2px; }
.ng-una { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.ng-una .toggle-row { width: 100%; text-align: left; font: inherit; color: inherit; }
.ng-oferta { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.ng-oferta .row > .input:first-child { flex: 1; min-width: 0; font-weight: 600; }
.ng-ent-progreso { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.ng-ent-progreso span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 380ms var(--ease-out); }
.ng-ent-titulo { font-size: 20px; letter-spacing: -0.015em; line-height: 1.25; margin-bottom: 6px; text-wrap: balance; }
.ng-ent-fin { text-align: center; padding: 26px 8px 12px; }
.ng-ent-medalla { width: 54px; height: 54px; border-radius: 50%; background: var(--good-soft); color: var(--good-ink); display: grid; place-items: center; margin: 0 auto 16px; }
.ng-ent-medalla svg { width: 26px; height: 26px; }
.ng-pendientes { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.ng-pendientes h3 { display: flex; gap: 8px; align-items: center; }
.ng-pendientes h3 svg { width: 16px; height: 16px; color: var(--accent); }
.ng-pendiente { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.ng-pendiente .row { align-items: flex-start; }
.ng-pendiente .textarea { flex: 1; min-width: 0; }

.ct-revisado { display: flex; gap: 14px; align-items: flex-start; border-top: 1px solid var(--line); }
.ct-revisado p { margin-top: 4px; line-height: 1.5; max-width: 78ch; }
.ct-cab { gap: 10px; }
.ct-nombre { font-weight: 650; font-size: 15px; max-width: 340px; }
.ct-item { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 9px 11px; display: grid; gap: 8px; }
.ct-item.agotado .ct-linea .input { color: var(--ink-3); text-decoration: line-through; }
.ct-linea { display: flex; gap: 8px; align-items: center; }
.ct-linea .grow { flex: 1; min-width: 0; }
.ct-precio { position: relative; width: 96px; flex: none; }
.ct-precio .input { padding-right: 24px; text-align: right; font-variant-numeric: tabular-nums; }
.ct-precio span { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13px; pointer-events: none; }
.ct-estrella { width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; background: none; color: var(--line-2); display: grid; place-items: center; cursor: pointer; flex: none; transition: color .15s ease, transform 160ms var(--ease-out); touch-action: manipulation; }
.ct-estrella.on { color: #f5a524; }
.ct-estrella:active { transform: scale(0.9); }
.ct-resumen { margin: 0 2px; line-height: 1.45; }
.ct-detalle { display: grid; gap: 12px; padding: 6px 2px 4px; }
.ct-previa { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 14px 12px; }
.ct-previa h4 { margin: 14px 0 6px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.ct-previa ul { list-style: none; margin: 0; padding: 0; }
.ct-previa li { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ct-previa li:last-child { border-bottom: 0; }
.ct-previa small { color: var(--ink-3); }
.ct-previa strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  .ct-cab { flex-wrap: wrap; }
  .ct-cab .ct-nombre { max-width: none; flex: 1 1 100%; }
  .ct-linea { flex-wrap: wrap; }
  .ct-linea .grow { flex-basis: 100%; }
  .ct-precio { flex: 1; }
  .ng-pendiente .row:last-child { flex-direction: column; align-items: stretch; }
}
/* El atributo hidden manda siempre, también sobre los elementos con display propio. */
[hidden] { display: none !important; }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* Llamadas */
.toggle-row.disabled { opacity: .55; cursor: not-allowed; }
.toggle-row.disabled:hover { background: var(--surface); }
.desvio { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.desvio.recomendado { border-color: var(--accent); }
.desvio > div { flex: 1; }
.desvio code { display: block; margin-top: 3px; font-size: 15px; letter-spacing: .02em; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
@media (max-width: 720px) { .desvio code { font-size: 13.5px; letter-spacing: 0; } }
.tramo .select, .tramo .input { height: 34px; }
input[type="range"]#c-vel { width: 100%; accent-color: var(--accent); }
.llamadas-vivo { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 14px; }
.llamada-viva { display: flex; flex-direction: column; }
.llamada-viva .card-head .right { gap: 8px; flex-shrink: 0; }
.llamada-viva .transcripcion { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; height: 300px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.llamada-viva .msg { max-width: 88%; }
.llamada-viva .msg.parcial .bubble { opacity: .65; font-style: italic; }
@media (max-width: 720px) { .llamada-viva .transcripcion { height: 46vh; } .llamada-viva .btn-row .btn { flex: 1; justify-content: center; min-height: 40px; } }
.llamadas-vivo > .card:only-child:not(.llamada-viva) { grid-column: 1 / -1; }
.transcripcion-historial { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); max-height: 50vh; overflow-y: auto; }
.transcripcion-historial .msg { max-width: 88%; }
@media (max-width: 720px) { .ocultar-movil { display: none; } }
.barra-consumo { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 5px; min-width: 90px; }
.barra-consumo > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.barra-consumo.aviso > span { background: var(--warn-ink); }
.barra-consumo.lleno > span { background: var(--critical); }
