/* Agentes de IA CRM — shared, light identity */
:root {
    color-scheme: light;
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #94a3b8;
    --text-primary: #122746;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --primary: #0e7490;
    --primary-color: #0e7490;
    --primary-gradient: linear-gradient(135deg, #122746, #0e7490);
    --accent-primary: #0e7490;
    --accent-hover: #155e75;
    --accent-glow: rgba(6, 182, 212, .12);
    --font-sans: 'Inter', system-ui, sans-serif;
}
body { font-family: var(--font-sans); background: #f8fafc; }
button, input, textarea, select { font-family: inherit; }
::selection { background: #cffafe; color: #122746; }
:focus-visible { outline: 3px solid #0891b2; outline-offset: 3px; }
::-webkit-scrollbar-thumb { background: #b8c6d6; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.platform-logo { display: block; width: 230px; max-width: 100%; height: auto; }
.login-logo .platform-logo { width: 310px; margin: 0 auto; }
.login-container { max-width: 480px; }
body:has(.login-container) {
    min-height: 100dvh; height: auto; overflow: auto; padding: 32px 0;
    background: radial-gradient(ellipse at top right, #e0f2fe, transparent 60%), #f8fafc;
}
.login-card { padding: 40px 32px; border-radius: 24px; box-shadow: 0 16px 56px rgba(18,39,70,.08); background: #fff; }
.login-header h2 { color: #122746; }
.login-header p { line-height: 1.6; }
.login-logo { margin-bottom: 32px; }
.login-card .form-control { background: #f8fafc; color: #122746; min-height: 48px; }
.login-card .form-control:focus { background: #fff; box-shadow: 0 0 0 3px #cffafe; }
.form-control-wrapper svg { position: absolute; left: 14px; width: 18px; height: 18px; color: #64748b; pointer-events: none; }
.login-card .btn { min-height: 48px; color: white; background: #122746; }
.login-card .btn:hover { background: #0e7490; box-shadow: 0 6px 18px rgba(18,39,70,.12); }
body > header { background: #fff; box-shadow: 0 2px 12px rgba(18,39,70,.03); }
.header-badge { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.stat-card, .table-container, .settings-card { box-shadow: 0 3px 16px rgba(18,39,70,.035); }
.stat-info p, .header-title h2, .lead-name, .modal-lead-title h3,
.modal-lead-name-input, .btn-close:hover, .table-container tr:hover td { color: #122746; }
.stat-icon { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.modal-content, .modal-dialog { background-color: #fff; }
.form-control, select, textarea { color: #122746; }
.form-control:focus { background-color: #fff; border-color: #0891b2; box-shadow: 0 0 0 3px #cffafe; }
.btn-primary, .btn-success, .btn-danger:hover, .active-subtab,
.nav-item.active, .avatar { color: #fff !important; }
.btn-primary, .btn-success, .avatar { background: #0e7490; }
.btn-primary:hover, .btn-success:hover { background: #155e75; }
.btn-secondary { color: #334155; background: #f1f5f9; border-color: #e2e8f0; }
.btn-secondary:hover { color: #122746; background: #e2e8f0; }
.nav-item:hover { color: #122746; background: #f1f5f9; }
.nav-item.active { background: #122746; box-shadow: none; }
.sidebar-brand { margin-bottom: 24px; }
.sidebar-brand .platform-logo { width: 176px; margin: 0 0 10px; }
.sidebar-brand > div { flex-wrap: wrap; gap: 12px; }
.brand-text h1 { background: none; -webkit-text-fill-color: #122746; color: #122746; }
.kanban-column { background: #eef3f8; }
.lead-card { background: #fff; }
.table-container th, .table-container tbody tr:hover { background: #f1f5f9; }
/* The messaging workspace keeps its own layout and uses the same identity. */
.inbox-brand { display: block; padding: 2px 0 12px; border-bottom: 1px solid #e2e8f0; }
.inbox-brand img { display: block; width: 210px; max-width: 100%; height: auto; }
.inbox-header, .thread-header, .composer { background: #fff; }
.conversation-item:hover, .conversation-item.active { background: #ecfeff; }
.bubble { box-shadow: 0 1px 3px rgba(18,39,70,.06); border: 1px solid #e2e8f0; }
.bubble.lead, .bubble.agent { background: #fff; }
.bubble.admin { border-color: #a5f3fc; }
#sendBtn, #resumeAiBtn, .primary, #saveAssignLabelsBtn, .chip.active, .badge { color: #fff; }
@media (max-width: 640px) {
    body > header { padding: 14px 16px; flex-wrap: wrap; gap: 14px; }
    .header-logo { flex-wrap: wrap; gap: 8px; }
    .header-logo .platform-logo { width: 190px; }
    .header-actions { flex-wrap: wrap; gap: 8px; }
    .login-card { padding: 30px 22px; }
    .login-container { padding: 16px; }
    .container { padding-left: 16px; padding-right: 16px; }
}
.main-card { box-shadow: 0 4px 24px rgba(18,39,70,.05); }
.card-lead-name, .media-download-btn, .details-section h4,
.chat-input-area input, .ext-item input, .ext-item select { color: #122746; }
.chat-input-area input, .ext-item input, .ext-item select { background: #f8fafc; }
.message.admin, .message.agent { color: #122746; background: #ecfeff; border-color: #a5f3fc; }
.chat-bubble.lead { background: #fff; border: 1px solid #e2e8f0; }
.chat-bubble.agent, .chat-bubble.admin { background: #ecfeff; color: #122746; border-color: #a5f3fc; }

/* Superadmin: use the available viewport without constraining the client CRM. */
.superadmin-page .container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 32px clamp(20px, 2.5vw, 64px) 48px;
    min-width: 0;
}
.superadmin-page > header { padding: 16px clamp(20px, 2.5vw, 64px); }
.dashboard-heading { margin-bottom: 28px; }
.dashboard-eyebrow { color: #0e7490; font-size: 11px; font-weight: 700; letter-spacing: .12em; margin-bottom: 8px; }
.dashboard-heading h1 { font-size: clamp(26px, 2.2vw, 34px); letter-spacing: -.04em; font-weight: 700; color: #122746; }
.dashboard-description, .section-description { color: #64748b; font-size: 13px; line-height: 1.6; margin-top: 7px; }
.superadmin-page .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 28px; }
.superadmin-page .stat-card { min-width: 0; padding: 24px; min-height: 128px; gap: 16px; }
.superadmin-page .stat-info h3 { font-size: 11px; line-height: 1.5; }
.superadmin-page .stat-info p { margin-top: 8px; font-size: 36px; letter-spacing: -.04em; }
.superadmin-page .stat-icon { flex-shrink: 0; }
.superadmin-page .main-card { margin-bottom: 0; }
.superadmin-page .card-header { padding: 24px; gap: 20px; }
.superadmin-page .card-header h2 { font-size: 17px; }
.superadmin-page .card-header > .btn { flex-shrink: 0; min-height: 42px; }
.superadmin-page .table-responsive { overflow-x: auto; }
.superadmin-page table { min-width: 1080px; }
.superadmin-page th, .superadmin-page td { padding: 20px 24px; vertical-align: middle; }
.superadmin-page th { font-size: 10px; letter-spacing: .06em; white-space: nowrap; }
.superadmin-page th:first-child { width: 22%; }
.superadmin-page th:nth-child(2) { width: 9%; }
.superadmin-page th:nth-child(3) { width: 20%; }
.superadmin-page .tenant-name { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.superadmin-page .tenant-slug { display: inline-block; margin-top: 5px; background: #ecfeff; color: #0e7490; overflow-wrap: anywhere; }
.tenant-metrics { display: flex; gap: 20px; }
.tenant-metrics span { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #64748b; }
.tenant-metrics strong { font-size: 16px; color: #122746; }
.superadmin-page .actions-cell { display: flex; flex-wrap: wrap; gap: 8px; }
.superadmin-page .actions-cell .btn { white-space: nowrap; min-height: 36px; justify-content: center; }
.superadmin-page footer { padding: 18px 24px; line-height: 1.7; }
@media (max-width: 900px) {
    .superadmin-page .stat-card { padding: 18px; gap: 10px; }
    .superadmin-page .stat-icon { padding: 8px; }
}
@media (max-width: 640px) {
    .superadmin-page .container { padding: 24px 16px 32px; }
    .superadmin-page > header { padding: 14px 16px; }
    .superadmin-page .stats-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
    .superadmin-page .stat-card { min-height: 100px; }
    .superadmin-page .card-header { padding: 20px; flex-direction: column; align-items: stretch; gap: 16px; }
    .superadmin-page .card-header > .btn { justify-content: center; }
    .superadmin-page .table-responsive { scrollbar-width: thin; }
}
