:root {
  --primary-orange: #f27121;
  --secondary-orange: #ff8c42;
  --dark-bg: #1a1a2e;
  --dark-bg2: #16213e;
  --dark-bg3: #0f3460;
}

/* ========== LOGIN - LAYOUT SPLIT (form esquerda + produtos direita) ========== */

body.login-page {
  margin: 0;
  min-height: 100vh;
  background: #eef2f7;
}

.login-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.login-left {
  width: 400px;
  min-width: 360px;
  max-width: 420px;
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-bg2) 50%, var(--dark-bg3) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.75rem;
  flex-shrink: 0;
}

.login-right {
  flex: 1;
  background: #eef2f7;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.login-right .produtos-img {
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  max-width: none;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #eef2f7;
}

.login-right .produtos-fallback {
  display: none;
  width: 100%;
  max-width: none;
  padding: 1.5rem;
}

.login-right.has-error .produtos-img {
  display: none;
}

.login-right.has-error .produtos-fallback {
  display: block;
}

.glass-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  color: #fff;
}

.glass-card .login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.glass-card .login-logo h4 {
  font-weight: 700;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.glass-card .login-logo p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  margin: 0;
}

body.login-page .form-control {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff !important;
  padding: 0.75rem 1rem;
  height: auto;
}

body.login-page .form-control:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 0.2rem rgba(242, 113, 33, 0.25);
  background: rgba(255, 255, 255, 0.18);
}

body.login-page .form-control::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

body.login-page .form-label {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

.btn-orange {
  background: linear-gradient(45deg, var(--primary-orange), var(--secondary-orange));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  padding: 0.75rem;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-orange:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(242, 113, 33, 0.35);
  color: #fff;
}

body.login-page .alert {
  border-radius: 10px;
  font-size: 0.875rem;
}

body.login-page .login-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8rem;
}

/* ========== DASHBOARD ========== */

body.dashboard-page {
  background: #f4f5fa;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.dashboard-header {
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-bg2) 50%, var(--dark-bg3) 100%);
  padding: 1.1rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(1.2);
}

.dashboard-header .brand {
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-header .brand i {
  color: var(--secondary-orange);
}

.dashboard-header .user-info {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

.dashboard-header .user-info strong {
  color: #fff;
}

.welcome-card {
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-bg2) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  color: #fff;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  position: relative;
  overflow: hidden;
}
.welcome-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(242,113,33,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-card h4 {
  font-weight: 700;
}

.welcome-card p {
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

.welcome-card .user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary-orange), var(--secondary-orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.section-title {
  font-weight: 800;
  color: #172033;
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.section-title i {
  color: var(--primary-orange);
  margin-right: 8px;
}

.modulo-card {
  background: #fff;
  border: 1px solid #e9edf4;
  border-radius: 16px;
  padding: 1.75rem 1rem 1.25rem;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 184px;
  position: relative;
  overflow: hidden;
}

.modulo-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary-orange);
}

.modulo-card:hover {
  transform: translateY(-3px);
  border-color: rgba(242, 113, 33, 0.25);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
}

.modulo-card[data-sistema="advocacia"]::before { background: #722F37; }
.modulo-card[data-sistema="advocacia"]:hover { border-color: rgba(114, 47, 55, 0.25); }
.modulo-card[data-sistema="condominio"]::before { background: #2E7D32; }
.modulo-card[data-sistema="condominio"]:hover { border-color: rgba(46, 125, 50, 0.25); }
.modulo-card[data-sistema="imobiliaria"]::before { background: #1565C0; }
.modulo-card[data-sistema="imobiliaria"]:hover { border-color: rgba(21, 101, 192, 0.25); }
.modulo-card[data-sistema="obras"]::before { background: #F59E0B; }
.modulo-card[data-sistema="obras"]:hover { border-color: rgba(245, 158, 11, 0.25); }

.modulo-card .card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(242, 113, 33, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--primary-orange);
  margin-bottom: 0.75rem;
}

.modulo-card[data-sistema="advocacia"] .card-icon { background: rgba(114, 47, 55, 0.10); color: #722F37; }
.modulo-card[data-sistema="condominio"] .card-icon { background: rgba(46, 125, 50, 0.10); color: #2E7D32; }
.modulo-card[data-sistema="imobiliaria"] .card-icon { background: rgba(21, 101, 192, 0.10); color: #1565C0; }
.modulo-card[data-sistema="obras"] .card-icon { background: rgba(245, 158, 11, 0.10); color: #F59E0B; }

.modulo-card h5 {
  font-weight: 700;
  font-size: 1rem;
  color: #172033;
  margin-bottom: 0.25rem;
}

.modulo-card .card-desc {
  color: #667085;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}
.modulo-card .card-desc + .card-desc { margin-bottom: 1rem; }
.modulo-card:has(.btn-site) .card-icon { margin-top: 0.4rem; }

.modulo-card .btn-acessar {
  background: var(--primary-orange);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.52rem 1.35rem;
  transition: all 0.3s ease;
  margin-top: auto;
}

.btn-site {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #10b981;
  color: #fff !important;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
  transition: all 0.2s ease;
  z-index: 2;
}
.btn-site:hover {
  background: #0d9a6b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  color: #fff;
}
.btn-site i { font-size: 0.7rem; }

/* Badges e agrupamento de sistemas */
.badge-contratos {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #172033;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  line-height: 1;
  z-index: 2;
  letter-spacing: 0.02em;
}
.badge-contratos.single {
  background: #eef2f7;
  color: #425466;
  border: 1px solid #e2e8f0;
  font-weight: 600;
}
.modulo-card[data-sistema="condominio"] .badge-contratos { background: #2E7D32; }
.modulo-card[data-sistema="imobiliaria"] .badge-contratos { background: #1565C0; }
.modulo-card[data-sistema="advocacia"] .badge-contratos { background: #722F37; }
.modulo-card[data-sistema="obras"] .badge-contratos { background: #B7791F; }
.modulo-card:has(.badge-contratos) .card-icon { margin-top: 0.6rem; }
.modulo-card:has(.badge-contratos):has(.btn-site) .card-icon { margin-top: 0.9rem; }

.sistema-card { cursor: default; }
.sistema-card:hover { transform: translateY(-4px); }

.sistema-detalhe {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  margin-top: 1.25rem;
  box-shadow: 0 8px 24px rgba(15,23,42,0.06);
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity:0; transform: translateY(6px);} to {opacity:1; transform: translateY(0);} }
.sistema-detalhe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #eef2f7;
}
.sistema-detalhe-header h6 {
  font-weight: 800;
  color: #172033;
  margin: 0;
  font-size: 0.95rem;
}
.btn-fechar-detalhe {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  transition: all 0.2s ease;
}
.btn-fechar-detalhe:hover { background: #e2e8f0; color: #1e293b; }
.cliente-card {
  min-height: 150px;
  padding: 1.25rem 1rem 1rem;
  background: #fcfdff;
  border: 1px solid #e9edf4;
}
.cliente-card .card-icon.small {
  width: 42px; height: 42px; font-size: 1.1rem; margin-bottom: 0.6rem;
}
.cliente-card h6 { line-height: 1.2; }
/* Informações dos contratos com fonte branca para leitura em cards escuros */
.sistema-card .card-desc.small,
.cliente-card .card-desc {
  color: #fff !important;
  background: rgba(23, 32, 51, 0.92);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  display: inline-block;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.sistema-card .card-desc.small { font-size: 0.72rem; }
.cliente-card .card-desc { font-size: 0.74rem; }
.cliente-card h6 { color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,0.15); }
/* Deixa o card do cliente com fundo escuro para contraste da fonte branca */
.cliente-card[data-sistema="advocacia"] { background: linear-gradient(135deg, #2a1a2e 0%, #3d2438 100%); border-color: #4a2e40; }
.cliente-card[data-sistema="condominio"] { background: linear-gradient(135deg, #1e3a2a 0%, #2a4d35 100%); border-color: #345e42; }
.cliente-card[data-sistema="imobiliaria"] { background: linear-gradient(135deg, #1a2e4a 0%, #243b5a 100%); border-color: #2f4a6e; }
.cliente-card[data-sistema="obras"] { background: linear-gradient(135deg, #3d2e1a 0%, #5a4320 100%); border-color: #6d5228; }
.cliente-card[data-sistema] .card-icon.small { background: rgba(255,255,255,0.14) !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.18); }
/* Badge sempre branco */
.badge-contratos { color: #fff !important; }

.btn-ver-contratos .chevron { transition: transform 0.2s ease; font-size: 0.7rem; }
.btn-ver-contratos .chevron.rotated { transform: rotate(180deg); }

.modulo-card[data-sistema="advocacia"] .btn-acessar { background: #722F37; }
.modulo-card[data-sistema="condominio"] .btn-acessar { background: #2E7D32; }
.modulo-card[data-sistema="imobiliaria"] .btn-acessar { background: #1565C0; }
.modulo-card[data-sistema="obras"] .btn-acessar { background: #F59E0B; }

.modulo-card .btn-acessar:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(242, 113, 33, 0.30);
  color: #fff;
}

.modulo-card[data-sistema="advocacia"] .btn-acessar:hover { box-shadow: 0 6px 16px rgba(114, 47, 55, 0.30); }
.modulo-card[data-sistema="condominio"] .btn-acessar:hover { box-shadow: 0 6px 16px rgba(46, 125, 50, 0.30); }
.modulo-card[data-sistema="imobiliaria"] .btn-acessar:hover { box-shadow: 0 6px 16px rgba(21, 101, 192, 0.30); }
.modulo-card[data-sistema="obras"] .btn-acessar:hover { box-shadow: 0 6px 16px rgba(245, 158, 11, 0.30); }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #667085;
}

.empty-state i {
  font-size: 3rem;
  color: var(--primary-orange);
  opacity: 0.4;
  margin-bottom: 1rem;
}

.dashboard-footer {
  background: #fff;
  border-top: 1px solid #e9edf4;
  padding: 1rem 0;
  color: #667085;
  font-size: 0.85rem;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Fallback grid quando imagem não existe - replica visual da imagem enviada */
.produtos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%;
}
.produto-card {
  border-radius: 18px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}
.produto-card h5 {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.produto-card .prod-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.85;
  margin-bottom: 0.75rem;
}
.produto-card.adv { background: linear-gradient(180deg, #0f1f2e 0%, #1a2f44 100%); color: #fff; }
.produto-card.cond { background: linear-gradient(180deg, #e6f4ea 0%, #ffffff 100%); color: #1a3a2a; border: 1px solid #c8e6c9; }
.produto-card.imob { background: linear-gradient(180deg, #eaf2ff 0%, #ffffff 100%); color: #1a2a4a; border: 1px solid #bbdefb; }
.produto-card.obras { background: linear-gradient(180deg, #fff3e0 0%, #ffffff 100%); color: #4a2a0a; border: 1px solid #ffe0b2; }
.produto-card .prod-icon { width: 42px; height: 42px; border-radius: 10px; display:flex; align-items:center; justify-content:center; font-size:1.2rem; margin-bottom:0.75rem; }
.produto-card.adv .prod-icon { background: rgba(242, 180, 60, 0.15); border:1px solid rgba(242,180,60,0.3); }
.produto-card.cond .prod-icon { background: #2E7D32; color:#fff; }
.produto-card.imob .prod-icon { background: #1565C0; color:#fff; }
.produto-card.obras .prod-icon { background: #F59E0B; color:#fff; }

/* ========== RESPONSIVO ========== */

@media (max-width: 1100px) {
  .produtos-grid { grid-template-columns: repeat(2, 1fr); }
  .produto-card { min-height: 380px; }
}

@media (max-width: 991px) {
  .login-wrapper {
    flex-direction: column;
  }
  .login-left {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 2rem 1.25rem;
  }
  .login-right {
    padding: 0;
    min-height: 420px;
  }
  .login-right .produtos-img {
    height: auto;
    min-height: 420px;
    max-height: none;
  }
  .produtos-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .glass-card {
    padding: 1.75rem 1.25rem;
  }
  .modulo-card {
    min-height: 140px;
  }
  .dashboard-header .brand {
    font-size: 1.1rem;
  }
}
