/* ========================================
   CRM OMNICHANNEL — UNIFIED STYLES
   ======================================== */
:root {
    --bg-0: #0A0A0B; --bg-1: #121214; --bg-2: #18181B; --bg-3: #242426;
    --border: 1px solid rgba(255,255,255,0.12);
    --text: #ffffff; --text-2: rgba(255, 255, 255, 0.6); --text-3: rgba(255,255,255,0.3);
    --brand: #C19E67; --blue: #0A84FF; --green: #30D158; --purple: #BF5AF2;
    --red: #FF453A; --orange: #FF9F0A;
    --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
}
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif; background: var(--bg-0); color: var(--text); overflow: hidden; height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ---- App Shell ---- */
.crm-app { display: flex; height: 100vh; overflow: hidden; }

/* ---- Modules ---- */
.crm-module { display: none; flex: 1; flex-direction: column; overflow: hidden; background: var(--bg-0); }
.crm-module.active { display: flex; }

.module-header { background: var(--bg-2); border-bottom: var(--border); padding: 12px 24px 0; flex-shrink: 0; }
.mod-top { display: flex; align-items: center; gap: 20px; margin-bottom: 12px; }
.mod-title { display: flex; align-items: center; gap: 12px; }
.mod-title h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.mod-title .badge { margin-top: 2px; }

.module-nav { display: flex; gap: 24px; padding-bottom: 2px; }
.sub-nav-link { background: transparent; border: none; color: var(--text-2); font-size: 13px; font-weight: 500; padding: 10px 4px; cursor: pointer; border-bottom: 2px solid transparent; transition: all .2s; outline: none; }
.sub-nav-link:hover { color: white; border-bottom-color: rgba(255,255,255,0.2); }
.sub-nav-link.active { color: var(--brand); border-bottom-color: var(--brand); }

.module-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-height: 0; }
.module-content > section { display: flex; flex-direction: column; flex: 1; height: 100%; width: 100%; overflow: hidden; }

/* ---- Sidebar ---- */
.crm-sidebar { width: 72px; background: var(--bg-2); border-right: var(--border); display: flex; flex-direction: column; align-items: center; padding: 16px 0; flex-shrink: 0; z-index: 10; }
.sidebar-logo { font-size: 18px; font-weight: 800; color: var(--brand); margin-bottom: 32px; }
.sidebar-menu { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.nav-link { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; color: var(--text-2); text-decoration: none; font-size: 11px; position: relative; transition: color .2s; }
.nav-link i { font-size: 22px; }
.nav-link span { font-size: 11px; }
.nav-link:hover { color: white; }
.nav-link.active { color: white; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 28px; background: var(--brand); border-radius: 0 4px 4px 0; }
.nav-badge { background: var(--red); color: white; font-size: 11px; font-weight: bold; padding: 1px 5px; border-radius: 10px; position: absolute; top: 6px; right: 10px; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.sidebar-user { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; border-top: var(--border); width: 100%; }
.user-avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.user-info-sm { text-align: center; }
.user-info-sm strong { display: block; font-size: 10px; }
.user-info-sm span { font-size: 11px; color: var(--text-2); }

/* ---- Topbar (Legacy/Templates) ---- */
.crm-topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: var(--border); flex-shrink: 0; background: var(--bg-0); }
.inbox-back-btn { display: none; background: transparent; border: none; color: white; font-size: 20px; cursor: pointer; padding: 4px; margin-right: 8px; }

@media (max-width: 768px) {
    .inbox-back-btn { display: flex; }
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left h1 { font-size: 18px; font-weight: 600; }
.back-btn { color: var(--text-2); text-decoration: none; font-size: 18px; transition: color .2s; }
.back-btn:hover { color: white; }
.view-toggle { display: flex; background: rgba(255,255,255,0.05); border-radius: var(--radius-xs); overflow: hidden; }
.view-toggle button { background: transparent; border: none; color: var(--text-2); padding: 6px 8px; cursor: pointer; font-size: 16px; }
.view-toggle button.active { background: rgba(255,255,255,0.1); color: white; }
.topbar-search { display: flex; align-items: center; background: rgba(255,255,255,0.04); border: var(--border); border-radius: var(--radius-sm); padding: 0 12px; max-width: 360px; flex: 1; margin: 0 24px; }
.topbar-search i { color: var(--text-2); font-size: 16px; }
.topbar-search input { background: transparent; border: none; color: white; padding: 8px 10px; width: 100%; outline: none; font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ---- Buttons ---- */
.btn-accent { background: var(--green); color: black; border: none; padding: 7px 14px; border-radius: var(--radius-xs); font-weight: 600; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: filter .2s; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; border: none; color: var(--text-2); font-size: 18px; cursor: pointer; padding: 6px; transition: color .2s; }
.btn-ghost:hover { color: white; }
.pill-btn { background: transparent; border: var(--border); color: white; padding: 6px 12px; border-radius: var(--radius-xs); font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-family: inherit; transition: all .2s; }
.pill-btn:hover { background: rgba(255,255,255,0.08); }
.pill-btn.sm { font-size: 11px; padding: 4px 10px; }
.pill-btn.danger { border-color: rgba(255,69,58,0.4); color: var(--red); }
.pill-btn.danger:hover { background: rgba(255,69,58,0.15); }
.badge { background: rgba(255,255,255,0.1); padding: 4px 8px; border-radius: 4px; font-size: 12px; }
.badge.blue { background: rgba(10,132,255,0.15); color: var(--blue); }

/* ---- Subbar ---- */
.crm-subbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-bottom: var(--border); flex-shrink: 0; }
.filter-pills { display: flex; gap: 8px; }
.pipeline-stats { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.stat-bold { color: white; font-weight: 500; }
.blue-text { color: var(--blue); }
.green-text { color: var(--green); }
.orange-text { color: var(--orange); }
.red-text { color: var(--red); }
.color-brand { color: var(--brand); }

/* ---- Event Highlight (Financeiro) ---- */
.event-highlight-card { 
    background: linear-gradient(135deg, rgba(212,175,55,0.08) 0%, rgba(212,175,55,0.02) 100%);
    border: 1px solid rgba(212,175,55,0.15);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
}
.eh-tag { font-size: 10px; font-weight: 800; color: var(--brand); letter-spacing: 0.1em; margin-bottom: 8px; }
.eh-info h3 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.eh-stats { display: flex; gap: 40px; }
.eh-stat { display: flex; flex-direction: column; gap: 4px; }
.eh-stat strong { font-size: 24px; color: white; }
.eh-stat span { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== KANBAN ===== */
.kanban-board { display: flex; flex: 1; overflow-x: auto; padding: 20px; gap: 14px; background: var(--bg-1); }
.k-col { min-width: 260px; width: 260px; display: flex; flex-direction: column; background: rgba(255,255,255,0.015); border: var(--border); border-radius: var(--radius); flex-shrink: 0; }
.k-col-head { padding: 14px 16px; border-bottom: var(--border); position: relative; }
.btn-preview-automation { 
    cursor: pointer; 
    margin-top: 8px; 
    display: inline-flex; 
    align-items: center; 
    gap: 4px;
    transition: all 0.2s;
}
.btn-preview-automation:hover { background: var(--green); color: black; }
.k-col-head h3 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.k-col-head span { font-size: 11px; color: var(--text-2); }
.k-col-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; transition: background .2s, border-color .2s; }
.k-col-body.drag-over { background: rgba(193,158,103,0.04); border-color: rgba(193,158,103,0.2); }
.k-card { background: var(--bg-3); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); padding: 12px; cursor: grab; position: relative; transition: transform .2s cubic-bezier(0.2,0.9,0.3,1), border-color .2s, box-shadow .2s, opacity .15s; }
.k-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.2); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.k-card:active { cursor: grabbing; }
.k-card.dragging { opacity: 0.4; }
.k-card.won { border-left: 3px solid var(--green); }
.k-card h4 { font-size: 13px; font-weight: 600; margin-bottom: 4px; padding-right: 20px; }
.k-company { font-size: 11px; color: var(--text-2); margin-bottom: 10px; }
.k-footer { display: flex; align-items: center; justify-content: space-between; }
.k-val { font-size: 12px; font-weight: 500; }
.k-owner { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: black; font-size: 9px; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.k-owner.purple { background: var(--purple); color: white; }
.k-warn { position: absolute; top: 10px; right: 10px; font-size: 14px; }
.k-check { position: absolute; bottom: 10px; right: 10px; font-size: 16px; color: var(--green); }
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.k-col-body::-webkit-scrollbar { width: 4px; }
.k-col-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ===== INBOX ===== */
.inbox-layout { display: flex; flex: 1; overflow: hidden; }
.inbox-threads { width: 320px; flex-shrink: 0; background: var(--bg-2); border-right: var(--border); display: flex; flex-direction: column; }
.threads-head { padding: 16px; }
.threads-search { display: flex; align-items: center; background: rgba(0,0,0,0.3); border: var(--border); border-radius: var(--radius-xs); padding: 0 10px; }
.threads-search i { color: var(--text-2); }
.threads-search input { background: transparent; border: none; color: white; padding: 8px; width: 100%; outline: none; font-size: 13px; }
.threads-tabs { display: flex; padding: 0 16px; border-bottom: var(--border); }
.threads-tabs button { background: transparent; border: none; color: var(--text-2); font-size: 12px; font-weight: 600; padding: 8px 0; margin-right: 16px; border-bottom: 2px solid transparent; cursor: pointer; }
.threads-tabs button.active { color: var(--green); border-bottom-color: var(--green); }
.t-count { font-size: 11px; background: rgba(255,255,255,0.1); padding: 1px 5px; border-radius: 8px; margin-left: 4px; }
.threads-list { flex: 1; overflow-y: auto; }
.thread { display: flex; padding: 12px 16px; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.03); cursor: pointer; transition: background .15s; }
.thread:hover { background: rgba(255,255,255,0.02); }
.thread.active { background: rgba(255,255,255,0.05); border-left: 2px solid var(--blue); padding-left: 14px; }
.t-avatar { width: 40px; height: 40px; border-radius: 50%; background: #333; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; position: relative; overflow: visible; flex-shrink: 0; }
.t-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.channel-dot { position: absolute; bottom: -2px; right: -2px; width: 14px; height: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; color: white; }
.channel-dot.wa { background: #25D366; }
.channel-dot.ig { background: #E1306C; }
.t-body { flex: 1; overflow: hidden; }
.t-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.t-top strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-time { font-size: 11px; color: var(--text-2); flex-shrink: 0; }
.t-body p { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.t-body p.bold { color: white; font-weight: 500; }
.channel-label { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }

/* Chat */
.inbox-chat { flex: 1; display: flex; flex-direction: column; background: var(--bg-1); }
.chat-topbar { padding: 12px 24px; border-bottom: var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-2); }
.chat-topbar strong { font-size: 15px; }
.chat-actions { display: flex; gap: 8px; }
.chat-feed { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; }
.bubble { max-width: 60%; margin-bottom: 20px; }
.bubble.incoming { align-self: flex-start; }
.bubble.outgoing { align-self: flex-end; }
.b-msg { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; line-height: 1.5; }
.bubble.incoming .b-msg { background: var(--bg-3); border-bottom-left-radius: 4px; }
.bubble.outgoing .b-msg { background: var(--blue); color: white; border-bottom-right-radius: 4px; }
.b-time { display: block; font-size: 10px; color: var(--text-3); margin-top: 4px; text-align: right; }
.chat-composer { padding: 12px 24px; border-top: var(--border); background: var(--bg-2); display: flex; align-items: center; gap: 12px; }
.chat-composer input { flex: 1; background: var(--bg-3); border: 1px solid rgba(255,255,255,0.1); padding: 10px 14px; border-radius: 20px; color: white; outline: none; font-size: 13px; }
.send-btn { background: var(--brand); color: black; border: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; }

/* Detail Panel */
.inbox-detail { width: 280px; flex-shrink: 0; background: var(--bg-2); border-left: var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.detail-head { padding: 16px; border-bottom: var(--border); }
.detail-head h3 { font-size: 15px; margin-bottom: 6px; }
.det-tag { display: inline-block; background: rgba(48,209,88,0.2); color: var(--green); padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: bold; }
.detail-tabs { display: flex; border-bottom: var(--border); }
.detail-tabs button { background: transparent; border: none; color: var(--text-2); font-size: 12px; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; }
.detail-tabs button.active { color: white; border-bottom-color: white; }
.detail-fields { padding: 16px; }
.d-field { display: flex; flex-direction: column; margin-bottom: 14px; font-size: 13px; }
.d-field label { color: var(--text-2); font-size: 11px; margin-bottom: 2px; }
.d-field span { display: flex; align-items: center; gap: 6px; }
.muted { color: var(--text-3) !important; }
.detail-actions { padding: 16px; border-top: var(--border); }
.det-action-btn { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; cursor: pointer; padding: 8px 0; background: transparent; border: none; width: 100%; }
.det-action-btn:hover { color: white; }

/* ===== CONTATOS ===== */
.page-scroll { flex: 1; overflow-y: auto; padding: 24px; background: var(--bg-1); }
.table-wrap { background: var(--bg-2); border: var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: rgba(255,255,255,0.03); padding: 12px 20px; font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; border-bottom: var(--border); text-align: left; }
.data-table td { padding: 14px 20px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.02); }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.t-user { display: flex; align-items: center; gap: 10px; }
.av { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; color: white; flex-shrink: 0; }
.av.purple { background: var(--purple); }
.av.green { background: var(--green); color: black; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--orange); }
.status-dot.danger { background: var(--red); }

/* ===== ATIVIDADES ===== */
.act-list { max-width: 800px; margin: 0 auto; }
.act-group-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 28px 0 12px; border-bottom: var(--border); padding-bottom: 6px; }
.act-group-title.danger-text { color: var(--red); }
.act-row { display: flex; align-items: center; gap: 14px; background: var(--bg-2); padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 6px; border: var(--border); cursor: pointer; transition: background .15s; }
.act-row:hover { background: var(--bg-3); }
.act-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }
.act-icon { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.act-info { flex: 1; }
.act-info strong { display: block; font-size: 14px; margin-bottom: 2px; }
.act-info span { font-size: 12px; color: var(--text-2); }
.act-time { font-size: 12px; color: var(--text-2); }
.act-row.danger { border-left: 3px solid var(--red); }
.act-row.danger .act-icon { color: var(--red); background: rgba(255,69,58,0.1); }
.act-row.danger .act-time { color: var(--red); font-weight: 500; }
.act-row.muted { opacity: 0.5; }

/* ===== AUTOMAÇÕES ===== */
.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.auto-card { background: var(--bg-2); border: var(--border); border-radius: var(--radius); padding: 24px; }
.auto-card.active-flow { border-color: rgba(255,159,10,0.3); }
.auto-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.auto-head i { font-size: 28px; }
.auto-head strong { display: block; font-size: 15px; margin-bottom: 2px; }
.auto-head span { font-size: 12px; color: var(--text-2); }
.auto-flow { display: flex; flex-direction: column; align-items: center; }
.flow-node { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 20px; font-size: 13px; font-weight: 500; border: var(--border); background: var(--bg-3); }
.flow-node.trigger { border-color: var(--purple); color: var(--purple); }
.flow-node.action { background: rgba(10,132,255,0.08); color: var(--blue); border-color: rgba(10,132,255,0.2); }
.flow-node.action.wa { color: var(--green); background: rgba(48,209,88,0.08); border-color: rgba(48,209,88,0.2); }
.flow-node.action.alert { color: var(--orange); background: rgba(255,159,10,0.08); border-color: rgba(255,159,10,0.2); }
.flow-node.action.purple { color: var(--purple); background: rgba(191,90,242,0.08); border-color: rgba(191,90,242,0.2); }
.flow-node.condition { border-radius: var(--radius-sm); }
.flow-arrow { color: var(--text-3); margin: 8px 0; font-size: 14px; }
.flow-branch { display: flex; gap: 16px; margin-top: 8px; width: 100%; }
.branch-yes, .branch-no { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.branch-yes span { color: var(--green); font-size: 12px; font-weight: 600; }
.branch-no span { color: var(--red); font-size: 12px; font-weight: 600; }

/* ===== RELATÓRIOS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--bg-2); padding: 20px; border-radius: var(--radius); border: var(--border); }
.kpi-label { font-size: 12px; color: var(--text-2); display: block; margin-bottom: 8px; }
.kpi-value { font-size: 24px; font-weight: 700; display: block; margin-bottom: 8px; }
.kpi-trend { font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 4px; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { background: rgba(255,255,255,0.02); border: var(--border); border-radius: var(--radius); padding: 20px; }
.chart-card h3 { font-size: 15px; font-weight: 500; margin-bottom: 20px; color: var(--text-2); }
.bar-chart { display: flex; flex-direction: column; gap: 16px; }
.bar-item { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 120px; font-size: 13px; color: var(--text-2); }
.bar-track { flex: 1; height: 8px; background: rgba(255,255,255,0.05); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }
.bar-val { width: 40px; text-align: right; font-size: 13px; font-weight: 600; }

.metrics-row { display: flex; gap: 20px; margin-top: 24px; }
@media(max-width: 900px) { .metrics-row { flex-direction: column; } }

/* Leaderboard */
.leaderboard { display: flex; flex-direction: column; gap: 12px; }
.lb-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: rgba(255,255,255,0.02); border-radius: 12px; }
.lb-rank { font-size: 16px; font-weight: 700; width: 24px; color: var(--text-2); }
.lb-item:nth-child(1) .lb-rank { color: #FFD700; }
.lb-item:nth-child(2) .lb-rank { color: #C0C0C0; }
.lb-item:nth-child(3) .lb-rank { color: #CD7F32; }
.lb-person { display: flex; align-items: center; gap: 12px; flex: 1; margin-left: 12px; }
.lb-name { font-size: 14px; font-weight: 500; }
.lb-score { font-size: 15px; font-weight: 700; color: var(--green); }

/* Finance Tags & Checklists */
.fin-tags { margin-bottom: 8px; }
.f-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.f-pix { background: rgba(48,209,88,0.15); color: var(--green); }
.f-boleto { background: rgba(10,132,255,0.15); color: var(--blue); }
.f-cc { background: rgba(191,90,242,0.15); color: var(--purple); }

.fin-checklists { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 8px; padding-top: 10px; border-top: 1px dashed rgba(255,255,255,0.1); }
.fin-check { font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.fin-check input[type="checkbox"] { accent-color: var(--brand); cursor: pointer; }
.fin-check input:checked + span { text-decoration: line-through; opacity: 0.6; }

.overdue { animation: pulseRed 2s infinite; }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(255,69,58,0.4); } 70% { box-shadow: 0 0 0 6px rgba(255,69,58,0); } 100% { box-shadow: 0 0 0 0 rgba(255,69,58,0); } }
.text-red { color: var(--red) !important; }
.bar-fill.blue { background: var(--blue); }
.bar-fill.purple { background: var(--purple); }
.bar-fill.green { background: var(--green); }
.channel-stats { display: flex; flex-direction: column; gap: 16px; }
.ch-stat { display: flex; align-items: center; gap: 12px; }
.ch-stat strong { display: block; font-size: 14px; margin-bottom: 2px; }
.ch-stat span { font-size: 12px; color: var(--text-2); }

/* ===== DRAWER ===== */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 98; opacity: 0; pointer-events: none; transition: opacity .3s; }
.drawer-overlay.active { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 860px; max-width: 90vw; background: var(--bg-2); border-left: var(--border); z-index: 99; transform: translateX(100%); transition: transform .4s cubic-bezier(0.2,0.9,0.3,1); display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(0,0,0,0.5); }
.drawer.active { transform: translateX(0); }
.drawer-head { padding: 20px 28px; border-bottom: var(--border); display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { font-size: 20px; margin-bottom: 4px; }
.drawer-btns { display: flex; gap: 10px; align-items: center; }
.btn-won { background: var(--green); color: black; border: none; padding: 7px 14px; border-radius: var(--radius-xs); font-weight: 600; cursor: pointer; font-size: 13px; }
.btn-lost { background: var(--red); color: white; border: none; padding: 7px 14px; border-radius: var(--radius-xs); font-weight: 600; cursor: pointer; font-size: 13px; }
.drawer-content { display: flex; flex: 1; overflow: hidden; }
.drawer-side { width: 300px; background: var(--bg-1); border-right: var(--border); padding: 20px; overflow-y: auto; }
.ds-section { margin-bottom: 28px; }
.ds-section h4 { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; padding-bottom: 6px; border-bottom: var(--border); }
.ds-row { display: flex; flex-direction: column; margin-bottom: 14px; font-size: 13px; }
.ds-row label { color: var(--text-2); font-size: 11px; margin-bottom: 2px; }
.ds-row span { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.av-tiny { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); color: white; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: bold; }
.ds-person { display: flex; align-items: center; gap: 10px; background: var(--bg-3); padding: 10px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.ds-person strong { display: block; font-size: 13px; }
.ds-person span { font-size: 11px; color: var(--text-2); }
.ds-org { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 14px; }
.ds-org i { color: var(--brand); font-size: 20px; }
.tag-pill { background: rgba(255,255,255,0.1); padding: 3px 8px; border-radius: 4px; font-size: 11px; }
.tag-pill.blue { background: rgba(10,132,255,0.2); color: var(--blue); }

/* Timeline */
.drawer-timeline { flex: 1; padding: 24px; overflow-y: auto; }
.composer { background: var(--bg-3); border: var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 32px; }
.comp-tabs { display: flex; border-bottom: var(--border); }
.comp-tabs button { flex: 1; background: transparent; border: none; color: var(--text-2); padding: 10px; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; border-bottom: 2px solid transparent; }
.comp-tabs button.active { color: white; border-bottom-color: var(--brand); }
.composer textarea { width: 100%; min-height: 60px; background: transparent; border: none; padding: 14px; color: white; font-family: inherit; font-size: 13px; resize: vertical; outline: none; }
.comp-footer { display: flex; justify-content: flex-end; padding: 10px 14px; border-top: var(--border); }
.tl-section { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 20px; }
.tl-section::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.05); }
.tl-item { display: flex; gap: 14px; margin-bottom: 20px; position: relative; padding-left: 20px; }
.tl-item::before { content: ''; position: absolute; left: 5px; top: 32px; bottom: -20px; width: 2px; background: rgba(255,255,255,0.04); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: -2px; top: 4px; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; }
.tl-dot.update { background: #333; color: white; }
.tl-dot.owner { background: var(--blue); color: white; }
.tl-dot.create { background: var(--green); color: black; }
.tl-card { background: var(--bg-3); border: var(--border); border-radius: var(--radius-sm); padding: 12px 14px; flex: 1; }
.tl-meta { font-size: 11px; color: var(--text-2); margin-bottom: 6px; }
.tl-meta strong { color: white; }
.tl-card p { font-size: 13px; margin: 0; }
.tl-tag { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ===== SIM MODAL ===== */
.sim-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 200; display: none; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
.sim-modal.active { display: flex; }
.sim-modal-content { position: relative; width: 400px; height: 800px; max-height: 95vh; background: transparent; }
.sim-modal-content iframe { width: 100%; height: 100%; border-radius: 40px; }
.close-sim-btn { position: absolute; top: -10px; right: -40px; background: white; color: black; border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; z-index: 210; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* =========================================
   RESPONSIVITY - APPLE STANDARD
   ========================================= */

@media (max-width: 1024px) {
    .inbox-layout { grid-template-columns: 280px 1fr; }
    .inbox-detail { display: none; }
    .k-col { min-width: 240px; }
    .drawer { width: 600px; }
}

@media (max-width: 768px) {
    .crm-app { flex-direction: column; }
    
    /* Bottom Navigation - Apple Tab Bar Style */
    .crm-sidebar { 
        width: 100%; 
        height: calc(64px + env(safe-area-inset-bottom)); 
        flex-direction: row; 
        order: 2; 
        padding: 0 8px env(safe-area-inset-bottom);
        border-right: none;
        border-top: var(--border);
        justify-content: center;
        background: rgba(18, 18, 20, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-shrink: 0;
        z-index: 1000; /* Ensure it's above everything */
    }
    .sidebar-logo, .sidebar-bottom, .sidebar-user, .nav-link span { display: none; }
    .sidebar-menu { 
        display: flex;
        flex-direction: row; 
        justify-content: space-around; 
        align-items: stretch;
        height: 100%; 
        width: 100%; 
        max-width: 500px; /* Keep center modules accessible */
        margin: 0 auto;
    }
    .nav-link { 
        padding: 0; 
        height: 100%; 
        flex: 1;
        justify-content: center; 
        min-width: 60px;
    }
    .nav-link i { font-size: 26px; }
    .nav-link.active::before { 
        left: 50%; top: 0; bottom: auto; 
        transform: translateX(-50%); 
        width: 32px; height: 3px; 
        border-radius: 0 0 4px 4px; 
    }

    .crm-module { 
        order: 1; 
        height: calc(100vh - 64px - env(safe-area-inset-bottom));
        flex: none; 
        display: none;
    }
    .crm-module.active { display: flex; }
    
    .module-header { padding: 8px 16px 0; }
    .mod-top { gap: 12px; margin-bottom: 8px; }
    .mod-top h1 { font-size: 18px; }
    .module-nav { gap: 16px; overflow-x: auto; padding-bottom: 4px; }
    .module-nav::-webkit-scrollbar { display: none; }
    .sub-nav-link { white-space: nowrap; font-size: 13px; }
    
    /* Kanban Mobile - Swipeable */
    .kanban-board { 
        padding: 12px; 
        gap: 12px; 
        scroll-snap-type: x mandatory;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .k-col { 
        min-width: 85vw; 
        scroll-snap-align: center;
        background: rgba(255,255,255,0.03);
    }

    /* Inbox Mobile */
    .inbox-layout { grid-template-columns: 1fr; }
    .inbox-chat { display: none !important; } 
    .inbox-threads { display: flex !important; }
    
    /* Toggle State (JS will add class) */
    .inbox-layout.chat-active .inbox-chat { 
        display: flex !important; 
        position: absolute; 
        inset: 0; 
        z-index: 20; 
        background: var(--bg-0); 
    }
    .inbox-layout.chat-active .inbox-threads { display: none !important; }

    /* Tables */
    .data-table th:nth-child(3), .data-table td:nth-child(3),
    .data-table th:nth-child(4), .data-table td:nth-child(4),
    .data-table th:nth-child(5), .data-table td:nth-child(5) { display: none; }

    .event-highlight-card { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 20px; 
        padding: 16px; 
        margin: 12px;
    }
    .eh-stats { gap: 20px; width: 100%; justify-content: space-between; }
    .eh-info h3 { font-size: 18px; }
    .eh-stat strong { font-size: 20px; }
    
    .drawer { width: 100%; max-width: 100%; }
    .drawer-content { flex-direction: column; }
    .drawer-side { width: 100%; height: auto; border-right: none; border-bottom: var(--border); }
}
