/* WhatsBot · panel. Misma estructura visual que pdf-bot y ads-bot: barra lateral en degradado que ocupa el fondo, panel claro con la esquina izquierda
   redondeada, botón principal blanco, tarjetas con sombra larga tintada. Un solo tema claro, paleta Petróleo. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/PlusJakartaSans-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/PlusJakartaSans-500.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/PlusJakartaSans-600.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/PlusJakartaSans-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/PlusJakartaSans-800.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Paleta: Petróleo (verde WhatsApp hacia azul petróleo) */
  --sb-from: #22c27a;
  --sb-mid: #10918a;
  --sb-to: #0b5878;
  --sb-glow: rgb(255 255 255 / 0.16);
  --tint: 14 118 134;
  --wash-1: #ffffff;
  --wash-2: #d5edf0;
  --canvas: #f0f7f8;
  --line: #d8e7ea;
  --ink: #0d2a33;
  --brand: #12a58f;
  --brand-strong: #0b7a86;
  --cta-from: #12a58f;
  --cta-to: #0b6f86;
  --accent: #7c4de6;

  --surface: #ffffff;
  --text: var(--ink);
  --muted: color-mix(in srgb, var(--ink) 62%, #ffffff);
  --surface-2: color-mix(in srgb, var(--brand) 6%, #ffffff);
  --brand-soft: color-mix(in srgb, var(--brand) 13%, #ffffff);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, #ffffff);
  --danger: #d1400c;
  --danger-soft: #fdebe3;
  --warn: #a36a00;
  --warn-soft: #fff1d6;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgb(var(--tint) / 0.06);
  --shadow: 0 10px 30px rgb(var(--tint) / 0.1);
  --shadow-lg: 0 24px 56px -16px rgb(var(--tint) / 0.32);
  --font-size: 15px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-family: var(--font); color: var(--text); -webkit-font-smoothing: antialiased; }
body {
  margin: 0; min-height: 100vh; font: var(--font-size)/1.55 var(--font); color: var(--text);
  background: radial-gradient(circle at 85% -5%, var(--wash-1) 0, transparent 38%), radial-gradient(circle at 20% 110%, var(--wash-2) 0, transparent 45%), var(--canvas);
  background-attachment: fixed;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand-strong) 75%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- Marca ---- */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.logo-img { width: 38px; height: auto; display: block; }
.wordmark { color: #fff; }
.wordmark b { color: color-mix(in srgb, #ffffff 70%, var(--sb-from)); font-weight: 800; }
.brand .logo-img { width: 44px; padding: 5px; background: #fff; border-radius: 14px; box-shadow: 0 8px 20px -8px rgb(0 0 0 / 0.4); }

/* ---- Estructura: la ventana es el degradado; el panel claro flota encima ---- */
.shell {
  display: flex; height: 100dvh; overflow: hidden;
  background: radial-gradient(120% 55% at 0% 0%, var(--sb-glow) 0%, transparent 62%), linear-gradient(180deg, var(--sb-from) 0%, var(--sb-mid) 50%, var(--sb-to) 100%);
}
.nav-toggle { display: none; }
.sidebar { width: 288px; flex: none; display: flex; flex-direction: column; padding: 20px 16px 12px; color: #fff; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar .brand { padding: 0 8px 20px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-cta {
  display: flex; align-items: center; gap: 14px; margin-bottom: 8px; padding: 12px 16px; border-radius: 12px; background: #fff; color: var(--brand-strong);
  font-weight: 700; font-size: 15px; text-decoration: none; box-shadow: 0 6px 16px rgb(0 0 0 / 0.14); transition: background .15s ease;
}
.nav-cta:hover { background: color-mix(in srgb, var(--brand) 10%, #ffffff); }
.nav-cta svg { width: 22px; height: 22px; color: var(--brand-strong); }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 12px; text-decoration: none; color: #fff; font-weight: 600; font-size: 15px;
  transition: background .15s ease;
}
.nav-item svg { width: 22px; height: 22px; flex: none; }
.nav-item:hover { background: rgb(255 255 255 / 0.1); }
.nav-item.on { background: rgb(255 255 255 / 0.2); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.22); }
.nav-ext { margin-left: auto; display: grid; opacity: .7; }
.nav-ext svg { width: 15px; height: 15px; }
.side-mid { flex: 1; min-height: 120px; display: flex; flex-direction: column; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgb(255 255 255 / 0.2); }
.side-title { padding: 0 12px 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgb(255 255 255 / 0.75); }
.side-numbers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-num { width: 100%; display: flex; align-items: center; gap: 12px; padding: 7px 12px; border: 0; border-radius: 12px; background: transparent; color: #fff; text-align: left; }
.side-num:hover { background: rgb(255 255 255 / 0.1); }
.side-num svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side-num b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-num small { display: block; font-size: 11px; color: rgb(255 255 255 / 0.75); }
.side-num .sd { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none; background: rgb(255 255 255 / 0.45); box-shadow: 0 0 0 2px rgb(255 255 255 / 0.2); }
.side-num .sd.on { background: #fff; }
.side-bottom { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; margin-top: auto; }
.side-card { border: 1px solid rgb(255 255 255 / 0.35); background: rgb(255 255 255 / 0.15); border-radius: 16px; padding: 14px; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 6px 18px rgb(0 0 0 / 0.12); }
.side-card .side-title { padding: 0; }
.side-card p { font-size: 13px; margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; }
.side-card p span:first-child { color: rgb(255 255 255 / 0.85); }
.side-card p b { font-weight: 700; }
.meter { margin-top: 10px; height: 8px; border-radius: 999px; background: rgb(0 0 0 / 0.22); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: #fff; transition: width .4s ease; }

.account { position: relative; }
.account summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-radius: 12px; cursor: pointer; }
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: rgb(255 255 255 / 0.1); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #fff; color: var(--brand-strong); font-weight: 800; font-size: 16px; text-transform: uppercase; box-shadow: 0 0 0 2px rgb(255 255 255 / 0.35); position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account .who { min-width: 0; flex: 1; }
.account .who b { display: block; font-size: 13.5px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .who small { display: block; font-size: 12px; color: rgb(255 255 255 / 0.78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { display: grid; opacity: .8; }
.chev svg { width: 20px; height: 20px; }
.account-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.account-menu .id { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.account-menu .id b { display: block; font-size: 13.5px; }
.account-menu .id small { color: var(--muted); font-size: 12px; word-break: break-all; }
.account-menu form { padding: 4px; }
.account-menu .menu-links { padding: 4px 4px 0; }
.account-menu a.menu-btn { color: inherit; text-decoration: none; }
.menu-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 600; text-align: left; }
.menu-btn:hover { background: var(--brand-soft); }
.menu-btn svg { width: 16px; height: 16px; }

.app-panel {
  flex: 1; min-width: 0; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; position: relative;
  border-radius: 2rem 0 0 2rem; scrollbar-width: thin; scrollbar-color: rgb(var(--tint) / 0.45) transparent;
  background: radial-gradient(circle at 85% -5%, var(--wash-1) 0, transparent 38%), radial-gradient(circle at 20% 110%, var(--wash-2) 0, transparent 45%), var(--canvas);
}
.page { max-width: 1440px; margin: 0 auto; padding: 28px 40px 48px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: clamp(1.9rem, 2.6vw, 2.1rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.page-head p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.burger { display: none; position: absolute; left: 14px; top: 14px; z-index: 15; width: 40px; height: 40px; border-radius: 12px; place-items: center; border: 0; background: #fff; box-shadow: var(--shadow); }
.burger svg { width: 20px; height: 20px; }
.scrim { display: none; }

/* ---- Tarjetas y piezas comunes ---- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 14px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.hint { color: var(--muted); font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-weight: 650; font-size: 14px; transition: filter .15s ease, background .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn.primary { background-image: linear-gradient(100deg, var(--cta-from) 0%, var(--cta-to) 100%); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(0.95); background-image: linear-gradient(100deg, var(--cta-from) 0%, var(--cta-to) 100%); }
.btn.soft { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; padding: 9px 14px; font-size: 13.5px; }
.btn.soft:hover { background: color-mix(in srgb, var(--brand) 20%, #ffffff); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #f3c4b4; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 9px; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--brand-soft); color: var(--brand-strong); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--muted); }

.alert { padding: 12px 16px; border-radius: 14px; font-size: 14px; margin-bottom: 18px; border: 1px solid transparent; }
.alert.err { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.ok { background: var(--brand-soft); color: var(--brand-strong); }

/* ---- Inicio ---- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.kpi { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.kpi-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, var(--cta-from), var(--cta-to)); color: #fff; }
.kpi-ic svg { width: 22px; height: 22px; }
.kpi-num { display: block; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-label { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
.tool { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.tool-top { display: flex; align-items: center; gap: 14px; }
.tool-title { flex: 1; min-width: 0; }
.tool .icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(135deg, var(--cta-from), var(--cta-to)); }
.tool.flows .icon { background: linear-gradient(135deg, #818cf8, var(--accent)); }
.tool .icon svg { width: 24px; height: 24px; }
.tool h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.tool-kicker { font-size: 13px; color: var(--muted); }
.tool > p { color: var(--muted); font-size: 14.5px; }
.tool.flows .btn.soft { background: var(--accent-soft); color: var(--accent); }
.tool.flows .btn.soft:hover { background: color-mix(in srgb, var(--accent) 22%, #ffffff); }

/* ---- Numeros ---- */
.numbers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.slot { padding: 20px; display: flex; flex-direction: column; gap: 14px; min-height: 190px; transition: box-shadow .2s ease; }
.slot.live { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.slot.empty {
  border: 2px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); background: rgb(255 255 255 / 0.55); box-shadow: none; align-items: center; justify-content: center; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
button.slot.empty:hover { border-color: var(--brand); background: var(--brand-soft); }
.slot.empty .plus { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--brand-strong); box-shadow: var(--shadow); }
.slot.empty strong { color: var(--text); }
.slot-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.slot-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.slot-txt { min-width: 0; }
.num-avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--cta-from), var(--cta-to)); }
.num-avatar svg { width: 22px; height: 22px; }
.num-avatar.off { background: #cbd3de; }
.slot .label { font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .phone { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.slot .badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.slot-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.slot-meta .dot { width: 8px; height: 8px; border-radius: 50%; background: #c3cad8; }
.slot-meta .dot.on { background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.slot .actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.slot .err { color: var(--danger); font-size: 13px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.spin-center { margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Modales ---- */
dialog { border: 0; border-radius: 22px; padding: 0; background: #fff; color: var(--text); box-shadow: var(--shadow-lg), 0 0 0 1px rgb(var(--tint) / 0.08); width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
dialog[open] { animation: pop .18s ease; }
dialog.wide { width: min(620px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgb(15 23 42 / .45); backdrop-filter: blur(4px); }
.modal-body { padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.modal-body h3 { font-size: 19px; letter-spacing: -0.02em; font-weight: 700; }
.modal-body .sub { color: var(--muted); font-size: 14px; }
.qr-box { width: 264px; max-width: 100%; aspect-ratio: 1; margin: 4px auto; background: #fff; border-radius: 18px; padding: 12px; display: grid; place-items: center; border: 1px solid var(--line); box-shadow: var(--shadow); }
.qr-box img { width: 100%; height: 100%; image-rendering: pixelated; }
.steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.steps li + li { margin-top: 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, details.field > summary { font-size: 13px; font-weight: 650; color: color-mix(in srgb, var(--ink) 80%, #ffffff); }
input[type=text], input[type=email], input[type=password] { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ink) 18%, #ffffff); background: #fff; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
select { flex: 1 1 140px; min-width: 0; padding: 11px 13px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ink) 18%, #ffffff); background: #fff; outline: none; }
select:focus, input:focus { border-color: var(--brand-strong); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
input::placeholder { color: #98a3b2; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand-strong); flex: none; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1 1 140px; min-width: 0; }
.bot-contacts, .botlog { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bot-contacts li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.bot-contacts .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-contacts .who small { color: var(--muted); margin-left: 6px; }
.bot-contacts .empty, .botlog .empty { color: var(--muted); font-size: 13px; border-style: dashed; background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; transition: background .15s ease, border-color .15s ease; }
.chip:hover { background: var(--brand-soft); border-color: var(--brand); }
.botlog li { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.botlog .t { font-variant-numeric: tabular-nums; flex: none; }
.botlog .ok { color: var(--brand-strong); } .botlog .no { color: var(--danger); }
.botlog .who small { margin-left: 8px; color: var(--muted); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.seg button { flex: 1 1 0; padding: 9px 10px; background: transparent; border: 0; border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 600; transition: background .15s ease, color .15s ease; }
.seg button:hover { color: var(--text); }
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm), 0 2px 8px rgb(var(--tint) / 0.12); font-weight: 700; }
.seg button:disabled { opacity: .6; cursor: default; }
details.field > summary { cursor: pointer; }
.adv-grid { display: grid; gap: 6px; margin: 10px 0; }
.adv-grid label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.rule-op { color: var(--muted); font-size: 12px; margin-right: 6px; }
.grp-list { list-style: none; margin: 8px 0; padding: 0; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.grp-list li { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.grp-list li:last-child { border-bottom: 0; }
.grp-list small { color: var(--muted); margin-left: auto; }

/* ---- Tabla de administracion ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---- Toasts y avisos ---- */
#toasts { position: fixed; inset: auto auto 20px 50%; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(440px, calc(100vw - 32px)); }
#toasts[popover]:not(:popover-open) { display: none; }
.toast { background: #111827; color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
.toast.err { background: var(--danger); }
.center-msg { min-height: 70vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.center-msg > div { max-width: 460px; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 36px 30px; box-shadow: var(--shadow-lg); }
.center-msg h1 { font-size: 24px; letter-spacing: -0.03em; font-weight: 700; }
.center-msg .sub { color: var(--muted); margin-top: 8px; }
.center-msg .actions-row { margin-top: 20px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
body > main.center-msg { min-height: 100vh; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px clamp(28px, 5vw, 72px); display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 55% at 0% 0%, var(--sb-glow) 0%, transparent 62%), linear-gradient(180deg, var(--sb-from) 0%, var(--sb-mid) 50%, var(--sb-to) 100%);
}
.hero-inner { width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: 32px; }
.login-hero h2 { font-size: clamp(28px, 3.6vw, 42px); line-height: 1.12; letter-spacing: -0.035em; font-weight: 800; max-width: 15ch; }
.login-hero .lead { color: rgb(255 255 255 / 0.88); font-size: 17px; max-width: 44ch; margin-top: 14px; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.perks li { display: flex; align-items: center; gap: 14px; font-weight: 600; }
.perks .pi { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgb(255 255 255 / 0.16); border: 1px solid rgb(255 255 255 / 0.28); }
.perks .pi svg { width: 20px; height: 20px; }
.bubbles { display: flex; flex-direction: column; gap: 10px; max-width: 330px; }
.bubble { padding: 11px 15px; border-radius: 16px; font-size: 14px; line-height: 1.4; box-shadow: 0 12px 24px -12px rgb(0 0 0 / 0.45); }
.bubble.in { background: #fff; color: #1f2937; border-bottom-left-radius: 5px; align-self: flex-start; }
.bubble.out { background: #d9fdd3; color: #14341f; border-bottom-right-radius: 5px; align-self: flex-end; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(430px, 100%); padding: 36px 32px; display: flex; flex-direction: column; gap: 20px; text-align: center; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 26px; letter-spacing: -0.03em; font-weight: 800; }
.login-card p.sub { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.login-card .brand-mobile { display: none; justify-content: center; }
.login-card .brand-mobile .wordmark { color: var(--ink); }
.login-card .brand-mobile .wordmark b { color: var(--brand-strong); }
.login-card .brand-mobile .logo-img { padding: 0; background: none; box-shadow: none; width: 40px; }
.google-btn { background: #fff; color: #1f2937; border: 1px solid #d3d8e3; gap: 12px; padding: 13px 18px; font-size: 15px; }
.google-btn svg { width: 20px; height: 20px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dev-box { text-align: left; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); }
.dev-chip { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 2px 8px; border-radius: 999px; }
.login-foot { color: var(--muted); font-size: 12.5px; }

@media (max-width: 1100px) { .page { padding: 24px 28px 40px; } }
@media (max-width: 1023px) {
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; transform: translateX(-102%); transition: transform .22s ease; background: linear-gradient(180deg, var(--sb-from) 0%, var(--sb-mid) 50%, var(--sb-to) 100%); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgb(15 23 42 / .45); }
  .app-panel { border-radius: 0; }
  .burger { display: grid; }
  .page { padding: 64px 16px 40px; }
}
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card .brand-mobile { display: flex; }
}
@media (max-width: 820px) { .tool-grid, .numbers-grid { grid-template-columns: 1fr; } }
@media (min-width: 821px) and (max-width: 1180px) { .numbers-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr; } .tool-top { flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition: none !important; } }
#grp-bot { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* ---- Página de configuración del bot ---- */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--brand-strong); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.link { color: var(--brand-strong); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.link:hover { text-decoration: underline; }
.link svg { width: 14px; height: 14px; }
.bot-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; margin-bottom: 18px; flex-wrap: wrap; }
.bh-id { display: flex; align-items: center; gap: 16px; min-width: 0; flex-wrap: wrap; }
.bh-id h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.bh-id .phone { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.bh-switch { display: flex; align-items: center; gap: 16px; }
.bh-switch b { display: block; font-size: 15px; }
.bh-switch small { display: block; color: var(--muted); font-size: 13px; max-width: 30ch; }
.switch { position: relative; width: 58px; height: 32px; flex: none; border: 0; border-radius: 999px; background: #c5cfd6; transition: background .2s ease; padding: 0; }
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .25); transition: transform .2s ease; }
.switch[aria-checked="true"] { background: linear-gradient(100deg, var(--cta-from), var(--cta-to)); }
.switch[aria-checked="true"] i { transform: translateX(26px); }
.switch:disabled { opacity: .5; }
.confirm-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 18px; border-radius: 14px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: #5c3d00; }
.confirm-bar p { font-size: 14px; margin-top: 2px; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; width: fit-content; max-width: 100%; overflow-x: auto; box-shadow: var(--shadow-sm); }
.tab { border: 0; background: transparent; padding: 9px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background .15s ease, color .15s ease; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.on { background: linear-gradient(100deg, var(--cta-from), var(--cta-to)); color: #fff; }
.tab-n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; font-size: 11.5px; line-height: 18px; text-align: center; background: color-mix(in srgb, currentColor 16%, transparent); }
.tabpanel { display: grid; gap: 18px; max-width: 880px; }
.tabpanel[hidden] { display: none; }
.box { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.box h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.card-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.count { display: inline-block; min-width: 24px; padding: 0 8px; margin-left: 6px; border-radius: 999px; font-size: 12px; line-height: 22px; text-align: center; font-weight: 700; background: var(--brand-soft); color: var(--brand-strong); vertical-align: middle; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { text-align: left; padding: 16px; border: 2px solid var(--line); border-radius: 14px; background: #fff; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s ease, background .15s ease; }
.choice b { font-size: 15px; }
.choice small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.choice:hover:not(:disabled) { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.choice.on { border-color: var(--brand-strong); background: var(--brand-soft); }
.choice:disabled { opacity: .55; cursor: not-allowed; }
.fold { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.fold summary { cursor: pointer; font-weight: 650; font-size: 14px; }
.fold > * + * { margin-top: 10px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.p-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--cta-from), var(--cta-to)); }
.p-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-txt b { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-txt small { color: var(--muted); font-size: 12.5px; }
.people .empty { padding: 14px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: 12px; }
.toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.toggle { position: relative; flex: none; width: 52px; height: 30px; display: inline-block; cursor: pointer; }
.toggle input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle i { position: absolute; inset: 0; border-radius: 999px; background: #c5cfd6; transition: background .2s ease; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .25); transition: transform .2s ease; }
.toggle input:checked + i { background: linear-gradient(100deg, var(--cta-from), var(--cta-to)); }
.toggle input:checked + i::after { transform: translateX(22px); }
.toggle input:focus-visible + i { outline: 2px solid color-mix(in srgb, var(--brand-strong) 75%, transparent); outline-offset: 2px; }
.toggle input:disabled { cursor: not-allowed; }
.callout { background: var(--brand-soft); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; }
.callout ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.callout code { background: #fff; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.grp-list { margin: 0; max-height: 360px; }
.grp-row { display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer; }
.grp-list li { padding: 0; }
.grp-row { padding: 10px 14px; }
.grp-row:hover { background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.form-grid .field small { color: var(--muted); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.empty-cell { text-align: center; color: var(--muted); padding: 28px !important; }
@media (max-width: 700px) {
  .choice-grid, .form-grid { grid-template-columns: 1fr; }
  .bot-head { padding: 16px; }
  .bh-switch small { max-width: none; }
}
.grp-list .p-txt small { margin-left: 0; }
.field select { flex: none; width: 100%; }
.side-num { text-decoration: none; }
