:root {
    /* Paleta da marca Pablo Chagas Advogados & Associados (extraída do logo:
       monograma dourado, "PABLO CHAGAS" em azul-marinho, "ADVOGADOS & ASSOCIADOS" em âmbar) */
    --navy-900: #101b30;
    --navy-800: #17233f;
    --navy-700: #1f2f52;
    --navy-600: #2a3d64;
    --primary: #17233f;
    --primary-light: #2a3d64;
    --gold-300: #f0dca3;
    --gold-400: #e3c274;
    --gold-500: #cea355;
    --gold-600: #b3843a;
    --gold-700: #8f6a2e;
    --accent: #c19548;
    --accent-hover: #a97f3c;
    --amber: #c9822f;
    --success: #219a52;
    --success-bg: #d4edda;
    --danger: #e74c3c;
    --danger-bg: #f8d7da;
    --bg: #f2f3f6;
    --card: #ffffff;
    --text: #1c2436;
    --text-muted: #6c7488;
    --border: #e2e4ea;
    --shadow: 0 4px 20px rgba(16, 27, 48, 0.07);
    --shadow-lg: 0 20px 60px rgba(16, 27, 48, 0.35);
    --font-display: Georgia, 'Times New Roman', 'Cambria', serif;
    --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); }

h1, h2, h3, .brand-heading { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; }

/* ===== Tela de login ===== */
.login-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(226,194,116,0.16), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(226,194,116,0.10), transparent 50%),
        linear-gradient(150deg, rgba(16,27,48,0.88) 0%, rgba(23,35,63,0.82) 55%, rgba(31,47,82,0.85) 100%),
        url('/assets/login-bg.jpg');
    background-size: cover;
    background-position: center;
    position: relative;
}
.login-box {
    background: white; padding: 2.8rem 2.5rem 2.5rem; border-radius: 16px;
    box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; text-align: center;
    border-top: 3px solid var(--gold-500);
}
.login-logo { max-width: 180px; margin-bottom: .6rem; }
.login-box h2 { font-size: 1.3rem; color: var(--navy-800); margin-bottom: .3rem; }
.login-box .login-sub { display: block; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin-bottom: 1.6rem; font-weight: 600; }
.login-box input { width: 100%; padding: 0.9rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font-body); }
.login-box input:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(206,163,85,0.18); }
.login-box button {
    width: 100%; padding: 0.9rem; border: none; border-radius: 8px; cursor: pointer; font-weight: 700;
    background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
    color: var(--navy-900); letter-spacing: .02em; transition: filter .15s, transform .15s;
}
.login-box button:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* ===== Layout geral ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 264px; color: white; display: flex; flex-direction: column; position: fixed; height: 100vh; overflow: hidden;
    background: linear-gradient(185deg, var(--navy-900) 0%, var(--navy-800) 60%, var(--navy-700) 100%);
    border-right: 1px solid rgba(226,194,116,0.15);
}
.sidebar-header { flex: 0 0 auto; padding: 1.2rem 1rem 1rem; text-align: center; border-bottom: 1px solid rgba(226,194,116,0.18); }
.sidebar-logo { max-width: 84px; margin-bottom: 0.5rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.sidebar-header h3 { font-family: var(--font-display); font-size: 1.08rem; font-weight: 700; letter-spacing: .015em; line-height: 1.25; color: #fbf3e2; }
.sidebar-header .brand-sub { display: block; font-family: var(--font-body); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-400); margin-top: .25rem; font-weight: 600; }

.sidebar-nav { flex: 1 1 auto; padding: 0.6rem 0; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(226,194,116,0.25); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.nav-item {
    display: flex; align-items: center; gap: 0.7rem; padding: 0.62rem 1.3rem; color: rgba(255,255,255,0.72);
    text-decoration: none; transition: .18s; font-size: 0.92rem; white-space: nowrap;
    border-left: 3px solid transparent;
}
.nav-item i { width: 1.1rem; text-align: center; color: rgba(226,194,116,0.75); }
.nav-item:hover { background: rgba(226,194,116,0.08); color: #fff; }
.nav-item.active { background: rgba(226,194,116,0.13); color: #fff; border-left-color: var(--gold-500); }
.nav-item.active i { color: var(--gold-400); }

.sidebar-footer { flex: 0 0 auto; padding: 0.8rem 1.2rem; border-top: 1px solid rgba(226,194,116,0.15); background: rgba(0,0,0,0.18); }
.btn-logout { background: #b6413a; border: none; color: white; font-size: 0.9rem; cursor: pointer; }
.btn-logout:hover { background: #963129; }

.main-content { flex: 1; margin-left: 264px; padding: 1.8rem; min-height: 100vh; }
.page { display: none; }
.page.active { display: block; }
.page h1 { margin-bottom: 1.5rem; font-size: 1.55rem; color: var(--navy-800); display: flex; align-items: center; gap: .55rem; }
.page h1 i { color: var(--gold-600); font-size: 1.25rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem; margin-bottom: 1.8rem; }
.stat-card { background: var(--card); border-radius: 12px; padding: 1.3rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow); border-left: 4px solid; transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16,27,48,0.12); }
.stat-card.blue { border-color: #3b6ea5; } .stat-card.green { border-color: var(--success); } .stat-card.orange { border-color: var(--gold-600); } .stat-card.purple { border-color: #7a5c8e; } .stat-card.red { border-color: var(--danger); }
.stat-card i { font-size: 1.8rem; color: var(--text-muted); }
.stat-card.blue i { color: #3b6ea5; } .stat-card.green i { color: var(--success); } .stat-card.orange i { color: var(--gold-600); } .stat-card.purple i { color: #7a5c8e; }
.stat-number { display: block; font-size: 1.6rem; font-weight: bold; font-family: var(--font-display); color: var(--navy-800); }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }

.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 1.5rem; }
.chart-card { background: var(--card); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow); }
.chart-card h3 { color: var(--navy-800); font-size: 1rem; margin-bottom: .8rem; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { margin-bottom: 0; }
.pipeline-tabs { display: flex; gap: 0.5rem; }
.tab-btn { padding: 0.6rem 1.2rem; border: 1px solid var(--border); background: white; border-radius: 8px; cursor: pointer; font-family: var(--font-body); color: var(--text); }
.tab-btn.active { background: var(--navy-800); color: white; border-color: var(--navy-800); }

.pipeline-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.pipeline-column { background: var(--card); border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); min-height: 350px; }
.pipeline-column h3 { padding-bottom: 0.7rem; margin-bottom: 1rem; border-bottom: 2px solid var(--gold-300); font-size: 0.95rem; color: var(--navy-800); }
.deal-card { background: var(--bg); border-radius: 8px; padding: 0.9rem; margin-bottom: 0.6rem; cursor: pointer; transition: 0.2s; border-left: 3px solid transparent; }
.deal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-left-color: var(--gold-500); }

.chat-layout { display: grid; grid-template-columns: 300px 1fr 320px; gap: 0; height: calc(100vh - 140px); background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.chat-list { background: #f8f9fb; border-right: 1px solid var(--border); overflow-y: auto; }
.chat-search { padding: 1rem; border-bottom: 1px solid var(--border); }
.chat-search input { width: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: 8px; }
.contact-item { padding: 1rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.contact-item:hover, .contact-item.active { background: white; }
.contact-item h4 { font-size: 0.95rem; margin-bottom: 0.2rem; font-family: var(--font-body); font-weight: 600; }
.contact-item p { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-window { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
.chat-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.messages-container { flex: 1; min-height: 0; overflow-y: auto; padding: 1.2rem; background: #f8f9fb; display: flex; flex-direction: column; }
.message-bubble { max-width: 75%; padding: 0.7rem 1rem; border-radius: 12px; margin-bottom: 0.6rem; }
.message-bubble.in { background: white; align-self: flex-start; border-bottom-left-radius: 4px; }
.message-bubble.out { background: #f4e8cc; align-self: flex-end; border-bottom-right-radius: 4px; margin-left: auto; }
.message-bubble small { display: block; margin-top: 0.3rem; font-size: 0.7rem; color: var(--text-muted); }
.chat-input-area { display: flex; gap: 0.5rem; padding: 1rem; border-top: 1px solid var(--border); background: white; }
.chat-input-area input { flex: 1; padding: 0.8rem; border: 1px solid var(--border); border-radius: 8px; }
.chat-input-area button { padding: 0 1.2rem; background: var(--accent); color: var(--navy-900); border: none; border-radius: 8px; cursor: pointer; font-weight: 600; }

.form-card, .admin-card { background: var(--card); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.form-card label { display: block; margin: 1rem 0 0.4rem; font-weight: 500; }
.form-card input, .form-card select, .form-card textarea { width: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font-body); }
.btn-primary {
    background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: var(--navy-900); border: none;
    padding: 0.7rem 1.5rem; border-radius: 8px; cursor: pointer; margin-top: 1rem; font-weight: 700; letter-spacing: .01em;
    transition: filter .15s, transform .15s;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }

.connections-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.connection-card { background: var(--card); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow); text-align: center; }
.connection-status { display: inline-block; padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.85rem; margin: 1rem 0; }
.status-connected { background: var(--success-bg); color: #155724; }
.status-disconnected { background: var(--danger-bg); color: #721c24; }
.qr-code { max-width: 180px; margin: 0.5rem auto; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; }
.admin-card input, .admin-card select { width: 100%; padding: 0.7rem; margin-bottom: 0.7rem; border: 1px solid var(--border); border-radius: 8px; }

.hidden { display: none !important; }

@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; position: relative; }
    .main-content { margin-left: 0; }
    .app { flex-direction: column; }
    .chat-layout { grid-template-columns: 1fr; height: auto; }
    .charts-row { grid-template-columns: 1fr; }
}


/* Cabecalho da conversa + painel do contato */
.chat-header { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); background: #fff; }
.chat-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.icon-btn { background: transparent; border: none; cursor: pointer; font-size: 1.15rem; color: var(--navy-700); }
.icon-btn:hover { color: var(--gold-600); }
.contact-panel { background: #fff; border-left: 1px solid var(--border); overflow-y: auto; }
.panel-sec { border-bottom: 1px solid var(--border); padding: 1rem; }
.panel-sec h4 { margin: 0 0 .6rem; font-size: .78rem; color: var(--navy-700); text-transform: uppercase; letter-spacing: .04em; }
.panel-sec input, .panel-sec textarea, .panel-sec select { width: 100%; padding: .5rem; margin-bottom: .5rem; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; box-sizing: border-box; }
.panel-avatar { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto .5rem; background: #eee; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #f4ecd9; color: #5b4a26; border-radius: 12px; padding: .2rem .55rem; font-size: .8rem; margin: .15rem; }
.mini-item { font-size: .82rem; padding: .45rem .55rem; background: var(--bg); border-radius: 6px; margin-bottom: .35rem; }
@media (max-width: 1100px) { .chat-layout { grid-template-columns: 260px 1fr; } .contact-panel { display: none; } }

.panel-sec-head { display:flex; align-items:center; justify-content:space-between; cursor:pointer; }
.panel-sec-body { display:none; margin-top:.7rem; }
.panel-sec.open .panel-sec-body { display:block; }
.panel-sec .chev { color:#aaa; transition:transform .15s; font-size:1.1rem; }
.panel-sec.open .chev { transform:rotate(90deg); }

.status-tabs { display:flex; gap:.3rem; margin-top:.5rem; }
.stab { flex:1; text-align:center; font-size:.76rem; padding:.35rem .2rem; border-radius:6px; cursor:pointer; color:#555; background:#eef0f3; }
.stab.active { background:var(--navy-800); color:#fff; }
#filter-modal { display:none; }

/* Bolinha vermelha que pisca enquanto o áudio está sendo gravado */
@keyframes pulsa {
    0%   { opacity: 1; }
    50%  { opacity: .25; }
    100% { opacity: 1; }
}
