/* ═══════════════════════════════════════════════════════════════
   WABA Manager · design system v2
   Consola de operaciones con calidez editorial: papel cálido,
   sidebar de tinta con resalte lima, acento teal WhatsApp.
   Tokens: reports/ux-tokens.json · Spec: reports/ux-spec.md
   ═══════════════════════════════════════════════════════════════ */

/* ── 0. Tokens ─────────────────────────────────────────────── */
:root {
  --paper: #f6f4ee; --paper-2: #efece3; --paper-3: #e8e4d8; --card: #fffdf8;
  --ink: #0f1b17; --ink-2: #16261f; --ink-3: #22352c;
  --text: #1b2320; --text-2: #5b665f; --text-3: #8b948e;
  --line: #e4dfd2; --line-2: #d3cdbd;
  --teal: #0e7c66; --teal-2: #0a6352; --teal-soft: #dff2ea;
  --lime: #b9f26b; --lime-2: #8fd93f; --lime-soft: #ecfbd7;
  --amber: #b45309; --amber-soft: #fdf1d9;
  --red: #b91c1c; --red-soft: #fde4e4;
  --blue: #1d4ed8; --blue-soft: #e0e9ff;
  --violet: #6d28d9; --violet-soft: #ede9fe;
  --cyan: #0e7490; --cyan-soft: #e0f7fa;
  --wa-green: #25d366; --wa-teal: #075e54; --wa-teal-2: #128c7e; --wa-bg: #efeae2; --wa-bubble: #ffffff;
  --ring: rgba(14,124,102,.16); --ring-error: rgba(185,28,28,.14); --overlay: rgba(15,27,23,.55);
  --font-display: 'Bricolage Grotesque', 'IBM Plex Sans', sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius-xs: 5px; --radius-sm: 9px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 18px; --radius-pill: 999px; --radius-phone: 34px;
  --radius: 14px; /* compat */
  --shadow: 0 1px 2px rgba(15,27,23,.05), 0 8px 24px -12px rgba(15,27,23,.18);
  --shadow-lg: 0 24px 60px -24px rgba(15,27,23,.35);
  --shadow-popover: 0 12px 32px -12px rgba(15,27,23,.3), 0 0 0 1px var(--line);
  --shadow-phone: 0 30px 60px -30px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06) inset;
  --shadow-seg: 0 1px 2px rgba(0,0,0,.08);
  --z-sticky: 10; --z-subnav: 20; --z-dropdown: 40; --z-modal-bg: 60; --z-modal: 61; --z-tooltip: 80;
  --fast: 120ms; --base: 180ms; --slow: 260ms; --ease: cubic-bezier(.2,.7,.2,1);
  --sidebar-w: 240px; --sidebar-c: 64px; --topbar-h: 52px;
  --f-xs: 88px; --f-sm: 140px; --f-md: 220px; --f-lg: 360px; --f-xl: 520px;
}

/* ── 1. Base ───────────────────────────────────────────────── */
[x-cloak] { display: none !important; }
* { box-sizing: border-box; }
html { font-family: var(--font-body); color: var(--text); font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-size: .875rem; line-height: 1.5;
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 500px at 90% -10%, rgba(14,124,102,.07), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(185,242,107,.12), transparent 60%);
  background-attachment: fixed;
  font-feature-settings: 'ss01', 'cv11';
}
body.modal-open { overflow: hidden; }
body h1, body h2, body h3, body h4, .display { font-family: var(--font-display); letter-spacing: -.015em; margin: 0; color: var(--text); }
body h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
body h2 { font-size: 1.2rem; font-weight: 600; line-height: 1.2; }
body h3 { font-size: 1rem; font-weight: 600; line-height: 1.3; }
body h4 { font-size: .9rem; font-weight: 600; }
p { margin: 0; }
body a { color: var(--teal); text-decoration: none; }
body a:hover { color: var(--teal-2); }
.mono, code, pre, kbd, .font-mono { font-family: var(--font-mono) !important; font-feature-settings: normal; }
.tnum { font-variant-numeric: tabular-nums; }
.t1 { color: var(--text); } .t2 { color: var(--text-2); } .t3 { color: var(--text-3); }
.t-teal { color: var(--teal-2); } .t-red { color: var(--red); } .t-amber { color: var(--amber); } .t-blue { color: var(--blue); } .t-violet { color: var(--violet); } .t-cyan { color: var(--cyan); }
.text-sm { font-size: .8rem; } .text-xs { font-size: .72rem; } .text-lg { font-size: 1.05rem; }
.eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.eyebrow.danger { color: var(--red); }
::selection { background: var(--lime); color: var(--ink); }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: 6px; }
button { font-family: inherit; }
img { max-width: 100%; }
.divider { height: 1px; background: var(--line); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }
@keyframes flash-teal { 0% { box-shadow: 0 0 0 0 rgba(14,124,102,.5); } 100% { box-shadow: 0 0 0 12px rgba(14,124,102,0); } }
.rise, main > * > .card, main > * > .stat-card, main > .page-head { animation: rise .45s var(--ease) both; }
.rise:nth-child(2) { animation-delay: 50ms; } .rise:nth-child(3) { animation-delay: 100ms; } .rise:nth-child(4) { animation-delay: 150ms; } .rise:nth-child(5) { animation-delay: 200ms; }
.flash { animation: flash-teal .3s var(--ease) 1; }
.shake { animation: shake .3s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── 2. Layout global ─────────────────────────────────────── */
.app-frame { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; flex-shrink: 0; display: flex; flex-direction: column;
  width: var(--sidebar-w); background: var(--ink); color: #9aa89f; transition: width var(--base) var(--ease);
  overflow: hidden; z-index: var(--z-sticky);
}
.sidebar::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(185,242,107,.06), transparent 40%); }
.sidebar > * { position: relative; z-index: 1; }
.sidebar.is-collapsed { width: var(--sidebar-c); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--lime); color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 0 0 4px rgba(185,242,107,.12); }
.sidebar-name { font-family: var(--font-display); font-weight: 600; color: #fff; font-size: .9rem; line-height: 1.1; white-space: nowrap; }
.sidebar-eyebrow { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: #7f8c84; white-space: nowrap; }
.sidebar.is-collapsed .sidebar-text { display: none; }
.sidebar-nav { flex: 1; padding: 14px 0; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; overflow-x: hidden; }
.nav-item {
  display: flex; align-items: center; gap: 12px; margin: 0 10px; padding: 9px 12px; border-radius: var(--radius-md);
  font-size: .86rem; font-weight: 500; color: #9aa89f; text-decoration: none; white-space: nowrap; position: relative;
  transition: background var(--fast), color var(--fast);
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #e8efe9; }
.nav-item.active { background: rgba(185,242,107,.12); color: var(--lime); }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 20%; bottom: 20%; width: 3px; background: var(--lime); border-radius: 0 3px 3px 0; }
.sidebar.is-collapsed .nav-item { justify-content: center; padding: 9px 0; margin: 0 12px; }
.sidebar.is-collapsed .nav-item span { display: none; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-toggle { width: 100%; display: flex; justify-content: center; align-items: center; padding: 8px; border-radius: var(--radius-sm); border: 0; background: transparent; color: #9aa89f; cursor: pointer; transition: background var(--fast); }
.sidebar-toggle:hover { background: rgba(255,255,255,.06); color: #e8efe9; }
.sidebar-toggle svg { transition: transform var(--base); }
.sidebar.is-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar .tip::after, .sidebar .tip::before { display: none; }
.sidebar.is-collapsed .tip::after, .sidebar.is-collapsed .tip::before { display: block; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px;
  background: rgba(255,253,248,.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-2); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--teal-2); }
.crumbs .sep { color: var(--line-2); }
.crumbs .cur, .crumbs strong { color: var(--text); font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: .82rem; color: var(--text-2); }
.topbar-user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-2); font-weight: 700; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; }
.topbar-user a { color: var(--text-3); }
.topbar-user a:hover { color: var(--red); }
.page { flex: 1; padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin-top: 4px; }
.page-sub { font-size: .84rem; color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Sub-navegación de cuenta */
.subnav {
  position: sticky; top: var(--topbar-h); z-index: var(--z-subnav); display: flex; align-items: center; gap: 4px; margin: -8px -24px 0; padding: 6px 24px;
  background: rgba(246,244,238,.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-app { display: flex; align-items: center; gap: 8px; padding-right: 14px; margin-right: 6px; border-right: 1px solid var(--line-2); font-family: var(--font-display); font-weight: 600; font-size: .86rem; white-space: nowrap; }
.subnav-app .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.subnav-item { padding: 7px 12px; border-radius: var(--radius-sm); font-size: .82rem; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: background var(--fast), color var(--fast); }
.subnav-item:hover { background: var(--paper-2); color: var(--text); }
.subnav-item.active { background: var(--ink); color: var(--lime); }

/* ── 3. Cards y KPIs ──────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); }
.card.tight { padding: 16px; }
.card.p-0 { padding: 0; overflow: hidden; }
.card.sticky-card { position: sticky; top: calc(var(--topbar-h) + 52px); z-index: var(--z-sticky); }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: .95rem; color: var(--text); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; display: block; color: inherit; }
.stat-card::after { content: ''; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle, rgba(185,242,107,.35), transparent 70%); pointer-events: none; }
a.stat-card:hover { border-color: var(--line-2); transform: translateY(-1px); transition: transform var(--fast), border-color var(--fast); }
.stat-card.compact { padding: 12px 14px; }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-card.compact .stat-value, .stat-value.sm { font-size: 1.25rem; }
.stat-value.teal { color: var(--teal); } .stat-value.amber { color: var(--amber); } .stat-value.red { color: var(--red); } .stat-value.blue { color: var(--blue); } .stat-value.muted { color: var(--text-3); }
.stat-label { font-size: .78rem; color: var(--text-2); margin-top: 3px; }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 600; margin-left: 6px; font-variant-numeric: tabular-nums; }
.stat-delta.up { color: var(--teal); } .stat-delta.down { color: var(--red); }
.stat-sub { font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); margin-top: 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat-stack { display: grid; gap: 14px; }
.tile { border-radius: var(--radius-md); padding: 12px 14px; text-align: center; background: var(--paper-2); color: var(--text-2); }
.tile-value { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--text); }
.tile-label { font-size: .72rem; margin-top: 2px; }
.tile-blue { background: var(--blue-soft); color: var(--blue); } .tile-blue .tile-value { color: var(--blue); }
.tile-green { background: var(--teal-soft); color: var(--teal-2); } .tile-green .tile-value { color: var(--teal-2); }
.tile-amber { background: var(--amber-soft); color: var(--amber); } .tile-amber .tile-value { color: var(--amber); }
.tile-violet { background: var(--violet-soft); color: var(--violet); } .tile-violet .tile-value { color: var(--violet); }
.tile-cyan { background: var(--cyan-soft); color: var(--cyan); } .tile-cyan .tile-value { color: var(--cyan); }
.tile-gray { background: var(--paper-2); color: var(--text-2); }
.tile-red { background: var(--red-soft); color: var(--red); } .tile-red .tile-value { color: var(--red); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.progress { height: 6px; border-radius: 999px; background: var(--paper-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width var(--slow) var(--ease); }
.progress.warn > span { background: var(--amber); } .progress.danger > span { background: var(--red); }
.account-hero { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.attention-list { display: flex; flex-direction: column; }
.attention-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .84rem; }
.attention-item:last-child { border-bottom: 0; }
.attention-item .ico { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--amber-soft); color: var(--amber); }
.attention-item .ico.red { background: var(--red-soft); color: var(--red); }
.attention-item .grow { flex: 1; min-width: 0; }

/* ── 4. Badges ────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .01em; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; flex-shrink: 0; }
.badge.plain::before, .badge.no-dot::before { display: none; }
.badge-green { background: var(--teal-soft); color: var(--teal-2); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-yellow { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--paper-2); color: var(--text-2); }
.badge-lime { background: var(--lime-soft); color: #3f6d10; }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge-ink { background: var(--ink); color: var(--lime); }
.badge.sm { font-size: .66rem; padding: 1px 7px; }

/* ── 5. Botones ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: var(--radius-md);
  font-size: .86rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; white-space: nowrap; font-family: var(--font-body);
  transition: background var(--fast), color var(--fast), transform var(--fast), box-shadow var(--fast), border-color var(--fast); position: relative; text-decoration: none; line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--lime); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
.btn-primary:hover:not(:disabled) { background: var(--ink-3); transform: translateY(-1px); color: var(--lime); }
.btn-accent { background: var(--teal); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--teal-2); transform: translateY(-1px); color: #fff; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--line-2); }
.btn-secondary:hover:not(:disabled) { background: var(--paper-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--paper-2); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #f8cccc; color: var(--red); }
.btn-danger.solid { background: var(--red); color: #fff; }
.btn-danger.solid:hover:not(:disabled) { background: #991b1b; color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: .78rem; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: .72rem; border-radius: 7px; }
.btn-xs svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 30px; height: 30px; } .btn-icon.btn-xs { width: 26px; height: 26px; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-primary.is-loading::after { border-color: var(--lime); border-right-color: transparent; }
.btn-accent.is-loading::after, .btn-danger.solid.is-loading::after { border-color: #fff; border-right-color: transparent; }
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--text-2); border-right-color: transparent; }
.btn-danger.is-loading::after { border-color: var(--red); border-right-color: transparent; }
.btn-split { display: inline-flex; }
.btn-split .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-split .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 8px; border-left: 1px solid rgba(255,255,255,.15); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* Menú kebab / popover */
.menu-wrap { position: relative; display: inline-block; }
.menu, .popover {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--card); border-radius: var(--radius-md); box-shadow: var(--shadow-popover);
  padding: 6px; z-index: var(--z-dropdown); animation: rise .18s var(--ease) both;
}
.menu.left, .popover.left { right: auto; left: 0; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 7px; border: 0; background: transparent; color: var(--text); font-size: .82rem; text-align: left; cursor: pointer; text-decoration: none; }
.menu-item svg { width: 15px; height: 15px; color: var(--text-3); }
.menu-item:hover { background: var(--paper-2); color: var(--text); }
.menu-item.danger { color: var(--red); } .menu-item.danger:hover { background: var(--red-soft); }
.menu-item:disabled { opacity: .5; cursor: not-allowed; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-title { padding: 6px 10px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.popover { padding: 10px 12px; min-width: 220px; }
.popover .label { margin-bottom: 8px; }
.popover label.check { display: flex; align-items: center; gap: 8px; font-size: .8rem; padding: 4px 0; cursor: pointer; }

/* ── 6. Formularios ───────────────────────────────────────── */
.fg { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin: 0; min-width: 0; }
.fg + .fg { margin-top: 14px; }
.fg.plain { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 16px 0 0; }
.fg.plain:first-child { border-top: 0; padding-top: 0; }
.fg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0; margin-bottom: 12px; float: none; width: 100%; }
legend.fg-head { display: flex; }
.fg-title { font-family: var(--font-display); font-weight: 600; font-size: .84rem; color: var(--text); }
.fg-help { font-size: .74rem; color: var(--text-3); flex-basis: 100%; }
.fg-head .fg-help.inline { flex-basis: auto; }
.fg-grid { display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-start; }
.fg-grid.col { flex-direction: column; }
.fg-grid.col > .f-full, .fg-grid.col > .field.field { flex: 0 0 auto; width: 100%; max-width: 100%; }
/* un .field.f-* dentro de un contenedor flex en columna (.btn-row) tomaba su flex-basis (220–520px) como ALTO; .field.field gana a .field.f-xl */
.btn-row > .field.field, .btn-row > .control { flex: 0 0 auto; }
.field { display: flex; flex-direction: column; min-width: 0; width: 100%; max-width: 100%; }
.f-xs { max-width: var(--f-xs); } .f-sm { max-width: var(--f-sm); } .f-md { max-width: var(--f-md); } .f-lg { max-width: var(--f-lg); } .f-xl { max-width: var(--f-xl); } .f-full { max-width: 100%; flex-basis: 100%; }
.field.f-xs, .field.f-sm, .field.f-md, .field.f-lg, .field.f-xl { flex: 1 1 auto; }
.field.f-xs { flex-basis: var(--f-xs); } .field.f-sm { flex-basis: var(--f-sm); } .field.f-md { flex-basis: var(--f-md); } .field.f-lg { flex-basis: var(--f-lg); } .field.f-xl { flex-basis: var(--f-xl); }
input.f-xs, select.f-xs { width: var(--f-xs); } input.f-sm, select.f-sm { width: var(--f-sm); } input.f-md, select.f-md { width: var(--f-md); } input.f-lg, select.f-lg { width: var(--f-lg); } input.f-xl, select.f-xl { width: var(--f-xl); }
.label { display: flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; letter-spacing: .02em; }
.label .req { color: var(--red); font-weight: 700; }
.label .opt { color: var(--text-3); font-weight: 500; }
.control { display: flex; align-items: stretch; width: 100%; }
.control .input { flex: 1; min-width: 0; }
.control .prefix, .control .suffix { display: inline-flex; align-items: center; padding: 0 10px; background: var(--paper-2); border: 1px solid var(--line-2); color: var(--text-2); font-size: .8rem; font-family: var(--font-mono); white-space: nowrap; }
.control .prefix { border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.control .suffix { border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.control .prefix + .input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.control .input:has(+ .suffix), .control .input.has-suffix { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.control .suffix.btn-suffix { padding: 0; }
.control .suffix.btn-suffix button { border: 0; background: transparent; padding: 0 10px; cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; }
.control .suffix.btn-suffix button:hover { color: var(--teal); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-md);
  font-size: .875rem; color: var(--text); outline: none; font-family: var(--font-body); transition: border-color var(--fast), box-shadow var(--fast); box-shadow: none;
}
textarea.input { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; line-height: 1.45; }
.input.sm { height: 32px; font-size: .8rem; padding: 0 10px; }
.input:focus, .input:focus-visible { border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); border-radius: var(--radius-md); }
.input.mono { font-family: var(--font-mono) !important; font-size: .8rem; }
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--ring-error); }
.input.is-valid { border-color: var(--teal); }
.input:disabled, .input[readonly] { background: var(--paper-2); color: var(--text-2); cursor: not-allowed; }
.input[readonly] { cursor: text; }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b665f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select.input.sm { padding-right: 28px; background-position: right 8px center; }
select.input[multiple] { height: auto; padding: 6px; background-image: none; }
input[type="date"].input, input[type="month"].input, input[type="time"].input { font-family: var(--font-mono); font-size: .8rem; }
input[type="number"].input { font-variant-numeric: tabular-nums; }
.input.search { padding-left: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238b948e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; }
.field-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: 5px; }
.hint { font-size: .72rem; color: var(--text-3); margin-top: 5px; line-height: 1.4; }
.field-foot .hint { margin-top: 0; }
.counter { font-size: .7rem; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.counter.over { color: var(--red); font-weight: 600; }
.error { display: flex; align-items: flex-start; gap: 5px; font-size: .72rem; color: var(--red); margin-top: 5px; line-height: 1.4; }
.error::before { content: '!'; flex-shrink: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-weight: 700; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.error:empty { display: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal); width: 15px; height: 15px; cursor: pointer; }

/* Segmented */
.seg { display: inline-flex; background: var(--paper-2); border-radius: var(--radius-md); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg > a { padding: 0 12px; height: 32px; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; font-size: .78rem; font-weight: 600; color: var(--text-2); border: 0; background: transparent; cursor: pointer; transition: background var(--fast), color var(--fast); white-space: nowrap; text-decoration: none; }
.seg button:hover, .seg > a:hover { color: var(--text); }
.seg button.on, .seg > a.on, .seg button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-seg); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg.sm { padding: 2px; } .seg.sm button, .seg.sm > a { height: 26px; padding: 0 9px; font-size: .72rem; }
.seg .n { opacity: .55; font-weight: 500; }

/* Toggle */
.toggle { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .tg { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); flex-shrink: 0; transition: background var(--base); margin-top: 1px; }
.toggle .tg::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--base) var(--ease); }
.toggle input:checked + .tg { background: var(--teal); }
.toggle input:checked + .tg::after { transform: translateX(16px); }
.toggle input:focus-visible + .tg { box-shadow: 0 0 0 3px var(--ring); }
.toggle input:disabled + .tg { opacity: .5; }
.toggle .tg-text { display: flex; flex-direction: column; }
.toggle .tg-label { font-size: .84rem; font-weight: 500; color: var(--text); line-height: 1.3; }
.toggle .tg-label + .hint { margin-top: 2px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--text-2); font-size: .76rem; font-weight: 600; cursor: pointer; transition: background var(--fast), color var(--fast), border-color var(--fast); }
.chip:hover { border-color: var(--teal); color: var(--teal-2); }
.chip.on { background: var(--teal-soft); color: var(--teal-2); border-color: var(--teal); }
.chip.static { cursor: default; } .chip.static:hover { border-color: var(--line-2); color: var(--text-2); }
.chip:disabled, .chip.is-disabled { opacity: .45; cursor: not-allowed; }
.chip .x { margin-left: 2px; opacity: .6; font-size: 1rem; line-height: 1; }
.chip .x:hover { opacity: 1; color: var(--red); }
.chip.sm { height: 22px; padding: 0 8px; font-size: .68rem; }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; padding: 5px 8px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-md); }
.chips-input:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); }
.chips-input input { border: 0; outline: none; flex: 1; min-width: 120px; font-size: .84rem; font-family: var(--font-body); background: transparent; }

/* Check/radio cards */
.checkcard, .radiocard { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--card); cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.checkcard:hover, .radiocard:hover { border-color: var(--teal); }
.checkcard.on, .radiocard.on, .checkcard:has(input:checked), .radiocard:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.checkcard.danger:has(input:checked), .radiocard.danger:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.checkcard input, .radiocard input { margin-top: 3px; }
.checkcard.is-disabled, .radiocard.is-disabled { opacity: .5; cursor: not-allowed; }
.cc-title { font-size: .82rem; font-weight: 600; color: var(--text); font-family: var(--font-mono); }
.cc-title.sans { font-family: var(--font-body); }
.cc-desc { font-size: .72rem; color: var(--text-2); margin-top: 1px; }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }

/* Readonly key/value */
.readonly-kv { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); min-width: 0; }
.readonly-kv .k { font-size: .7rem; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; flex-shrink: 0; min-width: 90px; }
.readonly-kv .v { font-family: var(--font-mono); font-size: .8rem; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readonly-kv .btn { flex-shrink: 0; }

/* Combobox */
.combobox { position: relative; }
.combobox-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; background: var(--card); border-radius: var(--radius-md); box-shadow: var(--shadow-popover); z-index: var(--z-dropdown); padding: 4px; }
.combobox-group { padding: 6px 10px 3px; font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.combobox-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; font-size: .82rem; cursor: pointer; color: var(--text); }
.combobox-opt:hover, .combobox-opt.hi { background: var(--paper-2); }
.combobox-opt.on { background: var(--teal-soft); color: var(--teal-2); }
.combobox-opt .k { font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); }
.combobox-empty { padding: 10px; font-size: .78rem; color: var(--text-3); text-align: center; }

/* Dropzone */
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; transition: border-color var(--fast), background var(--fast); background: #fff; color: var(--text-2); font-size: .8rem; }
.dropzone:hover, .dropzone.over { border-color: var(--teal); background: var(--teal-soft); }
.dropzone.circle { width: 96px; height: 96px; border-radius: 50%; padding: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* Savebar */
.savebar { position: sticky; bottom: 12px; z-index: var(--z-sticky); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--ink); color: #e8efe9; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-size: .82rem; animation: rise .25s var(--ease) both; }

/* Tooltips CSS-only */
.tip { position: relative; cursor: help; }
span.tip:not([class*="btn"]):not(.badge) { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--paper-3); color: var(--text-2); font-size: 10px; font-weight: 700; font-family: var(--font-mono); vertical-align: middle; flex-shrink: 0; }
.tip::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(2px); width: max-content; max-width: 260px;
  padding: 6px 9px; background: var(--ink); color: #e8efe9; font-size: 12px; font-weight: 400; font-family: var(--font-body); line-height: 1.35; border-radius: 7px; text-align: left; white-space: normal;
  opacity: 0; pointer-events: none; transition: opacity var(--fast), transform var(--fast); z-index: var(--z-tooltip); letter-spacing: 0; text-transform: none; display: none; /* oculto con display: con opacity seguía sumando ancho de scroll (ux-review) */
}
.tip::before { content: ''; position: absolute; left: 50%; bottom: calc(100% + 3px); transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); opacity: 0; transition: opacity var(--fast); z-index: var(--z-tooltip); pointer-events: none; display: none; }
.tip:hover::after, .tip:focus-visible::after, .tip:hover::before, .tip:focus-visible::before { display: block; }
.tip:hover::after, .tip:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.tip:hover::before, .tip:focus-visible::before { opacity: 1; }
.tip[data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); }
.tip[data-tip-pos="bottom"]::before { bottom: auto; top: calc(100% + 3px); border-top-color: transparent; border-bottom-color: var(--ink); }
.tip[data-tip-pos="right"]::after { bottom: auto; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
.tip[data-tip-pos="right"]:hover::after, .tip[data-tip-pos="right"]:focus-visible::after { transform: translateY(-50%); }
.tip[data-tip-pos="right"]::before { bottom: auto; left: calc(100% + 3px); top: 50%; transform: translateY(-50%); border-top-color: transparent; border-right-color: var(--ink); }
.tip[data-tip-pos="left"]::after { bottom: auto; left: auto; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
.tip[data-tip-pos="left"]:hover::after, .tip[data-tip-pos="left"]:focus-visible::after { transform: translateY(-50%); }
.tip[data-tip-pos="left"]::before { bottom: auto; left: auto; right: calc(100% + 3px); top: 50%; transform: translateY(-50%); border-top-color: transparent; border-left-color: var(--ink); }
.tip[data-tip=""]::after, .tip[data-tip=""]::before { display: none; }

/* ── 7. Pestañas ──────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px; font-family: var(--font-display); font-size: .86rem; font-weight: 600; color: var(--text-2);
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: color var(--fast), border-color var(--fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--teal-2); border-bottom-color: var(--teal); }
.tab.is-disabled { opacity: .45; cursor: not-allowed; }
.tab:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); border-radius: 6px 6px 0 0; }
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--paper-3); color: var(--text-2); font-size: .68rem; font-weight: 700; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.tab.active .tab-count { background: var(--teal-soft); color: var(--teal-2); }
.tab-count.red, .tab[data-state="error"] .tab-count { background: var(--red-soft); color: var(--red); }
.tab-panel { padding-top: 18px; }
.tabs.pills { border-bottom: 0; background: var(--paper-2); border-radius: var(--radius-md); padding: 3px; gap: 2px; display: inline-flex; }
.tabs.pills .tab { height: 32px; padding: 0 12px; font-size: .78rem; border-radius: 8px; border-bottom: 0; margin: 0; font-family: var(--font-body); }
.tabs.pills .tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-seg); }
.tabs.stepper { border-bottom: 0; gap: 0; counter-reset: step; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 6px; }
.tabs.stepper .tab { flex: 1; justify-content: center; height: 44px; border-bottom: 0; margin: 0; border-radius: var(--radius-md); font-size: .8rem; position: relative; }
.tabs.stepper .tab.active { background: var(--paper-2); color: var(--ink); }
.tab-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); color: var(--text-2); font-size: .7rem; font-weight: 700; font-family: var(--font-body); font-variant-numeric: tabular-nums; background: var(--card); transition: background var(--fast), color var(--fast), border-color var(--fast); }
.tab.active .tab-num { border-color: var(--ink); color: var(--ink); }
.tab[data-state="done"] .tab-num { background: var(--teal); border-color: var(--teal); color: #fff; }
.tab[data-state="error"] .tab-num { background: var(--red); border-color: var(--red); color: #fff; }
.tab[data-state="done"] { color: var(--teal-2); }
.tab[data-state="error"] { color: var(--red); }
.tabs.stepper .tab:not(:last-child)::after { content: ''; position: absolute; right: -1px; top: 25%; height: 50%; width: 1px; background: var(--line); }
.checklist { display: flex; flex-direction: column; gap: 6px; }
.checklist li, .checklist-item { display: flex; align-items: flex-start; gap: 8px; font-size: .82rem; list-style: none; }
.checklist .ok::before, .checklist .ko::before { content: '✓'; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; flex-shrink: 0; background: var(--teal-soft); color: var(--teal-2); }
.checklist .ko::before { content: '✕'; background: var(--red-soft); color: var(--red); }

/* ── 8. Tablas ────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { margin-left: auto; }
.toolbar .search { min-width: 200px; }
.toolbar .input.f-lg { width: var(--f-lg); max-width: 100%; }
.toolbar .input.f-md { width: var(--f-md); } .toolbar .input.f-sm { width: var(--f-sm); }
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 14px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); border-bottom: 1px solid var(--line-2); background: var(--card); white-space: nowrap; }
.data-table td { padding: 10px 14px; font-size: .84rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table.dense th { padding: 6px 12px; }
.data-table.dense td { padding: 6px 12px; font-size: .8rem; }
.data-table tbody tr { transition: background var(--fast); }
.data-table tbody tr:hover td { background: rgba(14,124,102,.04); }
.data-table tbody tr.row-link { cursor: pointer; }
.data-table tbody tr.selected td { background: var(--teal-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tfoot td { font-weight: 600; background: var(--paper-2); border-top: 1px solid var(--line-2); border-bottom: 0; }
.data-table th.right, .data-table td.right, .data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .stat-delta { white-space: nowrap; margin-left: 0; }                 /* "▲ 1.144,4 % +1.234" en una sola línea */
.data-table .dn-cell { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.data-table .dn-name { display: inline-block; max-width: 180px; vertical-align: middle; } /* Nombre visible largo → elipsis + title */
.data-table .td-actions { text-align: right; white-space: nowrap; }
.data-table .td-actions .btn { vertical-align: middle; }
.data-table .td-sub { display: block; font-size: .7rem; color: var(--text-3); margin-top: 2px; font-family: var(--font-mono); }
.data-table .td-check { width: 36px; padding-right: 0; }
.data-table.sticky-head thead th { position: sticky; top: 0; z-index: 2; }
.table-container.sticky-head { max-height: 70vh; overflow-y: auto; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: '⇅'; margin-left: 5px; opacity: .35; font-size: .7rem; }
th.sortable.asc::after { content: '▲'; opacity: 1; color: var(--teal); }
th.sortable.desc::after { content: '▼'; opacity: 1; color: var(--teal); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--text-2); }
.pager { display: inline-flex; align-items: center; gap: 4px; }
.pager .btn { min-width: 30px; }
.pager .cur { padding: 0 8px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* ── 9. Alertas / estados ─────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius-md); font-size: .84rem; display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-success { background: var(--teal-soft); color: var(--teal-2); }
.alert-warn { background: var(--amber-soft); color: var(--amber); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert .grow { flex: 1; }
.alert .close { background: none; border: 0; cursor: pointer; color: inherit; font-size: 1.1rem; line-height: 1; opacity: .7; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 44px 20px; gap: 6px; }
.empty .ico { width: 56px; height: 56px; border-radius: 50%; background: var(--paper-2); color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.empty .ico svg { width: 26px; height: 26px; }
.empty-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text); }
.empty-text { font-size: 13px; color: var(--text-2); max-width: 420px; }
.empty .btn { margin-top: 10px; }
.empty.compact { padding: 22px 16px; }
.empty.compact .ico { width: 40px; height: 40px; }
.empty.error .ico { background: var(--red-soft); color: var(--red); }
.skeleton, .sk-line, .sk-title, .sk-card, .sk-row { background: linear-gradient(90deg, var(--paper-2) 25%, #f9f7f1 50%, var(--paper-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
.sk-line { height: 12px; margin: 6px 0; }
.sk-title { height: 20px; width: 40%; margin: 8px 0 14px; }
.sk-card { height: 120px; border-radius: var(--radius-lg); }
.sk-row { height: 40px; margin: 6px 0; border-radius: 8px; }

/* ── 10. Modales propios ──────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: var(--z-modal-bg); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 32rem; border: 1px solid var(--line); animation: rise .25s var(--ease) both; display: flex; flex-direction: column; max-height: calc(100vh - 32px); z-index: var(--z-modal); position: relative; padding: 24px; }
.modal.sm { max-width: 28rem; } .modal.md { max-width: 32rem; } .modal.lg { max-width: 44rem; } .modal.xl { max-width: 56rem; } .modal.wide { max-width: 56rem; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 0 14px; }
.modal-head h3 { font-size: 1.1rem; margin-top: 2px; }
.modal-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--paper-2); color: var(--text-2); font-size: 1.2rem; line-height: 1; cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; transition: background var(--fast), color var(--fast); }
.modal-x:hover { background: var(--paper-3); color: var(--text); }
.modal-x:disabled { opacity: .4; cursor: not-allowed; }
.modal-body { overflow-y: auto; max-height: 70vh; padding: 2px; margin: 0 -2px; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 18px; }
.modal-foot .left { margin-right: auto; }
.modal-head + .modal-body, .modal-body + .modal-foot { border-top: 1px solid var(--line); }
.modal-head + .modal-body { padding-top: 16px; }

/* ── 11. Clave/valor, código ──────────────────────────────── */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 0; margin: 0; font-size: .82rem; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--card); }
.kv > .kv-pair { display: contents; }
.kv dt, .kv dd { padding: 7px 12px; border-bottom: 1px solid var(--line); margin: 0; min-width: 0; }
.kv dt { color: var(--text-2); font-weight: 600; font-size: .74rem; background: var(--paper-2); display: flex; align-items: center; overflow-wrap: anywhere; }
.kv dd { font-family: var(--font-mono); font-size: .78rem; color: var(--text); word-break: break-word; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.kv > dt:nth-last-of-type(1), .kv > dd:last-child, .kv > .kv-pair:last-child > dt, .kv > .kv-pair:last-child > dd { border-bottom: 0; }
.kv dd .copy { opacity: 0; transition: opacity var(--fast); }
.kv dd:hover .copy { opacity: 1; }
.kv.compact dt, .kv.compact dd { padding: 5px 10px; }
.kv .badge { font-family: var(--font-body); }
.kv-empty { color: var(--text-3); }
.code-block { position: relative; background: var(--ink); color: #d7e3dc; border-radius: 12px; padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; overflow: auto; max-height: 420px; white-space: pre; margin: 0; }
.code-block .code-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.code-block .code-actions .btn { background: rgba(255,255,255,.08); color: #d7e3dc; border-color: transparent; }
.code-block .code-actions .btn:hover { background: rgba(185,242,107,.2); color: var(--lime); }
.code-editor { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; tab-size: 2; background: var(--ink); color: #d7e3dc; border-radius: 12px; padding: 16px; width: 100%; min-height: 520px; resize: vertical; border: 1px solid #1f3129; outline: none; white-space: pre; overflow: auto; }
.code-editor:focus { border-color: var(--lime-2); box-shadow: 0 0 0 3px rgba(185,242,107,.15); }
.code-editor[readonly] { opacity: .85; }
.kbd { font-family: var(--font-mono); font-size: .7rem; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; color: var(--text-2); }
.var-chip { display: inline-block; background: #e6f6ee; color: #0a6352; padding: 1px 6px; border-radius: 5px; font-size: 12px; font-weight: 600; font-family: var(--font-mono); }
.var-chip.filled { background: #dcfce7; color: #15803d; font-family: var(--font-body); font-weight: 500; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸'; display: inline-block; margin-right: 6px; transition: transform var(--fast); color: var(--text-3); }
details[open] > summary::before { transform: rotate(90deg); }
.copy-btn { border: 0; background: transparent; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 4px; display: inline-flex; }
.copy-btn:hover { color: var(--teal); background: var(--paper-2); }

/* ── 12. Preview de teléfono ──────────────────────────────── */
.with-preview { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
.preview-col { width: 100%; min-width: 0; }
.preview-sticky { position: sticky; top: calc(var(--topbar-h) + 8px); }
.preview-meta { margin-top: 12px; }
.preview-collapse { display: block; }
.preview-collapse > summary { font-size: .8rem; font-weight: 600; color: var(--text-2); padding: 8px 0; }
@media (min-width: 1280px) {
  .with-preview { grid-template-columns: 1fr 360px; }
  .with-preview.wide { grid-template-columns: 1fr 380px; }
  .with-preview.left { grid-template-columns: 360px 1fr; }
  .preview-collapse > summary { display: none; }
}
.phone {
  width: 320px; max-width: 100%; margin: 0 auto; border-radius: var(--radius-phone); border: 9px solid #111;
  background: #000; box-shadow: var(--shadow-phone); overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.phone.compact { width: 280px; }
.phone .notch { height: 22px; background: #000; display: flex; justify-content: center; }
.phone .notch::after { content: ''; width: 100px; height: 14px; background: #000; border-radius: 0 0 12px 12px; margin-top: -1px; }
.phone .wa-top { background: var(--wa-teal); color: #fff; padding: 8px 12px; display: flex; align-items: center; gap: 10px; }
.phone .wa-top .avatar { width: 32px; height: 32px; border-radius: 50%; background: #c4c4c4; overflow: hidden; flex-shrink: 0; }
.phone .wa-top .avatar img { width: 100%; height: 100%; object-fit: cover; }
.phone .wa-top .name { font-size: 14px; font-weight: 600; line-height: 1.1; }
.phone .wa-top .sub { font-size: 11px; opacity: .85; }
.phone .wa-chat {
  background-color: var(--wa-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.045' stroke-width='1.2'%3E%3Ccircle cx='20' cy='20' r='6'/%3E%3Cpath d='M60 10l6 6-6 6-6-6z'/%3E%3Cpath d='M95 30c-6 0-10 4-10 10s4 10 10 10'/%3E%3Cpath d='M20 80h14M27 73v14'/%3E%3Ccircle cx='70' cy='75' r='9'/%3E%3Cpath d='M100 95l8 8M108 95l-8 8'/%3E%3Cpath d='M45 105c0-5 4-8 8-8s8 3 8 8'/%3E%3C/g%3E%3C/svg%3E");
  padding: 14px 10px; min-height: 260px;
}
.phone .wa-bottom { background: #f0f0f0; padding: 8px 10px; display: flex; gap: 8px; align-items: center; }
.phone .wa-bottom .pill { flex: 1; height: 30px; background: #fff; border-radius: 15px; font-size: 12px; color: #999; display: flex; align-items: center; padding: 0 12px; }
.phone .wa-bottom .mic { width: 30px; height: 30px; border-radius: 50%; background: var(--wa-teal-2); }
.bubble { background: var(--wa-bubble); border-radius: 10px; border-top-left-radius: 2px; box-shadow: 0 1px 1px rgba(0,0,0,.1); overflow: hidden; max-width: 92%; position: relative; }
.bubble .b-header-text { padding: 8px 10px 0; font-size: 14.5px; font-weight: 700; color: #111b21; }
.bubble .b-media { height: 150px; background: #e2e8f0; display: flex; align-items: center; justify-content: center; color: #94a3b8; overflow: hidden; }
.bubble .b-media img { width: 100%; height: 100%; object-fit: cover; }
.bubble .b-media.video { background: #1e293b; color: #fff; }
.bubble .b-doc { padding: 10px 12px; background: #f1f5f9; display: flex; gap: 10px; align-items: center; color: #475569; font-size: 13px; }
.bubble .b-loc { height: 120px; background: linear-gradient(135deg, #d9efe3, #bfe3d0); position: relative; display: flex; align-items: center; justify-content: center; color: #0e7c66; }
.bubble .b-body { padding: 6px 10px 4px; font-size: 13.6px; line-height: 1.45; color: #111b21; white-space: pre-wrap; word-break: break-word; }
.bubble .b-footer { padding: 0 10px 4px; font-size: 11.5px; color: #8696a0; }
.bubble .b-time { text-align: right; padding: 0 8px 5px; font-size: 10.5px; color: #8696a0; }
.bubble .b-lto { margin: 8px 10px 0; padding: 8px 10px; background: #f0fdf4; border-radius: 8px; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: #166534; }
.bubble .b-btn { border-top: 1px solid #e9edef; text-align: center; padding: 9px; color: #00a884; font-size: 13.5px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; }
.bubble .b-card { margin: 8px; border: 1px solid #e9edef; border-radius: 10px; overflow: hidden; }
.flow-screen { background: #fff; min-height: 380px; display: flex; flex-direction: column; }
.flow-screen .fs-top { padding: 10px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #eee; font-size: 14px; font-weight: 600; color: #111; }
.flow-screen .fs-body { padding: 12px 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; color: #111; }
.flow-screen .fs-foot { padding: 10px 14px; border-top: 1px solid #eee; }
.flow-screen .fs-btn { background: #0d6c5a; color: #fff; text-align: center; border-radius: 22px; padding: 10px; font-size: 14px; font-weight: 600; }
.flow-screen .fs-input { border: 1px solid #c9ccd0; border-radius: 8px; padding: 10px 12px; color: #6b7280; font-size: 13px; position: relative; }
.flow-screen .fs-input .lbl { position: absolute; top: -7px; left: 10px; background: #fff; padding: 0 4px; font-size: 10.5px; color: #6b7280; }
.flow-screen .fs-opt { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f1f1; }
.flow-screen .fs-opt .rb { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #9ca3af; flex-shrink: 0; }
.flow-screen .fs-opt .cb { width: 18px; height: 18px; border-radius: 4px; border: 2px solid #9ca3af; flex-shrink: 0; }
.flow-screen .fs-opt .desc { font-size: 12px; color: #6b7280; }
.flow-screen .fs-chip { display: inline-block; border: 1px solid #c9ccd0; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; margin: 0 6px 6px 0; }
.flow-screen .fs-h1 { font-size: 20px; font-weight: 700; line-height: 1.25; }
.flow-screen .fs-h2 { font-size: 16px; font-weight: 600; }
.flow-screen .fs-cap { font-size: 12px; color: #6b7280; }
.flow-screen .fs-link { color: #0d6c5a; font-weight: 500; text-decoration: underline; }
.flow-screen .fs-dyn { display: inline-block; background: #fef3c7; color: #92400e; border-radius: 4px; padding: 0 5px; font-family: var(--font-mono); font-size: 11.5px; }

/* ── 13. Login ────────────────────────────────────────────── */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background-color: var(--ink);
  background-image: radial-gradient(900px 500px at 85% -10%, rgba(185,242,107,.10), transparent 60%), radial-gradient(700px 500px at -10% 110%, rgba(14,124,102,.16), transparent 60%); position: relative; overflow: hidden; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .18; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E"); }
.login-orbit { position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(185,242,107,.12); right: -180px; top: -140px; pointer-events: none; }
.login-orbit.two { width: 760px; height: 760px; right: -300px; top: -260px; border-color: rgba(185,242,107,.06); }
.card.login { width: 380px; max-width: 100%; padding: 32px 30px; border-radius: 22px; animation: rise .5s var(--ease) both; position: relative; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--lime); color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 26px; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; box-shadow: 0 10px 30px -10px rgba(185,242,107,.6); }
.login h1 { font-size: 1.5rem; }
.login-foot { margin-top: 22px; font-size: .72rem; color: var(--text-3); text-align: center; }

/* ── 14. Responsive ───────────────────────────────────────── */
@media (max-width: 1023px) {
  .sidebar { position: fixed; left: 0; top: 0; }
  .sidebar.is-collapsed { width: var(--sidebar-c); }
  .shell { margin-left: var(--sidebar-c); }
  .sidebar.is-open { box-shadow: var(--shadow-lg); z-index: var(--z-dropdown); }
}
@media (max-width: 640px) {
  .page { padding: 14px; gap: 14px; }
  .subnav { margin: -4px -14px 0; padding: 6px 14px; }
  .f-xs, .f-sm, .f-md, .f-lg, .f-xl, .field.f-xs, .field.f-sm, .field.f-md, .field.f-lg, .field.f-xl { max-width: 100%; flex-basis: 100%; }
  input.f-xs, input.f-sm, input.f-md, input.f-lg, input.f-xl, select.f-xs, select.f-sm, select.f-md, select.f-lg, select.f-xl { width: 100%; }
  .kv { grid-template-columns: 1fr; } .kv dt { border-bottom: 0; padding-bottom: 2px; }
  .modal { padding: 18px; }
  .card { padding: 16px; }
  .topbar { padding: 0 14px; }
}
@media print { .sidebar, .topbar, .subnav, .page-actions, .toolbar, .table-foot { display: none !important; } .shell { margin: 0; } .card { box-shadow: none; } }

/* ── 15. Mobile / responsive (drawer, tarjetas, modales, táctil) ─────────── */
html.sb-collapsed .sidebar:not(.is-open) { width: var(--sidebar-c); }
html.sb-collapsed .sidebar:not(.is-open) .sidebar-text, html.sb-collapsed .sidebar:not(.is-open) .nav-item span { display: none; }
.topbar-menu { display: none; width: 40px; height: 40px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0; margin-left: -8px; }
.topbar-menu:hover { background: var(--paper-2); }
.drawer-bg { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: calc(var(--z-dropdown) - 1); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.subnav { scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.subnav-item, .subnav-app { scroll-snap-align: start; }
.tabs { -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.tab { scroll-snap-align: start; }

@media (max-width: 1023px) {
  .sidebar, .sidebar.is-collapsed, html.sb-collapsed .sidebar:not(.is-open) { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform var(--slow) var(--ease); box-shadow: none; z-index: var(--z-dropdown); }
  .sidebar.is-drawer-open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar.is-collapsed .sidebar-text, .sidebar.is-collapsed .nav-item span, html.sb-collapsed .sidebar:not(.is-open) .sidebar-text, html.sb-collapsed .sidebar:not(.is-open) .nav-item span { display: block; }
  .sidebar.is-collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; margin: 0 10px; }
  .sidebar .tip::after, .sidebar .tip::before { display: none !important; }
  .sidebar.is-collapsed .sidebar-toggle svg { transform: rotate(0); }
  .shell { margin-left: 0; }
  .drawer-bg { display: block; }
  body.drawer-open { overflow: hidden; }
  .topbar-menu { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 10px; }
  .page { padding: 16px; gap: 16px; }
  .subnav { margin: -4px -16px 0; padding: 6px 16px; }
  .preview-sticky { position: static; }
}
@media (max-width: 767px) {
  .topbar-name { display: none; }
  /* breadcrumb: en pantallas angostas solo se muestran el penúltimo y el actual (el último quedaba cortado a una letra) */
  .crumbs > a:not(:nth-last-child(-n+3)), .crumbs > .sep:not(:nth-last-child(-n+3)) { display: none; }
  .crumbs > .cur { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .card-head .text-xs { min-width: 0; overflow-wrap: anywhere; }
  .comp-row { flex-wrap: wrap; } /* árbol de componentes del flow: las acciones bajan de línea en vez de desbordar la card */
  .tabs.stepper .tab { flex: 0 0 auto; }
  .with-preview > .preview-col { order: -1; }
  .phone { margin-left: auto; margin-right: auto; }
  /* Tabla como tarjetas: <table class="data-table table-cards"> + data-label en cada td */
  .table-cards { border-collapse: separate; border-spacing: 0; }
  .table-cards thead { display: none; }
  .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tbody tr { border: 1px solid var(--line); border-radius: var(--radius-md); margin: 10px 12px; background: var(--card); padding: 6px 0; }
  .table-cards tbody tr.selected { background: var(--teal-soft); }
  .table-cards tbody tr:hover td { background: transparent; }
  .table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 14px; border-bottom: 1px solid var(--line); text-align: right; }
  .table-cards td:last-child { border-bottom: 0; }
  .table-cards td::before { content: attr(data-label); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); text-align: left; flex-shrink: 0; }
  .table-cards td:not([data-label])::before { display: none; }
  .table-cards td.td-actions { justify-content: flex-end; }
  .table-cards td.td-check { justify-content: flex-start; }
  .table-cards td.td-title { font-size: .95rem; font-weight: 600; justify-content: flex-start; text-align: left; }
  .table-cards td[hidden], .table-cards td[style*="display: none"] { display: none; }
  .table-cards tfoot { display: block; padding: 0 12px; }
  .table-cards tfoot tr { display: flex; flex-wrap: wrap; gap: 6px 14px; }
  .table-cards tfoot td { display: inline-flex; gap: 6px; border: 0; padding: 4px 0; width: auto; }
  .table-cards .empty { padding: 20px; }
}
@media (max-width: 640px) {
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .toolbar { padding: 10px 12px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-right { margin-left: 0; justify-content: flex-end; }
  .toolbar .search, .toolbar .input.f-lg, .toolbar .input.f-md { width: 100%; min-width: 0; flex: 1 1 100%; }
  .toolbar .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .table-foot { flex-direction: column; align-items: flex-start; }
  .fg { padding: 12px; }
  .fg-grid { gap: 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px 14px; }
  .stat-value { font-size: 1.5rem; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-grid { grid-template-columns: 1fr; }
  .readonly-kv { flex-wrap: wrap; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal, .modal.sm, .modal.md, .modal.lg, .modal.xl, .modal.wide { max-width: 100%; width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; padding: 16px; animation: rise .25s var(--ease) both; }
  .modal-body { max-height: none; flex: 1; overflow-y: auto; }
  .modal-foot { position: sticky; bottom: 0; background: var(--card); padding-bottom: max(6px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
  .savebar { bottom: 6px; flex-wrap: wrap; }
  .kv dd { flex-wrap: wrap; }
  .code-block, .code-editor { font-size: 11.5px; }
  .menu, .popover { max-width: calc(100vw - 32px); }
}
/* Targets táctiles ≥ 40px y sin hover-only en dispositivos táctiles */
@media (pointer: coarse), (max-width: 640px) {
  .btn-sm, .btn-xs, .input.sm, .seg button, .seg > a, .subnav-item, .chip, .menu-item, .tabs.pills .tab, .btn-icon, .btn-icon.btn-sm, .btn-icon.btn-xs, .modal-x, .copy-btn { min-height: 40px; }
  .toggle { min-height: 40px; align-items: center; }
  .toggle .tg { margin-top: 0; }
  .btn-icon.btn-xs, .btn-icon.btn-sm { min-width: 40px; }
  .copy-btn { min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .seg { gap: 4px; }
  .kv dd .copy { opacity: 1; }
  .toggle .tg { width: 44px; height: 24px; }
  .toggle .tg::after { width: 20px; height: 20px; }
  .toggle input:checked + .tg::after { transform: translateX(20px); }
  input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; }
}

/* responsive: las órbitas del login no deben ensanchar el documento */
.login-orbit { position: fixed; }

/* ── módulo: plantillas ─────────────────────────────────────── */
.tpl-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-sub .badge { cursor: pointer; transition: transform var(--fast), box-shadow var(--fast); }
.tpl-sub .badge:hover { transform: translateY(-1px); box-shadow: 0 0 0 3px var(--ring); }
.tpl-sub .badge.on { box-shadow: 0 0 0 2px var(--ink); }
.tpl-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.tpl-panel { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.tpl-panel .tpl-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tpl-panel .tpl-panel-head h2 { font-size: 1.05rem; font-family: var(--font-mono); word-break: break-all; }
.tpl-panel .phone { width: 300px; }
.tpl-btn-list { display: flex; flex-direction: column; gap: 6px; }
.tpl-btn-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); font-size: .8rem; min-width: 0; }
.tpl-btn-item .v { margin-left: auto; font-family: var(--font-mono); font-size: .72rem; color: var(--text-2); max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-vars { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.tpl-vars .eq { font-size: .74rem; color: var(--text-2); }
.tpl-name-cell { display: flex; flex-direction: column; min-width: 0; }
.tpl-name-cell .nm { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.tpl-name-cell .sub { font-size: .7rem; color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.tpl-status-cell { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.tpl-status-cell .q { font-size: .68rem; color: var(--text-3); }
@media (min-width: 1280px) {
  .tpl-split.has-panel { grid-template-columns: minmax(0, 1fr) minmax(380px, 42%); }
  .tpl-panel { position: sticky; top: calc(var(--topbar-h) + 52px); max-height: calc(100vh - var(--topbar-h) - 64px); overflow-y: auto; padding-right: 2px; }
}
@media (max-width: 1279px) {
  .tpl-panel { position: fixed; inset: 0; z-index: var(--z-modal-bg); background: var(--paper); overflow-y: auto; padding: 14px; animation: none; }
  body.tpl-panel-open { overflow: hidden; }
}
/* Preview: carrusel */
.bubble .b-cards { display: flex; gap: 8px; overflow-x: auto; padding: 4px 8px 8px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.bubble .b-cards .b-card { flex: 0 0 82%; margin: 0; scroll-snap-align: start; background: #fff; }
.bubble .b-cards .b-card .b-btn { padding: 7px; font-size: 12.5px; }
/* Editor: stepper + grupos */
.tpl-editor .tabs.stepper { position: sticky; top: calc(var(--topbar-h) + 46px); z-index: var(--z-sticky); }
.tpl-editor .step { display: flex; flex-direction: column; gap: 14px; }
.step-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 4px; }
.btn-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; animation: rise .2s var(--ease) both; }
.btn-row.is-invalid { border-color: var(--red); }
.btn-row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-row-head .hint { margin: 0; flex: 1; min-width: 120px; }
.btn-row-head .ord { display: inline-flex; gap: 2px; margin-left: auto; }
.btn-row .fg-grid { gap: 10px 12px; }
.add-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fmt-bar { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; position: relative; }
.fmt-bar .btn-xs { min-width: 28px; }
.fmt-bar .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }
.emoji-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-dropdown); background: var(--card); border-radius: var(--radius-md); box-shadow: var(--shadow-popover); padding: 8px; display: grid; grid-template-columns: repeat(8, 30px); gap: 2px; animation: rise .18s var(--ease) both; }
.emoji-pop button { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 6px; font-size: 18px; cursor: pointer; line-height: 1; }
.emoji-pop button:hover { background: var(--paper-2); }
.var-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-dropdown); background: var(--card); border-radius: var(--radius-md); box-shadow: var(--shadow-popover); padding: 10px 12px; min-width: 260px; animation: rise .18s var(--ease) both; }
.var-pop .chips { margin-top: 8px; }
.sample-row { display: flex; align-items: center; gap: 10px; }
.sample-row .var-chip { flex-shrink: 0; min-width: 60px; text-align: center; }
.sample-row .input { flex: 1; }
.media-box { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .media-box { grid-template-columns: minmax(200px, 260px) 1fr; } }
.media-box .dropzone { min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative; overflow: hidden; }
.media-box .dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.media-box .dropzone .dz-label { position: relative; z-index: 1; background: rgba(255,253,248,.85); padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.media-box .dropzone .dz-sub { position: relative; z-index: 1; background: rgba(255,253,248,.85); padding: 1px 6px; border-radius: 6px; font-size: .7rem; }
.media-box .progress { margin-top: 6px; }
.handle-ok { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--teal-2); font-family: var(--font-mono); word-break: break-all; }
.card-editor { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.card-editor-head { display: flex; align-items: center; gap: 8px; }
.card-editor-head .ord { margin-left: auto; display: inline-flex; gap: 2px; }
.card-editor .dropzone { min-height: 96px; }
.review-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .review-grid { grid-template-columns: 1fr 1fr; } }
.problem-link { color: var(--red); text-decoration: underline; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; text-align: left; }
.problem-link:hover { color: #991b1b; }
.preview-toggle { display: flex; justify-content: center; margin-top: 8px; }
.payload-block { max-height: 300px; font-size: 11.5px; }
/* Librería */
.lib-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 1280px) { .lib-layout.has-panel { grid-template-columns: minmax(0, 1fr) 380px; } .lib-panel { position: sticky; top: calc(var(--topbar-h) + 52px); } }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lib-card { cursor: pointer; transition: transform var(--fast), box-shadow var(--fast), border-color var(--fast); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lib-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.lib-card.on { border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring), var(--shadow); }
.lib-card .nm { font-family: var(--font-mono); font-size: .76rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card .txt { font-size: .82rem; color: var(--text); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-card .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.lib-panel .phone { width: 300px; }
@media (max-width: 1279px) {
  .lib-panel { position: fixed; inset: 0; z-index: var(--z-modal-bg); background: var(--paper); overflow-y: auto; padding: 14px; animation: none; }
}
@media (max-width: 640px) { .tpl-name-cell .nm { max-width: 100%; white-space: normal; word-break: break-all; } .emoji-pop { grid-template-columns: repeat(6, 34px); } .emoji-pop button { width: 34px; height: 34px; } .step-foot .btn { flex: 1; } }

/* módulo: perfil */
.pf { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pf-main { min-width: 0; }
.pf-preview-head { display: flex; justify-content: center; margin-bottom: 10px; }
.pf-ficha { background: #f0f2f5; max-height: 560px; overflow-y: auto; scrollbar-width: thin; }
.pf-hero { background: linear-gradient(180deg, var(--wa-teal, #075e54) 0, var(--wa-teal, #075e54) 58px, #f0f2f5 58px); padding: 18px 0 0; text-align: center; }
.pf-avatar { position: relative; width: 132px; height: 132px; margin: 0 auto; border-radius: 50%; overflow: hidden; background: #cfd8dc; border: 4px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.18); cursor: pointer; padding: 0; display: block; }
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-avatar-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pf-avatar-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; }
.pf-avatar-cam { position: absolute; bottom: 2px; right: 2px; width: 34px; height: 34px; background: #00a884; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; transition: transform var(--fast); }
.pf-avatar:hover .pf-avatar-cam, .pf-avatar:focus-visible .pf-avatar-cam { transform: scale(1.08); }
.pf-title { background: #fff; padding: 12px 18px 14px; border-bottom: 8px solid #f0f2f5; text-align: center; }
.pf-name { font-size: 19px; font-weight: 600; color: #111b21; word-break: break-word; }
.pf-phone-num { font-size: 13px; color: #667781; margin-top: 2px; }
.pf-badge { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; color: #667781; background: #f0f2f5; border-radius: 999px; padding: 3px 10px; }
.pf-section { background: #fff; padding: 12px 18px; border-bottom: 8px solid #f0f2f5; }
.pf-k { font-size: 12px; color: #667781; margin-bottom: 3px; }
.pf-v { font-size: 14px; color: #111b21; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.pf-v.link { color: #0a6352; }
.pf-rows { background: #fff; padding: 6px 0; }
.pf-row { padding: 10px 18px; display: flex; gap: 14px; align-items: flex-start; }
.pf-ico { width: 20px; color: #667781; flex-shrink: 0; margin-top: 1px; }
.pf-row-txt { min-width: 0; } .pf-row-txt .pf-k { margin: 0; }
.pf-empty { padding: 14px 18px; font-size: 13px; color: #8696a0; text-align: center; }
@keyframes pfFlash { 0% { box-shadow: var(--shadow-phone), 0 0 0 0 rgba(0,168,132,.55); } 100% { box-shadow: var(--shadow-phone), 0 0 0 18px rgba(0,168,132,0); } }
.pf-flash, .pf-flash .phone { animation: pfFlash .45s var(--ease) both; }
.pf-photo-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pf-drop-img { width: 100%; height: 100%; object-fit: cover; }
.pf-photo-info { flex: 1; min-width: 200px; }
.pf-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.pf-audit { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 16px; }
.pf-audit-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pf-audit .kv dt .tip { font-size: 10px; }
.pf-crop { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.pf-crop-col { text-align: center; min-width: 0; }
.pf-crop-box { width: 100%; max-width: 220px; aspect-ratio: 1; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--paper-2); display: flex; align-items: center; justify-content: center; }
.pf-crop-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pf-crop-box.round { border-radius: 50%; } .pf-crop-box.round img { width: 100%; height: 100%; object-fit: cover; }
.pf-crop-arrow { font-size: 1.4rem; color: var(--text-3); }
.pf .preview-meta { margin-top: 12px; }
@media (max-width: 640px) {
  .pf-crop { grid-template-columns: 1fr; } .pf-crop-arrow { transform: rotate(90deg); text-align: center; }
  .pf-ficha { max-height: none; }
  .pf-actions .btn { flex: 1 1 auto; }
}

/* ═══════════════════════════════════════════════════════════════
   módulo: núcleo — dashboard, cuentas, detalle, webhooks, onboarding, configuración
   ═══════════════════════════════════════════════════════════════ */
/* Hero de cuenta */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.hero-id { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hero-id h1 { font-size: 1.75rem; line-height: 1.05; overflow-wrap: anywhere; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--text-2); }
.hero-meta .mono { font-size: .74rem; }
.hero-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero-kpis .stat-card { padding: 12px 14px; }
.hero-kpis .stat-value { font-size: 1.15rem; }
.hero-kpis .stat-card::after { width: 56px; height: 56px; }
.q-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 3px rgba(0,0,0,.05); vertical-align: middle; margin-right: 6px; }
.q-dot.GREEN, .q-dot.HIGH { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.q-dot.YELLOW, .q-dot.MEDIUM { background: #d97706; box-shadow: 0 0 0 3px var(--amber-soft); }
.q-dot.RED, .q-dot.LOW { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
/* Lista de errores de Meta con solución */
.meta-errors { display: flex; flex-direction: column; gap: 8px; }
.meta-error { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: var(--radius-md); background: var(--card); font-size: .8rem; }
.meta-error .code { font-family: var(--font-mono); font-weight: 600; color: var(--amber); grid-row: span 2; align-self: start; }
.meta-error .sol { color: var(--text-2); font-size: .74rem; }
.meta-error .sol::before { content: 'Solución: '; font-weight: 600; color: var(--teal-2); }
/* Panel de dos columnas de kv */
.kv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.kv-cols .card-title { margin-bottom: 8px; }
/* Grupos de eventos (modes) */
.mode-group { margin-top: 12px; }
.mode-group:first-child { margin-top: 0; }
.mode-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mode-group-title { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.checkcard .cc-tag { margin-left: auto; font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--paper-2); color: var(--text-3); white-space: nowrap; }
.checkcard.is-disabled .cc-tag { background: var(--amber-soft); color: var(--amber); }
.checkcard > div { min-width: 0; flex: 1; }
/* Editor de headers */
.hdr-rows { display: flex; flex-direction: column; gap: 8px; }
.hdr-row { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; gap: 8px; align-items: center; }
/* Chips de modos en tabla */
.mode-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 360px; }
.mode-chips .chip { height: 22px; padding: 0 8px; font-size: .66rem; cursor: default; }
.mode-chips .chip.more { background: var(--paper-2); }
.latency { font-family: var(--font-mono); font-size: .7rem; }
/* Wizard de onboarding */
.wizard { display: grid; grid-template-columns: 1fr; gap: 18px; }
.wizard-main { min-width: 0; }
.wizard-side { min-width: 0; }
@media (min-width: 1100px) { .wizard { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .wizard-side { position: sticky; top: calc(var(--topbar-h) + 12px); } }
.stage-track { display: flex; flex-direction: column; gap: 0; position: relative; }
.stage { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 8px 0; position: relative; }
.stage:not(:last-child)::before { content: ''; position: absolute; left: 12px; top: 34px; bottom: -8px; width: 2px; background: var(--line-2); }
.stage-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--card); display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; z-index: 1; }
.stage[data-state="done"] .stage-dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.stage[data-state="done"]:not(:last-child)::before { background: var(--teal); }
.stage[data-state="active"] .stage-dot { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 4px var(--lime-soft); }
.stage[data-state="error"] .stage-dot { background: var(--red); border-color: var(--red); color: #fff; }
.stage-title { font-family: var(--font-display); font-weight: 600; font-size: .86rem; color: var(--text); }
.stage[data-state="idle"] .stage-title { color: var(--text-2); }
.stage-detail { font-size: .74rem; color: var(--text-3); margin-top: 1px; overflow-wrap: anywhere; }
.stage[data-state="error"] .stage-detail { color: var(--red); }
.link-box { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px dashed var(--teal); border-radius: var(--radius-lg); background: var(--teal-soft); }
.link-box .url { font-family: var(--font-mono); font-size: .78rem; word-break: break-all; color: var(--teal-2); background: #fff; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid rgba(14,124,102,.2); }
.link-box.expired { border-color: var(--red); background: var(--red-soft); }
.link-box.expired .url { color: var(--red); text-decoration: line-through; border-color: rgba(185,28,28,.2); }
.qr-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr-box { width: 148px; height: 148px; padding: 8px; background: #fff; border-radius: var(--radius-md); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qr-box img, .qr-box canvas { width: 132px !important; height: 132px !important; image-rendering: pixelated; }
.phone-field .control select.input { width: 150px; flex: 0 0 150px; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; font-family: var(--font-mono); font-size: .78rem; }
.phone-field .control select.input + .input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.stage-chip { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); min-width: 0; }
.stage-chip .k { font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.stage-chip .v { font-family: var(--font-mono); font-size: .74rem; color: var(--text); margin-top: 2px; word-break: break-all; }
.stage-chip .l { font-size: .72rem; color: var(--text-2); }
.pending-list { display: flex; flex-direction: column; gap: 8px; }
.pending-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); cursor: pointer; transition: border-color var(--fast), transform var(--fast); min-width: 0; }
.pending-item:hover { border-color: var(--teal); transform: translateY(-1px); }
.pending-item.on { border-color: var(--ink); background: var(--lime-soft); }
.pending-item .nm { font-family: var(--font-display); font-weight: 600; font-size: .86rem; overflow-wrap: anywhere; }
.pending-item .sub { font-size: .7rem; color: var(--text-3); font-family: var(--font-mono); }
.mini-steps { display: flex; gap: 3px; flex-shrink: 0; }
.mini-steps i { width: 14px; height: 4px; border-radius: 2px; background: var(--line-2); display: block; }
.mini-steps i.done { background: var(--teal); } .mini-steps i.error { background: var(--red); } .mini-steps i.active { background: var(--lime-2); }
.wizard .tabs.stepper .tab { font-size: .76rem; padding: 0 8px; }
/* Configuración: opciones de capping */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.cap-opt { height: 38px; border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--card); font-family: var(--font-mono); font-size: .8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all var(--fast); }
.cap-opt:hover { border-color: var(--teal); color: var(--teal-2); }
.cap-opt.on { background: var(--ink); color: var(--lime); border-color: var(--ink); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--paper-2); font-size: .74rem; font-weight: 600; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.status-pill.ok .dot { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.status-pill.ko .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.timeline { display: flex; flex-direction: column; gap: 6px; font-size: .76rem; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 10px; list-style: none; }
.timeline .t { font-family: var(--font-mono); color: var(--text-3); white-space: nowrap; }
.level2-card { border: 1px dashed var(--line-2); background: repeating-linear-gradient(135deg, transparent 0 12px, rgba(0,0,0,.015) 12px 24px); }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hdr-row { grid-template-columns: 1fr; }
  .hdr-row .btn { justify-self: end; }
  .mode-chips { max-width: 100%; }
  .phone-field .control { flex-wrap: wrap; }
  .phone-field .control select.input { width: 100%; flex-basis: 100%; border-right: 1px solid var(--line-2); border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .phone-field .control select.input + .input { border-radius: 0 0 var(--radius-md) var(--radius-md); border-top: 0; }
  .qr-wrap { justify-content: center; }
  .wizard .tabs.stepper { padding: 4px; }
  .wizard .tabs.stepper .tab { height: 40px; padding: 0 10px; }
  .cap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kv-cols { grid-template-columns: 1fr; }
}

/* módulo: flows ─────────────────────────────────────────────────────────── */
/* Pantalla de Flow (wa-preview.js › flowScreen) */
.flow-screen { min-height: 420px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.flow-screen .fs-top { padding: 10px 12px; gap: 10px; }
.flow-screen .fs-top-x { color: #54656f; font-size: 15px; width: 22px; text-align: center; cursor: pointer; border-radius: 50%; }
.flow-screen .fs-top-x:hover { background: #f0f2f5; }
.flow-screen .fs-top-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.flow-screen .fs-top-more { color: #54656f; }
.flow-screen .fs-body { gap: 14px; padding: 14px; }
.flow-screen .fs-form { display: flex; flex-direction: column; gap: 14px; }
.flow-screen .fs-body-text { font-size: 14px; line-height: 1.45; color: #111b21; white-space: pre-wrap; }
.flow-screen .fs-cap { font-size: 12px; color: #667781; line-height: 1.4; }
.flow-screen .fs-field { display: flex; flex-direction: column; gap: 4px; }
.flow-screen .fs-help { font-size: 11.5px; color: #667781; padding: 0 12px; }
.flow-screen .fs-req { color: #b91c1c; }
.flow-screen .fs-input { display: flex; align-items: center; gap: 6px; min-height: 42px; }
.flow-screen .fs-input .fs-ico { margin-left: auto; color: #54656f; display: inline-flex; }
.flow-screen .fs-val { color: #111b21; }
.flow-screen .fs-row { display: flex; gap: 8px; }
.flow-screen .fs-row .fs-input { flex: 1; min-width: 0; }
.flow-screen .fs-group { display: flex; flex-direction: column; gap: 2px; }
.flow-screen .fs-glabel { font-weight: 600; font-size: 13.5px; color: #111b21; margin-bottom: 4px; }
.flow-screen .fs-opt { gap: 12px; padding: 10px 0; }
.flow-screen .fs-opt-main { flex: 1; min-width: 0; }
.flow-screen .fs-opt .rb, .flow-screen .fs-opt .cb, .flow-screen .fs-optin .cb { margin-left: auto; position: relative; }
.flow-screen .fs-optin .cb { margin-left: 0; }
.flow-screen .rb.on { border-color: #0d6c5a; }
.flow-screen .rb.on::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: #0d6c5a; }
.flow-screen .cb.on { background: #0d6c5a; border-color: #0d6c5a; }
.flow-screen .cb.on::after { content: '✓'; color: #fff; font-size: 12px; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.flow-screen .fs-opt-img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.flow-screen .fs-opt-img.large { width: 64px; height: 64px; }
.flow-screen .desc.meta { color: #8696a0; font-size: 11px; }
.flow-screen .fs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.flow-screen .fs-chip { margin: 0; }
.flow-screen .fs-chip.on { background: #d9fdd3; border-color: #25d366; color: #0b4f3b; }
.flow-screen .fs-navlist { display: flex; flex-direction: column; border: 1px solid #e9edef; border-radius: 10px; overflow: hidden; }
.flow-screen .fs-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f0f2f5; }
.flow-screen .fs-nav-item:last-child { border-bottom: 0; }
.flow-screen .fs-nav-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.flow-screen .fs-nav-main { flex: 1; min-width: 0; }
.flow-screen .fs-nav-title { font-weight: 500; font-size: 13.5px; }
.flow-screen .fs-nav-end { text-align: right; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.flow-screen .fs-chev { color: #8696a0; font-size: 18px; }
.flow-screen .fs-optin { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.4; }
.flow-screen .fs-embedded { display: inline-block; }
.flow-screen .fs-link { text-decoration: none; }
.flow-screen .fs-carousel { border-radius: 8px; overflow: hidden; }
.flow-screen .fs-carousel-track { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.flow-screen .fs-carousel-track::-webkit-scrollbar { display: none; }
.flow-screen .fs-carousel-item { flex: 0 0 88%; height: 150px; border-radius: 8px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; color: #9ca3af; scroll-snap-align: start; overflow: hidden; }
.flow-screen .fs-carousel-item img { width: 100%; height: 100%; }
.flow-screen .fs-dots { display: flex; justify-content: center; gap: 4px; padding: 6px 0 0; }
.flow-screen .fs-dots span { width: 6px; height: 6px; border-radius: 50%; background: #d1d7db; }
.flow-screen .fs-dots span.on { background: #0d6c5a; }
.flow-screen .fs-picker { display: flex; align-items: center; gap: 10px; border: 1px dashed #c9ccd0; border-radius: 10px; padding: 10px 12px; }
.flow-screen .fs-picker-ico { width: 36px; height: 36px; border-radius: 50%; background: #e7f8f2; color: #0d6c5a; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.flow-screen .fs-picker-main { flex: 1; min-width: 0; }
.flow-screen .fs-picker-title { font-weight: 500; font-size: 13.5px; }
.flow-screen .fs-picker-btn { color: #0d6c5a; font-weight: 600; font-size: 13px; }
.flow-screen .fs-unknown { font-family: var(--font-mono); font-size: 11px; color: #b45309; background: #fef3c7; padding: 2px 6px; border-radius: 4px; }
.flow-screen .fs-empty { font-size: 12px; color: #8696a0; text-align: center; padding: 30px 0; }
.flow-screen .fs-disabled { opacity: .5; }
.flow-screen .fs-foot { padding: 10px 14px 6px; }
.flow-screen .fs-caps { display: flex; justify-content: space-between; font-size: 11px; color: #667781; padding: 0 4px 6px; }
.flow-screen .fs-caps.center { justify-content: center; }
.flow-screen .fs-btn { transition: transform .12s, filter .12s; }
.flow-screen .fs-btn.off { background: #d1d7db; color: #fff; }
.flow-screen .fs-hint { text-align: center; font-size: 11px; color: #8696a0; margin-top: 6px; font-family: var(--font-mono); }
.flow-screen .fs-hint-err { color: #b91c1c; }
.flow-screen .fs-brand { text-align: center; font-size: 10px; color: #8696a0; padding: 2px 0 8px; }
.flow-screen [data-fs-action] { cursor: pointer; }
.flow-screen .fs-btn[data-fs-action]:hover { filter: brightness(1.08); transform: translateY(-1px); }
.flow-screen .fs-nav-item[data-fs-action]:hover { background: #f5f6f6; }
.flow-screen .fs-rich { font-size: 13.5px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.flow-screen .fs-md-h1 { font-size: 19px; font-weight: 700; } .flow-screen .fs-md-h2 { font-size: 16px; font-weight: 600; } .flow-screen .fs-md-h3 { font-size: 14px; font-weight: 600; }
.flow-screen .fs-md-hr { border: 0; border-top: 1px solid #e9edef; margin: 4px 0; }
.flow-screen .fs-md-ul, .flow-screen .fs-md-ol { margin: 0; padding-left: 20px; }
.flow-screen .fs-md-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.flow-screen .fs-md-table th, .flow-screen .fs-md-table td { border: 1px solid #e9edef; padding: 4px 6px; text-align: left; }
.flow-screen .fs-md-table th { background: #f5f6f6; }
.flow-screen code { background: #f0f2f5; padding: 0 4px; border-radius: 3px; font-size: 12px; }
.phone.flow-phone .wa-top, .phone.flow-phone .wa-bottom { display: none; }
.phone.flow-phone .notch { background: #fff; }
.phone.flow-phone .notch::after { background: #111; }

/* Lista de flows */
.flow-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.flows-disabled { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
.flows-disabled .steps { display: flex; flex-direction: column; gap: 10px; counter-reset: st; }
.flows-disabled .step { display: flex; gap: 12px; align-items: flex-start; font-size: .84rem; }
.flows-disabled .step::before { counter-increment: st; content: counter(st); width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--lime); font-weight: 700; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-display); }
@media (min-width: 900px) { .flows-disabled { grid-template-columns: 1.2fr 1fr; } }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.starter-grid .radiocard { flex-direction: column; gap: 6px; padding: 10px 12px; }
.starter-grid .radiocard input { display: none; }
.starter-grid .cc-title { font-family: var(--font-display); font-size: .84rem; }
.create-flow-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 880px) { .create-flow-grid { grid-template-columns: 1fr 292px; } }
.create-flow-grid .phone { width: 280px; }

/* Editor */
.flow-head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); }
.flow-head-meta .sep { color: var(--line-2); }
.flow-editor-grid { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
@media (min-width: 1280px) { .flow-editor-grid { grid-template-columns: minmax(0, 1fr) 360px; } .flow-editor-grid .preview-sticky { position: sticky; top: calc(var(--topbar-h) + 60px); } }
.flow-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.flow-toolbar .grow { flex: 1; }
.flow-toolbar .badge { flex-shrink: 0; }
.flow-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .72rem; color: var(--text-3); font-family: var(--font-mono); }
.code-wrap { display: flex; background: var(--ink); border-radius: 0; }
.code-wrap .code-gutter { flex-shrink: 0; width: 46px; padding: 16px 8px 16px 0; text-align: right; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; color: #55675d; background: #0c1613; user-select: none; overflow: hidden; white-space: pre; border-right: 1px solid #1f3129; }
.code-wrap .code-editor { border-radius: 0; border: 0; min-height: 560px; font-feature-settings: normal; }
.code-editor, .code-gutter, .code-block { font-feature-settings: normal; }
.code-wrap .code-editor.is-invalid { box-shadow: inset 0 0 0 2px rgba(185,28,28,.6); }
.code-wrap .code-gutter .cur { color: var(--lime); }
.screen-strip { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.screen-strip::-webkit-scrollbar { display: none; }
.screen-strip .chip { flex-shrink: 0; height: 26px; font-family: var(--font-mono); font-size: .68rem; }
.screen-strip .chip.err { border-color: var(--red); color: var(--red); }
.screen-strip .chip.err.on { background: var(--red-soft); }
.screen-cards { display: flex; flex-direction: column; gap: 10px; }
.screen-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); overflow: hidden; }
.screen-card.cur { border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); }
.screen-card-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--paper-2); flex-wrap: wrap; }
.screen-card-head .sid { font-family: var(--font-mono); font-weight: 600; font-size: .84rem; color: var(--text); }
.screen-card-head .actions { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.comp-tree { padding: 6px 8px; display: flex; flex-direction: column; }
.comp-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: .8rem; min-height: 34px; }
.comp-row:hover { background: var(--paper-2); }
.comp-row .ctype { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; color: var(--teal-2); background: var(--teal-soft); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.comp-row .ctype.footer { color: #3f6d10; background: var(--lime-soft); }
.comp-row .ctype.logic { color: var(--violet); background: var(--violet-soft); }
.comp-row .ctype.form { color: var(--text-2); background: var(--paper-3); }
.comp-row .cname { color: var(--text-2); font-family: var(--font-mono); font-size: .72rem; }
.comp-row .clabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.comp-row .cact { display: flex; gap: 2px; opacity: .35; transition: opacity var(--fast); }
.comp-row:hover .cact, .comp-row:focus-within .cact { opacity: 1; }
.comp-row .cact .btn { min-width: 26px; }
.comp-row.err { background: var(--red-soft); }
.lint-list { display: flex; flex-direction: column; gap: 6px; }
.lint-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-radius: var(--radius-md); font-size: .8rem; border: 1px solid var(--line); background: var(--card); }
.lint-item .lvl { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .68rem; }
.lint-item.lint-error .lvl { background: var(--red-soft); color: var(--red); }
.lint-item.lint-warn .lvl { background: var(--amber-soft); color: var(--amber); }
.lint-item.lint-meta .lvl { background: var(--blue-soft); color: var(--blue); }
.lint-item .msg { flex: 1; min-width: 0; }
.lint-item .path { font-family: var(--font-mono); font-size: .68rem; color: var(--text-3); word-break: break-all; }
.sim-log { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; font-family: var(--font-mono); font-size: .72rem; }
.sim-log .ev { display: flex; gap: 8px; padding: 5px 8px; border-radius: 6px; background: var(--paper-2); }
.sim-log .ev .t { color: var(--text-3); flex-shrink: 0; }
.sim-log .ev.done { background: var(--teal-soft); color: var(--teal-2); }
.sim-log .ev.nav { background: var(--blue-soft); color: var(--blue); }
.ds-rows { display: flex; flex-direction: column; gap: 6px; }
.ds-row { display: grid; grid-template-columns: 110px 1fr 1fr auto; gap: 6px; align-items: center; }
.ds-row .input { height: 32px; font-size: .8rem; }
.nav-item-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.action-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 10px; border: 1px dashed var(--line-2); border-radius: var(--radius-md); background: var(--card); width: 100%; }
.comp-modal-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 980px) { .comp-modal-grid { grid-template-columns: minmax(0, 1fr) 240px; } .comp-modal-grid .phone.compact { width: 240px; } }
.mini-phone .flow-screen { min-height: 200px; }
.mini-phone .flow-screen .fs-top, .mini-phone .flow-screen .fs-brand, .mini-phone .flow-screen .fs-hint { display: none; }
.mini-phone .flow-screen .fs-body { padding: 12px; }
@media (max-width: 767px) {
  .code-wrap .code-editor { min-height: 340px; font-size: 11.5px; }
  .code-wrap .code-gutter { width: 36px; font-size: 11.5px; }
  .flow-editor-grid .phone { width: 100%; max-width: 340px; }
  .ds-row { grid-template-columns: 1fr 1fr; }
  .ds-row .input:nth-child(3) { grid-column: 1 / -1; }
  .screen-card-head .actions { width: 100%; margin-left: 0; }
  .comp-row .cact { opacity: 1; }
  .comp-row .cname { display: none; }
}
.pf .preview-meta .kv { grid-template-columns: 104px 1fr; }  /* módulo: perfil */
.pf .preview-meta .kv dd { flex-wrap: wrap; }


/* módulo: reportes */
.chart-box { position: relative; height: 260px; width: 100%; min-width: 0; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 320px; }
.chart-box canvas { max-width: 100%; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-head .chart-title { font-family: var(--font-display); font-weight: 600; font-size: .92rem; }
.chart-head .chart-sub { font-size: .76rem; color: var(--text-3); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.rp-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.rp-filters .field { margin: 0; }
.rp-filters .field.f-auto { width: auto; flex: 0 0 auto; }
.rp-filters .field.f-grow { flex: 1 1 200px; }
.rp-filters .label { margin-bottom: 4px; }
.rp-range-label { font-size: .78rem; color: var(--text-2); }
.rp-range-label b { font-family: var(--font-mono); font-weight: 500; color: var(--text); }
.stat-card .stat-delta { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .74rem; font-weight: 600; }
.stat-delta.good { color: var(--teal-2); } .stat-delta.bad { color: var(--red); } .stat-delta.flat { color: var(--text-3); }
.stat-delta .delta-abs { font-family: var(--font-mono); font-weight: 400; color: var(--text-3); }
.stat-card.rp-kpi { padding: 14px 16px; }
.stat-card.rp-kpi .stat-value { font-size: 1.45rem; }
.stat-card .stat-label .tip { margin-left: 4px; }
.meter { margin-top: 6px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .78rem; color: var(--text-2); margin-bottom: 6px; flex-wrap: wrap; }
.meter-head b { color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.meter .progress { height: 8px; }
.prop-bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--paper-2); gap: 2px; }
.prop-bar > span { display: block; height: 100%; min-width: 2px; }
.prop-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: .78rem; color: var(--text-2); }
.prop-item b { color: var(--text); font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.rank-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(120px, 2fr) auto; gap: 12px; align-items: center; font-size: .82rem; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-name a { color: var(--text); font-weight: 600; }
.rank-name a:hover { color: var(--teal-2); }
.rank-pos { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: var(--paper-2); color: var(--text-3); font-size: .68rem; font-weight: 700; align-items: center; justify-content: center; margin-right: 8px; font-family: var(--font-mono); }
.rank-bar { height: 10px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.rank-bar > span { display: block; height: 100%; border-radius: 3px; transition: width var(--slow) var(--ease); }
.rank-val { font-family: var(--font-mono); font-size: .8rem; color: var(--text); white-space: nowrap; }
.timeline { position: relative; margin: 6px 0 0 10px; padding-left: 24px; border-left: 2px solid var(--line-2); }
.tl-item { position: relative; padding: 0 0 18px 0; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item::before { content: ''; position: absolute; left: -31px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper-3); box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--line-2); }
.tl-item.green::before { background: var(--teal); } .tl-item.yellow::before { background: var(--amber); } .tl-item.red::before { background: var(--red); }
.tl-date { font-size: .7rem; color: var(--text-3); font-family: var(--font-mono); }
.tl-title { font-weight: 600; font-size: .86rem; margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-text { font-size: .78rem; color: var(--text-2); margin-top: 2px; }
.saved-item { display: flex; align-items: center; gap: 8px; width: 100%; }
.saved-item .grow { flex: 1; min-width: 0; text-align: left; color: var(--text); }
.saved-item .grow:hover { color: var(--teal-2); }
.saved-item .saved-sub { display: block; font-size: .68rem; color: var(--text-3); font-family: var(--font-mono); }
.menu.wide { min-width: 300px; max-width: 360px; }
.menu .menu-item.static { cursor: default; }
.menu .menu-item.static:hover { background: transparent; }
.tpl-picker { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); max-height: 260px; overflow-y: auto; }
.tpl-picker .tpl-opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: .8rem; cursor: pointer; }
.tpl-picker .tpl-opt:last-child { border-bottom: 0; }
.tpl-picker .tpl-opt:hover { background: var(--paper-2); }
.tpl-picker .tpl-opt.on { background: var(--teal-soft); }
.tpl-picker .tpl-opt .mono { font-size: .76rem; }
.tpl-picker .tpl-opt.disabled { opacity: .5; cursor: not-allowed; }
.tpl-picker .tpl-opt .td-sub { display: block; font-size: .68rem; color: var(--text-3); font-family: var(--font-mono); margin-top: 1px; }
.seg.nowrap { flex-wrap: nowrap; }
.tpl-sel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tpl-sel .chip { max-width: 100%; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.rp-note { font-size: .78rem; color: var(--text-2); }
.rp-note ul { padding-left: 18px; margin: 6px 0 0; list-style: disc; }
.rp-note li { margin: 2px 0; }
.data-table tfoot td.tnum, .data-table tfoot td.right { font-family: var(--font-mono); font-weight: 600; }
.data-table th .tip { margin-left: 4px; width: 13px; height: 13px; font-size: 9px; text-transform: none; letter-spacing: 0; }
.win-seg button { min-width: 64px; justify-content: center; }
.subtle-card { background: var(--paper-2); border: 1px dashed var(--line-2); border-radius: var(--radius-md); padding: 12px 14px; }
.kpi-inline { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .8rem; color: var(--text-2); }
.kpi-inline b { color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.error-list { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; }
.error-list .mono { color: var(--red); }
.tab .tab-count { margin-left: 6px; }
@media (max-width: 640px) {
  /* los tooltips ocultos con opacity siguen sumando ancho de scroll: en mobile se ocultan con display */
  .tip::after, .tip::before { display: none; }
  .tip:hover::after, .tip:focus-visible::after, .tip:active::after, .tip:hover::before, .tip:focus-visible::before, .tip:active::before { display: block; }
  .tip[data-tip-pos="right"]::after, .tip[data-tip-pos="left"]::after { left: auto; right: 0; top: calc(100% + 8px); transform: none; }
  .tip[data-tip-pos="right"]:hover::after, .tip[data-tip-pos="left"]:hover::after { transform: none; }
  .chart-box, .chart-box.lg { height: 210px; }
  .chart-box.sm { height: 180px; }
  .chart-grid { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .rank-row .rank-bar { grid-column: 1 / -1; }
  .rp-filters > * { flex: 1 1 100%; }
  .rp-filters .btn { width: 100%; justify-content: center; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card.rp-kpi .stat-value { font-size: 1.2rem; }
  .timeline { margin-left: 6px; padding-left: 18px; }
  .tl-item::before { left: -25px; }
  .page-actions { width: 100%; }
  .page-actions .btn, .page-actions .menu-wrap { flex: 1 1 auto; }
  .page-actions .btn { justify-content: center; }
}
.preview-meta .kv { grid-template-columns: 118px 1fr; }
.preview-meta .kv dd { font-size: .74rem; }

/* módulo: núcleo — tooltip sobre texto (anula el círculo "i" del kit para span.tip.txt) */
/* especificidad ≥ (0,4,1) para ganarle a span.tip:not([class*="btn"]):not(.badge) del kit */
span.tip.txt:not([class*="btn"]):not(.badge):not(.never) { display: inline; width: auto; height: auto; border-radius: 0; background: none; font: inherit; color: inherit; vertical-align: baseline; }
span.tip.txt.chip:not([class*="btn"]):not(.badge):not(.never) { display: inline-flex; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--card); font-family: var(--font-body); font-size: .66rem; font-weight: 600; color: var(--text-2); }
span.tip.txt.chip.more:not([class*="btn"]):not(.badge):not(.never) { background: var(--paper-2); }

/* módulo: núcleo — zona de riesgo (Configuración de la app) */
.danger-zone { border-color: #f1b6b6 !important; background: linear-gradient(180deg, #fff6f6, var(--card)); }
.danger-zone .fg-head .fg-title { color: var(--red); }
.dz-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dz-row .grow { flex: 1 1 320px; min-width: 0; }
.dz-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dz-blocked { color: var(--amber); }
@media (max-width: 640px) { .dz-row .btn { width: 100%; } }

/* módulo: núcleo — historial del alta: los emails largos deben cortar en mobile */
.timeline li { flex-wrap: wrap; min-width: 0; }
.timeline li > span:not(.t) { overflow-wrap: anywhere; word-break: break-word; min-width: 0; flex: 1 1 160px; }

/* módulo: núcleo — credenciales de API (token de app) */
.tok-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tok-row input { flex: 1 1 320px; min-width: 0; letter-spacing: .02em; }
.tok-row input[type=password] { letter-spacing: .18em; }
@media (max-width: 640px) { .tok-row input, .tok-row .btn { flex: 1 1 100%; } }

/* módulo: plantillas — envío de prueba (formulario + preview en vivo) */
.send-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.send-preview { position: sticky; top: 0; }
.send-preview .phone { width: 280px; margin: 0 auto; }
@media (max-width: 900px) { .send-split { grid-template-columns: 1fr; } .send-preview { position: static; order: -1; } }

/* módulo: clientes y usuarios — tarjetas por cliente, sugerencias del proveedor, selector de cuentas */
.cl-stack { display: grid; gap: 14px; }
.cl-card { overflow: hidden; }
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 18px; background: linear-gradient(180deg, var(--paper-2), var(--card)); border-bottom: 1px solid var(--line); }
.cl-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cl-mark { width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--ink); color: var(--lime); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: .9rem; letter-spacing: -.02em; flex-shrink: 0; }
.cl-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: .98rem; color: var(--text); }
.cl-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cl-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 0; }
.cl-col { padding: 16px 18px; min-width: 0; }
.cl-col + .cl-col { border-left: 1px solid var(--line); }
.cl-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.cl-list li { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 7px 8px; border-radius: var(--radius-sm); transition: background var(--fast); }
.cl-list li:hover { background: var(--paper-2); }
.cl-list .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cl-list .btn-group { margin-left: auto; opacity: 0; transition: opacity var(--fast); flex-shrink: 0; }
.cl-list li:hover .btn-group, .cl-list li:focus-within .btn-group { opacity: 1; }
.cl-flags { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }

.sug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.sug { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--card); cursor: pointer; transition: border-color var(--fast), box-shadow var(--fast); }
.sug:hover { border-color: var(--teal); }
.sug.on { border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); }
.sug input[type=checkbox] { margin-top: 10px; accent-color: var(--teal); width: 16px; height: 16px; flex-shrink: 0; }
.sug-top { display: flex; align-items: center; gap: 8px; }
.sug-name { flex: 1; min-width: 0; }
.sug-apps { font-size: .72rem; color: var(--text-3); margin-top: 6px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.pick-list { display: grid; gap: 4px; max-height: 44vh; overflow-y: auto; padding: 2px; margin: 0 -2px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.pick:hover { border-color: var(--line-2); background: var(--paper-2); }
.pick.on { border-color: var(--teal); background: var(--teal-soft); }
.pick.is-taken { opacity: .55; cursor: not-allowed; }
.pick input[type=checkbox] { accent-color: var(--teal); width: 16px; height: 16px; flex-shrink: 0; }

/* módulo: mi cuenta */
.acc-wrap { max-width: 980px; }
.acc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.acc-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.acc-mark { width: 48px; height: 48px; border-radius: var(--radius-lg); background: var(--teal); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; flex-shrink: 0; }
.acc-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--text); }
.acc-dl { margin: 18px 0 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.acc-dl > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; background: var(--card); }
.acc-dl dt { font-size: .76rem; font-weight: 600; color: var(--text-2); }
.acc-dl dd { margin: 0; font-size: .84rem; color: var(--text); text-align: right; min-width: 0; }
.pw-meter { height: 4px; border-radius: 999px; background: var(--paper-3); margin-top: 7px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; border-radius: 999px; transition: width var(--base) var(--ease), background var(--base); }

@media (max-width: 860px) {
  .cl-body { grid-template-columns: 1fr; }
  .cl-col + .cl-col { border-left: 0; border-top: 1px solid var(--line); }
  .cl-list .btn-group { opacity: 1; }
  .cl-head { align-items: flex-start; }
  .acc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cl-list li { flex-wrap: wrap; }
  .cl-list .btn-group { margin-left: 16px; }
  .acc-dl > div { flex-direction: column; align-items: flex-start; gap: 3px; }
  .acc-dl dd { text-align: left; }
}
