/* Shell do SIG — cores da marca OTSS: #000c27, #023179, #17a2b8 */
:root {
  --sig-navy: #000c27;
  --sig-blue: #023179;
  --sig-teal: #17a2b8;
  --sig-sidebar-width: 15rem;
  --sig-sidebar-collapsed: 4.25rem;
}
body { background: #f5f7fb; }
.skip-link { position: absolute; z-index: 2000; padding: .5rem 1rem; background: #fff; }
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { --bs-offcanvas-bg: var(--sig-navy); --bs-offcanvas-color: #fff; background-color: var(--sig-navy) !important; color: #fff; width: var(--sig-sidebar-width); display: flex; flex-direction: column; }
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; transition: width .2s ease; }
  .sidebar-collapsed .app-sidebar { width: var(--sig-sidebar-collapsed); }
  .sidebar-collapsed .nav-label, .sidebar-collapsed .brand-name { display: none; }
  .sidebar-collapsed .sidebar-collapse i { transform: rotate(180deg); }
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; font-weight: 600; font-size: 1.15rem; }
.sidebar-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; }
/* Área da sessão (D71): título da área no menu lateral. */
.sidebar-area-title { color: rgba(255,255,255,.6); letter-spacing: .04em; }
@media (min-width: 992px) {
  .sidebar-collapsed .sidebar-area-title { display: none; }
}
.sidebar-nav .nav-link { color: rgba(255,255,255,.8); display: flex; align-items: center; gap: .85rem; padding: .65rem 1.25rem; white-space: nowrap; }
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link:focus { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-nav .nav-link.active { color: #fff; background: var(--sig-blue); box-shadow: inset 3px 0 0 var(--sig-teal); }
.sidebar-nav .bi { font-size: 1.2rem; }
.sidebar-collapse { color: rgba(255,255,255,.7); text-align: left; padding: .75rem 1.25rem; }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; background: #fff; border-bottom: 1px solid #e3e7ef; position: sticky; top: 0; z-index: 1020; }
.topbar-search { flex: 1; max-width: 40rem; }
.topbar-actions { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--sig-blue); color: #fff; font-size: .85rem; }
.notif-badge { position: absolute; top: 0; right: 0; font-size: .65rem; }
.notif-menu { width: min(22rem, calc(100vw - 1.5rem)); max-height: 70vh; overflow-y: auto; }
.notif-menu .dropdown-item { white-space: normal; min-height: 44px; }
.sig-notif-unread { background-color: var(--bs-primary-bg-subtle); }
.sig-notif-list .list-group-item.sig-notif-unread { border-left: 4px solid var(--bs-primary); }
.min-w-0 { min-width: 0; }
.app-content { flex: 1; padding: 1.5rem; }
.app-footer { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: .75rem 1.5rem; font-size: .85rem; color: #5b6475; border-top: 1px solid #e3e7ef; background: #fff; }
.app-footer[data-env='staging'], .auth-footer[data-env='staging'] { border-top: 3px solid #fd7e14; }
.app-footer[data-env='development'], .auth-footer[data-env='development'] { border-top: 3px solid #6c757d; }
.app-footer[data-env='test'], .auth-footer[data-env='test'] { border-top: 3px solid #6f42c1; }
.info-icon { color: var(--sig-teal); line-height: 1; }
.info-icon:focus-visible { outline: 2px solid var(--sig-teal); outline-offset: 2px; }

/* Telas de acesso (login, MFA, troca de senha): painel institucional + formulário à direita (mobile first) */
.auth-body { min-height: 100vh; margin: 0; background: var(--bs-body-bg); }
.auth-split { min-height: 100vh; display: flex; flex-direction: column; }
.auth-hero { position: relative; overflow: hidden; color: #fff; min-height: 11rem; display: flex; align-items: flex-end; }
.auth-hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-hero-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6, 30, 45, .15) 0%, rgba(6, 30, 45, .75) 100%); }
.auth-hero-content { position: relative; padding: 1.25rem 1.5rem; max-width: 36rem; }
.auth-hero-logo { width: 2.5rem; height: 2.5rem; border-radius: .6rem; margin-bottom: .5rem; }
.auth-hero-title { font-size: 1.35rem; font-weight: 600; margin: 0 0 .25rem; }
.auth-hero-subtitle { margin: 0; opacity: .92; font-size: .95rem; }
.auth-hero-description { display: none; }
.auth-panel { flex: 1; display: flex; flex-direction: column; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-form { width: 100%; max-width: 25rem; }
/* Links das telas de acesso com área de toque de 44 px (C14). */
.auth-link { display: inline-flex; align-items: center; min-height: 44px; }
.auth-footer { padding: .75rem 1.25rem; font-size: .8rem; color: var(--bs-secondary-color); text-align: center; border-top: 3px solid var(--sig-env-color, var(--bs-border-color)); }
.recovery-codes li { padding: .25rem .5rem; background: var(--bs-secondary-bg); border-radius: .25rem; }

@media (min-width: 992px) {
  .auth-split { flex-direction: row; }
  .auth-hero { flex: 1 1 55%; min-height: 100vh; align-items: flex-end; }
  .auth-hero-content { padding: 3rem 3.5rem 4rem; }
  .auth-hero-logo { width: 4rem; height: 4rem; border-radius: 1rem; margin-bottom: 1.25rem; }
  .auth-hero-title { font-size: 2.25rem; line-height: 1.2; }
  .auth-hero-subtitle { font-size: 1.15rem; }
  .auth-hero-description { display: block; margin: 1rem 0 0; opacity: .85; max-width: 30rem; }
  .auth-panel { flex: 0 0 min(32rem, 45%); box-shadow: -1px 0 0 var(--bs-border-color); }
  .auth-main { padding: 3rem; }
}

/* Organograma */
.org-tree, .org-children { list-style: none; padding-left: 0; margin: 0; }
.org-children { margin-left: 1.25rem; padding-left: 1rem; border-left: 2px solid var(--bs-border-color); }
.org-node { margin: .5rem 0; }
.org-node-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .5rem .75rem; }
.org-node-inactive > .org-node-card { opacity: .6; }
.org-type { font-weight: 500; }
.org-type-general_coordination { background: #0b3954; color: #fff; }
.org-type-coordination { background: #127a8a; color: #fff; }
.org-type-nucleus { background: #d8efe9; color: #14513f; }
.org-type-subnucleus { background: #eef1f6; color: #3d4757; }

/* Identidade visual e auditoria */
.branding-preview { height: 7rem; display: flex; align-items: center; justify-content: center; background: var(--bs-tertiary-bg); border-radius: .5rem; overflow: hidden; }
.branding-preview img { max-height: 100%; max-width: 100%; object-fit: contain; }
.audit-json { max-height: 24rem; overflow: auto; font-size: .75rem; background: var(--bs-tertiary-bg); padding: .5rem; border-radius: .25rem; white-space: pre-wrap; word-break: break-word; }

/* Projetos */
.planned-input { max-width: 9rem; }

/* Padrão de telas (D45): cabeçalho com ação principal, ações por linha, rodapé de formulário, mobile first */
.sig-page-header { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.sig-page-header > .btn { align-self: stretch; white-space: nowrap; flex-shrink: 0; }
.sig-row-actions { display: inline-flex; flex-direction: column; gap: .25rem; align-items: flex-end; }
.sig-touch { min-height: 44px; display: inline-flex; align-items: center; }
.sig-icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: .25rem .5rem; }
.sig-form-actions { display: flex; flex-direction: column-reverse; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--bs-border-color); }
.sig-form-actions .btn { min-height: 44px; }
.sig-inline-end { display: flex; flex-direction: column; gap: .25rem; align-items: stretch; margin: 0; }
/* Abas: até 991 px quebram linha (nenhuma aba escondida fora da tela); a partir de 992 px ficam em uma linha. */
.sig-tabs { flex-wrap: wrap; row-gap: .25rem; }
.sig-tabs .nav-link { white-space: nowrap; padding: .5rem .75rem; min-height: 44px; }
@media (max-width: 991.98px) {
  .sig-tabs.nav-tabs { border-bottom: 0; gap: .375rem; }
  .sig-tabs .nav-link { border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); margin-bottom: 0; display: inline-flex; align-items: center; gap: .25rem; }
  .sig-tabs .nav-link.active { background-color: var(--sig-blue); border-color: var(--sig-blue); color: #fff; }
}
.org-indent-1 { padding-left: 1rem; }
.org-indent-2 { padding-left: 2rem; }
.org-indent-3 { padding-left: 3rem; }
.org-indent-1, .org-indent-2, .org-indent-3 { border-left: 2px solid var(--bs-border-color); margin-left: .25rem; }
.sig-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--bs-primary); z-index: 2000; opacity: 0; transition: width .3s ease, opacity .2s ease; }
body.sig-loading .sig-progress { width: 70%; opacity: 1; }
body.sig-loading [data-sig-main] { opacity: .6; transition: opacity .15s ease; }
@media (min-width: 576px) {
  .sig-form-actions { flex-direction: row; justify-content: flex-end; }
}
@media (min-width: 768px) {
  .sig-page-header { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .sig-page-header > .btn { align-self: flex-start; }
  .sig-icon-btn { min-width: 36px; min-height: 36px; }
  .sig-touch { min-height: 0; }
  .sig-tabs .nav-link { min-height: 0; padding: .5rem 1rem; }
  .sig-row-actions { flex-direction: row; align-items: center; }
  .sig-inline-end { flex-direction: row; align-items: center; justify-content: flex-end; }
  .sig-inline-end .form-control { max-width: 10rem; }
}

/* Abas quebram linha também em telas largas: nenhuma aba fica escondida fora da área visível (fichas com muitas abas). */

/* Modal extra larga (D45): tela cheia no celular; ocupa a largura disponível em tablets e telas médias (o modal-xl do
   Bootstrap só alarga a partir de 1200 px); 1140 px no máximo em telas grandes. */
@media (min-width: 576px) {
  .modal-dialog.modal-xl { max-width: calc(100% - 2rem); }
}
@media (min-width: 1200px) {
  .modal-dialog.modal-xl { max-width: 1140px; }
}
.sig-cell-wrap { white-space: normal; overflow-wrap: anywhere; min-width: 10rem; }
.sig-pre-line { white-space: pre-line; }
/* Solicitações: seções do formulário, trechos do roteiro, painéis de ação e histórico */
.sig-form-section { margin-top: 1.25rem; padding-bottom: .25rem; border-bottom: 1px solid var(--bs-border-color); }
.sig-leg { border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .75rem .75rem 0; }
.sig-action-panel { border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .75rem; background: var(--bs-tertiary-bg); }
.sig-action-panel .btn { min-height: 44px; }
.sig-timeline-item { border-left: 3px solid var(--bs-border-color); padding: .25rem 0 .5rem .75rem; }
/* Toque (mobile first): botões com pelo menos 44 px de altura no celular; a partir de 768 px, altura padrão do Bootstrap. */
.btn:not(.btn-close):not(.btn-link):not(.btn-sm) { min-height: 44px; }
@media (min-width: 768px) { .btn:not(.btn-close):not(.btn-link):not(.btn-sm):not(.sig-icon-btn) { min-height: auto; } }
/* Botão Fechar (X) das modais e alertas: área de toque de 44 × 44 px no celular, com o ícone no mesmo tamanho. */
@media (max-width: 767.98px) { .btn-close { box-sizing: border-box; width: 44px; height: 44px; padding: 0; background-position: center; flex-shrink: 0; } }
/* Ficha de lançamento (impressão) */
.sig-print-body { background: #fff; }
.sig-sheet-block { border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .75rem; margin-bottom: .75rem; break-inside: avoid; }
@media print { .sig-no-print { display: none !important; } .sig-sheet-block { border-color: #999; } a[href]::after { content: none; } .sig-sheet-block .d-md-none { display: none !important; } .sig-sheet-block .d-md-block { display: block !important; } }
/* Cabeçalho com grupo de ações longas: empilha até 1199 px (o texto de introdução não fica espremido); a partir de 1200 px fica ao lado, sem quebrar os rótulos. */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .sig-page-header:has(> .sig-page-actions) { flex-direction: column; }
}
@media (min-width: 1200px) {
  .sig-page-header > .sig-page-actions { flex-shrink: 0; justify-content: flex-end; }
  .sig-page-actions .btn { white-space: nowrap; }
}

/* Seleção para ações em lote (D72 H1): área de toque de 44 × 44 px em volta da caixa de seleção. */
.sig-check-col { width: 3rem; padding-top: 0; padding-bottom: 0; }
.sig-check-hit { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; cursor: pointer; }
.sig-check { width: 1.25rem; height: 1.25rem; margin: 0; cursor: pointer; }
.border-dashed { border-style: dashed !important; }
/* Blocos recolhíveis (custo de pessoal, H8): seta que gira ao abrir, no lugar do marcador nativo. */
.sig-details > summary { list-style: none; cursor: pointer; }
.sig-details > summary::-webkit-details-marker { display: none; }
.sig-details-icon { transition: transform .15s ease-in-out; }
.sig-details[open] > summary .sig-details-icon { transform: rotate(180deg); }
