/* =========================================================
   DRG-Rently — styles.css
   Paleta teal (diferencia visualmente do DRG-Kronos azul)
   ========================================================= */

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

:root {
  /* Paleta Slate-Blue — baixa saturação, confortável pra sensibilidade à luz */
  --primary:       #475569;  /* slate-600 */
  --primary-dark:  #334155;  /* slate-700 */
  --primary-light: #E2E8F0;  /* slate-200 */
  --accent:        #64748B;  /* slate-500 */
  --success:       #15803D;  /* green-700, dessaturado */
  --success-light: #DCFCE7;  /* green-100 */
  --warning:       #C2410C;  /* orange-700, terra */
  --warning-light: #FFEDD5;  /* orange-100 */
  --danger:        #B91C1C;  /* red-700, dessaturado */
  --danger-light:  #FEE2E2;  /* red-100 */
  --sidebar-bg:    #1E293B;  /* slate-800 */
  --sidebar-hover: #334155;  /* slate-700 */
  --sidebar-active:#475569;  /* slate-600 */
  --bg:            #F8FAFC;  /* slate-50 — fundo creme-azul, evita branco puro */
  --card-bg:       #FFFFFF;
  --border:        #E2E8F0;  /* slate-200 */
  --text:          #1E293B;  /* slate-800, evita preto puro */
  --text-muted:    #64748B;  /* slate-500 */
  --text-light:    #94A3B8;  /* slate-400 */
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:     0 4px 16px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-btn:    0 1px 2px rgba(15,23,42,0.06), inset 0 1px 0 rgba(255,255,255,0.04);
  --sidebar-width: 260px;
  --topbar-h:      64px;
  --transition:    0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
/* 🔒 GUARDA DE ESTOURO (padrão da família DRG): nada faz a página rolar pro lado
   no celular. É `clip`, NÃO `hidden` — hidden torna o body um container de scroll
   e MATA todo `position:sticky` que deveria grudar na viewport. O hidden fica só
   de rede pra navegador velho (iOS <16) que não conhece clip.
   As tabelas largas continuam rolando dentro do próprio wrapper (overflow-x:auto). */
html, body { overflow-x: hidden; max-width: 100%; }
@supports (overflow-x: clip) {
  html, body { overflow-x: clip; }
}

a { cursor: pointer; text-decoration: none; color: var(--primary); }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ----- Telas (login / signup / app) ----- */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* ----- Tela de Login / Signup ----- */
#screen-login, #screen-signup {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 6px 18px rgba(15,23,42,0.12);
  animation: logo-pop 0.5s ease;
}

@keyframes logo-pop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.auth-card h1 {
  color: var(--primary-dark);
  font-size: 28px;
  margin-bottom: 8px;
  text-align: center;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,137,123,0.12);
}

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

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Botões dentro do auth-card (login/signup) ocupam toda a largura */
.auth-card .btn { width: 100%; }

/* Marcador de campo obrigatório */
.form-group label.required::after,
label.required::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}

/* Status inline de input (CEP, CPF/CNPJ, etc.) */
.input-status {
  font-size: 11px;
  margin-top: 4px;
  display: block;
  font-weight: 500;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary:hover { background: var(--primary-light); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #A01818; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.auth-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a { color: var(--primary); font-weight: 600; }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-info { background: var(--primary-light); color: var(--primary-dark); }

/* ----- App ----- */
#screen-app { display: none; }
#screen-app.active { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .brand-logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.sidebar-brand .brand-info {
  flex: 1;
  min-width: 0;
}

.sidebar-brand h2 {
  font-size: 19px;
  color: white;
  line-height: 1.1;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

/* Agrupamento de itens por seção */
.nav-group {
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.15);
}

.nav-group:first-child {
  border-top: none;
  box-shadow: none;
}

.nav-group-title {
  padding: 4px 12px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
}

/* Itens de navegação como botões com profundidade real */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 4px 0;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(255,255,255,0.06);
  cursor: default;
  user-select: none;
  transition: transform var(--transition), box-shadow var(--transition),
              background var(--transition), border-color var(--transition);
}

.nav-link .nav-ico {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link:hover {
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.04) 100%);
  color: #fff;
  border-color: rgba(255,255,255,0.20);
  box-shadow:
    0 4px 10px rgba(0,0,0,0.40),
    inset 0 1px 0 rgba(255,255,255,0.10);
  transform: translateY(-1px);
}

.nav-link:active {
  transform: translateY(0);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.30),
    inset 0 1px 2px rgba(0,0,0,0.20);
}

.nav-link.active {
  background: linear-gradient(180deg, #5B6B82 0%, #475569 100%);
  color: #fff;
  font-weight: 600;
  border-color: rgba(255,255,255,0.28);
  box-shadow:
    0 4px 14px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.14),
    inset 0 -1px 0 rgba(0,0,0,0.15);
}

.nav-link.active:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px rgba(0,0,0,0.50),
    inset 0 1px 0 rgba(255,255,255,0.14),
    inset 0 -1px 0 rgba(0,0,0,0.15);
}

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

/* Drag & drop dos itens do menu lateral.
   A "mãozinha" (grab) só aparece depois de clicar e segurar — ver enableSidebarDnD.
   Sem a classe .drag-armed o cursor fica normal (definido em .nav-link). */
.nav-link.drag-armed {
  cursor: grab;
}
.nav-link.drag-armed:active,
.nav-link.dragging-nav {
  cursor: grabbing;
}
.nav-link.dragging-nav {
  opacity: 0.45;
  transform: scale(0.97);
  border-style: dashed;
}
.nav-link.drag-over-nav {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow:
    0 0 0 2px rgba(96, 165, 250, 0.25),
    0 4px 10px rgba(0,0,0,0.40);
}
.nav-group {
  position: relative;
}
.nav-group .drag-hint {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  margin: 2px 6px 0;
  font-style: italic;
  user-select: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.nav-group:hover .drag-hint {
  opacity: 1;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

/* Botão Voltar global no topbar */
.btn-voltar-topbar {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  margin-right: 12px;
}
.btn-voltar-topbar:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.btn-voltar-topbar:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Container do title agrupa botão Voltar + texto */
.topbar-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

/* Toggle de visibilidade da senha (olho) */
.password-wrapper {
  position: relative;
}
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  padding-right: 42px;
}
.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 4px;
  color: var(--text-muted);
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.password-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Link "Esqueci minha senha" */
.forgot-password-link {
  display: block;
  text-align: right;
  margin-top: -8px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.forgot-password-link:hover {
  text-decoration: underline;
}

/* Formulário inline de reset de senha */
.forgot-password-box {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.forgot-password-box label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 6px;
}
.forgot-password-box .forgot-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.forgot-password-box .forgot-actions button {
  flex: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 26px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 14px;
}

.placeholder-section {
  text-align: center;
  padding: 60px 30px;
  color: var(--text-muted);
}

/* ----- Dashboard stat cards ----- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid #CBD5E1;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 10px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(15, 23, 42, 0.03);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
              border-color var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 4px 8px rgba(15, 23, 42, 0.08),
    0 12px 24px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(15, 23, 42, 0.05);
  border-color: var(--primary);
}

.stat-card:active {
  transform: translateY(-1px);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.10),
    0 2px 6px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stat-card[draggable="true"] { cursor: grab; }
.stat-card[draggable="true"]:active { cursor: grabbing; }

.stat-card.dragging {
  opacity: 0.4;
  transform: scale(0.96);
}

.stat-card.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.25), var(--shadow-md);
  transform: scale(1.02);
}

/* Cards de IA — destaque visual sutil */
.stat-card-ia {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAF5FF 100%);
  border-color: #d8b4fe;
  position: relative;
  overflow: hidden;
}

.stat-card-ia::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at top right, rgba(168, 85, 247, 0.12), transparent 70%);
  pointer-events: none;
}

.stat-card-ia:hover {
  border-color: #a855f7;
  box-shadow:
    0 4px 8px rgba(168, 85, 247, 0.15),
    0 12px 24px rgba(168, 85, 247, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Dropzone (Importar contrato via IA) */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  border: 2px dashed #c7d2fe;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  gap: 6px;
}

.dropzone:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  transform: translateY(-1px);
}

.dropzone.dragover {
  border-color: #6d28d9;
  background: linear-gradient(135deg, #ddd6fe, #c4b5fd);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.18);
}

.dropzone-icon {
  font-size: 42px;
  line-height: 1;
}

.dropzone-text strong {
  color: var(--primary-dark);
  font-size: 15px;
}

.dropzone.has-file {
  border-style: solid;
  border-color: #22c55e;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
}

.dropzone.has-file .dropzone-icon::after {
  content: '✓';
}

.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: var(--primary-light);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(15, 23, 42, 0.06),
    0 1px 2px rgba(15, 23, 42, 0.05);
}

.stat-icon-blue   { background: #DBEAFE; }
.stat-icon-purple { background: #EDE9FE; }
.stat-icon-amber  { background: #FEF3C7; }
.stat-icon-green  { background: #DCFCE7; }
.stat-icon-teal   { background: #CCFBF1; }
.stat-icon-rose   { background: #FFE4E6; }

.stat-card-body {
  flex: 1;
  min-width: 0;
}

.stat-card-value {
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Variante pra valores monetários (strings longas tipo "R$ 1.320,00") */
.stat-card-value.is-money {
  font-size: clamp(15px, 1.5vw, 20px);
  letter-spacing: -0.2px;
}

/* KPI card ativo (quando usado como filtro) */
.stat-card.is-active-filter {
  border-color: var(--primary);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--primary-light) 100%);
  box-shadow:
    0 0 0 2px rgba(71, 85, 105, 0.18),
    0 4px 10px rgba(15, 23, 42, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Destaque pulsante em campos com erro (chama atenção do operador) */
@keyframes input-erro-pulse {
  0%, 100% {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.20);
  }
  50% {
    border-color: var(--danger);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.10);
  }
}
.input-erro-pulse {
  animation: input-erro-pulse 0.6s ease-in-out 3;
  outline: none !important;
}

/* Status inline contextual — aparece perto do botão clicado, não no topo */
.status-inline {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.4;
  border: 1px solid transparent;
  word-break: break-word;
}
.status-inline.is-loading {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: var(--text-muted);
  animation: ia-pulse 1.4s ease-in-out infinite;
}
.status-inline.is-success {
  background: var(--success-light);
  border-color: #86EFAC;
  color: var(--success);
}
.status-inline.is-error {
  background: var(--danger-light);
  border-color: #FCA5A5;
  color: var(--danger);
}
.status-inline.is-info {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.status-inline a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

/* =========================================================
   PAINEL DE ALERTAS RESUMO no Dashboard
   ========================================================= */
.alertas-contadores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.alerta-contador {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.alerta-contador:hover { transform: translateY(-2px); }
.alerta-contador.nivel-critico {
  background: #FEE2E2;
  border-color: #FCA5A5;
}
.alerta-contador.nivel-critico:hover { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25); }
.alerta-contador.nivel-atencao {
  background: #FEF3C7;
  border-color: #FCD34D;
}
.alerta-contador.nivel-atencao:hover { box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25); }
.alerta-contador.nivel-info {
  background: #DBEAFE;
  border-color: #93C5FD;
}
.alerta-contador.nivel-info:hover { box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25); }

.alerta-contador-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}
.alerta-contador.nivel-critico .alerta-contador-num { color: #991B1B; }
.alerta-contador.nivel-atencao .alerta-contador-num { color: #92400E; }
.alerta-contador.nivel-info .alerta-contador-num { color: #1E40AF; }

.alerta-contador-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: right;
}
.alerta-contador.nivel-critico .alerta-contador-label { color: #991B1B; }
.alerta-contador.nivel-atencao .alerta-contador-label { color: #92400E; }
.alerta-contador.nivel-info .alerta-contador-label { color: #1E40AF; }

/* Lista de mini cards de alertas */
.alertas-mini-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alerta-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.15s;
}
.alerta-mini:hover {
  border-color: var(--primary);
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.alerta-mini.nivel-critico { border-left: 4px solid #DC2626; }
.alerta-mini.nivel-atencao { border-left: 4px solid #F59E0B; }
.alerta-mini.nivel-info    { border-left: 4px solid #3B82F6; }

.alerta-mini-icone {
  font-size: 22px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.alerta-mini-body { flex: 1; min-width: 0; }
.alerta-mini-titulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alerta-mini-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alerta-mini-arrow {
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.alerta-mini:hover .alerta-mini-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

/* Caixa Asaas no rodapé do balancete */
.asaas-balancete-box {
  background: linear-gradient(135deg, #ECFEFF, #CFFAFE);
  border: 1px solid #67E8F9;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 14px;
}

/* =========================================================
   CALENDÁRIO — agrupamento de eventos por dia/mês
   ========================================================= */
.calendario-mes-titulo {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
}
.calendario-mes-titulo:first-child { margin-top: 0; }

.calendario-dia-grupo {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.calendario-dia-grupo:last-child { border-bottom: none; }
.calendario-dia-caixa {
  flex-shrink: 0;
  width: 64px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 8px;
  padding: 6px 4px;
  height: fit-content;
}
.calendario-dia-caixa.hoje {
  background: linear-gradient(180deg, #DC2626, #B91C1C);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}
.calendario-dia-caixa.passado {
  background: linear-gradient(180deg, #6B7280, #4B5563);
  opacity: 0.7;
}
.calendario-dia-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}
.calendario-dia-mes {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.9;
}
.calendario-dia-semana {
  font-size: 9.5px;
  opacity: 0.8;
  margin-top: 2px;
}
.calendario-eventos {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.calendario-evento {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.15s;
}
.calendario-evento:hover {
  border-color: var(--primary);
  transform: translateX(3px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.calendario-evento-icone {
  font-size: 18px;
  width: 24px;
  flex-shrink: 0;
  text-align: center;
}
.calendario-evento-body {
  flex: 1;
  min-width: 0;
}
.calendario-evento-titulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.calendario-evento-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.calendario-evento.tipo-critico { border-left: 4px solid #DC2626; }
.calendario-evento.tipo-atencao { border-left: 4px solid #F59E0B; }
.calendario-evento.tipo-info { border-left: 4px solid #3B82F6; }
.calendario-evento.tipo-rotina { border-left: 4px solid #10B981; }

/* =========================================================
   KBD — teclas de atalho
   ========================================================= */
kbd {
  display: inline-block;
  padding: 2px 6px;
  background: linear-gradient(180deg, #F8FAFC 0%, #E2E8F0 100%);
  border: 1px solid #94A3B8;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #1E293B;
  box-shadow: 0 1px 0 rgba(0,0,0,0.12);
  margin: 0 1px;
}

/* =========================================================
   TAGS — input com chips (etiquetas customizáveis)
   ========================================================= */
.tags-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  min-height: 42px;
}
.tags-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.15);
}
.tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tags-input-wrapper input {
  flex: 1;
  min-width: 150px;
  border: none;
  outline: none;
  padding: 4px 6px;
  font-size: 13px;
  background: transparent;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #DBEAFE, #BFDBFE);
  color: #1E40AF;
  padding: 3px 8px 3px 10px;
  border-radius: 14px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid #93C5FD;
}
.tag-chip-remove {
  background: rgba(30, 64, 175, 0.15);
  border: none;
  color: #1E40AF;
  cursor: pointer;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
  transition: background 0.15s;
}
.tag-chip-remove:hover {
  background: #DC2626;
  color: white;
}

/* =========================================================
   GRÁFICOS do Dashboard (Chart.js)
   ========================================================= */
.graficos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}
.grafico-box {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px 18px;
  min-height: 240px;
}
.grafico-box h4 {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
  font-weight: 600;
}

/* =========================================================
   BANNER OFFLINE (PWA — quando navigator.onLine === false)
   ========================================================= */
.offline-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #DC2626, #B91C1C);
  color: white;
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  z-index: 99998;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
  animation: slide-up-banner 0.3s ease-out;
}
@keyframes slide-up-banner {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* =========================================================
   MODAL DE CONFIRMAÇÃO (substitui confirm() nativo)
   ========================================================= */
.modal-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 20px;
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-confirm-card {
  background: white;
  border-radius: 14px;
  max-width: 440px;
  width: 100%;
  padding: 28px 26px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: slide-up 0.2s ease-out;
}
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-confirm-icone {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
}
.modal-confirm-card h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}
.modal-confirm-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}
.modal-confirm-extra {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--text);
  text-align: left;
}
.modal-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-confirm-actions .btn {
  flex: 1;
  max-width: 180px;
  padding: 11px 18px;
}
/* Variante "perigo" — pra ações destrutivas */
.modal-confirm-card.is-danger .modal-confirm-icone { color: var(--danger); }
.modal-confirm-card.is-danger #btn-modal-confirm-ok {
  background: var(--danger);
  border-color: var(--danger);
}
.modal-confirm-card.is-danger #btn-modal-confirm-ok:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}
.modal-confirm-card.is-warning #btn-modal-confirm-ok {
  background: #F59E0B;
  border-color: #F59E0B;
}
.modal-confirm-card.is-warning #btn-modal-confirm-ok:hover {
  background: #D97706;
}

/* =========================================================
   IMPORTAÇÃO CSV — passos guiados (4 etapas)
   ========================================================= */
.import-passo {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  background: #FFFFFF;
}
.import-passo-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.import-passo-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.import-passo-header strong {
  font-size: 15px;
  color: var(--text);
}

/* Grid de cards pra escolher tipo de registro */
.import-tipos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.import-tipo-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
  position: relative;
  display: block;
}
.import-tipo-card input[type="radio"] {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.import-tipo-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.import-tipo-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(71, 85, 105, 0.2);
}
.import-tipo-emoji {
  font-size: 32px;
  margin-bottom: 6px;
}
.import-tipo-titulo {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}
.import-tipo-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Dropzone de upload do CSV */
.import-dropzone {
  border: 2px dashed #94A3B8;
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
}
.import-dropzone:hover,
.import-dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.01);
}
.import-dropzone-icone {
  font-size: 42px;
  margin-bottom: 8px;
  line-height: 1;
}
.import-dropzone-titulo {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.import-dropzone-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Card de arquivo selecionado (pós-upload) */
.import-arquivo-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--success-light);
  border: 1.5px solid #86EFAC;
  border-radius: 10px;
  margin-top: 10px;
}
.import-arquivo-info-icone {
  font-size: 30px;
  line-height: 1;
}
.import-arquivo-info-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.import-arquivo-info-body strong {
  font-size: 14px;
  color: #166534;
  word-break: break-all;
}

/* =========================================================
   IA Dropzone — upload de documento pra autopreencher cadastros
   ========================================================= */
.ia-dropzone-card {
  background: linear-gradient(135deg, #FAF5FF 0%, #F3E8FF 100%);
  border: 1.5px dashed #C084FC;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  transition: all 0.15s;
}
.ia-dropzone-card:hover {
  border-color: #A855F7;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.12);
}
.ia-dropzone-header {
  margin-bottom: 10px;
}
.ia-dropzone-header strong {
  display: block;
  font-size: 13px;
  color: #6B21A8;
  margin-bottom: 4px;
}
.ia-dropzone-header small {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}
.ia-dropzone-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ia-dropzone-status {
  font-size: 12px;
  color: var(--text-muted);
}
.ia-dropzone-status.is-loading { color: #7c3aed; font-weight: 500; }
.ia-dropzone-status.is-success { color: var(--success); font-weight: 600; }
.ia-dropzone-status.is-error { color: var(--danger); font-weight: 500; }

/* Pulsar enquanto IA processa */
@keyframes ia-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.ia-dropzone-status.is-loading { animation: ia-pulse 1.4s ease-in-out infinite; }

/* =========================================================
   PAPÉIS — checkboxes "Pode atuar como: Locador / Vendedor"
   ========================================================= */
.papeis-box {
  background: linear-gradient(135deg, #F1F5F9, #E2E8F0);
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.papeis-titulo {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.papeis-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.papel-check {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.papel-check:hover {
  border-color: var(--primary);
}
.papel-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.papel-check input[type="checkbox"]:checked + .papel-emoji + .papel-label,
.papel-check:has(input[type="checkbox"]:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}
.papel-emoji {
  font-size: 22px;
  line-height: 1;
}
.papel-label {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.papel-label small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Chips de papel na listagem */
.papel-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-left: 4px;
  vertical-align: middle;
}
.papel-chip.locador { background: #DBEAFE; color: #1E40AF; }
.papel-chip.vendedor { background: #FEF3C7; color: #92400E; }
.papel-chip.ambos { background: linear-gradient(135deg, #DBEAFE, #FEF3C7); color: #475569; }

/* Filtro de papel na lista */
.papel-filtros {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.papel-filtro-btn {
  background: white;
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.papel-filtro-btn:hover {
  border-color: var(--primary);
}
.papel-filtro-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* =========================================================
   ELABORAR CONTRATO — Wizard redesenhado
   ========================================================= */

/* Etapa 1: escolha de modalidade — cards grandes */
.elab-modalidade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 30px 0 14px;
}
.elab-modalidade-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 26px 22px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.elab-modalidade-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.2s;
}
.elab-modalidade-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}
.elab-modalidade-card:hover::before {
  opacity: 1;
}
.elab-modalidade-card .emoji {
  font-size: 42px;
  line-height: 1;
}
.elab-modalidade-card .titulo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}
.elab-modalidade-card .descricao {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Hero card de progresso */
.elab-hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, #F1F5F9 100%);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.elab-hero-info {
  flex: 1;
  min-width: 200px;
}
.elab-hero-titulo {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
}
.elab-hero-progresso {
  font-size: 12px;
  color: var(--text-muted);
}
.elab-hero-stats {
  display: flex;
  align-items: center;
  gap: 14px;
}
.elab-hero-percent {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1;
  min-width: 70px;
  text-align: right;
}
.elab-hero-percent small {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}
.elab-hero-barra {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid rgba(71, 85, 105, 0.1);
}
.elab-hero-barra-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 5px;
  transition: width 0.3s ease-out;
  box-shadow: 0 0 8px rgba(71, 85, 105, 0.3);
}

/* Grid de perguntas */
.elab-perguntas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.elab-perguntas-grid .elab-pergunta {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.15s;
  margin: 0;
}
.elab-perguntas-grid .elab-pergunta:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.elab-perguntas-grid .elab-pergunta.is-empty-required {
  border-color: #FCA5A5;
  background: #FEF2F2;
}
.elab-perguntas-grid .elab-pergunta.is-filled {
  border-color: #86EFAC;
  background: #F0FDF4;
}
.elab-perguntas-grid .elab-pergunta.full-width {
  grid-column: 1 / -1;
}
.elab-perguntas-grid .elab-pergunta label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.elab-perguntas-grid .elab-pergunta input,
.elab-perguntas-grid .elab-pergunta select,
.elab-perguntas-grid .elab-pergunta textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.15s;
}
.elab-perguntas-grid .elab-pergunta input:focus,
.elab-perguntas-grid .elab-pergunta select:focus,
.elab-perguntas-grid .elab-pergunta textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.15);
}

/* Footer de ações do wizard */
.elab-wizard-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .elab-perguntas-grid {
    grid-template-columns: 1fr;
  }
  .elab-hero {
    flex-direction: column;
    align-items: stretch;
  }
  .elab-hero-stats {
    justify-content: space-between;
  }
}

/* <details> com visual claro de abre/fecha */
details.card > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  user-select: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before {
  content: '▶';
  display: inline-block;
  transition: transform 0.2s;
  font-size: 10px;
  color: var(--text-muted);
}
details.card[open] > summary::before {
  transform: rotate(90deg);
}
details.card > summary:hover {
  color: var(--primary-dark);
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.placeholder-section .badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--warning-light);
  color: var(--warning);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* ----- Tabela super-admin ----- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--primary);
}

.table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover { background: var(--bg); }

.badge-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-status.ativo { background: var(--success-light); color: var(--success); }
.badge-status.suspenso { background: var(--danger-light); color: var(--danger); }
.badge-status.aprovado { background: var(--success-light); color: var(--success); }
.badge-status.reprovado { background: var(--danger-light); color: var(--danger); }
.badge-status.pendente_analise { background: var(--warning-light); color: var(--warning); }
.badge-status.disponivel { background: var(--success-light); color: var(--success); }
.badge-status.alugado { background: var(--primary-light); color: var(--primary-dark); }
.badge-status.vendido { background: #FEF3C7; color: #B45309; }
.badge-status.em_reforma { background: var(--warning-light); color: var(--warning); }
.badge-status.indisponivel { background: var(--danger-light); color: var(--danger); }
.badge-status.em_negociacao { background: #EDE9FE; color: #6D28D9; }
.badge-status.aceita { background: var(--success-light); color: var(--success); }
.badge-status.fechada { background: #FEF3C7; color: #B45309; }
.badge-status.recusada { background: var(--danger-light); color: var(--danger); }
.badge-status.rascunho { background: #ECEFF1; color: #455A64; }
.badge-status.vigente { background: var(--success-light); color: var(--success); }
.badge-status.encerrado { background: var(--primary-light); color: var(--primary-dark); }
.badge-status.rescindido { background: var(--danger-light); color: var(--danger); }

/* ----- Section header (título + botão de ação) ----- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-header h3 {
  margin-bottom: 4px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* ----- Tabela com ações ----- */
.table-wrap {
  overflow-x: auto;
  margin: 0 -6px;
}

.table .empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-style: italic;
}

.table .action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ----- Form layout dentro de modal ----- */
.form-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 28px 0 16px;
  padding: 11px 14px;
  background: linear-gradient(90deg, var(--primary-light) 0%, rgba(241, 245, 249, 0.3) 100%);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  position: relative;
}

.form-section-title:first-child {
  margin-top: 0;
}

/* Contêiner que segue o título: visualmente conectado */
.form-section-title + .form-group,
.form-section-title + .form-row {
  margin-top: 8px;
}

/* Estilo unificado para "cards de instrução" que aparecem em forms */
.form-info-box {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 1px solid #c7d2fe;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 14px;
}

.form-info-box.warn {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #fcd34d;
  border-left-color: #f59e0b;
  color: #92400e;
}

.form-info-box.success {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-color: #86efac;
  border-left-color: #16a34a;
  color: #065f46;
}

/* Override do .form-row para grid responsiva quando dentro de modal */
.modal-body .form-row {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* ----- Modal ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-lg { max-width: 820px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.modal-header h3 {
  font-size: 17px;
  color: var(--text);
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 6px;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-body select,
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body input[type="date"],
.modal-body input[type="number"],
.modal-body input[type="tel"],
.modal-body input[type="file"],
.modal-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  background: var(--card-bg);
}

.modal-body select:focus,
.modal-body input:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,137,123,0.12);
}

.modal-body textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.modal-footer .btn-danger {
  margin-right: auto;
}

/* ----- Lista de documentos do cadastro ----- */
.docs-list {
  margin-bottom: 14px;
}

.docs-list .empty {
  padding: 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  font-style: italic;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
  background: var(--card-bg);
  transition: border-color var(--transition);
}

.doc-item:hover {
  border-color: var(--primary);
}

.doc-item .doc-icon { font-size: 18px; }
.doc-item .doc-name { flex: 1; font-weight: 500; word-break: break-all; }
.doc-item .doc-meta { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

.doc-item .doc-actions {
  display: flex;
  gap: 2px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 14px;
  transition: all var(--transition);
}

.btn-icon:hover { background: var(--bg); color: var(--primary); }
.btn-icon.btn-icon-danger:hover { color: var(--danger); }

/* ----- Área de upload ----- */
.upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.upload-area input[type="file"] {
  flex: 1;
  min-width: 200px;
  padding: 6px 8px !important;
  font-size: 13px;
}

/* ----- Toggle row (checkbox + label inline) ----- */
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ----- Caixa de publicação pública ----- */
.publicacao-box {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.link-display {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.link-display input {
  flex: 1;
  min-width: 240px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: white;
  color: var(--text);
  font-family: 'Courier New', monospace;
}

/* ----- Galeria de fotos do imóvel ----- */
.fotos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fotos-grid .empty {
  grid-column: 1 / -1;
  padding: 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  font-style: italic;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.foto-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.foto-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.foto-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.foto-item .foto-del {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.foto-item:hover .foto-del { opacity: 1; }
.foto-item .foto-del:hover { background: var(--danger); }

/* Drag & drop pra reordenar fotos */
.foto-item[draggable="true"] {
  cursor: grab;
}
.foto-item[draggable="true"]:active {
  cursor: grabbing;
}
.foto-item.arrastando {
  opacity: 0.4;
  transform: scale(0.95);
}
.foto-item.drop-target {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.3), var(--shadow-md);
  transform: scale(1.03);
}

/* Badge "Capa" na primeira foto (vira capa do anúncio público) */
.foto-item.is-capa {
  border: 2px solid #FBBF24;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.4);
}
.foto-capa-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #78350F;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Estado "arrastando arquivos do desktop" no container */
#imovel-fotos-section.dropping-files {
  position: relative;
}
#imovel-fotos-section.dropping-files::after {
  content: '📷 Solte aqui pra fazer upload';
  position: absolute;
  inset: 0;
  background: rgba(71, 85, 105, 0.15);
  border: 3px dashed var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
  pointer-events: none;
  z-index: 10;
}

/* ----- Preview do contrato (modal) ----- */
.contrato-preview {
  background: white;
  padding: 32px 48px;
  font-family: 'Times New Roman', Georgia, serif;
  font-size: 13px;
  line-height: 1.7;
  color: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.contrato-preview .contrato-header {
  text-align: center;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ddd;
}

.contrato-preview .contrato-header h1 {
  font-size: 18px;
  font-weight: bold;
  margin: 0 0 6px;
  color: #000;
}

.contrato-preview .contrato-empresa {
  font-weight: bold;
  margin: 0;
}

.contrato-preview .contrato-empresa-sub {
  font-size: 11px;
  color: #555;
  margin-top: 2px;
}

.contrato-preview .contrato-conteudo {
  margin-bottom: 18px;
}

.contrato-preview .contrato-conteudo h3 {
  font-size: 14px;
  margin: 18px 0 8px;
  color: #000;
}

.contrato-preview .contrato-conteudo p {
  margin: 8px 0;
  text-align: justify;
}

.contrato-preview .contrato-rodape {
  margin-top: 30px;
}

.contrato-preview .contrato-assinaturas {
  display: flex;
  gap: 32px;
  margin: 30px 0 16px;
}

.contrato-preview .assinatura {
  flex: 1;
  text-align: center;
}

.contrato-preview .assinatura-linha {
  border-top: 1px solid #000;
  margin: 28px 8px 6px;
}

.contrato-preview .assinatura strong { display: block; }
.contrato-preview .assinatura span {
  font-size: 11px;
  color: #555;
}

.contrato-preview .contrato-testemunhas {
  margin-top: 22px;
  font-size: 12px;
}

/* ----- Balancete (blocos, lançamentos, resumo) ----- */
.balancete-bloco {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  overflow: hidden;
}

.balancete-bloco-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.balancete-bloco-header h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bloco-entrada h4 { color: var(--success); }
.bloco-despesa-loc h4 { color: var(--danger); }
.bloco-despesa-loct h4 { color: var(--warning); }
.bloco-taxa h4 { color: var(--primary-dark); }

.lanc-list {
  padding: 8px 12px;
}

.lanc-list .empty-lanc {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  font-style: italic;
}

.lanc-row {
  display: grid;
  grid-template-columns: 160px 1fr 130px 110px 30px;
  gap: 8px;
  padding: 6px 0;
  align-items: center;
}

.lanc-row select,
.lanc-row input[type="text"],
.lanc-row input[type="number"] {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
}

.lanc-row input:focus,
.lanc-row select:focus {
  outline: none;
  border-color: var(--primary);
}

.lanc-row .lanc-comprovante-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 11px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.lanc-row .lanc-comprovante-btn:hover { border-color: var(--primary); }

.lanc-row .lanc-comprovante-btn.has-file {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

.lanc-row .lanc-comprovante-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.lanc-row .lanc-del {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

.lanc-row .lanc-del:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.balancete-bloco-total {
  padding: 8px 14px;
  background: white;
  border-top: 1px solid var(--border);
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
}

.balancete-bloco-total strong {
  color: var(--text);
  margin-left: 6px;
}

/* Resumo do balancete */
.balancete-resumo {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 18px 0;
  box-shadow: var(--shadow-md);
}

.balancete-resumo .resumo-linha {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  font-size: 14px;
}

.balancete-resumo .resumo-linha strong { font-weight: 600; }

.balancete-resumo .resumo-final {
  margin-top: 8px;
  padding-top: 12px;
  border-bottom: none;
  border-top: 2px solid rgba(255,255,255,0.3);
}

.balancete-resumo .resumo-final span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.balancete-resumo .resumo-final strong {
  font-size: 22px;
}

.resumo-pix {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.20);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.resumo-pix-info {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}

.resumo-pix-info span {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

.resumo-pix-info strong {
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  color: white;
  word-break: break-all;
}

.btn-pix {
  background: white;
  color: var(--primary-dark);
  font-weight: 600;
  padding: 9px 14px;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.btn-pix:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.20);
}

.btn-pix:active { transform: translateY(0); }

.resumo-pix-aviso {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(255,193,7,0.18);
  border: 1px solid rgba(255,193,7,0.40);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: white;
}

/* ----- Alertas (cards agrupados por severidade) ----- */
.alerta-grupo {
  margin-bottom: 22px;
}

.alerta-grupo-titulo {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.alerta-grupo-critico .alerta-grupo-titulo { color: var(--danger); border-bottom-color: var(--danger); }
.alerta-grupo-atencao .alerta-grupo-titulo { color: var(--warning); border-bottom-color: var(--warning); }
.alerta-grupo-info .alerta-grupo-titulo { color: var(--primary); border-bottom-color: var(--primary); }

.alerta-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: white;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.alerta-card:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.alerta-card.critico { border-left-color: var(--danger); }
.alerta-card.atencao { border-left-color: var(--warning); }
.alerta-card.info    { border-left-color: var(--primary); }

.alerta-icone { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.alerta-conteudo { flex: 1; min-width: 0; }
.alerta-titulo { font-weight: 600; color: var(--text); font-size: 14px; }
.alerta-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.alerta-vazio {
  padding: 30px;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

/* ----- Banner 'Atuando como' (super admin) ----- */
.banner-atuando {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: linear-gradient(90deg, #C2410C 0%, #B45309 100%);
  color: white;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid #92310B;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.banner-atuando button {
  background: white;
  color: #B45309;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
}

.banner-atuando button:hover { background: #FEF3C7; }

@media (max-width: 720px) {
  .lanc-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .lanc-row select, .lanc-row input { grid-column: span 1; }
  .lanc-row .lanc-comprovante-btn, .lanc-row .lanc-del { grid-column: span 1; }
}

/* ----- Balancete impresso (preview) ----- */
.contrato-preview .balancete-info-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 12px;
  margin-bottom: 16px;
  font-size: 12px;
}

.contrato-preview .balancete-info-grid .lbl {
  color: #555;
  font-weight: 600;
}

.contrato-preview table.balancete-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 12px;
}

.contrato-preview table.balancete-table caption {
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 0;
  font-size: 12px;
  color: #000;
}

.contrato-preview table.balancete-table th,
.contrato-preview table.balancete-table td {
  border-bottom: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
}

.contrato-preview table.balancete-table th {
  background: #f0f0f0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.contrato-preview table.balancete-table td.valor,
.contrato-preview table.balancete-table th.valor {
  text-align: left;
  white-space: nowrap;
}

.contrato-preview table.balancete-table tr.total-row td {
  font-weight: 700;
  background: #f9f9f9;
  border-bottom: 2px solid #000;
}

.contrato-preview .balancete-resumo-print {
  margin: 24px 0;
  border: 2px solid #000;
  padding: 14px 18px;
}

.contrato-preview .balancete-resumo-print .linha {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.contrato-preview .balancete-resumo-print .linha.final {
  border-top: 2px solid #000;
  margin-top: 8px;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 700;
}

.contrato-preview .balancete-anexos {
  margin: 20px 0;
  font-size: 11px;
}

.contrato-preview .balancete-anexos ul {
  list-style: disc inside;
  margin-top: 6px;
}

/* =============================================================
   PORTAIS IMOBILIÁRIOS — cards de integração
   ============================================================= */
.portais-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.portal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.portal-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.08), 0 12px 24px rgba(71, 85, 105, 0.18);
}

.portal-card-unavailable {
  background: #fafafa;
  opacity: 0.85;
}

.portal-card-unavailable:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
}

.portal-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-card-header h4 {
  margin: 0 0 2px;
  font-size: 16px;
  color: var(--text);
}

.portal-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.portal-card-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.portal-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.portal-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.portal-card-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portal-meta-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.portal-card-meta strong {
  font-size: 12px;
  color: var(--text);
}

.portal-card-status {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}

.portal-card-status.status-soon {
  background: #fef3c7;
  color: #92400e;
  border: 1px dashed #fcd34d;
}

.portal-card-status.status-unavailable {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.portal-card-status.status-active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #86efac;
}

.feed-url-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}

.feed-url-input {
  flex: 1;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text-muted);
}

.feed-url-row .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================================
   Checkboxes de permissões em modais de Perfil (DRG + tenant)
   ============================================================= */
.perfil-grupo {
  margin-bottom: 16px;
}

.perfil-grupo:last-child {
  margin-bottom: 0;
}

.perfil-grupo-titulo {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-dark);
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: 6px;
  margin-bottom: 8px;
}

/* ===== Perfis 2.0 — grade de cards acesso+editar / ações ===== */
.perfil-grade {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.perfil-card-modulo {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--card-bg);
}
.perfil-card-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.perfil-card-checks {
  display: flex;
  gap: 14px;
  align-items: center;
}
.perfil-card-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.perfil-card-checks input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}
.perfil-card-checks input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.4; }
.perfil-card-leitura {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}
/* Cards de ação sensível — destaque âmbar */
.perfil-card-acao {
  border: 1px solid #FCD34D;
  border-radius: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
}
.perfil-card-acao label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.perfil-card-acao input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #d97706;
  cursor: pointer;
  flex-shrink: 0;
}
.perfil-card-acao strong {
  display: block;
  font-size: 12.5px;
  color: #92400E;
}
.perfil-card-acao small {
  display: block;
  font-size: 10.5px;
  color: #b45309;
  margin-top: 2px;
}

.perfil-grupo-itens {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.perfil-item-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.perfil-item-checkbox:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateX(2px);
}

.perfil-item-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.perfil-item-checkbox input[type="checkbox"]:checked + span {
  font-weight: 600;
  color: var(--primary-dark);
}

.perfil-item-checkbox:has(input[type="checkbox"]:checked) {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(71, 85, 105, 0.08);
}

/* ===== S3 — Minha conta / 2FA TOTP ===== */
.mfa-bloco {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  background: #fff;
}
.mfa-titulo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.mfa-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.mfa-badge-on { background: #dcfce7; color: #15803d; }
.mfa-badge-off { background: #f1f5f9; color: #64748b; }
.mfa-passos {
  margin: 4px 0 14px;
  padding-left: 20px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.7;
}
.mfa-qrcode {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 auto 10px;
  width: max-content;
}
.mfa-qrcode img,
.mfa-qrcode canvas { display: block; }
.mfa-secret-linha {
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
}
.mfa-secret {
  display: inline-block;
  margin-top: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  background: #f1f5f9;
  color: #0f172a;
  padding: 4px 10px;
  border-radius: 6px;
}
#mfa-codigo {
  font-size: 20px;
  letter-spacing: 6px;
  text-align: center;
  font-family: 'Courier New', monospace;
}
.mfa-acoes {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.mfa-ok {
  font-size: 14px;
  font-weight: 700;
  color: #15803d;
  margin: 0 0 6px;
}

/* ===== S4 — Aprovações de pagamento ===== */
.aprovar-resumo {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.aprovar-linha {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.aprovar-linha:last-child { border-bottom: none; }
.aprovar-linha span { color: #64748b; }
.aprovar-linha strong { color: var(--text); text-align: right; word-break: break-all; }
.aprovar-linha-valor { background: #f0fdf4; }
.aprovar-linha-valor strong { font-size: 17px; color: #15803d; }
#aprovar-totp {
  font-size: 20px;
  letter-spacing: 6px;
  text-align: center;
  font-family: 'Courier New', monospace;
}
.aprov-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.aprov-badge-aguardando { background: #fef9c3; color: #854d0e; }
.aprov-badge-aprovado { background: #dcfce7; color: #15803d; }
.aprov-badge-rejeitado { background: #fee2e2; color: #b91c1c; }

/* =============================================================
   Toggle PF/PJ no signup
   ============================================================= */
.tipo-pessoa-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.tipo-pessoa-btn {
  padding: 14px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
  line-height: 1.3;
}

.tipo-pessoa-btn small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
  color: var(--text-muted);
}

.tipo-pessoa-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.tipo-pessoa-btn.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(71, 85, 105, 0.25);
  transform: translateY(-1px);
}

.tipo-pessoa-btn.active small {
  color: rgba(255, 255, 255, 0.85);
}

/* =============================================================
   APURAÇÃO EM TEMPO REAL — card no topo do balancete
   ============================================================= */
.apuracao-card {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #cbd5e1;
}

.apuracao-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.apuracao-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.apuracao-item.entrada { border-left: 3px solid #16a34a; }
.apuracao-item.saida { border-left: 3px solid #dc2626; }
.apuracao-item.taxa { border-left: 3px solid #8b5cf6; }
.apuracao-item.liquido {
  border-left: 3px solid #f59e0b;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.apuracao-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.apuracao-item strong {
  font-size: 17px;
  color: var(--text);
}

.apuracao-item.liquido strong {
  font-size: 20px;
  color: #92400e;
}

/* =============================================================
   MULTI-COMPROVANTE — cards detectados pelo Gemini
   ============================================================= */
.multi-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
  transition: all 0.18s ease;
}

.multi-card-active {
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(71, 85, 105, 0.1);
}

.multi-card-skip {
  background: #f8fafc;
  opacity: 0.7;
}

.multi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.badge-tipo-doc {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.multi-card-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.multi-card-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.multi-card .form-row {
  margin-bottom: 8px;
}

.multi-card .form-group {
  margin-bottom: 0;
}

.multi-card .form-group label {
  font-size: 11px;
  font-weight: 600;
}

.multi-card input, .multi-card select {
  font-size: 13px;
}

/* =============================================================
   VINCULAÇÃO AO CONTRATO (Fase 3)
   ============================================================= */
.vinculacao-box {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0 0 10px;
  font-size: 12.5px;
}

.vinculacao-box.vinc-forte {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border: 1px solid #86efac;
  color: #065f46;
}

.vinculacao-box.vinc-parcial {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  color: #92400e;
}

.vinculacao-box.vinc-nenhum {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.vinc-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
}

.vinc-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: currentColor;
  cursor: pointer;
}

.vinc-motivos {
  margin: 6px 0 0;
  padding-left: 28px;
  list-style: none;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.5;
}

.vinc-motivos li {
  margin-bottom: 2px;
}

.vinc-aviso {
  margin: 6px 0 4px;
  padding-left: 28px;
  font-size: 11.5px;
  font-weight: 400;
}

.vinculacao-box.vinc-nenhum p {
  margin: 0;
  font-weight: 500;
}

/* Badge na linha do lançamento (Entrada / Despesa) */
.lanc-vinc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
  flex-shrink: 0;
}

.lanc-vinc-badge.vinc-ok {
  background: #d1fae5;
  color: #065f46;
}

.lanc-vinc-badge.vinc-parcial {
  background: #fef3c7;
  color: #92400e;
}

.lanc-vinc-badge.vinc-ia {
  background: #dbeafe;
  color: #1e40af;
}

/* =============================================================
   PWA — Banner instalar + Banner atualização disponível
   ============================================================= */
.pwa-install-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
  z-index: 9999;
  animation: pwaSlideUp 0.4s ease-out;
}

@keyframes pwaSlideUp {
  from { transform: translateY(120%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pwa-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.pwa-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-banner-text strong {
  font-size: 14px;
  color: var(--text);
}

.pwa-banner-text span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.pwa-banner-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.pwa-banner-actions .btn-secondary {
  padding: 4px 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.pwa-update-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 10px 16px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(71, 85, 105, 0.4);
  z-index: 9998;
  animation: pwaSlideDown 0.4s ease-out;
}

@keyframes pwaSlideDown {
  from { transform: translate(-50%, -200%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Mobile: PWA standalone mode — ajustes finos */
@media (display-mode: standalone) {
  body {
    /* Espaço extra pro notch do iPhone */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* =============================================================
   RESPONSIVE — Mobile (< 900px)
   Sidebar vira drawer + dashboard ocupa toda largura
   ============================================================= */

/* Botão hamburger — escondido no desktop */
.btn-menu-mobile {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-right: 10px;
  flex-shrink: 0;
}

.btn-menu-mobile:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* Overlay — escondido por padrão (só aparece em mobile com sidebar aberta) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 998;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  /* Sidebar vira drawer fixo à esquerda, fora da tela por padrão */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 999;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

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

  /* Botão hamburger aparece */
  .btn-menu-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Topbar — ajusta pra mobile */
  .topbar {
    padding: 0 12px;
    height: 56px;
  }

  .topbar-title {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-user-name {
    display: none; /* esconde nome do usuário em mobile, fica só botão Sair */
  }

  .topbar-user {
    gap: 6px;
  }

  /* Banner "Atuando como" */
  .banner-atuando {
    padding: 8px 12px;
    font-size: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* Main + content: padding menor */
  .main {
    width: 100%;
  }

  .content {
    padding: 12px !important;
  }

  /* Dashboard — 1 coluna */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Cards de stat menores */
  .stat-card {
    padding: 14px;
  }

  .stat-card-value {
    font-size: 22px;
  }

  /* Section header — empilha botões */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .section-header > div + div,
  .section-header button {
    width: 100%;
  }

  /* Cards genéricos */
  .card {
    padding: 14px !important;
  }

  /* Form rows: empilha em 1 coluna */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Filtros: empilha */
  .form-row[style*="max-width"] {
    max-width: 100% !important;
  }

  /* Tabelas: scroll horizontal */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    font-size: 12px;
    min-width: 600px; /* garante que tabela cabe e usuário rola lateralmente */
  }

  .table th, .table td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  /* Modais — full screen no mobile */
  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal, .modal-lg {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0;
  }

  .modal-body {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }

  .modal-footer .btn {
    flex: 1 1 100%;
    min-width: 0;
    margin: 2px 0;
  }

  /* Botões em geral menores */
  .btn {
    font-size: 13px;
  }

  /* Lançamentos do balancete: empilha */
  .lanc-row {
    flex-wrap: wrap;
  }

  /* Vitrine pública e portais */
  .portais-grid {
    grid-template-columns: 1fr !important;
  }

  /* Multi-card no balancete */
  .multi-card .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Apuração em tempo real: 2 colunas (cabe melhor) */
  .apuracao-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .apuracao-item strong {
    font-size: 15px;
  }
  .apuracao-item.liquido strong {
    font-size: 17px;
  }

  /* Tipo pessoa tabs PF/PJ no signup */
  .tipo-pessoa-btn {
    padding: 12px 8px;
    font-size: 13px;
  }

  /* Auth card (login/signup) */
  .auth-card {
    padding: 20px 16px !important;
    margin: 12px;
  }
  .auth-card h1 {
    font-size: 22px;
  }

  /* PWA banner ajustes */
  .pwa-install-banner {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 10px 12px;
  }
  .pwa-banner-icon { width: 40px; height: 40px; }
  .pwa-banner-text strong { font-size: 13px; }
  .pwa-banner-text span { font-size: 11px; }
}

/* Muito pequeno: ajustes adicionais */
@media (max-width: 380px) {
  .topbar-title { font-size: 14px; }
  .btn { padding: 6px 10px; font-size: 12px; }
  .topbar { padding: 0 8px; }
  .btn-menu-mobile { width: 36px; height: 36px; font-size: 20px; margin-right: 6px; }
}

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

/* ============================================
   IMPORTAR CONTRATO (modal de revisão via IA)
   ============================================ */
.tabs {
  display: flex;
  gap: 4px;
}
.tab-btn {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  transition: all 0.15s;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.importar-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}
.importar-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
  flex-wrap: wrap;
}
.importar-card-header strong {
  font-size: 15px;
}
.importar-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.importar-badge.novo {
  background: #e8f5e9;
  color: #2e7d32;
}
.importar-badge.duplicado {
  background: #fff3e0;
  color: #e65100;
}
.importar-badge.confianca-baixa {
  background: #ffebee;
  color: #c62828;
}
.importar-confidence {
  font-size: 12px;
  color: var(--muted);
}
.importar-resolucao {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 13px;
}
.importar-resolucao label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}
.importar-resolucao input[type="radio"] {
  margin: 0;
}
.importar-campos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 700px) {
  .importar-campos-grid { grid-template-columns: 1fr; }
}
.importar-campo-duvidoso input,
.importar-campo-duvidoso select,
.importar-campo-duvidoso textarea {
  background: #fffbe6;
  border-color: #ffd54f;
}
.importar-campo-duvidoso label::after {
  content: " ⚠️";
  font-size: 11px;
}

/* ===== Rede de corretores (rede.js) ===== */
.rede-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.rede-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.rede-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .12); transform: translateY(-1px); }
.rede-card-capa {
  aspect-ratio: 4 / 3;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
}
.rede-card-capa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rede-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.rede-campos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 4px 16px;
  margin-top: 6px;
}
.rede-ficha-fotos {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px;
}
.rede-ficha-fotos img { height: 140px; border-radius: 8px; flex: 0 0 auto; cursor: zoom-in; }
@media (max-width: 600px) {
  .rede-grid { grid-template-columns: 1fr; }
  .rede-campos { grid-template-columns: 1fr; }
}
.nav-badge-pendentes {
  margin-left: auto;
  background: #DC2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 16px;
}

/* Conta bancária do locador: banco mais largo, agência estreita */
.form-row-banco,
.modal-body .form-row-banco {
  grid-template-columns: 2fr 1fr 1.4fr 1.3fr;
}

/* Representante do locador (administração por terceiros) */
.rep-section {
  border-left: 3px solid var(--primary);
  padding: 2px 0 4px 14px;
  margin: 10px 0 6px;
}
@media (max-width: 600px) {
  .rep-section { padding-left: 10px; }
}

/* Regra nº 1: todo botão responde ao toque */
.btn:active:not(:disabled) { transform: scale(.98); filter: brightness(.92); }

/* Repasse ao representante (🔓 ALTERADA 12/10/2026) */
.rep-repasse-box {
  margin: 12px 0 4px;
  padding: 10px 12px;
  border: 1px dashed var(--border, #CBD5E1);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rep-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  min-height: 40px;
}
.rep-check input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; }
.rep-instr-arquivo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rep-repasse-info {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.45;
}
.rep-repasse-info.ok { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.rep-repasse-info.pendente { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.resumo-pix-rep { font-size: 12px; color: var(--text-muted, #64748B); display: block; margin-top: 2px; }

/* Perfis 3.0 — Ver + Criar/Editar/Excluir em 3 níveis (12/10/2026) */
.perfil-ver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}
.perfil-ver input { width: 17px; height: 17px; accent-color: var(--primary); }
.perfil-ver input:disabled { opacity: .4; cursor: not-allowed; }
.perfil-ops {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.perfil-op { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-muted); }
.perfil-op select, .perfil-card-acao select {
  font-size: 12px;
  padding: 5px 4px;
  min-height: 34px;
  width: 100%;
  border-radius: 6px;
}
.perfil-op select:disabled { opacity: .5; }
.perfil-card-acao { display: flex; flex-direction: column; gap: 8px; justify-content: space-between; }
.sel-perfil-usuario { min-height: 36px; max-width: 220px; font-size: 12.5px; }
@media (max-width: 600px) {
  .perfil-grade { grid-template-columns: 1fr; }
  .sel-perfil-usuario { max-width: 100%; }
}
.diff-details { margin-top: 6px; font-size: 12px; }
.diff-details summary { cursor: pointer; color: var(--primary); min-height: 28px; display: list-item; }
.diff-table { font-size: 12px; margin-top: 6px; }
.diff-table td, .diff-table th { padding: 4px 6px; vertical-align: top; word-break: break-word; }

/* =============================================================
   ANÚNCIOS (anuncios.js) — código, portais/relevância, gerador IA
   ============================================================= */
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; }
.alerta-clicavel { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; border: 1px solid #FCD34D;
  background: #FEF3C7; color: #92400E; font-size: 13px; cursor: pointer; }
.alerta-clicavel:active { transform: scale(.98); filter: brightness(.92); }

.codigo-anuncio-chip { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #EEF2FF; color: #3730A3;
  font-size: 10.5px; font-weight: 700; letter-spacing: .4px; vertical-align: middle; white-space: nowrap; }
.imoveis-busca-wrap { margin-bottom: 10px; }
.imoveis-busca-wrap input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }

.anuncio-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--card-bg); }
.anuncio-topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.anuncio-codigo { font-size: 20px; font-weight: 800; letter-spacing: 1px; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-ia { background: linear-gradient(135deg, #7C3AED, #2563EB); border: 0; color: #fff; min-height: 42px; }
.anuncio-portal-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(150px, 1fr); gap: 4px 10px; align-items: center;
  padding: 8px 0; border-top: 1px dashed var(--border); }
.anuncio-portal-row select { min-height: 38px; }
.anuncio-portal-cota { grid-column: 1 / -1; font-size: 11px; color: #64748B; }
.anuncio-portal-cota.is-warn { color: #B45309; font-weight: 600; }

.portal-contrato { margin: 10px 0; padding: 10px; border-radius: 8px; background: #F1F5F9; }
.portal-cotas { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; margin-top: 8px; }
.portal-cotas label { display: flex; flex-direction: column; font-size: 11px; gap: 3px; }
.portal-cotas input { width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 6px; }

.portais-plano { padding: 16px; margin-bottom: 20px; }
.plano-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.plano-portal { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.plano-portal-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.plano-niveis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.plano-nivel { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #F1F5F9; }
.plano-nivel.is-warn { background: #FEF3C7; color: #92400E; }
.plano-lista { margin: 6px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.6; }

/* Gerador */
.gerador-fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.gerador-foto { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #E2E8F0; }
.gerador-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gerador-foto.is-fora img { opacity: .35; filter: grayscale(1); }
.gerador-foto-tag { position: absolute; left: 4px; bottom: 4px; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: rgba(15,23,42,.7); color: #fff; }
.gerador-foto-x { position: absolute; top: 2px; right: 2px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(15,23,42,.72); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.gerador-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gerador-falta { margin-top: 8px; font-size: 12px; color: #B45309; }
.gerador-caracteristicas { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 10px; }
.gerador-caracteristicas .toggle-row { font-size: 13px; min-height: 34px; }
.gerador-footer { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.gerador-footer .btn { width: 100%; min-height: 44px; }
.gerador-footer .btn[style*="display: none"], .gerador-footer .btn[style*="display:none"] { display: none; }

.gerador-res-topo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.gerador-nota { display: flex; align-items: baseline; gap: 2px; padding: 8px 14px; border-radius: 10px; background: #F1F5F9; }
.gerador-nota strong { font-size: 28px; }
.gerador-nota.is-ok { background: #DCFCE7; color: #166534; }
.gerador-nota.is-mid { background: #FEF3C7; color: #92400E; }
.gerador-nota.is-low { background: #FEE2E2; color: #991B1B; }
.gerador-alertas { background: #FFF7ED; border: 1px solid #FDBA74; color: #9A3412; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.gerador-relevancia, .gerador-faltando { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.gerador-relevancia select { min-height: 36px; margin-left: 4px; }
.gerador-faltando ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.gerador-res-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gerador-res-foto { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card-bg); }
.gerador-res-foto.is-descartada { opacity: .55; }
.gerador-res-img { position: relative; aspect-ratio: 4 / 3; background: #E2E8F0; }
.gerador-res-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gerador-ordem { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(15,23,42,.75); color: #fff; font-size: 12px; font-weight: 700; }
.gerador-comparar { position: absolute; bottom: 6px; right: 6px; min-height: 40px; padding: 0 10px; border-radius: 8px; border: 0;
  background: rgba(15,23,42,.72); color: #fff; font-size: 12px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.gerador-res-info { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; font-size: 13px; }
.gerador-res-info .toggle-row { font-size: 12.5px; min-height: 32px; }
.gerador-motivo { font-size: 12px; color: #B91C1C; }
.gerador-privacidade { font-size: 12px; color: #9A3412; }

@media (max-width: 480px) {
  .anuncio-portal-row { grid-template-columns: 1fr; }
  .gerador-res-fotos { grid-template-columns: 1fr; }
  .anuncio-topo .btn-ia { width: 100%; }
}

/* Selo PERMUTA (lista de Imóveis e Rede) */
.selo-permuta-chip { display: inline-block; padding: 1px 7px; border: 1.5px solid #B91C1C; border-radius: 4px;
  color: #B91C1C; font-size: 10px; font-weight: 800; letter-spacing: .8px; transform: rotate(-4deg); vertical-align: middle; }

/* Desempenho no site (relatório ao proprietário) */
.desempenho-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.desempenho-tabela th, .desempenho-tabela td { text-align: center; font-size: 12.5px; padding: 6px 4px; white-space: nowrap; }
.desempenho-tabela td:first-child, .desempenho-tabela th:first-child { text-align: left; }
#btn-relatorio-proprietario { width: 100%; min-height: 42px; margin-top: 8px; }
