/* Pozo · panel de operación. Índigo y violeta (como las landings), tarjetas suaves con borde fino, números grandes
   en Plus Jakarta Sans, íconos de trazo en el menú y una luz de color de fondo. Claro, oscuro y versión de celular. */
:root {
  --page: #F4F6FB; --bg: #FFFFFF; --side: #FFFFFF; --card: #FFFFFF; --soft: #F1F4F9; --hover: #F3F5FB; --ink: #0F172A; --muted: #64748B;
  --line: #E6EAF2; --line-strong: #D6DCE7;
  --accent: #4F5BFF; --accent-2: #8B5CF6; --accent-ink: #FFFFFF; --accent-soft: #EEF0FF;
  --grad: linear-gradient(135deg, #5B6BFF 0%, #8B5CF6 100%);
  --glow: rgba(91, 107, 255, .14); --glow-2: rgba(139, 92, 246, .10);
  --chat-bg: #E7EBEF; --bubble-in: #FFFFFF; --bubble-out: #ECEEFF; --bubble-op: #E3F6EA; --bubble-ink: #0F0F0F; --tick: #4FAE4E;
  --ok: #16A34A; --ok-soft: #E8F7EE; --warn: #D97706; --warn-soft: #FEF3E2; --crit: #E11D48; --crit-soft: #FDECF1;
  --cyan: #0891B2; --cyan-soft: #E3F6FA;
  --bar-dep: #5B6BFF; --bar-ret: #C4B5FD;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -8px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, .28);
  --radius: 18px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --disp: "Plus Jakarta Sans", "Inter", "Segoe UI", sans-serif;
  color-scheme: light;
}
/* Oscuro: si Windows está en oscuro (y no se eligió claro en el panel), o si se eligió oscuro en el panel. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #070B14; --bg: #0A1020; --side: #0D1324; --card: #0D1324; --soft: #141B30; --hover: #151D34; --ink: #E8ECF7; --muted: #8B95AF;
    --line: #1B2440; --line-strong: #27325A;
    --accent: #8C96FF; --accent-2: #A78BFA; --accent-ink: #FFFFFF; --accent-soft: #1A2050;
    --grad: linear-gradient(135deg, #5B6BFF 0%, #8B5CF6 100%);
    --glow: rgba(91, 107, 255, .20); --glow-2: rgba(139, 92, 246, .14);
    --chat-bg: #0B1120; --bubble-in: #172036; --bubble-out: #26306B; --bubble-op: #173D2E; --bubble-ink: #F5F5F5; --tick: #8C96FF;
    --ok: #4ADE80; --ok-soft: #10291D; --warn: #FBBF24; --warn-soft: #2F2410; --crit: #FB7185; --crit-soft: #33121E;
    --cyan: #22D3EE; --cyan-soft: #0D2A33;
    --bar-dep: #6E7BFF; --bar-ret: #4C3D8F;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 60px -10px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #070B14; --bg: #0A1020; --side: #0D1324; --card: #0D1324; --soft: #141B30; --hover: #151D34; --ink: #E8ECF7; --muted: #8B95AF;
  --line: #1B2440; --line-strong: #27325A;
  --accent: #8C96FF; --accent-2: #A78BFA; --accent-ink: #FFFFFF; --accent-soft: #1A2050;
  --grad: linear-gradient(135deg, #5B6BFF 0%, #8B5CF6 100%);
  --glow: rgba(91, 107, 255, .20); --glow-2: rgba(139, 92, 246, .14);
  --chat-bg: #0B1120; --bubble-in: #172036; --bubble-out: #26306B; --bubble-op: #173D2E; --bubble-ink: #F5F5F5; --tick: #8C96FF;
  --ok: #4ADE80; --ok-soft: #10291D; --warn: #FBBF24; --warn-soft: #2F2410; --crit: #FB7185; --crit-soft: #33121E;
  --cyan: #22D3EE; --cyan-soft: #0D2A33;
  --bar-dep: #6E7BFF; --bar-ret: #4C3D8F;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -10px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  color: var(--ink); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
  background: radial-gradient(900px 520px at 12% -8%, var(--glow), transparent 70%), radial-gradient(700px 480px at 100% 0%, var(--glow-2), transparent 70%), var(--page);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
/* Íconos del sprite en el texto (sin emojis en el panel) y logos de marcas con su color. */
svg.ic { width: 1.1em; height: 1.1em; vertical-align: -.18em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cxr-ic svg.ic { width: 21px; height: 21px; vertical-align: 0; }
.ni svg.ic, .ws-card-h .flag svg.ic { width: 20px; height: 20px; vertical-align: 0; }
svg.b-meta { color: #0467DF; } svg.b-claude { color: #D97757; } svg.b-gemini { color: #8E75B2; } svg.b-tiktok { color: var(--ink); }
svg.ni { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Estructura */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100%; }
nav.side {
  background: color-mix(in srgb, var(--side) 82%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 16px; margin-bottom: 6px; font-family: var(--disp); font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand .logo { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; box-shadow: 0 8px 20px -6px rgba(91, 107, 255, .6), inset 0 1px 0 rgba(255, 255, 255, .3); }
.brand small { display: block; font-family: var(--font); font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
/* País que se mira (con más de un país): las sumas y los reportes van en su moneda. */
.cpick { display: flex; align-items: center; gap: 8px; margin: 0 4px 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
.cpick select { flex: 1; min-width: 0; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; cursor: pointer; }
.ctag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }
.navgrp { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); opacity: .8; padding: 18px 12px 6px; }
nav.side a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 11px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
nav.side a > span:not(.count) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.side a svg.ni { color: var(--muted); transition: color .15s; }
nav.side a:hover { background: var(--hover); }
nav.side a:hover svg.ni { color: var(--ink); }
nav.side a.on { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent-2) 6%, transparent)); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent); }
nav.side a.on svg.ni { color: var(--accent); }
nav.side a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); box-shadow: 0 0 12px var(--accent); }
nav.side a.nav-top { font-weight: 600; }
.count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--grad); color: #fff; border-radius: 10px; padding: 0 6px; min-width: 20px; text-align: center; line-height: 19px; font-variant-numeric: tabular-nums; box-shadow: 0 4px 10px -4px rgba(91, 107, 255, .7); }
nav.side a.on .count { background: var(--grad); color: #fff; }
.side-foot { margin-top: auto; font-size: 13px; color: var(--muted); padding: 14px 4px 2px; display: grid; gap: 10px; border-top: 1px solid var(--line); }
.side-st { display: flex; flex-wrap: wrap; gap: 6px; }
.side-foot #logout { justify-self: start; }
main { min-width: 0; padding: 28px 36px 64px; animation: viewIn .28s ease-out; }
@keyframes viewIn { from { opacity: 0; } }

/* Tipografía */
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
h1 { font-family: var(--disp); font-size: 27px; font-weight: 800; margin: 0; letter-spacing: -.025em; line-height: 1.15; }
h2 { font-family: var(--disp); font-size: 15.5px; font-weight: 700; margin: 0 0 10px; letter-spacing: -.01em; }
h3 { font-size: 13.5px; font-weight: 650; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 6px 0 0; max-width: 80ch; font-size: 13.5px; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-size: 14px; }

/* Bloques: tarjetas suaves */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; box-shadow: var(--shadow); }
.panel > h2:first-child { margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.half { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .val { font-family: var(--disp); font-size: 27px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.15; }
.kpi .delta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.theme { display: flex; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.theme button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; background: none; border-radius: 9px; padding: 6px 4px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; }
.theme button svg.ni { width: 14px; height: 14px; }
.theme button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }

/* Tablas */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 13.5px; }
th { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 12px; background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; } th:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
th { border-bottom: 0; }
td { padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--hover); }
.num { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); padding: 26px 4px; text-align: center; font-size: 14px; }

/* Estados */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 10px 1px 9px; white-space: nowrap; line-height: 21px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; opacity: .9; }
.p-ok { background: var(--ok-soft); color: var(--ok); } .p-warn { background: var(--warn-soft); color: var(--warn); }
.p-crit { background: var(--crit-soft); color: var(--crit); } .p-info { background: var(--accent-soft); color: var(--accent); }
.p-mut { background: var(--soft); color: var(--muted); }

/* Controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--card); border-radius: 11px; padding: 7px 15px; min-height: 37px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink); text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .1s, filter .15s; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.btn:hover { background: var(--hover); border-color: color-mix(in srgb, var(--line-strong) 60%, var(--muted)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.pri { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -8px rgba(91, 107, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.pri:hover { filter: brightness(1.08) saturate(1.05); background: var(--grad); }
.btn.sm { padding: 4px 11px; min-height: 31px; font-size: 12.5px; border-radius: 9px; }
.btn.danger { color: var(--crit); }
.btn.danger:hover { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.btn svg.ni { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--line-strong); background: var(--hover); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -8px rgba(91, 107, 255, .9); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .input { border: 1px solid var(--line-strong); border-radius: 11px; padding: 8px 12px; min-height: 39px; background: var(--bg); width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 0; }
.field input:hover, .field select:hover, .field textarea:hover, .input:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--muted)); }
.field input.bad, .field textarea.bad { border-color: var(--crit) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 18%, transparent); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
/* Interruptor (switch) de Configuración */
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; position: relative; z-index: 5; /* el tooltip queda encima de los campos de abajo */ }
.switch-lbl { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
/* Tooltip de ayuda (ⓘ): con el mouse, el teclado o un toque */
.tip { position: relative; flex: none; align-self: flex-start; margin-top: 2px; }
.tip-btn { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--soft); color: var(--muted); font: 600 12px/1 Georgia, serif; font-style: italic; cursor: help; padding: 0; display: grid; place-items: center; }
.tip-btn:hover, .tip-btn:focus-visible, .tip.open .tip-btn { color: var(--accent); border-color: var(--accent); outline: none; }
.tip-box { position: absolute; top: calc(100% + 8px); right: -8px; z-index: 30; width: min(300px, 80vw); padding: 10px 12px; border-radius: 10px; background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); font-size: 12.5px; line-height: 1.5; font-weight: 400; box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .45), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s, visibility .12s; pointer-events: none; }
.tip-box::before { content: ''; position: absolute; top: -6px; right: 14px; width: 10px; height: 10px; background: var(--card); border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong); transform: rotate(45deg); }
.tip:hover .tip-box, .tip-btn:focus-visible + .tip-box, .tip.open .tip-box { opacity: 1; visibility: visible; transform: none; }
/* Tooltip al lado del nombre de un campo: se abre hacia la derecha (si no, saldría de la tarjeta). */
.lbl-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; } .lbl-row label { margin: 0; } .lbl-row .tip { margin-top: 0; align-self: center; }
.tip-left .tip-box { right: auto; left: -8px; } .tip-left .tip-box::before { right: auto; left: 12px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw-state { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
fieldset { min-width: 0; }

/* Listas tipo Telegram */
.queue { display: flex; flex-direction: column; }
.qitem { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.qitem:last-child { border-bottom: 0; }
.qitem .stripe { width: 8px; height: 8px; border-radius: 50%; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; font-size: 17px; flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }

svg text { fill: var(--muted); font: 11.5px var(--font); }
svg .gridl { stroke: var(--line); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* Chats */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; background: var(--side); border-radius: var(--radius); box-shadow: var(--shadow); height: calc(100vh - 40px); min-height: 520px; overflow: hidden; }
.ilist { border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; min-width: 0; padding: 6px; }
.conv .r { min-width: 0; }
.conv { padding: 8px 10px; border: 0; border-radius: 10px; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 12px; text-align: left; background: none; width: 100%; align-items: center; }
.conv:hover { background: var(--hover); }
.conv.on { background: var(--accent); color: var(--accent-ink); }
.conv.on .prev, .conv.on .t { color: var(--accent-ink); opacity: .85; }
.conv .r { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.conv .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .t { color: var(--muted); font-size: 12.5px; flex: none; }
.conv .prev { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .badge { background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; flex: none; }
.conv .badge.wait { background: var(--warn); color: #fff; }
.conv.on .badge { background: var(--accent-ink); color: var(--accent); }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thead { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--side); }
.thead .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thead .who small { display: block; color: var(--muted); font-size: 13px; }
.msgs { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; background: var(--chat-bg); overflow-y: auto; }
.m { max-width: min(80%, 460px); padding: 6px 10px 6px 11px; border-radius: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--bubble-ink); box-shadow: var(--shadow); font-size: 14.5px; }
.m.in { background: var(--bubble-in); align-self: flex-start; border-bottom-left-radius: 4px; }
.m.out { background: var(--bubble-out); align-self: flex-end; border-bottom-right-radius: 4px; }
.m.out.op { background: var(--bubble-op); }
.m .by { display: block; font-size: 12.5px; font-weight: 500; color: var(--accent); margin-bottom: 1px; }
.m .meta { float: right; font-size: 11.5px; color: var(--muted); margin: 6px 0 -2px 10px; }
.m.out .meta::after { content: " ✓✓"; color: var(--tick); }
.m .kb { display: flex; flex-direction: column; gap: 4px; margin: 8px -4px -2px; clear: both; }
.m .kb .kr { display: flex; gap: 4px; }
.m .kb .kr > * { flex: 1 1 0; min-width: 0; }
.m .kb span, .m .kb button, .m .kb a { background: rgba(0,0,0,.06); border: 0; color: var(--bubble-ink); border-radius: 8px; padding: 6px 8px; font-size: 13.5px; text-align: center; text-decoration: none; overflow-wrap: anywhere; }
.m .kb a { color: var(--accent); }
.m code.cp { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: 14.5px; background: rgba(0,0,0,.07); padding: 2px 6px; border-radius: 6px; cursor: pointer; letter-spacing: .02em; overflow-wrap: anywhere; }
.m a.doc { display: inline-block; margin-bottom: 4px; font-weight: 500; text-decoration: none; }
.m > a { display: block; }
.m > a > img.ph { cursor: zoom-in; }
.m img.ph { display: block; width: calc(100% + 17px); max-width: none; margin: -6px -6px 6px -11px; border-radius: 14px 14px 4px 4px; }
.m .kb button { cursor: pointer; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.m .kb button:hover { filter: brightness(.97); }
.ev { align-self: center; font-size: 12.5px; color: #fff; background: rgba(0,0,0,.28); border-radius: 12px; padding: 2px 10px; max-width: 92%; text-align: center; }
.pl-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.pl-tools .srch { flex: 1 1 320px; max-width: 520px; }
.chmoney { padding: 10px 12px; border-top: 1px solid var(--line); background: var(--side); display: grid; gap: 8px; min-width: 0; overflow-wrap: anywhere; max-height: 55vh; overflow-y: auto; }
.chmoney .chm-h { display: flex; justify-content: space-between; align-items: center; }
.chmoney .chm-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chmoney .chm-row .input { min-width: 0; flex: 2 1 160px; }
.chmoney .chm-row .input:first-child { flex: 1 1 110px; }
.chmoney .chm-info { margin: 0; font-size: 13.5px; }
.chmoney .chm-opts { display: grid; gap: 4px; font-size: 14px; }
.chmoney .chm-opts .check { margin: 0; align-items: flex-start; }
.chmoney .chm-opts .check input { margin-top: 1px; }
.chmoney .check { margin: 0; }
.chmoney .hint { margin: 0; }
.ch-acts { gap: 6px; flex-wrap: nowrap; }
.ch-acts .btn.on { background: var(--soft); border-color: var(--acc, var(--line)); }
@media (max-width: 720px) {
  .ch-acts .btn { padding-inline: 8px; }
}
.compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--side); align-items: center; }
.compose .input { border-radius: 20px; background: var(--soft); border-color: transparent; }
.profile { border-left: 1px solid var(--line); padding: 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.profile .head { text-align: center; display: grid; justify-items: center; gap: 6px; }
.profile .head .avatar { width: 72px; height: 72px; font-size: 26px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Simulador */
.phone { border-radius: 18px; overflow: hidden; background: var(--chat-bg); display: flex; flex-direction: column; height: 580px; box-shadow: var(--shadow); }
.phone .ph { background: var(--side); padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.phone .ph small { display: block; color: var(--muted); font-size: 12.5px; }

/* Bot y botones */
.bt-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.bt-prev { position: sticky; top: 16px; }
.bt-prev .phone { height: auto; min-height: 460px; max-height: calc(100vh - 60px); }
.bt-prev .msgs { min-height: 400px; }
.brows { display: grid; gap: 8px; margin-bottom: 10px; }
.brow { background: var(--soft); border-radius: 10px; padding: 8px; display: grid; gap: 6px; }
.bcells { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px; }
.bcell { background: var(--side); border-radius: 8px; padding: 8px; display: grid; gap: 6px; position: relative; box-shadow: var(--shadow); align-content: start; }
.bcell input, .bcell select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg); width: 100%; min-width: 0; font-size: 14px; }
.bcell input[data-f=text] { padding-right: 28px; font-weight: 500; }
.bcell .x { position: absolute; top: 9px; right: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 2px; }
.bcell .x:hover { color: var(--crit); }
.bcell .hint { font-size: 12.5px; color: var(--muted); }
.bops { display: flex; gap: 4px; flex-wrap: wrap; }
.bops button { border: 0; background: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 3px 8px; border-radius: 6px; }
.bops button:hover:not(:disabled) { background: var(--accent-soft); }
.bops button:disabled { color: var(--muted); opacity: .5; cursor: default; }
.bops .del { color: var(--crit); margin-left: auto; }
.thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 8px; background: var(--soft); }
/* Conexiones: cuenta de Telegram normal */
.cx-step { display: flex; gap: 8px; align-items: baseline; font-size: 14px; padding: 4px 0; color: var(--muted); }
.cx-step span { width: 18px; flex: none; text-align: center; }
.cx-step.ok { color: var(--ink); }
.cx-step.ok span { color: var(--ok); font-weight: 700; }
.cx-howto { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }

/* Mapa del bot */
.bt-grid.full { grid-template-columns: minmax(0, 1fr); }
.bt-grid.full .bt-prev { display: none; }
.map-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.map-tools .legend { flex-wrap: wrap; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg.k-msg { background: var(--accent); } .lg.k-auto { background: var(--ok); } .lg.k-own { background: #9B7BF0; } .lg.k-app { background: #F0A23B; }
.map-shell { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; align-items: start; }
.map-view { position: relative; overflow: auto; border-radius: var(--radius); box-shadow: var(--shadow); height: calc(100vh - 230px); min-height: 480px;
  background-color: var(--page); background-image: radial-gradient(rgba(127,127,127,.28) 1px, transparent 1px); background-size: 18px 18px; }
.map { position: relative; min-width: 100%; min-height: 100%; }
svg.edges { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 0; color: var(--accent); }
svg.edges path { fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .5; }
svg.edges path.back { stroke-dasharray: 5 5; opacity: .3; }
svg.edges path.hot { stroke-width: 2.4; opacity: .95; }
.node { position: absolute; z-index: 1; width: 248px; background: var(--side); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px 12px; cursor: grab; border: 2px solid transparent; border-left: 4px solid var(--accent); transition: border-color .15s, box-shadow .15s; touch-action: none; user-select: none; }
.node.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 10px 28px rgba(0,0,0,.28); transition: none; }
.node.drop { border-color: var(--ok) !important; box-shadow: 0 0 0 3px var(--ok-soft), var(--shadow); }
.node.sel { border-color: var(--accent); }
.node.k-auto { border-left-color: var(--ok); } .node.k-own { border-left-color: #9B7BF0; } .node.k-app { border-left-color: #F0A23B; }
.node.sel.k-app { border-color: #F0A23B; }
.node.sel.k-auto { border-color: var(--ok); } .node.sel.k-own { border-color: #9B7BF0; }
.node.start { width: auto; white-space: nowrap; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 500; font-size: 13.5px; }
.node .nh, .map-drawer .dh { display: flex; gap: 8px; align-items: center; }
.node .nh b, .map-drawer .dh b { display: block; font-weight: 500; font-size: 14px; line-height: 1.2; }
.node .nh small, .map-drawer .dh small { display: block; color: var(--muted); font-size: 12px; }
.ni { font-size: 18px; width: 30px; height: 30px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; flex: none; }
.node .nm { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.node .nmore, .node .nphoto { font-size: 12px; color: var(--accent); margin-top: 4px; }
.node .nsteps { margin: 6px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); }
.node .nb { display: grid; gap: 4px; margin-top: 8px; }
.chipb { display: flex; justify-content: space-between; gap: 6px; align-items: center; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 5px 9px; font-size: 12.5px; font-weight: 500; position: relative; }
.chipb > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipb .to { color: var(--muted); font-size: 11.5px; font-weight: 400; white-space: nowrap; }
.chipb .pt { position: absolute; right: -19px; top: 50%; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--side); transform: translateY(-50%); cursor: crosshair; z-index: 2; }
.chipb .pt::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; }
.chipb .pt.on { background: var(--accent); }
.chipb .pt:hover { box-shadow: 0 0 0 4px var(--accent-soft); }
.node .nadd { margin-top: 6px; width: 100%; border: 1px dashed var(--line); background: none; color: var(--muted); border-radius: 8px; padding: 4px; font-size: 12px; cursor: pointer; }
.node .nadd:hover { color: var(--accent); border-color: var(--accent); }
svg.edges path.tmp { stroke-dasharray: 5 4; opacity: 1; stroke-width: 2; }
.node .nbadges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.node .nbadges span { font-size: 11.5px; background: var(--soft); color: var(--muted); border-radius: 6px; padding: 1px 6px; }
.node .nloose { font-size: 12px; color: var(--warn); margin-top: 8px; }
.map-drawer { position: sticky; top: 12px; max-height: calc(100vh - 160px); overflow-y: auto; border-radius: var(--radius); }
.map-drawer .dh { margin-bottom: 10px; }
.map-drawer .dprev { border-radius: 12px; padding: 12px; margin-bottom: 14px; flex: none; max-height: 340px; }
.map-drawer .tips { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 8px; }
@media (max-width: 1150px) {
  .map-shell { grid-template-columns: minmax(0, 1fr); }
  .map-drawer { position: static; max-height: none; }
  .map-view { height: 60vh; }
}

/* API del casino y banco */
.op-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.mrow { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 0 10px; }
.mono-in { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: 13.5px !important; }
.vars { display: flex; flex-wrap: wrap; gap: 4px; }
.vars button { border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 8px; font-size: 12.5px; cursor: pointer; font-family: ui-monospace, Consolas, monospace; }
pre.res { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; overflow: auto; max-height: 360px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 0; font-family: ui-monospace, Consolas, monospace; }
pre.res.bad { color: var(--crit); }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--page); }
.login form { width: min(360px, 100%); text-align: center; padding: 28px; }
.login .logo { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #7B5CE0)); color: var(--accent-ink); display: grid; place-items: center; font-size: 34px; font-weight: 700; margin: 0 auto 14px; }
.login .field { text-align: left; }
.pn-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.pn-card:hover { border-color: var(--accent); }
.pn-card .flag { font-size: 28px; line-height: 1; }
.pn-card b { display: block; font-size: 16px; }
.pn-card small { color: var(--muted); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; background: rgba(0,0,0,.78); color: #fff; padding: 9px 16px; border-radius: 10px; max-width: min(420px, calc(100% - 32px)); z-index: 50; font-size: 14px; }
.toast.err { background: var(--crit); }

@media (max-width: 1150px) {
  .bt-grid { grid-template-columns: minmax(0, 1fr); }
  .bt-prev { position: static; }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
  .profile { display: none; }
  .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) { .mrow { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Menú lateral por grupos ---------- */
nav.side .nav-top { font-weight: 500; margin-bottom: 4px; }
nav.side .navsub { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; background: none; color: var(--ink); padding: 7px 12px; border-radius: 9px; cursor: pointer; font: inherit; font-size: 14px; text-align: left; }
nav.side .navsub:hover { background: var(--hover); }
nav.side .navsub::after { content: "›"; color: var(--muted); font-size: 18px; line-height: 1; transition: transform .15s; }
nav.side .navsub.open::after { transform: rotate(90deg); }
nav.side .subnav { display: flex; flex-direction: column; gap: 1px; }
nav.side .subnav.closed { display: none; }
nav.side .subnav a { padding-left: 26px; font-size: 14px; }

/* ---------- Conexiones como lista ---------- */
.cx-list { display: grid; gap: 10px; }
.panel.cxr { padding: 0; }
.cxr-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; border-radius: var(--radius); }
.cxr-head:hover { background: var(--hover); }
.cxr-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 19px; flex: none; }
.cxr-t { flex: 1; min-width: 0; }
.cxr-t b { display: block; font-weight: 500; }
.cxr-t small { display: block; color: var(--muted); font-size: 13px; }
.cxr-st { flex-wrap: wrap; justify-content: flex-end; }
.cxr-body { padding: 14px 16px 16px; border-top: 1px solid var(--line); }

/* ---------- Paneles laterales (crear enlace, configuración) ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { background: var(--side); width: min(440px, 100%); height: 100%; overflow-y: auto; padding: 18px 20px; box-shadow: -8px 0 24px rgba(0,0,0,.2); }
.drawer.wide { width: min(900px, 100%); }
/* Ventana centrada (por ejemplo, el editor de una promo) */
.modal-bg { position: fixed; inset: 0; z-index: 48; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: rgba(5, 8, 18, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn .2s ease-out; }
.modal { background: var(--side); width: min(760px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 18px 20px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,.35)); animation: popIn .2s cubic-bezier(.2, .9, .3, 1); }
.modal .field { align-content: start; }
.modal .modal-act { justify-content: flex-end; gap: 8px; position: sticky; bottom: -18px; background: var(--side); padding: 12px 0 2px; margin-top: 4px; border-top: 1px solid var(--line); }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (max-width: 720px) {
  .modal-bg { padding: 0; align-items: stretch; }
  .modal { width: 100%; max-height: 100%; border-radius: 0; border: 0; padding: calc(14px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); }
  .modal .modal-act { bottom: calc(-20px - env(safe-area-inset-bottom)); }
}
.drawer-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer-h h2 { margin: 0; }

/* ---------- Flujo del bot: espacio de trabajo ---------- */
.map-shell { display: block; position: relative; }
.map-view { height: calc(100vh - 190px); min-height: 520px; cursor: grab; }
.map-view.panning { cursor: grabbing; }
.map-help { position: absolute; left: 14px; top: 14px; max-width: min(560px, calc(100% - 28px)); background: var(--side); box-shadow: var(--shadow); border-radius: 12px; padding: 9px 34px 9px 12px; font-size: 12.5px; color: var(--muted); z-index: 6; }
.map-help b { color: var(--ink); font-weight: 500; }
.map-x { position: absolute; right: 6px; top: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.map-legend { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--side); box-shadow: var(--shadow); border-radius: 12px; padding: 6px 8px 6px 12px; font-size: 12.5px; color: var(--muted); z-index: 6; }
.map-zoom { position: absolute; left: 14px; bottom: 14px; display: flex; flex-direction: column; align-items: center; background: var(--side); box-shadow: var(--shadow); border-radius: 12px; overflow: hidden; z-index: 6; }
.map-zoom button { border: 0; background: none; color: var(--ink); width: 36px; height: 34px; cursor: pointer; font-size: 17px; }
.map-zoom button:hover { background: var(--hover); }
.map-zoom span { font-size: 11px; color: var(--muted); padding: 2px 0; }
.map-add { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 6; }
.map-palette { display: flex; gap: 6px; background: var(--side); box-shadow: 0 6px 20px rgba(0,0,0,.18); border-radius: 14px; padding: 8px; }
.map-palette button { display: grid; justify-items: center; gap: 3px; width: 98px; padding: 9px 6px; border: 0; border-radius: 10px; background: var(--soft); color: var(--ink); cursor: grab; font-size: 12.5px; touch-action: none; }
.map-palette button span { font-size: 20px; }
.map-palette button:hover { background: var(--accent-soft); }
.map-drawer { position: absolute; right: 12px; top: 12px; bottom: 12px; width: min(380px, calc(100% - 24px)); max-height: none; overflow-y: auto; z-index: 8; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.map-drawer > .panel { min-height: 100%; }
.map-shell.with-drawer .map-legend { right: 404px; }
#map-ghost { position: fixed; z-index: 100; pointer-events: none; background: var(--side); color: var(--ink); border: 2px dashed var(--accent); border-radius: 12px; padding: 8px 12px; font-size: 13px; box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .cxr-head { flex-wrap: wrap; }
  .cxr-st { width: 100%; justify-content: flex-start; }
  .map-legend { display: none; }
  .map-palette button { width: 76px; }
}

/* ---------- Analítica de rastreo (embudo) ---------- */
.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.fstep { background: var(--side); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; position: relative; }
.fstep-lbl { font-size: 13px; color: var(--muted); }
.fstep-n { font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 2px; }
.fstep-sub { font-size: 12px; color: var(--muted); }
.fstep-rate { position: absolute; top: 12px; right: 12px; font-size: 12.5px; font-weight: 500; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; }
.fstep-bar { height: 6px; background: var(--soft); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.fstep-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.fchart { display: flex; align-items: flex-end; gap: 3px; height: 180px; }
.fcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.fcol span { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.fbar { width: 100%; max-width: 26px; background: var(--bar-ret); border-radius: 5px 5px 2px 2px; display: flex; align-items: flex-end; overflow: hidden; min-height: 2px; }
.fbar-in { width: 100%; background: var(--accent); }
@media (max-width: 1000px) { .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Tablero de Publicidad ---------- */
.dfilters { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.calwrap { position: relative; display: inline-flex; }
.calpop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 280px; padding: 12px; box-shadow: 0 8px 28px rgba(16, 35, 47, .18); }
.cal-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; text-transform: capitalize; }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-g i { font-style: normal; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-g button { border: 0; background: none; border-radius: 8px; padding: 7px 0; font-size: 13.5px; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-g button:hover { background: var(--hover); }
.cal-g button.in { background: var(--accent-soft); }
.cal-g button.edge { background: var(--accent); color: var(--accent-ink); }
.cal-g button.today { font-weight: 700; }
.cal-g button.off { color: var(--muted); opacity: .4; cursor: default; }
.dkpis { grid-template-columns: repeat(4, minmax(0, 1fr)); transition: opacity .15s; }
.dkpis.loading, .dkpis.loading ~ #db-chart-wrap { opacity: .55; }
@media (max-width: 1150px) { .dkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dk { text-align: left; font: inherit; color: inherit; border: 0; cursor: default; }
button.dk { cursor: pointer; }
button.dk:hover { box-shadow: 0 0 0 1px var(--line), var(--shadow); }
button.dk.on { box-shadow: 0 0 0 2px var(--accent); }
.dl { font-weight: 500; color: var(--ink); }
.dl.up { color: var(--ok); } .dl.down { color: var(--crit); }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 5px 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--side); color: var(--ink); box-shadow: var(--shadow); }
.dchart { position: relative; display: grid; grid-template-columns: 64px 1fr; grid-template-rows: 220px auto; }
.dgrid { grid-column: 1 / 3; grid-row: 1; position: relative; }
.gl { position: absolute; left: 64px; right: 0; border-top: 1px solid var(--line); }
.gl span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dbars { grid-column: 2; grid-row: 1; display: flex; align-items: flex-end; gap: 2px; position: relative; }
.dcol { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 6px; }
.dcol.hover { background: var(--hover); }
.dbar { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.dbar.zero { min-height: 2px; background: var(--line); }
.dx { grid-column: 2; grid-row: 2; display: flex; gap: 2px; }
.dx span { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); padding-top: 6px; white-space: nowrap; overflow: visible; }
.dtip { position: absolute; z-index: 20; pointer-events: none; background: var(--side); box-shadow: 0 6px 22px rgba(16, 35, 47, .2); border-radius: 10px; padding: 10px 12px; font-size: 13px; min-width: 200px; display: grid; gap: 3px; }
.dtip div { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); }
.dtip div b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.heat { display: flex; flex-wrap: wrap; gap: 18px; }
.hmonth { flex: 1; min-width: 250px; max-width: 420px; }
.hm-t { font-weight: 500; margin-bottom: 6px; text-transform: capitalize; }
.hgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.hd { font-size: 11.5px; color: var(--muted); text-align: center; }
.hc { aspect-ratio: 1 / .82; border-radius: 6px; background: var(--soft); display: flex; flex-direction: column; justify-content: space-between; padding: 3px 5px; font-size: 11px; min-width: 0; }
.hc i { font-style: normal; color: var(--muted); }
.hc b { font-weight: 500; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.hc.out { background: none; }
.hc.out i { opacity: .45; }
.hc.l1 { background: color-mix(in srgb, var(--accent) 18%, var(--side)); }
.hc.l2 { background: color-mix(in srgb, var(--accent) 40%, var(--side)); }
.hc.l3 { background: color-mix(in srgb, var(--accent) 68%, var(--side)); }
.hc.l4 { background: var(--accent); }
.hc.l3 i, .hc.l3 b, .hc.l4 i, .hc.l4 b { color: var(--accent-ink); }
.hc.hover { box-shadow: 0 0 0 2px var(--ink); }
.legend.hl { align-items: center; gap: 4px; margin-top: 10px; }
.legend.hl i.hc { width: 14px; height: 14px; aspect-ratio: auto; padding: 0; border-radius: 4px; margin: 0; }
h2.sect { font-size: 16px; font-weight: 500; margin: 22px 0 10px; }
@media (max-width: 760px) {
  .dchart { grid-template-columns: 48px 1fr; grid-template-rows: 180px auto; }
  .gl { left: 48px; }
  .calpop { left: auto; right: 0; }
}

/* ---------- Varios bots ---------- */
.botbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; }
.botbar label { font-weight: 500; }
.cx-bots { margin-bottom: 6px; min-width: 0; }
.cx-list > * { min-width: 0; }
.cx-bots-h { justify-content: space-between; align-items: flex-end; margin-bottom: 10px; flex-wrap: nowrap; }
@media (max-width: 760px) { .cx-bots-h { flex-wrap: wrap; } .cx-bots-h > .row { flex: 1 1 100%; min-width: 0; } .cx-bots-h .btn { flex: 1 1 auto; white-space: normal; } .botbar .row { margin-left: 0 !important; } }

/* ---------- Cuentas de Telegram normales y guía para agregarlas ---------- */
.cx-sub { font-size: 14px; font-weight: 500; color: var(--muted); margin: 14px 0 8px; }
.acc-list { margin-bottom: 4px; }
.acc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.acc-row:first-of-type { border-top: 0; }
.acc-empty { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.acc-empty > div { flex: 1; }
.wz-steps { display: flex; gap: 6px; margin-bottom: 16px; }
.wz-steps span { flex: 1; font-size: 12.5px; color: var(--muted); border-top: 3px solid var(--line); padding-top: 6px; }
.wz-steps span.on { color: var(--ink); border-color: var(--accent); font-weight: 500; }
.wz-steps span.ok { color: var(--ok); border-color: var(--ok); }
.wz-wait { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.wz-done { text-align: center; padding: 8px 0 4px; }
.wz-ok { width: 52px; height: 52px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 26px; font-weight: 700; display: grid; place-items: center; margin: 0 auto; }
@media (max-width: 760px) { .acc-row { grid-template-columns: auto minmax(0, 1fr); } .acc-row > .row { grid-column: 1 / -1; } .acc-empty { flex-wrap: wrap; } }
.cx-bots-h .btn { white-space: nowrap; }
.cx-bots-act { flex-wrap: nowrap; }
@media (max-width: 760px) { .cx-bots-act { flex-wrap: wrap; } }
.cx-bots-h > div { flex: 1 1 auto; min-width: 0; }

/* ---------- Ganancias (estado de resultados) y retención ---------- */
.fkpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rkpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1150px) { .fkpis, .rkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pnl { display: grid; gap: 2px; }
.pnl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 7px 0; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.pnl-row b { font-weight: 500; text-align: right; }
.pnl-row small { display: block; font-size: 12px; color: var(--muted); }
.pnl-row.cost { grid-template-columns: minmax(0, 1fr) 120px auto; color: var(--muted); }
.pnl-row.cost b { color: var(--ink); }
.pnl-row.sum { border-top: 1px solid var(--line); font-weight: 500; }
.pnl-row.total { border-top: 2px solid var(--line); font-size: 17px; font-weight: 500; padding-top: 10px; }
.pnl-bar { display: block; height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; min-width: 60px; }
.pnl-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.share { display: grid; grid-template-columns: auto 80px auto; gap: 8px; align-items: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.share b { font-weight: 500; }
.fx-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.fx-row:first-child { border-top: 0; }
.fx-row.ended { opacity: .6; }
.seg-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 56px auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.seg-row:first-child { border-top: 0; }
.rt-bigs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rt-big { background: var(--soft); border-radius: 12px; padding: 12px; text-align: center; }
.rt-big .val { font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.rt-big .lbl { font-size: 13px; }
table.coh td.hm { font-variant-numeric: tabular-nums; }
table.coh td.hm.l0 { color: var(--muted); }
table.coh td.hm.l1 { background: color-mix(in srgb, var(--accent) 14%, var(--side)); }
table.coh td.hm.l2 { background: color-mix(in srgb, var(--accent) 32%, var(--side)); }
table.coh td.hm.l3 { background: color-mix(in srgb, var(--accent) 58%, var(--side)); color: var(--accent-ink); }
table.coh td.hm.l4 { background: var(--accent); color: var(--accent-ink); }
table.coh td.hm-na { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--soft) 6px 8px); }
@media (max-width: 760px) {
  .pnl-row.cost { grid-template-columns: minmax(0, 1fr) auto; } .pnl-row.cost .pnl-bar { display: none; }
  .seg-row { grid-template-columns: minmax(0, 1fr) 56px; } .seg-row .pnl-bar, .seg-row > :last-child { display: none; }
  .rt-bigs { grid-template-columns: 1fr; }
  .share { grid-template-columns: auto auto; } .share .pnl-bar { display: none; }
}
/* Estado de los jugadores y frecuencia: nombre, número y botón arriba; la barra abajo a lo ancho. */
.seg-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; }
.seg-row > .pnl-bar { grid-column: 1 / -1; grid-row: 2; }
.seg-row > .num { text-align: right; }
@media (max-width: 760px) { .seg-row { grid-template-columns: minmax(0, 1fr) auto auto; } .seg-row .pnl-bar, .seg-row > :last-child { display: block; } }

/* ---------- Bots y cuentas (como Creadoras) ---------- */
.avatar.pic { object-fit: cover; background: var(--soft); }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; display: grid; border-radius: 50%; margin: 0; }
.bot-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.bot-card { display: grid; gap: 10px; }
.bc-head { display: flex; align-items: center; gap: 10px; }
.bc-head > div { flex: 1; }
.bc-acc { font-size: 13.5px; background: var(--soft); border-radius: 10px; padding: 7px 10px; }
.bc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.bc-stats div { display: grid; }
.bc-stats span { font-size: 12px; color: var(--muted); }
.bc-stats b { font-weight: 500; font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Perfil del bot */
.pf-photo { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cnt { float: right; font-size: 12px; color: var(--muted); font-weight: 400; }
.btn.disabled { opacity: .45; pointer-events: none; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.panel.soft { background: var(--soft); box-shadow: none; }
.tg-phone { background: var(--bg); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; max-width: 340px; margin: 0 auto; display: flex; flex-direction: column; min-height: 420px; }
.tg-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--side); border-bottom: 1px solid var(--line); }
.tg-top small { display: block; font-size: 12px; color: var(--muted); }
.tg-empty { flex: 1; display: grid; place-items: center; padding: 18px; background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.tg-card { background: color-mix(in srgb, #000 35%, transparent); color: #fff; border-radius: 14px; padding: 12px 14px; max-width: 260px; font-size: 13.5px; }
.tg-card p { margin: 6px 0 0; white-space: pre-wrap; line-height: 1.4; }
.tg-start { text-align: center; padding: 12px; font-weight: 500; color: var(--accent); background: var(--side); border-top: 1px solid var(--line); letter-spacing: .04em; }
/* Hábitos del jugador (Chats) */
.learned { background: var(--soft); border-radius: 12px; padding: 10px 12px; }
.learned h3 { margin-top: 0; }
.learned .risk { margin: 8px 0 0; font-size: 13px; color: var(--crit); }
/* Asesor IA */
.av-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
@media (max-width: 1150px) { .av-grid { grid-template-columns: 1fr; } }
.av-list { display: grid; gap: 10px; }
.av-item h3 { font-size: 16px; }
.av-item.done, .av-item.dismissed { opacity: .8; }
.av-p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }
.av-cmp { margin-top: 6px; font-size: 13px; background: var(--soft); border-radius: 8px; padding: 6px 8px; }
.av-warn { margin-bottom: 12px; border-left: 3px solid var(--warn); }
.mem-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mem-row:first-child { border-top: 0; }
#av-tabs .chip span { margin-left: 4px; font-size: 12px; opacity: .8; }

/* ---------- Cobros y autorización ---------- */
.cb-status { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: center; border-left: 4px solid var(--ok); }
.cb-status.backup { border-left-color: var(--warn); }
.cb-status .lbl { font-size: 13px; color: var(--muted); }
.cb-acc { font-size: 17px; margin: 2px 0 4px; }
.cb-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cb-row:first-child { border-top: 0; }
.cb-form { background: var(--soft); border-radius: 12px; padding: 12px; margin: 4px 0 10px; }
label.radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; font-size: 14px; }
label.radio input { margin-top: 3px; accent-color: var(--accent); }
code.cp { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; background: var(--soft); padding: 2px 6px; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; }
code.cp.big { display: inline-block; font-size: 15px; padding: 6px 10px; margin-top: 4px; }
@media (max-width: 760px) { .cb-status { grid-template-columns: 1fr; } }
/* Ejemplo de charla de vínculo */
.bubble-out { display: inline-block; max-width: 420px; background: var(--accent); color: var(--accent-ink); border-radius: 14px 14px 4px 14px; padding: 8px 12px; font-size: 14.5px; line-height: 1.4; white-space: pre-wrap; }
/* Vista previa de un mensaje al grupo */
.tg-msg { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; max-width: 460px; }
/* Vista previa de la mini app (un teléfono) */
.ma-phone { width: 340px; max-width: 100%; height: 640px; margin: 0 auto 8px; border: 8px solid #1d2733; border-radius: 34px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.ma-phone iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
/* Guía del dominio */
.ma-guide { margin-top: 12px; }
.ma-guide summary { cursor: pointer; font-weight: 500; color: var(--accent); }
.ma-guide code { font-size: 12.5px; background: var(--soft); padding: 1px 5px; border-radius: 5px; }

/* Conector de Claude */
.mk-val { flex: 1; min-width: 0; display: block; background: var(--soft); border-radius: 8px; padding: 7px 10px; font: 12.5px/1.4 ui-monospace, Consolas, monospace; overflow-x: auto; white-space: nowrap; }
.mk-fresh { border: 1px solid var(--ok); }
.mk-ask { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }

/* ---------- Encuadre general (computadora) ---------- */
.inbox, .map-view { border: 1px solid var(--line); }
.drawer { border-left: 1px solid var(--line); }
.calpop, .dtip { border: 1px solid var(--line); }
.seg { border: 1px solid var(--line); }
.ch-back { display: none; }

/* ---------- Celular: barra de arriba, menú que se desliza y accesos abajo ---------- */
.mbar, .tabbar, .scrim { display: none; }
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { display: block; min-height: 100dvh; }

  .mbar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: 4px; min-height: 56px; padding: env(safe-area-inset-top) 6px 0; background: color-mix(in srgb, var(--side) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mbar-title { flex: 1; min-width: 0; font-weight: 650; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 12px; color: var(--ink); text-decoration: none; cursor: pointer; flex: none; }
  .mbar-btn:active { background: var(--hover); }
  .mbar-btn svg { width: 24px; height: 24px; }
  .mbar-btn .count { position: absolute; top: 3px; right: 1px; }

  nav.side { position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(86vw, 310px); height: 100%; padding: calc(14px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom)); transform: translateX(-104%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); border-right: 0; flex-direction: column; overflow-y: auto; }
  body.nav-open nav.side { transform: none; }
  body.nav-open { overflow: hidden; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(4, 10, 16, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  nav.side a, nav.side .navsub { padding-top: 11px; padding-bottom: 11px; font-size: 15px; }
  nav.side .subnav a { padding-left: 26px; }

  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 45; inset: auto 0 0 0; padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--side) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 6px 0 5px; border: 0; background: none; font: 500 11px/1.2 var(--font); color: var(--muted); text-decoration: none; cursor: pointer; }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .on { color: var(--accent); }
  .tabbar .count { position: absolute; top: 4px; left: calc(50% + 5px); font-size: 10.5px; min-width: 18px; line-height: 17px; padding: 0 5px; }

  main { padding: 16px 14px calc(86px + env(safe-area-inset-bottom)); }
  .top { margin-bottom: 14px; padding-bottom: 12px; align-items: flex-start; }
  .top > div:first-child { flex: 1 1 100%; }
  h1 { font-size: 21px; }
  .sub { font-size: 13.5px; }
  .panel { padding: 14px; border-radius: 12px; }
  .kpi { padding: 12px 14px; }
  .grid { gap: 10px; }
  .kpis, .dkpis, .fkpis, .rkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .val { font-size: 19px; }
  .two, .half, .grid.two, .grid.half { grid-template-columns: minmax(0, 1fr); }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .field input, .field select, .field textarea, .input { font-size: 16px; min-height: 42px; } /* sin zoom al tocar en iPhone */
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  table { font-size: 13px; }
  th, td { padding: 9px 10px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .drawer, .drawer.wide { width: 100%; border-left: 0; padding: calc(14px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); }

  /* Chats: primero la lista; al tocar uno, la conversación a pantalla completa (con "volver"). */
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 56px - 16px - 86px - env(safe-area-inset-bottom)); min-height: 380px; }
  .inbox .thread { display: none; }
  .inbox.show-thread .ilist { display: none; }
  .inbox.show-thread .thread { display: flex; }
  .ilist { max-height: none; border-right: 0; border-bottom: 0; }
  .thead { padding: 8px 10px; }
  .ch-back { display: inline-flex; padding: 0 10px; font-size: 20px; line-height: 1; }
  .msgs { min-height: 0; padding: 12px; }
  .m { max-width: 86%; }
  .compose { padding: 8px; }
}

/* Depósitos: comprobantes para revisar (miniatura del comprobante + datos y acciones) */
.rv-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rv-item:first-child { padding-top: 0; }
.rv-item:last-child { border-bottom: 0; }
.rv-thumb { width: 96px; height: 128px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12.5px; text-align: center; text-decoration: none; padding: 4px; box-sizing: border-box; }
.rv-thumb img { width: calc(100% + 8px); height: calc(100% + 8px); margin: -4px; object-fit: cover; display: block; }
.rv-thumb.pdf { font-size: 15px; color: var(--ink); }
.rv-thumb.sm { width: 48px; height: 64px; }
@media (max-width: 520px) { .rv-item { grid-template-columns: 72px minmax(0, 1fr); } .rv-thumb { width: 72px; height: 96px; } }

/* Interruptor (prender/apagar): por ejemplo, cada promo en Promociones. */
.sw { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; white-space: nowrap; user-select: none; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw span { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong); transition: background .15s; }
.sw span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span::after { transform: translateX(16px); }
.sw input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Chats: buscador, bot y grupos arriba de la lista (quedan fijos al bajar). */
.ch-top { position: sticky; top: 0; z-index: 1; background: var(--side); padding: 8px 6px 4px; margin: -6px -6px 4px; border-bottom: 1px solid var(--line); }
.ch-tools { display: flex; gap: 6px; margin-bottom: 6px; }
.ch-tools #ch-q { flex: 1; min-width: 0; }
.ch-tools #ch-bot { width: auto; max-width: 45%; }
.ch-top .chips { margin: 0; flex-wrap: wrap; }

/* ---------- Diseño: piezas nuevas y retoques sobre lo de arriba ---------- */
/* Menú: grupos que se abren con su ícono y los subitems colgando de una línea. */
nav.side .navsub { gap: 11px; padding: 8px 11px; border-radius: 11px; font-weight: 500; }
nav.side .navsub .nsl { display: flex; align-items: center; gap: 11px; }
nav.side .navsub svg.ni { color: var(--muted); }
nav.side .subnav { margin: 1px 0 4px 20px; padding-left: 8px; border-left: 1px solid var(--line); }
nav.side .subnav a { padding-left: 10px; font-size: 13.5px; }
nav.side .subnav a.on::before { left: -9px; }

/* Avisos abajo: con su ícono y entrando suave. */
.toast { display: flex; align-items: center; gap: 10px; bottom: 26px; padding: 10px 16px 10px 11px; border-radius: 14px; font-weight: 500; color: #fff;
  background: rgba(15, 23, 42, .92); border: 1px solid rgba(255, 255, 255, .08); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow-lg); animation: toastIn .28s cubic-bezier(.2, .9, .3, 1.15); }
.toast::before { content: "✓"; flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #22C55E; font-size: 12px; font-weight: 800; }
.toast.err { background: rgba(190, 18, 60, .95); }
.toast.err::before { content: "!"; background: rgba(255, 255, 255, .22); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px) scale(.97); } }

/* Entrar y elegir el panel: luces de color detrás de una tarjeta de vidrio. */
.login { position: relative; overflow: hidden; background: transparent; }
.login::before { content: ""; position: fixed; inset: -10%; z-index: 0; pointer-events: none;
  background: radial-gradient(560px 420px at 28% 30%, rgba(91, 107, 255, .32), transparent 70%), radial-gradient(520px 400px at 74% 72%, rgba(139, 92, 246, .26), transparent 70%);
  animation: glowDrift 16s ease-in-out infinite alternate; }
.login > * { position: relative; z-index: 1; }
.login form.panel, .login > .panel { border-radius: 26px; background: color-mix(in srgb, var(--card) 84%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--shadow-lg); }
.login form { padding: 34px 30px 30px; width: min(380px, 100%); }
.login .logo { background: var(--grad); color: #fff; border-radius: 20px; font-family: var(--disp); font-weight: 800; box-shadow: 0 16px 34px -12px rgba(91, 107, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .3); }
.login h1 { font-size: 27px; }
.login .btn.pri { min-height: 44px; font-size: 14.5px; }
@keyframes glowDrift { to { transform: translate3d(3%, 2%, 0) scale(1.06); } }
.pn-card { border-radius: 16px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.pn-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }

/* Chats: el elegido con el degradé, como el menú. */
.inbox { border-radius: var(--radius); }
.conv { border-radius: 12px; transition: background .12s; }
.conv .badge { background: var(--grad); color: #fff; font-weight: 700; }
.conv.on { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent-2) 7%, transparent)); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.conv.on .prev, .conv.on .t { color: var(--muted); opacity: 1; }
.conv.on .badge { background: var(--grad); color: #fff; }
.compose .input { border-radius: 22px; }

/* Paneles laterales: entran deslizando. */
.drawer-bg { background: rgba(5, 8, 18, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn .2s ease-out; }
.drawer { border-radius: 24px 0 0 24px; box-shadow: var(--shadow-lg); animation: slideIn .3s cubic-bezier(.2, .9, .3, 1); }
@keyframes slideIn { from { opacity: .4; transform: translateX(48px); } }
@keyframes fadeIn { from { opacity: 0; } }
.seg button.on { background: var(--card); }
.fstep, .rt-big { border-radius: 16px; }
.fstep-bar span, .pnl-bar i, .fbar-in, .dbar { background: var(--grad); }
.fstep-n, .rt-big .val { font-family: var(--disp); font-weight: 800; letter-spacing: -.02em; }
.sw input:checked + span { background: var(--grad); }

/* ---------- Panel (inicio) ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hello .eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hello .eyebrow .date::first-letter { text-transform: uppercase; }
.live { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; flex: none; animation: live 2.2s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } }
.hello h1 { font-size: 31px; margin-top: 6px; }
.hello h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.hello .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.kpis.dash { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1380px) { .kpis.dash { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kx { display: flex; flex-direction: column; padding: 18px 18px 14px; transition: transform .18s, box-shadow .18s, border-color .18s; }
.kx:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--kc) 35%, var(--line)); box-shadow: 0 16px 34px -18px color-mix(in srgb, var(--kc) 70%, transparent); }
.kx::after { content: ""; position: absolute; right: -46px; top: -46px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--kc) 22%, transparent), transparent); pointer-events: none; }
.kx .kh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.kic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--kc) 14%, transparent); color: var(--kc); flex: none; }
.kic svg.ni { width: 19px; height: 19px; }
.kx.k-dep { --kc: var(--accent); } .kx.k-wd { --kc: #A855F7; } .kx.k-net { --kc: var(--ok); } .kx.k-auto { --kc: var(--warn); } .kx.k-lead { --kc: var(--cyan); }
.kx .delta { flex: 1; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; line-height: 21px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trend.up { background: var(--ok-soft); color: var(--ok); } .trend.down { background: var(--crit-soft); color: var(--crit); } .trend.eq { background: var(--soft); color: var(--muted); }
.spark { height: 40px; margin: 12px -6px -6px; }
.spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.kbar { height: 7px; border-radius: 99px; background: var(--soft); overflow: hidden; margin: 14px 0 6px; }
.kbar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--warn), #FCD34D); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

.ch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ch-tot { display: flex; gap: 22px; flex-wrap: wrap; }
.ch-tot div { display: grid; gap: 1px; }
.ch-tot span { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ch-tot span i { width: 9px; height: 9px; border-radius: 3px; }
.ch-tot b { font-family: var(--disp); font-size: 19px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
#pn-chart rect.bar { transition: opacity .15s; }
#pn-chart g.day:hover rect.bar { opacity: .8; }
#pn-chart g.day rect.hit { fill: transparent; }
#pn-chart g.day:hover rect.hit { fill: var(--hover); }

.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h2 { margin: 0; }
.card-h > a { font-size: 13px; font-weight: 600; text-decoration: none; }
.todo { display: grid; gap: 8px; }
.todo > a, .todo > div { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--soft); border: 1px solid transparent; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s, background .15s; }
.todo > a:hover { border-color: var(--line-strong); background: var(--hover); transform: translateX(2px); }
.tic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc) 15%, transparent); color: var(--tc); }
.todo .n { font-family: var(--disp); font-size: 19px; font-weight: 800; margin-right: 5px; font-variant-numeric: tabular-nums; }
.todo small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.todo .chev { color: var(--muted); }
.allgood { display: grid; justify-items: center; gap: 10px; padding: 30px 8px; text-align: center; color: var(--muted); font-size: 13.5px; }
.allgood .okb { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 0 9px color-mix(in srgb, var(--ok) 8%, transparent); }
.allgood .okb svg.ni { width: 26px; height: 26px; stroke-width: 2.4; }
.allgood b { color: var(--ink); font-family: var(--disp); font-size: 16px; }

.opk { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.opk i { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.opk i svg.ni { width: 16px; height: 16px; }
.opk.dep i { background: var(--accent-soft); color: var(--accent); }
.opk.wd i { background: color-mix(in srgb, #A855F7 14%, transparent); color: #A855F7; }
.opwho { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; }
.avatar.xs { width: 26px; height: 26px; font-size: 11px; font-weight: 700; }
.amt { font-weight: 700; }
.amt.in { color: var(--ok); }

/* ---------- Tarjetas de números en los reportes (Ganancias, Retención, Publicidad) ---------- */
.kx.k-cost { --kc: var(--crit); } .kx.k-pink { --kc: #EC4899; }
.kx.k-hero { --kc: #fff; background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 18px 40px -18px rgba(91, 107, 255, .9); }
.kx.k-hero.neg { background: linear-gradient(135deg, #E11D48, #9F1239); box-shadow: 0 18px 40px -18px rgba(225, 29, 72, .8); }
.kx.k-hero .lbl, .kx.k-hero .delta { color: rgba(255, 255, 255, .82); }
.kx.k-hero .kic { background: rgba(255, 255, 255, .18); color: #fff; }
.kx.k-hero::after { background: radial-gradient(closest-side, rgba(255, 255, 255, .22), transparent); }
.kx.k-hero .dl { background: rgba(255, 255, 255, .2); color: #fff; }
.dl { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; line-height: 21px; white-space: nowrap; background: var(--soft); color: var(--muted); font-variant-numeric: tabular-nums; }
.dl.up { background: var(--ok-soft); color: var(--ok); } .dl.down { background: var(--crit-soft); color: var(--crit); }
.kx.dk { border: 1px solid var(--line); cursor: default; }
button.kx.dk { cursor: pointer; }
button.kx.dk:hover { box-shadow: 0 16px 34px -18px color-mix(in srgb, var(--kc) 70%, transparent); }
button.kx.dk.on { border-color: transparent; box-shadow: 0 0 0 2px var(--accent), 0 16px 34px -18px color-mix(in srgb, var(--accent) 80%, transparent); }
.fkpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pnl-row.total { font-family: var(--disp); font-weight: 800; font-size: 18px; border-top: 0; margin-top: 6px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pnl-row.sum { border-top: 1px dashed var(--line-strong); }
.pnl-bar { height: 7px; border-radius: 99px; }
.dbar { border-radius: 6px 6px 2px 2px; }
.dtip { border-radius: 14px; box-shadow: var(--shadow-lg); }

/* ---------- Chats ---------- */
.ch-top { padding: 10px 8px 8px; margin: -6px -6px 6px; background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.ch-tools { gap: 6px; margin-bottom: 8px; }
.srch { position: relative; flex: 1; min-width: 0; display: block; }
.srch svg.ni { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.srch .input { padding-left: 34px; border-radius: 12px; background: var(--soft); border-color: transparent; }
.srch .input:focus { background: var(--bg); }
.ch-tools #ch-bot { width: auto; max-width: 46%; border-radius: 12px; background: var(--soft); border-color: transparent; font-weight: 600; font-size: 13px; cursor: pointer; }
.ch-top .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; gap: 5px; }
.ch-top .chips::-webkit-scrollbar { display: none; }
.ch-top .chip { flex: none; padding: 4px 11px; font-size: 12.5px; }
.conv { padding: 9px 10px; gap: 0 12px; }
.cav { position: relative; display: inline-flex; flex: none; }
.cv-vip { position: absolute; right: -3px; bottom: -2px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-style: normal; color: #7A4B00; background: linear-gradient(135deg, #FFE29A, #F5B53D); box-shadow: 0 0 0 2px var(--card); }
.conv.wait .avatar { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--warn); }
.wait-t { color: var(--warn); font-weight: 700; }
.conv .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 0 6px; line-height: 18px; white-space: nowrap; vertical-align: 1px; }
.mini svg.ni { width: 12px; height: 12px; }
.mini.ok { color: var(--ok); background: var(--ok-soft); }
.mini.warn { color: var(--warn); background: var(--warn-soft); margin-left: 4px; }
.mini.vip { color: #8A5A00; background: linear-gradient(135deg, #FFE9B0, #F8C866); margin-left: 4px; }
.conv.on .mini { background: color-mix(in srgb, var(--card) 70%, transparent); }
.thead { padding: 10px 16px; background: color-mix(in srgb, var(--card) 92%, transparent); }
.thead .who b { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.msgs { background-color: var(--chat-bg); background-image: radial-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 1px, transparent 1.4px); background-size: 22px 22px; }
.m { border-radius: 16px; box-shadow: 0 1px 1px rgba(15, 23, 42, .06), 0 2px 8px -4px rgba(15, 23, 42, .12); }
.m.out { background: var(--bubble-out); }
.m.out.op { background: var(--bubble-op); }
.m .kb span, .m .kb button, .m .kb a { border-radius: 10px; }
.compose { padding: 10px 12px 12px; }
.compose .input { background: var(--soft); border-color: transparent; padding-left: 16px; }
.compose .input:focus { background: var(--bg); border-color: var(--accent); }
#ch-quick .chip { padding: 3px 10px; font-size: 12.5px; }
/* Ficha del jugador */
.profile { padding: 0 16px 20px; gap: 14px; }
.profile .head { position: relative; padding-top: 22px; gap: 4px; }
.profile .head > * { position: relative; }
.profile .pban { position: absolute; left: -16px; right: -16px; top: 0; height: 64px; background: var(--grad); opacity: .9; }
.profile .pban::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120px 60px at 80% 10%, rgba(255, 255, 255, .35), transparent 70%); }
.profile .head .avatar { box-shadow: 0 0 0 4px var(--card), 0 10px 24px -8px rgba(15, 23, 42, .4); margin-bottom: 4px; }
.profile .head small { font-size: 12.5px; }
.ptiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ptiles .hl { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; }
.ptiles .hl b { font-size: 17px; }
.ptiles > div { display: grid; gap: 1px; padding: 9px 9px 8px; border-radius: 12px; background: var(--soft); min-width: 0; }
.ptiles span { font-size: 11px; font-weight: 600; color: var(--muted); }
.ptiles b { font-family: var(--disp); font-weight: 800; font-size: 15px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ptiles .hl { background: var(--grad); color: #fff; }
.ptiles .hl span { color: rgba(255, 255, 255, .82); }
.profile h3 { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.profile dl.kv { font-size: 13.5px; gap: 7px 12px; }
.learned { border-radius: 14px; border: 1px solid var(--line); }
@media (max-width: 760px) {
  .fkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fkpis > :last-child { grid-column: 1 / -1; }
}

/* Sin conexión con el servidor */
.offline { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 90; max-width: min(560px, calc(100% - 24px)); padding: 10px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 600; color: #fff; background: rgba(190, 18, 60, .95); box-shadow: var(--shadow-lg); animation: toastIn .25s ease-out; }

/* Enlaces → Qué dice el bot al tocar Iniciar */
.sp-item { margin-bottom: 16px; }
.sp-item h3 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.sp-chat { border-radius: 16px; padding: 14px; flex: none; }
.sp-chat .m { max-width: 100%; }
.spoil { filter: blur(4px); background: color-mix(in srgb, var(--ink) 25%, transparent); border-radius: 4px; padding: 0 2px; }

/* Mini apps → Diseño: los temas para elegir */
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.th { display: grid; gap: 6px; justify-items: start; text-align: left; padding: 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.th:hover:not(:disabled) { border-color: var(--line-strong); transform: translateY(-1px); }
.th.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.th:disabled { cursor: default; }
.th-sw { position: relative; width: 100%; height: 54px; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25); }
.th-sw i { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 16px; border-radius: 6px; }
.th-sw b { position: absolute; left: 8px; top: 8px; width: 46%; height: 16px; border-radius: 6px; }
.th-n { font-weight: 600; font-size: 13px; }
.th small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }

/* Recorte de banner (imágenes del bot) */
.crop-bg { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 18, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadeIn .2s ease-out; }
.crop { width: min(680px, 100%); box-shadow: var(--shadow-lg); }
.crop-frame { position: relative; overflow: hidden; width: 100%; aspect-ratio: 2 / 1; border-radius: 14px; background: #000; cursor: grab; touch-action: none; user-select: none; }
.crop-frame.grab { cursor: grabbing; }
.crop-frame img { position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; }
.crop-grid { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7);
  background: linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(255, 255, 255, .25) calc(33.33% - .5px), rgba(255, 255, 255, .25) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255, 255, 255, .25) calc(66.66% - .5px), rgba(255, 255, 255, .25) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.crop-zoom { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-weight: 700; }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.thumb { width: 136px; height: 68px; border-radius: 10px; }

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  nav.side { background: var(--side); }
  main { padding: 18px 14px calc(92px + env(safe-area-inset-bottom)); }
  h1 { font-size: 23px; }
  .hello { margin-bottom: 16px; }
  .hello h1 { font-size: 24px; }
  .hello .acts { display: none; }
  .kpis.dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.dash > :first-child { grid-column: 1 / -1; }
  .kx { padding: 14px 14px 10px; }
  .kx .kh { margin-bottom: 8px; }
  .kic { width: 32px; height: 32px; border-radius: 10px; }
  .kx .val { font-size: 21px; }
  .kx .delta { font-size: 11.5px; }
  .spark { height: 30px; }
  .ch-tot { gap: 14px; }
  .ch-tot b { font-size: 16px; }
  .drawer { border-radius: 0; }
  .tabbar { background: color-mix(in srgb, var(--side) 88%, transparent); }
  .tabbar .on::before { content: ""; position: absolute; top: 5px; left: 50%; width: 48px; height: 30px; transform: translateX(-50%); border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); z-index: -1; }
  .mbar-title { font-family: var(--disp); font-weight: 800; }
}
@media (prefers-reduced-motion: reduce) {
  main, .toast, .drawer, .drawer-bg, .modal, .modal-bg, .login::before, .live { animation: none !important; }
  .kx, .todo > a { transition: none; }
}

/* ---------- La mesa de trabajo: los paneles (cada uno, un país con su moneda, su medio de pago y sus bots) ---------- */
.ws { min-height: 100%; background: var(--page); display: flex; flex-direction: column; }
.ws-top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--card); }
.ws-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.ws-brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--grad, linear-gradient(135deg, var(--accent), #7B5CE0)); color: var(--accent-ink, #fff); display: grid; place-items: center; font-weight: 800; }
.ws-me { margin-left: auto; color: var(--muted); font-size: 14px; }
.ws-main { width: min(1120px, 100%); margin: 0 auto; padding: 28px 24px 48px; }
.ws-head h1 { margin: 0 0 4px; font-size: 28px; }
.ws-head p { margin: 0 0 22px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ws-card { display: flex; flex-direction: column; gap: 14px; text-align: left; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.ws-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--accent) 70%, transparent); }
.ws-card-h { display: flex; align-items: center; gap: 12px; }
.ws-card-h .flag { font-size: 34px; line-height: 1; }
.ws-card-h b { display: block; font-size: 18px; }
.ws-card-h small { color: var(--muted); font-size: 13.5px; }
.ws-card-h .pill { margin-left: auto; }
.ws-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ws-stats div { background: var(--soft, color-mix(in srgb, var(--ink) 5%, transparent)); border-radius: 12px; padding: 10px; min-width: 0; }
.ws-stats small { display: block; color: var(--muted); font-size: 12px; }
.ws-stats b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-stats span { color: var(--muted); font-size: 12px; }
.ws-stats .hot b { color: var(--warn); }
.ws-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.ws-go { margin-left: auto; color: var(--accent); font-weight: 700; }
.ws-new { border-style: dashed; justify-content: center; align-items: center; min-height: 200px; color: var(--muted); }
.ws-new .plus { font-size: 34px; line-height: 1; color: var(--accent); }
.ws-form { cursor: default; }
.ws-form:hover { transform: none; }
.ws-fix { font-size: 13px; color: var(--muted); background: var(--soft, color-mix(in srgb, var(--ink) 5%, transparent)); border-radius: 12px; padding: 10px 12px; }
@media (max-width: 600px) { .ws-top { padding: 12px 16px; } .ws-main { padding: 20px 16px 40px; } .ws-head h1 { font-size: 23px; } }
/* El panel que se mira (arriba del menú): vuelve a la mesa de trabajo. */
button.cpick { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; margin: 0 0 10px; }
button.cpick:hover { border-color: var(--accent); }
.cpick-flag { font-size: 22px; line-height: 1; }
.cpick-t { display: grid; min-width: 0; }
.cpick-t b { font-size: 14px; }
.cpick-t small { color: var(--muted); font-size: 12px; }
.cpick-go { margin-left: auto; color: var(--muted); }

.flagi { display: inline-grid; place-items: center; flex: none; width: 36px; height: 24px; border-radius: 5px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); vertical-align: middle; }
.flagi svg { width: 100%; height: 100%; display: block; }
.flagi b { font-size: 12px; color: var(--muted); }
.cpick-flag .flagi { width: 27px; height: 18px; }
h2 .flagi { width: 27px; height: 18px; margin: 0 4px 2px; }
.ws[hidden], button.cpick[hidden] { display: none; }

/* El Simulador: la mini app en un celular al lado del chat. */
.sm-phone { width: min(390px, 100%); height: 720px; margin: 0 auto; border-radius: 30px; overflow: hidden; border: 8px solid #0b0e17; box-shadow: 0 20px 50px -24px rgba(0, 0, 0, .7); background: #0b0e17; }
.sm-phone iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

/* Confirmaciones adentro de la página (ask/askText en app.js): no dependen de los diálogos del navegador. */
.ask { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: askIn .15s ease-out; }
.ask-card { width: min(460px, 100%); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 18px; display: grid; gap: 14px; }
.ask-card p { margin: 0; font-size: 15px; line-height: 1.45; white-space: pre-line; }
.ask-card .input { width: 100%; }
.ask-row { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes askIn { from { opacity: 0; } to { opacity: 1; } }
/* Ver un comprobante encima de la pantalla (viewFile en app.js). */
.viewer-card { width: min(920px, 100%); height: min(88vh, 960px); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.viewer-body { flex: 1; min-height: 0; display: grid; place-items: center; background: var(--soft); }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* Verificación en dos pasos (Mi cuenta y el login) */
/* Mi cuenta: las dos tarjetas (contraseña y 2FA) a la mitad cada una y de la misma altura; en el celular, una debajo de la otra. */
.cu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
@media (max-width: 760px) { .cu-grid { grid-template-columns: 1fr; } }
.cu-actions { gap: 8px; flex-wrap: wrap; }
.cu-grid > .panel { margin: 0; min-width: 0; display: flex; flex-direction: column; }
/* Los botones de las dos tarjetas a la misma altura: el formulario ocupa el resto y su fila de botones va abajo. */
.cu-grid > .panel > form { flex: 1; display: flex; flex-direction: column; }
.cu-grid > .panel > form > .row:last-child { margin-top: auto; padding-top: 4px; }
/* Campo de contraseña con el ojito para verla. */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 42px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--ink); background: var(--soft); }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tfa-steps { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.tfa-steps li { margin-bottom: 8px; }
.tfa-qr { margin: 10px 0; } .tfa-qr img { display: block; width: 212px; height: 212px; max-width: 100%; border-radius: 10px; image-rendering: pixelated; }
.tfa-manual { margin-top: 4px; } .tfa-manual summary { cursor: pointer; font-size: 13.5px; color: var(--accent); }
.tfa-secret { font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 6px; overflow-wrap: anywhere; user-select: all; }
.tfa-codes { font: 600 15px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; columns: 2; column-gap: 24px; user-select: all; white-space: pre; }
@media (max-width: 420px) { .tfa-codes { columns: 1; } }
.login .lg-back { display: block; width: 100%; margin-top: 14px; background: none; border: 0; padding: 6px; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.login .lg-back:hover, .login .lg-back:focus-visible { color: var(--accent); outline: none; text-decoration: underline; }
