/*
 * TPM-TUR RH — folha de estilo da aplicação (v1.1).
 * Tokens de cor em app/config/branding.php (injectados no layout com nonce CSP).
 * Linguagem visual: o vocabulário dos formulários controlados da TPM-TUR (faixa amarela do cabeçalho,
 * código do documento) e o triângulo de canto dos códigos de funcionário do registo original.
 * Sem estilos inline (a CSP não permite 'unsafe-inline').
 */
:root {
    --brand-primary: #143D6B;
    --brand-primary-dark: #0E2D50;
    --brand-accent: #F69E20;
    --brand-secondary: #1FA4DD;
    --brand-highlight: #FFC000;
    --ink: #1B2430;
    --ink-soft: #4A5565;
    --ink-faint: #6B7684;
    --line: #DDE3EA;
    --line-soft: #EEF1F5;
    --paper: #F4F6F9;
    --surface: #FFFFFF;
    --focus: #F69E20;
    --danger: #B42318;
    --danger-bg: #FEF3F2;
    --warning: #8A4B00;
    --warning-bg: #FFF8E6;
    --success: #0F6B3A;
    --success-bg: #ECFDF3;
    --info: #0B5C85;
    --info-bg: #EEF7FC;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-pop: 0 10px 30px rgba(20, 61, 107, .16);
    --sidebar-w: 252px;
    --topbar-h: 60px;
    --bs-body-font-family: var(--brand-font);
    --bs-body-color: var(--ink);
    --bs-link-color: #0B5C85;
    --bs-link-color-rgb: 11, 92, 133;
    --bs-link-hover-color: var(--brand-primary);
    --bs-link-hover-color-rgb: 20, 61, 107;
    --bs-border-color: var(--line);
    --bs-primary: var(--brand-primary);
    --bs-primary-rgb: 20, 61, 107;
    --bs-secondary-color: var(--ink-soft);
    --bs-code-color: #8E2449;
}

html { font-size: 15px; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body { background: var(--paper); color: var(--ink); font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.06rem; }
a { text-underline-offset: 2px; }
.text-muted { color: var(--ink-soft) !important; }
code { color: var(--bs-code-color); }

/* Foco sempre visível e consistente (teclado) */
:focus { outline: none; }
:focus-visible, .btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .nav-link:focus-visible {
    outline: 3px solid var(--focus) !important; outline-offset: 2px; box-shadow: none;
}
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 2000; background: var(--brand-primary); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 10px; color: #fff; }

/* Barra de progresso de navegação */
.page-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--brand-accent); z-index: 3000; opacity: 0; transition: width .4s ease, opacity .3s; }
.page-progress.active { opacity: 1; width: 70%; transition: width 6s cubic-bezier(.1,.7,.2,1), opacity .2s; }
.page-progress.done { opacity: 0; width: 100%; transition: width .2s, opacity .4s .2s; }

/* ---------------------------------------------------------------- Botões */
.btn { font-weight: 500; border-radius: var(--radius-sm); }
.btn-primary { --bs-btn-bg: var(--brand-primary); --bs-btn-border-color: var(--brand-primary); --bs-btn-hover-bg: var(--brand-primary-dark);
    --bs-btn-hover-border-color: var(--brand-primary-dark); --bs-btn-active-bg: #0B2340; --bs-btn-disabled-bg: #5B7493; --bs-btn-disabled-border-color: #5B7493; }
.btn-accent { background: var(--brand-accent); border-color: var(--brand-accent); color: #2A1A00; font-weight: 600; }
.btn-accent:hover, .btn-accent:focus-visible { background: #E08A0E; border-color: #E08A0E; color: #1E1300; }
.btn-outline-primary { --bs-btn-color: var(--brand-primary); --bs-btn-border-color: #9DB0C7; --bs-btn-hover-bg: var(--brand-primary);
    --bs-btn-hover-border-color: var(--brand-primary); --bs-btn-active-bg: var(--brand-primary-dark); }
.btn-light { --bs-btn-bg: #EEF2F6; --bs-btn-border-color: #E1E7EE; --bs-btn-hover-bg: #E2E8EF; }
.btn-link { --bs-btn-color: #0B5C85; }
.btn-icon { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; border-radius: 50%; border: 0; background: transparent; color: var(--ink); font-size: 1.2rem; }
.btn-icon:hover { background: var(--paper); }
.btn .spinner-border { vertical-align: -2px; }

/* ---------------------------------------------------------------- Estrutura */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--brand-primary); color: #D6E2F0;
    position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; overscroll-behavior: contain; }
.sidebar .brand { background: #fff; padding: 14px 18px 12px; border-bottom: 4px solid var(--brand-highlight); position: relative; }
.sidebar .brand img { max-width: 168px; height: auto; display: block; }
.sidebar .brand small { display: block; color: var(--ink-soft); font-size: .78rem; margin-top: 2px; }
.sidebar-close { display: none; position: absolute; right: 12px; top: 14px; }
.sidebar nav { padding: 10px 10px 24px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group > span { display: block; font-size: .78rem; color: #A9C2DD; padding: 0 10px 4px; font-weight: 500; }
.sidebar .nav-link { color: #E9F0F7; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
    font-size: .95rem; border-left: 3px solid transparent; }
.sidebar .nav-link i { font-size: 1.05rem; width: 18px; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: rgba(255,255,255,.14); color: #fff; border-left-color: var(--brand-accent); font-weight: 600; }
.sidebar .nav-link:focus-visible { outline-color: var(--brand-highlight) !important; }
.sidebar .nav-link .count { margin-left: auto; background: var(--brand-accent); color: #2A1A00; font-size: .72rem; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
.sidebar-foot { padding: 12px 18px; font-size: .75rem; color: #A9C2DD; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 20, 35, .45); z-index: 1040; }

.main { flex: 1; min-width: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); height: var(--topbar-h); display: flex; align-items: center;
    gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 1030; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar .search { flex: 1; max-width: 560px; position: relative; }
.topbar .search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.topbar .search input { padding-left: 36px; padding-right: 36px; background: var(--paper); border-color: transparent; height: 40px; }
.topbar .search input:focus { background: #fff; border-color: var(--line); }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: #fff; color: var(--ink-soft); border: 1px solid var(--line);
    font-size: .75rem; padding: 0 6px; border-radius: 4px; box-shadow: none; }
.search input:focus ~ .search-kbd { display: none; }
.suggest-list, .cbx-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-pop); list-style: none; margin: 0; padding: 6px; z-index: 1060; max-height: 340px; overflow-y: auto; }
.suggest-list li, .cbx-list li { padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.suggest-list li[aria-selected="true"], .cbx-list li[aria-selected="true"], .suggest-list li:hover, .cbx-list li:hover { background: #EAF1F8; }
.suggest-list .s-name { font-weight: 600; display: block; }
.suggest-list .s-meta, .suggest-list .s-empty { font-size: .82rem; color: var(--ink-soft); }
.suggest-list .s-all { border-top: 1px solid var(--line-soft); margin-top: 4px; color: #0B5C85; font-weight: 500; }
.suggest-list mark, .cbx-list mark { background: #FFE9A8; padding: 0; color: inherit; }

.bell { position: relative; }
.bell .dot { position: absolute; top: 2px; right: 0; background: #C2410C; color: #fff; font-size: .66rem; border-radius: 8px; padding: 0 5px; font-weight: 700; line-height: 1.5; }
.notif-menu { width: min(380px, calc(100vw - 24px)); padding: 0; overflow: hidden; border-radius: var(--radius); box-shadow: var(--shadow-pop); border-color: var(--line); }
.notif-head { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.notif-item:hover, .notif-item:focus-visible { background: #F4F8FC; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: 0 0 9px; }
.notif-msg { display: block; font-size: .88rem; line-height: 1.35; }
.notif-meta { display: block; font-size: .78rem; color: var(--ink-soft); margin-top: 2px; }
.notif-empty { padding: 18px 14px; margin: 0; color: var(--ink-soft); }
.notif-all { display: block; text-align: center; padding: 10px; font-weight: 500; text-decoration: none; background: #F8FAFC; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 22px; padding: 3px 12px 3px 3px; background: #fff; color: var(--ink); }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; }
.user-chip small { color: var(--ink-soft); display: block; line-height: 1.1; font-size: .72rem; }
.sidebar-toggle { display: none; }

.content { padding: 22px 26px 40px; flex: 1 0 auto; outline: none; }
.app-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px 24px; flex-wrap: wrap;
    margin-top: auto; padding: 14px 26px; font-size: .8rem; color: var(--ink-soft); border-top: 1px solid var(--line); background: var(--surface); }
.app-footer a { color: var(--brand-primary); font-weight: 600; }

/* Cabeçalho de página: faixa inspirada no cabeçalho dos formulários controlados */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px;
    padding-bottom: 12px; border-bottom: 2px solid var(--brand-highlight); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--ink-soft); margin: 4px 0 0; font-size: .93rem; max-width: 78ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .86rem; margin-bottom: 4px; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a::before { content: "\2190\00a0"; }
.crumbs a:hover { color: var(--brand-primary); text-decoration: underline; }

/* ---------------------------------------------------------------- Painéis */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel + .panel, .alert + .panel, .panel + .alert, form > .panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1rem; }
.panel-head .hint { font-size: .82rem; color: var(--ink-soft); }
.panel-body { padding: 16px; }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: #FBFCFD;
    border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.chart-box { height: 340px; position: relative; overflow: hidden; }
.form-narrow { max-width: 560px; }
.form-mid { max-width: 760px; }
.form-wide { max-width: 920px; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; display: block; position: relative; }
a.kpi:hover { border-color: #9DB0C7; }
a.kpi::after { content: "\203A"; position: absolute; right: 14px; top: 10px; color: #9DB0C7; font-size: 1.3rem; }
.kpi .value { font-size: 1.9rem; font-weight: 600; line-height: 1.1; color: var(--brand-primary); }
.kpi .label { color: var(--ink-soft); font-size: .88rem; }
.kpi.warn .value { color: #9A4A00; }
.kpi.danger .value { color: var(--danger); }

/* ---------------------------------------------------------------- Formulários */
.form-label { font-weight: 500; color: #3A4555; margin-bottom: .3rem; font-size: .92rem; }
.form-label .req, .req { color: var(--danger); margin-left: 2px; }
.form-text { font-size: .82rem; color: var(--ink-soft); }
.form-control, .form-select { border-color: #C9D3DE; border-radius: var(--radius-sm); min-height: 40px; }
.form-control-sm, .form-select-sm { min-height: 32px; }
.form-control:hover, .form-select:hover { border-color: #A9B6C4; }
.form-control:focus, .form-select:focus { border-color: var(--brand-secondary); box-shadow: 0 0 0 .2rem rgba(31,164,221,.18); }
.form-control::placeholder { color: #8692A0; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); background-image: none; padding-right: .75rem; }
.form-control.is-valid { border-color: #2E8B57; background-image: none; }
.invalid-feedback { color: var(--danger); font-size: .84rem; font-weight: 500; }
.form-check-input { border-color: #8A98A8; }
.form-check-input:checked { background-color: var(--brand-primary); border-color: var(--brand-primary); }
.form-section { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 20px; padding: 20px; border-bottom: 1px solid var(--line-soft); }
.form-section:last-of-type { border-bottom: 0; }
.form-section > header h2 { font-size: 1rem; margin: 0 0 4px; }
.form-section > header p { font-size: .85rem; color: var(--ink-soft); margin: 0; }
.form-legend { font-size: .85rem; color: var(--ink-soft); margin-bottom: 12px; }
.form-actions { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
    padding: 12px 16px; margin-top: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -6px 18px rgba(20,61,107,.09); }
.form-actions .status { margin-right: auto; font-size: .85rem; color: var(--ink-soft); }
.form-actions-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.char-count { font-size: .76rem; color: var(--ink-faint); text-align: right; margin-top: 2px; }
.char-count.near { color: var(--warning); font-weight: 600; }
.small-check { font-size: .85rem; color: inherit; }
.input-reveal { position: relative; }
.input-reveal .btn-reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* Resumo de erros de validação (padrão acessível) */
.error-summary { border: 2px solid var(--danger); border-left-width: 6px; background: var(--danger-bg); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.error-summary:focus { outline: 3px solid var(--focus); }
.error-summary h2 { font-size: 1.02rem; color: var(--danger); margin: 0 0 6px; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: var(--danger); font-weight: 500; }

/* Caixa de selecção pesquisável (melhoria progressiva de <select>) */
.cbx { position: relative; }
.cbx-input { padding-right: 34px; }
.cbx-caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--ink-soft); }
.cbx-list li.cbx-empty { cursor: default; color: var(--ink-soft); }
.cbx-native { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- Listas e filtros */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FBFCFD; border-radius: var(--radius) var(--radius) 0 0; }
.filters .form-control, .filters .form-select { min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }
.filters label { font-size: .8rem; color: var(--ink-soft); display: block; margin-bottom: 2px; font-weight: 500; }
.filters-toggle { display: none; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.filter-chips .lbl { color: var(--ink-soft); margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #EAF1F8; color: var(--brand-primary); border: 1px solid #C9D8E8; border-radius: 16px; padding: 2px 4px 2px 10px; font-weight: 500; }
.chip button { border: 0; background: transparent; color: inherit; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.chip button:hover { background: #D4E2F0; }
.chips-clear { background: none; border: 0; color: #0B5C85; text-decoration: underline; padding: 2px 4px; }

.table-wrap { overflow-x: auto; }
.table { margin: 0; --bs-table-bg: transparent; }
.table thead th { background: #F8FAFC; color: #3A4555; font-weight: 600; font-size: .84rem; white-space: nowrap;
    border-bottom: 2px solid var(--brand-highlight); padding-top: 9px; padding-bottom: 9px; position: sticky; top: 0; z-index: 2; }
.table thead th a { color: inherit; text-decoration: none; }
.table thead th a:hover { color: var(--brand-primary); text-decoration: underline; }
.table thead th[aria-sort="none"] a::after { content: " \2195"; color: #A9B6C4; font-weight: 400; }
.table td { vertical-align: middle; border-color: var(--line-soft); }
.table tbody tr:hover { background: #F5F9FD; }
.table tbody tr[data-href] { cursor: pointer; }
.table .num { text-align: right; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.empty { text-align: center; padding: 34px 16px; color: var(--ink-soft); margin: 0; }
.empty i { font-size: 1.8rem; display: block; margin-bottom: 6px; color: #8A98A8; }
.empty .btn { margin-top: 10px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; font-size: .88rem; color: var(--ink-soft); border-top: 1px solid var(--line); flex-wrap: wrap; gap: 8px; }
.pager .per-page { display: flex; align-items: center; gap: 6px; }
.pager .per-page select { width: auto; min-height: 30px; padding-top: 2px; padding-bottom: 2px; }
.pagination { --bs-pagination-active-bg: var(--brand-primary); --bs-pagination-active-border-color: var(--brand-primary); --bs-pagination-color: var(--brand-primary); }
.w-40 { width: 40%; } .w-45 { width: 45%; } .w-38 { width: 38%; } .w-100px { width: 100px; }
.minw-120 { min-width: 120px; } .minw-200 { min-width: 200px; } .minw-260 { min-width: 260px; } .mw-260 { max-width: 260px; }
.logo-md { max-width: 180px; height: auto; } .radius-8 { border-radius: var(--radius); } .text-brand { color: var(--brand-primary) !important; }
.bg-brand { background-color: var(--brand-primary) !important; } .progress-thin { height: 8px; }

/* Código de funcionário: chip com o triângulo de canto do registo original */
.code-chip { display: inline-block; position: relative; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .86rem;
    background: #EAF1F8; color: var(--brand-primary); padding: 1px 8px 1px 10px; border-radius: 4px; min-width: 44px; text-align: center; }
.code-chip::before { content: ""; position: absolute; left: 0; top: 0; border-style: solid; border-width: 7px 7px 0 0;
    border-color: var(--brand-accent) transparent transparent transparent; border-top-left-radius: 4px; }
.code-chip.none { background: #F1F3F5; color: #5E6A78; font-weight: 500; }
.code-chip.none::before { border-top-color: #C5CDD6; }

/* Badges com contraste AA */
.badge { font-weight: 600; letter-spacing: .01em; }
.text-bg-success { background-color: #12733F !important; }
.text-bg-warning { background-color: #FFD27A !important; color: #4A2E00 !important; }
.text-bg-info { background-color: #CDEBF8 !important; color: #08445F !important; }
.text-bg-secondary { background-color: #5E6A78 !important; }
.text-bg-light { border: 1px solid var(--line); color: #3A4555 !important; }

/* Ficha */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .initials { width: 64px; height: 64px; border-radius: 10px; background: var(--brand-primary); color: #fff; display: grid; place-items: center; font-size: 1.5rem; font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; }
.facts > div { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.facts dt { font-size: .8rem; color: var(--ink-soft); font-weight: 500; }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.nav-tabs .nav-link { color: var(--ink-soft); white-space: nowrap; }
.nav-tabs .nav-link.active { color: var(--brand-primary); font-weight: 600; border-top: 3px solid var(--brand-accent); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-secondary); }
.timeline li:last-child { border-left-color: transparent; }
.timeline .meta { font-size: .8rem; color: var(--ink-soft); }

/* Calendário */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { background: #F8FAFC; font-size: .8rem; color: #3A4555; font-weight: 600; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 2px solid var(--brand-highlight); }
.cal .day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; font-size: .85rem; min-width: 0; }
.cal.week .day { min-height: 220px; }
.cal .day.other { background: #FAFBFC; color: var(--ink-faint); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--brand-accent); }
.cal .day .n { font-weight: 600; font-size: .8rem; }
.cal .ev { display: block; margin-top: 4px; padding: 2px 6px; border-radius: 4px; background: #E7F4FB; color: #08445F; text-decoration: none; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev:hover { background: #D3ECF8; }

/* Estado de saúde do sistema */
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.st-ok { background: #16A34A; } .st-warn { background: #D97706; } .st-fail { background: #DC2626; } .st-info { background: #94A3B8; }
.mono-path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; word-break: break-all; background: #0F2238; color: #E6EEF7; padding: 10px 12px; border-radius: var(--radius-sm); display: block; }

/* Callouts (alertas dentro da página) */
.alert { border-radius: var(--radius); border-width: 1px; }
.alert-warning { background: var(--warning-bg); border-color: #F5D58A; color: #5B3700; }
.alert-danger { background: var(--danger-bg); border-color: #F5C2BC; color: #7A1A12; }
.alert-success { background: var(--success-bg); border-color: #A8E0BF; color: #0B4F2B; }
.alert-info, .alert-light { background: var(--info-bg); border-color: #BFE1F3; color: #08445F; }

/* Notificações (toasts) */
.toast-zone { position: fixed; top: calc(var(--topbar-h) + 10px); right: 18px; z-index: 1090; width: min(400px, calc(100vw - 24px)); display: grid; gap: 10px; }
.minimal .toast-zone { top: 16px; }
.app-toast { width: 100%; border: 1px solid var(--line); border-left-width: 5px; border-radius: var(--radius); box-shadow: var(--shadow-pop); background: #fff; }
.app-toast .toast-body { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; font-size: .92rem; }
.app-toast .toast-icon { font-size: 1.15rem; margin-top: 1px; }
.app-toast .toast-text { flex: 1; }
.toast-success { border-left-color: #12733F; } .toast-success .toast-icon { color: #12733F; }
.toast-danger { border-left-color: var(--danger); } .toast-danger .toast-icon { color: var(--danger); }
.toast-warning { border-left-color: #D97706; } .toast-warning .toast-icon { color: #B45309; }
.toast-info { border-left-color: var(--brand-secondary); } .toast-info .toast-icon { color: var(--info); }

/* Páginas de erro */
.error-page { display: grid; place-items: center; padding: 40px 16px; }
.error-page.standalone { min-height: 100vh; align-content: center; gap: 22px; }
.error-logo { max-width: 170px; height: auto; }
.error-card { max-width: 560px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 34px 30px; border-top: 4px solid var(--brand-highlight); }
.error-icon { width: 64px; height: 64px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: #EAF1F8; color: var(--brand-primary); font-size: 1.8rem; }
.error-code { margin: 0; color: var(--ink-soft); font-size: .86rem; font-weight: 600; }
.error-card h1 { font-size: 1.5rem; margin: 4px 0 10px; }
.error-card .lead-text { font-size: 1.02rem; }
.error-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.error-ref { margin: 18px 0 0; font-size: .82rem; color: var(--ink-soft); }
.error-debug { text-align: left; font-size: .75rem; background: #F8FAFC; border: 1px solid var(--line); padding: 8px; margin-top: 12px; max-height: 300px; overflow: auto; }

/* Ecrãs de autenticação/instalação */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-side { background: var(--brand-primary); color: #DCE7F3; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -90px; bottom: -90px; width: 280px; height: 280px; border-radius: 50%; background: var(--brand-accent); opacity: .9; }
.auth-side h2 { color: #fff; font-size: 1.7rem; max-width: 22ch; line-height: 1.25; }
.auth-side p { max-width: 46ch; }
.auth-side .doc-ref { font-size: .82rem; color: #B3C9E1; position: relative; z-index: 1; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; background: #fff; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card img { max-width: 190px; height: auto; margin-bottom: 26px; }
.caps-warning { font-size: .82rem; color: var(--warning); margin-top: 4px; }
.install-wrap { max-width: 920px; margin: 0 auto; padding: 28px 18px 60px; }

/* ---------------------------------------------------------------- Responsivo */
@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 1050; transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; }
    .sidebar.open { transform: none; visibility: visible; box-shadow: var(--shadow-pop); }
    .sidebar-close { display: block; }
    .sidebar-toggle { display: inline-grid; }
    .topbar { padding: 0 10px; gap: 6px; }
    .search-kbd { display: none; }
    .content { padding: 16px 14px 32px; }
    .user-chip { padding: 3px; } .user-chip .who { display: none; } .user-chip.dropdown-toggle::after { display: none; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .form-section { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 767.98px) {
    html { font-size: 15.5px; }
    .page-head { align-items: flex-start; }
    .page-head .actions { width: 100%; }
    .page-head .actions > .btn, .page-head .actions > form, .page-head .actions > .dropdown { flex: 1 1 auto; }
    .page-head .actions .btn { width: 100%; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .kpi { padding: 12px; } .kpi .value { font-size: 1.5rem; }
    /* Filtros recolhidos atrás de um botão */
    .filters-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line);
        background: #FBFCFD; font-weight: 600; color: var(--brand-primary); border-radius: var(--radius) var(--radius) 0 0; }
    .filters.collapsible:not(.open) { display: none; }
    .filters > div, .filters .grow, .filters .form-control, .filters .form-select { width: 100%; min-width: 0; flex: 1 1 100%; }
    /* Tabelas transformadas em cartões */
    .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
    .table-stack td { border: 0; padding: 3px 0; display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; text-align: left !important; white-space: normal !important; }
    .table-stack td::before { content: attr(data-label); color: var(--ink-soft); font-size: .8rem; font-weight: 500; }
    .table-stack td[data-label=""]::before, .table-stack td:not([data-label])::before { content: none; }
    .table-stack td[data-label=""], .table-stack td:not([data-label]) { grid-template-columns: 1fr; }
    .table-stack td:first-child { font-weight: 600; }
    .table-stack td > .badge, .table-stack td > .code-chip, .table-stack td > .btn { justify-self: start; }
    .pager { justify-content: center; text-align: center; }
    .form-actions { margin-left: -14px; margin-right: -14px; border-radius: 0; border-left: 0; border-right: 0; }
    .form-actions .btn { flex: 1 1 auto; }
    .cal .day { min-height: 64px; padding: 4px; } .cal .ev { font-size: .72rem; padding: 1px 4px; }
    .notif-menu { position: fixed !important; inset: var(--topbar-h) 8px auto 8px !important; transform: none !important; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
    .code-chip::before, .status-dot { forced-color-adjust: none; }
    .btn, .chip, .kpi { border: 1px solid ButtonText; }
}

/* ---------------------------------------------------------------- Impressão */
.print-only { display: none; }
@media print {
    @page { size: A4; margin: 14mm 12mm; }
    body { background: #fff; font-size: 11pt; }
    .sidebar, .topbar, .app-footer, .no-print, .filters, .filters-toggle, .filter-chips, .pager, .btn, .toast-zone, form.d-inline, .form-actions,
    .error-summary, .page-progress, .skip-link, .nav-tabs { display: none !important; }
    .content { padding: 0; }
    .panel { border: none; }
    .print-only { display: block; }
    .print-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--brand-highlight); padding-bottom: 8px; margin-bottom: 12px; }
    .print-head img { height: 46px; }
    .print-head .meta { text-align: right; font-size: 9pt; color: #333; }
    .print-foot { margin-top: 16px; font-size: 8pt; color: #555; border-top: 1px solid #999; padding-top: 6px; }
    a { color: inherit; text-decoration: none; }
    .table thead th { background: #fff !important; position: static; }
    .code-chip { background: none; }
    .table-wrap { overflow: visible; }
}

/* Contraste AA para utilitários do Bootstrap */
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning-emphasis { color: #7A4300 !important; }
.btn-outline-secondary { --bs-btn-color: #4A5565; --bs-btn-border-color: #8A98A8; --bs-btn-hover-bg: #4A5565; --bs-btn-hover-border-color: #4A5565; }
.btn-outline-success { --bs-btn-color: #0F6B3A; --bs-btn-border-color: #3E9A68; --bs-btn-hover-bg: #0F6B3A; --bs-btn-hover-border-color: #0F6B3A; }
.btn-outline-danger { --bs-btn-color: #A61B12; --bs-btn-border-color: #D06A62; --bs-btn-hover-bg: #A61B12; --bs-btn-hover-border-color: #A61B12; }
.btn-danger { --bs-btn-bg: #B42318; --bs-btn-border-color: #B42318; --bs-btn-hover-bg: #921C13; --bs-btn-hover-border-color: #921C13; }
.cal .day.other { color: #5E6A78; }

/* ---- Verificação da instalação (1.3) ---- */
.setup-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.setup-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: #F1F3F5; color: #5E6A78; font-size: .88rem; }
.setup-steps li span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; font-weight: 700; font-size: .8rem; }
.setup-steps li.done { background: #E7F6EC; color: #166534; }
.setup-steps li.current { background: var(--brand-primary); color: #fff; }
.setup-steps li.current span { color: var(--brand-primary); }
.setup-code { background: #0F2440; color: #F3F6FA; padding: 12px 14px; border-radius: 6px; font-size: .84rem; white-space: pre-wrap; word-break: break-all; user-select: all; }
.setup-ok > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.setup-ok > summary::-webkit-details-marker { display: none; }
.setup-ok[open] > summary { border-bottom: 1px solid var(--line); }
.setup-ok > summary:focus-visible { outline: 3px solid var(--brand-secondary); outline-offset: -3px; }

/* ================================================================ v1.3.1 — wizard, filtros em tempo real, tema escuro */
:root { --chart-1: var(--brand-primary); --chart-2: var(--brand-secondary); --chart-3: #B42318; --surface-2: #FBFCFD; --hover: #F5F9FD; --chip-bg: #EAF1F8; --chip-line: #C9D8E8; }

/* Wizard do cadastro */
.wizard-nav { margin: 0 0 6px; overflow-x: auto; scrollbar-width: thin; }
.wizard-nav ol { display: flex; gap: 6px; list-style: none; margin: 0; padding: 2px 2px 8px; min-width: max-content; counter-reset: wz; }
.wizard-dot { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px;
    padding: 5px 14px 5px 5px; font-size: .88rem; font-weight: 500; min-height: 40px; }
.wizard-dot .num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--chip-bg); color: var(--brand-primary); font-size: .95rem; }
.wizard-dot:hover { border-color: #9DB0C7; color: var(--ink); }
li.current .wizard-dot { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
li.current .wizard-dot .num { background: #fff; color: var(--brand-primary); }
li.done .wizard-dot { border-color: #8CC9A6; color: var(--success); }
li.done .wizard-dot .num { background: var(--success-bg); color: var(--success); }
li.done .wizard-dot .num i::before { content: "\F26E"; } /* bi-check-lg */
li.error .wizard-dot { border-color: var(--danger); color: var(--danger); }
li.error .wizard-dot .num { background: var(--danger-bg); color: var(--danger); }
.wizard-status { font-size: .85rem; color: var(--ink-soft); margin: 0 0 8px; font-weight: 500; }
.wizard-progress { height: 4px; background: var(--line-soft); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.wizard-progress span { display: block; height: 100%; width: 0; background: var(--brand-accent); transition: width .25s ease; }
.is-wizard .wizard-step .form-section { border-bottom: 1px solid var(--line-soft); }
.is-wizard .wizard-step .form-section:last-child { border-bottom: 0; }
.wizard-step h2:focus { outline: none; }
.dep-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0 0 12px; background: var(--surface-2); }
.dep-legend { float: none; width: auto; font-size: .9rem; font-weight: 600; color: var(--ink); margin: 0 0 6px; padding: 0; }
.dep-summary { padding-left: 1.1rem; margin-bottom: 8px; }
.review-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 10px; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review-head h3 { font-size: .95rem; margin: 0; }
.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; margin: 8px 0 0; }
.review-list dt { font-size: .78rem; color: var(--ink-soft); font-weight: 500; }
.review-list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
    .wizard-dot .lbl { display: none; }
    li.current .wizard-dot .lbl { display: inline; }
    .wizard-dot { padding-right: 5px; }
    li.current .wizard-dot { padding-right: 14px; }
    .form-actions .btn { min-width: 0; }
}

/* Filtros em tempo real */
.live-hidden { display: none !important; }
.live-hint { font-size: .78rem; color: var(--ink-soft); align-self: center; white-space: nowrap; }
.live-hint i { color: var(--brand-accent); }
.panel.is-loading .table-wrap, .panel.is-loading .empty { opacity: .55; transition: opacity .15s; }

/* Tema: escolha no menu do utilizador */
.theme-group .dropdown-item[aria-checked="true"] { font-weight: 600; }
.theme-group .dropdown-item[aria-checked="true"]::after { content: "\F26E"; font-family: bootstrap-icons; float: right; margin-left: 12px; color: var(--brand-accent); }

/* ---------------------------------------------------------------- Tema escuro (Bootstrap 5.3 data-bs-theme + tokens da aplicação) */
[data-bs-theme="dark"] {
    color-scheme: dark;
    --ink: #E7ECF3; --ink-soft: #B3BECC; --ink-faint: #93A0B0;
    --line: #2F3D50; --line-soft: #253244; --paper: #0D1520; --surface: #152132; --surface-2: #1A283B; --hover: #1D2D42;
    --chip-bg: #1F3550; --chip-line: #34507A;
    --danger: #FF8A80; --danger-bg: #3A1A1A; --warning: #FFC46B; --warning-bg: #3A2A0E; --success: #6FD69B; --success-bg: #13301F; --info: #7CC8F0; --info-bg: #102C3D;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    --chart-1: #6FA8E6; --chart-2: #3FC1F0; --chart-3: #FF7A6E;
    --bs-body-bg: var(--paper); --bs-body-color: var(--ink); --bs-border-color: var(--line); --bs-secondary-color: var(--ink-soft);
    --bs-link-color: #8CC8F2; --bs-link-color-rgb: 140, 200, 242; --bs-link-hover-color: #B9DEF8; --bs-link-hover-color-rgb: 185, 222, 248;
    --bs-code-color: #F2A7C3; --bs-tertiary-bg: var(--surface-2); --bs-secondary-bg: var(--surface-2);
    --bs-emphasis-color: #fff; --bs-dropdown-bg: var(--surface);
}
[data-bs-theme="dark"] body { background: var(--paper); color: var(--ink); }
[data-bs-theme="dark"] .text-muted { color: var(--ink-soft) !important; }
[data-bs-theme="dark"] .sidebar { background: #0A1A2E; }
[data-bs-theme="dark"] .sidebar .brand { background: #F4F6F9; }
[data-bs-theme="dark"] .topbar .search input, [data-bs-theme="dark"] .topbar .search input:focus { background: var(--surface-2); color: var(--ink); }
[data-bs-theme="dark"] .search-kbd, [data-bs-theme="dark"] .suggest-list, [data-bs-theme="dark"] .cbx-list,
[data-bs-theme="dark"] .form-actions, [data-bs-theme="dark"] .cal .day, [data-bs-theme="dark"] .error-card, [data-bs-theme="dark"] .auth-main,
[data-bs-theme="dark"] .app-toast, [data-bs-theme="dark"] .notif-menu { background: var(--surface); color: var(--ink); }
[data-bs-theme="dark"] .suggest-list li[aria-selected="true"], [data-bs-theme="dark"] .cbx-list li[aria-selected="true"],
[data-bs-theme="dark"] .suggest-list li:hover, [data-bs-theme="dark"] .cbx-list li:hover, [data-bs-theme="dark"] .notif-item:hover,
[data-bs-theme="dark"] .notif-item:focus-visible, [data-bs-theme="dark"] .table tbody tr:hover { background: var(--hover); }
[data-bs-theme="dark"] .suggest-list mark, [data-bs-theme="dark"] .cbx-list mark { background: #6B5300; color: #fff; }
[data-bs-theme="dark"] .notif-all, [data-bs-theme="dark"] .panel-foot, [data-bs-theme="dark"] .filters, [data-bs-theme="dark"] .error-debug,
[data-bs-theme="dark"] .cal .day.other, [data-bs-theme="dark"] .cal .dow { background: var(--surface-2); }
[data-bs-theme="dark"] .table thead th { background: var(--surface-2); color: var(--ink); }
[data-bs-theme="dark"] .table { --bs-table-color: var(--ink); --bs-table-striped-color: var(--ink); --bs-table-hover-color: var(--ink); }
[data-bs-theme="dark"] .form-label, [data-bs-theme="dark"] .text-bg-light { color: var(--ink) !important; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #0F1B2A; border-color: #3B4B60; color: var(--ink); }
[data-bs-theme="dark"] .form-control:hover, [data-bs-theme="dark"] .form-select:hover { border-color: #566A84; }
[data-bs-theme="dark"] .form-control::placeholder { color: #7D8A9B; }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-control[readonly] { background-color: #1A2535; }
[data-bs-theme="dark"] .form-check-input { background-color: #0F1B2A; border-color: #6B7C92; }
[data-bs-theme="dark"] .form-check-input:checked { background-color: #4A8FD9; border-color: #4A8FD9; }
[data-bs-theme="dark"] .kpi .value, [data-bs-theme="dark"] .chip, [data-bs-theme="dark"] .code-chip, [data-bs-theme="dark"] .table thead th a:hover { color: #9CC6F2; }
[data-bs-theme="dark"] .kpi.warn .value, [data-bs-theme="dark"] .text-warning-emphasis { color: var(--warning) !important; }
[data-bs-theme="dark"] a.kpi:hover { border-color: #4A6584; }
[data-bs-theme="dark"] .chip, [data-bs-theme="dark"] .code-chip { background: var(--chip-bg); border-color: var(--chip-line); }
[data-bs-theme="dark"] .chip button:hover { background: #2B4A70; }
[data-bs-theme="dark"] .code-chip.none { background: #263244; color: var(--ink-soft); }
[data-bs-theme="dark"] .chips-clear, [data-bs-theme="dark"] .btn-link, [data-bs-theme="dark"] .suggest-list .s-all { color: #8CC8F2; --bs-btn-color: #8CC8F2; }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: #23324A; --bs-btn-border-color: #34465F; --bs-btn-color: var(--ink); --bs-btn-hover-bg: #2C3D57; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #45597A; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #2F6DB5; --bs-btn-border-color: #2F6DB5; --bs-btn-hover-bg: #3A7CC7; --bs-btn-hover-border-color: #3A7CC7; --bs-btn-active-bg: #255C9C; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #9CC6F2; --bs-btn-border-color: #4A6584; --bs-btn-hover-bg: #2F6DB5; --bs-btn-hover-border-color: #2F6DB5; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #255C9C; }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--ink-soft); --bs-btn-border-color: #566A84; --bs-btn-hover-bg: #3B4B60; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-outline-success { --bs-btn-color: var(--success); --bs-btn-border-color: #2F7A50; --bs-btn-hover-bg: #1E6B42; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: #A04A44; --bs-btn-hover-bg: #A61B12; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .alert-warning { background: var(--warning-bg); border-color: #6B4E12; color: #FFD99A; }
[data-bs-theme="dark"] .alert-danger { background: var(--danger-bg); border-color: #6E2A26; color: #FFC2BC; }
[data-bs-theme="dark"] .alert-success { background: var(--success-bg); border-color: #255C3A; color: #A8E9C2; }
[data-bs-theme="dark"] .alert-info, [data-bs-theme="dark"] .alert-light { background: var(--info-bg); border-color: #1F4F6B; color: #B5E1F7; }
[data-bs-theme="dark"] .text-bg-info { background-color: #1F4F6B !important; color: #D6F0FB !important; }
[data-bs-theme="dark"] .text-bg-warning { background-color: #6B4E12 !important; color: #FFE7B8 !important; }
[data-bs-theme="dark"] .cal .ev { background: #173A52; color: #CFEBFA; }
[data-bs-theme="dark"] .cal .ev:hover { background: #1F4A68; }
[data-bs-theme="dark"] .error-icon { background: var(--chip-bg); }
[data-bs-theme="dark"] .empty i { color: var(--ink-faint); }
[data-bs-theme="dark"] .profile-head .initials, [data-bs-theme="dark"] .user-chip .avatar { background: #2F6DB5; }
[data-bs-theme="dark"] .setup-steps li { background: var(--surface-2); color: var(--ink-soft); }
[data-bs-theme="dark"] .setup-steps li span { background: var(--surface); }
[data-bs-theme="dark"] li.current .wizard-dot { background: #2F6DB5; border-color: #2F6DB5; }
[data-bs-theme="dark"] li.current .wizard-dot .num { color: #2F6DB5; }
[data-bs-theme="dark"] .wizard-dot .num { color: #9CC6F2; }
[data-bs-theme="dark"] li.done .wizard-dot { border-color: #2F7A50; }
[data-bs-theme="dark"] .auth-side { background: #0A1A2E; }
@media print {
    [data-bs-theme="dark"] { color-scheme: light; --ink: #1B2430; --ink-soft: #4A5565; --line: #DDE3EA; --line-soft: #EEF1F5; --paper: #fff; --surface: #fff; --surface-2: #fff; }
    [data-bs-theme="dark"] body, [data-bs-theme="dark"] .panel { background: #fff !important; color: #000 !important; }
}
[data-bs-theme="dark"] .sidebar .brand small { color: #4A5565; }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { color: #9CC6F2; background: var(--surface); border-color: var(--line) var(--line) var(--surface); }
[data-bs-theme="dark"] .pagination { --bs-pagination-color: #9CC6F2; --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--line);
    --bs-pagination-hover-color: #fff; --bs-pagination-hover-bg: var(--hover); --bs-pagination-hover-border-color: #4A6584;
    --bs-pagination-active-bg: #2F6DB5; --bs-pagination-active-border-color: #2F6DB5; --bs-pagination-active-color: #fff;
    --bs-pagination-disabled-color: var(--ink-faint); --bs-pagination-disabled-bg: var(--surface-2); --bs-pagination-disabled-border-color: var(--line); }
[data-bs-theme="dark"] .user-chip { background: var(--surface-2); }
@media (max-width: 767.98px) { .live-hint { flex-basis: 100%; white-space: normal; order: 99; } }
.wizard-nav, .wizard-step h2 { scroll-margin-top: calc(var(--topbar-h) + 12px); }
/* Logótipo (texto azul-marinho em PNG transparente): no tema escuro fica sobre uma placa clara, como na barra lateral */
[data-bs-theme="dark"] .brand-logo { background: #F4F6F9; padding: 8px 12px; border-radius: 8px; box-sizing: content-box; }
