/* ==========================================================================
   LeadGen — design system (the single stylesheet of the application)
   One design language for the platform and the organization workspace
   (indigo/violet brand, Inter + Plus Jakarta Sans, Bootstrap 5.3 base),
   extended with lead-generation components.
   1 tokens · 2 base · 3 shell · 4 page header · 5 cards & stats · 6 buttons
   7 forms · 8 tables · 9 status & badges · 10 feedback · 11 overlays & tabs
   12 lead components (results, conversations, timeline, pricing, usage)
   13 auth & public site · 14 utilities · 15 responsive
   ========================================================================== */

/* 1. TOKENS */
:root {
    --brand-50: #eef2ff; --brand-100: #e0e7ff; --brand-200: #c7d2fe; --brand-400: #818cf8;
    --brand-500: #6366f1; --brand-600: #4f46e5; --brand-700: #4338ca; --brand-900: #1e1b4b;
    --violet-600: #7c3aed; --teal-600: #0d9488;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #a855f7 100%);
    --gradient-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    --gradient-sidebar: linear-gradient(180deg, #111034 0%, #1e1b4b 55%, #2e1065 100%);

    --canvas: #f4f6fb; --surface: #fff; --surface-2: #f8fafc;
    --border: #e6e9f2; --border-strong: #d4d9e6;
    --text: #0f172a; --text-2: #334155; --muted: #64748b; --subtle: #94a3b8;

    --success: #059669; --success-bg: #ecfdf5;
    --warning: #b45309; --warning-bg: #fffbeb;
    --danger: #dc2626; --danger-bg: #fef2f2;
    --info: #0369a1; --info-bg: #f0f9ff;


    --whatsapp: #16a34a; --whatsapp-bg: #dcfce7; --chat-bg: #efeae2;

    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-display: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, sans-serif;
    --radius-sm: 8px; --radius: 12px; --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .04);
    --shadow-lg: 0 24px 48px -16px rgba(30, 27, 75, .25);
    --ring: 0 0 0 4px rgba(99, 102, 241, .18);
    --sidebar-w: 264px; --sidebar-w-collapsed: 76px; --topbar-h: 64px;
    --t: .2s cubic-bezier(.2, .8, .2, 1);

    --bs-primary: #4f46e5; --bs-primary-rgb: 79, 70, 229;
    --bs-body-font-family: var(--font); --bs-body-color: var(--text); --bs-body-bg: var(--canvas);
    --bs-border-color: var(--border); --bs-link-color: var(--brand-600); --bs-link-hover-color: var(--brand-700);
    --bs-border-radius: var(--radius-sm);
}

/* 2. BASE */
body { font-family: var(--font); font-size: .875rem; line-height: 1.55; color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4, h5 { font-size: 1rem; } h6 { font-size: .875rem; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
.text-muted { color: var(--muted) !important; }
::selection { background: var(--brand-200); }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* 3. SHELL */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1040; width: var(--sidebar-w); display: flex; flex-direction: column; background: var(--gradient-sidebar); color: #c7d2fe; transition: width var(--t), transform var(--t); }
.app-brand { display: flex; align-items: center; gap: .75rem; height: var(--topbar-h); padding: 0 1.2rem; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .06); flex-shrink: 0; }
.app-brand:hover { color: #fff; }
.app-brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--gradient); box-shadow: 0 6px 16px -4px rgba(124, 58, 237, .6); font-size: 1.05rem; flex-shrink: 0; }
.app-brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; line-height: 1.1; white-space: nowrap; }
.app-brand-name small { display: block; font-family: var(--font); font-weight: 500; font-size: .66rem; color: #a5b4fc; letter-spacing: .06em; text-transform: uppercase; }
.app-nav { flex: 1; overflow-y: auto; padding: .9rem .7rem 1.4rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.nav-group + .nav-group { margin-top: .9rem; }
.nav-heading { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; padding: .3rem .75rem; color: #818cf8; font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.nav-heading .bi { font-size: .65rem; transition: transform var(--t); }
.nav-group.collapsed .nav-heading .bi { transform: rotate(-90deg); }
.nav-group.collapsed .nav-list { display: none; }
.nav-list { list-style: none; margin: .2rem 0 0; padding: 0; }
.nav-link-app { position: relative; display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; margin: 1px 0; border-radius: 10px; color: #c7d2fe; font-weight: 500; font-size: .84rem; white-space: nowrap; transition: background var(--t), color var(--t); }
.nav-link-app .bi { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; flex-shrink: 0; }
.nav-link-app:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link-app.active { background: rgba(129, 140, 248, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(165, 180, 252, .15); }
.nav-link-app.active::before { content: ""; position: absolute; left: -.7rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: #a5b4fc; }
.app-sidebar-footer { padding: .8rem 1rem; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .75rem; }
.role-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .65rem; border-radius: 999px; background: rgba(255, 255, 255, .08); color: #e0e7ff; font-weight: 600; }
.org-chip { display: block; color: #a5b4fc; margin-top: .45rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; transition: margin var(--t); }
.app-topbar { position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--text-2); font-size: 1.1rem; transition: background var(--t); }
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.user-btn { display: flex; align-items: center; gap: .6rem; padding: .25rem .6rem .25rem .25rem; border: 1px solid var(--border); border-radius: 999px; background: #fff; }
.user-btn:hover { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gradient); color: #fff; font-weight: 700; font-size: .75rem; flex-shrink: 0; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.user-meta { line-height: 1.15; text-align: left; }
.user-meta strong { display: block; font-size: .8rem; }
.user-meta span { font-size: .68rem; color: var(--muted); }
.app-content { flex: 1; width: 100%; max-width: 1560px; margin: 0 auto; padding: 1.6rem; }
.app-footer { padding: .9rem 1.6rem; font-size: .72rem; color: var(--subtle); border-top: 1px solid var(--border); background: #fff; }
.app-backdrop { display: none; }
body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-brand-name, body.sidebar-collapsed .nav-heading, body.sidebar-collapsed .nav-link-app span, body.sidebar-collapsed .app-sidebar-footer { display: none; }
body.sidebar-collapsed .nav-group.collapsed .nav-list { display: block; }
body.sidebar-collapsed .nav-link-app { justify-content: center; }

/* 4. PAGE HEADER */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -.025em; margin: 0; }
.page-subtitle { color: var(--muted); margin: .2rem 0 0; }
.breadcrumb { font-size: .78rem; margin-bottom: .35rem; --bs-breadcrumb-divider: "›"; }
.breadcrumb-item a { color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* 5. CARDS & STATS */
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: .95rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.card-header h2, .card-header h3, .card-header h5 { font-size: .95rem; margin: 0; }
.card-body { padding: 1.2rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); }
.section-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--brand-50); color: var(--brand-600); font-size: 1rem; flex-shrink: 0; }
.stat { display: flex; gap: .9rem; align-items: center; padding: 1.05rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); height: 100%; transition: transform var(--t), box-shadow var(--t); color: inherit; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; color: #fff; background: var(--gradient); flex-shrink: 0; box-shadow: 0 8px 16px -8px rgba(79, 70, 229, .7); }
.stat-label { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat-sub { font-size: .72rem; color: var(--muted); }
.stat--teal .stat-icon { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.stat--amber .stat-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat--sky .stat-icon { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.stat--rose .stat-icon { background: linear-gradient(135deg, #f43f5e, #ec4899); }
.stat--green .stat-icon { background: linear-gradient(135deg, #059669, #10b981); }
.stat--slate .stat-icon { background: linear-gradient(135deg, #475569, #64748b); }
.hero { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 1.5rem 1.6rem; background: var(--gradient); color: #fff; box-shadow: var(--shadow-lg); }
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.hero h1 { color: #fff; font-size: 1.45rem; margin: 0 0 .3rem; }
.hero p { margin: 0; color: rgba(255, 255, 255, .86); }
.hero .btn { position: relative; z-index: 1; }
.kv { display: grid; grid-template-columns: 38% 1fr; gap: .45rem .9rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }

/* 6. BUTTONS */
.btn { --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; --bs-btn-font-size: .84rem; --bs-btn-font-weight: 600; --bs-btn-border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: all var(--t); }
.btn-sm { --bs-btn-padding-x: .7rem; --bs-btn-padding-y: .32rem; --bs-btn-font-size: .76rem; --bs-btn-border-radius: 8px; }
.btn-primary { background: var(--gradient); border: 0; box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .7); }
.btn-primary:hover, .btn-primary:focus { background: linear-gradient(135deg, #4338ca, #6d28d9 60%, #9333ea); box-shadow: 0 10px 20px -8px rgba(79, 70, 229, .8); }
.btn-success { background: linear-gradient(135deg, #059669, #10b981); border: 0; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); border: 0; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #f97316); border: 0; color: #fff; }
.btn-warning:hover { color: #fff; }
.btn-light, .btn-outline-secondary { --bs-btn-color: var(--text-2); --bs-btn-bg: #fff; --bs-btn-border-color: var(--border-strong); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--brand-200); --bs-btn-hover-color: var(--brand-700); --bs-btn-active-bg: var(--brand-50); --bs-btn-active-color: var(--brand-700); }
.btn-outline-primary { --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-200); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); }
.btn-outline-danger { --bs-btn-border-color: #fecaca; }
.btn-ai { background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; border: 0; }
.btn-ai:hover { color: #fff; filter: brightness(1.07); }
.row-actions { display: inline-flex; gap: .2rem; }
.row-actions a, .row-actions button { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); border: 0; background: transparent; }
.row-actions a:hover, .row-actions button:hover { background: var(--brand-50); color: var(--brand-700); }
.row-actions .danger:hover { background: var(--danger-bg); color: var(--danger); }

/* 7. FORMS */
.form-label { font-weight: 600; font-size: .8rem; color: var(--text-2); margin-bottom: .35rem; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control, .form-select { border: 1px solid var(--border-strong); border-radius: 10px; padding: .52rem .8rem; font-size: .86rem; color: var(--text); background-color: #fff; transition: border-color var(--t), box-shadow var(--t); }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.form-control::placeholder { color: var(--subtle); }
.form-control[readonly], .form-control:disabled { background: var(--surface-2); color: var(--muted); }
.form-control.is-invalid, .input-validation-error { border-color: var(--danger) !important; }
.field-validation-error, .text-danger.small { display: block; margin-top: .25rem; font-size: .76rem; font-weight: 500; color: var(--danger); }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.form-text { color: var(--muted); font-size: .76rem; }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { box-shadow: var(--ring); }
.form-section { padding: 1.2rem; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; padding: 1rem 1.2rem; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.check-card { display: flex; align-items: center; gap: .6rem; padding: .65rem .8rem; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; background: #fff; transition: all var(--t); user-select: none; }
.check-card:hover { border-color: var(--brand-400); }
.check-card input { margin: 0; }
.check-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); box-shadow: var(--ring); }
.check-card.disabled { opacity: .5; cursor: not-allowed; }
.char-count { font-size: .72rem; color: var(--muted); text-align: right; }
.char-count.over { color: var(--danger); font-weight: 700; }
.secret-hint { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: .2rem .5rem; border-radius: 6px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 160px; }
.search-box { position: relative; }
.search-box .bi { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--subtle); }
.search-box .form-control { padding-left: 2.2rem; min-width: 240px; }

/* 8. TABLES */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f8f9ff; margin: 0; color: var(--text-2); vertical-align: middle; }
.table > thead > tr > th { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); padding: .7rem 1rem; white-space: nowrap; }
.table > tbody > tr > td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.cell-primary strong { display: block; color: var(--text); font-weight: 600; }
.cell-primary > span, .cell-sub { display: block; font-size: .75rem; color: var(--muted); }
.cell-primary .chip { display: inline-flex; }
.cell-clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 1.2rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); }
.pagination { gap: .25rem; margin: 0; }
.page-link { border: 0; border-radius: 8px !important; color: var(--text-2); font-weight: 600; font-size: .78rem; padding: .35rem .65rem; }
.page-item.active .page-link { background: var(--gradient); color: #fff; }
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty .bi { font-size: 2.4rem; color: var(--brand-400); display: block; margin-bottom: .6rem; }
.empty h3 { font-size: 1rem; color: var(--text); }

/* 9. STATUS & BADGES */
.badge { font-weight: 600; font-size: .7rem; padding: .35em .65em; border-radius: 999px; }
.status { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .62rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; background: #f1f5f9; color: #475569; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-ai { background: #f5f3ff; color: #6d28d9; }
.st-pending { background: #fffbeb; color: #b45309; }
.st-approved { background: #eef2ff; color: #4338ca; }
.st-scheduled { background: #f0f9ff; color: #0369a1; }
.st-published { background: #ecfdf5; color: #047857; }
.st-failed { background: #fef2f2; color: #b91c1c; }
.st-muted { background: #f1f5f9; color: #64748b; }
.st-new { background: #eff6ff; color: #1d4ed8; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.chip-brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }

/* 10. FEEDBACK */
.alert { border-radius: var(--radius); border: 1px solid transparent; font-size: .85rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-success { background: var(--success-bg); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--warning-bg); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--info-bg); border-color: #bae6fd; color: #075985; }
.toast-stack { position: fixed; right: 1rem; top: calc(var(--topbar-h) + .75rem); z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: 420px; }
.toast-stack .alert { box-shadow: var(--shadow-lg); animation: slidein .25s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.progress { height: 8px; border-radius: 999px; background: #eef1f6; }
.progress-bar { background: var(--gradient); border-radius: 999px; }
.sim-banner { background: repeating-linear-gradient(45deg, #fffbeb, #fffbeb 10px, #fef3c7 10px, #fef3c7 20px); border-bottom: 1px solid #fde68a; color: #92400e; font-size: .75rem; font-weight: 600; text-align: center; padding: .3rem 1rem; }
.spinner-overlay { position: fixed; inset: 0; z-index: 2000; display: none; place-items: center; background: rgba(15, 23, 42, .35); backdrop-filter: blur(2px); }
.spinner-overlay.show { display: grid; }
.spinner-card { background: #fff; padding: 1.4rem 1.8rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: .9rem; font-weight: 600; }

/* 11. OVERLAYS & TABS */
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-footer { background: var(--surface-2); }
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; font-size: .84rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .7rem; display: flex; align-items: center; gap: .55rem; }
.dropdown-item:hover { background: var(--brand-50); color: var(--brand-700); }
.nav-tabs { border-bottom: 1px solid var(--border); gap: .2rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; padding: .6rem .9rem; border-radius: 0; }
.nav-tabs .nav-link.active { color: var(--brand-700); border-bottom-color: var(--brand-600); background: transparent; }
.nav-pills .nav-link { color: var(--text-2); font-weight: 600; border-radius: 999px; padding: .38rem .9rem; font-size: .8rem; }
.nav-pills .nav-link.active { background: var(--gradient); }

/* 12. LEAD COMPONENTS */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 1rem 2.1rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-dot { position: absolute; left: 4px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--brand-400); }
.timeline .tl-dot.ok { border-color: #10b981; } .timeline .tl-dot.warn { border-color: #f59e0b; } .timeline .tl-dot.msg { border-color: var(--whatsapp); }
.timeline .tl-title { font-weight: 600; color: var(--text); font-size: .84rem; word-break: break-word; }
.timeline .tl-meta { font-size: .72rem; color: var(--muted); }
.perm-module { background: var(--surface-2) !important; font-weight: 700; color: var(--text); }
.perm-matrix th, .perm-matrix td { text-align: center; white-space: nowrap; }
.perm-matrix th:first-child, .perm-matrix td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; white-space: normal; min-width: 220px; }
.perm-matrix .bi-check-circle-fill { color: var(--success); } .perm-matrix .bi-dash { color: var(--subtle); }

/* Search results & bulk actions */
.result-row.saved td { color: var(--subtle); }
.result-row.saved .cell-primary strong { color: var(--muted); }
.bulk-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem 1.2rem; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.bulk-bar .count { font-weight: 700; color: var(--brand-700); margin-right: auto; }
.check-col { width: 38px; }
.link-icons { display: inline-flex; gap: .15rem; }
.link-icons a { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); }
.link-icons a:hover { background: var(--brand-50); color: var(--brand-700); }
.link-icons a.wa:hover { background: var(--whatsapp-bg); color: var(--whatsapp); }
.search-panel { background: var(--gradient-soft); border: 1px solid var(--brand-100); border-radius: var(--radius-lg); padding: 1.2rem; }
.pipeline { display: flex; flex-wrap: wrap; gap: .4rem; }
.pipeline .step { flex: 1 1 110px; min-width: 110px; padding: .6rem .7rem; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.pipeline .step .n { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; line-height: 1.1; }
.pipeline .step .l { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.status-picker { display: flex; flex-wrap: wrap; gap: .35rem; }
.status-picker label { cursor: pointer; }
.status-picker input { position: absolute; opacity: 0; pointer-events: none; }
.status-picker .status { border: 1px solid transparent; padding: .35rem .7rem; }
.status-picker input:checked + .status { border-color: currentColor; box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.status-picker input:focus-visible + .status { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* Conversations (WhatsApp / email) */
.chat { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; height: 420px; overflow-y: auto; background: var(--chat-bg); }
.chat.email { background: var(--surface-2); }
.bubble { max-width: 82%; padding: .55rem .75rem .35rem; border-radius: 12px; font-size: .84rem; box-shadow: 0 1px 1px rgba(15, 23, 42, .08); word-break: break-word; white-space: pre-wrap; }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 4px; }
.chat.email .bubble.out { background: var(--brand-50); }
.bubble .subject { font-weight: 700; margin-bottom: .2rem; white-space: normal; }
.bubble .meta { display: block; text-align: right; font-size: .66rem; color: var(--muted); margin-top: .2rem; white-space: normal; }
.bubble .meta .bi-check2-all { color: #0ea5e9; }
.bubble.failed { border: 1px solid #fecaca; }
.bubble a.attach { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; margin-top: .3rem; }
.bubble img { max-width: 220px; border-radius: 8px; display: block; margin-top: .3rem; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); font-size: .82rem; }
.composer { display: flex; gap: .5rem; align-items: flex-end; padding: .75rem; border-top: 1px solid var(--border); background: #fff; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.composer textarea { resize: vertical; min-height: 42px; }
.composer .file-chip { font-size: .72rem; }
.ai-panel { border: 1px solid #e9d5ff; background: linear-gradient(180deg, #faf5ff, #fff 45%); border-radius: var(--radius-lg); }

/* Pricing & usage */
.price-card { position: relative; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; padding: 1.4rem; height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); transition: transform var(--t), box-shadow var(--t); }
.price-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.price-card.popular { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12), var(--shadow-md); }
.price-card.current { border-color: #10b981; }
.price-card .ribbon { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--gradient); color: #fff; font-size: .68rem; font-weight: 700; padding: .2rem .7rem; border-radius: 999px; white-space: nowrap; }
.price-card .price { font-family: var(--font-display); font-size: 2rem; font-weight: 800; line-height: 1; }
.price-card .price small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.price-card ul { list-style: none; padding: 0; margin: 1rem 0 1.2rem; flex: 1; }
.price-card li { padding: .3rem 0; font-size: .84rem; display: flex; gap: .45rem; }
.price-card li .bi { color: var(--success); }
.usage-line + .usage-line { margin-top: .8rem; }
.usage-line .progress-bar.warn { background: linear-gradient(135deg, #f59e0b, #f97316); }
.usage-line .progress-bar.full { background: linear-gradient(135deg, #ef4444, #dc2626); }
.trial-banner { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-radius: var(--radius); background: var(--warning-bg); border: 1px solid #fde68a; color: #92400e; margin-bottom: 1rem; }

/* Help */
.guide-step { display: flex; gap: .9rem; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.guide-step:last-child { border-bottom: 0; }
.guide-step .num { width: 30px; height: 30px; border-radius: 50%; background: var(--gradient); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.guide-step img { max-width: 100%; border: 1px solid var(--border); border-radius: 10px; margin-top: .5rem; cursor: zoom-in; }
.help-tile { display: flex; gap: .9rem; align-items: center; padding: 1.1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; height: 100%; color: inherit; box-shadow: var(--shadow-sm); transition: transform var(--t), box-shadow var(--t); }
.help-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }

/* Assistant widget */
.assistant-fab { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 1045; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--gradient); color: #fff; font-size: 1.35rem; box-shadow: var(--shadow-lg); display: grid; place-items: center; }
.assistant-panel { position: fixed; right: 1.2rem; bottom: 5.2rem; z-index: 1046; width: min(380px, calc(100vw - 2rem)); height: min(520px, calc(100vh - 7rem)); display: none; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.assistant-panel.open { display: flex; }
.assistant-head { padding: .8rem 1rem; background: var(--gradient); color: #fff; display: flex; align-items: center; justify-content: space-between; }
.assistant-body { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .5rem; background: var(--surface-2); }
.assistant-body .bubble.out { background: var(--brand-50); }
.assistant-foot { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--border); }

/* 13. AUTH & PUBLIC SITE */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-aside { position: relative; overflow: hidden; background: var(--gradient-sidebar); color: #e0e7ff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside::before { content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; right: -160px; top: -120px; background: radial-gradient(circle, rgba(168, 85, 247, .45), transparent 70%); }
.auth-aside h1 { color: #fff; font-size: 2.1rem; font-weight: 800; line-height: 1.15; max-width: 460px; }
.auth-aside p { color: #c7d2fe; max-width: 460px; }
.auth-feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; position: relative; }
.auth-feature .bi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #fff; flex-shrink: 0; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h2 { font-size: 1.55rem; font-weight: 800; }
.auth-card.wide { max-width: 560px; }
.public-page { min-height: 100vh; background: var(--canvas); padding: 2rem 1rem; }
.public-card { max-width: 860px; margin: 0 auto; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.4rem; letter-spacing: .5em; text-align: center; }
.stepper { display: flex; gap: .5rem; margin-bottom: 1.2rem; }
.stepper .s { flex: 1; height: 4px; border-radius: 4px; background: var(--border); }
.stepper .s.done { background: var(--gradient); }

.site-nav { position: sticky; top: 0; z-index: 1030; background: rgba(17, 16, 52, .92); backdrop-filter: blur(12px); }
.site-nav .container { display: flex; align-items: center; gap: 1rem; height: 64px; }
.site-nav a.nav-a { color: #c7d2fe; font-weight: 500; font-size: .86rem; }
.site-nav a.nav-a:hover { color: #fff; }
.site-brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }
.site-brand:hover { color: #fff; }
.site-hero { position: relative; overflow: hidden; background: var(--gradient-sidebar); color: #e0e7ff; padding: 5rem 0 6rem; }
.site-hero::before { content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%; right: -180px; top: -200px; background: radial-gradient(circle, rgba(168, 85, 247, .45), transparent 70%); }
.site-hero h1 { color: #fff; font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; }
.site-hero .lead { color: #c7d2fe; font-size: 1.08rem; max-width: 560px; }
.hero-card { position: relative; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--radius-lg); padding: 1.2rem; backdrop-filter: blur(8px); }
.hero-card .row-demo { display: flex; align-items: center; gap: .7rem; padding: .6rem .4rem; border-bottom: 1px solid rgba(255, 255, 255, .08); color: #e0e7ff; font-size: .84rem; }
.hero-card .row-demo:last-child { border-bottom: 0; }
.site-section { padding: 4.5rem 0; }
.site-section.alt { background: #fff; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.eyebrow { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-600); background: var(--brand-50); padding: .25rem .7rem; border-radius: 999px; margin-bottom: .8rem; }
.feature { height: 100%; padding: 1.3rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); }
.feature .section-icon { width: 42px; height: 42px; font-size: 1.15rem; margin-bottom: .8rem; }
.site-footer { background: #0f0e2e; color: #a5b4fc; padding: 2.5rem 0 1.5rem; font-size: .84rem; }
.site-footer a { color: #c7d2fe; }
.prose h2 { margin-top: 1.6rem; font-size: 1.15rem; } .prose p, .prose li { color: var(--text-2); }

/* 14. UTILITIES */
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.fs-xs { font-size: .72rem; } .fs-sm { font-size: .8rem; }
.min-w-0 { min-width: 0; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.divider { border-top: 1px solid var(--border); margin: 1rem 0; }
.text-wa { color: var(--whatsapp) !important; }
.required-mark::after { content: " *"; color: var(--danger); font-weight: 700; }

/* 15. RESPONSIVE (tested at 360 px, 768 px and 1440 px) */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    body.sidebar-open .app-sidebar { transform: none; }
    body.sidebar-open .app-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .45); }
    .app-main, body.sidebar-collapsed .app-main { margin-left: 0; }
    body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w); }
    body.sidebar-collapsed .app-brand-name, body.sidebar-collapsed .nav-heading, body.sidebar-collapsed .nav-link-app span, body.sidebar-collapsed .app-sidebar-footer { display: revert; }
    .app-content { padding: 1rem; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .sticky-side { position: static; }
    .chat { height: 360px; }
}
@media (max-width: 767.98px) {
    .filter-bar { width: 100%; }
    .filter-bar > * { flex: 1 1 100%; }
    .filter-bar .form-control, .filter-bar .form-select, .search-box .form-control { width: 100%; min-width: 0; }
    .page-head { align-items: stretch; }
    .page-actions { width: 100%; }
    .page-actions > .btn, .page-actions > form, .page-actions > .dropdown { flex: 1 1 auto; }
    .page-actions > form .btn, .page-actions > .dropdown > .btn { width: 100%; }
    .site-hero { padding: 3rem 0 3.5rem; }
    .site-section { padding: 3rem 0; }
    .bubble { max-width: 92%; }
}
@media (max-width: 575.98px) {
    .app-topbar { padding: 0 .75rem; }
    .user-meta { display: none; }
    .page-title { font-size: 1.3rem; }
    .kv { grid-template-columns: 1fr; gap: .1rem; }
    .kv dd { margin-bottom: .5rem; }
    .card-header { flex-wrap: wrap; }
    .table > thead > tr > th, .table > tbody > tr > td { padding: .6rem .65rem; }
    .stat { padding: .85rem; gap: .65rem; }
    .stat-icon { width: 38px; height: 38px; font-size: 1rem; }
    .stat-value { font-size: 1.25rem; }
    .toast-stack { left: .75rem; right: .75rem; max-width: none; }
    .assistant-fab { right: .8rem; bottom: .8rem; }
}
@media print {
    .app-sidebar, .app-topbar, .app-footer, .page-actions, .btn, .assistant-fab { display: none !important; }
    .app-main { margin: 0 !important; }
}
.wa-qr img { display: block; border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: #fff; max-width: 100%; height: auto; }
