/* ==========================================================================
   Controle COSAE — Layout (Header / Footer)
   Usado em todas as telas internas do sistema (não usado na tela de Login).
   ========================================================================== */

.app-header {
  width: 100%;
  height: var(--cosae-header-height);
  background: var(--cosae-black);
  box-shadow: var(--cosae-shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header__inner {
  display: grid;
  /* auto/auto reservam o espaço real de logo e botões primeiro; o título
     (1fr) é quem cede espaço quando aperta — nunca o contrário. Com
     "1fr auto 1fr" as colunas das pontas podiam encolher (min-width:0)
     além do conteúdo e o título vazava por cima dos botões no mobile. */
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
  gap: 16px;
}

.app-header__left {
  justify-self: start;
  min-width: 0;
  display: flex;
  align-items: center;
}

.app-header__menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 8px;
  margin-right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--cosae-radius-sm);
  flex-shrink: 0;
  transition: background var(--cosae-fast) var(--cosae-ease);
}

.app-header__menu-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.app-header__menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--cosae-text-inverse);
  border-radius: 2px;
  transition: transform var(--cosae-fast) var(--cosae-ease), opacity var(--cosae-fast) var(--cosae-ease);
}

.app-header__menu-toggle.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.app-header__menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
}

.app-header__menu-toggle.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.app-header__center {
  justify-self: center;
  min-width: 0;
  overflow: hidden;
}

.app-header__right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.app-header__brand {
  display: flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
}

.app-header__logo {
  height: calc(var(--cosae-header-height) - 30px);
  width: auto;
  object-fit: contain;
  transition: transform var(--cosae-normal) var(--cosae-ease);
}

.app-header__brand:hover .app-header__logo {
  transform: scale(1.04);
}

.app-header__system {
  display: block;
  color: var(--cosae-text-inverse);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
  min-width: 0;
}

.app-header__user-name {
  color: var(--cosae-text-inverse);
  font-weight: 600;
  font-size: 0.86rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header__user-role {
  color: var(--cosae-text-inverse-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.app-header__logout {
  flex-shrink: 0;
  border: none;
  border-radius: var(--cosae-radius-sm);
  background: linear-gradient(180deg, var(--cosae-red-light) 0%, var(--cosae-red) 100%);
  color: #fff;
  font-family: var(--cosae-font);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 9px 16px;
  cursor: pointer;
  transition: transform var(--cosae-fast) var(--cosae-ease), box-shadow var(--cosae-fast) var(--cosae-ease), filter var(--cosae-fast) var(--cosae-ease);
  box-shadow: var(--cosae-shadow-red);
}

.app-header__controle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: var(--cosae-radius-sm);
  background: linear-gradient(180deg, var(--cosae-green-light) 0%, var(--cosae-green) 100%);
  color: #fff;
  font-family: var(--cosae-font);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--cosae-fast) var(--cosae-ease), box-shadow var(--cosae-fast) var(--cosae-ease), filter var(--cosae-fast) var(--cosae-ease);
  box-shadow: var(--cosae-shadow-green);
}

.app-header__controle-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31, 157, 85, 0.4);
}

.app-header__controle-btn:active {
  transform: translateY(0);
  filter: brightness(0.96);
}

.app-header__controle-btn[hidden] {
  display: none;
}

.app-header__logout:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(179, 18, 26, 0.4);
}

.app-header__logout:active {
  transform: translateY(0);
  filter: brightness(0.96);
}

@media (max-width: 640px) {
  .app-header__inner {
    padding: 0 12px;
    gap: 6px;
  }
  .app-header__system {
    font-size: 0.82rem;
    letter-spacing: 0.4px;
  }
  /* Nome/papel do usuário competem por espaço com logo e botões nessa
     largura — some no mobile, já dá pra ver quem está logado no drawer. */
  .app-header__user {
    display: none;
  }
  .app-header__right {
    gap: 8px;
  }
  .app-header__controle-btn,
  .app-header__logout {
    padding: 7px 10px;
    font-size: 0.66rem;
    letter-spacing: 0.3px;
  }
}

@media (max-width: 380px) {
  /* Espaço não alcança pra logo + título + botões — some com o título,
     a logo já identifica o sistema. */
  .app-header__system {
    display: none;
  }
}

/* Menu lateral (drawer) */
.app-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--cosae-normal) var(--cosae-ease);
  z-index: 150;
}

.app-nav-overlay.is-active {
  opacity: 1;
  pointer-events: all;
}

.app-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  max-width: 82vw;
  background: var(--cosae-black-soft);
  box-shadow: var(--cosae-shadow-lg);
  transform: translateX(-100%);
  transition: transform var(--cosae-normal) var(--cosae-ease);
  z-index: 160;
  display: flex;
  flex-direction: column;
}

.app-nav-drawer.is-open {
  transform: translateX(0);
}

.app-nav-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-nav-drawer__title {
  color: var(--cosae-text-inverse);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.app-nav-drawer__close {
  background: none;
  border: none;
  color: var(--cosae-text-inverse-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: 6px;
  transition: background var(--cosae-fast) var(--cosae-ease), color var(--cosae-fast) var(--cosae-ease);
}

.app-nav-drawer__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-nav-drawer__list {
  list-style: none;
  margin: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-nav-drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--cosae-radius-sm);
  color: var(--cosae-text-inverse);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background var(--cosae-fast) var(--cosae-ease), color var(--cosae-fast) var(--cosae-ease);
}

a.app-nav-drawer__link:hover {
  background: rgba(255, 255, 255, 0.08);
}

a.app-nav-drawer__link.is-active {
  background: rgba(179, 18, 26, 0.18);
  color: #fff;
  border-left: 3px solid var(--cosae-red);
  padding-left: 11px;
}

.app-nav-drawer__link--soon {
  color: var(--cosae-text-inverse-muted);
  cursor: default;
}

.app-nav-drawer__link--soon em {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Grupos do menu (Análise, Planilhas, Ferramentas) — seções fixas, sempre
   expandidas: a pessoa abre o menu e já vê tudo organizado por seção, sem
   precisar clicar pra descobrir o que tem dentro de cada uma. */
.app-nav-drawer__group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px 6px;
  color: var(--cosae-text-inverse-muted);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.app-nav-drawer__group-chevron {
  flex-shrink: 0;
  color: var(--cosae-red-light);
  transform: rotate(180deg);
}

.app-nav-drawer__group-list {
  list-style: none;
  margin: 0;
  padding: 0 0 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Footer */
.app-footer {
  position: relative;
  width: 100%;
  min-height: 240px;
  background-image: url('/assets/img/footer-banner.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: auto;
}

.app-footer__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.65) 100%);
}

.app-footer__content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--cosae-text-inverse);
  padding: 32px 20px;
  /* 1040px em vez de 720px pra caber as duas linhas de organização (DIISE
     e COSAE) lado a lado numa linha só, sem quebrar — o resto do conteúdo
     continua centralizado normalmente dentro desse espaço maior. */
  max-width: 1040px;
}

.app-footer__line {
  margin: 6px 0;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.app-footer__line--title {
  font-weight: 700;
  font-size: 1.05rem;
}

.app-footer__line--highlight {
  font-weight: 600;
  color: var(--cosae-red-light);
}

.app-footer__orgs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.app-footer__orgs .app-footer__line {
  margin: 6px 0;
}

.app-footer__orgs-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .app-footer__orgs {
    flex-direction: column;
    gap: 4px;
  }
  .app-footer__orgs-sep {
    display: none;
  }
}

.app-footer__line--muted {
  color: var(--cosae-text-inverse-muted);
  font-size: 0.8rem;
}

.app-footer__divider {
  width: 60px;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin: 10px auto;
}

.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
}

@media (max-width: 576px) {
  .app-footer__content {
    padding: 24px 16px;
  }
  .app-footer__line {
    font-size: 0.85rem;
  }
}
