/* ===================================================
   CRMZap - Design System
   =================================================== */

:root {
    --bg-primary: #FAFBFC;
    --bg-secondary: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-hover: #F3F4F6;
    --bg-active: #EEF2FF;
    --bg-accent: #F0F9FF;

    --border: #E5E7EB;
    --border-light: #F3F4F6;

    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;

    --accent: #0EA5E9;
    --accent-hover: #0284C7;
    --accent-light: #E0F2FE;
    --accent-bg: #F0F9FF;

    --green: #38BDF8;
    --green-light: #E0F2FE;
    --blue: #3B82F6;
    --blue-light: #DBEAFE;
    --red: #EF4444;
    --red-light: #FEE2E2;
    --orange: #F59E0B;
    --orange-light: #FEF3C7;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 150ms var(--ease);
}

/* ========== TEMA ESCURO (remover este bloco inteiro para voltar só ao tema claro) ========== */
html.theme-dark {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-elevated: #1e293b;
    --bg-hover: #334155;
    --bg-active: #1e3a5f;
    --bg-accent: #0c4a6e;

    --border: #334155;
    --border-light: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-light: #0c4a6e;
    --accent-bg: #0c4a6e;

    --green: #38bdf8;
    --green-light: #0c4a6e;
    --blue: #60a5fa;
    --blue-light: #1e3a5f;
    --red: #f87171;
    --red-light: #450a0a;
    --orange: #fbbf24;
    --orange-light: #422006;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.35);
}

/* Ajustes pontuais no tema escuro (elementos com cor fixa) */
html.theme-dark body { background-color: var(--bg-primary); color: var(--text-primary); }
html.theme-dark .login-body::before {
    background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 100%);
}
html.theme-dark .topbar,
html.theme-dark .settings-sidebar {
    border-color: var(--border);
}
html.theme-dark input[type="text"],
html.theme-dark input[type="email"],
html.theme-dark input[type="password"],
html.theme-dark input[type="number"],
html.theme-dark input[type="datetime-local"],
html.theme-dark textarea,
html.theme-dark select {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-primary);
}
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
    color: var(--text-muted);
}
html.theme-dark .modal-box {
    background: var(--bg-elevated);
    border-color: var(--border);
}
html.theme-dark .cm-msg-in { background: var(--bg-hover); }
html.theme-dark .cm-msg-out { background: var(--accent-bg); color: var(--accent); }
html.theme-dark .cm-msg-in .cm-msg-body { background: var(--bg-hover); color: #cbd5e1; }
html.theme-dark .cm-msg-out .cm-msg-body { background: #0c4a6e; color: #93c5fd; }
html.theme-dark .flash-messages .flash { border-color: var(--border); }
html.theme-dark .btn-toggle-default-new.is-active { background: #422006; color: #fbbf24; }
html.theme-dark .btn-toggle-default-new.is-active:hover { background: #78350f; }
html.theme-dark .btn-tarefa-icon.btn-tarefa-approve:hover { color: #0f172a; }
html.theme-dark .btn-tarefa-icon.btn-tarefa-reject:hover { background: #450a0a; color: #f87171; border-color: #7f1d1d; }

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* ===================================================
   Login
   =================================================== */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
}

.login-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50vh;
    background: linear-gradient(135deg, #0369A1 0%, #0EA5E9 100%);
    border-radius: 0 0 40px 40px;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 44px 36px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0EA5E9 0%, #38BDF8 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
}

.logo-icon svg {
    width: 36px;
    height: 36px;
}

.login-logo h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}

.login-content {
    margin-bottom: 24px;
}

.login-desc {
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
    font-size: 13.5px;
}

.login-desc-note {
    margin-bottom: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.btn-google:hover {
    background: var(--bg-hover);
    border-color: #D1D5DB;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-google:active { transform: translateY(0); }

.google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.login-footer {
    text-align: center;
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
}

.login-footer p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ===================================================
   Flash Messages
   =================================================== */

.flash-messages {
    margin-bottom: 16px;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 500;
    animation: flash-in 0.3s var(--ease);
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
    background: var(--green-light);
    color: #0369A1;
}

.flash-error {
    background: var(--red-light);
    color: #991B1B;
}

.flash-info {
    background: var(--blue-light);
    color: #1E40AF;
}

.flash-warning {
    background: var(--orange-light);
    color: #92400E;
}

.flash-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 12px;
    transition: opacity var(--transition);
}

.flash-close:hover { opacity: 1; }

/* ===================================================
   Dashboard Layout
   =================================================== */

.dashboard-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content-full { width: 100%; }

/* ===================================================
   Topbar
   =================================================== */

.topbar {
    height: 56px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
    position: relative;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo svg {
    filter: drop-shadow(0 1px 2px rgba(16, 185, 129, 0.2));
}

.topbar-brand {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.topbar-left h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border-radius: var(--radius);
    transition: background var(--transition);
}

.user-info:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
    transition: border-color var(--transition);
}

.user-info:hover .user-avatar {
    border-color: var(--accent-light);
}

.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9, #38BDF8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.topbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-btn-active {
    background: var(--accent-bg);
    color: var(--accent);
}

.topbar-btn-active:hover {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.topbar-btn-has-tasks,
.topbar-btn-has-tasks.topbar-btn-active {
    background: #16A34A;
    color: #fff;
}

.topbar-btn-has-tasks:hover,
.topbar-btn-has-tasks.topbar-btn-active:hover {
    background: #15803D;
    color: #fff;
}

.topbar-theme-toggle {
    border: none;
    background: transparent;
}

.tarefas-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.topbar-search-wrap {
    position: relative;
    margin-left: 8px;
}

.topbar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.topbar-search-input {
    width: 340px;
    padding: 8px 28px 8px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-primary);
    outline: none;
    transition: border-color 0.15s;
}

.topbar-search-input::placeholder {
    color: var(--text-muted);
}

.topbar-search-input:focus {
    border-color: var(--accent);
}

.topbar-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    display: none;
    border-radius: 50%;
    transition: color 0.15s;
}
.topbar-search-clear:hover {
    color: var(--text-primary);
}
.topbar-search-wrap.has-value .topbar-search-clear {
    display: block;
}

.scheduler-countdown-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
}
.scheduler-countdown-label {
    white-space: nowrap;
}
.scheduler-countdown {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--accent);
    min-width: 2.5em;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.btn-topbar-logout {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    z-index: 10;
}

.btn-topbar-logout:hover {
    background: var(--red-light);
    color: var(--red);
}

/* ===================================================
   Content Area
   =================================================== */

.content-area {
    flex: 1;
    overflow: hidden;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}

.has-kanban > .content-area {
    padding: 0;
    overflow: hidden;
}

/* ===================================================
   Status dots
   =================================================== */

.nav-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-status-active  { background: var(--green); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15); }
.nav-status-error   { background: var(--red); }
.nav-status-pending { background: var(--orange); }
.nav-status-inactive { background: var(--text-muted); }
.nav-status-none    { background: var(--border); }

/* ===================================================
   WhatsApp Config Page
   =================================================== */

.wz-config-page {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    flex: 1;
}

.wz-section {
    padding: 0 4px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.section-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Empty state */
.wz-empty-banner {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    border: 2px dashed var(--border);
    padding: 48px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: border-color var(--transition);
}

.wz-empty-banner:hover {
    border-color: #D1D5DB;
}

.wz-empty-icon svg {
    width: 56px;
    height: 56px;
}

.wz-empty-banner h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.wz-empty-banner p {
    font-size: 13.5px;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.7;
}

.btn-guide {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    margin-top: 8px;
}

.btn-guide:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

/* Connected card */
.wz-connected-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.wz-connected-card:hover {
    box-shadow: var(--shadow-md);
}

.wz-connected-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--accent-bg);
    border-bottom: 1px solid var(--accent-light);
    flex-wrap: wrap;
}

.wz-connected-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.wz-connected-icon svg {
    width: 28px;
    height: 28px;
}

.wz-connected-info { flex: 1; min-width: 0; }

.wz-connected-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-active  { background: var(--green); box-shadow: 0 0 0 3px rgba(14,165,233,0.2); }
.status-error   { background: var(--red); }
.status-pending { background: var(--orange); }

.status-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.wz-connected-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wz-phone {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.wz-connected-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-verify, .btn-disconnect {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: white;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}

.btn-verify {
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

.btn-verify:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-verify:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-disconnect {
    border: 1.5px solid var(--red-light);
    color: var(--red);
}

.btn-disconnect:hover {
    background: var(--red-light);
    border-color: var(--red);
}

/* Details grid */
.wz-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.wz-detail-item {
    padding: 14px 20px;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: background var(--transition);
}

.wz-detail-item:hover { background: var(--bg-hover); }
.wz-detail-item:nth-child(3n) { border-right: none; }
.wz-detail-item:nth-last-child(-n+3) { border-bottom: none; }

.detail-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-value.mono { font-family: var(--mono); font-size: 12px; }

.quality-badge { font-size: 13px; font-weight: 600; }
.quality-green  { color: #0369A1; }
.quality-yellow { color: #92400E; }
.quality-red    { color: #991B1B; }
.quality-unknown { color: var(--text-muted); }

/* Webhook box */
.wz-webhook-box {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.wz-webhook-box h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.webhook-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.webhook-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.webhook-value {
    font-family: var(--mono);
    font-size: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    word-break: break-all;
}

.btn-copy {
    padding: 5px 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font);
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-copy:hover { border-color: var(--accent); color: var(--accent); }

.webhook-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ===================================================
   Form Card
   =================================================== */

.wz-form-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.wz-form-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
}

.wz-form-header svg { stroke: var(--accent); }

.wz-form-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.wz-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.required { color: var(--red); }
.optional { font-weight: 400; color: var(--text-muted); font-size: 12px; }

.form-input {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-elevated);
    transition: all var(--transition);
    outline: none;
    width: 100%;
}

.form-input:hover { border-color: #D1D5DB; }

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.08);
}

.form-input::placeholder { color: var(--text-muted); }

.input-password-wrap {
    position: relative;
    display: flex;
}

.input-password-wrap .form-input { padding-right: 42px; }

.btn-toggle-pass {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

.btn-toggle-pass:hover { color: var(--text-secondary); }

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.form-hint a {
    color: var(--accent);
    font-weight: 500;
}

.form-hint a:hover { text-decoration: underline; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.btn-connect {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 1px 3px rgba(14, 165, 233, 0.3);
}

.btn-connect:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(14, 165, 233, 0.25);
}

.btn-connect:active { transform: none; }

/* ===================================================
   Info Boxes
   =================================================== */

.wz-info-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.wz-info-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all var(--transition);
}

.wz-info-box:hover {
    border-color: #D1D5DB;
    box-shadow: var(--shadow-sm);
}

.info-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-blue   { background: var(--blue-light); }
.info-blue svg { stroke: var(--blue); }
.info-green  { background: var(--green-light); }
.info-green svg { stroke: var(--accent); }
.info-orange { background: var(--orange-light); }
.info-orange svg { stroke: var(--orange); }

.wz-info-box strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 3px;
}

.wz-info-box p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===================================================
   Modal
   =================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: modal-in 0.2s var(--ease);
}

@keyframes modal-in {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-icon-warning { background: var(--orange-light); }
.modal-icon-warning svg { stroke: var(--orange); }

.modal-box h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-box p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-modal-cancel, .btn-modal-confirm {
    padding: 9px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-modal-cancel {
    background: white;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

.btn-modal-cancel:hover { border-color: #D1D5DB; color: var(--text-primary); }

.btn-modal-confirm {
    background: var(--red);
    border: none;
    color: white;
    font-weight: 600;
}

.btn-modal-confirm:hover { background: #DC2626; }

/* ===================================================
   Animations
   =================================================== */

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ===================================================
   Responsive
   =================================================== */

@media (max-width: 768px) {
    .content-area { padding: 20px 16px; }
    .wz-details-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .wz-info-boxes { grid-template-columns: 1fr; }
    .wz-connected-actions { width: 100%; }
    .topbar-left h2 { display: none; }
}

/* ===================================================
   Scrollbar
   =================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ===================================================
   Kanban
   =================================================== */

.kanban-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 16px;
}

.kanban-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--orange-light);
    border-radius: var(--radius);
    font-size: 13px;
    color: #92400E;
    flex-shrink: 0;
}

.kanban-alert a {
    color: #92400E;
    font-weight: 600;
    text-decoration: underline;
    margin-left: auto;
    white-space: nowrap;
}

.kanban-board {
    display: flex;
    gap: 16px;
    flex: 1;
    overflow-x: auto;
    padding-bottom: 8px;
}

.kanban-column {
    min-width: 280px;
    width: 280px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.kanban-column-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.column-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-column-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.column-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 2px 7px;
    border-radius: 10px;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100px;
    transition: background 0.2s;
}

.kanban-cards.drag-over {
    background: var(--accent-bg);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Card */
.kanban-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: grab;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.kanban-card:hover {
    border-color: #D1D5DB;
    box-shadow: var(--shadow-sm);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9, #38BDF8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-phone {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.card-badge {
    background: var(--green);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.card-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.card-preview svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.card-preview span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.card-tag {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--blue-light);
    color: #1E40AF;
}

.card-time {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

/* ===================================================
   Chat Modal
   =================================================== */

.chat-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    z-index: 100;
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    animation: slide-in 0.25s var(--ease);
}

@keyframes slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9, #38BDF8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.chat-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-phone {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.chat-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #F9FAFB;
}

.chat-loading {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 40px 0;
}

.msg-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.msg-in {
    align-self: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.msg-out {
    align-self: flex-end;
    background: #E0F2FE;
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: right;
}

.msg-status {
    display: inline-block;
    margin-left: 4px;
}

.msg-status-read { color: var(--blue); }

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition);
}

#chat-input:focus {
    border-color: var(--accent);
}

#chat-send {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}

#chat-send:hover { background: var(--accent-hover); }

/* ===================================================
   Settings Layout
   =================================================== */

.has-settings-layout > .content-area {
    padding: 0;
    overflow: hidden;
}

.settings-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.settings-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    overflow-y: auto;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    position: relative;
}

.settings-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.settings-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
}

.settings-status-active {
    background: var(--green);
    box-shadow: 0 0 0 2px var(--green-light);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.settings-welcome h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.settings-welcome p {
    font-size: 14px;
}

.settings-page {
    max-width: 800px;
}

.settings-page-header {
    margin-bottom: 24px;
}

.settings-page-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.settings-page-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.settings-page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition);
    font-family: var(--font);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
    font-family: var(--font);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Backup (configurações) */
.settings-backup-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 960px;
}
@media (min-width: 960px) {
    .settings-backup-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}
.settings-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
}
.settings-backup-card h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.settings-backup-desc,
.settings-backup-hint,
.settings-backup-warning {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 10px 0;
}
.settings-backup-desc code {
    font-size: 12px;
    padding: 1px 5px;
    background: var(--bg-hover);
    border-radius: 4px;
}
.settings-backup-hint {
    font-size: 12px;
    color: var(--text-muted);
}
.settings-backup-warning {
    color: var(--warning, #b45309);
}
.settings-backup-warning strong {
    color: var(--text-primary);
}
.settings-backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}
.settings-backup-actions a.btn-primary,
.settings-backup-actions a.btn-secondary {
    text-decoration: none;
}
.settings-backup-import-form {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
}
.settings-backup-file-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    width: 100%;
}
.settings-backup-file-label input[type="file"] {
    font-size: 12px;
    width: 100%;
    max-width: 100%;
}
.settings-backup-checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    cursor: pointer;
}
.settings-backup-checkbox input {
    margin-top: 3px;
    flex-shrink: 0;
}

/* Labels list */

.labels-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.label-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: all var(--transition);
    cursor: default;
}

.label-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}

.label-item.dragging {
    opacity: 0.4;
    border-color: var(--accent);
}

.label-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.label-drag-handle:active { cursor: grabbing; }

.label-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}

.label-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.label-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.label-badge-synced {
    background: var(--accent-bg);
    color: var(--accent);
}

.label-item-hidden {
    opacity: 0.5;
}

.label-item-hidden .label-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.label-visibility-toggle {
    flex-shrink: 0;
}

.btn-toggle-visibility {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: all var(--transition);
}

.btn-toggle-visibility:hover {
    background: var(--bg-hover);
}

.btn-toggle-visibility .icon-hidden { display: none; }
.btn-toggle-visibility .icon-visible { display: block; }

.btn-toggle-visibility.is-hidden .icon-hidden { display: block; }
.btn-toggle-visibility.is-hidden .icon-visible { display: none; }
.btn-toggle-visibility.is-hidden {
    color: var(--text-muted);
}

.label-default-new-toggle {
    flex-shrink: 0;
}

.btn-toggle-default-new {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: none;
    background: var(--bg-hover);
    color: var(--text-muted);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-toggle-default-new:hover {
    background: var(--border-light);
    color: var(--text-secondary);
}

.btn-toggle-default-new.is-active {
    background: #fef3c7;
    color: #d97706;
}

.btn-toggle-default-new.is-active:hover {
    background: #fde68a;
}

.btn-toggle-default-new svg {
    width: 14px;
    height: 14px;
}

.btn-toggle-default-new.is-active svg {
    fill: #d97706;
}

.label-allow-delete-toggle {
    flex-shrink: 0;
}

.btn-toggle-allow-delete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: none;
    background: var(--accent-bg);
    color: var(--accent);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-toggle-allow-delete:hover {
    background: var(--accent-light);
}

.btn-toggle-allow-delete.is-disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.btn-toggle-allow-delete.is-disabled:hover {
    background: var(--border-light);
}

.btn-toggle-allow-delete svg {
    width: 14px;
    height: 14px;
}

.label-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.label-item:hover .label-actions { opacity: 1; }

.btn-icon {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon-danger:hover {
    background: var(--red-light);
    color: var(--red);
}

.labels-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.labels-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    margin-top: 8px;
}

.labels-empty h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 12px 0 4px;
}

.labels-empty p {
    font-size: 13px;
    margin-bottom: 16px;
    max-width: 360px;
}

.labels-info-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--blue-light);
    border-radius: var(--radius);
    font-size: 12px;
    color: #1E40AF;
    margin-top: 20px;
    line-height: 1.5;
}

.labels-info-box svg { flex-shrink: 0; margin-top: 1px; }

/* Color picker */

.color-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-option {
    cursor: pointer;
}

.color-option input[type=radio] {
    display: none;
}

.color-swatch {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transition: all var(--transition);
    box-shadow: 0 0 0 2px transparent;
}

.color-option input[type=radio]:checked + .color-swatch {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text-primary);
    transform: scale(1.1);
}

.color-swatch:hover {
    transform: scale(1.1);
}

/* ===================================================
   Kanban Board
   =================================================== */

.kanban-board {
    display: flex;
    gap: 10px;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px;
    align-items: stretch;
}

.kanban-column {
    flex: 1 1 0;
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    transition: box-shadow var(--transition), opacity var(--transition);
}

.kanban-column.column-dragging {
    opacity: 0.5;
    box-shadow: var(--shadow-lg);
}

.kanban-column-header {
    padding: 12px 14px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: grab;
}

.kanban-column-header:active { cursor: grabbing; }

.kanban-column[draggable="false"] .kanban-column-header {
    cursor: default;
    border-top: 3px solid #9CA3AF;
}

.kanban-column-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    min-width: 0;
}

.kanban-column-title > span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-column-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.kanban-column-drag-hint {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition);
}

.kanban-column:hover .kanban-column-drag-hint { opacity: 0.6; }

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 4px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 40px;
}

.kanban-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 12px;
    cursor: grab;
    transition: all var(--transition);
    position: relative;
}

.kanban-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card.has-unread {
    border-color: #22c55e;
    background: #f0fdf4;
    box-shadow: 0 0 0 1px #22c55e33;
}
html.theme-dark .kanban-card.has-unread {
    border-color: #22c55e;
    background: #052e16;
    box-shadow: 0 0 0 1px #22c55e44;
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: rotate(2deg);
    box-shadow: var(--shadow-md);
}

.kanban-card-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--transition), color var(--transition);
    z-index: 1;
}

.kanban-card-delete:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.kanban-card-demo {
    cursor: default;
    border: 1px dashed var(--border);
}

.kanban-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.kanban-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9, #38BDF8);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kanban-card-avatar-img {
    object-fit: cover;
    background: #e2e8f0;
}

.kanban-card-info {
    flex: 1;
    min-width: 0;
}

.kanban-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-phone {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono);
    margin-top: 1px;
}

.kanban-card-msg {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
    padding: 3px 6px;
    background: var(--bg-hover);
    border-radius: 4px;
    height: 22px;
    box-sizing: border-box;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.kanban-card-timeago {
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    padding: 1px 6px;
}

.kanban-card-timeago.timeago-in {
    color: #DC2626;
}

.kanban-card-timeago.timeago-out {
    color: #0EA5E9;
}

.kanban-card-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.kanban-card-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.kanban-card-top-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

.kanban-card-scheduled {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--accent-bg);
    color: var(--accent);
}

.kanban-card-scheduled svg {
    width: 14px;
    height: 14px;
}

.kanban-card-unread {
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
}

.kanban-card-placeholder {
    height: 50px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-hover);
}

.kanban-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    padding: 48px 24px;
}

.kanban-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 0 6px;
}

.kanban-empty p {
    font-size: 13px;
    margin-bottom: 20px;
    max-width: 360px;
}

.kanban-empty .btn-primary {
    text-decoration: none;
}

.contatos-page {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tarefas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    padding: 48px 24px;
}

.tarefas-empty svg {
    color: var(--text-muted);
}

.tarefas-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 0 6px;
}

.tarefas-empty p {
    font-size: 13px;
    margin: 0;
}

/* ========== Modal de Contato ========== */

.contact-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.contact-modal {
    background: var(--bg-elevated);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    width: 80vw;
    max-width: 1400px;
    height: 90vh;
    max-height: 860px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.contact-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.contact-modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.contact-modal-avatar-wrap {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
}

.contact-modal-avatar-wrap.has-photo {
    cursor: zoom-in;
}

.contact-modal-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9, #38BDF8);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-modal-avatar-img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
    flex-shrink: 0;
    flex-shrink: 0;
}

.contact-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.contact-modal-phone {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--mono);
}

.cm-merge-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-hover);
    border-radius: 50%;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.cm-merge-btn:hover {
    background: var(--accent-light, #dbeafe);
    color: var(--accent);
}

.contact-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-hover);
    border-radius: 50%;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.contact-modal-close:hover {
    background: var(--red-light);
    color: var(--red);
}

/* Lightbox foto do contato (modal) */
.cm-avatar-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 24px;
    box-sizing: border-box;
}

.cm-avatar-lightbox-img {
    max-width: min(90vw, 560px);
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}

.cm-avatar-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.15s ease;
}

.cm-avatar-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.contact-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.cm-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.cm-panel:last-child {
    border-right: none;
}

.cm-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 14px 16px 0;
    margin: 0;
}

.cm-panel-hint {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 16px 0;
    margin: 0;
    line-height: 1.4;
}

.cm-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.cm-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.cm-panel-input {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.cm-variables-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
}

.cm-var-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    font-size: 11px;
    font-family: var(--font);
    color: var(--accent);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.cm-var-btn:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
}

.cm-toolbar {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.cm-toolbar-buttons-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.cm-emoji-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.cm-toolbar-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.cm-toolbar-btn:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.cm-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.cm-attach-preview {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    max-width: 140px;
    max-height: 80px;
    overflow-y: auto;
    overflow-x: hidden;
}

.cm-attach-preview::-webkit-scrollbar {
    width: 4px;
}

.cm-attach-preview::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.cm-attach-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-qm-att-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 2px 6px;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.cm-qm-att-tag .cm-qm-att-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-qm-att-rm {
    flex-shrink: 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

.cm-qm-att-rm:hover {
    color: var(--danger, #c0392b);
}

.cm-attach-remove {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.cm-attach-remove:hover {
    color: var(--danger, #c0392b);
    background: var(--bg-hover);
}

.cm-input-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}

.cm-qm-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
    min-width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 10;
    display: none;
}

.cm-qm-dropdown.open {
    display: block;
}

.cm-qm-dropdown-item {
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
    line-height: 1.4;
}

.cm-qm-dropdown-item:last-child {
    border-bottom: none;
}

.cm-qm-dropdown-item:hover {
    background: var(--bg-hover);
}

.cm-qm-dropdown-item strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.cm-textarea {
    width: 100%;
    min-height: 54px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-primary);
    resize: none;
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.cm-textarea:focus {
    border-color: var(--accent);
}

.cm-btn-audio {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-primary);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s;
}
.cm-btn-audio:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}
.cm-btn-audio.recording {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    animation: cm-pulse 1s infinite;
}
.cm-rec-time {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font);
}
@keyframes cm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.cm-btn-send {
    padding: 4px 10px;
    font-size: 11px;
    flex-shrink: 0;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cm-toolbar .cm-btn-send {
    align-self: stretch;
    height: auto;
}

/* Mensagens */
.cm-msg {
    margin-bottom: 8px;
    max-width: 85%;
}

.cm-msg-in {
    margin-right: auto;
}

.cm-msg-out {
    margin-left: auto;
}

.cm-msg-body {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.cm-msg-in .cm-msg-body {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

.cm-msg-out .cm-msg-body {
    background: #E0F2FE;
    color: #0369A1;
    border-bottom-right-radius: 2px;
}

.cm-msg-time {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    padding: 0 4px;
}

.cm-msg-out .cm-msg-time {
    text-align: right;
}

.cm-msg-status {
    margin-left: 4px;
    font-size: 11px;
    letter-spacing: -1px;
}

.cm-status-pending {
    color: var(--text-muted);
    font-size: 9px;
    letter-spacing: 0;
}

.cm-status-sent {
    color: var(--text-muted);
}

.cm-status-delivered {
    color: var(--text-muted);
}

.cm-status-read {
    color: #3B82F6;
}

.cm-status-failed {
    color: #EF4444;
}

/* Mídia: imagem, vídeo, documento */
.cm-msg-media {
    margin-bottom: 4px;
    border-radius: 10px;
    overflow: hidden;
}

.cm-msg-img {
    max-width: 100%;
    max-height: 280px;
    display: block;
    border-radius: 8px;
}

.cm-msg-media .cm-msg-caption {
    margin-top: 6px;
    padding: 6px 0 0 !important;
    border-radius: 0 !important;
}

.cm-msg-video {
    max-width: 100%;
    max-height: 280px;
    display: block;
    border-radius: 8px;
    background: #000;
}

.cm-msg-doc {
    margin-bottom: 4px;
}

.cm-msg-doc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-hover);
    border-radius: 8px;
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.cm-msg-doc-link:hover {
    text-decoration: underline;
}

/* Player de áudio: barra de ponta a ponta + velocidades */
.cm-msg-audio-wrap {
    width: 100%;
    min-width: 200px;
    margin-bottom: 4px;
}

.cm-audio-bar-row {
    position: relative;
    width: 100%;
    height: 24px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
    padding: 0 2px;
}

.cm-audio-range {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 6px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

.cm-audio-range::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
}

.cm-audio-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    margin-top: -4px;
}

.cm-audio-range::-moz-range-track {
    height: 6px;
    background: transparent;
}

.cm-audio-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.cm-audio-bar-fill {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    border-radius: 3px;
    background: var(--accent);
    opacity: 0.35;
    pointer-events: none;
    width: 0%;
}

.cm-audio-ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cm-audio-play {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.cm-audio-play:hover {
    filter: brightness(1.1);
}

.cm-audio-time {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 80px;
}

.cm-audio-speed-toggle {
    margin-left: auto;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    min-width: 36px;
    text-align: center;
    transition: background .15s;
}
.cm-audio-speed-toggle:hover {
    background: var(--accent-dark, #1d4ed8);
}

.cm-empty {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 24px 0;
}

/* Notas */
.cm-note-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.cm-note-body {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.45;
}

.cm-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.cm-note-time {
    font-size: 10px;
    color: var(--text-muted);
}

.cm-note-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.cm-note-delete:hover {
    color: var(--red);
}

/* Agendadas */
.cm-sched-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.cm-sched-body {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.45;
}

.cm-sched-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.cm-sched-time {
    font-size: 11px;
    color: var(--accent);
    font-weight: 500;
}

.cm-schedule-row {
    display: flex;
    gap: 8px;
}

.cm-schedule-dt {
    font-size: 13px;
    padding: 8px 10px;
}

.cm-emoji-picker {
    display: none;
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 6px;
    width: 320px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    z-index: 20;
    overflow: hidden;
}

.cm-emoji-picker.open {
    display: block;
}

.cm-emoji-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    padding: 4px 4px 0;
    gap: 2px;
}

.cm-emoji-tab {
    border: none;
    background: none;
    font-size: 18px;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
}

.cm-emoji-tab:hover {
    background: var(--bg-hover);
}

.cm-emoji-tab.active {
    background: var(--accent-bg);
}

.cm-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 36px);
    gap: 2px;
    padding: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.cm-emoji-picker .cm-emoji-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm-emoji-picker .cm-emoji-btn:hover {
    background: var(--bg-hover);
}

/* ===================================================
   Quick Messages
   =================================================== */

.qm-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.qm-combo {
    flex: 1;
    position: relative;
}

.qm-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 260px;
    overflow-y: auto;
    z-index: 50;
    margin-top: 4px;
}

.qm-dropdown.open { display: block; }

.qm-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-light);
}

.qm-dropdown-item:last-child { border-bottom: none; }
.qm-dropdown-item:hover { background: var(--bg-hover); }

.qm-dropdown-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.qm-dropdown-preview {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qm-dropdown-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.qm-editor {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.qm-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.qm-editor-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.qm-body-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.qm-variables-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.qm-var-btn {
    font-size: 11px;
    font-family: var(--mono);
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--accent);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}

.qm-var-btn:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
}

.qm-emoji-toggle {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.qm-emoji-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.qm-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: var(--font);
    line-height: 1.6;
}

.qm-body-preview {
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    min-height: 0;
}

.qm-body-preview:empty { display: none; }

.qm-preview-var {
    background: var(--accent-bg);
    color: var(--accent);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
}

.qm-emoji-picker {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    margin-bottom: 6px;
    overflow: hidden;
}

.qm-emoji-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    padding: 4px 4px 0;
    gap: 2px;
}

.qm-emoji-tab {
    border: none;
    background: none;
    font-size: 18px;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: background var(--transition);
}

.qm-emoji-tab:hover { background: var(--bg-hover); }
.qm-emoji-tab.active { background: var(--accent-bg); }

.qm-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 36px);
    gap: 2px;
    padding: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.qm-emoji-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.qm-emoji-btn:hover { background: var(--bg-hover); }

.qm-attachment-area {
    display: flex;
    gap: 8px;
}

.qm-attachment-type-select {
    width: 140px;
    flex-shrink: 0;
}

.qm-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.qm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
}

.qm-empty h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 12px 0 4px;
}

.qm-empty p {
    font-size: 13px;
}

/* ===================================================
   Flow Builder
   =================================================== */

.settings-content:has(.flow-page) {
    padding: 0;
    overflow: hidden;
}

.flow-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.flow-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.flow-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flow-toolbar-name-actions {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.flow-select {
    width: 200px;
    font-size: 13px;
}

.flow-name-input {
    width: 100%;
    max-width: 280px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.btn-danger-outline {
    color: var(--red) !important;
    border-color: var(--red-light) !important;
}

.btn-danger-outline:hover {
    background: var(--red-light) !important;
}

.flow-builder {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.flow-sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 12px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.flow-sidebar-section {
    padding: 0 12px;
    margin-bottom: 16px;
}

.flow-sidebar-section h5 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 4px;
}

.flow-node-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: grab;
    transition: background var(--transition);
    margin-bottom: 2px;
}

.flow-node-btn:hover { background: var(--bg-hover); }
.flow-node-btn:active { cursor: grabbing; }

.flow-node-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flow-node-icon-purple { background: #EDE9FE; color: #7C3AED; }
.flow-node-icon-blue   { background: var(--blue-light); color: var(--blue); }
.flow-node-icon-yellow { background: var(--orange-light); color: #B45309; }
.flow-node-icon-green  { background: var(--green-light); color: var(--accent); }
.flow-node-icon-orange { background: var(--orange-light); color: var(--orange); }
.flow-node-icon-red    { background: var(--red-light); color: var(--red); }

/* Drawflow canvas */

.flow-canvas {
    flex: 1;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
}

/* Override Drawflow default styles */

.drawflow .drawflow-node,
.drawflow .drawflow-node *:not(.df-badge-yellow):not(.df-badge-orange) {
    color: #1f2937;
}

.drawflow .drawflow-node,
.drawflow .drawflow-node .drawflow_content_node {
    background: #f8fafc !important;
}

.drawflow .drawflow-node {
    border: 1.5px solid #e2e8f0 !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-width: 200px;
    padding: 0;
    font-family: var(--font);
}

.drawflow .drawflow-node.selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.25);
}

.drawflow .drawflow-node:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border-color: #cbd5e1 !important;
}

/* Cores claras e leves por tipo de nó */
.drawflow .drawflow-node.trigger,
.drawflow .drawflow-node.trigger .drawflow_content_node {
    background: #f5f3ff !important;
    border-color: #e9e5ff !important;
    border-left: 4px solid #8B5CF6 !important;
}
.drawflow .drawflow-node.trigger:hover { border-color: #7C3AED !important; }

.drawflow .drawflow-node.timer,
.drawflow .drawflow-node.timer .drawflow_content_node {
    background: #eff6ff !important;
    border-color: #dbeafe !important;
    border-left: 4px solid #3B82F6 !important;
}
/* Drawflow usa width: 160px nos nós; o card Tempo precisa de mais espaço */
.drawflow .drawflow-node.timer {
    width: 240px !important;
    min-width: 240px !important;
}
.drawflow .drawflow-node.timer .drawflow_content_node {
    width: 100% !important;
    min-width: 0 !important;
}
.drawflow .drawflow-node.timer:hover { border-color: #2563EB !important; }

.drawflow .drawflow-node.condition,
.drawflow .drawflow-node.condition .drawflow_content_node {
    background: #fefce8 !important;
    border-color: #fef9c3 !important;
    border-left: 4px solid #EAB308 !important;
}
.drawflow .drawflow-node.condition:hover { border-color: #A16207 !important; }

.drawflow .drawflow-node.action_label,
.drawflow .drawflow-node.action_label .drawflow_content_node {
    background: #F0F9FF !important;
    border-color: #dcfce7 !important;
    border-left: 4px solid #38BDF8 !important;
}
.drawflow .drawflow-node.action_label:hover { border-color: #15803D !important; }

.drawflow .drawflow-node.action_message,
.drawflow .drawflow-node.action_message .drawflow_content_node {
    background: #fff7ed !important;
    border-color: #ffedd5 !important;
    border-left: 4px solid #F97316 !important;
}
.drawflow .drawflow-node.action_message:hover { border-color: #C2410C !important; }

.drawflow .drawflow-node.action_reminder,
.drawflow .drawflow-node.action_reminder .drawflow_content_node {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    border-left: 4px solid #EF4444 !important;
}
.drawflow .drawflow-node.action_reminder:hover { border-color: #B91C1C !important; }

.drawflow .drawflow-node .inputs,
.drawflow .drawflow-node .outputs {
    pointer-events: auto;
}

.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
    width: 14px;
    height: 14px;
    border: 2px solid #94a3b8;
    background: #f1f5f9;
    border-radius: 50%;
}

.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.drawflow .connection .main-path {
    stroke: #64748B;
    stroke-width: 2;
}

.drawflow .connection .main-path:hover {
    stroke: var(--accent);
    stroke-width: 3;
}

.drawflow .drawflow-delete {
    background: var(--red);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    font-size: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Node content */

.df-node-content {
    padding: 12px 14px;
    background: transparent !important;
}

.df-node-header {
    margin-bottom: 10px;
}

.df-node-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    display: inline-block;
}

.df-badge-purple,
.df-badge-blue,
.df-badge-yellow,
.df-badge-green,
.df-badge-orange,
.df-badge-red {
    background: #e2e8f0;
    color: #475569;
}

.df-node-content label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b !important;
    margin-bottom: 4px;
}

.drawflow .drawflow-node .df-select,
.drawflow .drawflow-node .df-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #D1D5DB !important;
    border-radius: 6px;
    font-size: 12px;
    font-family: var(--font);
    color: #1E293B !important;
    background: #fff !important;
    outline: none;
    transition: border-color var(--transition);
}

.drawflow .drawflow-node .df-select option {
    background: #fff;
    color: #1E293B;
}

.drawflow .drawflow-node .df-select:focus,
.drawflow .drawflow-node .df-input:focus {
    border-color: var(--accent) !important;
}

.df-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.df-input-sm { width: 56px; min-width: 48px; }
.df-select-sm { flex: 1; min-width: 0; }

/* Card Tempo: número menor, combobox maior para exibir Minutos/Horas/Dias */
.drawflow .drawflow-node.timer .df-input-sm {
    width: 44px;
    min-width: 40px;
}
.drawflow .drawflow-node.timer .df-select-sm {
    flex: none;
    width: 100px;
    min-width: 100px;
}
.drawflow .drawflow-node.timer .df-row {
    flex-wrap: nowrap;
}

/* Condition node outputs - label Sim/Não */

.drawflow-node.condition .outputs .output:first-child::after {
    content: 'Sim';
    position: absolute;
    font-size: 9px;
    font-weight: 700;
    color: #7DD3FC;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.drawflow-node.condition .outputs .output:last-child::after {
    content: 'Não';
    position: absolute;
    font-size: 9px;
    font-weight: 700;
    color: #F87171;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

/* ========== Custom Popup ========== */

.crm-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.crm-popup-overlay.visible {
    opacity: 1;
}

.crm-popup {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    min-width: 340px;
    max-width: 440px;
    width: 90vw;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.crm-popup-overlay.visible .crm-popup {
    transform: scale(1) translateY(0);
}

.crm-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px 0;
}

.crm-popup-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crm-popup-icon.info {
    background: #EFF6FF;
    color: #3B82F6;
}

.crm-popup-icon.warning {
    background: #FEF3C7;
    color: #F59E0B;
}

.crm-popup-icon.danger {
    background: #FEF2F2;
    color: #EF4444;
}

.crm-popup-icon.input {
    background: #F0F9FF;
    color: #0EA5E9;
}

.crm-popup-icon svg {
    width: 20px;
    height: 20px;
}

.crm-popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
    margin: 0;
}

.crm-popup-body {
    padding: 14px 24px 8px;
}

.crm-popup-message {
    font-size: 14px;
    color: #64748B;
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
}

.crm-popup-input {
    width: 100%;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font);
    color: #1E293B;
    background: #F8FAFC;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.crm-popup-input:focus {
    border-color: var(--accent, #1877F2);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
    background: #fff;
}

.crm-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 20px;
}

.crm-popup-btn {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.crm-popup-btn-cancel {
    background: #F1F5F9;
    color: #64748B;
}

.crm-popup-btn-cancel:hover {
    background: #E2E8F0;
    color: #475569;
}

.crm-popup-btn-ok {
    background: var(--accent, #1877F2);
    color: #fff;
}

.crm-popup-btn-ok:hover {
    filter: brightness(1.1);
}

.crm-popup-btn-danger {
    background: #EF4444;
    color: #fff;
}

.crm-popup-btn-danger:hover {
    background: #DC2626;
}

/* ========== Notificação de Anotação Agendada ========== */

.note-notify-overlay {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.note-notify {
    pointer-events: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05);
    width: 360px;
    max-width: 90vw;
    animation: noteSlideIn .35s cubic-bezier(.22,.68,0,1.1);
    overflow: hidden;
}

@keyframes noteSlideIn {
    from { opacity: 0; transform: translateX(80px); }
    to   { opacity: 1; transform: translateX(0); }
}

.note-notify-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 0;
}

.note-notify-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: #FEF3C7;
    color: #F59E0B;
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-notify-icon svg {
    width: 18px;
    height: 18px;
}

.note-notify-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.note-notify-contact {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

.note-notify-body {
    padding: 10px 16px;
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
}

.note-notify-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 16px 12px;
}

.note-notify-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.note-notify-btn-dismiss {
    background: #f1f5f9;
    color: #64748b;
}

.note-notify-btn-dismiss:hover {
    background: #e2e8f0;
}

.note-notify-btn-open {
    background: var(--accent, #1877F2);
    color: #fff;
}

.note-notify-btn-open:hover {
    filter: brightness(1.1);
}

/* ========== Regras de Disparo ========== */

.dispatch-form {
    max-width: 640px;
}

.dispatch-section {
    margin-bottom: 28px;
}

.dispatch-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.dispatch-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dispatch-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 6px 0 0;
    line-height: 1.4;
}

.dispatch-input-full {
    max-width: 160px;
}

.dispatch-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.dispatch-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent, #0EA5E9);
    cursor: pointer;
    flex-shrink: 0;
}

.dispatch-checkbox-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.dispatch-days {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dispatch-day-btn {
    width: 48px;
    height: 40px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dispatch-day-btn:hover {
    border-color: var(--accent, #0EA5E9);
    color: var(--accent, #0EA5E9);
}

.dispatch-day-btn.active {
    background: var(--accent, #0EA5E9);
    border-color: var(--accent, #0EA5E9);
    color: #fff;
}

.dispatch-time-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.dispatch-time-group {
    flex: 0 0 auto;
}

.dispatch-time-input-wrap {
    position: relative;
}

.dispatch-time-input {
    width: 130px;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 12px;
    text-align: center;
}

.dispatch-time-separator {
    font-size: 13px;
    color: var(--text-tertiary);
    padding-bottom: 12px;
}

.dispatch-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ========== Tarefas ========== */

.tarefas-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tarefas-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
    text-align: center;
}


.tarefas-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
}

.tarefas-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.tarefas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    text-align: center;
}

.tarefas-empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.tarefas-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.tarefas-empty p {
    font-size: 14px;
    margin: 0;
    max-width: 400px;
}

/* ---- Tabela de tarefas ---- */

.tarefas-table-wrap {
    overflow: visible;
}

.tarefas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tarefas-table thead th {
    padding: 6px 6px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.tarefas-table tbody tr {
    transition: opacity 0.3s ease, background 0.15s ease;
    border-bottom: 1px solid var(--border-light);
}

.tarefas-table tbody tr:hover {
    background: var(--bg-elevated);
}

.tarefas-table tbody td {
    padding: 8px 6px;
    vertical-align: middle;
}

.tarefa-action-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tarefa-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.tarefa-badge svg {
    flex-shrink: 0;
}

.tarefa-badge-action_message {
    background: #DBEAFE;
    color: #1D4ED8;
}

.tarefa-badge-action_label {
    background: #FEF3C7;
    color: #B45309;
}

.tarefa-badge-action_reminder {
    background: #E0E7FF;
    color: #4338CA;
}

.tarefa-contact-cell {
    color: var(--text-primary);
}

.tarefa-contact-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tarefa-contact-name {
    font-weight: 600;
    white-space: nowrap;
}

.tarefa-phone {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    font-family: var(--mono);
}

.tarefa-desc-cell {
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
}

.tarefa-flow-cell {
    color: var(--text-muted);
    white-space: nowrap;
}

.tarefa-time-cell {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.tarefa-actions-cell {
    white-space: nowrap;
    text-align: right;
}

.btn-tarefa-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 2px;
}

.btn-tarefa-icon.btn-tarefa-approve {
    color: #10B981;
}

.btn-tarefa-icon.btn-tarefa-approve:hover {
    background: #10B981;
    color: #fff;
    border-color: #10B981;
}

.btn-tarefa-icon.btn-tarefa-reject {
    color: var(--text-muted);
}

.btn-tarefa-icon.btn-tarefa-reject:hover {
    background: #FEE2E2;
    color: #DC2626;
    border-color: #FECACA;
}
