:root{
    --bg:#14161c;
    --surface:#1b1e27;
    --surface-2:#20232e;
    --border:#2a2e3a;
    --text:#edeff3;
    --muted:#8b90a0;
    --muted-2:#5c6070;
    --ember:#ff6b35;
    --ember-dim:#ff6b3522;
    --warm:#f2b84b;
    --cold:#5b9dd6;
    --win:#34d399;
    --border-hover:#3a3f4e;
    --radius:14px;
  }
  /* Tema claro — mesma identidade (laranja ember + Space Grotesk), só inverte a
     escala neutra. --warm/--cold/--win ficam um pouco mais escuros que no
     escuro: são usados como TEXTO em badge (ex: "Aguardando confirmação"),
     e a versão pastel original perde contraste em fundo branco. */
  :root[data-theme="light"]{
    --bg:#f7f5f1;
    --surface:#ffffff;
    --surface-2:#f2f0eb;
    --border:#e3e0d9;
    --text:#1c1e24;
    --muted:#6b7080;
    --muted-2:#9298a8;
    --ember:#ff6b35;
    --ember-dim:#ff6b3520;
    --warm:#b8860b;
    --cold:#3f7fb8;
    --win:#1f9d72;
    --border-hover:#c9c5ba;
  }
  *{box-sizing:border-box; margin:0; padding:0;}
  body{
    background:var(--bg);
    color:var(--text);
    font-family:'Inter',sans-serif;
    height:100vh;
    overflow:hidden;
    -webkit-font-smoothing:antialiased;
  }
  .shell{display:flex; height:100vh;}

  /* SIDEBAR */
  .sidebar{
    width:64px; flex-shrink:0; background:var(--surface);
    border-right:1px solid var(--border);
    display:flex; flex-direction:column; align-items:center;
    padding:calc(16px + env(safe-area-inset-top)) 0 16px env(safe-area-inset-left); gap:6px;
    overflow-y:auto; overflow-x:hidden;
  }
  .sidebar::-webkit-scrollbar{width:0; display:none;}
  .sidebar-fade{ display:none; }
  .side-mark-wrap{position:relative; margin-bottom:14px;}
  .side-mark{
    width:32px; height:32px; border-radius:9px;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center;
    font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:15px; color:#14161c;
  }
  .side-mark.clickable{cursor:pointer; transition:.15s;}
  .side-mark.clickable:hover{filter:brightness(1.1); transform:scale(1.04);}
  .sidebar-client-popover{
    display:none; position:fixed; top:16px; left:64px; width:280px;
    background:var(--surface); border:1px solid var(--border); border-radius:12px;
    box-shadow:0 16px 34px -10px rgba(0,0,0,.6); z-index:115; padding:12px;
  }
  .sidebar-client-popover.open{display:block;}
  .sidebar-client-popover-title{font-size:10.5px; font-weight:600; color:var(--muted); margin-bottom:8px; text-transform:uppercase; letter-spacing:.03em;}
  .sidebar-client-row{display:flex; align-items:center; gap:8px; padding:7px 8px; border-radius:8px; cursor:pointer;}
  .sidebar-client-row:hover{background:var(--surface-2);}
  .sidebar-client-popover-footer{margin-top:8px; padding-top:9px; border-top:1px solid var(--border); font-size:11.5px; color:var(--ember); cursor:pointer; text-align:center;}
  .sidebar-client-popover-footer:hover{text-decoration:underline;}
  .nav-item{
    width:42px; height:42px; border-radius:11px;
    display:flex; align-items:center; justify-content:center;
    color:var(--muted-2); cursor:pointer; position:relative;
    transition:.15s;
  }
  .nav-item:hover{color:var(--muted); background:var(--surface-2);}
  .nav-item.active{color:var(--ember); background:var(--ember-dim);}
  .nav-label{
    position:absolute; left:52px; top:50%; transform:translateY(-50%);
    background:var(--surface-2); border:1px solid var(--border);
    padding:4px 9px; border-radius:7px; font-size:11px; white-space:nowrap;
    opacity:0; pointer-events:none; transition:.15s; z-index:20;
  }
  .nav-item:hover .nav-label{opacity:1;}

  .app{display:flex; flex-direction:column; height:100vh; flex:1; min-width:0;}
  .view{display:none; flex-direction:column; flex:1; min-height:0;}
  .view.active{display:flex;}

  /* TOP BAR */
  .topbar{
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 22px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
    flex-shrink:0;
  }
  .brand{display:flex; align-items:center; gap:10px;}
  .brand-mark{
    width:30px; height:30px; border-radius:8px;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center;
    font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:15px; color:#14161c;
  }
  .brand-name{font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:19px; letter-spacing:-0.01em;}
  .brand-sub{font-size:11px; color:var(--muted-2); margin-left:8px; padding-left:8px; border-left:1px solid var(--border);}
  .topbar-right{display:flex; align-items:center; gap:16px;}
  .search{
    display:flex; align-items:center; gap:8px;
    background:var(--surface-2); border:1px solid var(--border);
    border-radius:10px; padding:7px 12px; width:220px;
  }
  .search input{background:none; border:none; outline:none; color:var(--text); font-size:13px; width:100%;}
  .search svg{flex-shrink:0; opacity:0.5;}
  .avatar{
    width:32px; height:32px; border-radius:50%;
    background:linear-gradient(135deg,#5b9dd6,#8b90a0);
    display:flex; align-items:center; justify-content:center;
    font-size:12px; font-weight:600;
  }

  .notif-bell-wrap{position:relative;}
  .notif-bell{
    position:relative; width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center;
    color:var(--muted); border:1px solid var(--border); background:var(--surface-2); cursor:pointer; transition:.15s;
  }
  .notif-bell:hover{color:var(--text); border-color:var(--border-hover);}
  .notif-bell-badge{
    position:absolute; top:-5px; right:-5px; min-width:16px; height:16px; padding:0 4px; border-radius:8px;
    background:var(--ember); color:#1a0e07; font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center;
  }
  .notif-popover{
    display:none; position:absolute; top:44px; right:0; width:300px; max-height:360px; overflow-y:auto; z-index:60;
    background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:10px; box-shadow:0 12px 32px rgba(0,0,0,.35);
  }
  .notif-popover.open{display:block;}
  .notif-popover-title{font-size:11.5px; font-weight:600; color:var(--muted); padding:4px 6px 8px;}
  .notif-popover-item{
    display:flex; align-items:center; gap:10px; padding:8px 6px; border-radius:8px; cursor:pointer; transition:.15s;
  }
  .notif-popover-item:hover{background:var(--surface-2);}
  .notif-popover-empty{font-size:12px; color:var(--muted-2); text-align:center; padding:20px 8px;}

  /* BOARD HEADER */
  .board-header{
    padding:18px 22px 4px;
    display:flex; align-items:baseline; justify-content:space-between;
    flex-shrink:0;
  }
  .board-title{font-family:'Space Grotesk',sans-serif; font-size:22px; font-weight:600;}
  .board-meta{font-size:12px; color:var(--muted); font-family:'JetBrains Mono',monospace;}

  /* BARRA DE ESTATÍSTICAS/FILTROS DO FUNIL */
  .kanban-toolbar{padding:10px 22px 0; flex-shrink:0;}
  .kanban-stat-tabs{display:flex; gap:6px; margin-bottom:8px;}
  .kanban-stat-tab{
    font-size:11.5px; padding:7px 12px; border-radius:8px; border:1px solid var(--border);
    color:var(--muted); cursor:pointer; display:flex; align-items:center; gap:6px;
  }
  .kanban-stat-tab:hover{background:var(--surface-2);}
  .kanban-stat-tab.active{background:var(--ember-dim); color:var(--ember); font-weight:600; border-color:var(--ember);}
  .kanban-stat-tab span{font-family:'JetBrains Mono',monospace; font-size:10.5px; opacity:.85;}
  .kanban-search-row{display:flex; gap:8px; align-items:center; margin-bottom:8px;}
  .kanban-visible-count{font-size:11px; color:var(--muted-2); font-family:'JetBrains Mono',monospace; white-space:nowrap; flex-shrink:0;}

  /* RESULTADO (ganho/perdido) NO CARD E NO DRAWER */
  .card-result-badge{
    font-size:10px; font-weight:700; width:16px; height:16px; border-radius:50%;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
  }
  .card-result-badge.won{background:#1f9d7222; color:#4ade80;}
  .card-result-badge.lost{background:#ef444422; color:#ef4444;}
  .drawer-result-actions{display:flex; gap:8px; padding:0 16px 12px; flex-wrap:wrap;}
  .drawer-result-btn{
    font-size:11px; padding:6px 11px; border-radius:8px; border:1px solid var(--border);
    color:var(--muted); cursor:pointer;
  }
  .drawer-result-btn:hover{background:var(--surface-2);}
  .drawer-result-btn.won:hover{border-color:#4ade80; color:#4ade80;}
  .drawer-result-btn.lost:hover{border-color:#ef4444; color:#ef4444;}
  .drawer-result-badge{
    font-size:11px; font-weight:600; padding:6px 11px; border-radius:8px;
  }
  .drawer-result-badge.won{background:#1f9d7222; color:#4ade80;}
  .drawer-result-badge.lost{background:#ef444422; color:#ef4444;}

  /* SELETOR DE PIPELINE (multi-kanban) */
  .pipeline-switcher{position:relative; display:flex; align-items:center; gap:6px; cursor:pointer; width:fit-content;}
  .pipeline-switcher svg{color:var(--muted); flex-shrink:0;}
  .pipeline-switcher:hover .board-title{color:var(--ember);}
  .pipeline-menu{
    display:none; position:absolute; top:100%; left:0; margin-top:8px; width:260px;
    background:var(--surface); border:1px solid var(--border); border-radius:12px;
    box-shadow:0 16px 34px -10px rgba(0,0,0,.6); z-index:20; padding:6px; overflow:hidden;
  }
  .pipeline-menu.open{display:block;}
  .pipeline-menu-item{
    display:flex; align-items:center; gap:8px; padding:9px 10px; border-radius:8px; cursor:pointer; font-size:12.5px;
  }
  .pipeline-menu-item:hover{background:var(--surface-2);}
  .pipeline-menu-item.active{background:var(--ember-dim); color:var(--ember); font-weight:600;}
  .pipeline-menu-add{
    display:flex; align-items:center; gap:8px; padding:9px 10px; border-radius:8px; cursor:pointer; font-size:12.5px;
    color:var(--ember); border-top:1px solid var(--border); margin-top:4px; padding-top:11px;
  }
  .pipeline-menu-add:hover{background:var(--ember-dim);}
  .pipeline-lock-badge{
    font-size:9px; background:var(--violet-dim); color:var(--violet); padding:1px 6px; border-radius:20px; margin-left:auto; font-weight:600;
  }

  .upsell-price{
    font-family:'Space Grotesk',sans-serif; font-size:32px; font-weight:600; color:var(--ember); text-align:center; margin:6px 0 2px;
  }
  .upsell-price span{font-size:13px; color:var(--muted); font-weight:400; font-family:'Inter',sans-serif;}
  .upsell-feat{display:flex; align-items:flex-start; gap:8px; font-size:12px; color:var(--muted); margin-bottom:8px; line-height:1.5;}
  .upsell-feat svg{color:var(--win); flex-shrink:0; margin-top:2px;}

  /* CONTAS DE WHATSAPP */
  .wa-account-card{
    background:var(--surface); border:1px solid var(--border); border-radius:14px;
    padding:18px; margin-bottom:14px; border-top:3px solid var(--win);
  }
  .wa-account-card.connecting{border-top-color:var(--warm);}
  .wa-account-card.disconnected{border-top-color:var(--muted-2);}
  .wa-account-head{display:flex; align-items:flex-start; gap:14px; margin-bottom:14px;}
  .wa-avatar{
    width:52px; height:52px; border-radius:50%; flex-shrink:0;
    background:linear-gradient(135deg, #25D366, #128C7E);
    display:flex; align-items:center; justify-content:center; font-size:20px;
  }
  .wa-account-name{font-size:14px; font-weight:600;}
  .wa-account-phone{font-size:11.5px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:2px;}
  .wa-status-badge{
    display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:600;
    padding:2px 9px; border-radius:20px; margin-top:6px;
  }
  .wa-status-badge.connected{background:#25D36622; color:#25D366;}
  .wa-status-badge.connecting{background:var(--ember-dim); color:var(--warm);}
  .wa-status-badge.disconnected{background:var(--surface-2); color:var(--muted-2);}
  .wa-status-dot{width:6px; height:6px; border-radius:50%; background:currentColor;}
  .wa-mode-tag{font-size:9.5px; color:var(--muted-2); background:var(--surface-2); padding:2px 8px; border-radius:20px; margin-left:6px;}

  .wa-rows{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:12px;}
  .wa-row-item{
    background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:11px 13px;
    display:flex; align-items:center; justify-content:space-between; gap:10px;
  }
  .wa-row-label{font-size:12px; display:flex; flex-direction:column; gap:2px;}
  .wa-row-label span.sub{font-size:10px; color:var(--muted-2); font-weight:400;}
  .wa-quota-track{height:8px; background:var(--surface-2); border-radius:5px; overflow:hidden; margin:8px 0 4px;}
  .wa-quota-fill{height:100%; background:#25D366; border-radius:5px;}
  .wa-actions{display:flex; gap:8px; margin-top:12px; flex-wrap:wrap;}

  .qr-box{
    width:220px; height:220px; margin:0 auto; border-radius:14px; background:#fff;
    display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden;
  }
  .qr-box svg{width:100%; height:100%;}
  .qr-scan-line{
    position:absolute; left:6%; width:88%; height:3px; background:#25D366; box-shadow:0 0 12px 2px #25D366;
    animation:qr-scan 2.2s ease-in-out infinite;
  }
  @keyframes qr-scan{0%{top:6%;} 50%{top:92%;} 100%{top:6%;}}
  .wa-mode-picker{display:flex; gap:8px; margin-bottom:16px;}
  .wa-mode-opt{
    flex:1; border:1px solid var(--border); border-radius:10px; padding:12px; cursor:pointer; text-align:center; transition:.15s;
  }
  .wa-mode-opt.selected{border-color:#25D366; background:#25D36618;}
  .wa-mode-opt-title{font-size:12px; font-weight:600;}
  .wa-mode-opt-sub{font-size:10px; color:var(--muted-2); margin-top:2px;}

  /* REMARKETING */
  .rmk-campaign-card{
    background:var(--surface); border:1px solid var(--border); border-radius:14px;
    padding:16px 18px; margin-bottom:12px;
  }
  .rmk-campaign-head{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:10px;}
  .rmk-campaign-name{font-size:13.5px; font-weight:600;}
  .rmk-campaign-meta{font-size:11px; color:var(--muted); margin-top:3px;}
  .rmk-status{font-size:9.5px; font-weight:600; padding:3px 10px; border-radius:20px; flex-shrink:0;}
  .rmk-status.rascunho{background:var(--surface-2); color:var(--muted);}
  .rmk-status.agendada{background:var(--violet-dim); color:var(--violet);}
  .rmk-status.enviando{background:var(--ember-dim); color:var(--warm);}
  .rmk-status.concluida{background:#25D36622; color:#25D366;}
  .rmk-stats{display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:12px;}
  .rmk-stat{background:var(--surface-2); border-radius:9px; padding:9px; text-align:center;}
  .rmk-stat-num{font-family:'Space Grotesk',sans-serif; font-size:17px; font-weight:600;}
  .rmk-stat-label{font-size:9.5px; color:var(--muted-2); margin-top:2px;}
  .rmk-progress-track{height:6px; background:var(--surface-2); border-radius:4px; overflow:hidden; margin-top:10px;}
  .rmk-progress-fill{height:100%; background:#25D366; border-radius:4px; transition:width .3s;}

  .rmk-audience-box{
    background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:12px; margin-bottom:14px;
  }
  .rmk-audience-count{
    display:flex; align-items:center; justify-content:space-between; font-size:12.5px; font-weight:600;
    padding-top:10px; margin-top:10px; border-top:1px solid var(--border);
  }
  .rmk-audience-count b{color:var(--ember); font-family:'Space Grotesk',sans-serif; font-size:18px;}
  .legend{display:flex; gap:14px; margin-top:2px;}
  .legend-item{display:flex; align-items:center; gap:5px; font-size:11px; color:var(--muted);}
  .dot{width:7px; height:7px; border-radius:50%;}

  /* BOARD */
  .board{
    flex:1;
    display:flex;
    gap:14px;
    padding:16px 22px 22px;
    overflow-x:auto;
    overflow-y:hidden;
  }
  .column{
    min-width:270px;
    max-width:270px;
    display:flex;
    flex-direction:column;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    overflow:hidden;
  }
  .col-head{
    padding:12px 14px 10px;
    display:flex; align-items:center; justify-content:space-between;
    border-bottom:1px solid var(--border);
  }
  .col-title{font-size:13px; font-weight:600;}
  .col-count{
    font-size:11px; color:var(--muted); font-family:'JetBrains Mono',monospace;
    background:var(--surface-2); padding:2px 7px; border-radius:20px;
  }
  .col-body{
    flex:1; overflow-y:auto; padding:10px; display:flex; flex-direction:column; gap:8px;
  }
  .col-body::-webkit-scrollbar{width:5px;}
  .col-body::-webkit-scrollbar-thumb{background:var(--border); border-radius:10px;}

  .card{
    background:var(--surface-2);
    border:1px solid var(--border);
    border-radius:10px;
    padding:11px 12px;
    cursor:pointer;
    transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    touch-action:manipulation;
    user-select:none;
    -webkit-user-select:none;
  }
  .card:hover{
    transform:translateY(-2px);
    border-color:var(--border-hover);
    box-shadow:0 8px 20px -8px rgba(0,0,0,0.5);
  }
  .card-top{display:flex; align-items:center; justify-content:between; gap:8px; margin-bottom:7px;}
  .card-name{font-size:13px; font-weight:600; flex:1;}
  .temp{width:8px; height:8px; border-radius:50%; flex-shrink:0;}
  .card-msg{font-size:12px; color:var(--muted); line-height:1.4; margin-bottom:8px;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;}
  .card-foot{display:flex; align-items:center; justify-content:space-between;}
  .tag{
    font-size:10px; padding:2px 7px; border-radius:5px;
    background:var(--ember-dim); color:var(--ember); font-weight:500;
  }
  .card-time{font-size:10px; color:var(--muted-2); font-family:'JetBrains Mono',monospace;}
  .unread{
    width:16px; height:16px; border-radius:50%; background:var(--ember);
    font-size:9px; color:#14161c; font-weight:700; display:flex; align-items:center; justify-content:center;
  }

  .add-card{
    padding:9px; text-align:center; font-size:12px; color:var(--muted-2);
    border:1px dashed var(--border); border-radius:10px; cursor:pointer;
  }
  .add-card:hover{color:var(--muted); border-color:var(--muted-2);}

  .card.dragging{opacity:0.35;}
  .col-body.drag-over{background:var(--ember-dim); outline:2px dashed var(--ember); outline-offset:-4px; border-radius:10px;}

  .automation-badge{
    display:flex; align-items:center; gap:4px; font-size:9.5px; color:var(--ember);
    background:var(--ember-dim); padding:2px 7px; border-radius:20px; font-weight:500;
    margin-top:4px; width:fit-content; cursor:pointer; transition:.12s;
  }
  .automation-badge:hover{filter:brightness(1.15);}

  /* TOAST */
  .toast-wrap{position:fixed; bottom:22px; left:50%; transform:translateX(-50%); z-index:120; display:flex; flex-direction:column; gap:8px; align-items:center;}
  .toast{
    display:flex; align-items:center; gap:10px;
    background:var(--surface); border:1px solid var(--border);
    box-shadow:0 12px 30px -8px rgba(0,0,0,0.6);
    padding:10px 16px; border-radius:12px; font-size:12.5px;
    opacity:0; transform:translateY(12px); transition:all .3s cubic-bezier(.2,.8,.2,1);
    max-width:340px;
  }
  .toast.show{opacity:1; transform:translateY(0);}
  .toast-icon{
    width:26px; height:26px; border-radius:50%; background:var(--ember-dim);
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
  }
  .toast b{color:var(--text);}
  .toast span.muted{color:var(--muted); display:block; font-size:11px; margin-top:1px;}

  /* AGENDA VIEW */
  .page-head{padding:18px 22px 4px; flex-shrink:0;}
  .page-title{font-family:'Space Grotesk',sans-serif; font-size:22px; font-weight:600;}
  .page-sub{font-size:12px; color:var(--muted); margin-top:2px;}
  .page-body{flex:1; overflow-y:auto; padding:16px 22px 30px;}

  .agenda-grid{display:grid; grid-template-columns:340px 1fr; gap:16px; align-items:start;}
  .panel{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px;}
  .panel-title{font-size:13px; font-weight:600; margin-bottom:12px; display:flex; align-items:center; justify-content:space-between;}

  .mini-cal{display:grid; grid-template-columns:repeat(7,1fr); gap:4px;}
  .mini-cal .dow{font-size:10px; color:var(--muted-2); text-align:center; padding-bottom:6px; font-family:'JetBrains Mono',monospace;}
  .mini-cal .day{
    aspect-ratio:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
    border-radius:8px; font-size:12px; color:var(--muted); cursor:pointer; position:relative;
  }
  .mini-cal .day:hover{background:var(--surface-2);}
  .mini-cal .day.today{background:var(--ember); color:#1a0e07; font-weight:700;}
  .mini-cal .day.has-appt::after{
    content:''; width:4px; height:4px; border-radius:50%; background:var(--ember); position:absolute; bottom:5px;
  }
  .mini-cal .day.today.has-appt::after{background:#1a0e07;}
  .mini-cal .day.empty{visibility:hidden;}
  .mini-cal .day.selected{outline:2px solid var(--ember); outline-offset:-2px;}

  .notif-toggle{display:flex; align-items:center; justify-content:space-between; padding:9px 0; border-top:1px solid var(--border); font-size:12.5px; gap:10px;}
  .notif-toggle span:first-child{flex:1; min-width:0;}
  .notif-toggle:first-of-type{border-top:none;}
  .switch{width:34px; height:19px; border-radius:20px; background:var(--surface-2); border:1px solid var(--border); position:relative; cursor:pointer; flex-shrink:0;}
  .switch.on{background:var(--ember); border-color:var(--ember);}
  .switch::after{content:''; width:14px; height:14px; border-radius:50%; background:#fff; position:absolute; top:2px; left:2px; transition:.2s;}
  .switch.on::after{left:17px;}

  .appt-list{display:flex; flex-direction:column; gap:10px;}
  .appt-card{
    background:var(--surface); border:1px solid var(--border); border-radius:12px;
    padding:13px 15px; display:flex; align-items:center; gap:13px;
  }
  .appt-time{
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    width:52px; flex-shrink:0; font-family:'JetBrains Mono',monospace;
  }
  .appt-time b{font-size:15px;}
  .appt-time span{font-size:9px; color:var(--muted-2);}
  .appt-divider{width:1px; align-self:stretch; background:var(--border);}
  .appt-info{flex:1; min-width:0;}
  .appt-name{font-size:13px; font-weight:600;}
  .appt-proc{font-size:11.5px; color:var(--muted); margin-top:1px;}
  .appt-status{
    font-size:10px; padding:3px 9px; border-radius:20px; font-weight:600; flex-shrink:0;
  }
  .appt-status.confirmado{background:#34d39922; color:var(--win);}
  .appt-status.pendente{background:var(--ember-dim); color:var(--ember);}
  .appt-wa{
    width:30px; height:30px; border-radius:8px; background:var(--surface-2);
    display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0; color:var(--muted);
  }
  .appt-wa:hover{color:var(--ember); background:var(--ember-dim);}
  .appt-actions{display:flex; gap:5px; flex-shrink:0;}

  .feed-item{display:flex; gap:10px; padding:9px 0; border-top:1px solid var(--border); font-size:12px;}
  .feed-item:first-child{border-top:none;}
  .feed-dot{width:6px; height:6px; border-radius:50%; background:var(--ember); margin-top:5px; flex-shrink:0;}
  .feed-item span.time{display:block; color:var(--muted-2); font-size:10px; margin-top:2px; font-family:'JetBrains Mono',monospace;}

  /* IA VIEW */
  .ia-grid{display:grid; grid-template-columns:1fr 340px; gap:16px; align-items:start;}
  .field-label{font-size:11.5px; color:var(--muted); margin-bottom:6px; display:block; font-weight:500;}
  .field-input, .field-select, .field-textarea{
    width:100%; background:var(--surface-2); border:1px solid var(--border); border-radius:9px;
    padding:9px 12px; font-size:13px; color:var(--text); outline:none; font-family:'Inter',sans-serif;
  }
  .field-input:focus, .field-select:focus, .field-textarea:focus{border-color:var(--ember);}
  .field-textarea{resize:vertical; line-height:1.5;}
  .field-group{margin-bottom:14px;}
  .field-row{display:flex; gap:10px;}
  .field-row > div{flex:1;}
  .key-input-wrap{position:relative;}
  .key-toggle{position:absolute; right:10px; top:50%; transform:translateY(-50%); cursor:pointer; color:var(--muted); font-size:11px;}
  .key-status{display:flex; align-items:center; gap:6px; font-size:11px; color:var(--win); margin-top:6px;}
  .key-status .dot{width:6px; height:6px; border-radius:50%; background:var(--win);}

  .stage-toggle-row{display:flex; align-items:center; justify-content:space-between; padding:9px 0; border-top:1px solid var(--border);}
  .stage-toggle-row:first-of-type{border-top:none;}
  .stage-toggle-row .name{font-size:12.5px;}

  .btn-primary{
    background:var(--ember); color:#1a0e07; border:none; border-radius:9px;
    padding:10px 18px; font-size:13px; font-weight:600; cursor:pointer;
  }
  .btn-primary:hover{filter:brightness(1.08);}
  .btn-secondary{
    background:none; color:var(--muted); border:1px solid var(--border); border-radius:9px;
    padding:10px 18px; font-size:13px; font-weight:600; cursor:pointer;
  }
  .btn-secondary:hover{color:var(--text); border-color:var(--muted-2);}

  /* MODAL */
  .modal-overlay{
    position:fixed; inset:0; background:rgba(10,11,14,0.6);
    display:flex; align-items:center; justify-content:center;
    opacity:0; pointer-events:none; transition:opacity .2s ease; z-index:110; padding:20px;
  }
  .modal-overlay.open{opacity:1; pointer-events:auto;}
  .modal{
    background:var(--surface); border:1px solid var(--border); border-radius:16px;
    width:420px; max-width:100%; max-height:88vh; overflow-y:auto;
    transform:translateY(14px); transition:transform .2s ease;
  }
  .modal-overlay.open .modal{transform:translateY(0);}
  .modal-head{
    display:flex; align-items:center; justify-content:space-between;
    padding:16px 18px; border-bottom:1px solid var(--border);
  }
  .modal-title{font-family:'Space Grotesk',sans-serif; font-size:16px; font-weight:600;}
  .modal-close{cursor:pointer; color:var(--muted); display:flex;}
  .modal-close:hover{color:var(--text);}
  .modal-body{padding:18px;}
  .modal-foot{display:flex; justify-content:flex-end; gap:8px; padding:14px 18px; border-top:1px solid var(--border);}

  .seq-step{display:flex; gap:8px; padding:11px 0; border-top:1px solid var(--border);}
  .seq-step:first-of-type{border-top:none; padding-top:4px;}
  .seq-step-num{
    width:20px; height:20px; border-radius:50%; background:var(--ember-dim); color:var(--ember);
    font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:2px;
  }
  .seq-step-body{flex:1;}

  .col-row{display:flex; align-items:center; gap:8px; padding:8px 0; border-top:1px solid var(--border);}
  .col-row:first-of-type{border-top:none;}
  .col-row-arrows{display:flex; flex-direction:column; gap:2px; flex-shrink:0;}
  .col-row-arrow{
    width:18px; height:14px; display:flex; align-items:center; justify-content:center;
    color:var(--muted-2); cursor:pointer; font-size:10px; border-radius:3px;
  }
  .col-row-arrow:hover{color:var(--ember); background:var(--ember-dim);}
  .col-row-count{font-size:10px; color:var(--muted-2); font-family:'JetBrains Mono',monospace; white-space:nowrap; flex-shrink:0;}
  .rem-del.disabled{opacity:.3; cursor:not-allowed;}

  .qr-row{display:flex; align-items:center; gap:10px; padding:9px 0; border-top:1px solid var(--border);}
  .qr-row:first-of-type{border-top:none;}
  .qr-row-icon{width:28px; height:28px; border-radius:8px; background:var(--surface-2); display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0;}
  .qr-row-body{flex:1; min-width:0;}
  .qr-row-label{font-size:12px; font-weight:600;}
  .qr-row-preview{font-size:11px; color:var(--muted); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}

  .ia-test{display:flex; flex-direction:column; height:420px;}
  .ia-test-thread{flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:8px; margin-bottom:10px;}
  .ia-test-input{display:flex; gap:6px;}

  /* AGENTES (multi-agente) */
  .agent-tabs{display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap;}
  .agent-tab{
    display:flex; align-items:center; gap:9px; padding:9px 13px; border-radius:12px;
    border:1px solid var(--border); background:var(--surface); cursor:pointer; transition:.15s;
  }
  .agent-tab:hover{border-color:var(--border-hover);}
  .agent-tab.selected{border-color:var(--ember); background:var(--ember-dim);}
  .agent-tab-icon{
    width:30px; height:30px; border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0;
  }
  .agent-tab-name{font-size:12.5px; font-weight:600;}
  .agent-tab-role{font-size:10px; color:var(--muted); margin-top:1px;}
  .agent-tab-status{width:7px; height:7px; border-radius:50%; background:var(--win); flex-shrink:0; margin-left:2px;}
  .agent-tab-status.off{background:var(--muted-2);}
  .agent-tab-add{
    display:flex; align-items:center; gap:7px; padding:9px 14px; border-radius:12px;
    border:1px dashed var(--border); cursor:pointer; color:var(--muted); font-size:12px;
  }
  .agent-tab-add:hover{color:var(--ember); border-color:var(--ember);}

  .agent-subtabs{display:flex; gap:6px; margin-bottom:14px;}
  .agent-subtab{
    padding:7px 16px; border-radius:9px; font-size:12px; font-weight:600; color:var(--muted);
    border:1px solid var(--border); background:var(--surface); cursor:pointer; transition:.15s;
  }
  .agent-subtab:hover{color:var(--text);}
  .agent-subtab.selected{border-color:var(--ember); background:var(--ember-dim); color:var(--ember);}

  .routing-row{
    display:flex; align-items:flex-start; gap:9px; padding:10px 0; border-top:1px solid var(--border);
  }
  .routing-row:first-of-type{border-top:none;}
  .routing-agent-icon{width:26px; height:26px; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:12px; flex-shrink:0; margin-top:2px;}
  .routing-body{flex:1;}
  .routing-agent-name{font-size:12px; font-weight:600; margin-bottom:4px;}
  .routing-keywords{width:100%; background:var(--surface-2); border:1px solid var(--border); border-radius:7px; padding:6px 9px; font-size:11.5px; color:var(--text);}

  /* EQUIPE */
  .member-row{
    display:flex; align-items:center; gap:12px; padding:12px 0; border-top:1px solid var(--border);
  }
  .member-row:first-of-type{border-top:none;}
  .member-avatar{
    width:38px; height:38px; border-radius:50%; flex-shrink:0;
    background:linear-gradient(135deg, var(--cold), var(--muted-2));
    display:flex; align-items:center; justify-content:center; font-weight:600; font-size:13px; color:#fff;
  }
  .member-body{flex:1; min-width:0;}
  .member-name{font-size:13px; font-weight:600; display:flex; align-items:center; gap:7px; flex-wrap:wrap;}
  .member-email{font-size:11.5px; color:var(--muted); margin-top:1px;}
  .role-badge{font-size:9.5px; padding:2px 8px; border-radius:20px; font-weight:600;}
  .role-badge.admin{background:var(--ember-dim); color:var(--ember);}
  .role-badge.gestor{background:var(--violet-dim); color:var(--violet);}
  .role-badge.atendente{background:#5b9dd622; color:var(--cold);}
  .member-status{font-size:9.5px; padding:2px 8px; border-radius:20px; background:var(--surface-2); color:var(--muted);}
  .member-status.pending{background:var(--ember-dim); color:var(--warm);}
  .member-status.active{background:#1f9d7222; color:var(--win);}
  .member-actions{display:flex; gap:4px; flex-shrink:0;}

  /* FATURAMENTO */
  .billing-grid{display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px;}
  .plan-name{font-family:'Space Grotesk',sans-serif; font-size:20px; font-weight:600;}
  .plan-price{font-size:13px; color:var(--muted); margin-top:2px;}
  .plan-price b{color:var(--text); font-size:16px;}
  .seats-track{height:9px; background:var(--surface-2); border-radius:5px; overflow:hidden; margin:10px 0 6px;}
  .seats-fill{height:100%; background:var(--ember); border-radius:5px;}
  .card-visual{
    background:linear-gradient(135deg, #1f2430, #14161c); border:1px solid var(--border); border-radius:12px;
    padding:16px; font-family:'JetBrains Mono',monospace; margin-bottom:10px;
  }
  .card-visual .num{font-size:15px; letter-spacing:2px; margin-bottom:10px;}
  .card-visual .meta{display:flex; justify-content:space-between; font-size:10px; color:var(--muted);}
  .invoice-row{display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--border); font-size:12px;}
  .invoice-row:first-of-type{border-top:none;}
  .invoice-status{font-size:9.5px; padding:2px 8px; border-radius:20px; flex-shrink:0;}
  .invoice-status.pago{background:#34d39922; color:var(--win);}
  .invoice-status.pendente{background:var(--ember-dim); color:var(--warm);}
  .plan-tier{
    border:1px solid var(--border); border-radius:12px; padding:14px; cursor:pointer; transition:.15s;
  }
  .plan-tier:hover{border-color:var(--border-hover);}
  .plan-tier.current{border-color:var(--ember); background:var(--ember-dim);}
  .plan-tier-name{font-size:13px; font-weight:700;}
  .plan-tier-price{font-family:'Space Grotesk',sans-serif; font-size:22px; font-weight:600; margin:4px 0;}
  .plan-tier-feat{font-size:11px; color:var(--muted); line-height:1.6;}
  .plan-tiers-grid{grid-template-columns:1fr 1fr 1fr;}

  /* LOGIN / DEFINIR SENHA */
  .login-screen{
    position:fixed; inset:0; z-index:100; background:var(--bg);
    display:none; align-items:center; justify-content:center; padding:20px;
    background-image:radial-gradient(circle at 30% 20%, #ff6b3512, transparent 50%), radial-gradient(circle at 80% 80%, #a78bfa10, transparent 50%);
  }
  .login-screen.open{display:flex;}
  .login-card{width:360px; max-width:100%;}
  .login-mark{
    width:44px; height:44px; border-radius:12px; margin:0 auto 16px;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center;
    font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:20px; color:#14161c;
  }
  .login-title{font-family:'Space Grotesk',sans-serif; font-size:22px; font-weight:600; text-align:center;}
  .login-sub{font-size:12px; color:var(--muted); text-align:center; margin-top:4px; margin-bottom:26px;}
  .login-tenant{
    display:flex; align-items:center; justify-content:center; gap:6px; font-size:11px; color:var(--muted-2);
    margin-bottom:22px; padding-bottom:18px; border-bottom:1px solid var(--border);
  }
  .login-field{margin-bottom:14px;}
  .login-forgot{display:block; text-align:right; font-size:11px; color:var(--muted); margin-top:6px; cursor:pointer;}
  .login-forgot:hover{color:var(--ember);}
  .login-btn{
    width:100%; background:var(--ember); color:#1a0e07; border:none; border-radius:9px;
    padding:12px; font-size:13px; font-weight:700; cursor:pointer; margin-top:6px;
  }
  .login-btn:hover{filter:brightness(1.08);}
  .login-switch{text-align:center; font-size:11.5px; color:var(--muted); margin-top:18px;}
  .login-switch a{color:var(--ember); cursor:pointer; font-weight:600;}
  .sidebar-login-trigger{
    margin-top:auto; width:38px; height:38px; border-radius:11px;
    display:flex; align-items:center; justify-content:center; color:var(--muted-2); cursor:pointer;
  }
  .sidebar-login-trigger:hover{color:var(--ember); background:var(--ember-dim);}

  .impersonate-banner{
    position:fixed; top:0; left:0; right:0; z-index:30; height:38px;
    background:var(--violet); color:#fff; align-items:center; justify-content:center; gap:14px;
    font-size:12px; padding:0 16px;
  }

  /* SUPER ADMIN (FalconAds) — gerencia os clientes/tenants do white-label */
  .superadmin-screen{
    position:fixed; inset:0; z-index:100; background:var(--bg); display:none; flex-direction:column;
  }
  .superadmin-screen.open{display:flex;}
  .sa-topbar{
    padding:16px 24px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; flex-shrink:0;
  }
  .sa-badge{
    background:var(--violet-dim); color:var(--violet); font-size:10px; font-weight:700; padding:3px 9px; border-radius:20px;
    letter-spacing:.03em;
  }
  .sa-body{flex:1; overflow-y:auto; padding:22px 24px;}
  .sa-client-row{
    display:flex; align-items:center; gap:14px; padding:14px 16px;
    background:var(--surface); border:1px solid var(--border); border-radius:12px; margin-bottom:10px;
  }
  .sa-client-mark{
    width:38px; height:38px; border-radius:10px; flex-shrink:0;
    background:linear-gradient(135deg, var(--cold), var(--violet));
    display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; color:#fff;
  }
  .sa-client-body{flex:1; min-width:0;}
  .sa-client-name{font-size:13.5px; font-weight:600;}
  .sa-client-domain{font-size:11px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:1px;}
  .sa-client-meta{font-size:10.5px; color:var(--muted-2); margin-top:3px;}

  /* CONTATOS */
  .contacts-table{width:100%; border-collapse:collapse; font-size:12px;}
  .contacts-table thead th{
    text-align:left; font-size:10.5px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted-2);
    padding:8px 10px; border-bottom:1px solid var(--border); white-space:nowrap;
  }
  .contacts-table tbody td{
    padding:10px; border-bottom:1px solid var(--border); white-space:nowrap; color:var(--text);
  }
  .contacts-table tbody tr:hover{background:var(--surface-2);}
  .contacts-table tbody tr:last-child td{border-bottom:none;}

  /* MARCA / WHITE-LABEL */
  .brand-grid{display:grid; grid-template-columns:1fr 1fr; gap:16px;}
  .logo-upload-box{
    width:100%; aspect-ratio:2.5; border:1.5px dashed var(--border); border-radius:12px;
    display:flex; align-items:center; justify-content:center; cursor:pointer; overflow:hidden;
    background:var(--surface-2); transition:.15s;
  }
  .logo-upload-box:hover{border-color:var(--ember);}
  .logo-upload-box img{max-width:100%; max-height:100%; object-fit:contain;}
  .favicon-upload-box{
    width:56px; height:56px; border:1.5px dashed var(--border); border-radius:10px;
    display:flex; align-items:center; justify-content:center; cursor:pointer; overflow:hidden;
    background:var(--surface-2); flex-shrink:0;
  }
  .favicon-upload-box:hover{border-color:var(--ember);}
  .favicon-upload-box img{max-width:100%; max-height:100%; object-fit:contain;}
  .color-swatch-row{display:flex; align-items:center; gap:10px;}
  .color-swatch-row input[type=color]{
    width:38px; height:38px; border-radius:9px; border:1px solid var(--border); background:none; cursor:pointer; padding:2px;
  }
  .domain-row{display:flex; gap:8px;}
  .cname-box{
    background:var(--surface-2); border:1px solid var(--border); border-radius:9px; padding:10px 12px;
    font-family:'JetBrains Mono',monospace; font-size:11px; display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px;
  }
  .copy-btn{color:var(--muted); cursor:pointer; flex-shrink:0;}
  .copy-btn:hover{color:var(--ember);}

  /* REMINDER RULE BUILDER */
  .panel-subtitle{font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted-2); margin:14px 0 8px; font-weight:600;}
  .panel-subtitle:first-of-type{margin-top:0;}
  .reminder-row{display:flex; align-items:center; gap:6px; margin-bottom:7px;}
  .reminder-row .field-input, .reminder-row .field-select{padding:7px 9px; font-size:12px;}
  .rem-value{width:52px; flex-shrink:0; text-align:center;}
  .rem-unit{flex:1;}
  .rem-target{flex:1;}
  .rem-del{
    width:26px; height:26px; border-radius:7px; flex-shrink:0; display:flex; align-items:center; justify-content:center;
    color:var(--muted-2); cursor:pointer;
  }
  .rem-del:hover{color:var(--ember); background:var(--ember-dim);}
  .add-reminder{
    font-size:11.5px; color:var(--ember); cursor:pointer; display:flex; align-items:center; gap:5px;
    margin-top:4px; font-weight:500;
  }
  .add-reminder:hover{opacity:0.8;}

  /* DASHBOARD */
  .kpi-row{display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:16px;}
  .kpi-card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:15px 16px;}
  .kpi-label{font-size:11px; color:var(--muted); margin-bottom:8px;}
  .kpi-value{font-family:'Space Grotesk',sans-serif; font-size:26px; font-weight:600;}
  .kpi-delta{font-size:11px; margin-top:5px; display:flex; align-items:center; gap:4px;}
  .kpi-delta.up{color:var(--win);}
  .kpi-delta.down{color:#ef4444;}

  .dash-grid{display:grid; grid-template-columns:1.4fr 1fr; gap:16px; align-items:start; margin-bottom:16px;}

  .funnel-row{display:flex; align-items:center; gap:10px; margin-bottom:10px;}
  .funnel-label{width:100px; flex-shrink:0; font-size:12px; color:var(--muted);}
  .funnel-bar-track{flex:1; height:26px; background:var(--surface-2); border-radius:7px; overflow:hidden; position:relative;}
  .funnel-bar-fill{height:100%; border-radius:7px; display:flex; align-items:center; padding:0 10px; font-size:11px; font-weight:600; color:#1a0e07;}
  .funnel-conv{width:44px; flex-shrink:0; text-align:center; font-size:10.5px; color:var(--muted-2); font-family:'JetBrains Mono',monospace;}

  .origin-row{display:flex; align-items:center; gap:10px; margin-bottom:9px; font-size:12px;}
  .origin-label{width:86px; flex-shrink:0; color:var(--muted);}
  .origin-track{flex:1; height:9px; background:var(--surface-2); border-radius:5px; overflow:hidden;}
  .origin-fill{height:100%; background:var(--ember); border-radius:5px;}
  .origin-val{width:30px; flex-shrink:0; text-align:right; font-family:'JetBrains Mono',monospace; font-size:11px; color:var(--muted);}

  .temp-bar{display:flex; height:14px; border-radius:7px; overflow:hidden; margin:10px 0 10px;}
  .temp-legend{display:flex; gap:16px;}

  .msg-chart{display:flex; align-items:flex-end; gap:8px; height:130px; padding-top:10px;}
  .msg-col{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:2px;}
  .msg-seg{width:100%; border-radius:3px;}
  .msg-day-label{font-size:9.5px; color:var(--muted-2); margin-top:6px; font-family:'JetBrains Mono',monospace;}
  .msg-legend{display:flex; gap:14px; margin-top:14px; justify-content:center;}

  /* CHAT VIEW (full page) */
  .chat-shell{flex:1; display:flex; min-height:0;}

  .chat-list{width:290px; flex-shrink:0; border-right:1px solid var(--border); overflow-y:auto; background:var(--surface);}
  .chat-list-search{padding:12px; border-bottom:1px solid var(--border); position:sticky; top:0; background:var(--surface);}
  .chat-item{
    display:flex; gap:10px; padding:11px 14px; cursor:pointer; border-bottom:1px solid var(--border);
    align-items:flex-start; transition:.12s;
  }
  .chat-item:hover{background:var(--surface-2);}
  .chat-item.active{background:var(--ember-dim); border-left:2px solid var(--ember);}
  .chat-item-avatar{
    width:36px; height:36px; border-radius:50%; flex-shrink:0;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center; font-weight:600; font-size:12px; color:#14161c;
  }
  .chat-item-body{flex:1; min-width:0;}
  .chat-item-top{display:flex; align-items:center; justify-content:space-between; gap:6px;}
  .chat-item-name{font-size:12.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .chat-item-time{font-size:9.5px; color:var(--muted-2); flex-shrink:0; font-family:'JetBrains Mono',monospace;}
  .chat-item-msg{font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px;}
  .chat-item-foot{display:flex; align-items:center; gap:6px; margin-top:5px;}

  .chat-tabs{
    display:flex; gap:4px; padding:10px 12px; border-bottom:1px solid var(--border);
    position:sticky; top:0; background:var(--surface); z-index:2;
  }
  .chat-tab{
    flex:1; text-align:center; font-size:11px; padding:7px 6px; border-radius:8px;
    color:var(--muted); cursor:pointer; display:flex; align-items:center; justify-content:center; gap:5px;
  }
  .chat-tab:hover{background:var(--surface-2);}
  .chat-tab.active{background:var(--ember-dim); color:var(--ember); font-weight:600;}
  .chat-tab-count{
    background:var(--ember); color:#1a0e07; font-size:9px; font-weight:700;
    padding:1px 6px; border-radius:20px; min-width:14px;
  }
  .chat-search-row{display:flex; gap:6px; padding:9px 12px; border-bottom:1px solid var(--border);}
  .chat-search-row .field-input{flex:1;}
  #chatFilterBtn{position:relative; flex-shrink:0;}
  .chat-filter-dot{position:absolute; top:5px; right:5px; width:6px; height:6px; border-radius:50%; background:var(--ember);}
  .chat-filters-panel{padding:12px; border-bottom:1px solid var(--border); background:var(--surface-2);}
  .chat-filter-chips{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:4px;}
  .chat-filter-chip{
    font-size:10.5px; padding:5px 10px; border-radius:20px; border:1px solid var(--border);
    background:var(--surface); color:var(--muted); cursor:pointer; transition:.12s;
  }
  .chat-filter-chip.selected{border-color:var(--ember); background:var(--ember-dim); color:var(--ember); font-weight:600;}
  .chat-item{position:relative;}
  .chat-item-archive{
    position:absolute; top:9px; right:10px; width:22px; height:22px; border-radius:6px;
    display:flex; align-items:center; justify-content:center; color:var(--muted-2); cursor:pointer;
  }
  .chat-item-archive:hover{color:var(--ember); background:var(--ember-dim);}
  .chat-item-pin{
    position:absolute; top:9px; right:36px; width:22px; height:22px; border-radius:6px;
    display:flex; align-items:center; justify-content:center; color:var(--muted-2); cursor:pointer;
  }
  .chat-item-pin:hover{color:var(--ember); background:var(--ember-dim);}
  .chat-item-pin.pinned{color:var(--ember);}
  .chat-item.is-pinned{background:var(--ember-dim);}
  .pin-badge{
    display:inline-flex; align-items:center; margin-right:3px; color:var(--ember); flex-shrink:0;
  }

  .pinned-bar{
    display:flex; flex-direction:column; gap:4px; padding:8px 14px;
    background:var(--ember-dim); border-bottom:1px solid var(--border);
  }
  .pinned-bar-title{font-size:9.5px; text-transform:uppercase; letter-spacing:.03em; color:var(--ember); font-weight:700; margin-bottom:2px;}
  .pinned-bar-item{
    display:flex; align-items:center; gap:8px; font-size:11.5px; color:var(--text);
    background:var(--surface); border-radius:8px; padding:6px 9px; cursor:pointer;
  }
  .pinned-bar-item:hover{background:var(--surface-2);}
  .pinned-bar-text{flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .pinned-bar-unpin{color:var(--muted-2); flex-shrink:0; display:flex;}
  .pinned-bar-unpin:hover{color:var(--ember);}
  .chat-item-empty{padding:30px 16px; text-align:center; font-size:12px; color:var(--muted-2); line-height:1.6;}
  .chat-item-stage{font-size:9px; color:var(--muted-2); background:var(--surface-2); padding:1px 7px; border-radius:20px;}

  .chat-main{flex:1; display:flex; flex-direction:column; min-width:0; background:var(--bg);}
  .chat-main-head{
    padding:13px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; flex-shrink:0;
  }
  .chat-main-avatar{
    width:38px; height:38px; border-radius:50%; flex-shrink:0;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center; font-weight:600; font-size:13px; color:#14161c;
  }
  .chat-main-name{font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .chat-main-phone{font-size:11px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .chat-main-info{flex:1; min-width:0;}
  .chat-stage-select{margin-left:auto;}
  .chat-head-icons{display:flex; gap:4px;}

  .chat-thread{flex:1; overflow-y:auto; padding:18px 22px; display:flex; flex-direction:column; gap:10px;}
  .chat-thread::-webkit-scrollbar{width:5px;}
  .chat-thread::-webkit-scrollbar-thumb{background:var(--border); border-radius:10px;}

  .chat-info{width:280px; flex-shrink:0; border-left:1px solid var(--border); background:var(--surface); padding:18px; overflow-y:auto; transition:width .2s ease, padding .2s ease;}
  .chat-info.collapsed{width:52px; padding:14px 8px;}
  .chat-info-toolbar{display:flex; justify-content:flex-end; margin-bottom:8px;}
  .chat-info-collapse-btn{
    width:24px; height:24px; border-radius:7px; display:flex; align-items:center; justify-content:center;
    color:var(--muted-2); cursor:pointer; flex-shrink:0; transition:.15s;
  }
  .chat-info-collapse-btn:hover{color:var(--ember); background:var(--ember-dim);}
  .chat-info-collapse-btn svg{transition:transform .2s ease;}
  .chat-info.collapsed .chat-info-collapse-btn svg{transform:rotate(180deg);}
  .chat-info-mini{display:none; flex-direction:column; align-items:center; gap:16px; margin-top:8px;}
  .chat-info.collapsed .chat-info-mini{display:flex;}
  .chat-info.collapsed .chat-info-body{display:none;}
  .mini-avatar{
    width:32px; height:32px; border-radius:50%; flex-shrink:0;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center; font-weight:600; font-size:11px; color:#14161c;
  }
  .mini-temp-dot{width:11px; height:11px; border-radius:50%; flex-shrink:0; cursor:pointer;}
  .mini-ia-dot{width:9px; height:9px; border-radius:50%; border:1.5px solid var(--muted-2); flex-shrink:0; cursor:pointer;}
  .mini-ia-dot.on{background:var(--win); border-color:var(--win);}
  .mini-pin-btn{color:var(--muted-2); cursor:pointer; flex-shrink:0;}
  .mini-pin-btn:hover{color:var(--ember);}
  .info-avatar-wrap{text-align:center; margin-bottom:14px;}
  .info-avatar{
    width:58px; height:58px; border-radius:50%; margin:0 auto 10px;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center; font-weight:600; font-size:18px; color:#14161c;
  }
  .info-name{font-size:14px; font-weight:600;}
  .info-phone{font-size:11px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:2px;}
  .info-section{margin-top:16px; padding-top:14px; border-top:1px solid var(--border);}
  .info-section-title{font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted-2); font-weight:600; margin-bottom:9px;}
  .origin-detail{margin-top:10px; padding-top:10px; border-top:1px solid var(--border);}
  .origin-detail-row{display:flex; flex-direction:column; gap:1px; margin-bottom:8px; font-size:11.5px;}
  .origin-detail-label{font-size:9.5px; color:var(--muted-2); text-transform:uppercase; letter-spacing:.02em;}
  .origin-creative{
    display:flex; align-items:center; gap:9px; background:var(--surface-2); border-radius:9px; padding:8px; margin-top:4px;
  }
  .origin-creative-thumb{
    width:34px; height:34px; border-radius:7px; background:var(--surface); flex-shrink:0;
    display:flex; align-items:center; justify-content:center; font-size:15px;
  }
  .origin-creative-name{font-size:11px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .origin-creative-meta{font-size:9.5px; color:var(--muted-2); margin-top:1px;}

  /* ATENDIMENTO */
  .sheet-row{
    display:flex; align-items:center; gap:12px; padding:13px 0; border-top:1px solid var(--border);
  }
  .sheet-row:first-of-type{border-top:none;}
  .sheet-url{font-size:12.5px; font-weight:600; word-break:break-all;}
  .sheet-meta{font-size:10.5px; color:var(--muted-2); margin-top:3px;}

  .task-row{
    display:flex; align-items:flex-start; gap:12px; padding:13px 0; border-top:1px solid var(--border);
  }
  .task-row:first-of-type{border-top:none;}
  .task-check{
    width:20px; height:20px; border-radius:50%; border:2px solid var(--border); flex-shrink:0; margin-top:1px;
    cursor:pointer; display:flex; align-items:center; justify-content:center; transition:.15s;
  }
  .task-check:hover{border-color:var(--ember);}
  .task-check.done{background:var(--win); border-color:var(--win); color:#0c1a10;}
  .task-title{font-size:13px; font-weight:600;}
  .task-title.done{text-decoration:line-through; color:var(--muted);}
  .task-desc{font-size:11.5px; color:var(--muted); margin-top:2px;}
  .task-meta{font-size:10.5px; color:var(--muted-2); margin-top:5px; display:flex; gap:10px; flex-wrap:wrap; align-items:center;}
  .task-meta .overdue{color:var(--ember); font-weight:600;}
  .task-actions{display:flex; gap:4px; flex-shrink:0; margin-left:auto;}

  .atd-stats{display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:14px;}
  .atd-stat{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px;}
  .atd-stat-num{font-family:'Space Grotesk',sans-serif; font-size:24px; font-weight:600;}
  .atd-stat-label{font-size:11px; color:var(--muted); margin-top:2px;}
  .atd-grid{display:grid; grid-template-columns:1fr 1.3fr; gap:16px; align-items:start;}
  .attendant-row{
    display:flex; align-items:center; gap:11px; padding:11px 0; border-top:1px solid var(--border);
  }
  .attendant-row:first-of-type{border-top:none;}
  .attendant-avatar-wrap{position:relative; flex-shrink:0;}
  .attendant-status-dot{
    position:absolute; bottom:-1px; right:-1px; width:10px; height:10px; border-radius:50%;
    border:2px solid var(--surface);
  }
  .attendant-status-dot.online{background:#25D366;}
  .attendant-status-dot.away{background:var(--warm);}
  .attendant-status-dot.offline{background:var(--muted-2);}
  .attendant-name{font-size:12.5px; font-weight:600;}
  .attendant-count{font-size:10.5px; color:var(--muted);}
  .queue-item{
    display:flex; align-items:center; gap:11px; padding:11px 13px;
    background:var(--surface-2); border:1px solid var(--border); border-radius:11px; margin-bottom:9px;
  }
  .queue-wait{font-size:9.5px; color:var(--ember); font-weight:600; margin-top:2px;}
  .transfer-picker{display:flex; flex-direction:column; gap:6px; margin-top:8px;}
  .transfer-option{
    display:flex; align-items:center; gap:9px; padding:8px 10px; border-radius:9px; cursor:pointer; font-size:12px;
  }
  .transfer-option:hover{background:var(--surface-2);}
  .temp-picker{display:flex; gap:8px;}
  .temp-opt{
    flex:1; text-align:center; padding:7px 4px; border-radius:8px; border:1px solid var(--border);
    font-size:10.5px; cursor:pointer; color:var(--muted); display:flex; flex-direction:column; align-items:center; gap:4px;
  }
  .temp-opt .dot{width:8px; height:8px; border-radius:50%;}
  .temp-opt.selected{border-color:var(--ember); background:var(--ember-dim); color:var(--text);}
  .info-tags{display:flex; flex-wrap:wrap; gap:6px;}
  .info-note{
    width:100%; background:var(--surface-2); border:1px solid var(--border); border-radius:9px;
    padding:9px 10px; font-size:12px; color:var(--text); resize:none; font-family:'Inter',sans-serif;
  }
  .tag.removable{display:inline-flex; align-items:center; gap:5px;}
  .tag-x{cursor:pointer; opacity:0.6; font-size:12px; line-height:1;}
  .tag-x:hover{opacity:1;}
  .icon-btn.ia-on{color:var(--ember); background:var(--ember-dim);}
  .icon-btn.recording{color:#fff; background:#ef4444; animation:mic-pulse 1.2s infinite;}
  @keyframes mic-pulse{
    0%{box-shadow:0 0 0 0 rgba(239,68,68,.55);}
    70%{box-shadow:0 0 0 9px rgba(239,68,68,0);}
    100%{box-shadow:0 0 0 0 rgba(239,68,68,0);}
  }

  /* FLOW BUILDER */
  :root{ --violet:#a78bfa; --violet-dim:#a78bfa22; --teal:#2dd4bf; --teal-dim:#2dd4bf22; }
  :root[data-theme="light"]{ --violet:#7c5cd4; --violet-dim:#7c5cd420; --teal:#0f9488; --teal-dim:#0f948820; }
  .flow-topbar{
    padding:12px 18px; border-bottom:1px solid var(--border);
    display:flex; align-items:center; gap:10px; flex-shrink:0;
  }
  .flow-select{max-width:220px;}
  .flow-body{flex:1; display:flex; min-height:0;}

  .flow-palette{width:190px; flex-shrink:0; border-right:1px solid var(--border); background:var(--surface); padding:14px 12px; overflow-y:auto;}
  .palette-title{font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted-2); font-weight:600; margin-bottom:10px;}
  .palette-item{
    display:flex; align-items:center; gap:9px; padding:9px 10px; border-radius:9px;
    border:1px solid var(--border); margin-bottom:7px; cursor:pointer; font-size:12px; background:var(--surface-2);
    transition:.12s;
  }
  .palette-item:hover{border-color:var(--ember); transform:translateX(2px);}
  .palette-icon{width:22px; height:22px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:12px; flex-shrink:0;}

  .flow-canvas-wrap{
    flex:1; overflow:auto; position:relative;
    background-color:var(--bg);
    background-image:radial-gradient(var(--border) 1px, transparent 1px);
    background-size:22px 22px;
  }
  .flow-canvas{position:relative; width:1500px; height:1150px;}
  .flow-links{position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none;}

  .flow-node{
    position:absolute; width:196px; background:var(--surface); border:1px solid var(--border);
    border-radius:11px; box-shadow:0 6px 18px -8px rgba(0,0,0,.5); cursor:grab; user-select:none; touch-action:none;
  }
  .flow-node.selected{border-color:var(--ember); box-shadow:0 0 0 2px var(--ember-dim), 0 10px 24px -8px rgba(0,0,0,.6);}
  .flow-node.linking-source{border-color:var(--violet); box-shadow:0 0 0 2px var(--violet-dim);}
  .flow-node-head{
    display:flex; align-items:center; gap:7px; padding:8px 10px; border-bottom:1px solid var(--border);
    border-radius:11px 11px 0 0;
  }
  .flow-node-icon{width:20px; height:20px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:11px; flex-shrink:0;}
  .flow-node-title{font-size:11.5px; font-weight:600; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .flow-node-del{width:16px; height:16px; color:var(--muted-2); cursor:pointer; flex-shrink:0; display:flex;}
  .flow-node-del:hover{color:var(--ember);}
  .flow-node-body{padding:9px 10px; font-size:11.5px; color:var(--muted); line-height:1.4; max-height:54px; overflow:hidden;}
  .flow-node-opts{padding:0 10px 9px; display:flex; flex-wrap:wrap; gap:4px;}
  .flow-node-opt{font-size:9.5px; background:var(--surface-2); border:1px solid var(--border); padding:2px 7px; border-radius:20px; color:var(--muted);}
  .node-handle-out{
    position:absolute; bottom:-8px; left:50%; transform:translateX(-50%);
    width:16px; height:16px; border-radius:50%; background:var(--ember); border:2px solid var(--surface);
    cursor:crosshair; z-index:5;
  }
  .node-handle-out:hover{transform:translateX(-50%) scale(1.2);}
  .node-handle-in{
    position:absolute; top:-8px; left:50%; transform:translateX(-50%);
    width:16px; height:16px; border-radius:50%; background:var(--surface-2); border:2px solid var(--ember);
    cursor:crosshair; z-index:5;
  }
  .node-handle-in:hover{transform:translateX(-50%) scale(1.2);}

  .flow-props{width:270px; flex-shrink:0; border-left:1px solid var(--border); background:var(--surface); padding:16px; overflow-y:auto;}
  .flow-props-empty{font-size:12px; color:var(--muted-2); text-align:center; margin-top:40px; line-height:1.6;}
  .flow-hint-banner{
    margin:10px 18px 0; padding:8px 12px; background:var(--violet-dim); border:1px solid #a78bfa44;
    border-radius:9px; font-size:11px; color:var(--violet); display:none; align-items:center; gap:7px;
  }
  .flow-hint-banner.show{display:flex;}

  .chat-back-btn{
    display:none; align-items:center; justify-content:center;
    width:30px; height:30px; border-radius:8px; color:var(--muted); cursor:pointer; flex-shrink:0;
  }
  .chat-info-close{ display:none; }

  /* RESPONSIVO — telas estreitas (celular) */
  @media (max-width: 880px){
    .sidebar{ width:56px; }
    .nav-item{ width:38px; height:38px; }

    /* Rail de navegação tem mais itens do que cabe na tela em celulares —
       essa sombra no rodapé avisa visualmente que dá pra rolar pra ver mais
       (a barra de rolagem em si fica escondida por design). */
    .sidebar-fade{
      display:block; position:fixed; left:0; bottom:0; width:56px; height:26px;
      padding-left:env(safe-area-inset-left);
      background:linear-gradient(to bottom, transparent, var(--surface));
      pointer-events:none; z-index:5;
    }

    .board{ padding:12px 14px 18px; gap:10px; }
    .column{ min-width:78vw; max-width:78vw; }

    .chat-shell{ position:relative; overflow:hidden; }
    .chat-list{ width:100%; }
    .chat-main{ display:none; width:100%; }
    .chat-shell.conversation-open .chat-list{ display:none; }
    .chat-shell.conversation-open .chat-main{ display:flex; }

    .chat-back-btn{ display:flex; }
    .chat-stage-select{ display:none; }

    .chat-info{
      position:fixed; top:0; right:0; height:100vh; width:82vw; max-width:300px;
      transform:translateX(100%); transition:transform .25s ease; z-index:25;
      box-shadow:-14px 0 34px rgba(0,0,0,.5);
    }
    .chat-info.collapsed{ width:82vw; max-width:300px; padding:18px; }
    .chat-info.collapsed .chat-info-body{ display:block; }
    .chat-info.collapsed .chat-info-mini{ display:none; }
    .chat-info-collapse-btn{ display:none; }
    .chat-info.open{ transform:translateX(0); }
    .chat-info-close{
      display:flex; align-items:center; justify-content:center;
      width:26px; height:26px; border-radius:7px; color:var(--muted); cursor:pointer;
      position:absolute; top:14px; right:14px;
    }

    .dash-grid{ grid-template-columns:1fr; }
    .agenda-grid{ grid-template-columns:1fr; }
    .kpi-row{ grid-template-columns:1fr 1fr; }
    .ia-grid{ grid-template-columns:1fr; }
    .billing-grid{ grid-template-columns:1fr; }
    .brand-grid{ grid-template-columns:1fr; }
    .plan-tiers-grid{ grid-template-columns:1fr; }

    /* Formulários de duas colunas empilham em vez de espremer e cortar texto */
    .field-row{ flex-direction:column; }
    .field-row > div{ width:100%; }

    /* Linhas densas de listas (equipe, clientes, faturas, agendamentos) quebram em vez de cortar */
    .sa-client-row{ flex-wrap:wrap; row-gap:8px; }
    .sa-client-row .btn-secondary{ width:100%; margin-top:4px; }
    .member-row{ flex-wrap:wrap; row-gap:8px; }
    .member-actions{ margin-left:auto; }
    .invoice-row{ flex-wrap:wrap; row-gap:4px; }
    .appt-card{ flex-wrap:wrap; row-gap:8px; }
    .col-row{ flex-wrap:wrap; row-gap:6px; }
    .col-row input.field-input{ width:100%; }
    .routing-row{ flex-wrap:wrap; }
    .domain-row{ flex-direction:column; }
    .color-swatch-row{ flex-wrap:wrap; }
    .cname-box{ flex-direction:column; align-items:flex-start; gap:8px; }

    /* Modais mais compactos em telas estreitas */
    .modal{ width:100%; }
    .modal-body{ padding:14px; }
    .modal-head, .modal-foot{ padding:14px; }

    /* Board header e demais cabeçalhos com botão não estouram mais a largura */
    .board-header{ flex-wrap:wrap; row-gap:8px; }
    .board-header-actions{ flex-wrap:wrap; row-gap:6px; width:100%; }
    .board-header-actions .btn-secondary{ flex:0 1 auto; }
    .page-head{ flex-wrap:wrap; row-gap:10px; }

    /* Abas de status do Kanban (Todos/Ativos/Ganhos/Perdidos) quebram em vez
       de estourar a largura em telas estreitas — sem "flex-grow" pra não
       esticar um item sozinho na linha até ocupar 100% (ficava achatado) */
    .kanban-stat-tabs{ flex-wrap:wrap; }
    .kanban-stat-tab{ flex:0 1 auto; justify-content:center; }

    /* Barra de topo: caixa de busca (decorativa hoje) e nome do tenant somem
       pra sobrar espaço pro sino de notificação e avatar, que são funcionais */
    .topbar{ padding:12px 14px; }
    .search{ display:none; }
    .brand-sub{ display:none; }
    .topbar-right{ gap:10px; }

    .reminder-row{ flex-wrap:wrap; row-gap:6px; }
    .reminder-row .rem-unit, .reminder-row .rem-target{ flex:1 1 100px; }

    .composer{ padding:10px 10px calc(14px + env(safe-area-inset-bottom)); gap:5px; }
    .composer-icons{ gap:2px; }
    .icon-btn{ width:28px; height:28px; }
    .icon-btn svg{ width:16px; height:16px; }

    .sa-topbar{ flex-wrap:wrap; row-gap:8px; padding:14px; }
    .flow-topbar{ flex-wrap:wrap; row-gap:8px; }
    .flow-select{ max-width:160px; }

    .flow-palette{
      position:fixed; top:0; left:0; height:100vh; width:78vw; max-width:260px;
      transform:translateX(-100%); transition:transform .25s ease; z-index:25;
      box-shadow:14px 0 34px rgba(0,0,0,.5);
    }
    .flow-palette.open{transform:translateX(0);}
    .flow-props{
      position:fixed; top:0; right:0; height:100vh; width:82vw; max-width:290px;
      transform:translateX(100%); transition:transform .25s ease; z-index:25;
      box-shadow:-14px 0 34px rgba(0,0,0,.5);
    }
    .flow-props.open{transform:translateX(0);}
    .flow-mobile-toggle{display:flex !important;}
  }
  .flow-mobile-toggle{display:none;}

  /* CHAT DRAWER */
  .overlay{
    position:fixed; inset:0; background:rgba(10,11,14,0.55);
    opacity:0; pointer-events:none; transition:opacity .25s ease;
    z-index:10;
  }
  .overlay.open{opacity:1; pointer-events:auto;}

  .drawer{
    position:fixed; top:0; right:0; height:100vh; width:420px; max-width:100vw;
    background:var(--surface); border-left:1px solid var(--border);
    display:flex; flex-direction:column;
    transform:translateX(100%);
    transition:transform .3s cubic-bezier(.2,.8,.2,1);
    z-index:11;
  }
  .drawer.open{transform:translateX(0);}

  .drawer-head{
    padding:16px 18px; border-bottom:1px solid var(--border);
    display:flex; align-items:center; gap:12px;
  }
  .drawer-avatar{
    width:38px; height:38px; border-radius:50%;
    background:linear-gradient(135deg, var(--ember), var(--warm));
    display:flex; align-items:center; justify-content:center; font-weight:600; font-size:13px; color:#14161c;
  }
  .drawer-name{font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .drawer-stage{font-size:11px; color:var(--muted); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .drawer-info{flex:1; min-width:0;}
  .drawer-close{margin-left:auto; cursor:pointer; opacity:0.6;}
  .drawer-close:hover{opacity:1;}

  .thread{flex:1; overflow-y:auto; padding:16px 18px; display:flex; flex-direction:column; gap:10px;}
  .thread::-webkit-scrollbar{width:5px;}
  .thread::-webkit-scrollbar-thumb{background:var(--border); border-radius:10px;}
  .day-sep{
    text-align:center; font-size:10px; color:var(--muted-2);
    font-family:'JetBrains Mono',monospace; margin:6px 0;
  }
  .bubble{max-width:100%; padding:9px 12px; border-radius:12px; font-size:13px; line-height:1.45;}
  .msg-agent-tag{font-size:10px; color:var(--muted-2); align-self:flex-end; margin-bottom:2px; padding-right:2px;}
  .bubble.in{background:var(--surface-2); align-self:flex-start; border-bottom-left-radius:3px;}
  .bubble.out{background:var(--ember); color:#1a0e07; align-self:flex-end; border-bottom-right-radius:3px; font-weight:500;}
  .bubble-time{font-size:9px; opacity:0.55; margin-top:3px; display:block; font-family:'JetBrains Mono',monospace;}

  /* AÇÕES DA MENSAGEM: responder / editar / excluir */
  .msg-group{display:flex; flex-direction:column; max-width:78%;}
  .msg-actions{display:flex; gap:12px; padding:2px 4px 0;}
  .msg-actions span{cursor:pointer; color:var(--muted-2); display:flex; align-items:center; transition:.12s;}
  .msg-actions span:hover{color:var(--ember);}
  .reply-quote-inline{
    font-size:10.5px; color:var(--muted); background:var(--surface-2);
    border-left:2px solid var(--ember); padding:5px 9px; border-radius:8px 8px 2px 2px; margin-bottom:-2px;
    cursor:pointer; transition:.12s;
  }
  .reply-quote-inline:hover{background:var(--ember-dim); color:var(--text);}
  .msg-group.jump-highlight .bubble,
  .msg-group.jump-highlight .audio-bubble,
  .msg-group.jump-highlight .file-bubble{
    animation:jump-flash 1.4s ease;
  }
  @keyframes jump-flash{
    0%, 100% { box-shadow:0 0 0 0 transparent; }
    20% { box-shadow:0 0 0 3px var(--ember); }
  }
  .edited-tag{font-size:9px; opacity:.6; font-style:italic;}
  .deleted-bubble{color:var(--muted-2) !important; font-style:italic; background:var(--surface-2) !important;}
  .editing-bubble{background:var(--surface-2) !important; width:100%;}
  .edit-textarea{
    width:100%; background:var(--surface); border:1px solid var(--border); border-radius:7px;
    color:var(--text); font-size:13px; padding:7px 9px; resize:vertical; font-family:'Inter',sans-serif;
  }
  .edit-actions{display:flex; gap:12px; justify-content:flex-end; margin-top:5px; font-size:10.5px;}
  .edit-actions span{cursor:pointer; color:var(--muted); opacity:.9;}
  .edit-actions span:hover{color:var(--ember); opacity:1;}

  .reply-banner{
    display:flex; align-items:center; gap:9px; margin:0 14px 8px; padding:8px 10px;
    background:var(--surface-2); border-radius:9px; border-left:3px solid var(--ember);
  }
  .reply-banner-bar{display:none;}
  .reply-banner-text{flex:1; font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .reply-banner-close{cursor:pointer; color:var(--muted-2); display:flex; flex-shrink:0;}
  .reply-banner-close:hover{color:var(--ember);}

  .audio-bubble{
    display:flex; align-items:center; gap:8px; background:var(--surface-2);
    align-self:flex-start; padding:8px 10px; border-radius:12px; border-bottom-left-radius:3px; width:200px;
  }
  .play-btn{
    width:26px; height:26px; border-radius:50%; background:var(--ember);
    display:flex; align-items:center; justify-content:center; flex-shrink:0; cursor:pointer;
  }
  .waveform{flex:1; display:flex; align-items:center; gap:2px; height:20px;}
  .waveform div{width:2px; background:var(--muted); border-radius:2px;}
  .audio-speed-btn{
    font-size:9px; font-weight:700; font-family:'JetBrains Mono',monospace;
    border:1px solid var(--border); border-radius:20px; padding:2px 6px;
    cursor:pointer; flex-shrink:0; user-select:none;
  }
  .audio-speed-btn:hover{opacity:0.75;}
  .audio-transcript-btn{
    font-size:10.5px; color:var(--muted); cursor:pointer; padding:5px 9px;
    background:var(--surface-2); border-radius:0 0 10px 10px; margin-top:-4px; width:fit-content;
  }
  .audio-transcript-btn:hover{color:var(--ember);}
  .audio-transcript-box{
    font-size:11px; color:var(--muted); background:var(--surface-2); border-radius:0 0 10px 10px;
    padding:7px 10px; margin-top:-4px; max-width:230px; line-height:1.4;
  }

  .file-bubble{
    display:flex; align-items:center; gap:9px; background:var(--surface-2);
    align-self:flex-start; padding:9px 11px; border-radius:12px; border-bottom-left-radius:3px; width:210px;
  }
  .file-icon{
    width:32px; height:32px; border-radius:8px; background:var(--ember-dim);
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
  }
  .file-name{font-size:12px; font-weight:500;}
  .file-size{font-size:10px; color:var(--muted); font-family:'JetBrains Mono',monospace;}

  /* QUICK REPLIES */
  .quick-replies-row{
    display:flex; align-items:center; gap:8px; padding:8px 12px 8px 18px;
    border-top:1px solid var(--border);
  }
  .quick-replies{ flex:1; display:flex; gap:6px; overflow-x:auto; }
  .qr-chip{
    font-size:11px; white-space:nowrap; padding:6px 11px; display:flex; align-items:center; gap:5px;
    background:var(--surface-2); border:1px solid var(--border); border-radius:20px;
    cursor:pointer; color:var(--muted); transition:.15s; flex-shrink:0;
  }
  .qr-chip:hover{color:var(--text); border-color:var(--ember); background:var(--ember-dim);}
  .qr-manage-btn{
    width:28px; height:28px; border-radius:8px; flex-shrink:0; display:flex; align-items:center; justify-content:center;
    color:var(--muted); cursor:pointer; background:var(--surface-2);
  }
  .qr-manage-btn:hover{color:var(--ember); background:var(--ember-dim);}

  .qr-draft{
    margin:0 14px 10px; padding:10px 12px; background:var(--surface-2);
    border:1px solid var(--ember); border-radius:12px;
  }
  .qr-draft-head{
    display:flex; align-items:center; justify-content:space-between;
    font-size:11px; font-weight:600; color:var(--ember); margin-bottom:8px;
  }
  .qr-draft-close{cursor:pointer; color:var(--muted); display:flex;}
  .qr-draft-close:hover{color:var(--text);}
  .qr-draft-block{
    display:flex; align-items:flex-start; gap:7px; margin-bottom:6px; background:var(--surface); border-radius:8px; padding:7px 9px;
  }
  .qr-draft-icon{font-size:12px; flex-shrink:0; margin-top:3px;}
  .qr-draft-block .field-textarea{flex:1; font-size:12px; padding:6px 8px;}
  .qr-draft-file{flex:1; font-size:11.5px; color:var(--muted); padding-top:3px;}
  .qr-draft-remove{cursor:pointer; color:var(--muted-2); flex-shrink:0; margin-top:3px;}
  .qr-draft-remove:hover{color:var(--ember);}
  .qr-draft-actions{display:flex; justify-content:flex-end; gap:8px; margin-top:6px;}

  .composer{
    padding:12px 14px calc(16px + env(safe-area-inset-bottom)); display:flex; align-items:flex-end; gap:8px;
  }
  .composer-icons{display:flex; gap:4px; flex-shrink:0;}
  .icon-btn{
    width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center;
    color:var(--muted); cursor:pointer; transition:.15s; flex-shrink:0;
  }
  .icon-btn:hover{background:var(--surface-2); color:var(--text);}
  .composer-input{
    flex:1; min-width:0; background:var(--surface-2); border:1px solid var(--border); border-radius:20px;
    padding:9px 14px; font-size:13px; color:var(--text); outline:none;
  }
  .send-btn{
    width:34px; height:34px; border-radius:50%; background:var(--ember);
    display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0;
  }

  .emoji-picker{
    display:none; position:fixed; z-index:60; width:264px; max-height:230px; overflow-y:auto;
    background:var(--surface); border:1px solid var(--border); border-radius:12px;
    box-shadow:0 16px 34px -10px rgba(0,0,0,.6); padding:8px;
    grid-template-columns:repeat(8, 1fr); gap:2px;
  }
  .emoji-picker.open{display:grid;}
  .emoji-picker-item{
    font-size:18px; text-align:center; padding:4px 0; border-radius:6px; cursor:pointer; line-height:1.4;
  }
  .emoji-picker-item:hover{background:var(--surface-2);}