/*!
 * Refurbish — camada de identidade visual
 * Assenta sobre Portal v3.1 / Bootstrap v5.3.3 (portal.css).
 *
 * IMPORTANTE: carregar SEMPRE depois de portal.css. Não existem cascade
 * layers neste projeto; a precedência é dada exclusivamente pela ordem
 * dos <link>. Nenhuma regra usa !important salvo nos utilitários de
 * impressão e no bloco de transição, onde é intencional.
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

:root {
    --rf-primary: #15a362;
    --rf-primary-dark: #128c54;
    --rf-primary-light: #18ba70;
    --rf-primary-soft: #edfdf6;

    --rf-ink: #252930;
    --rf-body: #5d6778;
    --rf-muted: #828d9f;
    --rf-faint: #9fa7b5;

    --rf-line: #e7e9ed;
    --rf-line-strong: #bcc1cb;
    --rf-surface: #ffffff;
    --rf-surface-alt: #fafbff;
    --rf-canvas: #f5f6fe;

    --rf-success: #5cb377;
    --rf-success-soft: #eaf6ee;
    --rf-danger: #d26d69;
    --rf-danger-soft: #fbeceb;
    --rf-warning: #eebf41;
    --rf-warning-soft: #fdf6e3;
    --rf-info: #5b99ea;
    --rf-info-soft: #ecf3fd;
    --rf-neutral-soft: #eef0f5;

    --rf-radius: 0.25rem;
    --rf-radius-lg: 0.5rem;
    --rf-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06);
    --rf-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);

    --rf-sidebar-width: 250px;
    --rf-header-height: 56px;
}

/* ==========================================================================
   2. Base e acessibilidade
   ========================================================================== */

html.no-js .js-only {
    display: none !important;
}

.js-only[hidden] {
    display: none !important;
}

.sr-only,
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: absolute;
    top: -3rem;
    left: 1rem;
    z-index: 2000;
    padding: 0.625rem 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--rf-ink);
    border-radius: 0 0 var(--rf-radius) var(--rf-radius);
    transition: top 0.15s ease-in-out;
}

.skip-link:focus {
    top: 0;
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--rf-primary);
    outline-offset: 2px;
}

.app-content:focus,
.auth-main:focus {
    outline: none;
}

/* ==========================================================================
   3. Estrutura (shell)
   ========================================================================== */

body.app {
    background: var(--rf-canvas);
    color: var(--rf-body);
}

/* Variante sem sessão iniciada: sem barra lateral, sem recuo de 250px. */
.app-plain .app-header-inner,
.app-plain .app-wrapper {
    margin-left: 0;
}

.app-sidepanel .sidepanel-drop {
    display: none;
}

.app-branding .brand-mark {
    width: 34px;
    height: 34px;
    color: var(--rf-primary);
}

.app-branding .brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
}

.app-branding .brand-text {
    font-size: 1.1875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--rf-ink);
    text-transform: uppercase;
}

.app-sidepanel-footer {
    padding: 1rem;
}

.sidepanel-role {
    margin-bottom: 0.125rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--rf-primary);
    text-transform: uppercase;
}

.sidepanel-user {
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    color: var(--rf-body);
    word-break: break-word;
}

.sidepanel-logout {
    width: 100%;
    font-size: 0.8125rem;
}

.app-footer {
    color: var(--rf-muted);
    font-size: 0.8125rem;
}

/* ==========================================================================
   4. Navegação lateral
   ========================================================================== */

.app-nav .nav-icon .icon,
.app-nav .nav-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.app-nav .nav-link-text {
    font-size: 0.875rem;
    font-weight: 500;
}

.app-nav .submenu-arrow .icon {
    width: 14px;
    height: 14px;
}

.app-nav .submenu-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-nav .submenu-link .submenu-icon {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    opacity: 0.75;
}

.app-nav .submenu-link.active .submenu-icon {
    opacity: 1;
}

.nav-empty {
    padding: 1rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--rf-muted);
}

/* ==========================================================================
   5. Cabeçalho
   ========================================================================== */

.app-breadcrumbs .breadcrumb {
    --bs-breadcrumb-divider-color: var(--rf-faint);
    --bs-breadcrumb-item-padding-x: 0.5rem;
    font-size: 0.8125rem;
    margin-bottom: 0;
}

.app-breadcrumbs .breadcrumb-item a {
    color: var(--rf-body);
    text-decoration: none;
}

.app-breadcrumbs .breadcrumb-item a:hover {
    color: var(--rf-primary);
    text-decoration: underline;
}

.app-breadcrumbs .breadcrumb-item.active {
    color: var(--rf-ink);
    font-weight: 600;
}

.app-utility-item .icon {
    width: 22px;
    height: 22px;
}

.app-user-dropdown .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--rf-primary);
    border-radius: 50%;
}

.app-user-dropdown .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--rf-body);
    text-decoration: none;
}

.app-user-dropdown .dropdown-toggle .menu-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--rf-ink);
}

.app-user-dropdown .dropdown-menu {
    min-width: 15rem;
    font-size: 0.875rem;
}

.dropdown-header-user {
    padding: 0.75rem 1rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--rf-ink);
    border-bottom: 1px solid var(--rf-line);
}

.dropdown-header-user span {
    color: var(--rf-muted);
    word-break: break-all;
}

.dropdown-item .icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    vertical-align: -0.15rem;
}

.dropdown-item-danger,
.dropdown-item-danger:hover,
.dropdown-item-danger:focus {
    color: #b23c38;
}

.dropdown-form .dropdown-item {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
}

.notifications {
    position: relative;
}

.notifications[data-count]::after {
    position: absolute;
    top: -0.3rem;
    right: -0.45rem;
    display: inline-block;
    min-width: 20px;
    height: 20px;
    padding-top: 1px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    content: attr(data-count);
    background: var(--rf-danger);
    border: 2px solid #fff;
    border-radius: 50%;
}

/* ==========================================================================
   6. Cartões e cabeçalhos de página
   ========================================================================== */

.app-page-title,
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--rf-ink);
    margin-bottom: 0.375rem;
}

.page-description {
    max-width: 70ch;
    margin-bottom: 0;
    font-size: 0.9375rem;
    color: var(--rf-muted);
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header-text {
    min-width: 0;
}

.app-card {
    border: 1px solid var(--rf-line);
    box-shadow: var(--rf-shadow-sm);
}

.app-card .app-card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--rf-ink);
}

.app-card .card-description {
    margin-bottom: 0;
    font-size: 0.875rem;
    color: var(--rf-muted);
}

/* Compatibilidade com os templates que usam .card como superfície. */
.app-content .card,
.auth-card .card {
    position: relative;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    background: var(--rf-surface);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
    box-shadow: var(--rf-shadow-sm);
}

.app-content .card > .card-header,
.auth-card .card > .card-header {
    padding: 0;
    margin-bottom: 1rem;
    background: none;
    border: 0;
}

.app-content .card > .card-body,
.auth-card .card > .card-body {
    padding: 0;
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--rf-ink);
    margin-bottom: 0.25rem;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.form-page {
    max-width: 44rem;
    margin-inline: auto;
}

.error-card {
    max-width: 40rem;
    margin-inline: auto;
    text-align: center;
}

/* ==========================================================================
   7. Botões
   ========================================================================== */

.btn {
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.btn .icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.375rem;
    vertical-align: -0.15rem;
}

.btn-primary,
.app-btn-primary {
    color: #fff;
    background: var(--rf-primary);
    border-color: var(--rf-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.app-btn-primary:hover,
.app-btn-primary:focus,
.app-btn-primary:active {
    color: #fff;
    background: var(--rf-primary-light);
    border-color: var(--rf-primary-light);
}

.btn-neutral {
    color: #fff;
    background: var(--rf-ink);
    border-color: var(--rf-ink);
}

.btn-neutral:hover,
.btn-neutral:focus {
    color: #fff;
    background: #3a4049;
    border-color: #3a4049;
}

.btn-ghost {
    color: var(--rf-body);
    background: var(--rf-surface);
    border-color: var(--rf-line-strong);
}

.btn-ghost:hover,
.btn-ghost:focus {
    color: var(--rf-primary);
    background: var(--rf-surface);
    border-color: var(--rf-primary);
}

.btn-danger {
    color: #fff;
    background: #b23c38;
    border-color: #b23c38;
}

.btn-danger:hover,
.btn-danger:focus {
    color: #fff;
    background: #c04a46;
    border-color: #c04a46;
}

.btn-success {
    color: #fff;
    background: #2f8a52;
    border-color: #2f8a52;
}

.btn-success:hover,
.btn-success:focus {
    color: #fff;
    background: #37a05f;
    border-color: #37a05f;
}

.btn-warning {
    color: var(--rf-ink);
    background: var(--rf-warning);
    border-color: var(--rf-warning);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    color: var(--rf-body);
    background: none;
    border: 0;
    border-radius: var(--rf-radius);
    cursor: pointer;
}

.btn-icon:hover {
    color: var(--rf-primary);
    background: var(--rf-primary-soft);
}

.btn-icon .icon {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
}

.icon {
    display: inline-block;
    width: 1.125rem;
    height: 1.125rem;
    flex: 0 0 auto;
}

/* ==========================================================================
   8. Formulários
   ========================================================================== */

.field {
    margin-bottom: 1rem;
}

.field-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--rf-ink);
}

.field-required {
    color: #b23c38;
}

.field-help {
    margin: 0.375rem 0 0;
    padding-left: 0;
    font-size: 0.8125rem;
    color: var(--rf-muted);
    list-style: none;
}

.field-errors {
    margin: 0.375rem 0 0;
    padding-left: 1.125rem;
    font-size: 0.8125rem;
    color: #b23c38;
}

.formset-row {
    border: 0;
    border-top: 1px solid var(--rf-border, #cbd5e1);
    padding-top: 1rem;
    margin-top: 1rem;
}
.formset-row:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
/*
 * Os widgets chegam do ui.py sem classes. Estas regras usam :where()
 * (especificidade zero) para que qualquer .form-control ou
 * .form-select-sm aplicado no futuro continue a ganhar.
 */
:where(.app-content, .auth-card) :where(form, .field)
    :where(
        input[type="text"], input[type="search"], input[type="email"],
        input[type="password"], input[type="number"], input[type="date"],
        input[type="datetime-local"], input[type="time"], input[type="url"],
        input[type="tel"], input[type="file"], select, textarea
    ) {
    display: block;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--rf-body);
    background-color: var(--rf-surface);
    background-clip: padding-box;
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
    appearance: none;
}
/* Ícones — alinhamento tipográfico e espaçamento em botões/badges */
.bi { line-height: 1; vertical-align: -0.125em; }
.btn > .bi:first-child,
.badge > .bi:first-child { margin-inline-end: 0.375rem; }
.definition-grid dt > .bi { margin-inline-end: 0.35rem; opacity: 0.75; }

:where(.app-content, .auth-card) :where(form, .field)
    :where(input, select, textarea):focus {
    color: var(--rf-body);
    border-color: var(--rf-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(21, 163, 98, 0.15);
}

:where(.app-content, .auth-card) :where(form, .field) :where(textarea) {
    min-height: 5.5rem;
}

:where(.app-content, .auth-card) :where(form)
    :where(input[type="checkbox"], input[type="radio"]) {
    width: 1rem;
    height: 1rem;
    accent-color: var(--rf-primary);
}

.field-invalid :where(input, select, textarea) {
    border-color: #d68d8a;
}

/* ==========================================================================
   9. Tabelas
   ========================================================================== */

.table-wrapper {
    background: var(--rf-surface);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
    box-shadow: var(--rf-shadow-sm);
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper > .table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table > thead > tr > th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--rf-muted);
    text-transform: uppercase;
    background: var(--rf-surface-alt);
    border-bottom: 1px solid var(--rf-line);
    white-space: nowrap;
}

.table > tbody > tr > td,
.table > tbody > tr > th {
    padding: 0.75rem 1rem;
    color: var(--rf-body);
    vertical-align: middle;
    border-color: var(--rf-line);
}

.table > tbody > tr > th {
    font-weight: 600;
    color: var(--rf-ink);
}

.table-hover > tbody > tr:hover > *,
.app-table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: var(--rf-surface-alt);
}

/* ==========================================================================
   10. Badges, chips, alertas, estados vazios
   ========================================================================== */

.badge {
    padding: 0.35em 0.65em;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 50rem;
}

.badge-success,
.badge-ok {
    color: #24693f;
    background: var(--rf-success-soft);
}

.badge-danger {
    color: #9c3franchise;
}

.badge-danger {
    color: #9c3b37;
    background: var(--rf-danger-soft);
}

.badge-warning,
.badge-warn {
    color: #86620d;
    background: var(--rf-warning-soft);
}

.badge-info {
    color: #2f5f9e;
    background: var(--rf-info-soft);
}

.badge-neutral,
.badge:not([class*="badge-"]):not([class*="text-bg-"]) {
    color: var(--rf-body);
    background: var(--rf-neutral-soft);
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.chip {
    display: inline-block;
    padding: 0.3125rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rf-body);
    background: var(--rf-neutral-soft);
    border-radius: 50rem;
}

.message-list {
    padding-left: 0;
    margin-bottom: 1.5rem;
    list-style: none;
}

.alert {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--rf-radius);
}

.alert-icon {
    flex: 0 0 auto;
    line-height: 1;
}

.alert-icon .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.alert-body {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}

.alert-title {
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.alert-list {
    padding-left: 1.125rem;
    margin-bottom: 0;
}

.alert-dismiss {
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    margin: -0.25rem -0.25rem -0.25rem 0;
}

.alert-success {
    --bs-alert-color: #24693f;
    --bs-alert-bg: var(--rf-success-soft);
    --bs-alert-border-color: #bfe0cb;
}

.alert-danger {
    --bs-alert-color: #9c3b37;
    --bs-alert-bg: var(--rf-danger-soft);
    --bs-alert-border-color: #eec4c2;
}

.alert-warning {
    --bs-alert-color: #86620d;
    --bs-alert-bg: var(--rf-warning-soft);
    --bs-alert-border-color: #f3e0ae;
}

.alert-info {
    --bs-alert-color: #2f5f9e;
    --bs-alert-bg: var(--rf-info-soft);
    --bs-alert-border-color: #c5d9f5;
}

.empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
    color: var(--rf-primary);
    background: var(--rf-primary-soft);
    border-radius: 50%;
}

.empty-state-glyph {
    width: 26px;
    height: 26px;
}

.empty-state-title {
    margin-bottom: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--rf-ink);
}

.empty-state-description {
    max-width: 46ch;
    margin: 0 auto 1.25rem;
    font-size: 0.875rem;
    color: var(--rf-muted);
}

/* ==========================================================================
   11. Listas de definições e cronologias
   ========================================================================== */

.definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem 1.5rem;
    margin-bottom: 0;
}

.definition-grid dt {
    margin-bottom: 0.125rem;
    font-size: 0.75rem
    ;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--rf-muted);
    text-transform: uppercase;
}

.definition-grid dd {
    margin-bottom: 0;
    font-size: 0.9375rem;
    color: var(--rf-ink);
    word-break: break-word;
}

.timeline {
    padding-left: 1.5rem;
    margin-bottom: 0;
    list-style: none;
    border-left: 2px solid var(--rf-line);
}

.timeline > li {
    position: relative;
    margin-bottom: 0.75rem;
}

.timeline > li::before {
    position: absolute;
    top: 1.25rem;
    left: -1.9375rem;
    width: 10px;
    height: 10px;
    content: "";
    background: var(--rf-primary);
    border: 2px solid var(--rf-surface);
    border-radius: 50%;
}

/* ==========================================================================
   12. Confirmação em <details>
   ========================================================================== */

.confirm > summary {
    list-style: none;
    cursor: pointer;
}

.confirm > summary::-webkit-details-marker {
    display: none;
}

.confirm-panel {
    padding: 1rem;
    margin-top: 0.75rem;
    background: var(--rf-surface);
    border: 1px solid var(--rf-line-strong);
    border-radius: var(--rf-radius);
}

.confirm-danger .confirm-panel {
    border-color: #eec4c2;
    background: var(--rf-danger-soft);
}

.confirm-title {
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rf-ink);
}

.confirm-message {
    font-size: 0.875rem;
    color: var(--rf-body);
}

.confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.modal-inline {
    padding: 1rem;
    background: var(--rf-surface);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
}

/* ==========================================================================
   13. Paginação
   ========================================================================== */

.app-pagination .page-link {
    color: var(--rf-body);
    border-color: var(--rf-line);
}

.app-pagination .page-item.active .page-link,
.app-pagination .page-link.active {
    color: #fff;
    background: var(--rf-primary);
    border-color: var(--rf-primary);
}

.app-pagination .pagination-status {
    font-size: 0.8125rem;
    color: var(--rf-muted);
}

/* ==========================================================================
   14. Autenticação
   ========================================================================== */

.auth-body {
    background: var(--rf-surface);
}

.app-auth-wrapper .app-auth-body {
    width: 100%;
    max-width: 360px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-bottom: 2rem;
}

.auth-brand .brand-mark {
    width: 48px;
    height: 48px;
    color: var(--rf-primary);
}

.auth-brand .brand-text {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--rf-ink);
    text-transform: uppercase;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--rf-ink);
    margin-bottom: 0.375rem;
}

.auth-subtitle {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--rf-muted);
}

.auth-form {
    margin-bottom: 1.25rem;
}

.auth-note,
.auth-footer {
    font-size: 0.75rem;
    color: var(--rf-muted);
}

/*
 * O tema Portal aponta .auth-background-holder para ficheiros JPEG que
 * não existem neste projeto. Substituído por um gradiente da marca, o
 * que evita pedidos 404 e mantém o mesmo vocabulário de classes.
 */
.app-login .auth-background-holder,
.app-signup .auth-background-holder,
.app-reset-password .auth-background-holder,
.auth-background-holder {
    background: linear-gradient(150deg, #0f3d29 0%, var(--rf-primary-dark) 55%, var(--rf-primary) 100%);
    background-size: cover;
}

.auth-background-overlay .overlay-content {
    background: rgba(37, 41, 48, 0.55);
}

/* ==========================================================================
   15. Impressão
   ========================================================================== */

@media print {
    .no-print,
    .app-header,
    .app-sidepanel,
    .app-footer,
    .skip-link,
    .notifications-region {
        display: none !important;
    }

    body.app {
        padding-top: 0 !important;
        background: #fff !important;
    }

    .app-wrapper,
    .app-header-inner {
        margin-left: 0 !important;
    }

    .app-card,
    .app-content .card,
    .table-wrapper {
        border: 1px solid #999 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    a[href]::after {
        content: "";
    }
}

/* ==========================================================================
   16. Bloco de transição (REMOVER no fim da migração)
   --------------------------------------------------------------------------
   Traduz os utilitários Tailwind ainda presentes nos templates que não
   foram migrados. Cada bloco de módulo entregue elimina dependências
   daqui; quando a migração terminar, apague esta secção inteira.
   ========================================================================== */



.flex { display: flex; }
.grid { display: grid; }
.inline-block { display: inline-block; }
.block { display: block; }
.hidden { display: none; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.self-start { align-self: flex-start; }
.flex-grow-1 { flex-grow: 1; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }
.gap-5 { gap: 2rem; }
.gap-6 { gap: 2.5rem; }
.gx-2 { column-gap: 0.5rem; }
.gx-3 { column-gap: 1rem; }
.gx-5 { column-gap: 2rem; }
.gy-3 { row-gap: 1rem; }
/* app.css — acrescentar à secção de layout/utilitários */
.definition-grid-full { grid-column: 1 / -1; }

.doc-page { max-width: 56rem; margin-inline: auto; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.5rem; }

@media (min-width: 576px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sm\:col-span-2 { grid-column: span 2 / span 2; }
    .sm\:col-span-3 { grid-column: span 3 / span 3; }
    .sm\:col-span-4 { grid-column: span 4 / span 4; }
    .sm\:flex-row { flex-direction: row; }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
    .md\:col-span-3 { grid-column: span 3 / span 3; }
    .md\:col-span-4 { grid-column: span 4 / span 4; }
}

@media (min-width: 992px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-2 { margin-left: 0.5rem; }
.mx-auto { margin-inline: auto; }

.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-inline: 0.75rem; }
.px-4 { padding-inline: 1rem; }
.py-2 { padding-block: 0.5rem; }
.py-3 { padding-block: 0.75rem; }
.py-8 { padding-block: 2rem; }
.pl-6 { padding-left: 1.5rem; }
.pt-4 { padding-top: 1rem; }

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.divide-y > * + * { border-top: 1px solid var(--rf-line); }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.125rem; }
.text-2xl { font-size: 1.375rem; }
.text-3xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--bs-font-monospace); font-size: 0.875em; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.break-words { overflow-wrap: break-word; word-break: break-word; }
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-slate-500 { color: var(--rf-muted); }
.text-slate-600 { color: var(--rf-body); }
.text-slate-800 { color: var(--rf-ink); }
.text-blue-700 { color: #2f5f9e; }
.text-red-700, .text-red-800 { color: #9c3b37; }
.text-green-700 { color: #24693f; }
.text-amber-700, .text-amber-800 { color: #86620d; }
.text-white { color: #fff; }

.bg-white { background-color: var(--rf-surface); }
.bg-slate-50 { background-color: var(--rf-surface-alt); }
.bg-red-50 { background-color: var(--rf-danger-soft); }
.bg-amber-50 { background-color: var(--rf-warning-soft); }
.bg-green-700 { background-color: #2f8a52; }
.bg-red-700 { background-color: #b23c38; }
.bg-amber-700 { background-color: #a9800f; }
.bg-blue-700 { background-color: var(--rf-primary); }
.bg-slate-800 { background-color: var(--rf-ink); }

.border { border: 1px solid var(--rf-line); }
.border-t { border-top: 1px solid var(--rf-line); }
.border-red-300 { border-color: #eec4c2; }
.border-amber-300 { border-color: #f3e0ae; }
.border-slate-200, .border-slate-300 { border-color: var(--rf-line); }
.border-slate-400 { border-color: var(--rf-line-strong); }
.rounded-md { border-radius: var(--rf-radius); }
.rounded-xl { border-radius: var(--rf-radius-lg); }
.shadow-sm { box-shadow: var(--rf-shadow-sm); }

.min-w-full { min-width: 100%; }
.w-full { width: 100%; }
.h-100 { height: 100%; }
.overflow-x-auto { overflow-x: auto; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
