:root {
  --bs-primary: #5b73e8;
  --bs-primary-rgb: 91, 115, 232;
  --sidebar-width: 250px;
  --topbar-height: 160px;
}

body {
  background: #f8f9fb;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.auth-body {
  background: linear-gradient(135deg, #eef2ff 0%, #f8f9fb 100%);
  min-height: 100vh;
}

.bg-soft {
  background: rgba(91, 115, 232, 0.15) !important;
}

.auth-illustration {
  min-height: 120px;
  background: linear-gradient(180deg, rgba(91,115,232,.2), transparent);
  border-radius: 0 0 0 80px;
}

#page-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1002;
  background: #fff;
  box-shadow: 0 2px 4px rgba(15, 34, 58, 0.08);
  height: var(--topbar-height);
}

.navbar-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  margin: 0 auto;
  height: var(--topbar-height);
  padding: 0 1.5rem;
}

.navbar-header-left {
  justify-self: start;
  min-width: 0;
}

.navbar-header-center {
  justify-self: center;
  max-width: min(980px, 72vw);
  min-width: 0;
}

.navbar-header-right {
  justify-self: end;
}

.logo {
  font-weight: 700;
  color: #343a40;
  text-decoration: none;
}

.logo span {
  color: var(--bs-primary);
}

.brand-block {
  display: inline-flex;
  align-items: flex-start;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  max-width: min(820px, 68vw);
}

.brand-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: 0;
}

.brand-logo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  max-width: 320px;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.brand-logo-frame[hidden] {
  display: none !important;
}

.brand-logo {
  display: block;
  height: 104px;
  width: auto;
  max-width: 320px;
  object-fit: contain;
  object-position: left center;
}

.brand-details {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  max-width: 360px;
}

.brand-detail-line {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

.brand-detail-line[hidden] {
  display: none !important;
}

.brand-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
  padding-top: 0.35rem;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #1d4ed8;
  line-height: 1.25;
  padding-top: 0;
  white-space: normal;
}

.brand-right .brand-detail-line {
  color: #475569;
}

.admin-brand-wrap {
  min-height: 9.5rem;
}

.admin-brand-block {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  max-width: 100%;
}

.admin-brand-block .brand-title {
  font-size: 0.9rem;
  padding-top: 0;
  color: #4338ca;
}

.admin-brand-block .brand-logo {
  height: 88px;
  max-width: 240px;
}

.admin-brand-block .brand-details {
  max-width: 100%;
}

.vertical-menu {
  width: var(--sidebar-width);
  z-index: 1001;
  background: #fff;
  bottom: 0;
  margin-top: 0;
  position: fixed;
  top: var(--topbar-height);
  box-shadow: 2px 0 4px rgba(15, 34, 58, 0.05);
  overflow-y: auto;
  overflow-x: hidden;
}

.vertical-menu > [data-simplebar],
.vertical-menu > .h-100 {
  min-height: 100%;
  height: auto !important;
}

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}

.page-content {
  padding: 24px;
}

.page-title-box h4 {
  font-weight: 600;
}

#sidebar-menu {
  padding: 16px 0;
}

.menu-title {
  padding: 12px 20px;
  font-size: 11px;
  text-transform: uppercase;
  color: #7f8387;
  letter-spacing: .05em;
}

#side-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #545a6d;
  text-decoration: none;
}

#side-menu li a:hover,
#side-menu li a.active {
  color: var(--bs-primary);
  background: rgba(91, 115, 232, 0.08);
}

#side-menu li.menu-logout {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e9ebf1;
}

#side-menu a.menu-link-logout {
  color: #dc3545;
}

#side-menu a.menu-link-logout:hover {
  color: #b02a37;
  background: rgba(220, 53, 69, 0.08);
}

#side-menu .menu-parent {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

#side-menu .menu-arrow {
  margin-left: auto;
  transition: transform .2s ease;
}

#side-menu .has-submenu.open > .menu-parent .menu-arrow,
#side-menu .has-submenu.open > button .menu-arrow {
  transform: rotate(180deg);
}

#side-menu .sub-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 4px 0 8px 18px;
}

#side-menu .has-submenu.open > .sub-menu {
  display: block;
}

#side-menu .sub-menu .has-submenu > .menu-parent {
  padding: 10px 16px;
  font-size: 13px;
}

#side-menu .sub-menu .sub-menu {
  padding-left: 14px;
}

#side-menu .sub-menu a {
  padding: 10px 16px;
  font-size: 13px;
}

#side-menu a .menu-icon-colored,
#side-menu button .menu-icon-colored,
#side-menu .sub-menu a .menu-icon-colored,
#admin-side-menu a .menu-icon-colored,
#admin-side-menu button .menu-icon-colored,
#admin-side-menu .sub-menu a .menu-icon-colored {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  min-width: 1.35rem;
  text-align: center;
}

.admin-menu-parent .menu-arrow {
  transition: transform .2s ease;
}

.has-submenu.open > .admin-menu-parent .menu-arrow {
  transform: rotate(180deg);
}

/* Menu admin: nao depender do Tailwind CDN para largura/textos */
#admin-sidebar {
  width: 16.5rem;
  min-width: 16.5rem;
  max-width: 18rem;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  overflow-x: hidden;
  overflow-y: auto;
}

#admin-side-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

#admin-side-menu a,
#admin-side-menu button.admin-menu-parent,
#admin-side-menu button.menu-parent {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}

#admin-side-menu a > span,
#admin-side-menu button > span {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 0.875rem !important;
  font-weight: 600;
  color: #475569;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#admin-side-menu a.text-red-600 > span,
#admin-side-menu a[href="/logout"] > span {
  color: #dc2626;
}

#admin-side-menu .sub-menu {
  display: none;
}

#admin-side-menu .has-submenu.open > .sub-menu {
  display: block;
}

#side-menu a > span,
#side-menu .menu-parent > span {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 0.9rem;
  white-space: nowrap;
}

.card {
  border: none;
  box-shadow: 0 1px 3px rgba(15, 34, 58, 0.08);
  border-radius: 0.5rem;
}

#cliente-form .form-label {
  color: #000;
  font-weight: 700;
}

#produto-form .form-label {
  color: #000;
  font-weight: 700;
}

#caixa-form .form-label {
  color: #000;
  font-weight: 700;
}

#usuario-form .form-label {
  color: #000;
  font-weight: 700;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.permission-card {
  border: 1px solid #e9ebf1;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  cursor: pointer;
}

.permission-title {
  font-size: 13px;
  color: #2f3640;
  font-weight: 600;
}

.mini-stat-icon .avatar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.footer {
  padding: 20px;
  color: #74788d;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  overflow: hidden;
  background: #5b73e8;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 144px;
  height: 144px;
  font-size: 48px;
}

.user-avatar-md {
  width: 176px;
  height: 176px;
  font-size: 56px;
}

.user-avatar-lg {
  width: 224px;
  height: 224px;
  font-size: 72px;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  line-height: 1;
}

.user-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-header-name {
  font-size: 16px;
  font-weight: 600;
  color: #343a40;
}

.user-header-tipo {
  font-size: 13px;
  color: #6c757d;
  text-transform: capitalize;
}

.usuario-foto-preview {
  width: 384px;
  height: 384px;
  border-radius: 9999px;
  overflow: hidden;
  background: #5b73e8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
  font-weight: 700;
}

.usuario-foto-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-user-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  margin-bottom: 8px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(91, 115, 232, 0.08);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.login-user-preview-ready {
  background: rgba(25, 135, 84, 0.1);
  box-shadow: inset 0 0 0 1px rgba(25, 135, 84, 0.2);
}

.login-user-avatar {
  width: 352px;
  height: 352px;
  border-radius: 9999px;
  overflow: hidden;
  background: #5b73e8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 112px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(91, 115, 232, 0.25);
}

.login-user-preview-ready .login-user-avatar {
  background: #198754;
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.25);
}

.login-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-user-name {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #343a40;
  text-align: center;
}

.login-user-tipo {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #5b73e8;
  text-align: center;
  text-transform: capitalize;
}

.login-user-hint {
  margin: 0;
  font-size: 13px;
  color: #6c757d;
  text-align: center;
}

/* Monitores baixos (ex.: 1024x768): avatar menor para o botão Entrar não sair da tela */
@media (max-height: 900px) {
  .login-user-avatar {
    width: 160px;
    height: 160px;
    font-size: 56px;
  }
  .login-user-preview {
    margin-top: 8px;
    padding: 10px;
    gap: 4px;
  }
  .login-user-name {
    font-size: 18px;
  }
  .account-pages {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
    padding-top: 0 !important;
  }
}

@media (max-width: 991px) {
  .vertical-menu {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.sidebar-enable .vertical-menu {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

.empresa-ativa-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  max-width: min(960px, 78vw);
}

.empresa-cert-validade {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #2563eb;
  white-space: nowrap;
  text-align: center;
}

.empresa-cert-validade.is-vencido {
  color: #dc2626;
  font-weight: 700;
}

.empresa-ativa-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  padding: 0;
  border: 1px solid #67e8f9;
  border-radius: 999px;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 55%, #e0f2fe 100%);
  box-shadow: 0 1px 2px rgba(8, 145, 178, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: visible;
}

.empresa-ativa-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.7rem 1.45rem 0.7rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #020617;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}

.empresa-ativa-trigger:focus-visible {
  outline: 2px solid #0891b2;
  outline-offset: 2px;
}

.empresa-ativa-label {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #020617;
  white-space: nowrap;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.empresa-ativa-label i {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.empresa-ativa-label .empresa-ativa-prefix {
  font-size: 1.05rem;
  font-weight: 800;
  color: #020617;
  opacity: 1;
  flex-shrink: 0;
  line-height: 1.2;
}

.empresa-ativa-nome-atual {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #020617;
  max-width: min(520px, 48vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 4rem;
  line-height: 1.2;
}

.empresa-ativa-chevron {
  font-size: 1.3rem;
  opacity: 0.75;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.empresa-ativa-box.is-open .empresa-ativa-chevron {
  transform: rotate(180deg);
}

.empresa-ativa-box.is-transportes {
  border-color: #fdba74;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 55%, #fed7aa 100%);
  box-shadow: 0 1px 2px rgba(234, 88, 12, 0.14);
}

.empresa-ativa-truck {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  flex-shrink: 0;
}

.empresa-ativa-truck svg {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(124, 45, 18, 0.2));
}

.empresa-ativa-nome {
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #020617;
  font-size: inherit;
}

.empresa-ativa-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Painel grande e colorido (fixed via JS para não ser cortado pelo header) */
.empresa-ativa-painel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: min(520px, 88vw);
  max-width: min(640px, 92vw);
  padding: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.22),
    0 2px 8px rgba(15, 23, 42, 0.1);
  animation: empPainelIn 0.22s ease;
}

.empresa-ativa-painel.is-fixed-open {
  position: fixed;
  transform: none;
}

.empresa-ativa-painel[hidden] {
  display: none !important;
}

@keyframes empPainelIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.empresa-ativa-opcao {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.95rem 2.2rem;
  border: 2px solid transparent;
  border-radius: 0.9rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: uppercase;
  color: #0f172a;
  cursor: pointer;
  line-height: 1.3;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    filter 0.18s ease;
}

.empresa-ativa-opcao-nome {
  display: block;
  width: 100%;
  text-align: center;
}

.empresa-ativa-opcao::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 0%,
    transparent 38%,
    rgba(255, 255, 255, 0.75) 50%,
    transparent 62%,
    transparent 100%
  );
  transform: translateX(-120%);
  pointer-events: none;
}

.empresa-ativa-opcao:hover,
.empresa-ativa-opcao:focus-visible {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.06);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
  outline: none;
  z-index: 1;
}

.empresa-ativa-opcao:hover::before,
.empresa-ativa-opcao:focus-visible::before {
  animation: empFlash 0.7s ease;
}

@keyframes empFlash {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

.empresa-ativa-opcao.is-ativa {
  border-color: rgba(15, 23, 42, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), 0 4px 14px rgba(15, 23, 42, 0.12);
}

.empresa-ativa-opcao.is-ativa::after {
  content: "✓";
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.7;
}

.empresa-ativa-opcao.empresa-cor-0 {
  border-color: #67e8f9;
  background: linear-gradient(135deg, #ecfeff 0%, #a5f3fc 55%, #7dd3fc 100%);
}
.empresa-ativa-opcao.empresa-cor-1 {
  border-color: #93c5fd;
  background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 55%, #a5b4fc 100%);
}
.empresa-ativa-opcao.empresa-cor-2 {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fffbeb 0%, #fde68a 55%, #fdba74 100%);
}
.empresa-ativa-opcao.empresa-cor-3 {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #f5f3ff 0%, #ddd6fe 55%, #c4b5fd 100%);
}
.empresa-ativa-opcao.empresa-cor-4 {
  border-color: #6ee7b7;
  background: linear-gradient(135deg, #ecfdf5 0%, #a7f3d0 55%, #6ee7b7 100%);
}
.empresa-ativa-opcao.empresa-cor-5 {
  border-color: #fda4af;
  background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 55%, #f9a8d4 100%);
}

/* Cores distintas por loja (ciclo de 6) — fundo colorido, texto sempre preto escuro */
.empresa-ativa-box.empresa-cor-0 {
  border-color: #67e8f9;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 55%, #e0f2fe 100%);
  box-shadow: 0 1px 2px rgba(8, 145, 178, 0.12);
}
.empresa-ativa-box.empresa-cor-0 .empresa-ativa-trigger,
.empresa-ativa-box.empresa-cor-0 .empresa-ativa-label,
.empresa-ativa-box.empresa-cor-0 .empresa-ativa-prefix,
.empresa-ativa-box.empresa-cor-0 .empresa-ativa-nome,
.empresa-ativa-box.empresa-cor-0 .empresa-ativa-nome-atual { color: #020617; }

.empresa-ativa-box.empresa-cor-1 {
  border-color: #93c5fd;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 55%, #e0e7ff 100%);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.12);
}
.empresa-ativa-box.empresa-cor-1 .empresa-ativa-trigger,
.empresa-ativa-box.empresa-cor-1 .empresa-ativa-label,
.empresa-ativa-box.empresa-cor-1 .empresa-ativa-prefix,
.empresa-ativa-box.empresa-cor-1 .empresa-ativa-nome,
.empresa-ativa-box.empresa-cor-1 .empresa-ativa-nome-atual { color: #020617; }

.empresa-ativa-box.empresa-cor-2 {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 55%, #ffedd5 100%);
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.12);
}
.empresa-ativa-box.empresa-cor-2 .empresa-ativa-trigger,
.empresa-ativa-box.empresa-cor-2 .empresa-ativa-label,
.empresa-ativa-box.empresa-cor-2 .empresa-ativa-prefix,
.empresa-ativa-box.empresa-cor-2 .empresa-ativa-nome,
.empresa-ativa-box.empresa-cor-2 .empresa-ativa-nome-atual { color: #020617; }

.empresa-ativa-box.empresa-cor-3 {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 55%, #e0e7ff 100%);
  box-shadow: 0 1px 2px rgba(109, 40, 217, 0.12);
}
.empresa-ativa-box.empresa-cor-3 .empresa-ativa-trigger,
.empresa-ativa-box.empresa-cor-3 .empresa-ativa-label,
.empresa-ativa-box.empresa-cor-3 .empresa-ativa-prefix,
.empresa-ativa-box.empresa-cor-3 .empresa-ativa-nome,
.empresa-ativa-box.empresa-cor-3 .empresa-ativa-nome-atual { color: #020617; }

.empresa-ativa-box.empresa-cor-4 {
  border-color: #6ee7b7;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 55%, #ccfbf1 100%);
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.12);
}
.empresa-ativa-box.empresa-cor-4 .empresa-ativa-trigger,
.empresa-ativa-box.empresa-cor-4 .empresa-ativa-label,
.empresa-ativa-box.empresa-cor-4 .empresa-ativa-prefix,
.empresa-ativa-box.empresa-cor-4 .empresa-ativa-nome,
.empresa-ativa-box.empresa-cor-4 .empresa-ativa-nome-atual { color: #020617; }

.empresa-ativa-box.empresa-cor-5 {
  border-color: #fda4af;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 55%, #fce7f3 100%);
  box-shadow: 0 1px 2px rgba(225, 29, 72, 0.12);
}
.empresa-ativa-box.empresa-cor-5 .empresa-ativa-trigger,
.empresa-ativa-box.empresa-cor-5 .empresa-ativa-label,
.empresa-ativa-box.empresa-cor-5 .empresa-ativa-prefix,
.empresa-ativa-box.empresa-cor-5 .empresa-ativa-nome,
.empresa-ativa-box.empresa-cor-5 .empresa-ativa-nome-atual { color: #020617; }

@media (max-width: 640px) {
  .empresa-ativa-painel {
    min-width: min(100vw - 1.5rem, 420px);
  }
  .empresa-ativa-opcao {
    min-height: 3rem;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
  }
  .empresa-ativa-nome-atual {
    max-width: min(220px, 42vw);
  }
}

/* Boas-vindas ao trocar de empresa */
.empresa-boasvindas-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  animation: empBvFadeIn 0.25s ease;
}

.empresa-boasvindas-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1.75rem 1.5rem 1.35rem;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  animation: empBvPop 0.35s ease;
}

.empresa-boasvindas-card i {
  font-size: 2.5rem;
  color: #2563eb;
  display: block;
  margin-bottom: 0.65rem;
}

.empresa-boasvindas-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

.empresa-boasvindas-card h2 strong {
  color: #1d4ed8;
  display: block;
  font-size: 1.35rem;
  margin-top: 0.25rem;
}

.empresa-boasvindas-card p {
  margin: 0 0 1.1rem;
  color: #64748b;
  font-size: 0.95rem;
}

.empresa-boasvindas-card button {
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 1.4rem;
  cursor: pointer;
}

.empresa-boasvindas-card button:hover {
  background: #1d4ed8;
}

@keyframes empBvFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes empBvPop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Aviso de certificado digital próximo do vencimento */
.certificado-aviso-overlay.is-warn .certificado-aviso-card i {
  color: #d97706;
}
.certificado-aviso-overlay.is-danger .certificado-aviso-card i {
  color: #dc2626;
}
.certificado-aviso-overlay.is-warn .certificado-aviso-card h2 {
  color: #92400e;
}
.certificado-aviso-overlay.is-danger .certificado-aviso-card h2 {
  color: #991b1b;
}
.certificado-aviso-card p strong {
  color: #0f172a;
}
.certificado-aviso-overlay.is-warn .certificado-aviso-card button {
  background: #d97706;
}
.certificado-aviso-overlay.is-warn .certificado-aviso-card button:hover {
  background: #b45309;
}
.certificado-aviso-overlay.is-danger .certificado-aviso-card button {
  background: #dc2626;
}
.certificado-aviso-overlay.is-danger .certificado-aviso-card button:hover {
  background: #b91c1c;
}

/* Previsão de recebimentos (popup ao entrar) */
.prev-rec-overlay {
  position: fixed;
  inset: 0;
  z-index: 100050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
}
.prev-rec-card {
  width: min(640px, 96vw);
  max-height: min(88vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  padding: 1.1rem 1.2rem 1.2rem;
}
.prev-rec-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
.prev-rec-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.prev-rec-head p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}
.prev-rec-x {
  border: 0;
  background: #f1f5f9;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
  color: #334155;
  font-size: 1.25rem;
  line-height: 1;
}
.prev-rec-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.prev-rec-kpis > div {
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.prev-rec-kpis span {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
}
.prev-rec-kpis strong {
  font-size: 0.88rem;
  color: #0f172a;
}
.prev-rec-kpis .is-venc { background: #fff1f2; border-color: #fecaca; }
.prev-rec-kpis .is-venc strong { color: #b91c1c; }
.prev-rec-kpis .is-hoje { background: #fffbeb; border-color: #fde68a; }
.prev-rec-kpis .is-hoje strong { color: #b45309; }
.prev-rec-kpis .is-tot { background: #eff6ff; border-color: #93c5fd; }
.prev-rec-kpis .is-tot strong { color: #1d4ed8; }
.prev-rec-table-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.prev-rec-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.prev-rec-table-wrap th,
.prev-rec-table-wrap td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}
.prev-rec-table-wrap th {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
  position: sticky;
  top: 0;
}
.prev-rec-val { font-weight: 700; white-space: nowrap; }
.prev-rec-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}
.prev-rec-tag.is-hoje { background: #fef3c7; color: #92400e; }
.prev-rec-tag.is-venc { background: #fee2e2; color: #991b1b; }
.prev-rec-wa {
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #15803d;
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
}
.prev-rec-wa:hover { background: #dcfce7; }
.prev-rec-wa:disabled { opacity: 0.6; cursor: wait; }
.prev-rec-omit {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}
.prev-rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.9rem;
}
.prev-rec-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
}
.prev-rec-btn.is-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
@media (max-width: 560px) {
  .prev-rec-kpis { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Ajuste automático para monitores de baixa resolução (ex.: 1024x768).
   Reduz a escala de todo o sistema para o conteúdo caber sem cortar campos.
   O PDV tem escala própria (pdv.css), por isso fica de fora daqui.
   ========================================================================== */
@media (max-width: 1280px) {
  body:not(.pdv-mode) {
    zoom: 0.9;
  }
}
@media (max-width: 1152px) {
  body:not(.pdv-mode) {
    zoom: 0.85;
  }
}
@media (max-width: 1024px) {
  body:not(.pdv-mode) {
    zoom: 0.8;
  }
}
@media (max-width: 900px) {
  body:not(.pdv-mode) {
    zoom: 0.75;
  }
}
/* Telas baixas (altura pequena) também ganham fôlego vertical */
@media (max-height: 660px) {
  body:not(.pdv-mode) {
    zoom: 0.8;
  }
}
