/* ============================================================
   ACC — Accounting Control Center
   Folha de estilos principal — Sessão 2
   ============================================================ */

:root {
    --verde:        #008A5E;
    --verde-escuro: #00674A;
    --verde-claro:  #E6F4EF;
    --cinza-texto:  #333333;
    --cinza-fundo:  #F5F5F5;
    --branco:       #FFFFFF;
    --erro:         #D32F2F;
    --aviso:        #F57C00;
    --sucesso:      #2E7D32;
    --borda:        #E0E0E0;

    /* Aliases internos */
    --cor-primaria:    var(--verde);
    --cor-primaria-h:  var(--verde-escuro);
    --cor-fundo:       var(--cinza-fundo);
    --cor-superficie:  var(--branco);
    --cor-borda:       var(--borda);
    --cor-texto:       var(--cinza-texto);
    --cor-texto-sub:   #6B7280;
    --cor-verde:       var(--sucesso);
    --cor-vermelho:    var(--erro);
    --cor-amarelo:     var(--aviso);
    --cor-azul-claro:  var(--verde-claro);
    --raio:            6px;
    --sombra:          0 1px 3px rgba(0,0,0,.08);
    --fonte:           'Segoe UI', Arial, sans-serif;
    --sidebar-w:       220px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea, optgroup { font-family: inherit; }

body {
    font-family: var(--fonte);
    font-size: 14px;
    color: var(--cor-texto);
    background: var(--cor-fundo);
    line-height: 1.5;
}

a { color: var(--cor-primaria); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   LAYOUT SIDEBAR
   ============================================================ */
.layout-sidebar {
    display: flex;
    min-height: 100vh;
}

.layout-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-w);
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--verde-escuro);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow: hidden;
    overscroll-behavior: contain;
    z-index: 200;
}

.sidebar-logo {
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-logo-link { text-decoration: none; }

.sidebar-logo-acc {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 1.1rem;
    font-weight: 400;
    color: #fff;
    letter-spacing: .06em;
    line-height: 1;
}

.sidebar-logo-sub {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,.6);
    margin-top: .2rem;
    line-height: 1.3;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: .75rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 2px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem 1rem;
    color: rgba(255,255,255,.75);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background .12s, color .12s;
    position: relative;
}

.sidebar-link:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.activo {
    background: rgba(255,255,255,.15);
    color: #fff;
    border-left: 3px solid #fff;
    padding-left: calc(1rem - 3px);
}

.sidebar-icon { font-size: 1rem; flex-shrink: 0; }

.sidebar-badge {
    margin-left: auto;
    background: var(--erro);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

.sidebar-sep {
    padding: .9rem 1rem .3rem;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.4);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1rem;
    border-top: 1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.15);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-footer-info { flex: 1; min-width: 0; }

.sidebar-footer-nome {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer-perfil {
    font-size: 10px;
    color: rgba(255,255,255,.55);
    text-transform: capitalize;
}

/* ---- Topbar ---- */
.topbar {
    background: var(--cor-superficie);
    border-bottom: 1px solid var(--cor-borda);
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--sombra);
}

.topbar-titulo {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cor-texto);
}

.topbar-accoes { display: flex; gap: .5rem; align-items: center; }

.topbar-input {
    padding: .4rem .65rem;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    font-size: 13px;
    font-family: var(--fonte);
    color: var(--cor-texto);
    background: var(--cor-superficie);
    transition: border-color .15s;
    width: 160px;
}
.topbar-input:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(0,138,94,.12);
}

/* ---- Page content ---- */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* Layout simples (login, erros) */
.layout-simples .main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ============================================================
   ALERTAS / FLASH
   ============================================================ */
.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-radius: var(--raio);
    margin-bottom: 1rem;
    font-size: 13px;
    transition: opacity .4s;
}

.alert-erro    { background: #FEECEC; color: #7F1515; border: 1px solid #F5C6CB; }
.alert-sucesso { background: #EBF5EB; color: #1A5E20; border: 1px solid #C8E6C9; }
.alert-info    { background: #E6F4EF; color: #004D3A; border: 1px solid #B2DFDB; }
.alert-aviso   { background: #FFF8E1; color: #7B5800; border: 1px solid #FFE082; }

.alert-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.2rem; line-height: 1; color: inherit; opacity: .6; padding: 0 0 0 .75rem;
}
.alert-close:hover { opacity: 1; }

.alertas-bloco { margin-bottom: 1.5rem; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .9rem;
    border-radius: var(--raio);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s, border-color .15s;
    line-height: 1.4;
}

.btn-sm { padding: .3rem .65rem; font-size: 12px; }

.btn-primario      { background: var(--verde); color: #fff; border-color: var(--verde); }
.btn-primario:hover { background: var(--verde-escuro); border-color: var(--verde-escuro); color: #fff; text-decoration: none; }

.btn-verde         { background: #2E7D32; color: #fff; border-color: #2E7D32; }
.btn-verde:hover   { background: #1B5E20; color: #fff; text-decoration: none; }

.btn-vermelho      { background: var(--erro); color: #fff; border-color: var(--erro); }
.btn-vermelho:hover { background: #B71C1C; color: #fff; text-decoration: none; }

.btn-secundario    { background: var(--cor-superficie); color: var(--cor-texto); border-color: var(--cor-borda); }
.btn-secundario:hover { background: var(--cor-fundo); }

.btn-ghost         { background: transparent; color: var(--cor-texto-sub); border-color: var(--cor-borda); }
.btn-ghost:hover   { background: var(--cor-fundo); text-decoration: none; }

.btn-block         { width: 100%; justify-content: center; }
.btn:disabled      { opacity: .55; cursor: not-allowed; }

.btn-logout {
    background: none;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: var(--raio);
    padding: 3px 8px;
    cursor: pointer;
    font-size: 11px;
    color: rgba(255,255,255,.7);
    white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header h2             { font-size: 1.3rem; font-weight: 600; }
.page-header small,
.page-header h2 small       { font-size: .75rem; color: var(--cor-texto-sub); margin-left: .5rem; font-weight: 400; }

/* ============================================================
   DASHBOARD — KPIs
   ============================================================ */
.kpis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--sombra);
}

.kpi-valor  { font-size: 2.2rem; font-weight: 700; line-height: 1; margin-bottom: .3rem; }
.kpi-label  { font-size: 12px; color: var(--cor-texto-sub); margin-bottom: .5rem; }
.kpi-link   { font-size: 12px; color: var(--verde); }

.kpi-azul     { color: #1565C0; }
.kpi-laranja  { color: #E65100; }
.kpi-verde    { color: var(--sucesso); }
.kpi-roxo     { color: #6A1B9A; }
.kpi-vermelho { color: #C62828; }

/* Dashboard actividade */
.actividade-lista { display: flex; flex-direction: column; gap: .35rem; }

.actividade-item {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    font-size: 13px;
    padding: .4rem .75rem;
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
}

.actividade-hora {
    font-variant-numeric: tabular-nums;
    color: var(--verde);
    font-weight: 600;
    white-space: nowrap;
    font-size: 12px;
}

.actividade-desc { flex: 1; }

/* Badges numéricos */
.badge-num {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.badge-azul   { background: #E3F2FD; color: #1565C0; }
.badge-laranja { background: #FFF3E0; color: #E65100; }
.badge-verde  { background: var(--verde-claro); color: var(--verde-escuro); }

/* ============================================================
   SECÇÕES GENÉRICAS
   ============================================================ */
.secao    { margin-bottom: 2rem; }
.secao h3 { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; }

/* ============================================================
   BADGES DE ESTADO
   ============================================================ */
.estado-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.estado-inbox             { background: #E3F2FD; color: #1565C0; }
.estado-em_processamento  { background: #FFF8E1; color: #7B5800; }
.estado-aguarda_aprovacao { background: #FFF3E0; color: #E65100; }
.estado-aprovado          { background: var(--verde-claro); color: var(--verde-escuro); }
.estado-exportado         { background: #E0F2F1; color: #004D40; }
.estado-reconciliado      { background: #F3E5F5; color: #6A1B9A; }
.estado-rejeitado         { background: #FEECEC; color: #7F1515; }
.estado-erro              { background: #FEECEC; color: #7F1515; }

.badge-qr   { background: #E3F2FD; color: #1565C0; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-ocr  { background: #FFF8E1; color: #7B5800; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-xml  { background: #fff3e0; color: #c25e00; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-csv  { background: #e8f4fd; color: #0369a1; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-xlsx { background: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-valido   { background: var(--verde-claro); color: var(--verde-escuro); padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.badge-invalido { background: #FEECEC; color: #7F1515; padding: 2px 6px; border-radius: 4px; font-size: 11px; }

/* ============================================================
   TABELAS
   ============================================================ */
.tabela {
    width: 100%;
    border-collapse: collapse;
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    overflow: hidden;
    box-shadow: var(--sombra);
    font-size: 13px;
}

.tabela th {
    background: var(--cinza-fundo);
    border-bottom: 1px solid var(--cor-borda);
    padding: .6rem .75rem;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: var(--cor-texto-sub);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.tabela td {
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--cor-borda);
    vertical-align: middle;
}

.tabela tbody tr:last-child td { border-bottom: none; }
.tabela tbody tr:hover { background: #FAFAFA; }

.tabela tfoot td {
    background: var(--cinza-fundo);
    border-top: 2px solid var(--cor-borda);
    font-size: 12px;
    padding: .6rem .75rem;
}

.tabela-totais td { font-weight: 500; }

.td-nome  { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-valor { text-align: right; font-variant-numeric: tabular-nums; }
.nif-sub  { display: block; color: var(--cor-texto-sub); font-size: 11px; }
.link-tabela { font-size: 12px; color: var(--verde); }
.acoes-cell { white-space: nowrap; }

/* ============================================================
   FILTROS
   ============================================================ */
.filtros-form { margin-bottom: 1.5rem; }

.filtros-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    padding: 1rem;
    box-shadow: var(--sombra);
}

/* ============================================================
   CAMPOS DE FORMULÁRIO
   ============================================================ */
.campo { display: flex; flex-direction: column; gap: .3rem; }
.campo label { font-size: 12px; font-weight: 500; color: var(--cor-texto-sub); }
.campo input, .campo select, .campo textarea {
    padding: .4rem .65rem;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    font-size: 13px;
    font-family: var(--fonte);
    color: var(--cor-texto);
    background: var(--cor-superficie);
    transition: border-color .15s;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(0,138,94,.12);
}

.campo-accao { flex-direction: row; gap: .5rem; align-items: flex-end; }

/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.paginacao {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 13px;
    color: var(--cor-texto-sub);
}

/* ============================================================
   BARRA ACÇÕES EM LOTE
   ============================================================ */
.lote-barra {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--verde-claro);
    border: 1px solid var(--verde);
    border-radius: var(--raio);
    padding: .6rem 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.lote-info {
    font-size: 13px;
    font-weight: 600;
    color: var(--verde-escuro);
}

/* ============================================================
   UPLOAD / DROP ZONE
   ============================================================ */
.drop-zone {
    border: 2px dashed var(--cor-borda);
    border-radius: var(--raio);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--cor-superficie);
    margin-bottom: 1rem;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--verde);
    background: var(--verde-claro);
}

.drop-zone-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.drop-zone p    { color: var(--cor-texto-sub); margin-bottom: .25rem; }
.drop-zone-sub  { font-size: 12px; }
.link-upload    { color: var(--verde); cursor: pointer; }

.ficheiros-lista { margin-bottom: 1rem; }
.ficheiro-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .5rem .75rem;
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    margin-bottom: .4rem;
    font-size: 13px;
}

.ficheiro-nome     { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficheiro-tamanho  { color: var(--cor-texto-sub); font-size: 12px; white-space: nowrap; }

.btn-remover {
    background: none; border: none; cursor: pointer;
    color: var(--cor-texto-sub); font-size: 1.1rem; line-height: 1; padding: 0 4px;
}
.btn-remover:hover { color: var(--erro); }

.resultados { margin-top: 1.5rem; }
.resultado-item {
    padding: .6rem .9rem; border-radius: var(--raio);
    margin-bottom: .4rem; font-size: 13px;
}
.resultado-ok    { background: var(--verde-claro); border: 1px solid #A5D6A7; color: #1B5E20; }
.resultado-erro  { background: #FEECEC; border: 1px solid #F5C6CB; color: #7F1515; }
.resultado-aviso { background: #FFF8E1; border: 1px solid #FFE082; color: #7B5800; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 500;
    padding: 1rem;
}

.modal-box {
    background: var(--cor-superficie);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--cor-borda);
}

.modal-header h3 { font-size: 1rem; font-weight: 600; }

.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.4rem; line-height: 1; color: var(--cor-texto-sub);
}
.modal-close:hover { color: var(--cor-texto); }

.modal-body { padding: 1.25rem; }

/* ============================================================
   LOGIN
   ============================================================ */
.body-login {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--cor-fundo);
}

.login-wrapper { width: 100%; max-width: 380px; padding: 1rem; margin: 0 auto; }

.login-card {
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-header h1 { font-family: 'Press Start 2P', monospace; font-size: 1.5rem; font-weight: 400; color: var(--verde); }
.login-header p  { color: var(--cor-texto-sub); font-size: 13px; margin-top: .25rem; }
.login-header small { color: var(--cor-texto-sub); font-size: 11px; }

.login-form .campo { margin-bottom: 1rem; }
.login-form .campo input { width: 100%; }
.login-form .btn-block { margin-top: .5rem; padding: .65rem; font-size: 14px; }

/* ============================================================
   DOCUMENTO DETALHE / SHOW
   ============================================================ */
.doc-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

.pdf-viewer {
    width: 100%;
    height: 800px;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    background: #fff;
}

.pdf-indisponivel {
    height: 200px;
    display: flex; align-items: center; justify-content: center;
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    color: var(--cor-texto-sub);
    font-size: 13px;
}

.pdf-meta { color: var(--cor-texto-sub); }

.doc-info-panel { display: flex; flex-direction: column; gap: 1rem; }

.doc-secao {
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    padding: 1rem;
    box-shadow: var(--sombra);
}

.doc-secao h3 {
    font-size: 11px; font-weight: 700;
    margin-bottom: .75rem;
    color: var(--cor-texto-sub);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.dl-info {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: .4rem .75rem;
    font-size: 13px;
}
.dl-info dt { color: var(--cor-texto-sub); }
.dl-info dd { font-weight: 500; }

.dl-valores .valor-total { font-size: 1.1rem; font-weight: 700; color: var(--cor-texto); }

.tabela-lancamentos { font-size: 12px; }

/* ============================================================
   APROVAÇÃO — LAYOUT DOIS PAINÉIS
   ============================================================ */
.aprovar-layout {
    display: grid;
    grid-template-columns: 55% 45%;
    gap: 1.5rem;
    align-items: start;
}

.aprovar-pdf  { position: sticky; top: 68px; }
.aprovar-info { display: flex; flex-direction: column; gap: 1rem; }

.class-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

/* Preview lançamento */
#preview-lanc { font-size: 12px; }

/* ============================================================
   ERRO 404
   ============================================================ */
.body-erro { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.erro-wrapper { text-align: center; }
.erro-wrapper h1 { font-size: 5rem; font-weight: 700; color: var(--cor-borda); }
.erro-wrapper p  { color: var(--cor-texto-sub); margin: .75rem 0 1.5rem; }

/* ============================================================
   ESTADOS VAZIOS E UTILITÁRIOS
   ============================================================ */
.estado-vazio {
    padding: 3rem; text-align: center;
    color: var(--cor-texto-sub);
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    font-size: 13px;
}

.text-muted { color: var(--cor-texto-sub); }

code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: var(--cinza-fundo);
    padding: 1px 5px;
    border-radius: 3px;
}

/* ============================================================
   ESTATÍSTICAS (compatibilidade dashboard v1)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--sombra);
}

.stat-valor        { font-size: 2rem; font-weight: 700; color: var(--cor-texto); }
.stat-label        { font-size: 12px; color: var(--cor-texto-sub); margin-top: .25rem; }
.stat-destaque .stat-valor { color: var(--verde); }
.stat-verde .stat-valor    { color: var(--sucesso); }
.stat-vermelho .stat-valor { color: var(--erro); }

.estado-lista { display: flex; flex-wrap: wrap; gap: .5rem; }
.estado-item  { display: flex; align-items: center; gap: .5rem; font-size: 13px; }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 1024px) {
    .kpis-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .layout-sidebar { flex-direction: column; }
    .sidebar { position: relative; width: 100%; height: auto; }
    .layout-main { margin-left: 0; }
    .doc-layout, .aprovar-layout { grid-template-columns: 1fr; }
    .pdf-viewer { height: 500px; }
    .aprovar-pdf { position: relative; top: auto; }
    .kpis-grid { grid-template-columns: repeat(2, 1fr); }
    .class-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .kpis-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 1rem; }
}

/* ============================================================
   F7 — RELATÓRIOS: BARRAS HORIZONTAIS
   ============================================================ */
.barras-horiz { display:flex; flex-direction:column; gap:6px; }

.barra-linha {
    display:grid;
    grid-template-columns:160px 1fr 80px;
    gap:8px;
    align-items:center;
    font-size:13px;
}

.barra-label {
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    color:var(--cor-texto);
}

.barra-bar {
    height:18px;
    background:#f0f0f0;
    border-radius:4px;
    overflow:hidden;
}

.barra-fill {
    height:100%;
    border-radius:4px;
    transition:width .3s ease;
    min-width:2px;
}

.barra-valor {
    text-align:right;
    font-weight:600;
    font-size:12px;
    white-space:nowrap;
}

.barra-sub {
    display:block;
    font-size:10px;
    color:var(--cor-texto-sub);
    font-weight:normal;
}

/* ============================================================
   F7 — RELATÓRIOS: SPARKLINE
   ============================================================ */
.sparkline-vazio {
    color:var(--cor-texto-sub);
    font-size:18px;
    line-height:1;
}

/* ============================================================
   F7 — DASHBOARD EXPANDIDO: LINHA DE PRODUTIVIDADE
   ============================================================ */
.dashboard-produtividade {
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:16px;
    margin-bottom:20px;
}

.card-produtividade {
    background:var(--cor-superficie);
    border-radius:var(--raio);
    padding:16px;
    border:1px solid var(--cor-borda);
    box-shadow:var(--sombra);
}

.produtividade-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:12px;
}

.produtividade-header h3 {
    font-size:12px;
    color:var(--cor-texto-sub);
    font-weight:600;
    margin:0;
    text-transform:uppercase;
    letter-spacing:.04em;
}

.link-relatorio {
    font-size:11px;
    color:var(--verde);
    text-decoration:none;
    white-space:nowrap;
}
.link-relatorio:hover { text-decoration:underline; }

.produtividade-foot {
    margin-top:8px;
    display:flex;
    align-items:baseline;
    gap:6px;
}

.kpi-grande {
    font-size:24px;
    font-weight:700;
    color:var(--cor-texto);
}

.kpi-sub {
    font-size:11px;
    color:var(--cor-texto-sub);
}

.taxa-grande {
    font-size:32px;
    font-weight:700;
    text-align:center;
    padding:8px 0;
    line-height:1;
}

.estado-vazio-mini {
    color:var(--cor-texto-sub);
    font-size:12px;
    text-align:center;
    padding:12px 0;
}

/* ============================================================
   F7 — RELATÓRIOS: FILTRO INLINE E TABELA COMPACTA
   ============================================================ */
.filtro-inline {
    display:flex;
    align-items:center;
    gap:.6rem;
    font-size:13px;
}

.filtro-inline label { color:var(--cor-texto-sub); font-weight:500; }

.filtro-inline select {
    padding:.3rem .6rem;
    border:1px solid var(--cor-borda);
    border-radius:var(--raio);
    font-size:13px;
    font-family:var(--fonte);
    color:var(--cor-texto);
    background:var(--cor-superficie);
    cursor:pointer;
}
.filtro-inline select:focus {
    outline:none;
    border-color:var(--verde);
}

.tabela-compacta th, .tabela-compacta td {
    padding:.45rem .65rem;
}

/* ============================================================
   SIDEBAR: GRUPOS COLAPSÁVEIS
   ============================================================ */
.sidebar-grupo {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sidebar-grupo-row {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.sidebar-grupo-row .sidebar-link {
    flex: 1;
    min-width: 0;
}

.sidebar-chevron-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.38);
    padding: 0 .65rem;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: color .12s, transform .2s;
}
.sidebar-chevron-btn:hover { color: rgba(255,255,255,.75); }
.sidebar-grupo.aberto .sidebar-chevron-btn { transform: rotate(90deg); }

.sidebar-grupo-sub {
    display: none;
    flex-direction: column;
    width: 100%;
    background: rgba(0,0,0,.12);
    padding: .25rem 0;
    overflow: hidden;
}
.sidebar-grupo.aberto .sidebar-grupo-sub {
    display: flex;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem 1rem .4rem 1.5rem;
    color: rgba(255,255,255,.6);
    font-size: 12px;
    font-weight: 400;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    transition: background .12s, color .12s;
}
.sidebar-sublink:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    text-decoration: none;
}
.sidebar-sublink.activo {
    color: #fff;
    font-weight: 600;
    background: rgba(255,255,255,.08);
}

.sub-ind {
    flex-shrink: 0;
    opacity: .4;
    font-size: 12px;
    line-height: 1;
}

/* ============================================================
   F7 — RESPONSIVO ADICIONADO
   ============================================================ */
@media (max-width: 900px) {
    .dashboard-produtividade { grid-template-columns:1fr; }
    .barra-linha { grid-template-columns:120px 1fr 60px; }
}

@media (max-width: 600px) {
    .dashboard-produtividade { grid-template-columns:1fr; }
}

/* ============================================================
   ETIQUETAS
   ============================================================ */
.etiqueta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    border: 1px solid transparent;
    white-space: nowrap;
}

.etiqueta-chip-remover {
    background: none;
    border: none;
    padding: 0 0 0 2px;
    cursor: pointer;
    opacity: .55;
    line-height: 1;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
}
.etiqueta-chip-remover:hover { opacity: 1; }

.etiquetas-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 26px;
    align-items: center;
}

.etiqueta-picker-wrap {
    position: relative;
    margin-top: 8px;
}

.etiqueta-picker-input {
    width: 100%;
    padding: .4rem .65rem;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    font-size: 13px;
    font-family: var(--fonte);
    color: var(--cor-texto);
    background: var(--cor-superficie);
    transition: border-color .15s;
}
.etiqueta-picker-input:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(0,138,94,.12);
}

.etiqueta-sugestoes {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: var(--cor-superficie);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    z-index: 300;
    max-height: 220px;
    overflow-y: auto;
}
.etiqueta-sugestao-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: .45rem .75rem;
    cursor: pointer;
    font-size: 13px;
    transition: background .1s;
}
.etiqueta-sugestao-item:hover { background: var(--cor-fundo); }

.etiqueta-sugestao-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.etiqueta-criar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: .45rem .75rem;
    cursor: pointer;
    font-size: 13px;
    color: var(--verde);
    font-weight: 600;
    border-top: 1px solid var(--cor-borda);
    transition: background .1s;
}
.etiqueta-criar-btn:hover { background: var(--verde-claro); }

/* ============================================================
   ANEXOS / DROP ZONE
   ============================================================ */
.drop-zone {
    border: 2px dashed var(--cor-borda);
    border-radius: var(--raio);
    padding: 20px;
    text-align: center;
    color: var(--cor-texto-sub);
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-top: 10px;
    position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--verde);
    background: var(--verde-claro);
    color: var(--verde-escuro);
}
.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.drop-zone-icon { margin-bottom: 6px; }
.drop-zone-texto { font-weight: 500; }
.drop-zone-sub { font-size: 11px; opacity: .7; margin-top: 3px; }

.anexos-lista {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
}

.anexo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--cor-fundo);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    font-size: 12px;
}
.anexo-item-nome {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.anexo-item-meta { color: var(--cor-texto-sub); white-space: nowrap; }
.anexo-item-acoes { display: flex; gap: 4px; }

.anexo-item-loading {
    opacity: .6;
    pointer-events: none;
}

/* ============================================================
   SECÇÕES OPCIONAIS COLAPSÁVEIS (aprovar.php)
   ============================================================ */
.secao-opcional {
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    margin-bottom: 12px;
    position: relative;
}

.secao-opcional-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    cursor: pointer;
    background: var(--cor-fundo);
    font-size: 13px;
    font-weight: 600;
    color: var(--cor-texto);
    user-select: none;
    transition: background .12s;
    border: none;
    width: 100%;
    text-align: left;
    border-radius: var(--raio) var(--raio) 0 0;
}
.secao-opcional-header:hover { background: #ebebeb; }

.secao-opcional-badge {
    margin-left: auto;
    background: var(--verde);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

.secao-opcional-body {
    padding: 12px 14px;
    border-top: 1px solid var(--cor-borda);
    background: var(--cor-superficie);
    border-radius: 0 0 var(--raio) var(--raio);
    overflow: visible;
}
