/* =====================================================================
   ALTITUDE V37 — AJUSTES CONSOLIDADOS 01–27
   Carregado por último para neutralizar conflitos de versões anteriores.
   ===================================================================== */

:root{
  --v37-navy:#07314f;
  --v37-cyan:#16a9bc;
  --v37-line:#d7e4ec;
  --v37-bg:#f4f8fb;
  --v37-muted:#62788a;
  --v37-danger:#bd2f3d;
}

/* 26 — No mobile, Acessar/Cadastrar ficam dentro do dropdown. */
.alt-public-header__mobile-actions{
  display:none;
  gap:8px;
  margin-top:7px;
  padding-top:10px;
  border-top:1px solid var(--v37-line);
}
.alt-public-header__mobile-actions a{
  justify-content:center!important;
  text-align:center;
  min-height:46px!important;
  border:1px solid #cfe2ea;
}
.alt-public-header__mobile-actions .mobile-login{
  color:var(--v37-navy)!important;
  background:#fff;
}
.alt-public-header__mobile-actions .mobile-signup{
  color:#fff!important;
  border-color:var(--v37-cyan)!important;
  background:var(--v37-cyan)!important;
}

/* 20–24 — login/cadastro */
.email-confirm-grid{display:grid;gap:6px}
.account-recovery-links{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:8px 16px;
  margin-top:12px;
}
.account-recovery-links a{font-weight:800}
.wrong-email-pane{
  width:min(520px,100%);
  margin:12px auto 0;
  padding:16px;
  border:1px solid #d6e5ec;
  border-radius:14px;
  background:#f8fcfd;
}
.wrong-email-pane[hidden]{display:none!important}
.wrong-email-pane h3{margin:0 0 5px;color:var(--v37-navy)}
.wrong-email-pane p{margin:0 0 14px;color:var(--v37-muted);line-height:1.45}
.wrong-email-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.wrong-email-grid .span-2{grid-column:1/-1}
.recovery-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.recovery-actions button{min-height:44px}
.registration-recovery-box{
  display:grid;
  gap:8px;
  margin-top:10px;
  padding:12px 14px;
  border:1px solid #efd49f;
  border-radius:12px;
  background:#fffaf0;
  color:#664d13;
}
.registration-recovery-box a{font-weight:900;color:#0b607d}

/* 14, 25 — Portal de Gestão mobile: sidebar por cima, sem blur bloqueando. */
@media (max-width:1120px){
  body:has(.gestor-topbar){
    width:100%!important;
    min-width:0!important;
    overflow-x:hidden!important;
    background:var(--v37-bg)!important;
  }
  body:has(.gestor-topbar) > .container{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    margin:0!important;
    overflow:visible!important;
  }
  body:has(.gestor-topbar) .conteudo{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0 16px 34px!important;
    overflow-x:hidden!important;
  }
  body:has(.gestor-topbar) #gestorSidebar,
  body:has(.gestor-topbar) .sidebar{
    position:fixed!important;
    inset:0 auto 0 0!important;
    width:min(320px,88vw)!important;
    max-width:88vw!important;
    height:100dvh!important;
    min-height:100dvh!important;
    z-index:9100!important;
    transform:translateX(-105%)!important;
    transition:transform .22s ease!important;
    pointer-events:auto!important;
    filter:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
  body:has(.gestor-topbar) #gestorSidebar.open,
  body:has(.gestor-topbar) #gestorSidebar.aberta,
  body:has(.gestor-topbar) .sidebar.open,
  body:has(.gestor-topbar) .sidebar.aberta{
    transform:translateX(0)!important;
  }
  body:has(.gestor-topbar) .gestor-sidebar-overlay{
    position:fixed!important;
    inset:0!important;
    z-index:9000!important;
    display:none!important;
    background:rgba(3,29,48,.38)!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
    filter:none!important;
    cursor:pointer!important;
    pointer-events:none!important;
  }
  body:has(.gestor-topbar) .gestor-sidebar-overlay.show,
  body:has(.gestor-topbar) .gestor-sidebar-overlay.active,
  body:has(.gestor-topbar) .gestor-sidebar-overlay.ativo{
    display:block!important;
    pointer-events:auto!important;
  }
  body:has(.gestor-topbar) #gestorSidebar .nav-item,
  body:has(.gestor-topbar) .sidebar .nav-item{
    position:relative!important;
    z-index:1!important;
    pointer-events:auto!important;
    opacity:1!important;
    filter:none!important;
  }
  body:has(.gestor-topbar) .gestor-topbar{
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:10px!important;
    width:auto!important;
    min-width:0!important;
    min-height:70px!important;
    margin:0 -16px 18px!important;
    padding:10px 16px!important;
    background:rgba(244,248,251,.98)!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
  body:has(.gestor-topbar) .mobile-menu{
    display:grid!important;
    place-items:center!important;
    width:44px!important;
    height:44px!important;
    padding:0!important;
    border:1px solid #d9e6ec!important;
    background:#fff!important;
    color:var(--v37-navy)!important;
    cursor:pointer!important;
  }
  body:has(.gestor-topbar) .gestor-topbar>div:nth-child(2){min-width:0!important}
  body:has(.gestor-topbar) .gestor-topbar .eyebrow{display:none!important}
  body:has(.gestor-topbar) .gestor-topbar h1{
    margin:0!important;
    min-width:0!important;
    max-width:100%!important;
    font-size:20px!important;
    line-height:1.15!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  body:has(.gestor-topbar) .topbar-actions{min-width:0!important}
  body:has(.gestor-topbar) .topbar-actions span{display:none!important}

  /* Painéis não podem ficar estreitos nem lado a lado. */
  body:has(.gestor-topbar) .welcome-panel,
  body:has(.gestor-topbar) .workflow-panel,
  body:has(.gestor-topbar) .panel,
  body:has(.gestor-topbar) .card,
  body:has(.gestor-topbar) .surface-admin-form,
  body:has(.gestor-topbar) .table-card{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  body:has(.gestor-topbar) .dashboard-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  body:has(.gestor-topbar) .workflow-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  /* 27 — Próximas ações em cima; últimos cursos embaixo. */
  body:has(.gestor-topbar) .dashboard-columns{
    display:flex!important;
    flex-direction:column!important;
    gap:14px!important;
    width:100%!important;
  }
  body:has(.gestor-topbar) .dashboard-columns>.panel:nth-child(2){order:1!important}
  body:has(.gestor-topbar) .dashboard-columns>.panel:nth-child(1){order:2!important}
  body:has(.gestor-topbar) .dashboard-columns .section-heading{
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:12px!important;
  }
  body:has(.gestor-topbar) .dashboard-columns .section-heading>div{min-width:0!important}
  body:has(.gestor-topbar) .dashboard-columns .section-heading h3{
    margin:2px 0 0!important;
    white-space:normal!important;
    overflow-wrap:break-word!important;
  }
  body:has(.gestor-topbar) .dashboard-columns .section-heading button{
    flex:0 0 auto!important;
    width:auto!important;
    min-width:90px!important;
    min-height:42px!important;
  }
  body:has(.gestor-topbar) .simple-list button{
    width:100%!important;
    min-width:0!important;
    grid-template-columns:58px minmax(0,1fr) auto!important;
    gap:12px!important;
    padding:12px 0!important;
  }
  body:has(.gestor-topbar) .simple-list img{width:58px!important;height:48px!important}
  body:has(.gestor-topbar) .simple-list strong,
  body:has(.gestor-topbar) .simple-list small{
    min-width:0!important;
    white-space:normal!important;
    overflow-wrap:break-word!important;
    word-break:normal!important;
  }
  body:has(.gestor-topbar) .simple-list em{white-space:nowrap!important}

  /* 4, 15 — ações tocáveis; publicar sempre prioritário. */
  body:has(.gestor-topbar) .course-action-cell,
  body:has(.gestor-topbar) .cert-admin-actions,
  body:has(.gestor-topbar) .ticket-row-actions,
  body:has(.gestor-topbar) .student-actions{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  body:has(.gestor-topbar) .course-action-cell button,
  body:has(.gestor-topbar) .cert-admin-actions button,
  body:has(.gestor-topbar) .ticket-row-actions button,
  body:has(.gestor-topbar) .student-actions button{
    width:100%!important;
    min-width:0!important;
    min-height:46px!important;
    white-space:normal!important;
    overflow-wrap:break-word!important;
  }
  body:has(.gestor-topbar) .course-action-cell .gc-publish{
    grid-column:1/-1!important;
    grid-row:1!important;
    min-height:50px!important;
    font-weight:900!important;
  }
  body:has(.gestor-topbar) #btnBuilderPublishNormal,
  body:has(.gestor-topbar) #latexImportPublish,
  body:has(.gestor-topbar) .builder-publish-button{
    width:100%!important;
    min-height:52px!important;
    font-weight:900!important;
  }
}

@media (max-width:820px){
  /* 26 — topo público fica apenas logo + hambúrguer. */
  .alt-public-header__inner{
    grid-template-columns:minmax(110px,1fr) auto!important;
    gap:10px!important;
    min-height:72px!important;
  }
  .alt-public-header__actions{display:none!important}
  .alt-public-header__toggle{display:flex!important;grid-column:2!important;grid-row:1!important}
  .alt-public-header__mobile{grid-column:1/-1!important;grid-row:2!important;padding-bottom:12px!important}
  .alt-public-header__mobile nav{width:100%!important}
  .alt-public-header__mobile-actions{display:grid!important;grid-template-columns:1fr 1fr!important}

  .wrong-email-grid{grid-template-columns:1fr}
  .wrong-email-grid .span-2{grid-column:auto}
  .recovery-actions{grid-template-columns:1fr}
}

@media (max-width:720px){
  body:has(.gestor-topbar) .conteudo{padding:0 12px 28px!important}
  body:has(.gestor-topbar) .gestor-topbar{margin:0 -12px 16px!important;padding:9px 12px!important}
  body:has(.gestor-topbar) .dashboard-kpis{grid-template-columns:1fr!important}
  body:has(.gestor-topbar) .workflow-grid{grid-template-columns:1fr!important}
  body:has(.gestor-topbar) .welcome-panel{padding:20px 16px!important}
  body:has(.gestor-topbar) .welcome-actions{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  body:has(.gestor-topbar) .welcome-actions button{width:100%!important;min-height:48px!important}
  body:has(.gestor-topbar) .course-action-cell,
  body:has(.gestor-topbar) .cert-admin-actions,
  body:has(.gestor-topbar) .ticket-row-actions,
  body:has(.gestor-topbar) .student-actions{grid-template-columns:1fr!important}
  body:has(.gestor-topbar) .course-action-cell .gc-publish{grid-column:1!important}
  body:has(.gestor-topbar) .simple-list button{grid-template-columns:62px minmax(0,1fr)!important}
  body:has(.gestor-topbar) .simple-list em{grid-column:2!important;justify-self:start!important;margin-top:4px!important}
  body:has(.gestor-topbar) .dashboard-columns .section-heading{align-items:flex-start!important}
}

/* 13 — exclusão de aluno deve ser reconhecível, mas não dominar a tela. */
.student-actions .student-delete-action{
  border-color:#efc8cd!important;
  background:#fff7f8!important;
  color:var(--v37-danger)!important;
  font-weight:800!important;
}
.student-actions .student-delete-action:hover{background:#fdebed!important}

/* 28 — etapa própria de solicitação de certificado após aprovação. */
.student-menu .certificate-request-nav{
  position:relative;
  border-color:rgba(22,169,188,.28);
}
.student-menu .certificate-request-nav:not([hidden]){
  display:flex;
}
.student-menu .certificate-request-nav .menu-badge{
  margin-left:auto;
  min-width:24px;
  height:24px;
  padding:0 7px;
  display:inline-grid;
  place-items:center;
  border-radius:999px;
  background:#16a9bc;
  color:#fff;
  font-size:12px;
  font-weight:900;
}
.certificate-request-flow-banner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}
.certificate-request-flow-banner strong{white-space:nowrap}
.button-link{cursor:pointer;font:inherit}
.request-certificate-main-action{
  min-height:50px!important;
  font-weight:900!important;
}
.certificate-request-empty{
  display:grid!important;
  gap:8px!important;
  justify-items:start!important;
}
.certificate-request-empty strong{color:var(--v37-navy)}
.certificate-request-empty span{color:var(--v37-muted);line-height:1.5}

@media (max-width:820px){
  .certificate-request-flow-banner{
    align-items:flex-start;
    flex-direction:column;
    padding:16px!important;
  }
  .certificate-request-flow-banner strong{white-space:normal}
  #solicitar-certificado .certificate-heading,
  #certificados .certificate-heading{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:12px!important;
  }
  #solicitar-certificado .certificate-heading .secondary-link,
  #certificados .certificate-heading .secondary-link{
    width:100%!important;
    justify-content:center!important;
  }
  #solicitar-certificado .hours-request-control,
  #solicitar-certificado .certificate-actions{
    width:100%!important;
  }
  #solicitar-certificado .hours-request-control select,
  #solicitar-certificado .hours-request-control input,
  #solicitar-certificado .hours-request-control button{
    width:100%!important;
    min-height:48px!important;
  }
}
