
:root{
  --bg:#f5f7fb;--panel:#fff;--ink:#0f172a;--muted:#64748b;--line:#e2e8f0;
  --nav:#0f172a;--nav2:#1e293b;--accent:#2563eb;--green:#16a34a;--red:#dc2626;--amber:#d97706;
  --radius:18px;--shadow:0 12px 35px rgba(15,23,42,.08)
}
*{box-sizing:border-box}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--ink)}
button,input,select,textarea{font:inherit}.hidden{display:none!important}
.btn{border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:12px;padding:10px 14px;font-weight:750;cursor:pointer}
.btn:hover{filter:brightness(.98)}.btn.primary{background:var(--nav);color:#fff;border-color:var(--nav)}.btn.ghost{background:#fff}.btn.full{width:100%}
.btn.dark{background:#1e293b;color:#e2e8f0;border-color:#334155}
.auth-shell{min-height:100vh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at top right,#dbeafe 0,transparent 32%),var(--bg)}
.auth-card{width:min(440px,100%);background:#fff;border:1px solid var(--line);border-radius:24px;padding:28px;box-shadow:var(--shadow)}
.logo-row,.brand{display:flex;align-items:center;gap:12px}.logo-row h1{font-size:21px;margin:0}.logo-row p{margin:4px 0 0;color:var(--muted);font-size:13px}
.logo-mark{width:48px;height:48px;border-radius:15px;background:#0f172a;color:white;display:grid;place-items:center;font-weight:900}.logo-mark.small{width:38px;height:38px;border-radius:12px}
.auth-form{display:grid;gap:13px;margin-top:22px}.auth-form label,.form-grid label{display:grid;gap:7px;font-size:12px;font-weight:800;color:#475569}
input,select,textarea{width:100%;border:1px solid var(--line);border-radius:11px;padding:11px 12px;background:#fff;outline:none;color:var(--ink)}
input:focus,select:focus,textarea:focus{border-color:#94a3b8;box-shadow:0 0 0 3px rgba(148,163,184,.14)}
textarea{min-height:96px;resize:vertical}.fineprint{color:var(--muted);font-size:12px;line-height:1.55}.setup-note{margin-top:18px;padding:12px;border-radius:12px;background:#f8fafc;color:#475569;font-size:12px;line-height:1.45;border:1px solid var(--line)}
.app{display:grid;grid-template-columns:250px 1fr;min-height:100vh}.sidebar{background:var(--nav);color:white;padding:18px 14px;position:sticky;top:0;height:100vh}
.brand{padding:4px 6px 22px}.brand b{font-size:14px;display:block}.brand span{font-size:11px;color:#94a3b8}
.sidebar nav{display:grid;gap:7px}.nav-item{border:0;background:transparent;color:#cbd5e1;border-radius:11px;padding:11px 12px;text-align:left;cursor:pointer}.nav-item:hover,.nav-item.active{background:var(--nav2);color:white}
.sidebar-footer{position:absolute;left:14px;right:14px;bottom:16px}.user-email{font-size:11px;color:#94a3b8;margin:0 2px 10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.main{min-width:0}.topbar{height:76px;background:rgba(255,255,255,.9);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 26px;position:sticky;top:0;z-index:20}
.topbar h2{margin:0;font-size:20px}.topbar p{margin:4px 0 0;color:var(--muted);font-size:12px}.top-actions{display:flex;align-items:center;gap:10px}
.mode-badge{font-size:11px;font-weight:800;padding:6px 9px;border-radius:999px;background:#eef2ff;color:#3730a3}.mode-badge.cloud{background:#dcfce7;color:#166534}.content{padding:24px}.page{display:none}.page.active{display:block}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px}.kpi-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
.card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:0 4px 15px rgba(15,23,42,.03)}.kpi span{font-size:12px;color:var(--muted)}.kpi strong{font-size:25px;display:block;margin-top:8px;letter-spacing:-.02em}.kpi small{font-size:11px;color:#94a3b8;display:block;margin-top:6px}
.two-col{display:grid;grid-template-columns:1.2fr .8fr;gap:16px;margin-top:16px}.mt{margin-top:16px}.card-head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:14px}.card-head h3,.rule-card h3,.settings-grid h3{margin:0;font-size:15px}.card-head span{font-size:11px;color:var(--muted)}
.bar-row{display:grid;grid-template-columns:150px 1fr 36px;gap:10px;align-items:center;margin:12px 0;font-size:12px}.bar-track{height:9px;background:#eef2f7;border-radius:999px;overflow:hidden}.bar-fill{height:100%;background:#0f172a;border-radius:999px}
.recent-list{display:grid}.recent-item{display:flex;justify-content:space-between;gap:14px;padding:10px 0;border-bottom:1px solid var(--line)}.recent-item:last-child{border-bottom:0}.recent-item b{font-size:13px}.recent-item small{display:block;color:var(--muted);margin-top:3px}
.pill{display:inline-flex;align-items:center;padding:5px 8px;border-radius:999px;font-size:10px;font-weight:800;background:#f1f5f9;color:#475569}.pill.green{background:#dcfce7;color:#166534}.pill.amber{background:#fef3c7;color:#92400e}.pill.red{background:#fee2e2;color:#991b1b}.pill.blue{background:#dbeafe;color:#1d4ed8}
.kanban{display:grid;grid-template-columns:repeat(5,minmax(220px,1fr));gap:13px;overflow:auto;padding-bottom:10px}.kanban-col{background:#edf1f5;border-radius:16px;padding:11px;min-height:540px}.kanban-head{display:flex;justify-content:space-between;padding:3px 3px 12px;font-weight:800;font-size:12px}.dropzone{min-height:470px}
.lead-card{background:#fff;border:1px solid var(--line);border-radius:13px;padding:12px;margin-bottom:9px;box-shadow:0 2px 7px rgba(15,23,42,.04);cursor:grab}.lead-card h4{margin:0 0 7px;font-size:13px}.lead-card p{margin:4px 0;color:var(--muted);font-size:11px}.lead-card .amount{font-weight:850;color:var(--ink)}
.toolbar{display:flex;gap:9px;flex-wrap:wrap;margin-bottom:13px}.toolbar input{min-width:240px;flex:1}.toolbar select{width:auto;min-width:170px}.table-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);overflow:auto}
table{width:100%;border-collapse:collapse;min-width:950px}th,td{text-align:left;padding:12px 13px;border-bottom:1px solid var(--line);font-size:12px}th{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:#64748b;background:#f8fafc}tbody tr:hover td{background:#fcfcfd}.money-positive{font-weight:850;color:#166534}
.rule-card p{font-size:13px;color:#475569;line-height:1.55;margin-bottom:0}.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.setting-row{display:flex;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--line);font-size:12px}.setting-row:last-child{border-bottom:0}
.history-list{display:grid;gap:10px}.history-item{padding:12px;border:1px solid var(--line);border-radius:12px;background:#fbfdff}.history-item b{font-size:12px}.history-item p{margin:5px 0 0;color:var(--muted);font-size:11px;line-height:1.4}
.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:50;display:grid;place-items:center;padding:18px}.modal{width:min(760px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:22px;padding:20px;box-shadow:var(--shadow)}
.modal-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:16px}.modal-head h3{margin:0}.modal-head p{margin:4px 0 0;font-size:11px;color:var(--muted)}.icon-btn{border:0;background:#f1f5f9;width:34px;height:34px;border-radius:10px;font-size:22px;cursor:pointer}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}.form-grid .full{grid-column:1/-1}.modal-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:17px}
.toast{position:fixed;right:18px;top:18px;z-index:100;background:#0f172a;color:#fff;padding:11px 14px;border-radius:11px;box-shadow:var(--shadow);font-size:12px;transform:translateY(-80px);opacity:0;transition:.25s}.toast.show{transform:translateY(0);opacity:1}.toast.error{background:#991b1b}.empty{padding:26px;text-align:center;color:var(--muted)}.mobile-nav{display:none}
.source-row{display:grid;grid-template-columns:220px 1fr 42px;gap:10px;align-items:center;margin:11px 0;font-size:12px}
@media(max-width:1050px){.kpi-grid{grid-template-columns:repeat(2,1fr)}.two-col{grid-template-columns:1fr}}
@media(max-width:760px){
  .app{grid-template-columns:1fr}.sidebar{display:none}.topbar{height:70px;padding:0 14px}.topbar h2{font-size:17px}.topbar p,.mode-badge{display:none}.content{padding:14px 14px 86px}.kpi-grid,.kpi-grid.three{grid-template-columns:1fr 1fr}.settings-grid,.form-grid{grid-template-columns:1fr}.form-grid .full{grid-column:auto}
  .mobile-nav{display:flex;position:fixed;left:10px;right:10px;bottom:10px;background:#0f172a;border-radius:15px;padding:7px;z-index:30;justify-content:space-around;box-shadow:var(--shadow)}.mobile-nav button{border:0;background:transparent;color:#cbd5e1;padding:9px 7px;border-radius:9px;font-size:10px}.mobile-nav button.active{background:#1e293b;color:#fff}
}
@media(max-width:430px){.kpi-grid,.kpi-grid.three{grid-template-columns:1fr}.top-actions .btn{padding:9px 10px}.source-row{grid-template-columns:120px 1fr 35px}}


/* Melhor legibilidade no cadastro/edição de lead */
.modal{
  font-size:15px;
}
.modal-head h3{
  font-size:20px;
  line-height:1.25;
}
.modal-head p{
  font-size:13px;
  line-height:1.45;
}
.form-grid label{
  font-size:14px;
  line-height:1.35;
}
.form-grid input,
.form-grid select,
.form-grid textarea{
  font-size:16px;
  min-height:46px;
  padding:12px 13px;
}
.form-grid textarea{
  min-height:110px;
}
.modal-actions .btn{
  font-size:14px;
  padding:11px 16px;
}
.icon-btn{
  font-size:24px;
}
@media(max-width:760px){
  .modal{
    padding:18px;
  }
  .modal-head h3{
    font-size:19px;
  }
  .form-grid label{
    font-size:14px;
  }
  .form-grid input,
  .form-grid select,
  .form-grid textarea{
    font-size:16px;
    min-height:48px;
  }
  .modal-actions .btn{
    font-size:15px;
    min-height:44px;
  }
}


/* Dados preenchidos com peso normal para melhorar a leitura */
.form-grid input,
.form-grid select,
.form-grid textarea{
  font-weight:400;
}


/* Melhor legibilidade na tela de login */
.auth-card{
  font-size:15px;
}

.logo-row h1{
  font-size:22px;
  line-height:1.25;
}

.logo-row p{
  font-size:14px;
  line-height:1.45;
}

.auth-form label{
  font-size:14px;
  line-height:1.35;
}

.auth-form input{
  font-size:16px;
  min-height:46px;
  padding:12px 13px;
  font-weight:400;
}

.auth-form .btn,
.auth-card > .btn{
  font-size:15px;
  min-height:46px;
}

.setup-note{
  font-size:13px;
  line-height:1.5;
}

.fineprint{
  font-size:13px;
  line-height:1.55;
}

@media(max-width:760px){
  .auth-card{
    padding:22px;
  }

  .logo-row h1{
    font-size:21px;
  }

  .logo-row p{
    font-size:14px;
  }

  .auth-form label{
    font-size:14px;
  }

  .auth-form input{
    font-size:16px;
    min-height:48px;
    font-weight:400;
  }

  .auth-form .btn,
  .auth-card > .btn{
    font-size:15px;
    min-height:48px;
  }
}


/* Alternância entre login e cadastro */
.auth-tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  margin-top:20px;
  padding:4px;
  border-radius:12px;
  background:#f1f5f9;
}
.auth-tab{
  border:0;
  border-radius:9px;
  padding:10px 12px;
  background:transparent;
  color:#64748b;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
}
.auth-tab.active{
  background:#ffffff;
  color:#0f172a;
  box-shadow:0 2px 8px rgba(15,23,42,.07);
}

/* Conteúdo digitado no login/cadastro sem negrito */
.auth-form input{
  font-weight:400 !important;
}


/* ===== Tipografia global ampliada para todo o CRM ===== */
body{
  font-size:16px;
  line-height:1.45;
}

/* Menu lateral e identidade */
.brand b{
  font-size:16px;
}
.brand span{
  font-size:13px;
}
.nav-item{
  font-size:15px;
  padding:13px 14px;
}
.user-email{
  font-size:13px;
}

/* Cabeçalho */
.topbar h2{
  font-size:23px;
}
.topbar p{
  font-size:14px;
}
.mode-badge{
  font-size:12px;
}

/* Botões */
.btn{
  font-size:15px;
  min-height:42px;
}

/* Cards e indicadores */
.kpi span{
  font-size:14px;
}
.kpi strong{
  font-size:29px;
}
.kpi small{
  font-size:13px;
}
.card-head h3,
.rule-card h3,
.settings-grid h3{
  font-size:18px;
}
.card-head span{
  font-size:13px;
}

/* Gráficos e barras */
.bar-row{
  grid-template-columns:170px 1fr 42px;
  font-size:14px;
}
.source-row{
  grid-template-columns:240px 1fr 48px;
  font-size:14px;
}

/* Atividades recentes */
.recent-item b{
  font-size:15px;
}
.recent-item small{
  font-size:13px;
}

/* Badges / etiquetas */
.pill{
  font-size:12px;
  padding:6px 9px;
}

/* Funil Kanban */
.kanban-head{
  font-size:15px;
  padding:5px 4px 14px;
}
.lead-card h4{
  font-size:15px;
}
.lead-card p{
  font-size:13px;
}
.lead-card .amount{
  font-size:15px;
}

/* Busca e filtros */
.toolbar input,
.toolbar select{
  font-size:15px;
  min-height:44px;
}

/* Tabelas */
th{
  font-size:12px;
  padding:14px 14px;
}
td{
  font-size:14px;
  padding:14px 14px;
}
td .fineprint{
  font-size:12px;
}

/* Comissão e regras */
.rule-card p{
  font-size:15px;
  line-height:1.6;
}

/* Configurações */
.setting-row{
  font-size:14px;
}

/* Histórico */
.history-item b{
  font-size:14px;
}
.history-item p{
  font-size:13px;
}

/* Textos auxiliares */
.fineprint{
  font-size:13px;
}
.setup-note{
  font-size:14px;
}

/* Login */
.logo-row h1{
  font-size:24px;
}
.logo-row p{
  font-size:15px;
}
.auth-form label{
  font-size:15px;
}
.auth-form input{
  font-size:16px;
}
.auth-tab{
  font-size:15px;
}

/* Modal de Novo Lead */
.modal-head h3{
  font-size:22px;
}
.modal-head p{
  font-size:14px;
}
.form-grid label{
  font-size:15px;
}
.form-grid input,
.form-grid select,
.form-grid textarea{
  font-size:16px;
}
.modal-actions .btn{
  font-size:15px;
}

/* Mobile: impedir que a interface fique minúscula */
@media(max-width:760px){
  body{
    font-size:16px;
  }
  .topbar h2{
    font-size:20px;
  }
  .kpi span{
    font-size:14px;
  }
  .kpi strong{
    font-size:25px;
  }
  .kpi small{
    font-size:13px;
  }
  .card-head h3{
    font-size:17px;
  }
  .kanban-head{
    font-size:15px;
  }
  .lead-card h4{
    font-size:15px;
  }
  .lead-card p{
    font-size:13px;
  }
  .mobile-nav button{
    font-size:12px;
    padding:10px 8px;
  }
  th{
    font-size:12px;
  }
  td{
    font-size:14px;
  }
}

/* Celulares pequenos continuam legíveis */
@media(max-width:430px){
  .kpi strong{
    font-size:24px;
  }
  .top-actions .btn{
    font-size:14px;
  }
  .source-row{
    grid-template-columns:130px 1fr 38px;
    font-size:13px;
  }
}


/* Perfis de acesso */
.role-hidden{
  display:none !important;
}
.user-role-badge{
  display:inline-flex;
  align-items:center;
  margin:0 2px 7px;
  padding:5px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}
.user-role-badge.admin{
  background:#dbeafe;
  color:#1d4ed8;
}
.user-role-badge.client{
  background:#f1f5f9;
  color:#475569;
}


/* Histórico detalhado do administrador */
.history-toolbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:16px;
}
.history-toolbar input{
  flex:1;
  min-width:260px;
  font-size:15px;
  min-height:44px;
}
.history-toolbar select{
  width:auto;
  min-width:180px;
  font-size:15px;
  min-height:44px;
}
.history-list{
  gap:14px;
}
.history-item.detailed{
  padding:16px;
  background:#fff;
}
.history-title-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.history-title-row strong{
  font-size:16px;
}
.history-meta{
  display:flex;
  gap:8px 16px;
  flex-wrap:wrap;
  margin-top:9px;
  color:#64748b;
  font-size:13px;
}
.history-meta b{
  color:#334155;
}
.history-changes{
  display:grid;
  gap:8px;
  margin-top:14px;
  padding-top:12px;
  border-top:1px solid var(--line);
}
.history-change{
  display:grid;
  grid-template-columns:minmax(170px,230px) 1fr;
  gap:14px;
  align-items:start;
  padding:10px 11px;
  border-radius:10px;
  background:#f8fafc;
}
.history-field{
  font-size:14px;
  font-weight:700;
  color:#334155;
}
.history-values{
  display:flex;
  align-items:center;
  gap:9px;
  flex-wrap:wrap;
  min-width:0;
  font-size:14px;
}
.history-before,
.history-after{
  padding:5px 8px;
  border-radius:8px;
  overflow-wrap:anywhere;
  white-space:pre-wrap;
}
.history-before{
  background:#fee2e2;
  color:#991b1b;
}
.history-after{
  background:#dcfce7;
  color:#166534;
}
.history-arrow{
  color:#94a3b8;
  font-weight:800;
}
.history-nochange{
  color:#64748b;
  font-size:13px;
  padding:6px 0;
}
@media(max-width:760px){
  .history-change{
    grid-template-columns:1fr;
    gap:7px;
  }
  .history-meta{
    font-size:13px;
  }
  .history-values{
    font-size:14px;
  }
}


/* ===== Multi-clientes / ambientes isolados ===== */
.org-switcher-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 9px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}
.org-switcher-wrap span{
  color:#64748b;
  font-size:12px;
  font-weight:700;
}
.org-switcher-wrap select{
  width:auto;
  min-width:180px;
  border:0;
  padding:4px 6px;
  font-size:14px;
  font-weight:600;
  background:#fff;
}
.clients-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}
.client-card{
  transition:.15s ease;
}
.client-card.selected{
  border-color:#94a3b8;
  box-shadow:0 0 0 2px rgba(148,163,184,.18);
}
.client-card-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
.client-card-head h3{
  margin:0 0 8px;
  font-size:18px;
}
.client-details{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:16px;
}
.client-details div{
  padding:11px;
  border-radius:11px;
  background:#f8fafc;
}
.client-details span{
  display:block;
  color:#64748b;
  font-size:12px;
  margin-bottom:4px;
}
.client-details b{
  display:block;
  font-size:14px;
  overflow-wrap:anywhere;
}
.profile-form{
  display:grid;
  gap:13px;
  margin-top:16px;
}
.profile-form label{
  display:grid;
  gap:7px;
  font-size:14px;
  font-weight:700;
  color:#475569;
}
.profile-form input{
  font-size:16px;
  font-weight:400;
  min-height:46px;
}
.checkbox-row{
  display:flex !important;
  align-items:center;
  gap:10px;
}
.checkbox-row input{
  width:20px;
  min-height:auto;
}
.page-head{
  margin-bottom:15px;
}
.role-hidden{
  display:none !important;
}
@media(max-width:900px){
  .clients-grid{
    grid-template-columns:1fr;
  }
}
@media(max-width:760px){
  .org-switcher-wrap{
    max-width:160px;
  }
  .org-switcher-wrap span{
    display:none;
  }
  .org-switcher-wrap select{
    min-width:0;
    max-width:140px;
    font-size:13px;
  }
  .client-details{
    grid-template-columns:1fr;
  }
}
