/* Tema dark, variaveis :root e todos os componentes legados do dash (sidebar, topbar,
   tabelas, modais, kanban, pills). Extraido do <style> inline na Fase 9.
   A ORDEM importa: este carrega ANTES do design-system.css, que redefine alguns tokens.
   Inverter os <link> muda a cascata e a tela inteira. */
  :root {
    /* Paleta híbrida v5 — navy profundo + NOBETA purple */
    --bg: #141928;
    --surface: #1C2338;
    --surface2: #243050;
    --surface3: #2C3A5E;
    --border: rgba(255,255,255,0.09);
    --border2: rgba(255,255,255,0.14);
    --accent: #6C63FF;
    --accent2: #34D399;
    --accent-bg: rgba(108,99,255,0.11);
    --accent-border: rgba(108,99,255,0.28);
    --green: #34D399;
    --yellow: #FBBF24;
    --red: #F87171;
    --blue: #60A5FA;
    --text: #E8EDF8;
    --muted: #909ABE;
    --dim: #4D5470;
    --radius: 8px;
    /* Keep legacy aliases for backward compat */
    --surface-bg: #1C2338;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { background: var(--bg); color: var(--text); font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; font-size: 14px; display: flex; height: 100vh; overflow: hidden; position: relative; z-index: 1; }

  /* SIDEBAR */
  .sidebar { position: relative; z-index: 1; width: 220px; background: #090C17; border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
  .logo { padding: 20px 18px; border-bottom: 1px solid var(--border); }
  .logo span { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
  .logo small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
  .nav { flex: 1; padding: 12px 0; overflow-y: auto; }
  .nav-section { padding: 14px 18px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--disabled); }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 18px; cursor: pointer; border-left: 3px solid transparent; transition: all .15s; color: var(--muted); font-size: 13px; }
  .nav-item:hover { background: rgba(251,191,36,.07); color: var(--color-action); border-left-color: rgba(251,191,36,.35); }
  .nav-item.active { background: rgba(251,191,36,.08); color: var(--color-action); border-left-color: var(--color-action); font-weight:500; }
  .nav-item .badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 10px; }
  .nav-item .badge.green { background: var(--green); }
  .nav-icon { width:26px; height:26px; border-radius:7px; background:rgba(108,99,255,.1); display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all .15s; }
  .nav-item:hover .nav-icon { background:rgba(108,99,255,.18); }
  .nav-item.active .nav-icon { background:rgba(108,99,255,.22); }
  .sidebar-alertas { margin: 0 12px 12px; background: #13172a; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; padding: 12px; }
  .sidebar-alertas-row { display: flex; align-items: center; justify-content: space-between; border-radius: 7px; padding: 7px 10px; margin-bottom: 6px; }
  .sidebar-alertas-row:last-of-type { margin-bottom: 0; }
  .sidebar-alertas-label { font-size: 11px; font-weight: 600; }
  .sidebar-alertas-val { font-size: 15px; font-weight: 800; }
  .sidebar-alertas-ok { display: flex; align-items: center; gap: 6px; padding: 5px 2px; }
  .sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

  /* MAIN */
  .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
  .topbar { background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 var(--sp-6); height: 52px; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
  .topbar h1 { font-size: 15px; font-weight: 600; letter-spacing: -.1px; }
  .topbar .spacer { flex: 1; }
  .topbar .alert-bell { position: relative; cursor: pointer; padding: 6px; background: var(--surface2); border-radius: 8px; }
  .topbar .alert-bell .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid var(--surface); }
  .content { flex: 1; overflow-y: auto; padding: var(--sp-6); position: relative; z-index: 1; }

  /* CARDS */
  .kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
  .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4); }
  .kpi .label { font-size: 11px; color: var(--muted); }
  .kpi .value { font-size: 22px; font-weight: 700; margin: 4px 0 2px; }
  .kpi .sub { font-size: 11px; color: var(--muted); }
  .kpi.accent .value { color: var(--accent); }
  .kpi.green .value { color: var(--green); }
  .kpi.yellow .value { color: var(--yellow); }
  .kpi.red .value { color: var(--red); }
  .kpi.blue .value { color: var(--blue); }

  /* SECTION */
  .section-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
  .section-title .line { flex: 1; height: 1px; background: var(--border); opacity: .6; }

  /* TABLE */
  .table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--sp-6); }
  .table-header { padding: 14px var(--sp-4); display: flex; align-items: center; gap: var(--sp-3); border-bottom: 1px solid var(--border); }
  .table-header .title { font-weight: 600; font-size: 14px; }
  .table-header .spacer { flex: 1; }
  .search-input { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 12px; color: var(--text); font-size: 13px; width: 200px; outline: none; font-family: inherit; }
  .search-input:focus { border-color: var(--accent); }
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; font-family: inherit; }
  .btn:hover { opacity: .85; }
  .btn-primary { background: var(--accent); color: #fff; }
  .btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
  .btn-sm { padding: 4px 10px; font-size: 12px; }
  .btn-green { background: var(--green); color: #fff; }
  .btn-red { background: var(--red); color: #fff; }
  .btn-yellow { background: var(--yellow); color: #fff; }
  table { width: 100%; border-collapse: collapse; }
  th { text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface2); white-space: nowrap; }
  td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: rgba(108,99,255,.05); }
  .avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }

  /* STATUS BADGES */
  .badge-status { display: inline-block; padding: 3px 9px; border-radius: 5px; font-size: 11px; font-weight: 600; letter-spacing: .1px; }
  .s-ativo { background: rgba(34,197,94,.12); color: #22c55e; }
  .s-pipeline { background: rgba(59,130,246,.12); color: #60a5fa; }
  .s-negociacao { background: rgba(234,179,8,.12); color: #eab308; }
  .s-inativo { background: rgba(239,68,68,.12); color: #ef4444; }
  .s-pago { background: rgba(34,197,94,.12); color: #22c55e; }
  .s-pendente { background: rgba(234,179,8,.12); color: #eab308; }
  .s-fechado { background: rgba(108,99,255,.12); color: var(--accent); }

  /* PIPELINE */
  .pipeline { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 24px; }
  .pipeline-col { flex-shrink: 0; width: 180px; }
  .pipeline-col-header { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px 8px 0 0; padding: 10px 14px; font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
  .pipeline-col-header .count { background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 10px; }
  .pipeline-cards { background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; padding: 10px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
  .pcard { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; cursor: pointer; transition: border-color .15s; }
  .pcard:hover { border-color: var(--accent); }
  .pcard .pname { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
  .pcard .psite { font-size: 11px; color: var(--muted); }
  .pcard .pdate { font-size: 10px; color: var(--muted); margin-top: 6px; }

  /* ALERTS */
  .alert-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
  .alert-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: center; gap: 14px; }
  .alert-item.urgent { border-left: 2px solid var(--red); }
  .alert-item.warn { border-left: 2px solid var(--yellow); }
  .alert-item.info { border-left: 2px solid var(--blue); }
  .alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .alert-dot.red { background: var(--red); }
  .alert-dot.yellow { background: var(--yellow); }
  .alert-dot.blue { background: var(--blue); }
  .alert-text { flex: 1; font-size: 13px; }
  .alert-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }

  /* TWO COLS */
  .two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

  /* CHART BAR */
  .chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 100px; padding: 0 4px; }
  .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
  .bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .8; transition: opacity .15s; }
  .bar:hover { opacity: 1; }
  .bar-label { font-size: 10px; color: var(--muted); }
  .bar-val { font-size: 10px; color: var(--text); font-weight: 600; }

  .field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .field { display: flex; flex-direction: column; gap: 6px; }
  .field label { font-size: 11px; color: var(--muted); font-weight: 500; }
  .field .val { font-size: 13px; }
  .progress-steps { display: flex; flex-direction: column; gap: 10px; }
  .step { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: var(--radius); background: var(--surface2); border: 1px solid var(--border); }
  .step-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
  .step-num.done { background: var(--green); color: #fff; }
  .step-num.current { background: var(--accent); color: #fff; }
  .step-num.todo { background: var(--surface); border: 2px solid var(--border); color: var(--muted); }
  .step-label { flex: 1; font-size: 13px; }
  .step.done .step-label { color: var(--muted); text-decoration: line-through; }
  .timeline { display: flex; flex-direction: column; gap: 0; }
  .tl-item { display: flex; gap: 14px; }
  .tl-line { display: flex; flex-direction: column; align-items: center; }
  .tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 4px; }
  .tl-bar { width: 2px; flex: 1; background: var(--border); margin: 4px 0; }
  .tl-content { padding-bottom: 16px; }
  .tl-content .tl-date { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
  .tl-content .tl-text { font-size: 13px; }

  /* TABS PAGE */
  .page-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
  .page-tab { padding: 8px 16px; cursor: pointer; font-size: 13px; color: var(--muted); border-radius: 7px; border: 1px solid transparent; }
  .page-tab.active { color: var(--accent); border-color: var(--accent); background: rgba(108,99,255,.1); font-weight: 600; }

  /* HIDDEN SECTIONS */
  .section { display: none; }
  .section.active { display: block; }

  /* PREMIAÇÃO */
  .ranking { display: flex; flex-direction: column; gap: 10px; }
  .rank-item { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; }
  .rank-pos { width: 26px; height: 26px; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); }
  .rank-pos.gold { background: #f39c12; color: #fff; }
  .rank-pos.silver { background: #7b8a9a; color: #fff; }
  .rank-pos.bronze { background: #a0673a; color: #fff; }
  .rank-name { flex: 1; font-size: 13px; font-weight: 600; }
  .rank-sites { font-size: 12px; color: var(--muted); }
  .rank-value { font-size: 14px; font-weight: 700; color: var(--green); }

  /* LEADS */
  .lead-row { display: flex; align-items: center; gap: 14px; }
  .domain-badge { background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px; font-size: 11px; color: var(--muted); }

  /* ADMANAGER */
  .insight-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
  .insight-card .ic-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .insight-card .ic-title { font-size: 13px; font-weight: 600; }
  .insight-card .ic-time { font-size: 11px; color: var(--muted); }
  .insight-card .ic-body { font-size: 13px; color: var(--muted); line-height: 1.6; }
  .tag-removed { color: var(--red); font-weight: 600; }
  .tag-ok { color: var(--green); font-weight: 600; }

  /* SCROLLBAR */
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--disabled); }

  /* MINI FORMS */
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
  .form-field { display: flex; flex-direction: column; gap: 6px; }
  .form-field label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
  .form-field input, .form-field select { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 12px; color: var(--text); font-size: 13px; outline: none; width: 100%; }
  .form-field input:focus, .form-field select:focus { border-color: var(--accent); }

  /* FINANCIAL */
  .payment-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .payment-row:last-child { border-bottom: none; }
  .payment-partner { flex: 1; font-size: 13px; }
  .payment-amount { font-size: 14px; font-weight: 700; }
  .payment-date { font-size: 11px; color: var(--muted); }

  /* TOOLTIP */
  .tooltip { position: relative; }
  .tooltip:hover::after { content: attr(data-tip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background: #000; color: #fff; padding: 4px 8px; border-radius: 5px; font-size: 11px; white-space: nowrap; z-index: 10; pointer-events: none; }

  .empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
  .empty-state .icon { font-size: 36px; margin-bottom: 10px; }

  /* KANBAN */
  .kanban-wrap{display:flex;gap:12px;overflow-x:auto;padding-bottom:12px;align-items:flex-start}
  .kanban-col{flex:0 0 220px;background:var(--surface);border:1px solid var(--border);border-radius:10px;display:flex;flex-direction:column}
  .kanban-col-hdr{padding:10px 12px;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;border-radius:10px 10px 0 0;display:flex;align-items:center;justify-content:space-between}
  .kanban-col-body{padding:8px;display:flex;flex-direction:column;gap:8px;min-height:80px;flex:1}
  .k-card{background:var(--surface2);border:1px solid var(--border);border-radius:8px;padding:10px 12px;cursor:pointer;transition:.15s;border-left:3px solid transparent}
  .k-card:hover{border-color:var(--accent);transform:translateY(-1px)}
  .k-card.urgente{border-left-color:#e74c3c}
  .k-card.alta{border-left-color:#e67e22}
  .k-card.media{border-left-color:#f1c40f}
  .k-card .k-nome{font-size:13px;font-weight:600;margin-bottom:3px}
  .k-card .k-meta{font-size:11px;color:var(--muted)}
  .k-card .k-tag{display:inline-block;font-size:10px;padding:1px 7px;border-radius:8px;margin-top:5px;font-weight:600}
  /* TIMELINE */
  .timeline{list-style:none;padding:0;position:relative}
  .timeline::before{content:'';position:absolute;left:13px;top:0;bottom:0;width:2px;background:var(--border)}
  .tl-item{display:flex;gap:12px;padding:8px 0;position:relative}
  .tl-dot{width:16px;height:16px;border-radius:50%;flex-shrink:0;margin-top:2px;z-index:1;border:2px solid var(--bg)}
  .tl-dot.disparo{background:#6c63ff}
  .tl-dot.resposta{background:#2ecc71}
  .tl-dot.followup{background:#f39c12}
  .tl-dot.nota{background:#3498db}
  .tl-dot.perda{background:#e74c3c}
  .tl-body{flex:1}
  .tl-data{font-size:11px;color:var(--muted)}
  .tl-desc{font-size:13px;margin-top:2px}
  /* LEAD DETAIL PANEL */
  .lead-detail-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.65);z-index:999;align-items:center;justify-content:center}
  .lead-detail-overlay.open{display:flex}
  .lead-detail-panel{background:var(--surface);border:1px solid var(--border);border-radius:14px;width:min(680px,95vw);max-height:90vh;overflow-y:auto;padding:24px}
  /* FICHA COMPLETA */
  #ficha-page{display:none;position:fixed;inset:0;background:var(--bg);z-index:850;overflow-y:auto}
  #ficha-page.open{display:block}
  .ficha-topbar{position:sticky;top:0;background:var(--surface);border-bottom:1px solid var(--border);padding:0 24px;height:52px;display:flex;align-items:center;gap:14px;z-index:10}
  .ficha-body{max-width:1160px;margin:0 auto;padding:24px 24px 60px}
  @media(max-width:900px){
    #ficha-page .ficha-cols{grid-template-columns:1fr !important}
  }
  /* METRICS */
  .prosp-kpi-row{display:grid;grid-template-columns:repeat(7,1fr);gap:12px;margin-bottom:20px}
  @media(max-width:1100px){.prosp-kpi-row{grid-template-columns:repeat(4,1fr)}}
  .prosp-kpi{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:14px;text-align:center}
  .prosp-kpi .pv{font-size:26px;font-weight:700;color:var(--accent)}
  .prosp-kpi .pl{font-size:11px;color:var(--muted);margin-top:3px}
  .prosp-kpi.warn .pv{color:var(--yellow)}
  .prosp-kpi.danger .pv{color:var(--red)}
  .prosp-kpi.ok .pv{color:var(--green)}
  .stage-bar{display:flex;gap:4px;margin:20px 0 8px;overflow-x:auto;padding-bottom:4px}
  .stage-btn{padding:5px 12px;border-radius:20px;font-size:12px;cursor:pointer;border:1px solid var(--border);background:var(--surface2);color:var(--muted);transition:.15s;white-space:nowrap}
  .stage-btn.active{background:var(--accent);color:#fff;border-color:var(--accent)}
  /* HISTÓRICO DRAWER */
  .hist-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:1000}
  .hist-backdrop.open{display:block}
  .hist-drawer{position:fixed;top:0;right:-720px;width:min(720px,96vw);height:100vh;background:var(--surface);border-left:1px solid var(--border);z-index:1001;transition:right .3s cubic-bezier(.4,0,.2,1);overflow-y:auto;display:flex;flex-direction:column}
  .hist-drawer.open{right:0}
  .hist-drawer-hdr{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--surface);z-index:1}
  .hist-drawer-hdr h2{font-size:16px;font-weight:700;margin:0}
  .hist-drawer-body{padding:20px 24px;flex:1}
  /* DEDUPLICATION BADGE */
  @keyframes pulse-border {
    0%,100%{box-shadow:0 0 0 0 rgba(243,156,18,.4)}
    50%{box-shadow:0 0 0 5px rgba(243,156,18,0)}
  }
  .retorno-alert{animation:pulse-border 2s ease-in-out infinite}
    .badge-respondeu{background:rgba(230,126,18,.18);color:#e67e22;border:1px solid rgba(230,126,18,.4);border-radius:10px;font-size:10px;padding:2px 7px;font-weight:600;white-space:nowrap;margin-left:6px}
  .lead-row-respondeu{opacity:.55}

/* ========== CRM FINANCEIRO ========== */
#crm-fin { }
#crm-fin .crm-banner { display:flex;align-items:center;justify-content:space-between;padding:10px 16px;background:var(--surface);border:1px solid var(--border);border-radius:8px;margin-bottom:12px;font-size:12px;color:var(--muted) }
#crm-fin .crm-banner strong { color:var(--text) }
#crm-fin .crm-valor-prev { display:flex;align-items:center;gap:8px;margin-bottom:12px;padding:8px 14px;background:var(--surface);border:1px solid var(--border);border-radius:7px;font-size:11px;color:var(--muted) }
#crm-fin .crm-ctrs { display:flex;gap:0;margin-bottom:14px;background:var(--surface);border:1px solid var(--border);border-radius:8px;overflow:hidden }
#crm-fin .crm-ctr { flex:1;padding:9px 12px;border-right:1px solid var(--border);text-align:center;cursor:pointer;user-select:none;transition:background .15s }
#crm-fin .crm-ctr:last-child { border-right:none }
#crm-fin .crm-ctr:hover { background:var(--surface2) }
#crm-fin .crm-ctr .cn { font-size:17px;font-weight:700;line-height:1 }
#crm-fin .crm-ctr .cl { font-size:10px;color:var(--muted);margin-top:2px }
#crm-fin .crm-ctr.active { background:var(--surface2) }
#crm-fin .crm-table-wrap { background:var(--surface);border:1px solid var(--border);border-radius:8px;overflow:hidden }
#crm-fin .crm-table-hdr { display:flex;align-items:center;justify-content:space-between;padding:9px 14px;border-bottom:1px solid var(--border) }
#crm-fin .crm-table-hdr h3 { font-size:11px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.4px }
#crm-fin table { width:100%;border-collapse:collapse }
#crm-fin th { font-size:10px;font-weight:600;color:var(--muted);text-align:left;padding:7px 12px;border-bottom:1px solid var(--border);text-transform:uppercase;letter-spacing:.4px;white-space:nowrap }
#crm-fin td { padding:9px 12px;border-bottom:1px solid var(--surface2);font-size:12px;vertical-align:middle }
#crm-fin tr:last-child td { border-bottom:none }
#crm-fin tr:hover td { background:var(--surface2) }
#crm-fin tr.crm-hidden { display:none }
#crm-fin .pname { font-weight:600;color:var(--text);display:block }
#crm-fin .purl { font-size:10px;color:var(--accent);display:block;margin-top:1px;text-decoration:none;opacity:.75 }
#crm-fin .purl:hover { opacity:1;text-decoration:underline }
#crm-fin .dias-ok { color:#27ae60;font-size:11px;font-weight:600;padding:2px 7px;border-radius:4px;background:rgba(39,174,96,.08) }
#crm-fin .dias-warn { color:var(--yellow);font-size:11px;font-weight:600;padding:2px 7px;border-radius:4px;background:rgba(255,193,7,.1) }
#crm-fin .dias-late { color:var(--red);font-size:11px;font-weight:700;padding:2px 7px;border-radius:4px;background:rgba(231,76,60,.12) }
#crm-fin .dot6 { width:6px;height:6px;border-radius:50%;display:inline-block;margin-right:5px;flex-shrink:0 }
#crm-fin .crm-acao { display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:500;padding:3px 8px;border-radius:4px;white-space:nowrap }
#crm-fin .crm-footer { display:flex;gap:12px;margin-top:10px;padding:0 4px;flex-wrap:wrap;font-size:11px;color:var(--muted) }


  /* ===== v5 HYBRID ADDITIONS ===== */
  .alert-pill-v5 {
    display:flex;align-items:center;gap:5px;padding:4px 10px;
    border-radius:20px;font-size:11px;font-weight:600;
    background:rgba(248,113,113,0.12);color:#F87171;
    border:1px solid rgba(248,113,113,0.22);cursor:pointer;white-space:nowrap;
  }
  .alert-pill-v5 svg{flex-shrink:0}
  .topbar-avatar {
    width:30px;height:30px;border-radius:50%;
    background:rgba(108,99,255,0.12);border:1.5px solid rgba(108,99,255,0.28);
    display:flex;align-items:center;justify-content:center;
    font-size:11px;font-weight:600;color:var(--accent);cursor:pointer;flex-shrink:0;
  }
  .comp-bar-v5 {
    display:flex;align-items:center;gap:10px;
    padding:6px 24px;background:var(--surface);
    border-bottom:1px solid var(--border);font-size:11px;flex-shrink:0;
  }
  .comp-badge-v5 {
    padding:2px 8px;border-radius:4px;background:rgba(108,99,255,0.11);
    color:var(--accent);font-weight:600;border:1px solid rgba(108,99,255,0.28);font-size:11px;
  }
  .comp-sep-v5{color:var(--dim)}
  .comp-warn-v5{color:#FBBF24;font-weight:500}
  .comp-fin-v5{margin-left:auto;font-size:12px;font-weight:500;white-space:nowrap}
  .comp-fin-v5 span{color:var(--accent)}

  /* ── Barra de alertas persistente ── */
  #alert-strip {
    display:none;flex-shrink:0;
    padding:7px 24px;font-size:12px;font-weight:500;
    align-items:center;gap:10px;cursor:pointer;
    border-bottom:1px solid rgba(0,0,0,.15);
    transition:background .2s;
  }
  #alert-strip.strip-urgent { display:none; }
  #alert-strip.strip-warn   { display:none; }
  #alert-strip .strip-icon  { font-size:14px; flex-shrink:0; }
  #alert-strip .strip-msg   { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #alert-strip .strip-count { font-size:11px; opacity:.75; flex-shrink:0; padding:2px 8px; border-radius:4px; background:rgba(0,0,0,.2); }
  #alert-strip .strip-cta   { font-size:11px; opacity:.8; flex-shrink:0; text-decoration:underline; }

  /* Activity filters */
  .act-filter-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
  .act-filter-wrap{display:flex;gap:3px}
  .act-filter-btn{
    padding:3px 9px;border-radius:4px;font-size:11px;font-weight:500;
    cursor:pointer;color:var(--muted);border:1px solid transparent;
    transition:all .12s;background:transparent;font-family:inherit;
  }
  .act-filter-btn:hover{background:var(--surface2);color:var(--text)}
  .act-filter-btn.on{background:rgba(108,99,255,0.11);color:var(--accent);border-color:rgba(108,99,255,0.28)}

  /* Resp avatar */
  .resp-av{
    width:22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;
    justify-content:center;font-size:10px;font-weight:600;color:#fff;flex-shrink:0;
  }
  .resp-av-L{background:#6C63FF}.resp-av-G{background:#34D399;color:#111}
  .resp-av-J{background:#60A5FA}.resp-av-D{background:#FBBF24;color:#111}
  .resp-av-O{background:#F97316}.resp-av-C{background:#A78BFA}

  /* Próxima Ação na tabela */
  .na-cell{display:flex;align-items:center;gap:4px;font-size:11px;font-weight:500}
  .na-danger{color:#F87171}.na-warn{color:#FBBF24}.na-ok{color:#34D399}
  .na-info{color:#60A5FA}.na-neu{color:var(--muted)}

  /* ===== FICHA DO PARCEIRO OVERLAY ===== */
  .ficha-overlay{
    position:fixed;inset:0;background:var(--bg);z-index:999;
    display:none;flex-direction:column;overflow:hidden;
  }
  .ficha-overlay.open{display:flex}
  .ficha-topbar{
    display:flex;align-items:center;gap:12px;padding:0 20px;height:50px;
    border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0;
  }
  .ficha-back{
    display:flex;align-items:center;gap:5px;font-size:12px;color:var(--muted);
    cursor:pointer;padding:5px 8px;border-radius:5px;transition:all .12s;
    background:transparent;border:none;font-family:inherit;
  }
  .ficha-back:hover{background:var(--surface2);color:var(--text)}
  .ficha-breadcrumb{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:6px}
  .ficha-breadcrumb span{color:var(--text);font-weight:500}
  .ficha-header{
    display:flex;align-items:center;gap:14px;padding:14px 20px;
    border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0;
  }
  .ficha-logo-av{
    width:40px;height:40px;border-radius:10px;background:var(--surface2);
    border:1px solid var(--border2);display:flex;align-items:center;justify-content:center;
    font-size:16px;font-weight:700;color:var(--text);flex-shrink:0;
  }
  .ficha-meta-wrap{flex:1;min-width:0}
  .ficha-nome{font-size:15px;font-weight:600;color:var(--text)}
  .ficha-url-line{font-size:11px;color:var(--muted);margin-top:2px}
  .ficha-pills{display:flex;align-items:center;gap:6px;margin-top:6px;flex-wrap:wrap}
  .ficha-actions-bar{display:flex;gap:6px;flex-shrink:0}
  .ficha-btn{
    padding:6px 13px;border-radius:6px;font-size:12px;font-weight:500;
    cursor:pointer;border:none;transition:all .15s;font-family:inherit;
  }
  .ficha-btn-brand{background:var(--accent);color:#fff}
  .ficha-btn-brand:hover{background:#7C75FF}
  .ficha-btn-ghost{background:var(--surface2);color:var(--muted);border:1px solid var(--border)}
  .ficha-btn-ghost:hover{color:var(--text)}
  .ficha-tabs{
    display:flex;gap:0;padding:0 20px;border-bottom:1px solid var(--border);
    background:var(--surface);flex-shrink:0;
  }
  .ficha-tab{
    padding:10px 13px;font-size:12px;font-weight:500;cursor:pointer;
    color:var(--muted);border-bottom:2px solid transparent;margin-bottom:-1px;
    transition:all .12s;
  }
  .ficha-tab:hover{color:var(--text)}
  .ficha-tab.on{color:var(--accent);border-bottom-color:var(--accent)}
  .ficha-body{flex:1;overflow-y:auto;padding:18px 20px;background:var(--bg)}
  .ficha-kv-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
  .ficha-kv{background:var(--surface);border:1px solid var(--border);border-radius:7px;padding:10px 13px}
  .ficha-kv-l{font-size:11px;color:var(--muted);margin-bottom:4px}
  .ficha-kv-v{font-size:13px;font-weight:500;color:var(--text)}
  .ficha-tl{padding:4px 0}
  .ficha-tl-item{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}
  .ficha-tl-item:last-child{border-bottom:none}
  .ficha-tl-dot{width:8px;height:8px;border-radius:50%;margin-top:4px;flex-shrink:0}
  .ficha-tl-date{font-size:10px;color:var(--dim);white-space:nowrap;min-width:60px}
  .ficha-tl-text{font-size:12px;color:var(--text);flex:1}
  .ficha-tl-sub{font-size:11px;color:var(--muted);margin-top:2px}
  .ficha-next-action{
    background:rgba(248,113,113,0.08);border:1px solid rgba(248,113,113,0.18);
    border-radius:7px;padding:11px 14px;margin-bottom:16px;
    display:flex;align-items:center;justify-content:space-between;
  }
  .ficha-next-action.warn{background:rgba(251,191,36,0.08);border-color:rgba(251,191,36,0.2)}
  .ficha-next-action.ok{background:rgba(52,211,153,0.08);border-color:rgba(52,211,153,0.18)}
  .pill-v5{display:inline-flex;align-items:center;gap:4px;padding:2px 7px;border-radius:4px;font-size:11px;font-weight:500}
  .pv-ok{background:rgba(52,211,153,.10);color:#34D399}
  .pv-warn{background:rgba(251,191,36,.10);color:#FBBF24}
  .pv-dan{background:rgba(248,113,113,.10);color:#F87171}
  .pv-info{background:rgba(96,165,250,.10);color:#60A5FA}
  .pv-brand{background:rgba(108,99,255,.11);color:#6C63FF}
  .pv-neu{background:var(--surface2);color:var(--muted)}
  /* ===== END v5 ADDITIONS ===== */
