/* ZAP OBSIDIAN — tema monocromático (preto / cinza / branco) */

:root, .theme-dark {
    --bg-primary: #0A0A0B;
    --bg-secondary: #0D0D0F;
    --bg-card: #141416;
    --bg-inner: #0F0E12;
    --bg-input: #0F0E12;
    --bg-tile: #1C1A24;
    --border-color: #222226;
    --border-soft: #1F1F23;
    --text-primary: #F4F4F5;
    --text-secondary: #A1A1AA;
    --text-muted: #8A8A93;
    --shadow: none;
    --hover-bg: rgba(255, 255, 255, 0.05);
    --nav-hover: #18181B;
    --bubble-human: #27272A;
    --accent: #7C3AED;
    --accent-hover: #6D28D9;
    --accent-soft: #1C1A24;
    --accent-text: #A78BFA;
    --accent-text-strong: #C4B5FD;
    --success: #4ADE80;
    --warning: #FACC15;
    --danger: #F87171;
    --pede-acao-bg: #1A1708;
    --pede-acao-borda: #4A3F0F;
    --brand: #7C3AED;
    --brand-light: #A78BFA;
    --brand-dark: #6D28D9;
    --glow: 0 0 0 1px #3a3a3a;
    --green: #22c55e;
    --green-text: #4ADE80;
    --blue: #3b82f6;
    --yellow: #eab308;
    --red: #ef4444;
    --radius-card: 16px;
    --radius-item: 10px;
    color-scheme: dark;
}

.theme-light {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-inner: #f5f5f5;
    --bg-input: #f5f5f5;
    --bg-tile: #f0f0f0;
    --border-color: #e5e5e5;
    --border-soft: #ededed;
    --text-primary: #0a0a0a;
    --text-secondary: #525252;
    --text-muted: #6B6B73;
    --hover-bg: rgba(0, 0, 0, 0.04);
    --nav-hover: rgba(0, 0, 0, 0.05);
    --bubble-human: #E7E7E7;
    --accent: #7C3AED;
    --accent-hover: #6D28D9;
    --accent-soft: #EDE9FE;
    --accent-text: #6D28D9;
    --accent-text-strong: #5B21B6;
    --success: #15803D;
    --warning: #854D0E;
    --danger: #B91C1C;
    --pede-acao-bg: #FEF9C3;
    --pede-acao-borda: #FDE047;
    --brand: #7C3AED;
    --brand-light: #6D28D9;
    --brand-dark: #5B21B6;
    --glow: 0 0 0 1px #d4d4d4;
    color-scheme: light;
}

* { scrollbar-width: thin; scrollbar-color: #333 transparent; -webkit-tap-highlight-color: transparent; }
/* iOS: elementos clicáveis que não são <button>/<a> precisam de cursor:pointer para receber toque */
[onclick], .sidebar-item, .notification-bell { cursor: pointer; touch-action: manipulation; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }

html { background: var(--bg-primary); }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---------- Ícones (Lucide) ---------- */
i.zi { display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-style: normal; vertical-align: -0.15em; }
i.zi > svg.zi-svg { width: 1.15em; height: 1.15em; flex-shrink: 0; }
.zi-spin { animation: spin 0.9s linear infinite; }

/* ---------- Utilitários de tema ---------- */
.bg-primary { background: var(--bg-inner); }
.bg-secondary { background: var(--bg-secondary); }
.bg-card { background: var(--bg-card); }
.border-theme { border-color: var(--border-color); }
.divide-theme > * + * { border-color: var(--border-soft); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.shadow-theme { box-shadow: var(--shadow); }
.shadow-glow { box-shadow: var(--glow); }
.hover-bg { transition: background 0.15s; }
.hover-bg:hover { background: var(--hover-bg); }
.brand { color: var(--brand); }
.text-brand { color: var(--brand); }
.bg-brand { background: var(--brand); color: #0a0a0a; }
.bg-brand:hover { background: var(--brand-dark); }
.border-brand { border-color: var(--brand) !important; }

/* Cards grandes arredondados como nos prints */
.rounded-xl.bg-card, .bg-card.rounded-2xl, .z-card { border-radius: var(--radius-card) !important; }
.bg-card.border { border-color: var(--border-color); }
.rounded-lg.bg-primary { border-radius: var(--radius-item); }

/* ---------- Sidebar ---------- */
#sidebar { background: var(--bg-secondary) !important; border-color: var(--border-soft) !important; }
.sidebar-item {
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    border-radius: 14px !important;
}
.sidebar-item:hover { background: var(--nav-hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent-soft); color: var(--text-primary); }
.sidebar-item.active .zi { color: var(--accent-text); }
.sidebar-item .icon { width: 20px; text-align: center; }
.sidebar-item .badge-new {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-size: 9px; background: #262626; color: #fafafa;
    padding: 2px 8px; border-radius: 10px; font-weight: 700; letter-spacing: 0.5px;
}
.sidebar-item.active .badge-new { background: var(--accent); color: #fff; }

/* ---------- Cabeçalho ---------- */
.z-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 50;
}
.z-header-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px;
    color: var(--text-secondary); transition: background 0.15s, color 0.15s;
    font-size: 20px;
}
.z-header-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
.z-header-texto { width: auto; min-width: 40px; padding: 0 10px; gap: 6px; font-size: 14px; }
.z-header-texto i.zi { font-size: 20px; }
.z-conta { position: relative; margin-left: 4px; }
.z-avatar {
    width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--hover-bg); border: 1px solid var(--border-color); color: var(--text-primary); font-size: 13px; font-weight: 700;
}
.z-conta .notifications-dropdown { right: 0; width: 240px; }
.z-header-link { color: var(--text-secondary); font-size: 16px; transition: color 0.15s; }
.z-header-link:hover { color: var(--text-primary); }

/* ---------- Toasts e animações ---------- */
.toast { animation: slideInRight 0.3s ease; border-radius: 16px !important; pointer-events: auto; }
/* Avisos não bloqueiam toques no que está por baixo (cabeçalho, menu) */
#toastContainer, #notificationContainer { pointer-events: none; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutRight { to { opacity: 0; transform: translateX(100%); } }
.spinner {
    border: 3px solid #333; border-top: 3px solid #fafafa; border-radius: 50%;
    width: 24px; height: 24px; animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.pulse-dot { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Assistente de campanha ---------- */
.step-dot {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    background: var(--bg-input); color: var(--text-muted);
    border: 1px solid var(--border-color); transition: all 0.2s ease; flex-shrink: 0;
}
.step-dot.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-dot.completed { background: #262626; border-color: #3a3a3a; color: #fafafa; }
.step-dot.completed .zi { color: #fafafa !important; }
.step-line { flex: 1; height: 2px; background: var(--border-color); min-width: 20px; transition: background 0.2s; border-radius: 2px; }
.step-line.completed { background: #525252; }

/* ---------- Campos ---------- */
.input-theme {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 16px;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    font-size: 15px;
}
.input-theme:focus { border-color: var(--accent-text); box-shadow: none; }
.input-theme::placeholder { color: var(--text-muted); }
select.input-theme { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
input[type="checkbox"] { accent-color: #d4d4d4; }

/* ---------- Modais ---------- */
.modal-overlay { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.2s ease; }
.modal-overlay.show { opacity: 1; }
.modal-content { transform: scale(0.97) translateY(12px); transition: all 0.2s ease; opacity: 0; border-radius: 28px !important; background: var(--bg-card) !important; }
.modal-overlay.show .modal-content { transform: scale(1) translateY(0); opacity: 1; }

/* ---------- Login ---------- */
#pixelBg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; background: #000; }
#loginPage { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px 20px; background: #000; }
#loginPage.hidden { display: none; }
#loginPage.hidden + #pixelBg, body.app-open #pixelBg { display: none; }
/* Sem z-index aqui: senão o menu lateral (fixo) fica preso dentro desta camada, abaixo do overlay */
#mainApp { display: none; min-height: 100vh; position: relative; background: var(--bg-primary); }
#mainApp.show { display: flex; }

.glass-card-login {
    position: relative; z-index: 1;
    width: 100%; max-width: 420px;
    padding: 40px 26px 34px;
    background: #131313;
    border: 1px solid #2a2a2a;
    border-radius: 32px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.glass-card-login .brand-icon { font-size: 44px; color: #fafafa; }
.glass-card-login .brand-icon svg { stroke-width: 1.75; }
.glass-card-login h1 { font-size: 24px; font-weight: 700; color: #fafafa; letter-spacing: -0.3px; margin-top: 8px; }
.glass-card-login .subtitle { color: #8a8a8a; font-size: 15px; letter-spacing: 0.3px; margin-top: 6px; }
.glass-card-login .glow-line { width: 64px; height: 2px; margin: 26px auto 0; border-radius: 2px; background: linear-gradient(90deg, transparent, #9a9a9a, #fafafa, #9a9a9a, transparent); }
.glass-card-login label { color: #a3a3a3; font-size: 14px; font-weight: 500; letter-spacing: 0.2px; }
.glass-card-login input[type="email"], .glass-card-login input[type="password"], .glass-card-login input[type="text"] {
    background: #1c1c1c; border: 1px solid #2a2a2a; color: #fafafa;
    padding: 0 18px; height: 56px; border-radius: 20px; width: 100%; font-size: 16px;
    transition: border-color 0.15s, background 0.15s; outline: none;
}
.glass-card-login input:focus { border-color: #4a4a4a; background: #202020; }
.glass-card-login input::placeholder { color: #6b6b6b; }
.glass-card-login .remember { color: #a3a3a3; font-size: 15px; }
.glass-card-login .remember input { width: 18px; height: 18px; accent-color: #c4c4c4; border-radius: 5px; }
.glass-card-login .forgot { color: #a3a3a3; font-size: 15px; }
.glass-card-login .forgot:hover { color: #fafafa; }

.btn-cyber {
    position: relative; width: 100%; height: 52px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #000; color: #fafafa; border: 1px solid #000;
    padding: 12px; border-radius: 18px; cursor: pointer;
    font-weight: 600; font-size: 16px; transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn-cyber:hover { background: #0d0d0d; border-color: #2a2a2a; }
.btn-cyber:active { transform: scale(0.98); }
.btn-cyber:disabled { opacity: 0.6; cursor: wait; }
#mainApp .btn-cyber, .modal-overlay .btn-cyber, .btn-cyber { background: var(--accent); color: #fff; border-color: var(--accent); }
#mainApp .btn-cyber:hover, .modal-overlay .btn-cyber:hover, .btn-cyber:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-cyber-secondary {
    position: relative; width: 100%; height: 48px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #1c1c1c; color: var(--text-primary);
    border: 1px solid var(--border-color); padding: 12px; border-radius: 16px;
    cursor: pointer; font-weight: 600; transition: background 0.15s, border-color 0.15s;
}
.btn-cyber-secondary:hover { background: #222; border-color: #3a3a3a; }

/* ---------- Dashboard (prints) ---------- */
.z-stat {
    border-radius: var(--radius-card); padding: 22px 22px 20px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    min-height: 158px; display: flex; flex-direction: column;
}
.z-stat .z-stat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.z-stat .z-stat-title { color: var(--text-secondary); font-size: 16px; line-height: 1.35; }
.z-stat .z-stat-value { font-size: 34px; font-weight: 700; color: var(--text-primary); margin-top: 14px; line-height: 1.1; letter-spacing: -0.5px; }
.z-stat .z-stat-sub { color: var(--text-muted); font-size: 15px; margin-top: 10px; }
.z-stat.is-light { background: #ffffff; border-color: #ffffff; }
.z-stat.is-light .z-stat-title { color: #525252; }
.z-stat.is-light .z-stat-value { color: #0a0a0a; }
.z-stat.is-light .z-stat-sub { color: #6b6b6b; }
.z-stat.is-light .z-stat-icon { color: #0a0a0a; font-size: 22px; }

.z-tile { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 20px; }
.z-tile.neutral { background: var(--accent-soft); color: var(--accent-text); }
.z-tile.soft { background: var(--accent-soft); color: var(--accent-text); }
.z-tile.blue { background: rgba(59, 130, 246, 0.16); color: #3b82f6; }
.z-tile.green { background: rgba(34, 197, 94, 0.18); color: #22c55e; }
.z-tile.yellow { background: rgba(234, 179, 8, 0.2); color: #eab308; }
.z-tile.lg { width: 52px; height: 52px; border-radius: 16px; font-size: 22px; }

.z-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-card); padding: 22px; }
.z-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.z-card-title { display: flex; align-items: center; gap: 14px; color: var(--text-secondary); font-size: 16px; min-width: 0; white-space: nowrap; }
.z-card-meta { color: var(--text-muted); font-size: 14px; white-space: nowrap; }

.z-item { background: var(--bg-inner); border-radius: var(--radius-item); padding: 14px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.z-item-title { color: var(--text-primary); font-size: 17px; line-height: 1.45; }
.z-item-sub { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

.z-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; font-size: 15px; font-weight: 500; white-space: nowrap; }
.z-pill.done { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.z-pill.running { background: rgba(234, 179, 8, 0.18); color: #facc15; }
.z-pill.paused { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.z-pill.scheduled { background: rgba(59, 130, 246, 0.16); color: #60a5fa; }
.z-pill.idle { background: #1f1f1f; color: #a3a3a3; }

.z-bars { display: flex; align-items: flex-end; gap: 12px; height: 170px; }
.z-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.z-bar { width: 100%; background: #3b3b3b; border-radius: 8px 8px 3px 3px; min-height: 8px; transition: height 0.4s ease; }
.z-bar-date { color: var(--text-muted); font-size: 14px; margin-top: 10px; }
.z-bar-count { color: var(--text-primary); font-size: 15px; font-weight: 700; }

.z-plan-name { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.32; margin-top: 2px; }
.z-plan-label { color: var(--text-muted); font-size: 13.5px; }

.z-fab {
    position: fixed; right: 16px; bottom: 22px; z-index: 900;
    width: 64px; height: 64px; border-radius: 22px;
    background: #ececec; color: #0a0a0a; border: none;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); cursor: pointer; transition: transform 0.15s, background 0.15s;
}
.z-fab:hover { background: #ffffff; }
.z-fab:active { transform: scale(0.95); }

.z-segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--bg-inner); border: 1px solid var(--border-color); padding: 5px; border-radius: 18px; }
.z-segment button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; border-radius: 13px; font-size: 14px; font-weight: 600; color: var(--text-secondary); transition: background 0.15s, color 0.15s; }
.z-segment button.active { background: var(--accent); color: #fff; }
.z-segment button:not(.active):hover { color: var(--text-primary); background: var(--hover-bg); }

.z-mini-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 12px; background: #1c1c1c; border: 1px solid var(--border-color); color: var(--text-secondary); font-size: 13px; font-weight: 600; transition: background 0.15s, color 0.15s; }
.z-mini-btn:hover { background: #242424; color: var(--text-primary); }
.z-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px; color: var(--text-muted); transition: background 0.15s, color 0.15s; flex-shrink: 0; }
.z-icon-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
.z-icon-btn.danger:hover { color: #f87171; }

/* Pré-visualização no estilo WhatsApp */
.wa-preview { background: #0b141a; border-radius: 22px; padding: 18px 14px; border: 1px solid var(--border-color); }
.wa-bubble { background: #202c33; color: #e9edef; border-radius: 4px 14px 14px 14px; max-width: 290px; overflow: hidden; font-size: 14.5px; line-height: 1.4; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); }
.wa-bubble .wa-media { background: #111b21; display: flex; align-items: center; justify-content: center; min-height: 120px; color: #8696a0; }
.wa-bubble .wa-media img, .wa-bubble .wa-media video { width: 100%; display: block; max-height: 220px; object-fit: cover; }
.wa-bubble .wa-body { padding: 8px 10px 6px; white-space: pre-wrap; word-break: break-word; }
.wa-bubble .wa-footer { padding: 0 10px 8px; color: #8696a0; font-size: 12.5px; }
.wa-bubble .wa-time { float: right; color: #8696a0; font-size: 11px; margin: 6px 0 0 10px; }
.wa-btns { max-width: 290px; margin-top: 2px; display: flex; flex-direction: column; gap: 2px; }
.wa-btn { background: #202c33; color: #53bdeb; text-align: center; padding: 10px; font-size: 14.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 8px; }
.wa-btns .wa-btn:last-child { border-radius: 0 0 14px 14px; }
.wa-btns.attached { margin-top: 0; border-top: 1px solid #2a3942; }
.wa-btns.attached .wa-btn:first-child { border-radius: 0; }

/* ---------- Chat ---------- */
.chat-bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px; margin-bottom: 6px; word-wrap: break-word; }
.chat-bubble.sent { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.chat-bubble.received { background: #1f1f1f; color: var(--text-primary); align-self: flex-start; border-bottom-left-radius: 5px; }
.chat-bubble .time { font-size: 10px; opacity: 0.6; margin-top: 4px; display: block; }
.chat-bubble .badge-ai { font-size: 9px; background: #262626; color: #fafafa; padding: 2px 8px; border-radius: 10px; margin-top: 4px; display: inline-block; }
.quick-reply-btn { transition: all 0.15s; cursor: pointer; background: #1c1c1c; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 6px 14px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.quick-reply-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.chat-tool { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 16px; background: #1c1c1c; border: 1px solid var(--border-color); color: var(--text-secondary); font-size: 18px; flex-shrink: 0; transition: background 0.15s, color 0.15s; }
.chat-tool:hover { color: var(--text-primary); background: #242424; }
.chat-tool.recording { background: #ef4444; border-color: #ef4444; color: #fff; animation: pulse 1.4s infinite; }
.chat-attach-preview { display: flex; align-items: center; gap: 10px; background: var(--bg-inner); border: 1px solid var(--border-color); border-radius: 14px; padding: 8px 10px; margin-top: 10px; font-size: 13px; color: var(--text-secondary); }

.media-preview { max-width: 200px; max-height: 150px; border-radius: 12px; object-fit: cover; }

.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-badge.active { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.status-badge.paused { background: rgba(234, 179, 8, 0.16); color: #facc15; }
.status-badge.completed { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.status-badge.pending { background: #1f1f1f; color: #a3a3a3; }
.status-badge.failed { background: rgba(239, 68, 68, 0.16); color: #f87171; }

.plano-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 12px; font-size: 10px; font-weight: 600; background: #262626; color: #e5e5e5; }

.progress-bar { height: 5px; background: var(--border-color); border-radius: 4px; overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-bar .fill.green { background: #22c55e; }
.progress-bar .fill.yellow { background: #eab308; }
.progress-bar .fill.red { background: #ef4444; }
.progress-bar .fill.purple { background: var(--accent); }

.typing-indicator { display: inline-flex; gap: 4px; padding: 8px 12px; background: #1f1f1f; border-radius: 12px; }
.typing-indicator span { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; animation: typingPulse 1.2s ease-in-out infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.fade-in { animation: fadeInUp 0.3s ease forwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.number-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 16px; font-size: 12px; font-weight: 500; margin: 2px; }
.number-tag.valid { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.2); }
.number-tag.invalid { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }
.number-tag.pending { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.2); }

.instance-card { transition: border-color 0.15s, transform 0.15s; border: 1px solid var(--border-soft); border-radius: var(--radius-item) !important; background: var(--bg-inner) !important; }
.instance-card:hover { border-color: #3a3a3a; }
.instance-card .status-dot, .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: #22c55e; }
.status-dot.offline { background: #ef4444; }
.status-dot.connecting { background: #eab308; animation: pulse 1.5s infinite; }

.latency-bar { height: 4px; border-radius: 3px; background: #2b2b2b; overflow: hidden; margin-top: 6px; }
.latency-bar .fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.latency-bar .fill.low { background: #22c55e; }
.latency-bar .fill.medium { background: #eab308; }
.latency-bar .fill.high { background: #ef4444; }

.notification-bell { position: relative; cursor: pointer; }
.notification-bell .badge {
    position: absolute; top: 2px; right: 0; background: #ef4444; color: #fff;
    font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg-card);
}
.notification-bell .badge.hidden { display: none; }
.notification-bell.pulse { animation: bellPulse 2s ease-in-out infinite; }
@keyframes bellPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.notifications-dropdown {
    position: absolute; top: calc(100% + 8px); right: -60px; width: 320px; max-width: calc(100vw - 24px); max-height: 420px; overflow-y: auto;
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); padding: 6px 0; z-index: 999; display: none;
}
.notifications-dropdown.open { display: block; }
.notifications-dropdown .notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); cursor: pointer; transition: background 0.15s; }
.notifications-dropdown .notif-item:hover { background: var(--hover-bg); }
.notifications-dropdown .notif-item .time { font-size: 11px; color: var(--text-muted); }

/* Cores de destaque herdadas do tema roxo -> neutro */
.text-\[\#7c3aed\] { color: #fafafa !important; }

@media (max-width: 768px) {
    .sidebar-mobile { position: fixed; top: 0; left: -290px; height: 100%; height: 100dvh; min-height: 0 !important; width: 280px; transition: left 0.25s ease; z-index: 1000; background: var(--bg-secondary); border-right: 1px solid var(--border-color); overflow: hidden; }
    .sidebar-mobile nav { min-height: 0; overflow-y: auto; }
    .sidebar-mobile > div:last-child { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
    .sidebar-mobile.open { left: 0; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 999; }
    .sidebar-overlay.open { display: block; }
    /* embaixo, acima da barra do navegador: não cobre o título da página */
    #toastContainer { top: auto !important; bottom: calc(16px + env(safe-area-inset-bottom)) !important; }
    .sidebar-item { min-height: 46px; }
    #sidebar nav { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
    .z-main-pad { padding: 20px 16px 110px !important; }
}
/* Usuários em cartões no celular */
@media (max-width: 640px) {
    .z-users-table thead { display: none; }
    .z-users-table, .z-users-table tbody, .z-users-table tr, .z-users-table td { display: block; width: 100%; }
    .z-users-table tr { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
    .z-users-table td { padding: 4px 0 !important; text-align: left !important; display: flex; align-items: center; justify-content: space-between; gap: 12px; white-space: normal !important; }
    .z-users-table td[data-label]:not([data-label=""])::before { content: attr(data-label); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; flex-shrink: 0; }
    .z-users-table td[data-label=""] { justify-content: flex-end; padding-top: 8px !important; }
}
@media (max-width: 400px) {
    .z-card-title { font-size: 15px; gap: 12px; }
    .z-card-meta { font-size: 13px; }
    .z-card-title .z-tile { width: 40px; height: 40px; }
}
@media (max-width: 380px) {
    .z-stat { padding: 18px 16px; }
    .z-stat .z-stat-value { font-size: 30px; }
    .z-stat .z-stat-title { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* Secundário: borda e fundo transparente */
.btn-cyber-secondary, #mainApp .btn-cyber-secondary { background: transparent; border-color: var(--border-color); color: var(--text-primary); }
.btn-cyber-secondary:hover { background: var(--nav-hover); border-color: var(--border-color); }
.zp-btn { background: transparent !important; border-color: var(--border-color) !important; }
.zp-btn:hover { background: var(--nav-hover) !important; }
.zp-btn.primary { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }
.zp-btn.danger { color: var(--danger) !important; }

/* Nenhum texto mais escuro que o --text-muted no tema escuro */
html:not(.theme-light) .text-neutral-500, html:not(.theme-light) .text-neutral-600, html:not(.theme-light) .text-neutral-700 { color: var(--text-muted) !important; }

/* Card de número só ganha cor quando pede ação */
.z-stat.pede-acao { background: var(--pede-acao-bg); border-color: var(--pede-acao-borda); }
.z-stat.pede-acao .z-stat-value { color: var(--warning); }
.z-stat-link { color: var(--accent-text); font-size: 14px; font-weight: 600; }
.z-stat-link:hover { color: var(--accent-text-strong); }
.z-stat.pede-acao .z-stat-link { color: var(--warning); }
.db-assumir { display: flex !important; align-items: center; justify-content: center; text-decoration: none; }
.db-st { font-size: 13px; font-weight: 500; white-space: nowrap; }
.db-st.ok { color: var(--success); } .db-st.warn { color: var(--warning); } .db-st.bad { color: var(--danger); }

/* Primeiros passos */
.z-passos-tit { color: var(--text-primary); font-weight: 600; font-size: 16px; }
.z-passos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.z-passo { display: flex; gap: 10px; padding: 12px; border-radius: 14px; background: var(--bg-inner); border: 1px solid transparent; }
.z-passo.prox { border-color: var(--accent); }
.z-passo-ico { color: var(--text-muted); font-size: 18px; flex-shrink: 0; }
.z-passo.feito .z-passo-ico { color: var(--success); }
.z-passo-tit { color: var(--text-primary); font-size: 14px; font-weight: 600; }
.z-passo.feito .z-passo-tit { color: var(--text-muted); text-decoration: line-through; }
.z-passo-txt { color: var(--text-muted); font-size: 13px; margin: 2px 0 4px; }

/* Tela vazia */
.z-vazio { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 20px; margin: 4px; border: 1.5px dashed var(--border-color); border-radius: 20px; }
.z-vazio-ico { width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; background: var(--accent-soft); color: var(--accent-text); }
.z-vazio-tit { color: var(--text-primary); font-weight: 600; font-size: 16px; }
.z-vazio-txt { color: var(--text-secondary); font-size: 14px; max-width: 460px; line-height: 1.5; }
.z-vazio-bts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
/* Tela vazia: o botão dela é o principal; o do topo da aba vira secundário */
#mainApp .tab-content:has(.z-vazio) .btn-cyber:not(.z-vazio .btn-cyber) { background: transparent; border-color: var(--border-color); color: var(--text-primary); }

/* ---------- Consistência ---------- */
.z-card, .z-stat, .za-du, .zpl, .modal-content, .z-vazio, .notifications-dropdown, .rounded-xl, .rounded-2xl { border-radius: 16px !important; }
.btn-cyber, .btn-cyber-secondary, .zp-btn, .z-mini-btn, .z-header-btn, .input-theme, .sidebar-item, .zp-filter, .zp-x, .rounded-lg, .z-item, .z-passo { border-radius: 10px !important; }
.z-pill, .zp-tag, .badge-new, .zc-tag, .zpl-mod, .zpl-fita, .z-cont { border-radius: 99px !important; }
.z-card { padding: 24px; }
.z-item { padding: 12px 16px; }
.z-card-head { margin-bottom: 16px; gap: 12px; }
.z-card-title, .tab-content h3, .z-passos-tit { font-size: 16px !important; font-weight: 600 !important; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible, [onclick]:focus-visible { outline: 2px solid var(--accent-text) !important; outline-offset: 2px; }

/* ---------- Menu: contadores e modo recolhido ---------- */
.z-cont { background: var(--hover-bg); color: var(--text-secondary); font-weight: 600; }
.z-cont.ok { color: var(--success); background: rgba(74, 222, 128, 0.12); }
.z-cont.bad { color: var(--danger); background: rgba(248, 113, 113, 0.12); }
.z-cont.fila { color: var(--warning); background: rgba(250, 204, 21, 0.14); }
.sidebar-item { position: relative; }
@media (min-width: 769px) {
    #sidebar { transition: width 0.15s; }
    #sidebar.recolhido { width: 76px; }
    #sidebar.recolhido > div:first-child { padding: 0; justify-content: center; }
    #sidebar.recolhido > div:first-child > i, #sidebar.recolhido .z-logo-txt { display: none; }
    #sidebar.recolhido #menuRecolher { margin: 0; }
    #sidebar.recolhido .zn-head { display: none; }
    #sidebar.recolhido .zn-sec.fechada .zn-itens { display: block !important; }
    #sidebar.recolhido .sidebar-item { justify-content: center; padding-left: 0; padding-right: 0; }
    #sidebar.recolhido .sidebar-item > span:not(.z-cont) { display: none; }
    #sidebar.recolhido .sidebar-item > .z-cont { position: absolute; top: 0; right: 0; margin: 0; padding: 0 4px !important; font-size: 10px; }
    #sidebar.recolhido > div:last-child > div:not(:last-child), #sidebar.recolhido #headerUser, #sidebar.recolhido #headerPlano { display: none; }
    #sidebar.recolhido > div:last-child > div:last-child { justify-content: center; border: 0; }
}

/* ---------- Celular ---------- */
@media (max-width: 640px) {
    .btn-cyber, .btn-cyber-secondary, .zp-btn, .z-mini-btn, .z-header-btn, .zp-filter, .zp-x, .zc-tool, .sidebar-item, .zn-head, .input-theme { min-height: 44px !important; }
    .zp-x, .z-header-btn, .zc-tool { min-width: 44px !important; }
    .z-avatar { width: 44px; height: 44px; }
    #mainApp .tab-content button:not(.za-cm .zp-x), .notifications-dropdown button { min-height: 44px; }
    .z-icon-btn { min-width: 44px; }
    .zc-filtros button { height: 44px !important; }
    .modal-overlay { padding: 0 !important; }
    .modal-content { width: 100vw !important; max-width: none !important; height: 100vh !important; height: 100dvh !important; max-height: none !important; border-radius: 0 !important; border: 0 !important; overflow-y: auto; }
    .modal-content .grid-cols-2, .modal-content .grid-cols-3, .za-g2, form .grid-cols-2 { grid-template-columns: minmax(0, 1fr) !important; }
    .zpl.largo ul { columns: 1; }
    table { max-width: 100%; }
}

/* O display do .z-header-btn vence as classes md:hidden e hidden: cada botão de menu só no seu tamanho */
@media (min-width: 769px) { .z-header-btn.md\:hidden { display: none; } }
@media (max-width: 768px) { #menuRecolher { display: none !important; } }
/* Celular: o teclado já tem emoji; o espaço fica para o campo de mensagem */
@media (max-width: 640px) {
    .zc-comp [data-zc="emoji"] { display: none; }
    .zc-comp { gap: 6px; }
    #zcTexto { min-width: 0; flex: 1 1 auto; }
}

/* Tema claro: o que veio pintado para fundo escuro precisa ficar legível */
.theme-light .text-neutral-100, .theme-light .text-neutral-200, .theme-light .text-neutral-300, .theme-light .text-neutral-400 { color: var(--text-primary) !important; }
.theme-light .bg-white\/10 { background: rgba(0, 0, 0, 0.07) !important; }
.theme-light .text-green-400, .theme-light .text-green-500 { color: var(--success) !important; }
.theme-light .text-yellow-400, .theme-light .text-yellow-500, .theme-light .text-orange-400, .theme-light .text-orange-500 { color: var(--warning) !important; }
.theme-light .text-red-400, .theme-light .text-red-500 { color: var(--danger) !important; }
.theme-light .text-blue-400, .theme-light .text-blue-500 { color: #1D4ED8 !important; }
.theme-light .z-pill, .theme-light .zp-tag, .theme-light .zpl-mod, .theme-light .z-mini-btn, .theme-light .za-avatar, .theme-light .zc-av { color: #0A0A0A !important; }
.theme-light .anual, .theme-light [style*="color:#4ade80"] { color: var(--success) !important; }
.theme-light [style*="color:#facc15"], .theme-light [style*="color:#eab308"] { color: var(--warning) !important; }
.theme-light [style*="color:#f87171"], .theme-light [style*="color:#ef4444"] { color: var(--danger) !important; }
.theme-light .z-mini-btn { background: transparent !important; border-color: var(--border-color) !important; }
#btnRenovarPlano { align-items: center; gap: 6px; }
@media (max-width: 640px) {
    .zc-comp > :not(#zcTexto) { flex-shrink: 0; }
    #zcEnviar { min-width: 44px !important; flex: none; }
}

/* Abas das telas agrupadas */
.z-abas { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); overflow-x: auto; scrollbar-width: none; }
.z-abas::-webkit-scrollbar { display: none; }
.z-abas button { padding: 10px 16px; min-height: 44px; font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.z-abas button:hover { color: var(--text-primary); }
.z-abas button.on { color: var(--accent-text); border-bottom-color: var(--accent); }
