/* SIGFAD UI consolidada v1.0.0 */
:root {
  --sigfad-blue-950: #051020;
  --sigfad-blue-900: #071d33;
  --sigfad-blue-800: #0b2a4a;
  --sigfad-blue-700: #123f6d;
  --sigfad-blue-600: #1d5fa7;
  --sigfad-green-700: #2e7d32;
  --sigfad-bg: #f4f7fb;
  --sigfad-border: #d9e1ec;
  --sigfad-muted: #64748b;
  --sigfad-shadow: 0 18px 46px rgba(7, 29, 51, .16);
  --sigfad-shell-height: 72px;
}

html,
body {
  height: 100%;
}

body.sigfad-shell {
  margin: 0;
  overflow: hidden;
  background: #edf2f7;
  color: #102033;
  font-family: Inter, Montserrat, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Navbar original permanece no DOM como motor funcional. */
body.sigfad-shell > nav.navbar,
body.sigfad-shell > .navbar.fixed-top,
body.sigfad-shell > header.navbar,
body.sigfad-shell > .main-header,
body.sigfad-shell > .topbar {
  display: none !important;
}

body.sigfad-shell #map {
  position: absolute !important;
  inset: var(--sigfad-shell-height) 0 0 0 !important;
  width: 100% !important;
  height: auto !important;
  z-index: 1 !important;
}

/* =========================================================
   SHELL
   ========================================================= */

.sigfad-shell-top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1025;
  height: var(--sigfad-shell-height);
  padding: 0 18px;
  display: grid;
  grid-template-columns: minmax(250px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--sigfad-blue-950), var(--sigfad-blue-800));
  box-shadow: 0 14px 38px rgba(7, 29, 51, .26);
}

.sigfad-shell-left,
.sigfad-shell-right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.sigfad-shell-left {
  gap: 13px;
}

.sigfad-shell-right {
  justify-content: flex-end;
  gap: 7px;
}

.sigfad-shell-menu-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  transition: background .18s ease;
}

.sigfad-shell-menu-btn:hover {
  background: rgba(255, 255, 255, .14);
}

.sigfad-shell-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1;
}

.sigfad-shell-brand strong {
  color: #fff;
  font-size: 1.36rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.sigfad-shell-brand span {
  margin-top: 4px;
  max-width: 360px;
  overflow: hidden;
  color: rgba(255, 255, 255, .72);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sigfad-shell-modules {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sigfad-shell-modules > .navbar-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px;
  margin: 0 !important;
  padding: 0 !important;
}

.sigfad-shell-modules .nav-item {
  margin: 0;
}

.sigfad-shell-modules .nav-link {
  min-width: 78px;
  height: 48px;
  padding: 5px 9px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: rgba(255, 255, 255, .88) !important;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease;
}

.sigfad-shell-modules .nav-link i {
  margin: 0 !important;
  font-size: 1rem;
}

.sigfad-shell-modules .nav-link:hover,
.sigfad-shell-modules .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .12);
}

.sigfad-shell-right > .navbar-nav,
.sigfad-shell-right > ul.navbar-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.sigfad-shell-right > .navbar-nav > .nav-item > .nav-link,
.sigfad-shell-right > .navbar-nav > .nav-item > button.nav-link {
  width: 42px;
  height: 42px;
  padding: 0 !important;
  display: grid !important;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .11) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, .07) !important;
  color: #fff !important;
}

.sigfad-shell-right > .navbar-nav > .nav-item > .nav-link:hover,
.sigfad-shell-right > .navbar-nav > .nav-item > button.nav-link:hover {
  background: rgba(255, 255, 255, .13) !important;
}

/* =========================================================
   PERFIL — seletores específicos
   ========================================================= */

.sigfad-shell-right #auth-nav {
  margin-left: 2px;
}

.sigfad-shell-right #auth-nav > li,
.sigfad-shell-right #auth-nav .nav-item {
  display: flex;
  align-items: center;
}

.sigfad-shell-right #auth-nav .der-user-trigger {
  min-width: 220px;
  height: 56px;
  padding: 5px 12px 5px 7px !important;
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, .08) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.sigfad-shell-right #auth-nav .der-user-trigger .der-avatar {
  flex: 0 0 auto;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.sigfad-shell-right #auth-nav .der-user-trigger .der-user-name,
.sigfad-shell-right #auth-nav .der-user-trigger .der-user-role {
  color: #fff;
}

.sigfad-shell-right #auth-nav .der-user-menu {
  z-index: 1065 !important;
  min-width: 340px;
  overflow: hidden;
  padding: 0 0 8px !important;
  border: 1px solid #cad5e3;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 22px 52px rgba(5, 16, 32, .28);
}

.sigfad-shell-right #auth-nav .der-user-summary {
  padding: 20px 22px;
  color: #fff;
  background:
    radial-gradient(circle at 95% 5%, rgba(46, 125, 50, .24), transparent 38%),
    linear-gradient(135deg, var(--sigfad-blue-950), var(--sigfad-blue-700));
  border-bottom: 4px solid var(--sigfad-green-700);
}

.sigfad-shell-right #auth-nav .der-user-summary .der-avatar {
  width: 76px !important;
  height: 76px !important;
  min-width: 76px;
  min-height: 76px;
  border: 4px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(5, 16, 32, .28);
}

.sigfad-shell-right #auth-nav .der-user-summary strong,
.sigfad-shell-right #auth-nav .der-user-summary small {
  color: #fff !important;
  opacity: 1;
}

.sigfad-shell-right #auth-nav .der-user-summary .badge {
  color: var(--sigfad-blue-900) !important;
  background: #fff !important;
  border-color: transparent !important;
}

.sigfad-shell-right #auth-nav .der-user-menu .dropdown-item {
  min-height: 50px;
  padding: 11px 20px !important;
  color: #26384f !important;
  background: #fff;
  font-weight: 700;
}

.sigfad-shell-right #auth-nav .der-user-menu .dropdown-item:hover {
  color: var(--sigfad-blue-900) !important;
  background: #f1f5f9;
}

/* =========================================================
   ACESSO RÁPIDO
   ========================================================= */

.sigfad-shell-sidebar {
  position: fixed;
  top: 84px;
  left: 16px;
  z-index: 1035;
  width: 286px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 24px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 22px 68px rgba(7, 29, 51, .22);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-330px);
  transition: opacity .22s ease, transform .22s ease;
}

body.sigfad-shell-sidebar-open .sigfad-shell-sidebar {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.sigfad-shell-sidebar-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid #e6edf5;
}

.sigfad-shell-sidebar-head strong {
  display: block;
  color: var(--sigfad-blue-900);
  font-size: 1.02rem;
  font-weight: 900;
}

.sigfad-shell-sidebar-head span {
  display: block;
  margin-top: 2px;
  color: var(--sigfad-muted);
  font-size: .78rem;
  font-weight: 700;
}

.sigfad-shell-sidebar-body {
  padding: 12px;
}

.sigfad-shell-side-action {
  width: 100%;
  margin-bottom: 7px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: #26384f;
  font-size: .9rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.sigfad-shell-side-action:hover {
  color: var(--sigfad-blue-900);
  background: #f4f7fb;
  border-color: #e6edf5;
}

.sigfad-shell-side-action i {
  width: 18px;
  color: var(--sigfad-blue-700);
}

.sigfad-shell-side-action[hidden] {
  display: none !important;
}

.sigfad-shell-badge {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 900;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(7, 29, 51, .82);
  color: #fff;
  box-shadow: 0 10px 24px rgba(7, 29, 51, .22);
  backdrop-filter: blur(10px);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
}

/* =========================================================
   MAPAS TEMÁTICOS E ARRECADAÇÃO
   ========================================================= */

#thematicMapsModal .modal-dialog,
#thematicMapsModal .modal-dialog.modal-fullscreen,
#arrecadacaoModal .modal-dialog,
#arrecadacaoModal .modal-dialog.modal-fullscreen {
  width: min(96vw, 1560px) !important;
  max-width: 1560px !important;
  height: calc(100vh - 88px) !important;
  height: calc(100dvh - 88px) !important;
  max-height: calc(100vh - 88px) !important;
  max-height: calc(100dvh - 88px) !important;
  margin: 74px auto 14px !important;
}

#thematicMapsModal .modal-content,
#arrecadacaoModal .modal-content {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--sigfad-border);
  border-radius: 22px;
  box-shadow: 0 22px 54px rgba(5, 16, 32, .25);
}

#thematicMapsModal .modal-header,
#arrecadacaoModal .modal-header {
  flex: 0 0 auto;
  min-height: 74px;
  padding: 16px 22px;
  background: linear-gradient(135deg, #fff, #f7f9fc);
  border-bottom: 1px solid #d9e2ec;
}

#thematicMapsModal .modal-body,
#arrecadacaoModal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
}

#thematicMapsModal .modal-body {
  overflow: hidden;
}

#arrecadacaoModal .modal-body {
  overflow: auto;
}

#thematicMapsModal .der-thematic-workspace {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid !important;
  grid-template-columns: 340px minmax(0, 1fr) !important;
}

#thematicMapsModal .der-thematic-sidebar,
#thematicMapsModal .der-thematic-preview-area {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

#thematicMapsModal .btn-close,
#arrecadacaoModal .btn-close {
  flex: 0 0 auto;
  width: 42px !important;
  height: 42px !important;
  margin: 0 !important;
  border: 1px solid #c7d2df !important;
  border-radius: 14px !important;
  background-color: #eaf0f6 !important;
  opacity: 1 !important;
  filter: none !important;
  box-shadow: none !important;
}

#thematicMapsModal .btn-close:hover,
#arrecadacaoModal .btn-close:hover {
  background-color: #dde7f0 !important;
}

/* Bootstrap acima do shell */
body.sigfad-shell .modal {
  z-index: 1055;
}

body.sigfad-shell .modal-backdrop {
  z-index: 1050;
}

body.sigfad-shell .offcanvas {
  z-index: 1045;
}

body.sigfad-shell .offcanvas-backdrop {
  z-index: 1040;
}

/* Leaflet */
body.sigfad-shell .leaflet-control-container .leaflet-control {
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(7, 29, 51, .16);
}

/* Elementos experimentais antigos não devem reaparecer. */
body.sigfad-shell .sigfad-version-badge,
body.sigfad-shell .sigfad-footer-badge,
body.sigfad-shell .sigfad-home,
body.sigfad-shell .sigfad-home-card,
body.sigfad-shell .sigfad-shell-map-tools {
  display: none !important;
}

@media (max-width: 1180px) {
  .sigfad-shell-top {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
  }

  .sigfad-shell-brand span {
    display: none;
  }

  .sigfad-shell-modules .nav-link {
    min-width: 64px;
    padding-inline: 6px !important;
    font-size: .68rem;
  }
}

@media (max-width: 940px) {
  .sigfad-shell-top {
    grid-template-columns: auto 1fr auto;
  }

  .sigfad-shell-modules {
    display: none;
  }

  .sigfad-shell-right #auth-nav .der-user-copy {
    display: none;
  }

  .sigfad-shell-right #auth-nav .der-user-trigger {
    min-width: auto;
  }
}

@media (max-width: 680px) {
  #thematicMapsModal .modal-dialog,
  #thematicMapsModal .modal-dialog.modal-fullscreen,
  #arrecadacaoModal .modal-dialog,
  #arrecadacaoModal .modal-dialog.modal-fullscreen {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    height: calc(100dvh - 86px) !important;
    max-height: calc(100dvh - 86px) !important;
    margin: 76px auto 10px !important;
  }

  #thematicMapsModal .der-thematic-workspace {
    display: flex !important;
    flex-direction: column;
    overflow: auto;
  }

  #thematicMapsModal .der-thematic-sidebar {
    flex: 0 0 auto;
    max-height: 48%;
    border-bottom: 1px solid var(--sigfad-border);
  }

  #thematicMapsModal .der-thematic-preview-area {
    flex: 1 1 auto;
    min-height: 360px;
  }
}


/* SIGFAD_RESPONSIVE_SHELL_V1_START */

/*
 * Em telas reduzidas, inclusive quando o DevTools está aberto,
 * os módulos deixam a barra principal e permanecem disponíveis
 * pelo menu lateral.
 */
@media (max-width: 1180px) {
  body.sigfad-shell {
    --sigfad-shell-height: 68px;
    overflow: hidden;
  }

  body.sigfad-shell .sigfad-shell-top {
    width: 100%;
    max-width: 100vw;
    height: var(--sigfad-shell-height);
    min-height: var(--sigfad-shell-height);

    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px;
    padding: 8px 12px;
    box-sizing: border-box;
  }

  body.sigfad-shell .sigfad-shell-left {
    min-width: 0;
    gap: 8px;
  }

  body.sigfad-shell .sigfad-shell-modules {
    display: none !important;
  }

  body.sigfad-shell .sigfad-shell-menu-btn {
    display: inline-flex !important;
    flex: 0 0 auto;
  }

  body.sigfad-shell .sigfad-shell-brand {
    min-width: 0;
    max-width: clamp(120px, 28vw, 220px);
  }

  body.sigfad-shell .sigfad-shell-brand strong {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.sigfad-shell .sigfad-shell-brand span {
    display: none !important;
  }

  body.sigfad-shell .sigfad-shell-right {
    min-width: 0;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  body.sigfad-shell .sigfad-shell-right > * {
    flex: 0 0 auto;
  }

  body.sigfad-shell #map {
    inset: var(--sigfad-shell-height) 0 0 0 !important;
  }
}

/* Celulares */
@media (max-width: 680px) {
  body.sigfad-shell {
    --sigfad-shell-height: 64px;
  }

  body.sigfad-shell .sigfad-shell-top {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 5px;
    padding: 7px 8px;
  }

  body.sigfad-shell .sigfad-shell-left {
    gap: 6px;
  }

  body.sigfad-shell .sigfad-shell-brand {
    max-width: 122px;
  }

  body.sigfad-shell .sigfad-shell-brand strong {
    font-size: 1.05rem;
    line-height: 1;
  }

  body.sigfad-shell .sigfad-shell-right {
    gap: 4px;
  }

  body.sigfad-shell .sigfad-shell-menu-btn,
  body.sigfad-shell .sigfad-shell-right > button,
  body.sigfad-shell .sigfad-shell-right > .btn,
  body.sigfad-shell .sigfad-shell-right .nav-link {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.sigfad-shell #navbarUserDropdown {
    min-width: 38px;
    padding: 2px !important;
  }

  body.sigfad-shell #navbarUserDropdown .der-user-copy,
  body.sigfad-shell #navbarUserDropdown .der-profile-label {
    display: none !important;
  }

  body.sigfad-shell #navbarUserDropdown img,
  body.sigfad-shell #navbarUserDropdown .der-avatar {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px;
    object-fit: cover;
  }

  body.sigfad-shell .sigfad-shell-sidebar {
    top: 72px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100dvh - 84px);
    border-radius: 18px;
  }

  body.sigfad-shell .sigfad-shell-badge {
    right: 8px;
    bottom: 8px;
    font-size: .72rem;
  }
}

/* Celulares muito estreitos */
@media (max-width: 420px) {
  body.sigfad-shell .sigfad-shell-brand {
    max-width: 105px;
  }

  body.sigfad-shell .sigfad-shell-brand strong {
    font-size: .98rem;
  }

  body.sigfad-shell .sigfad-shell-right {
    gap: 2px;
  }

  body.sigfad-shell .sigfad-shell-menu-btn,
  body.sigfad-shell .sigfad-shell-right > button,
  body.sigfad-shell .sigfad-shell-right > .btn,
  body.sigfad-shell .sigfad-shell-right .nav-link {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
  }
}

/* SIGFAD_RESPONSIVE_SHELL_V1_END */

/* SIGFAD_MOBILE_PROFILE_PROPORTION_V1_START */

@media (max-width: 680px) {

  /* Remove margens Bootstrap que aumentavam o espaço entre os ícones */
  body.sigfad-shell .sigfad-shell-right > .navbar-nav,
  body.sigfad-shell .sigfad-shell-right #auth-nav {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 4px !important;
  }

  body.sigfad-shell .sigfad-shell-right .nav-item {
    display: flex;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
  }

  /*
   * O perfil.js substitui #navbarUserDropdown por .der-user-trigger.
   * Este é o seletor definitivo do botão de perfil.
   */
  body.sigfad-shell #auth-nav .der-user-trigger {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;

    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;

    margin: 0 !important;
    padding: 2px !important;
    gap: 0 !important;

    border-radius: 50% !important;
    box-sizing: border-box !important;
    overflow: hidden;
  }

  /* Foto do usuário proporcional à hotbar */
  body.sigfad-shell #auth-nav .der-user-trigger > .der-avatar {
    display: grid !important;

    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;

    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;

    margin: 0 !important;
    padding: 0 !important;

    border-width: 2px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    box-sizing: border-box !important;
  }

  /* No celular permanece somente a foto */
  body.sigfad-shell #auth-nav .der-user-copy,
  body.sigfad-shell #auth-nav .der-profile-label,
  body.sigfad-shell #auth-nav .der-user-trigger::after {
    display: none !important;
  }

  /* Todos os atalhos da direita ficam com a mesma proporção */
  body.sigfad-shell .sigfad-shell-right #nav-alertas-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-auditoria-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-usuarios-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-alertas-wrapper button,
  body.sigfad-shell .sigfad-shell-right #nav-auditoria-wrapper button,
  body.sigfad-shell .sigfad-shell-right #nav-usuarios-wrapper button {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;

    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;

    margin: 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    border-radius: 14px !important;
    box-sizing: border-box !important;
  }

  /* Menu do perfil não pode ultrapassar a tela */
  body.sigfad-shell #auth-nav .der-user-menu {
    position: fixed !important;
    top: 68px !important;
    right: 8px !important;
    left: auto !important;

    width: min(320px, calc(100vw - 16px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 16px) !important;

    margin: 0 !important;
    transform: none !important;
  }
}

@media (max-width: 390px) {
  body.sigfad-shell #auth-nav .der-user-trigger,
  body.sigfad-shell .sigfad-shell-right #nav-alertas-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-auditoria-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-usuarios-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-alertas-wrapper button,
  body.sigfad-shell .sigfad-shell-right #nav-auditoria-wrapper button,
  body.sigfad-shell .sigfad-shell-right #nav-usuarios-wrapper button {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;

    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
  }

  body.sigfad-shell #auth-nav .der-user-trigger > .der-avatar {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;

    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
  }
}

/* SIGFAD_MOBILE_PROFILE_PROPORTION_V1_END */


/* SIGFAD_TABLET_LAYOUT_V2_START */

/*
 * Layout compacto para tablets, notebooks estreitos,
 * telas dobráveis e dispositivos de automação.
 *
 * Abrange:
 * - iPad Mini
 * - iPad Air
 * - Surface Pro 7
 * - Asus Zenbook Fold
 * - Nest Hub Max
 */
@media (max-width: 1366px) {
  body.sigfad-shell {
    --sigfad-shell-height: 68px;
    overflow: hidden;
  }

  body.sigfad-shell .sigfad-shell-top {
    width: 100%;
    max-width: 100vw;
    height: var(--sigfad-shell-height);
    min-height: var(--sigfad-shell-height);

    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center;
    gap: 10px;

    padding: 8px 14px !important;
    box-sizing: border-box;
    overflow: visible;
  }

  /* Os módulos passam para o menu hambúrguer. */
  body.sigfad-shell .sigfad-shell-modules {
    display: none !important;
  }

  body.sigfad-shell .sigfad-shell-menu-btn {
    display: grid !important;
    flex: 0 0 auto;
  }

  body.sigfad-shell .sigfad-shell-left {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
  }

  body.sigfad-shell .sigfad-shell-brand {
    display: block;
    min-width: 0;
    max-width: 190px;
  }

  body.sigfad-shell .sigfad-shell-brand strong {
    display: block;
    font-size: 1.25rem;
    line-height: 1;
    white-space: nowrap;
  }

  body.sigfad-shell .sigfad-shell-brand span {
    display: none !important;
  }

  body.sigfad-shell .sigfad-shell-right {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap !important;
    flex: 0 0 auto;
    min-width: 0;
    gap: 6px !important;
    overflow: visible;
  }

  body.sigfad-shell .sigfad-shell-right > .navbar-nav,
  body.sigfad-shell .sigfad-shell-right #auth-nav {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    flex-wrap: nowrap !important;
    gap: 6px !important;

    margin: 0 !important;
    padding: 0 !important;
  }

  body.sigfad-shell .sigfad-shell-right .nav-item {
    display: flex;
    align-items: center;
    flex: 0 0 auto;

    margin: 0 !important;
    padding: 0 !important;
  }

  /*
   * Botões de alerta, histórico e gestão de usuários
   * com dimensões uniformes.
   */
  body.sigfad-shell .sigfad-shell-right #nav-alertas-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-auditoria-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-usuarios-wrapper .nav-link,
  body.sigfad-shell .sigfad-shell-right #nav-alertas-wrapper button,
  body.sigfad-shell .sigfad-shell-right #nav-auditoria-wrapper button,
  body.sigfad-shell .sigfad-shell-right #nav-usuarios-wrapper button {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;

    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 0 !important;

    border-radius: 14px !important;
    box-sizing: border-box;
  }

  /* Perfil reduzido para foto, sem nome e cargo. */
  body.sigfad-shell #auth-nav .der-user-trigger {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;

    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 2px !important;
    gap: 0 !important;

    border-radius: 50% !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  body.sigfad-shell #auth-nav .der-user-trigger > .der-avatar {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;

    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;

    margin: 0 !important;
    padding: 0 !important;

    border-radius: 50% !important;
    object-fit: cover !important;
    box-sizing: border-box;
  }

  body.sigfad-shell #auth-nav .der-user-copy,
  body.sigfad-shell #auth-nav .der-profile-label,
  body.sigfad-shell #auth-nav .der-user-trigger::after {
    display: none !important;
  }

  /* Reposiciona o mapa de acordo com a hotbar compacta. */
  body.sigfad-shell #map {
    inset: var(--sigfad-shell-height) 0 0 0 !important;
  }

  /* Menu lateral proporcional ao tablet. */
  body.sigfad-shell .sigfad-shell-sidebar {
    top: 76px;
    left: 12px;

    width: min(330px, calc(100vw - 24px));
    max-height: calc(100dvh - 88px);

    border-radius: 20px;
  }

  /* Dropdown do perfil sempre dentro da viewport. */
  body.sigfad-shell #auth-nav .der-user-menu {
    position: fixed !important;

    top: 72px !important;
    right: 12px !important;
    left: auto !important;

    width: min(320px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;

    margin: 0 !important;
    transform: none !important;
  }

  /* Pop-ups adequados para telas com menor altura. */
  body.sigfad-shell .leaflet-popup {
    max-width: calc(100vw - 24px) !important;
  }

  body.sigfad-shell .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
  }

  body.sigfad-shell .leaflet-popup-content {
    width: auto !important;
    max-width: calc(100vw - 54px);
    max-height: calc(100dvh - 170px);
    overflow-y: auto;

    margin: 12px 14px;
    box-sizing: border-box;
  }

  body.sigfad-shell .occupation-map-popup {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
  }
}

/*
 * Tablets em orientação retrato:
 * iPad Mini, iPad Air, Surface Pro e Zenbook Fold.
 */
@media (min-width: 681px) and (max-width: 1024px) {
  body.sigfad-shell .sigfad-shell-top {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.sigfad-shell .sigfad-shell-brand {
    max-width: 150px;
  }

  body.sigfad-shell .sigfad-shell-brand strong {
    font-size: 1.18rem;
  }

  body.sigfad-shell .sigfad-shell-right {
    gap: 5px !important;
  }

  body.sigfad-shell .sigfad-shell-right > .navbar-nav,
  body.sigfad-shell .sigfad-shell-right #auth-nav {
    gap: 5px !important;
  }
}

/*
 * Larguras entre tablet e desktop:
 * Nest Hub Max e Zenbook Fold em orientação horizontal.
 */
@media (min-width: 1025px) and (max-width: 1366px) {
  body.sigfad-shell .sigfad-shell-top {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  body.sigfad-shell .sigfad-shell-brand {
    max-width: 210px;
  }

  body.sigfad-shell .sigfad-shell-brand strong {
    font-size: 1.3rem;
  }

  body.sigfad-shell .sigfad-shell-sidebar {
    width: 330px;
  }
}

/* SIGFAD_TABLET_LAYOUT_V2_END */




/* SIGFAD_PROFILE_LAYOUT_FIX_V2_START */

/*
 * Impede que padding, grid ou elementos da barra superior
 * ultrapassem a largura útil da tela.
 */
body.sigfad-shell .sigfad-shell-top {
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

body.sigfad-shell .sigfad-shell-left,
body.sigfad-shell .sigfad-shell-modules,
body.sigfad-shell .sigfad-shell-right {
  min-width: 0 !important;
}

body.sigfad-shell .sigfad-shell-right {
  max-width: 100% !important;
  flex-wrap: nowrap !important;
}

body.sigfad-shell #auth-nav,
body.sigfad-shell #auth-nav > li {
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 auto !important;
}

/*
 * Desktop: nome, cargo, avatar e seta permanecem visíveis.
 */
@media (min-width: 1025px) {
  body.sigfad-shell
  .sigfad-shell-right
  #auth-nav
  .der-user-trigger {
    width: auto !important;
    min-width: 220px !important;
    max-width: 260px !important;

    height: 56px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;

    padding: 5px 14px 5px 7px !important;
    gap: 9px !important;

    border-radius: 16px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body.sigfad-shell
  .sigfad-shell-right
  #auth-nav
  .der-user-trigger
  .der-user-copy {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  body.sigfad-shell
  .sigfad-shell-right
  #auth-nav
  .der-user-trigger.dropdown-toggle::after {
    display: inline-block !important;
    position: static !important;

    flex: 0 0 auto !important;

    margin-top: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    margin-left: auto !important;

    transform: none !important;
  }
}

/*
 * Tablets e notebooks estreitos: somente avatar.
 * Não existe conteúdo largo escondido dentro de 44px.
 */
@media (max-width: 1024px) {
  body.sigfad-shell .sigfad-shell-top {
    grid-template-columns:
      minmax(0, auto)
      minmax(0, 1fr)
      auto !important;

    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  body.sigfad-shell #auth-nav {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
  }

  body.sigfad-shell
  #auth-nav
  .der-user-trigger {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;

    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 2px !important;
    gap: 0 !important;

    border-radius: 14px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body.sigfad-shell
  #auth-nav
  .der-user-trigger > .der-avatar {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;

    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;

    margin: 0 !important;
    padding: 0 !important;

    border-radius: 50% !important;
    object-fit: cover !important;
    box-sizing: border-box !important;
  }

  body.sigfad-shell #auth-nav .der-user-copy,
  body.sigfad-shell #auth-nav .der-profile-label,
  body.sigfad-shell
  #auth-nav
  .der-user-trigger.dropdown-toggle::after {
    display: none !important;
  }
}

/* Celulares */
@media (max-width: 680px) {
  body.sigfad-shell #auth-nav {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
  }

  body.sigfad-shell
  #auth-nav
  .der-user-trigger {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;

    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
  }

  body.sigfad-shell
  #auth-nav
  .der-user-trigger > .der-avatar {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;

    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
  }
}

/* Celulares muito estreitos */
@media (max-width: 390px) {
  body.sigfad-shell #auth-nav {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
  }

  body.sigfad-shell
  #auth-nav
  .der-user-trigger {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;

    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
  }

  body.sigfad-shell
  #auth-nav
  .der-user-trigger > .der-avatar {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;

    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
  }
}

/* SIGFAD_PROFILE_LAYOUT_FIX_V2_END */

/* SIGFAD_PROFILE_DUPLICATE_ROLE_FIX_START */
/* O papel do usuário já aparece abaixo do nome no novo componente. */
body.sigfad-shell
#auth-nav
.der-user-trigger
.der-profile-label {
  display: none !important;
}
/* SIGFAD_PROFILE_DUPLICATE_ROLE_FIX_END */
