/* Padrão único de navegação dos módulos Delfos One.
   Gestão de Documentos é a exceção deliberada: usa o fluxo de três colunas. */
.module-identity-band {
  margin: -24px -24px 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--green) 14%, var(--bg)) 0%, color-mix(in srgb, var(--green) 6%, var(--bg)) 48%, var(--bg) 100%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.module-identity-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 20px;
  color: var(--green);
  font-size: 11px;
  font-weight: var(--font-bold);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.module-identity-label i { color: var(--green); }
.module-identity-rule { height: 3px; background: linear-gradient(90deg, var(--green), color-mix(in srgb, var(--green) 74%, transparent) 72%, transparent 100%); }

.module-shell,
.fo-shell, .ac-shell, .rh-shell, .tr-shell {
  display: flex;
  min-height: calc(100vh - 150px);
  background: var(--bg2, var(--bg));
}

.main-desktop.schedule-module-layout { flex-direction: row; }
.schedule-module-side { height: auto; min-height: calc(100vh - 86px); }
.schedule-module-view {
  flex: 1;
  min-width: 0;
  padding: var(--space-4) !important;
  overflow-y: auto;
}
.schedule-module-view .module-identity-band { margin: -16px -16px 12px; }
.schedule-module-identity {
  margin: 0;
  flex: 0 0 auto;
}

.module-side,
.fo-side, .ac-side, .rh-side, .tr-side {
  width: 238px;
  flex: 0 0 238px;
  padding: 12px 0;
  overflow-y: auto;
  background: var(--nav-bg);
  border-right: 1px solid var(--line);
}

.module-side-group,
.fo-side-glabel, .ac-side-glabel, .rh-side-glabel, .tr-side-glabel {
  display: block;
  padding: 14px 20px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.module-side-item,
.fo-side-item, .ac-side-item, .rh-side-item, .tr-side-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 10px 20px;
  color: var(--muted);
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color .16s ease, background .16s ease;
}

.module-side-item i,
.fo-side-item i, .ac-side-item i, .rh-side-item i, .tr-side-item i {
  width: 16px;
  color: var(--blue);
  text-align: center;
}

.module-side-item:hover,
.fo-side-item:hover, .ac-side-item:hover, .rh-side-item:hover, .tr-side-item:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.module-side-item.active,
.fo-side-item.active, .ac-side-item.active, .rh-side-item.active, .tr-side-item.active {
  color: var(--text);
  background: var(--menu-active);
  border-left-color: var(--green);
  font-weight: var(--font-semibold);
}

.module-side-item.active i,
.fo-side-item.active i, .ac-side-item.active i, .rh-side-item.active i, .tr-side-item.active i { color: var(--green); }

/* Itens de navegação usam escrita normal. Maiúsculas ficam reservadas às
   pequenas categorias que organizam o menu. */
.module-side-item,
.fo-side-item, .ac-side-item, .rh-side-item, .tr-side-item,
.generic-module-tabs .tab-item,
.oc-subnav .oc-subnav-item,
#audSubnav .aud-subnav-btn,
.nav-item { text-transform: none; letter-spacing: normal; }

/* No tema claro o texto do item selecionado não pode herdar o branco/dark
   usado no tema escuro. A combinação mantém contraste alto em todos os
   tipos de menu lateral (módulos novos e menus legados migrados). */
[data-theme="light"] .module-side-item.active,
[data-theme="light"] .fo-side-item.active, [data-theme="light"] .ac-side-item.active,
[data-theme="light"] .rh-side-item.active, [data-theme="light"] .tr-side-item.active,
[data-theme="light"] .generic-module-tabs .tab-item.active,
[data-theme="light"] .oc-subnav .oc-subnav-item.active,
[data-theme="light"] #audSubnav .aud-subnav-btn.on,
[data-theme="light"] .nav-item.active {
  color: #0b332d !important;
  background: var(--menu-active) !important;
}
[data-theme="light"] .module-side-item.active i,
[data-theme="light"] .fo-side-item.active i, [data-theme="light"] .ac-side-item.active i,
[data-theme="light"] .rh-side-item.active i, [data-theme="light"] .tr-side-item.active i,
[data-theme="light"] .generic-module-tabs .tab-item.active i,
[data-theme="light"] .oc-subnav .oc-subnav-item.active i,
[data-theme="light"] #audSubnav .aud-subnav-btn.on i { color: var(--green) !important; }

.module-main,
.fo-main, .ac-main, .rh-main, .tr-main {
  flex: 1;
  min-width: 0;
  min-height: 440px;
  /* Guia de estilos: --space-4 é o respiro padrão entre navegação e cards. */
  padding: var(--space-4);
  overflow: auto;
}

/* Barras de identidade seguem o mesmo token primário; cores de status continuam semânticas. */
.fo-modtag, .ac-modtag, .tr-modtag, .ca-modtag, .oc-mod-tag,
.st-modtag, .tu-modtag, .pa-modtag, .kb-modtag, .rk-modtag, .ind-modtag,
.aud-modtag, .reu-modtag {
  color: var(--green) !important;
  background: linear-gradient(90deg, color-mix(in srgb, var(--green) 14%, var(--bg)) 0%, color-mix(in srgb, var(--green) 6%, var(--bg)) 52%, var(--bg) 100%) !important;
  border-bottom-color: var(--line) !important;
}
.fo-modtag i, .ac-modtag i, .tr-modtag i, .ca-modtag i, .oc-mod-tag i,
.st-modtag i, .tu-modtag i, .pa-modtag i, .kb-modtag i, .rk-modtag i, .ind-modtag i,
.aud-modtag i, .reu-modtag i {
  color: var(--green) !important;
}
.fo-modrule, .ac-modrule, .tr-modrule, .ca-modrule, .oc-mod-rule,
.st-modrule, .tu-modrule, .pa-modrule, .kb-modrule, .rk-modrule, .ind-modrule,
.aud-modrule, .reu-modrule {
  background: linear-gradient(90deg, var(--green), transparent 70%) !important;
}

/* Navegação Modelo B: texto primeiro; ícone fica reservado à faixa do módulo. */
.module-side-item i,
.fo-side-item i, .ac-side-item i, .rh-side-item i, .tr-side-item i,
.schedule-module-side .module-side-item i,
.oc-subnav .oc-subnav-item i,
#audSubnav .aud-subnav-btn i,
#gpRoot > .schedule-tabs .tab-item i,
#glRoot > .schedule-tabs .tab-item i,
#osRoot > .schedule-tabs .tab-item i,
#tfRoot > .schedule-tabs .tab-item i,
#fmRoot > .schedule-tabs .tab-item i {
  display: none;
}
.module-side-item,
.fo-side-item, .ac-side-item, .rh-side-item, .tr-side-item,
.schedule-module-side .module-side-item { gap: 0; }

.module-main .card,
.fo-main .card, .ac-main .card, .rh-main .card, .tr-main .card {
  border-color: var(--line);
  box-shadow: none;
}

/* Compatibilidade: transforma navegações superiores legadas em laterais no desktop. */
@media (min-width: 769px) {
  .generic-module-tabs,
  .oc-subnav,
  #gpRoot > .schedule-tabs,
  #glRoot > .schedule-tabs,
  #osRoot > .schedule-tabs,
  #tfRoot > .schedule-tabs,
  #fmRoot > .schedule-tabs {
    float: left;
    display: flex;
    flex-direction: column;
    width: 238px;
    min-height: calc(100vh - 150px);
    padding: 12px 0;
    background: var(--nav-bg);
    border-right: 1px solid var(--line);
  }

  .generic-module-tabs .tab-item,
  .oc-subnav .oc-subnav-item,
  #gpRoot > .schedule-tabs .tab-item,
  #glRoot > .schedule-tabs .tab-item,
  #osRoot > .schedule-tabs .tab-item,
  #tfRoot > .schedule-tabs .tab-item,
  #fmRoot > .schedule-tabs .tab-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 42px;
    padding: 10px 20px;
    color: var(--muted);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    letter-spacing: normal;
    text-transform: none;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
    box-shadow: none;
    text-align: left;
  }

  .generic-module-tabs .tab-item:hover,
  .oc-subnav .oc-subnav-item:hover,
  #gpRoot > .schedule-tabs .tab-item:hover,
  #glRoot > .schedule-tabs .tab-item:hover,
  #osRoot > .schedule-tabs .tab-item:hover,
  #tfRoot > .schedule-tabs .tab-item:hover,
  #fmRoot > .schedule-tabs .tab-item:hover { color: var(--text); background: var(--surface-alt); }

  #gpRoot > .schedule-tabs .tab-item i,
  #glRoot > .schedule-tabs .tab-item i,
  #osRoot > .schedule-tabs .tab-item i,
  #tfRoot > .schedule-tabs .tab-item i,
  #fmRoot > .schedule-tabs .tab-item i { width: 16px; color: var(--blue); text-align: center; }

  .generic-module-tabs .tab-item.active,
  .oc-subnav .oc-subnav-item.active,
  #gpRoot > .schedule-tabs .tab-item.active,
  #glRoot > .schedule-tabs .tab-item.active,
  #osRoot > .schedule-tabs .tab-item.active,
  #tfRoot > .schedule-tabs .tab-item.active,
  #fmRoot > .schedule-tabs .tab-item.active {
    color: var(--text);
    background: var(--menu-active);
    border-left-color: var(--green);
    font-weight: var(--font-semibold);
  }

  #gpRoot > .schedule-tabs .tab-item.active i,
  #glRoot > .schedule-tabs .tab-item.active i,
  #osRoot > .schedule-tabs .tab-item.active i,
  #tfRoot > .schedule-tabs .tab-item.active i,
  #fmRoot > .schedule-tabs .tab-item.active i { color: var(--green); }

  /* Auditorias mantém seus IDs e handlers, mas usa a mesma navegação lateral. */
  #audSubnav {
    float: left;
    width: 238px;
    min-height: calc(100vh - 150px);
    background: var(--nav-bg);
    border-right: 1px solid var(--line);
  }
  #audSubnav .aud-subnav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 0;
  }
  #audSubnav .aud-subnav-btn {
    width: 100%;
    min-height: 42px;
    padding: 10px 20px;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    text-align: left;
  }
  #audSubnav .aud-subnav-btn:hover { color: var(--text); background: var(--surface-alt); }
  #audSubnav .aud-subnav-btn.on { color: var(--text); background: var(--menu-active); border-left-color: var(--green); }
  #audSubnav .aud-subnav-btn i { display: none !important; }
  #audArea {
    min-height: calc(100vh - 150px);
    margin-left: 238px;
    padding: var(--space-4);
    background: var(--bg2, var(--bg));
  }

  .generic-module-body,
  #ocArea,
  #gpRoot > .schedule-tabs ~ *,
  #glRoot > .schedule-tabs ~ *,
  #osRoot > .schedule-tabs ~ *,
  #tfRoot > .schedule-tabs ~ *,
  #fmRoot > .schedule-tabs ~ * {
    min-height: calc(100vh - 150px);
    margin-left: 238px;
    padding: var(--space-4) !important;
    background: var(--bg2, var(--bg));
    text-align: initial !important;
  }
}

@media (max-width: 768px) {
  .module-identity-band { margin: -16px -16px 12px; }
  .module-identity-label { min-height: 36px; padding: 0 16px; }
  .module-shell,
  .fo-shell, .ac-shell, .rh-shell, .tr-shell { display: block; min-height: auto; }
  .module-side,
  .fo-side, .ac-side, .rh-side, .tr-side { width: auto; height: auto; border-right: 0; }
  .module-main,
  .fo-main, .ac-main, .rh-main, .tr-main { min-height: auto; height: auto; padding: 16px; }
}
