    :root {
      --bg: #0a0a0f;
      --surface: #13131a;
      --surface2: #1c1c28;
      --border: #2a2a3d;
      --accent: #6c63ff;
      --green: #00d4aa;
      --yellow: #ffd166;
      --red: #ff6b6b;
      --gold: #d4a847;
      --text: #e8e8f0;
      --muted: #6b6b8a;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html,
    body {
      height: 100%;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'DM Sans', sans-serif;
      overflow: hidden;
    }

    /* LOGIN */
    .login-wrap {
      height: 100vh;
      display: flex;
      align-items: stretch;
      background: var(--bg);
    }

    /* ── Painel esquerdo ── */
    .login-left {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding: 60px 64px;
      background: radial-gradient(ellipse at 20% 40%, rgba(108,99,255,.14) 0%, transparent 55%),
                  radial-gradient(ellipse at 80% 80%, rgba(0,212,170,.07) 0%, transparent 50%),
                  var(--surface);
      border-right: 1px solid var(--border);
      position: relative;
      overflow: hidden;
    }

    .login-left::before {
      content: '';
      position: absolute;
      top: -120px; right: -120px;
      width: 400px; height: 400px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(108,99,255,.06) 0%, transparent 70%);
      pointer-events: none;
    }

    .login-brand {
      font-family: 'Syne', sans-serif;
      font-size: 38px;
      font-weight: 800;
      color: var(--accent);
      letter-spacing: -1px;
      margin-bottom: 6px;
    }

    .login-tagline {
      font-size: 15px;
      color: var(--muted);
      margin-bottom: 52px;
      line-height: 1.5;
    }

    .login-programs {
      display: flex;
      flex-direction: column;
      gap: 14px;
      margin-bottom: 52px;
    }

    .login-prog-card {
      display: flex;
      align-items: center;
      gap: 14px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 14px 18px;
      transition: border-color .2s;
    }

    .login-prog-card:hover { border-color: var(--accent); }

    .login-prog-icon {
      font-size: 22px;
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--surface3, #1e1e2e);
      border-radius: 10px;
      flex-shrink: 0;
    }

    .login-prog-name {
      font-weight: 700;
      font-size: 13px;
      color: var(--text);
    }

    .login-prog-desc {
      font-size: 11px;
      color: var(--muted);
      margin-top: 2px;
    }

    .login-public-links {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .login-pub-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      color: var(--muted);
      text-decoration: none;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 5px 12px;
      transition: all .2s;
    }

    .login-pub-link:hover {
      color: var(--accent);
      border-color: var(--accent);
    }

    .login-footer {
      position: absolute;
      bottom: 24px;
      left: 64px;
      font-size: 11px;
      color: var(--muted);
      opacity: .5;
    }

    /* ── Painel direito ── */
    .login-right {
      width: 440px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 48px 40px;
    }

    .login-card {
      width: 100%;
      animation: fadeUp .4s ease;
    }

    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(16px) }
      to   { opacity: 1; transform: translateY(0) }
    }

    .login-card-title {
      font-family: 'Syne', sans-serif;
      font-size: 22px;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 4px;
    }

    .login-logo {
      font-family: 'Syne', sans-serif;
      font-size: 28px;
      font-weight: 800;
      color: var(--accent);
      margin-bottom: 4px;
    }

    .login-logo span { color: var(--text); }

    .login-sub {
      font-size: 13px;
      color: var(--muted);
      margin-bottom: 36px;
    }

    .login-label {
      font-size: 11px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 6px;
    }

    .login-input {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 12px 16px;
      border-radius: 12px;
      font-size: 14px;
      font-family: 'DM Sans', sans-serif;
      outline: none;
      transition: border .2s;
      margin-bottom: 16px;
    }

    .login-input:focus { border-color: var(--accent); }

    .login-btn {
      width: 100%;
      background: var(--accent);
      color: #fff;
      border: none;
      padding: 14px;
      border-radius: 12px;
      font-size: 15px;
      font-weight: 600;
      font-family: 'Syne', sans-serif;
      cursor: pointer;
      transition: all .2s;
      margin-top: 4px;
    }

    .login-btn:hover {
      background: #5a52e0;
      transform: translateY(-1px);
    }

    .login-error {
      background: rgba(255, 107, 107, .1);
      border: 1px solid rgba(255, 107, 107, .3);
      color: var(--red);
      border-radius: 10px;
      padding: 10px 14px;
      font-size: 13px;
      margin-bottom: 12px;
    }

    @media (max-width: 768px) {
      .login-wrap { flex-direction: column; }
      .login-left { display: none; }
      .login-right { width: 100%; padding: 40px 24px; }
    }

    /* APP LAYOUT */
    .app {
      display: flex;
      height: 100vh;
      overflow: hidden;
    }

    .sidebar {
      width: 240px;
      background: var(--surface);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      padding: 24px 16px;
      gap: 4px;
      height: 100vh;
      overflow-y: auto;
      flex-shrink: 0;
    }

    .sidebar-logo {
      font-family: 'Syne', sans-serif;
      font-size: 18px;
      font-weight: 800;
      color: var(--accent);
      margin-bottom: 6px;
      padding: 0 8px;
    }

    .sidebar-logo span {
      color: var(--text);
    }

    .sidebar-user {
      font-size: 11px;
      color: var(--muted);
      padding: 0 8px;
      margin-bottom: 20px;
    }

    .sidebar-section {
      font-size: 10px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 1.2px;
      padding: 0 8px;
      margin: 12px 0 4px;
    }
    .ale-tab {
      background: none; border: none; padding: 10px 16px; cursor: pointer;
      font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent;
      transition: all .15s;
    }
    .ale-tab:hover { color: var(--text); }
    .ale-tab-active { color: var(--blue) !important; border-bottom-color: var(--blue) !important; font-weight: 600; }

    /* ALE Coleta Form */
    .ale-coleta-pub-tab { background:none;border:none;padding:10px 20px;cursor:pointer;font-size:13px;font-weight:600;color:var(--muted);border-bottom:3px solid transparent;transition:all .15s; }
    .ale-coleta-pub-tab:hover { color:var(--text); }
    .ale-coleta-pub-tab.active { color:var(--blue);border-bottom-color:var(--blue); }
    .ale-escala-btn { display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:10px 6px;border:2px solid var(--border);border-radius:10px;background:var(--surface2);cursor:pointer;transition:all .15s;flex:1;min-width:0;font-size:11px;color:var(--muted);font-weight:600; }
    .ale-escala-btn:hover { border-color:var(--blue);color:var(--blue); }
    .ale-escala-btn.selected { border-color:var(--blue);background:var(--blue);color:white; }
    .ale-escala-btn .ale-escala-num { font-size:20px;font-weight:800;line-height:1; }
    .ale-dim-progress { display:flex;gap:4px;margin-bottom:20px; }
    .ale-dim-progress-step { flex:1;height:4px;border-radius:2px;background:#E5E7EB;transition:background .2s; }
    .ale-dim-progress-step.done { background:var(--green); }
    .ale-dim-progress-step.active { background:var(--blue); }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 12px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      color: var(--muted);
      transition: all .15s;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
    }

    .nav-item:hover {
      background: var(--surface2);
      color: var(--text);
    }

    .nav-item.active {
      background: rgba(108, 99, 255, .15);
      color: var(--accent);
    }

    .nav-item.gold.active {
      background: rgba(212, 168, 71, .12);
      color: var(--gold);
    }

    .nav-item.gold:hover {
      color: var(--gold);
    }

    .nav-item svg {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
    }

    .sidebar-bottom {
      margin-top: auto;
      padding-top: 16px;
      border-top: 1px solid var(--border);
    }

    .logout-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 9px 12px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 12px;
      color: var(--muted);
      border: none;
      background: none;
      width: 100%;
      transition: all .15s;
    }

    .logout-btn:hover {
      color: var(--red);
      background: rgba(255, 107, 107, .08);
    }
    .link-ext-btn {
      display: flex; align-items: center; gap: 8px;
      padding: 9px 12px; border-radius: 8px; cursor: pointer;
      font-size: 12px; font-weight: 600; color: var(--text);
      border: 1px solid var(--border); background: var(--surface);
      width: 100%; text-align: left; transition: all .15s;
    }
    .link-ext-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface2); }

    .main {
      flex: 1;
      overflow-y: auto;
      padding: 32px;
    }

    .global-datetime {
      position: relative;
      top: 0;
      margin-left: auto;
      width: fit-content;
      z-index: 40;
      padding: 7px 10px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: rgba(10, 10, 14, 0.9);
      backdrop-filter: blur(6px);
      font-family: 'DM Mono', monospace;
      font-size: 11px;
      color: var(--muted);
      letter-spacing: 0.2px;
      pointer-events: none;
      margin-bottom: 10px;
    }

    /* COMMON */
    .page {
      display: none;
    }

    .page.active {
      display: block;
    }

    #page-whatsapp.active {
      display: flex;
      flex-direction: column;
    }

    .page-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 28px;
      flex-wrap: wrap;
      gap: 12px;
    }

    .page-title {
      font-family: 'Syne', sans-serif;
      font-size: 24px;
      font-weight: 800;
    }

    .page-title span {
      color: var(--accent);
    }

    .page-title.gold span {
      color: var(--gold);
    }

    @media(max-width: 768px) {
      .global-datetime {
        top: 6px;
        font-size: 10px;
        padding: 6px 8px;
        margin-bottom: 8px;
      }
    }

    .btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 9px 18px;
      border-radius: 10px;
      border: none;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      font-family: 'DM Sans', sans-serif;
      transition: all .15s;
    }

    .btn-primary {
      background: var(--accent);
      color: #fff;
    }

    .btn-primary:hover {
      background: #5a52e0;
      transform: translateY(-1px);
    }

    .btn-ghost {
      background: var(--surface2);
      color: var(--text);
      border: 1px solid var(--border);
    }

    .btn-ghost:hover {
      border-color: var(--accent);
      color: var(--accent);
    }

    .btn-parcela-sel {
      padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
      border: 1.5px solid var(--border); background: var(--bg); color: var(--text-muted);
      cursor: pointer; transition: all .15s;
    }
    .btn-parcela-sel:hover { border-color: var(--accent); color: var(--accent); }
    .btn-parcela-sel.active { background: var(--accent); border-color: var(--accent); color: #fff; }

    .parcela-row {
      display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center;
      background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
    }
    .parcela-row label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 2px; }
    .parcela-row input { width: 100%; background: none; border: none; color: var(--text); font-size: 13px; outline: none; }

    .btn-gold {
      background: var(--gold);
      color: #0f0f0f;
    }

    .btn-gold:hover {
      background: #c49a35;
      transform: translateY(-1px);
    }

    .btn-green {
      background: rgba(0, 212, 170, .15);
      color: var(--green);
      border: 1px solid rgba(0, 212, 170, .3);
    }

    .btn-green:hover {
      background: rgba(0, 212, 170, .25);
    }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 14px;
      margin-bottom: 24px;
    }

    .stat-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 18px;
      position: relative;
      overflow: hidden;
      cursor: default;
    }

    .stat-card.clickable {
      cursor: pointer;
      transition: border .15s;
    }

    .stat-card.clickable:hover {
      border-color: var(--accent);
    }

    .stat-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 2px;
    }

    .stat-card.c1::before {
      background: var(--accent);
    }

    .stat-card.c2::before {
      background: var(--green);
    }

    .stat-card.c3::before {
      background: var(--yellow);
    }

    .stat-card.c4::before {
      background: var(--red);
    }

    .stat-card.cg::before {
      background: var(--gold);
    }

    .stat-label {
      font-size: 11px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 6px;
    }

    .stat-value {
      font-family: 'Syne', sans-serif;
      font-size: 26px;
      font-weight: 800;
    }

    .stat-sub {
      font-size: 11px;
      color: var(--muted);
      margin-top: 3px;
    }

    /* TABLE */
    .table-wrap {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }

    thead {
      background: var(--surface2);
    }

    th {
      padding: 12px 14px;
      text-align: left;
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--muted);
      font-weight: 600;
    }

    td {
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      vertical-align: middle;
    }

    tr:last-child td {
      border-bottom: none;
    }

    tr:hover td {
      background: rgba(108, 99, 255, .03);
    }

    .badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 9px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 500;
      white-space: nowrap;
    }

    .badge-dot {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .badge.primeiro_contato {
      background: rgba(100, 180, 255, .15);
      color: #64b4ff;
    }

    .badge.primeiro_contato .badge-dot {
      background: #64b4ff;
    }

    .badge.proposta_enviada {
      background: rgba(156, 148, 255, .15);
      color: #9c94ff;
    }

    .badge.proposta_enviada .badge-dot {
      background: #9c94ff;
    }

    .badge.aguardando_retorno {
      background: rgba(255, 209, 102, .15);
      color: var(--yellow);
    }

    .badge.aguardando_retorno .badge-dot {
      background: var(--yellow);
    }

    .badge.em_negociacao {
      background: rgba(255, 150, 50, .15);
      color: #ff9632;
    }

    .badge.em_negociacao .badge-dot {
      background: #ff9632;
    }

    .badge.fechado {
      background: rgba(0, 212, 170, .15);
      color: var(--green);
    }

    .badge.fechado .badge-dot {
      background: var(--green);
    }

    .badge.declinado {
      background: rgba(255, 107, 107, .15);
      color: var(--red);
    }

    .badge.declinado .badge-dot {
      background: var(--red);
    }

    .badge.contrato_assinado {
      background: rgba(99, 179, 237, .15);
      color: #63b3ed;
    }

    .badge.contrato_assinado .badge-dot {
      background: #63b3ed;
    }

    .badge.pago {
      background: rgba(0, 212, 170, .25);
      color: #00d4aa;
      font-weight: 700;
    }

    .badge.pago .badge-dot {
      background: #00d4aa;
    }

    .badge.fechado {
      background: rgba(0, 212, 170, .15);
      color: var(--green);
    }

    .badge.fechado .badge-dot {
      background: var(--green);
    }

    .icon-btn {
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--muted);
      width: 30px;
      height: 30px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all .15s;
      flex-shrink: 0;
    }

    .icon-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
    }

    .icon-btn svg {
      width: 13px;
      height: 13px;
    }

    .lead-quick-btn {
      font-size: 10px;
      padding: 2px 8px;
      border-radius: 20px;
      border: 1px solid #4a5568;
      background: transparent;
      color: #a0aec0;
      cursor: pointer;
      white-space: nowrap;
    }
    .lead-quick-btn:hover { background: #2d3748; color: #e2e8f0; }


    .alert-date {
      color: var(--red);
    }

    .today-date {
      color: var(--yellow);
    }

    .future-date {
      color: var(--green);
    }

    /* FILTERS */
    .filters {
      display: flex;
      gap: 10px;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }

    .filter-input {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px 12px;
      border-radius: 10px;
      font-size: 13px;
      font-family: 'DM Sans', sans-serif;
      outline: none;
      transition: border .2s;
    }

    .filter-input:focus {
      border-color: var(--accent);
    }

    /* ALERTS */
    .alerts-section {
      margin-bottom: 20px;
    }

    .alerts-title {
      font-size: 12px;
      color: var(--yellow);
      margin-bottom: 10px;
      font-weight: 600;
    }

    .alert-cards {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .alert-chip {
      background: rgba(255, 107, 107, .08);
      border: 1px solid rgba(255, 107, 107, .2);
      color: var(--text);
      border-radius: 10px;
      padding: 7px 13px;
      font-size: 12px;
      cursor: pointer;
      transition: all .15s;
    }

    .alert-chip:hover {
      border-color: var(--red);
      color: var(--red);
    }

    /* MODAL */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .7);
      z-index: 500;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .modal {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      width: 100%;
      max-width: 560px;
      max-height: 90vh;
      overflow-y: auto;
      animation: fadeUp .2s ease;
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px 24px;
      border-bottom: 1px solid var(--border);
    }

    .modal-title {
      font-family: 'Syne', sans-serif;
      font-size: 16px;
      font-weight: 700;
    }

    .modal-body {
      padding: 20px 24px;
    }

    .modal-footer {
      padding: 16px 24px;
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }

    .form-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-bottom: 14px;
    }

    .form-label {
      font-size: 11px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .form-input {
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 10px 13px;
      border-radius: 10px;
      font-size: 13px;
      font-family: 'DM Sans', sans-serif;
      outline: none;
      transition: border .2s;
      width: 100%;
    }

    .form-input:focus {
      border-color: var(--accent);
    }

    /* HISTORY */
    .history-entry {
      background: var(--surface2);
      border-left: 2px solid var(--accent);
      border-radius: 0 9px 9px 0;
      padding: 10px 12px;
      margin-bottom: 7px;
    }

    .history-meta {
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 3px;
    }

    .history-note {
      font-size: 12px;
    }

    /* CHAT IA */
    .chat-wrap {
      display: flex;
      flex-direction: column;
      height: calc(100vh - 160px);
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      overflow: hidden;
    }

    .chat-box {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .chat-msg {
      display: flex;
      gap: 10px;
    }

    .chat-msg.user {
      flex-direction: row-reverse;
    }

    .chat-bubble {
      padding: 12px 16px;
      border-radius: 14px;
      font-size: 13px;
      line-height: 1.6;
      max-width: 80%;
    }

    .chat-msg.ai .chat-bubble {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-bottom-left-radius: 3px;
    }

    .chat-msg.user .chat-bubble {
      background: var(--accent);
      color: #fff;
      border-bottom-right-radius: 3px;
    }

    .chat-attach-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--muted);
      padding: 6px 8px;
      border-radius: 8px;
      font-size: 18px;
      transition: color 0.2s;
      flex-shrink: 0;
    }

    .chat-attach-btn:hover {
      color: var(--accent);
    }

    .chat-attach-preview {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      background: rgba(108, 99, 255, .12);
      border-radius: 8px;
      font-size: 11px;
      color: var(--accent);
      margin-bottom: 6px;
    }

    .chat-attach-preview span {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .chat-attach-remove {
      cursor: pointer;
      color: var(--muted);
      font-size: 14px;
    }

    .chat-attach-remove:hover {
      color: var(--red);
    }

    .chat-msg-img {
      max-width: 220px;
      border-radius: 8px;
      margin-top: 6px;
      display: block;
    }

    .chat-input-wrap {
      padding: 14px 16px;
      border-top: 1px solid var(--border);
      display: flex;
      gap: 8px;
      align-items: flex-end;
      background: var(--surface);
    }

    .chat-input {
      flex: 1;
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 10px 14px;
      border-radius: 12px;
      font-size: 13px;
      font-family: 'DM Sans', sans-serif;
      outline: none;
      resize: none;
      transition: border .2s;
      line-height: 1.5;
    }

    .chat-input:focus {
      border-color: var(--accent);
    }

    .chat-input::placeholder {
      color: var(--muted);
    }

    .chat-send {
      background: var(--accent);
      border: none;
      color: #fff;
      width: 44px;
      height: 44px;
      border-radius: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all .15s;
      flex-shrink: 0;
    }

    .chat-send:hover {
      background: #5a52e0;
    }

    .chat-send:disabled {
      background: var(--surface2);
      color: var(--muted);
      cursor: not-allowed;
    }

    .typing-dots {
      display: flex;
      gap: 4px;
      padding: 2px 0;
    }

    .typing-dots span {
      width: 7px;
      height: 7px;
      background: var(--muted);
      border-radius: 50%;
      animation: bounce 1.2s infinite;
    }

    .typing-dots span:nth-child(2) {
      animation-delay: .2s;
    }

    .typing-dots span:nth-child(3) {
      animation-delay: .4s;
    }

    @keyframes bounce {

      0%,
      60%,
      100% {
        transform: translateY(0)
      }

      30% {
        transform: translateY(-7px)
      }
    }

    /* FLUXO CAIXA */
    .fc-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 20px;
      margin-bottom: 14px;
    }

    .fc-title {
      font-size: 10px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 1.2px;
      margin-bottom: 14px;
    }

    .fc-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }

    .fc-inp {
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px 12px;
      border-radius: 9px;
      font-size: 13px;
      font-family: 'DM Sans', sans-serif;
      outline: none;
      transition: border .2s;
    }

    .fc-inp:focus {
      border-color: var(--gold);
    }

    .fc-inp option {
      background: var(--surface2);
    }

    .entry-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      transition: background .12s;
      font-size: 13px;
    }

    .entry-row:hover {
      background: rgba(212, 168, 71, .03);
    }

    .entry-row:last-child {
      border-bottom: none;
    }

    .fc-badge {
      display: inline-block;
      padding: 2px 9px;
      border-radius: 20px;
      font-size: 11px;
      white-space: nowrap;
    }

    .del-btn {
      background: none;
      border: none;
      color: var(--muted);
      cursor: pointer;
      font-size: 16px;
      padding: 2px 5px;
      border-radius: 4px;
      transition: color .15s;
      flex-shrink: 0;
    }

    .del-btn:hover {
      color: var(--red);
    }

    .tab {
      cursor: pointer;
      padding: 7px 16px;
      border-radius: 8px;
      font-size: 12px;
      letter-spacing: .5px;
      transition: all .15s;
      border: 1px solid transparent;
      font-family: 'DM Sans', sans-serif;
    }

    .tab.active {
      background: var(--gold);
      color: #0f0f0f;
      font-weight: 600;
    }

    .tab:not(.active) {
      color: var(--muted);
      border-color: var(--border);
    }

    .tab:not(.active):hover {
      border-color: var(--gold);
      color: var(--gold);
    }

    /* META BAR */
    .meta-bar-wrap {
      background: var(--surface2);
      border-radius: 6px;
      height: 8px;
      overflow: hidden;
      margin: 8px 0;
    }

    .meta-bar {
      height: 8px;
      border-radius: 6px;
      background: linear-gradient(90deg, var(--accent), var(--green));
      transition: width .6s ease;
    }

    /* DASHBOARD */
    .dash-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-top: 16px;
    }

    .dash-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 20px;
    }

    .dash-card-title {
      font-size: 11px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 14px;
      font-weight: 600;
    }

    .funnel-item {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
    }

    .funnel-label {
      font-size: 12px;
      width: 120px;
    }

    .funnel-bar-wrap {
      flex: 1;
      background: var(--surface2);
      border-radius: 3px;
      height: 7px;
    }

    .funnel-bar {
      height: 7px;
      border-radius: 3px;
      transition: width .5s ease;
    }

    .funnel-count {
      font-size: 12px;
      font-weight: 600;
      width: 25px;
      text-align: right;
    }

    .seller-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 9px 0;
      border-bottom: 1px solid var(--border);
      cursor: pointer;
    }

    .seller-row:last-child {
      border-bottom: none;
    }

    .seller-row:hover {
      opacity: .8;
    }

    /* COMISSÕES */
    .comissao-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 0;
      border-bottom: 1px solid var(--border);
    }

    .comissao-row:last-child {
      border-bottom: none;
    }

    /* AGENDA */
    .agenda-day-header {
      font-family: 'Syne', sans-serif;
      font-size: 13px;
      font-weight: 700;
      margin-bottom: 10px;
    }

    .agenda-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-bottom: 8px;
    }

    /* TOAST */
    .toast-wrap {
      position: fixed;
      bottom: 20px;
      right: 20px;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      gap: 8px;
      pointer-events: none;
    }

    .toast {
      padding: 10px 16px;
      border-radius: 9px;
      font-size: 13px;
      font-weight: 500;
      animation: fadeUp .3s ease;
      pointer-events: auto;
    }

    /* LOADING */
    #loading-overlay {
      position: fixed;
      inset: 0;
      background: rgba(10, 10, 15, .92);
      z-index: 2000;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 14px;
    }

    .spin {
      width: 36px;
      height: 36px;
      border: 3px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg)
      }
    }

    /* PERFIL */
    .user-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
      gap: 12px;
    }

    .user-row:last-child {
      border-bottom: none;
    }

    .user-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: 'Syne', sans-serif;
      font-weight: 800;
      font-size: 14px;
      flex-shrink: 0;
    }

    .access-tag {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 9px;
      border-radius: 20px;
      font-size: 11px;
    }

    /* POPUP */
    .popup-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .7);
      z-index: 600;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .popup-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      width: 100%;
      max-width: 520px;
      max-height: 80vh;
      overflow-y: auto;
      animation: fadeUp .2s ease;
    }

    .popup-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      border-bottom: 1px solid var(--border);
    }

    .popup-body {
      padding: 16px 20px;
    }

    /* WHATSAPP FECHAMENTO */
    .wa-card {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 12px;
    }

    .wa-name {
      font-weight: 700;
      margin-bottom: 6px;
      font-size: 14px;
    }

    .wa-msg {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.6;
      white-space: pre-line;
      margin-bottom: 10px;
    }

    /* MOBILE HEADER & MENU */
    .mobile-header {
      display: none;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .hamburger {
      background: none;
      border: none;
      color: var(--text);
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 5px;
      padding: 5px;
    }

    .hamburger span {
      display: block;
      width: 24px;
      height: 2px;
      background: currentColor;
      border-radius: 2px;
      transition: all 0.3s;
    }

    /* RESPONSIVE */
    @media(max-width:768px) {
      body {
        overflow: auto;
        /* Permite scroll no body no mobile */
      }

      .app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
      }

      .mobile-header {
        display: flex;
        /* Exibe o header com logo e botão no topo */
      }

      /* A sidebar vira um menu escondido no mobile */
      .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 200;
        transition: left 0.3s ease;
        padding-top: 60px;
        /* Espaço para o botão fechar */
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5);
      }

      .sidebar.open {
        left: 0;
      }

      .sidebar-logo {
        display: none;
        /* Logo vai pro mobile-header */
      }

      /* Overlay para fechar o menu ao clicar fora */
      .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 150;
        backdrop-filter: blur(3px);
      }

      .sidebar-overlay.open {
        display: block;
      }

      .close-menu-btn {
        position: absolute;
        top: 16px;
        right: 16px;
        background: none;
        border: none;
        color: var(--text);
        font-size: 24px;
        cursor: pointer;
      }

      .main {
        padding: 16px;
        overflow-y: visible;
        /* Scroll natural da página */
      }

      .page-header {
        flex-direction: column;
        align-items: flex-start;
      }

      .page-header button {
        width: 100%;
        justify-content: center;
      }

      .stats-grid,
      .dash-grid {
        grid-template-columns: 1fr;
      }

      .form-row {
        grid-template-columns: 1fr;
      }

      .filters {
        flex-direction: column;
      }

      .filters .filter-input {
        width: 100%;
      }

      .table-wrap {
        overflow-x: auto;
        /* Permite rolar a tabela lateralmente */
        border-radius: 10px;
      }

      table {
        min-width: 800px;
        /* Força um tamanho mínimo para não quebrar colunas */
      }

      .chat-wrap {
        height: calc(100vh - 200px);
      }

      .modal {
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
      }
    }
    /* ===== PROJETOS ===== */
    .proj-fase { background:#fff;border-radius:14px;border:1px solid #E2E8F0;margin-bottom:14px;overflow:hidden;box-shadow:0 1px 4px rgba(0,0,0,0.04) }
    .proj-fase-header { display:flex;align-items:center;gap:12px;padding:16px 20px;cursor:pointer;user-select:none }
    .proj-fase-header:hover { background:#F7FAFC }
    .proj-fase-num { width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#fff;flex-shrink:0 }
    .proj-fase-titulo { font-size:14px;font-weight:700;color:#1A365D;flex:1 }
    .proj-fase-badge { font-size:10px;padding:3px 8px;border-radius:20px;font-weight:600 }
    .proj-fase-prog { font-size:12px;color:#718096;margin-left:auto }
    .proj-fase-body { padding:0 20px 16px;border-top:1px solid #EDF2F7 }
    .proj-task { display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid #F7FAFC }
    .proj-task:last-child { border-bottom:none }
    .proj-task-check { width:18px;height:18px;border-radius:4px;border:2px solid #CBD5E0;cursor:pointer;flex-shrink:0;display:flex;align-items:center;justify-content:center;transition:all 0.15s }
    .proj-task-check.done { background:#48BB78;border-color:#48BB78 }
    .proj-task-check.externo { background:#EDF2F7;border-color:#CBD5E0;cursor:default }
    .proj-task-nome { font-size:13px;color:#2D3748;flex:1 }
    .proj-task-nome.done { text-decoration:line-through;color:#A0AEC0 }
    .proj-task-critico { font-size:9px;font-weight:700;color:#E53E3E;background:#FFF5F5;border:1px solid #FEB2B2;padding:2px 6px;border-radius:4px;flex-shrink:0 }
    .proj-resp-tags { display:flex;gap:4px;flex-wrap:wrap }
    .proj-resp-tag { font-size:10px;font-weight:600;padding:2px 7px;border-radius:10px;color:#fff }
    /* Matriz */
    .proj-matriz { background:#fff;border-radius:14px;border:1px solid #E2E8F0;overflow:auto;box-shadow:0 1px 4px rgba(0,0,0,0.04) }
    .proj-matriz table { width:100%;border-collapse:collapse;font-size:12px }
    .proj-matriz th { background:#F7FAFC;padding:10px 14px;font-weight:700;color:#4A5568;border-bottom:2px solid #E2E8F0;white-space:nowrap;text-align:center }
    .proj-matriz th:first-child { text-align:left;min-width:240px }
    .proj-matriz td { padding:9px 14px;border-bottom:1px solid #EDF2F7;color:#2D3748;vertical-align:middle }
    .proj-matriz td:not(:first-child) { text-align:center }
    .proj-matriz tr:hover td { background:#F7FAFC }
    .proj-matriz .fase-row td { background:#EDF2F7;font-weight:700;color:#2D3748;font-size:11px;padding:6px 14px }
    .proj-dot { width:22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff;margin:0 auto }
    .proj-dot-s { width:14px;height:14px;border-radius:50%;display:inline-block;opacity:0.4 }
    /* Pessoa view */
    .proj-pessoa-btn { padding:7px 14px;border-radius:20px;border:2px solid #E2E8F0;background:#fff;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit;transition:all 0.15s }
    .proj-pessoa-btn.active { color:#fff;border-color:transparent }
    .proj-pessoa-card { background:#fff;border-radius:12px;border:1px solid #E2E8F0;margin-bottom:10px;padding:16px 20px }
    .proj-pessoa-fase { font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:0.6px;color:#718096;margin-bottom:4px }
