/* ===================================================
 * COMPONENTES PARTILHADOS
 * Badges/pílulas, cabeçalho de página, barra de período, listagens,
 * modal de cadastro por passos e rodapé.
 * Usa os tokens --app-* / --brand-* de layout.css.
 * =================================================== */

/* ---------------------------------------------------
 * Tokens dos badges (claro, escuro e tema Colégio)
 * --------------------------------------------------- */
:root {
  --badge-blue-bg: #e3ecfd;
  --badge-blue-fg: #1d4ed8;
  --badge-teal-bg: #dcecf1;
  --badge-teal-fg: #0e7490;
  --badge-green-bg: #dcf3e5;
  --badge-green-fg: #15803d;
  --badge-amber-bg: #f6efd6;
  --badge-amber-fg: #854d0e;
  --badge-red-bg: #fde4e4;
  --badge-red-fg: #b91c1c;
}

:root[data-bs-theme="dark"] {
  --badge-blue-bg: #1a2a4a;
  --badge-blue-fg: #8db3ff;
  --badge-teal-bg: #12303a;
  --badge-teal-fg: #67c6dd;
  --badge-green-bg: #12301f;
  --badge-green-fg: #6fd59a;
  --badge-amber-bg: #33290f;
  --badge-amber-fg: #f1c75b;
  --badge-red-bg: #3a1717;
  --badge-red-fg: #f59a9a;
}

:root[data-accent="colegio"] {
  --badge-blue-bg: #efeaf6;
  --badge-blue-fg: #4e3372;
  --badge-teal-bg: #e3f3f4;
  --badge-teal-fg: #006c72;
  --badge-amber-bg: #fdf0e1;
  --badge-amber-fg: #a35200;
  --badge-red-bg: #fbe7e7;
  --badge-red-fg: #b01616;
}

:root[data-accent="colegio"][data-bs-theme="dark"] {
  --badge-blue-bg: #2c2240;
  --badge-blue-fg: #c6b2ea;
  --badge-teal-bg: #12302f;
  --badge-teal-fg: #6fd3d8;
  --badge-amber-bg: #35240f;
  --badge-amber-fg: #f8bb75;
  --badge-red-bg: #3a1717;
  --badge-red-fg: #f59a9a;
}

/* ---------------------------------------------------
 * Pílulas de estado
 * --------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.pill-blue { background-color: var(--badge-blue-bg); color: var(--badge-blue-fg); }
.pill-teal { background-color: var(--badge-teal-bg); color: var(--badge-teal-fg); }
.pill-green { background-color: var(--badge-green-bg); color: var(--badge-green-fg); }
.pill-amber { background-color: var(--badge-amber-bg); color: var(--badge-amber-fg); }
.pill-red { background-color: var(--badge-red-bg); color: var(--badge-red-fg); }
.pill-neutral { background-color: var(--app-active); color: var(--app-text-2); }

/* ---------------------------------------------------
 * Cabeçalho de página e eyebrow
 * --------------------------------------------------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-eyebrow {
  margin: 0 0 0.15rem;
  color: var(--app-subtle);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-greeting {
  margin: 0;
  color: var(--app-muted);
  font-size: 1.15rem;
  font-weight: 400;
}

.page-greeting strong {
  color: var(--app-text);
  font-weight: 600;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
}

.page-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 40px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: none;
  box-shadow: none;
}

.btn-soft {
  border: 1px solid var(--app-border);
  background-color: var(--app-primary-soft);
  color: var(--app-primary);
}

.btn-soft:hover {
  border-color: var(--app-primary);
  color: var(--app-primary);
}

.eyebrow {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--app-primary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow.muted {
  color: var(--app-muted);
}

.view-title {
  margin: 0;
  color: var(--app-text);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
}

.view-subtitle {
  margin: 0.15rem 0 0;
  color: var(--app-muted);
  font-size: 1rem;
}

.view-subtitle strong {
  color: var(--app-text);
  font-weight: 600;
}

.btn-outline-app {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background-color: var(--app-surface);
  color: var(--app-text);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: none;
  box-shadow: none;
}

.btn-outline-app:hover {
  border-color: var(--app-primary);
  color: var(--app-primary);
}

/* ---------------------------------------------------
 * Barra de período (filtro: anterior / actual / seguinte)
 * Sem cartão: assenta directamente no fundo da página.
 * --------------------------------------------------- */
.period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.period-bar-title {
  margin: 0;
  color: var(--app-text);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.period-bar-sub {
  margin: 0.3rem 0 0;
  color: var(--app-muted);
  font-size: 0.8rem;
}

.period-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

/* Grupo Anterior / Actual / Seguinte */
.period-nav {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background-color: var(--app-active);
}

.period-nav button {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 32px;
  padding: 0 0.8rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--app-text);
  font-size: 0.85rem;
  font-weight: 600;
}

.period-nav button:hover:not(:disabled) {
  background-color: var(--app-surface);
}

.period-nav button:disabled {
  color: var(--app-subtle);
  cursor: not-allowed;
}

.period-nav button.is-current {
  border-color: color-mix(in srgb, var(--badge-green-fg) 18%, transparent);
  background-color: var(--badge-green-bg);
  color: var(--badge-green-fg);
}

/* Campo do período (selector com aspecto de input) */
.period-field {
  width: 220px;
  height: 38px;
  padding: 0 0.85rem;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background-color: var(--app-surface);
  color: var(--app-text);
  font-size: 0.875rem;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.period-field:focus {
  border-color: var(--app-primary);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary) 22%, transparent);
}

/* Botão de acção da barra (branco, com sombra leve) */
.period-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 38px;
  padding: 0 0.9rem;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background-color: var(--app-surface);
  color: var(--app-text);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.period-action:hover {
  border-color: var(--app-primary);
  color: var(--app-primary);
}

/* ---------------------------------------------------
 * Listagens: tabs + tabela (marcação do template)
 * .nav-tabs-minimal / .badge-count / .card-datatable / .table-custom vêm do
 * custom.css com cores fixas; aqui só trocamos as cores pelos tokens do tema.
 * --------------------------------------------------- */
.list-section {
  margin-top: 1.5rem;
}

.list-section .nav-tabs-custom-container {
  margin-bottom: 1rem;
  border-bottom-color: var(--app-border);
}

.list-section .nav-tabs-minimal .nav-link {
  color: var(--app-muted);
  text-transform: none;
}

.list-section .nav-tabs-minimal .nav-link:hover,
.list-section .nav-tabs-minimal .nav-link.active {
  color: var(--app-primary) !important;
}

.list-section .nav-tabs-minimal .nav-link.active::after {
  background-color: var(--app-primary);
}

.list-section .nav-tabs-minimal .badge-count {
  background-color: var(--app-primary-soft);
  color: var(--app-primary);
}

.list-section .nav-tabs-minimal .nav-link:not(.active) .badge-count {
  background-color: var(--app-active);
  color: var(--app-muted);
}

.list-section .card-datatable {
  border: 0;
  border-radius: 8px;
  background-color: var(--app-surface);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

.list-section .dataTables_length,
.list-section .dataTables_info {
  color: var(--app-text-2);
}

/* !important: o custom.css força os .form-control a preto no modo escuro */
.list-section .dataTables_wrapper .dataTables_length select,
.list-section .dataTables_wrapper .dataTables_filter input {
  border-color: var(--app-border) !important;
  background-color: var(--app-surface) !important;
  color: var(--app-text) !important;
}

.list-section .dataTables_length select:focus,
.list-section .dataTables_filter input:focus {
  border-color: var(--app-primary);
  outline: 0;
  box-shadow: none;
}

.list-section table.dataTable {
  margin-top: 0 !important;
  color: var(--app-text-2);
}

/* !important: o core.css pinta o cabeçalho com um seletor mais específico */
.list-section table.dataTable thead th {
  border-bottom-color: var(--app-border) !important;
  background-color: var(--app-active) !important;
  color: var(--app-muted);
}

.list-section table.dataTable tbody td {
  border-bottom-color: var(--app-border) !important;
  background-color: transparent;
}

.list-section .year-link,
.list-section .year-code {
  color: var(--app-primary) !important;
}

/* Etiqueta cinzenta (ex.: regime) e estado neutro */
.list-section .badge-category,
.list-section .badge-neutral {
  border-radius: 4px;
  background-color: var(--app-active) !important;
  color: var(--app-text) !important;
}

.list-section .badge-pill-custom {
  border-radius: 4px;
}

/* Botões de acção e contagens sempre numa só linha */
.list-section table.dataTable td.text-end,
.list-section table.dataTable td.nowrap {
  white-space: nowrap;
}

/* Valor com barra de percentagem numa célula (ex.: alunos de cada curso) */
.list-section .cell-share {
  display: grid;
  grid-template-columns: 2.2rem minmax(48px, 1fr) 2.4rem;
  align-items: center;
  gap: 0.4rem;
  min-width: 130px;
}

.list-section .cell-share-value {
  color: var(--app-text);
  font-variant-numeric: tabular-nums;
}

.list-section .cell-share-pct {
  color: var(--app-muted);
  font-size: 0.78rem;
  text-align: right;
}

.list-section .cell-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background-color: var(--app-active);
  color: var(--app-primary);
  appearance: none;
}

.list-section .cell-progress::-webkit-progress-bar {
  border-radius: 999px;
  background-color: var(--app-active);
}

.list-section .cell-progress::-webkit-progress-value {
  border-radius: 999px;
  background-color: var(--app-primary);
}

.list-section .cell-progress::-moz-progress-bar {
  border-radius: 999px;
  background-color: var(--app-primary);
}

/* Segunda linha de uma célula (ex.: abreviaturas das disciplinas) */
.list-section .cell-sub {
  display: block;
  margin-top: 0.15rem;
  color: var(--app-muted);
  font-size: 0.75rem;
}

/* Complemento em linha numa célula (ex.: "28 / 35 (80%)") */
.list-section .cell-sub-inline {
  color: var(--app-muted);
  font-size: 0.78rem;
}

.list-section .year-link:hover {
  text-decoration: underline;
}

/* Botões de acção da linha: brancos com sombra leve */
.list-section .row-btn {
  width: 34px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background-color: var(--app-surface);
  color: var(--app-text-2);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.list-section .row-btn:hover {
  color: var(--app-primary);
}

.list-section .row-btn.btn-action-delete:hover {
  color: var(--app-danger);
}

/* Paginação: página actual na cor principal */
.list-section .dataTables_wrapper .pagination .page-link {
  color: var(--app-muted) !important;
}

.list-section .dataTables_wrapper .pagination .page-item.active .page-link {
  background-color: var(--app-primary) !important;
  color: var(--app-on-primary) !important;
}

.list-section .dataTables_wrapper .pagination .page-item.disabled .page-link {
  color: var(--app-subtle) !important;
  opacity: 0.6;
}

.list-section .dataTables_wrapper .pagination .page-item.previous .page-link,
.list-section .dataTables_wrapper .pagination .page-item.next .page-link {
  width: auto;
  padding: 0 0.4rem;
}

/* ---------------------------------------------------
 * Modal de cadastro por passos (padrão do template)
 * Cabeçalho · barra de passos · cartões · revisão (sempre o último passo).
 * Campos e botões são os do Bootstrap/template (.form-control, .btn-*).
 * --------------------------------------------------- */
.wiz-modal .modal-content {
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background-color: var(--app-surface);
  color: var(--app-text-2);
}

.wiz-modal .modal-header {
  align-items: flex-start;
  padding: 1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--app-border);
}

.wiz-modal .modal-title {
  margin: 0;
  color: var(--app-text);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.wiz-modal .modal-subtitle {
  margin: 0.15rem 0 0;
  color: var(--app-muted);
  font-size: 0.8rem;
}

/* Barra de passos: número + texto lado a lado, linha entre passos */
.wiz-steps {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0.85rem 1.25rem;
  list-style: none;
  border-bottom: 1px solid var(--app-border);
}

.wiz-step {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.6rem;
}

.wiz-step-num {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--app-active);
  color: var(--app-muted);
  font-size: 0.8rem;
  font-weight: 700;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.wiz-step-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.wiz-step-text strong {
  color: var(--app-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.wiz-step-text span {
  color: var(--app-muted);
  font-size: 0.72rem;
}

.wiz-step-line {
  flex: 1 1 auto;
  min-width: 1.5rem;
  height: 2px;
  border-radius: 2px;
  background-color: var(--app-border);
}

.wiz-step.is-active .wiz-step-num {
  background-color: var(--app-primary);
  color: var(--app-on-primary);
}

.wiz-step.is-active .wiz-step-text strong { color: var(--app-text); }
.wiz-step.is-active .wiz-step-text span { color: var(--app-primary); }

.wiz-step.is-done .wiz-step-num {
  background-color: var(--app-success);
  color: #fff;
}

.wiz-step.is-done .wiz-step-text strong { color: var(--app-text); }
.wiz-step.is-done .wiz-step-text span { color: var(--app-success); }

/* Corpo */
.wiz-modal .modal-body {
  position: relative;
  max-height: min(62vh, 600px);
  padding: 1.1rem 1.25rem;
}

.wiz-modal .modal-body:not(.ps) {
  overflow-y: auto;
}

.wiz-modal .modal-body > .ps__rail-y {
  width: 8px;
  background-color: transparent !important;
}

.wiz-modal .modal-body > .ps__rail-y > .ps__thumb-y {
  right: 2px;
  width: 4px;
  border-radius: 10px;
  background-color: var(--app-scroll);
}

.wiz-pane[hidden] {
  display: none;
}

.wiz-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.wiz-section-head h3 {
  margin: 0;
  color: var(--app-text);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
}

.wiz-section-head p {
  margin: 0.15rem 0 0;
  color: var(--app-muted);
  font-size: 0.78rem;
}

/* Cartão (ex.: "Trimestre #1") */
.wiz-card {
  padding: 0.85rem 0.9rem 1rem;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background-color: var(--app-surface);
}

.wiz-card + .wiz-card {
  margin-top: 0.85rem;
}

.wiz-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--app-border);
}

.wiz-tag {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  background-color: var(--app-active);
  color: var(--app-primary);
  font-size: 0.78rem;
  font-weight: 500;
}

.wiz-card-head .btn-remove-item {
  padding: 0.2rem 0.4rem;
  border: 0;
  background: none;
  color: var(--app-danger);
  font-size: 1.05rem;
  line-height: 1;
}

.wiz-card .form-label {
  margin-bottom: 0.35rem;
  color: var(--app-text-2);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.wiz-card .form-label .req {
  color: var(--app-danger);
}

.wiz-card .form-control,
.wiz-card .form-select {
  border-color: var(--app-border);
  border-radius: 6px;
  font-size: 0.875rem;
}

/* Espaço só entre campos empilhados (não nas grelhas .row) */
.wiz-card > .field + .field,
.wiz-card > .field + .row,
.wiz-card > .row + .field {
  margin-top: 0.85rem;
}


.wiz-card .form-text {
  margin-top: 0.3rem;
  color: var(--app-muted);
  font-size: 0.72rem;
}

/* Lista de escolha com quantidade (ex.: disciplinas do plano + tempos) */
.pick-group {
  margin: 0.25rem 0 0.4rem;
  color: var(--app-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pick-group:not(:first-child) {
  margin-top: 1rem;
}

.pick-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--app-border);
  border-radius: 8px;
}

.pick-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 96px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
}

.pick-row + .pick-row {
  border-top: 1px solid var(--app-border);
}

.pick-row .form-check-input {
  margin: 0;
}

.pick-name {
  color: var(--app-text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.pick-meta {
  display: block;
  color: var(--app-muted);
  font-size: 0.72rem;
  font-weight: 400;
}

.pick-row .form-control {
  height: 34px;
  padding: 0 0.5rem;
  font-size: 0.85rem;
}

.pick-row .form-control:disabled {
  opacity: 0.45;
}

.pick-row.is-off .pick-name {
  color: var(--app-muted);
}

.pick-total {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  color: var(--app-text-2);
  font-size: 0.82rem;
}

.pick-total strong {
  color: var(--app-text);
}

.pick-total.is-invalid {
  color: var(--app-danger);
}

/* Revisão */
.wiz-review {
  padding: 0.9rem;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background-color: var(--app-hover);
}

.wiz-review h3 {
  margin: 0 0 0.85rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--app-border);
  color: var(--app-text);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
}

.wiz-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background-color: var(--app-surface);
}

.wiz-total small {
  display: block;
  color: var(--app-muted);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wiz-total .wiz-total-sub {
  display: block;
  color: var(--app-muted);
  font-size: 0.75rem;
}

.wiz-total strong {
  color: var(--app-text);
  font-size: 0.9rem;
}

.wiz-total .wiz-tag {
  border-radius: 4px;
}

.wiz-alert {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  background-color: var(--badge-amber-bg);
  color: var(--badge-amber-fg);
  font-size: 0.8rem;
}

.wiz-review-table {
  overflow-x: auto;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background-color: var(--app-surface);
}

.wiz-review-table table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.wiz-review-table th {
  padding: 0.75rem;
  background-color: var(--app-active);
  color: var(--app-text-2);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}

.wiz-review-table td {
  padding: 0.75rem;
  border-top: 1px solid var(--app-border);
  color: var(--app-text-2);
  vertical-align: top;
}

.wiz-review-table td strong {
  color: var(--app-text);
}

.wiz-review-table .val {
  color: var(--app-primary);
}

.wiz-review-table .sub {
  display: block;
  color: var(--app-muted);
  font-size: 0.72rem;
}

/* Rodapé */
.wiz-modal .modal-footer {
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--app-border);
}

.wiz-modal .modal-footer .btn {
  min-width: 100px;
  height: 40px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
}

.wiz-modal .modal-footer > * {
  margin: 0;
}

@media (max-width: 767.98px) {
  .wiz-step-text {
    display: none;
  }

  .wiz-step.is-active .wiz-step-text {
    display: flex;
  }
}

/* ---------------------------------------------------
 * Rodapé
 * --------------------------------------------------- */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  color: var(--app-muted);
  font-size: 0.8rem;
}

/* ---------------------------------------------------
 * Responsivo
 * --------------------------------------------------- */
@media (max-width: 767.98px) {
  .period-controls {
    width: 100%;
  }
}

/* ---------------------------------------------------
 * Impressão: só o conteúdo
 * --------------------------------------------------- */
@media print {
  html,
  body {
    height: auto;
    overflow: visible;
  }

  .sidebar-slim,
  .sidebar-flyout,
  .layout-navbar,
  .layout-overlay,
  .skip-link,
  .no-print,
  .ps__rail-y,
  .ps__rail-x {
    display: none !important;
  }

  .layout-page {
    height: auto;
    margin-left: 0 !important;
    overflow: visible !important;
  }
}

/* ---------------------------------------------------
 * Mensagens e progresso geral (assets/js/alerts.js)
 * Bootstrap .alert e .progress do template, com as cores do tema activo
 * (tokens --app-* / --badge-*: claro, escuro e tema Colégio).
 * --------------------------------------------------- */

/* Progresso geral: barra fina no topo (posição em custom.css → .global-progress) */
.global-progress {
  z-index: 2100;
  pointer-events: none;
}

.global-progress .progress {
  height: 3px;
  background-color: var(--app-primary-soft);
}

.global-progress .progress-bar {
  width: 0;
  background-color: var(--app-primary);
  box-shadow: 0 0 8px color-mix(in srgb, var(--app-primary) 55%, transparent);
}

/* Mensagens no topo do conteúdo e dentro dos modais */
#alertContainer:empty,
[data-alert-container]:empty {
  display: none;
}

#alertContainer {
  margin-bottom: 1.25rem;
}

[data-alert-container] {
  margin-bottom: 1rem;
}

#alertContainer .alert,
[data-alert-container] .alert {
  margin: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.875rem;
}

#alertContainer .alert i,
[data-alert-container] .alert i {
  font-size: 1.1rem;
}

.alert-success { --alert-bg: var(--badge-green-bg); --alert-fg: var(--badge-green-fg); }
.alert-danger { --alert-bg: var(--badge-red-bg); --alert-fg: var(--badge-red-fg); }
.alert-warning { --alert-bg: var(--badge-amber-bg); --alert-fg: var(--badge-amber-fg); }
.alert-info { --alert-bg: var(--badge-blue-bg); --alert-fg: var(--badge-blue-fg); }

#alertContainer .alert,
[data-alert-container] .alert {
  border-color: color-mix(in srgb, var(--alert-fg) 25%, transparent);
  background-color: var(--alert-bg);
  color: var(--alert-fg);
}

@media (prefers-reduced-motion: reduce) {
  .global-progress .progress-bar {
    animation: none;
    transition: none;
  }
}

@media print {
  .global-progress,
  #alertContainer {
    display: none !important;
  }
}

/* ---------------------------------------------------
 * Menus do navbar: unidade (Colégio / Centro Infantil) e utilizador
 * --------------------------------------------------- */
.nav-menu {
  min-width: 14rem;
  padding: 0.35rem;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background-color: var(--app-surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.nav-menu-head {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem 0.65rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--app-border);
}

.nav-menu-head strong {
  font-size: 0.875rem;
  color: var(--app-text);
}

.nav-menu-head span {
  font-size: 0.75rem;
  color: var(--app-muted);
  overflow-wrap: anywhere;
}

.nav-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 8px;
  color: var(--app-text-2);
  font-size: 0.85rem;
}

.nav-menu .dropdown-item:hover,
.nav-menu .dropdown-item:focus {
  background-color: var(--app-active);
  color: var(--app-text);
}

/* Unidade: a escolhida fica na cor principal, com visto à direita */
.nav-unit-menu {
  min-width: 15rem;
}

.nav-unit-check {
  margin-left: auto;
  visibility: hidden;
}

.nav-unit-menu .dropdown-item.active,
.nav-unit-menu .dropdown-item.active:hover {
  background-color: var(--app-primary-soft);
  color: var(--app-primary);
  font-weight: 600;
}

.nav-unit-menu .dropdown-item.active .nav-unit-check {
  visibility: visible;
}
