/* =========================================================
   HEADER COMPARTILHADO — BIBLIOTECA MUNICIPAL
   Responsividade fluida:
   - Desktop amplo: composição completa.
   - Notebook: redução progressiva com clamp().
   - <= 1400px: drawer/toggle para notebook, tablet e mobile.
   - Drawer usa 100dvh + scroll para telas de pouca altura.
   ========================================================= */

.site-header {
  --header-green: #2e7d32;
  --header-green-dark: #236b2a;
  --header-green-light: #12b94f;
  --header-action-bg: #12b94f;
  --header-action-hover-bg: #159e47;
  --header-action-text: #ffffff;
  --header-white: #ffffff;
  --header-text-dark: #243229;
  --header-border: #dce7df;
  --header-soft: #f3f8f4;
  --header-shadow: 0 4px 18px rgba(18, 63, 50, 0.18);

  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;

  /* Mantém o componente no topo durante o scroll sem retirá-lo
     do fluxo da página, evitando a necessidade de padding compensatório. */
  isolation: isolate;
}

.site-header *,
.site-header *::before,
.site-header *::after {
  box-sizing: border-box;
}

.site-header a {
  text-decoration: none;
}

.site-header button {
  font: inherit;
  border: 0;
}

/* =========================================================
   DESKTOP / NOTEBOOK
   As três colunas mantêm o menu geometricamente centralizado.
   ========================================================= */

.navbar {
  width: 100%;
  min-height: clamp(72px, 4.5vw, 82px);
  padding-block: 8px;
  padding-inline: clamp(18px, 3vw, 64px);

  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  column-gap: clamp(14px, 1.8vw, 30px);

  overflow: visible;

  background: var(--header-green);
  box-shadow: var(--header-shadow);
}

/* =========================
   MARCA
   ========================= */

.logo-area {
  min-width: 0;
  justify-self: start;

  display: inline-flex;
  align-items: center;
  gap: clamp(7px, 0.8vw, 11px);

  color: var(--header-white);
}

.logo-area:hover {
  color: var(--header-white);
}

.logo-area img {
  width: clamp(48px, 3.2vw, 58px);
  height: clamp(48px, 3.2vw, 58px);
  flex: 0 0 auto;

  display: block;
  object-fit: contain;

  padding: 3px;
  background: var(--header-white);
  border-radius: 50%;
}

.brand-title {
  color: var(--header-white);

  font-size: clamp(0.78rem, 0.32vw + 0.68rem, 0.98rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;

  white-space: nowrap;
}

/* =========================
   NAVEGAÇÃO CENTRAL
   ========================= */

.nav-links {
  min-width: 0;
  margin: 0;
  padding: 0;

  justify-self: center;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(13px, 1.65vw, 34px);

  list-style: none;
}

.nav-links > li {
  position: relative;
  min-width: 0;
}

.nav-links a,
.dropdown-toggle {
  padding: 10px 0;

  display: inline-flex;
  align-items: center;

  color: var(--header-white);
  background: transparent;

  font-size: clamp(0.78rem, 0.28vw + 0.69rem, 0.95rem);
  font-weight: 550;
  line-height: 1.2;
  white-space: nowrap;

  cursor: pointer;

  transition:
    color 0.2s ease,
    opacity 0.2s ease;
}

.nav-links a:hover,
.dropdown-toggle:hover {
  color: #dff3e4;
}

/* A marca funciona como Home no desktop. */
.mobile-home {
  display: none;
}

/* =========================
   DROPDOWN
   ========================= */

.dropdown-menu {
  min-width: 220px;
  margin: 0;
  padding: 9px;

  position: absolute;
  top: calc(100% + 10px);
  left: 50%;

  display: none;
  flex-direction: column;
  gap: 4px;

  background: var(--header-white);
  border: 1px solid var(--header-border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(20, 55, 30, 0.18);

  list-style: none;

  transform: translateX(-50%);
}

.dropdown.open .dropdown-menu {
  display: flex;
}

.dropdown-menu a {
  width: 100%;
  padding: 11px 13px;

  color: var(--header-text-dark);
  border-radius: 7px;

  font-size: 0.88rem;
}

.dropdown-menu a:hover {
  color: var(--header-green-dark);
  background: var(--header-soft);
}

/* =========================
   AÇÕES À DIREITA
   ========================= */

.desktop-actions {
  min-width: 0;
  justify-self: end;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(6px, 0.55vw, 9px);
}

.login-btn {
  min-height: clamp(40px, 2.5vw, 44px);
  padding-inline: clamp(15px, 1.15vw, 21px);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  color: var(--header-action-text);
  background: var(--header-action-bg);
  border-radius: 999px;

  font-size: clamp(0.84rem, 0.25vw + 0.76rem, 0.95rem);
  font-weight: 700;
  white-space: nowrap;

  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.login-btn:hover {
  color: var(--header-action-text);
  background: var(--header-action-hover-bg);
  transform: translateY(-1px);
}

.authenticated-actions {
  gap: clamp(5px, 0.5vw, 8px);
}

.header-action-button {
  position: relative;

  width: clamp(38px, 2.35vw, 42px);
  height: clamp(38px, 2.35vw, 42px);
  flex: 0 0 auto;

  display: grid;
  place-items: center;

  color: var(--header-white);
  background: rgba(255, 255, 255, 0.12);

  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 50%;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.header-action-button:hover {
  color: var(--header-white);
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.notification-button {
  appearance: none;
}

/* =========================
   CENTRAL DE NOTIFICAÇÕES
   ========================= */

.notification-center {
  position: relative;

  display: flex;
  align-items: center;
}

.notification-button {
  isolation: isolate;
}

.notification-button i {
  position: relative;
  z-index: 1;
}

.notification-button--has-unread {
  color: var(--header-green-dark);
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.10),
    0 7px 18px rgba(16, 62, 28, 0.18);
}

.notification-button--has-unread:hover {
  color: var(--header-green-dark);
  background: #f4fff6;
}

.notification-button--pulse i {
  animation: notification-bell-pulse 0.7s ease;
}

@keyframes notification-bell-pulse {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }

  30% {
    transform: rotate(-14deg) scale(1.08);
  }

  60% {
    transform: rotate(12deg) scale(1.08);
  }
}

.notification-badge {
  position: absolute;
  z-index: 3;
  top: -7px;
  right: -7px;

  min-width: 20px;
  height: 20px;
  padding-inline: 5px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: #ffffff;
  background: #d93025;
  border: 2px solid var(--header-green);
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(118, 21, 15, 0.28);

  font-size: 0.63rem;
  font-weight: 850;
  line-height: 1;

  pointer-events: none;
}

.notification-button--has-unread .notification-badge {
  border-color: #ffffff;
}

.notification-badge[hidden] {
  display: none;
}

.notification-panel {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 14px);
  right: 0;

  width: min(420px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 110px));

  overflow: hidden;

  color: var(--header-text-dark);
  background: rgba(255, 255, 255, 0.99);

  border: 1px solid rgba(46, 125, 50, 0.14);
  border-radius: 18px;
  box-shadow:
    0 20px 55px rgba(13, 51, 24, 0.22),
    0 4px 14px rgba(13, 51, 24, 0.08);

  transform-origin: top right;
  animation: notification-panel-in 0.16s ease-out;
}

@keyframes notification-panel-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notification-panel[hidden] {
  display: none;
}

.notification-panel::before {
  content: "";

  position: absolute;
  top: -7px;
  right: 15px;

  width: 14px;
  height: 14px;

  background: #ffffff;
  border-top: 1px solid rgba(46, 125, 50, 0.14);
  border-left: 1px solid rgba(46, 125, 50, 0.14);

  transform: rotate(45deg);
}

.notification-panel__header {
  position: relative;
  z-index: 1;

  min-height: 72px;
  padding: 15px 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  background:
    linear-gradient(180deg, #fbfffc 0%, #ffffff 100%);
  border-bottom: 1px solid #e8efea;
}

.notification-panel__heading {
  min-width: 0;

  display: grid;
  gap: 3px;
}

.notification-panel__heading strong {
  color: #193822;

  font-size: 1rem;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.notification-panel__heading span {
  color: #6c7b70;

  font-size: 0.72rem;
  font-weight: 600;
}

.notification-read-all {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;

  color: var(--header-green-dark);
  background: #f0f8f2;
  border: 1px solid #e0eee3 !important;
  border-radius: 9px;

  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;

  cursor: pointer;

  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.notification-read-all:hover:not(:disabled) {
  color: #174d1e;
  background: #e7f4ea;
  border-color: #d2e7d7 !important;
}

.notification-read-all:disabled {
  color: #9aa79d;
  background: #f8faf8;
  border-color: #edf1ed !important;
  cursor: default;
}

.notification-list {
  max-height: 420px;
  overflow-x: hidden;
  overflow-y: auto;

  background: #ffffff;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #bfd0c3 transparent;
}

.notification-list::-webkit-scrollbar {
  width: 8px;
}

.notification-list::-webkit-scrollbar-thumb {
  background: #bfd0c3;
  border: 2px solid #ffffff;
  border-radius: 999px;
}

.notification-item {
  position: relative;

  width: 100%;
  min-height: 98px;

  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: stretch;

  background: #ffffff;
  border-bottom: 1px solid #edf2ee;

  transition:
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item:hover {
  background: #f8fbf9;
}

.notification-item--unread {
  background:
    linear-gradient(90deg, rgba(46, 125, 50, 0.065), transparent 70%),
    #fbfffc;
}

.notification-item--unread::before {
  content: "";

  position: absolute;
  inset: 0 auto 0 0;

  width: 3px;

  background: var(--header-green-light);
}

.notification-item--unread:hover {
  background:
    linear-gradient(90deg, rgba(46, 125, 50, 0.09), transparent 72%),
    #f7fcf8;
}

.notification-item__open {
  min-width: 0;
  padding: 13px 6px 13px 15px;

  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: start;

  color: #29372d;
  background: transparent;

  text-align: left;
  cursor: pointer;
}

.notification-item__open:focus-visible,
.notification-item__delete:focus-visible,
.notification-read-all:focus-visible,
.notification-button:focus-visible {
  outline: 3px solid rgba(18, 185, 79, 0.32);
  outline-offset: 2px;
}

.notification-item__icon {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  color: var(--header-green-dark);
  background: #e8f6eb;
  border: 1px solid #d9ecdd;
  border-radius: 12px;

  font-size: 0.84rem;
}

.notification-item--unread .notification-item__icon {
  color: #ffffff;
  background: var(--header-green);
  border-color: var(--header-green);
  box-shadow: 0 5px 14px rgba(46, 125, 50, 0.16);
}

.notification-item__content {
  min-width: 0;

  display: grid;
  gap: 5px;
}

.notification-item__title-row {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 7px;
}

.notification-item__title {
  min-width: 0;

  overflow: hidden;

  color: #1f3526;

  font-size: 0.83rem;
  font-weight: 820;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;

  background: #e53935;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.10);
}

.notification-item__message {
  margin: 0;

  display: -webkit-box;
  overflow: hidden;

  color: #5a685e;

  font-size: 0.75rem;
  line-height: 1.42;

  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.notification-item__time {
  color: #87948a;

  font-size: 0.66rem;
  font-weight: 650;
}

.notification-item__delete {
  width: 30px;
  height: 30px;
  margin: 10px 8px 0 0;

  align-self: start;

  display: grid;
  place-items: center;

  color: #8c9990;
  background: transparent;
  border-radius: 8px;

  font-size: 0.76rem;
  cursor: pointer;

  opacity: 0.72;

  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}

.notification-item__delete:hover {
  color: #b3261e;
  background: #fff0ef;

  opacity: 1;
  transform: scale(1.04);
}

.notification-item__delete:disabled {
  opacity: 0.35;
  cursor: wait;
  transform: none;
}

.notification-state {
  min-height: 160px;
  padding: 28px 24px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;

  color: #758178;

  text-align: center;
}

.notification-state i {
  color: #6f8574;

  font-size: 1.1rem;
}

.notification-state strong {
  color: #3f5145;

  font-size: 0.84rem;
}

.notification-state span {
  max-width: 280px;

  font-size: 0.74rem;
  line-height: 1.45;
}

.notification-retry {
  margin-top: 4px;
  padding: 7px 11px;

  color: var(--header-green-dark);
  background: var(--header-soft);
  border-radius: 8px;

  font-size: 0.72rem;
  font-weight: 750;

  cursor: pointer;
}

.notification-retry:hover {
  background: #e7f2e9;
}

.logout-form {
  margin: 0;
}

/* =========================
   CARD DO PERFIL
   ========================= */

.profile-card {
  max-width: clamp(160px, 12vw, 225px);
  min-width: 0;
  min-height: 46px;
  padding: 5px clamp(8px, 0.7vw, 12px) 5px 6px;

  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--header-white);
  background: rgba(255, 255, 255, 0.1);

  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;

  transition: background-color 0.2s ease;
}

.profile-card:hover {
  color: var(--header-white);
  background: rgba(255, 255, 255, 0.18);
}

.profile-avatar {
  width: 35px;
  height: 35px;
  flex: 0 0 35px;

  display: grid;
  place-items: center;

  color: var(--header-green-dark);
  background: var(--header-white);

  border-radius: 50%;

  font-size: 0.8rem;
  font-weight: 800;
  overflow: hidden;
}

.profile-avatar > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Mantém o fallback textual sozinho quando a foto não existe ou falha.
   A regra explícita é necessária porque o display:block acima prevalece
   sobre o estilo padrão do atributo HTML hidden em alguns navegadores. */
.profile-avatar > [data-avatar-image][hidden],
.profile-avatar > [data-avatar-initials][hidden] {
  display: none !important;
}

.profile-copy {
  min-width: 0;

  display: flex;
  flex-direction: column;

  line-height: 1.15;
}

.profile-copy strong {
  max-width: clamp(78px, 7.2vw, 140px);
  overflow: hidden;

  color: inherit;

  font-size: clamp(0.76rem, 0.18vw + 0.72rem, 0.84rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy small {
  margin-top: 3px;

  color: rgba(255, 255, 255, 0.76);

  font-size: 0.68rem;
}

/* Exclusivos do drawer */
.mobile-menu-button,
.mobile-account-area,
.mobile-admin,
.mobile-login,
.mobile-logout,
.mobile-menu-overlay {
  display: none;
}

/* =========================================================
   RESPONSIVIDADE DO HEADER

   Estratégia:
   - >= 1101px: três colunas simétricas (1fr / menu / 1fr).
     Isso mantém o menu no centro geométrico da tela, independentemente
     da largura da marca ou das ações de usuário à direita.
   - 1360px–1599px: desktop compacto, sem deslocar o menu.
   - 1200px–1359px: reduz tamanhos, mas preserva textos e ícones centrais.
   - 1101px–1199px: desktop mínimo ainda completo; nada some do menu.
   - <= 1100px: drawer lateral.
   ========================================================= */

/* ---------------------------------------------------------
   Desktop: navegação com ícones e estados de interação
   --------------------------------------------------------- */
@media (min-width: 1101px) {
  /* Colunas laterais sempre têm a mesma largura. O conteúdo pode ser
     diferente, mas o menu continua exatamente no centro da viewport. */
  .navbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    min-height: 68px;
    padding-inline: clamp(10px, 1.8vw, 32px);
    column-gap: clamp(6px, .8vw, 14px);
  }

  .logo-area {
    justify-self: start;
  }

  .desktop-actions {
    justify-self: end;
  }

  .navbar > .nav-links {
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
  }

  .navbar .desktop-nav-action {
    position: relative;
    min-height: 38px;
    padding: 0 clamp(5px, .48vw, 10px);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;

    color: rgba(255,255,255,.95);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;

    font-size: clamp(.69rem, .20vw + .65rem, .86rem);
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;

    transition:
      background-color .20s ease,
      border-color .20s ease,
      transform .20s ease,
      box-shadow .20s ease;
  }

  .navbar .desktop-nav-action .mobile-nav-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;

    display: inline-grid;
    place-items: center;

    color: rgba(255,255,255,.86);
    font-size: .74rem;
  }

  .navbar .desktop-nav-action:hover,
  .navbar .desktop-nav-action:focus-visible {
    color: #fff;
    background: rgba(255,255,255,.11);
    border-color: rgba(255,255,255,.12);
    transform: translateY(-1px);
  }

  .navbar .desktop-nav-action::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 3px;

    width: 0;
    height: 2px;

    background: rgba(255,255,255,.92);
    border-radius: 999px;

    transform: translateX(-50%);
    transition: width .20s ease;
  }

  .navbar .desktop-nav-action:hover::after,
  .navbar .desktop-nav-action:focus-visible::after {
    width: calc(100% - 18px);
  }

  .mobile-menu-button,
  .mobile-menu-overlay,
  .mobile-account-area,
  .mobile-admin,
  .mobile-login,
  .mobile-logout,
  .mobile-drawer-header,
  .mobile-section-label {
    display: none;
  }
}

/* ---------------------------------------------------------
   Full HD / desktop amplo
   --------------------------------------------------------- */
@media (min-width: 1600px) {
  .navbar {
    min-height: 72px;
    padding-inline: clamp(28px, 3vw, 64px);
    column-gap: clamp(10px, 1vw, 20px);
  }

  .navbar .desktop-nav-action {
    min-height: 40px;
    padding-inline: clamp(9px, .65vw, 14px);
    gap: 6px;
    font-size: .88rem;
  }

  .navbar .desktop-nav-action .mobile-nav-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
    font-size: .82rem;
  }
}

/* ---------------------------------------------------------
   Notebook confortável: 1360–1599
   Marca, navegação e perfil completo sem deslocar o centro.
   --------------------------------------------------------- */
@media (min-width: 1360px) and (max-width: 1599px) {
  .navbar {
    min-height: 70px;
    padding-inline: clamp(14px, 1.55vw, 26px);
    column-gap: 6px;
  }

  .logo-area {
    gap: 7px;
  }

  .logo-area img {
    width: 48px;
    height: 48px;
  }

  .brand-title {
    display: block;
    font-size: .79rem;
  }

  .navbar .desktop-nav-action {
    min-height: 38px;
    padding-inline: 6px;
    gap: 4px;
    font-size: .73rem;
  }

  .navbar .desktop-nav-action .mobile-nav-icon {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
    display: inline-grid;
    font-size: .75rem;
  }

  .authenticated-actions {
    gap: 4px;
  }

  .header-action-button {
    width: 36px;
    height: 36px;
  }

  .profile-card {
    width: auto;
    max-width: 155px;
    min-height: 40px;
    padding-right: 8px;
    justify-content: flex-start;
  }

  .profile-card .profile-avatar {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
  }

  .profile-card .profile-copy {
    display: flex;
  }

  .profile-copy strong {
    max-width: 92px;
    font-size: .73rem;
  }

  .profile-copy small {
    font-size: .60rem;
  }
}

/* ---------------------------------------------------------
   Notebook HD: 1200–1359
   Continua com menu completo e geometricamente centralizado.
   Somente o card de perfil é compactado para liberar margem.
   --------------------------------------------------------- */

/* ---------------------------------------------------------
   Notebook / laptop compacto
   --------------------------------------------------------- */
@media (min-width: 1101px) and (max-width: 1359px) {
  .notification-panel {
    width: min(370px, calc(100vw - 24px));
  }

  .notification-panel__header {
    padding-inline: 14px;
  }

  .notification-item__open {
    padding-left: 13px;
  }
}

@media (min-width: 1200px) and (max-width: 1359px) {
  .navbar {
    min-height: 68px;
    padding-inline: 10px;
    column-gap: 4px;
  }

  .logo-area {
    gap: 6px;
  }

  .logo-area img {
    width: 44px;
    height: 44px;
  }

  .brand-title {
    display: block;
    font-size: .78rem;
  }

  .navbar .desktop-nav-action {
    min-height: 36px;
    padding-inline: 5px;
    gap: 4px;
    font-size: .75rem;
  }

  .navbar .desktop-nav-action .mobile-nav-icon {
    width: 13px;
    height: 13px;
    flex-basis: 13px;
    display: inline-grid;
    font-size: .65rem;
  }

  .authenticated-actions {
    gap: 3px;
  }

  .header-action-button {
    width: 34px;
    height: 34px;
  }

  .profile-card {
    width: 38px;
    max-width: 38px;
    min-height: 38px;
    padding: 3px;
    justify-content: center;
  }

  .profile-card .profile-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .profile-card .profile-copy {
    display: none;
  }
}

/* ---------------------------------------------------------
   Notebook compacto: 1101–1199
   Preserva nome da biblioteca, ícones e textos do menu.
   A redução agora é somente de escala, não de conteúdo.
   --------------------------------------------------------- */
@media (min-width: 1101px) and (max-width: 1199px) {
  .navbar {
    min-height: 66px;
    padding-inline: 8px;
    column-gap: 2px;
  }

  .logo-area {
    width: auto;
    gap: 5px;
  }

  .logo-area img {
    width: 42px;
    height: 42px;
  }

  .brand-title {
    display: block;
    font-size: 0.78rem;
  }

  .navbar .desktop-nav-action {
    min-height: 34px;
    padding-inline: 4px;
    gap: 3px;
    font-size: .75rem;
  }

  .navbar .desktop-nav-action .mobile-nav-icon {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
    display: inline-grid;
    font-size: .65rem;
  }

  .authenticated-actions {
    gap: 2px;
  }

  .header-action-button {
    width: 31px;
    height: 31px;
  }

  .profile-card {
    width: 34px;
    max-width: 34px;
    min-height: 34px;
    padding: 3px;
    justify-content: center;
  }

  .profile-card .profile-avatar {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
    font-size: .68rem;
  }

  .profile-card .profile-copy {
    display: none;
  }
}

/* =========================================================
   DRAWER — somente quando a largura realmente exige
   (tablets, netbooks estreitos e celulares)
   ========================================================= */
@media (max-width: 1100px) {
  .navbar {
    min-height: 72px;
    padding: 8px clamp(14px, 3vw, 22px);

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .logo-area {
    gap: 9px;
  }

  .logo-area img {
    width: 50px;
    height: 50px;
  }

  .brand-title {
    font-size: .80rem;
  }

  .desktop-actions {
    display: none;
  }

  /* Mantém apenas o sino visível no header mobile. */
  .desktop-actions.authenticated-actions {
    margin-left: auto;

    display: flex;
    align-items: center;
    gap: 6px;
  }

  .authenticated-actions > .admin-panel-button,
  .authenticated-actions > .profile-card,
  .authenticated-actions > .logout-form {
    display: none;
  }

  .authenticated-actions .notification-center {
    display: flex;
  }

  .authenticated-actions .notification-button {
    width: 42px;
    height: 42px;
  }

  .notification-panel {
    position: fixed;
    top: 80px;
    right: 12px;
    left: 12px;

    width: auto;
    max-height: calc(100dvh - 96px);

    border-radius: 18px;
    transform-origin: top center;
  }

  .notification-panel::before {
    display: none;
  }

  .notification-list {
    max-height: calc(100dvh - 180px);
  }

  .notification-item__delete {
    opacity: 1;
  }

  .mobile-menu-button {
    position: relative;
    z-index: 10002;

    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    flex: 0 0 44px;
    padding: 0;

    display: grid;
    place-items: center;

    color: var(--header-white);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;

    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;

    transition:
      color .18s ease,
      background-color .18s ease,
      border-color .18s ease;
  }

  .mobile-menu-button i {
    line-height: 1;
    transform: none;
  }

  .nav-links {
    position: fixed;
    z-index: 10001;
    top: 0;
    right: 0;
    bottom: 0;

    width: min(318px, 88vw);
    height: 100dvh;
    min-height: 0;

    margin: 0;
    padding: 22px 20px 20px;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 3px;

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;

    background:
      linear-gradient(180deg, rgba(255,255,255,.035), transparent 150px),
      var(--header-green);
    box-shadow: -16px 0 42px rgba(9, 38, 18, .28);

    transform: translateX(100%);
    transition: transform .32s ease;
  }

  .nav-links.active {
    transform: translateX(0);
  }

  .nav-links > li {
    width: 100%;
  }

  .mobile-home,
  .mobile-account-area,
  .mobile-admin,
  .mobile-login,
  .mobile-logout,
  .mobile-drawer-header,
  .mobile-section-label,
  .mobile-nav-icon {
    display: block;
  }

  .mobile-drawer-header {
    min-height: 58px;
    margin: 0 52px 18px 0;
    padding: 0 0 16px;

    display: flex;
    align-items: center;

    border-bottom: 1px solid rgba(255,255,255,.14);
  }

  .mobile-drawer-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
  }

  .mobile-drawer-brand img {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 2px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
  }

  .mobile-drawer-brand > span {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mobile-drawer-brand strong {
    font-size: .82rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .mobile-drawer-brand small {
    color: rgba(255,255,255,.68);
    font-size: .62rem;
    font-weight: 550;
  }

  .nav-links > li > a,
  .dropdown-toggle {
    width: 100%;
    min-height: 48px;
    padding: 0 12px;

    display: flex;
    align-items: center;
    gap: 12px;

    color: var(--header-white);
    background: transparent;
    border-bottom: 0;
    border-radius: 10px;

    font-size: .91rem;
    font-weight: 620;
    text-align: left;
    white-space: normal;

    transition: background-color .18s ease;
  }

  .nav-links > li > a:hover,
  .dropdown-toggle:hover {
    background: rgba(255,255,255,.09);
  }

  .mobile-nav-icon {
    width: 20px;
    flex: 0 0 20px;
    place-items: center;
    color: rgba(255,255,255,.78);
    font-size: .92rem;
  }

  .dropdown {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .dropdown-menu {
    position: static;
    width: 100%;
    min-width: 0;
    margin: 2px 0 6px 32px;
    padding: 0 0 0 9px;

    background: transparent;
    border: 0;
    border-left: 1px solid rgba(255,255,255,.16);
    border-radius: 0;
    box-shadow: none;

    transform: none;
  }

  .dropdown-menu a {
    min-height: 40px;
    padding: 9px 11px;

    color: rgba(255,255,255,.76);
    border: 0;
    border-radius: 8px;

    font-size: .82rem;
  }

  .dropdown-menu a:hover {
    color: #fff;
    background: rgba(255,255,255,.07);
  }

  .mobile-menu-overlay {
    position: fixed;
    z-index: 10000;
    inset: 0;

    display: block;

    background: rgba(7, 22, 13, .60);
    backdrop-filter: blur(2px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
      opacity .28s ease,
      visibility .28s ease;
  }

  .mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-account-area {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.14);
  }

  .nav-links .mobile-profile-card {
    min-height: 60px;
    padding: 9px 11px;
    gap: 10px;

    display: flex;
    align-items: center;

    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 13px;
  }

  .mobile-profile-card .profile-avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .mobile-profile-card .profile-copy strong {
    max-width: 190px;
    font-size: .83rem;
  }

  .mobile-section-label {
    margin: 18px 0 5px;
    padding: 0 11px;

    color: rgba(255,255,255,.52);

    font-size: .60rem;
    font-weight: 750;
    letter-spacing: .10em;
    text-transform: uppercase;
  }

  .nav-links .mobile-secondary-action {
    min-height: 46px;
    margin: 0;
    padding: 0 12px;

    display: flex;
    align-items: center;
    gap: 11px;

    color: #fff;
    background: rgba(20, 72, 32, .22);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;

    font-size: .84rem;
    font-weight: 650;
  }

  .mobile-login {
    margin-top: auto;
    padding-top: 18px;
  }

  .nav-links .mobile-login > a {
    min-height: 46px;
    padding: 0 16px;
    justify-content: center;
    color: var(--header-action-text);
    background: var(--header-action-bg);
    border-radius: 11px;
    font-weight: 700;
  }

  .nav-links .mobile-login > a:hover {
    color: var(--header-action-text);
    background: var(--header-action-hover-bg);
  }

  .mobile-logout {
    margin-top: auto;
    padding-top: 18px;
  }

  .mobile-logout form {
    margin: 0;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,.14);
  }

  .mobile-logout button {
    width: 100%;
    min-height: 46px;
    padding: 0 15px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    color: #fff;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 11px;

    font-weight: 700;
    cursor: pointer;
  }

  .mobile-menu-button[aria-expanded="true"] {
    position: fixed;
    top: 14px;
    right: 14px;

    color: #fff;
    background: transparent;
    border-color: transparent;

    font-size: 1.15rem;
    box-shadow: none;
    transform: none;
  }

  .mobile-menu-button[aria-expanded="true"]:active {
    background: transparent;
    opacity: .7;
    transform: none;
  }

  .mobile-menu-button[aria-expanded="true"]:focus-visible {
    outline: 2px solid rgba(255,255,255,.82);
    outline-offset: 2px;
  }

  @media (hover: hover) {
    .mobile-menu-button[aria-expanded="true"]:hover {
      background: transparent;
      border-color: transparent;
      opacity: .82;
      transform: none;
    }
  }

  body.header-menu-open {
    overflow: hidden;
  }
}

/* ---------------------------------------------------------
   Netbook / celular estreito
   --------------------------------------------------------- */
@media (max-width: 520px) {
  .navbar {
    min-height: 68px;
    padding-inline: 10px;
    gap: 8px;
  }

  .authenticated-actions {
    gap: 4px;
  }

  .authenticated-actions .notification-button {
    width: 40px;
    height: 40px;
  }

  .notification-panel {
    top: 74px;
    right: 8px;
    left: 8px;

    max-height: calc(100dvh - 84px);

    border-radius: 16px;
  }

  .notification-panel__header {
    min-height: 66px;
    padding: 12px 13px;
  }

  .notification-panel__heading strong {
    font-size: 0.94rem;
  }

  .notification-read-all {
    min-height: 30px;
    padding-inline: 8px;

    font-size: 0.67rem;
  }

  .notification-list {
    max-height: calc(100dvh - 156px);
  }

  .notification-item {
    min-height: 94px;
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .notification-item__open {
    padding: 12px 4px 12px 12px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
  }

  .notification-item__icon {
    width: 34px;
    height: 34px;

    border-radius: 10px;
  }

  .notification-item__delete {
    width: 28px;
    height: 28px;
    margin: 9px 5px 0 0;
  }

  .notification-item__message {
    font-size: 0.72rem;
  }

  .logo-area img {
    width: 46px;
    height: 46px;
  }

  .brand-title {
    max-width: 145px;
    font-size: .73rem;
    white-space: normal;
  }

  .nav-links {
    width: min(300px, 90vw);
    padding: 18px 17px;
  }

  .mobile-drawer-header {
    margin-right: 48px;
  }
}


@media (max-width: 370px) {
  .brand-title {
    display: none;
  }

  .logo-area img {
    width: 44px;
    height: 44px;
  }
}

/* 800x480 / 1024x600: otimiza a altura do drawer sem remover itens. */
@media (max-width: 1100px) and (max-height: 620px) {
  .nav-links {
    padding-top: 12px;
    padding-bottom: 14px;
  }

  .mobile-drawer-header {
    min-height: 44px;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .mobile-drawer-brand img {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .nav-links > li > a,
  .dropdown-toggle {
    min-height: 39px;
  }

  .dropdown-menu a {
    min-height: 34px;
    padding-block: 6px;
  }

  .mobile-account-area {
    margin-top: 7px;
    padding-top: 7px;
  }

  .mobile-section-label {
    margin-top: 8px;
  }

  .mobile-login,
  .mobile-logout {
    padding-top: 8px;
  }

  .mobile-logout form {
    padding-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-links,
  .mobile-menu-overlay,
  .login-btn,
  .header-action-button,
  .notification-item,
  .notification-read-all,
  .notification-item__delete,
  .profile-card,
  .navbar .desktop-nav-action,
  .navbar .desktop-nav-action::after {
    transition: none;
  }
}


@media (prefers-reduced-motion: reduce) {
  .notification-panel,
  .notification-button--pulse i {
    animation: none !important;
  }
}
