body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f8;
}

.topbar {
  background: #7e3f92;
  color: #fff;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.main-content {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 12px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.kpi-value {
  font-size: clamp(20px, 2.8vw, 30px);
  white-space: nowrap;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.tabela {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.tabela th,
.tabela td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
}

.tabela th {
  background: #f3f4f6;
  text-align: left;
}

.auth-page {
  max-width: 360px;
  margin: 40px auto;
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.auth-page input {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

.auth-page button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: #7e3f92;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar-logo {
  font-weight: 700;
}

.topbar-nav a {
  margin-right: 16px;
  font-weight: 500;
  opacity: 0.9;
}

.topbar-nav a:hover {
  opacity: 1;
}

.flash-container {
  margin-bottom: 16px;
}

.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

.flash-danger { background: #fee2e2; color: #b91c1c; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-success { background: #dcfce7; color: #166534; }

.form-card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  max-width: 640px;
}

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

.form-row label {
  font-size: 14px;
  font-weight: 600;
}

.form-row input,
.form-row select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.form-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-primary,
.btn-secondary {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary {
  background: #7e3f92;
  color: #fff;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
  text-decoration: none;
}
.btn-primary {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: #7e3f92;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.form-card {
  max-width: 480px;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.form-row label {
  font-size: 14px;
  margin-bottom: 4px;
}

.form-row input,
.form-row select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}
/* -------- Formulário de cliente (PF/PJ toggle) -------- */

.form-card {
  max-width: 520px;
  margin: 24px 0;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.form-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-primary {
  background: #7e3f92;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* Toggle PF / PJ */

.tipo-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: #f3f4f6;
  padding: 3px;
  gap: 4px;
}

.tipo-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: #4b5563;
}

.tipo-btn.ativo {
  background: #7e3f92;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.config-form {
  margin-bottom: 12px;
}
.card-form {
  max-width: 520px;
  margin-top: 24px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-row label {
  font-size: 14px;
  font-weight: 600;
}

.form-row input,
.form-row select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.tipo-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: #f3f4f6;
  padding: 2px;
  gap: 4px;
}

.tipo-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}

.tipo-btn.ativo {
  background: #7e3f92;
  color: #fff;
  font-weight: 600;
}

.btn-primary {
  background: #7e3f92;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 600;
  cursor: pointer;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
/* Fases do orçamento */
.orc-fases {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 8px;
}

.fase-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  color: #9ca3af;
}

.fase-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #d1d5db;
  margin-bottom: 4px;
  background: #fff;
}

.fase-item.ativo {
  color: #7e3f92;
}

.fase-item.ativo .fase-dot {
  border-color: #7e3f92;
  background: #7e3f92;
}

.fase-line {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
}

.fase-line.ativo {
  background: #7e3f92;
}
/* =========================
   AJUSTES CONFIGURAÇÕES BÁSICAS
   ========================== */

/* Título da página bem separado */
.main-content > h1 {
  margin-top: 8px;
  margin-bottom: 18px;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
}

/* GRID das configurações: 2 colunas (duas em cima e duas embaixo) */
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

/* Inputs e selects dentro das tabelas de configuração */
.config-grid table input[type="text"],
.config-grid table input[type="number"],
.config-grid table select {
  min-width: 110px;
  padding: 6px 8px;
  font-size: 14px;
}

/* Ações (botões) na última coluna alinhados e DENTRO do card */
.config-grid .tabela td:last-child {
  white-space: normal;         /* deixa quebrar linha */
  display: flex;
  flex-wrap: wrap;             /* se faltar espaço, joga pra baixo */
  gap: 6px;
  justify-content: flex-end;   /* opcional: alinha à direita */
}

.config-grid .tabela td:last-child form {
  margin: 0;                   /* garante que não abra espaçamento estranho */
}

.config-grid .tabela td:last-child button {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
}

.config-grid > .card {
  min-width: 0;
}

@media (max-width: 600px) {
  .config-grid .tabela td:last-child button {
    padding: 4px 8px;
    font-size: 12px;
  }
}

.status-endosso-pendente { background:#fff3cd; color:#664d03; }

.email-attach-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.email-attach-backdrop.show{
  display: flex;
}
.email-attach-modal{
  background: #fff;
  width: min(520px, 92vw);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  overflow: hidden;
}
.email-attach-hd{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f5f5f7;
  border-bottom: 1px solid #e5e7eb;
}
.email-attach-hd h3{
  margin: 0;
  font-size: 16px;
}
.email-attach-close{
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}
.email-attach-bd{
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.email-attach-actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
