/* =============================================================
   BOTÕES DE AÇÃO — Visualizar / Editar / Excluir
   Padrão corporativo: discreto, minimalista, acessível
   ============================================================= */

.btn-action {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0 !important;
    border: none !important;
    border-radius: 6px;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none !important;
    line-height: 1;
    vertical-align: middle;
}

/* Visualizar — cinza neutro */
.btn-action.btn-action-view {
    color: #7a8fa0 !important;
}
.btn-action.btn-action-view:hover,
.btn-action.btn-action-view:focus {
    color: #4a6275 !important;
    background-color: rgba(122, 143, 160, 0.12) !important;
    outline: none;
}

/* Editar — azul */
.btn-action.btn-action-edit {
    color: #2e7bc4 !important;
}
.btn-action.btn-action-edit:hover,
.btn-action.btn-action-edit:focus {
    color: #1a5a9a !important;
    background-color: rgba(46, 123, 196, 0.12) !important;
    outline: none;
}

/* Excluir — vermelho suave */
.btn-action.btn-action-delete {
    color: #c0524a !important;
}
.btn-action.btn-action-delete:hover,
.btn-action.btn-action-delete:focus {
    color: #922e28 !important;
    background-color: rgba(192, 82, 74, 0.11) !important;
    outline: none;
}

/* Grupo de ações — espaçamento confortável entre ícones */
.acoes-grupo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* =============================================================
   BOTÕES LEGADOS — manter compatibilidade
   ============================================================= */

/* ===== Open Sans Font ===== */
@font-face {
    font-family: 'Open Sans';
    src: url('/fonts/opensans-regular.woff') format('woff');
}

/* ===== Base Body ===== */
body {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    color: var(--bs-body-color);
}

/* =============================================================
   HEADER FIXO — estilo PJe
   ============================================================= */

:root {
    --header-bg:        #0078AA;
    --header-height:    58px;
    --header-color:     #fff;
    --header-hover-bg:  rgba(255,255,255,0.12);
    --header-avatar-bg: #fff;
    --header-avatar-fg: #0078AA;
    --sidebar-width:    280px;
    --subnav-height:    44px;
}

.app-header.navtop,
nav.app-header.navtop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1050 !important;
    height: calc(var(--header-height) + var(--subnav-height)) !important;
    min-height: calc(var(--header-height) + var(--subnav-height)) !important;
    max-height: calc(var(--header-height) + var(--subnav-height)) !important;
    background: var(--header-bg) !important;
    border-bottom: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
    display: block !important;
    flex-wrap: unset !important;
}

.navtop-inner {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: var(--header-height) !important;
    width: 100% !important;
    padding: 0 16px !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* ── Subnav ── */
.navtop-subnav {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    height: var(--subnav-height) !important;
    width: 100% !important;
    padding: 0 16px !important;
    background: var(--bs-body-bg) !important;
    border-bottom: 2px solid var(--bs-border-color) !important;
    gap: 0;
    overflow-x: auto;
}
.navtop-subnav-link {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: 10px 12px;
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--bs-secondary-color) !important;
    text-decoration: none;
    text-transform: uppercase;
    line-height: 24px;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}
.navtop-subnav-link:hover  { color: #0078AA !important; border-bottom-color: #0078AA; }
.navtop-subnav-link.active { color: #0078AA !important; border-bottom-color: #0078AA; font-weight: 700; }

/* ── Lado esquerdo ── */
.navtop-left {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: nowrap !important;
}

.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    color: var(--header-color);
    font-size: 1.3rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: var(--header-hover-bg); }

.navtop-brand { display: flex; align-items: center; text-decoration: none; margin-right: 4px; }
.navtop-brand-text { color: var(--header-color); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; }

.navtop-page-sep   { color: rgba(255,255,255,0.4); font-size: 1.1rem; font-weight: 300; margin: 0 8px; line-height: 1; }
.navtop-page-title { color: rgba(255,255,255,0.9); font-size: 0.95rem; font-weight: 400; white-space: nowrap; letter-spacing: 0.2px; }

.navtop-links { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.navtop-link  { color: var(--header-color) !important; text-decoration: none; font-size: 0.875rem; padding: 6px 10px; border-radius: 4px; transition: background 0.15s; white-space: nowrap; }
.navtop-link:hover { background: var(--header-hover-bg); color: var(--header-color) !important; }

/* ── Lado direito ── */
.navtop-right {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: nowrap !important;
}

.ultimo-acesso { color: rgba(255,255,255,0.85); font-size: 0.78rem; white-space: nowrap; margin-right: 4px; }

.navtop-action     { position: relative; }
.navtop-action-btn { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: var(--header-color) !important; font-size: 1rem; border-radius: 4px; text-decoration: none; position: relative; transition: background 0.15s; }
.navtop-action-btn:hover { background: var(--header-hover-bg); color: var(--header-color) !important; }

.navtop-badge { position: absolute; top: 3px; right: 2px; background: #dc3545; color: #fff; font-size: 0.6rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; line-height: 1; pointer-events: none; }

.navtop-avatar-btn { display: flex !important; flex-direction: row !important; align-items: center !important; gap: 10px; padding: 4px 8px; border-radius: 4px; text-decoration: none; color: var(--header-color) !important; transition: background 0.15s; }
.navtop-avatar-btn::after { display: none !important; }
.navtop-avatar-btn:hover  { background: var(--header-hover-bg); }

.navtop-user-info { display: flex !important; flex-direction: column !important; align-items: flex-end !important; justify-content: center !important; line-height: 1.3; gap: 1px; }
.navtop-username   { display: block !important; font-size: 0.9rem; font-weight: 700; color: #fff !important; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.navtop-last-access { display: block !important; font-size: 0.7rem; color: rgba(255,255,255,0.8) !important; white-space: nowrap; line-height: 1.2; }

.navtop-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--header-avatar-bg); color: var(--header-avatar-fg); font-size: 0.9rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 2px solid rgba(255,255,255,0.5); position: relative; }
.navtop-avatar::after { content: ''; position: absolute; bottom: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: #f0a500; border: 2px solid var(--header-bg); }

/* ── Dropdowns ── */
.notif-dropdown { min-width: 340px; max-width: 340px; padding: 0; overflow: hidden; }
.notif-header   { padding: 10px 14px; font-size: 0.85rem; font-weight: 600; color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
/* Lista rolável: mantém header, abas e "Ver todas" sempre visíveis mesmo com muitas notificações */
.notif-list { max-height: 360px; overflow-y: auto; }
/* Abas Minhas/Gestão dentro do dropdown */
.notif-tabs { padding: 0 8px; gap: 4px; flex-wrap: nowrap; }
.notif-tabs .nav-link { padding: 6px 10px; font-size: 0.8rem; color: var(--bs-secondary-color); border: 0; border-bottom: 2px solid transparent; }
.notif-tabs .nav-link.active { color: #0078AA; border-bottom-color: #0078AA; background: transparent; font-weight: 600; }
.notif-tab-badge { font-size: 0.7rem; }
.notif-item     { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; white-space: normal; }
.notif-item.notif-unread { background: var(--bs-secondary-bg); }
.notif-item:hover        { background: var(--bs-secondary-bg); }
.notif-icon  { font-size: 1rem; color: #0078AA; margin-top: 2px; flex-shrink: 0; }
.notif-body  { flex: 1; min-width: 0; }
.notif-title { font-size: 0.82rem; font-weight: 600; color: var(--bs-body-color); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-msg   { font-size: 0.78rem; color: var(--bs-secondary-color); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-time  { font-size: 0.72rem; color: var(--bs-secondary-color); margin-top: 2px; }
.notif-footer { padding: 9px; font-size: 0.82rem; border-top: 1px solid var(--bs-border-color); color: #0078AA; }
.notif-footer:hover { background: var(--bs-secondary-bg); }

.usuario-dropdown        { min-width: 260px; padding: 0; overflow: hidden; }
.usuario-dropdown-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bs-tertiary-bg); }
.usuario-avatar-lg { width: 48px; height: 48px; border-radius: 50%; background: var(--header-bg); color: #fff; font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.usuario-info  { min-width: 0; }
.usuario-name  { font-weight: 600; font-size: 0.9rem; color: var(--bs-body-color); }
.usuario-email { font-size: 0.78rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-dropdown .dropdown-item:hover { background: var(--bs-secondary-bg); }
.usuario-dropdown .dropdown-item.text-danger:hover { background: var(--bs-secondary-bg); color: #dc3545 !important; }

/* ── Seletor de escritório ── */
.escritorio-dropdown { min-width: 260px; max-width: 320px; padding: 6px 0; }
.escritorio-dropdown form { margin: 0; }
.escritorio-dropdown .dropdown-item.active,
.escritorio-dropdown .dropdown-item.active:hover { background: var(--bs-secondary-bg); font-weight: 600; color: var(--bs-body-color); }
.navtop-escritorio-nome { font-size: 0.9rem; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =============================================================
   NEUTRALIZA O ADMINLTE 4
   Zeramos tudo que ele usa para empurrar conteúdo / mostrar
   sidebar automaticamente em telas grandes (sidebar-expand-lg).
   ============================================================= */

/* Remove o pseudo-elemento que o AdminLTE usa para detectar breakpoint */
.sidebar-expand-lg::before { display: none !important; content: '' !important; }

/* Anula margens que o AdminLTE injeta quando sidebar está "aberto" no body */
body .app-wrapper,
body .app-main,
body .content-wrapper {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Anula qualquer transform do AdminLTE no .app-sidebar */
body .app-sidebar {
    transform: none !important;
    margin-left: 0 !important;
}

/* =============================================================
   SIDEBAR — overlay fixo, sempre retraído por padrão
   ============================================================= */

.app-sidebar.pje-sidebar {
    position: fixed !important;
    top: calc(var(--header-height) + var(--subnav-height)) !important;
    left: 0 !important;
    height: calc(100vh - var(--header-height) - var(--subnav-height)) !important;
    width: var(--sidebar-width) !important;
    z-index: 1040 !important;
    background: var(--bs-body-bg) !important;
    border-right: 1px solid var(--bs-border-color) !important;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: 'Open Sans', Arial, sans-serif;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;

    /* FECHADO por padrão */
    transform: translateX(-100%) !important;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform;
}

/* ABERTO — classe adicionada pelo JS do _sidebar.html.twig */
.app-sidebar.pje-sidebar.sidebar-open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.18) !important;
}

/* Sobrescreve cor do tema dark do AdminLTE */
.app-sidebar.pje-sidebar,
.app-sidebar.pje-sidebar * { color: var(--bs-body-color); }

/* ── Busca rápida ── */
.pje-sidebar-search { position: relative; padding: 10px 12px 8px; border-bottom: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.pje-search-input-group { display: flex; align-items: center; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 3px; overflow: hidden; height: 34px; }
.pje-search-icon  { display: flex; align-items: center; justify-content: center; width: 34px; color: var(--bs-secondary-color); font-size: 0.85rem; flex-shrink: 0; }
.pje-search-input { flex: 1; border: none; outline: none; font-family: 'Open Sans', Arial, sans-serif; font-size: 13px; color: var(--bs-body-color); background: transparent; padding: 0 8px 0 0; }
.pje-search-input::placeholder { color: var(--bs-secondary-color); }

.pje-search-results { position: absolute; top: calc(100% - 8px); left: 12px; right: 12px; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-top: none; border-radius: 0 0 3px 3px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 10; max-height: 220px; overflow-y: auto; }
.pje-search-list { list-style: none; margin: 0; padding: 0; }
.pje-search-list li a { display: block; padding: 8px 12px; font-size: 13px; color: var(--bs-body-color); text-decoration: none; border-bottom: 1px solid var(--bs-border-color); transition: background 0.15s; }
.pje-search-list li a:hover { background: var(--bs-secondary-bg); color: #0078AA; }
.pje-search-empty { padding: 10px 12px; font-size: 13px; color: var(--bs-secondary-color); }

/* ── Menu ── */
.pje-menu-wrapper { padding: 4px 0; }
.pje-menu-list    { list-style: none; margin: 0; padding: 0; }

.pje-menu-separator { padding: 12px 16px 4px; font-size: 11px; font-weight: 700; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: 0.6px; border-top: 1px solid var(--bs-border-color); margin-top: 4px; }
.pje-menu-separator:first-child { border-top: none; margin-top: 0; }

.pje-menu-item { margin: 0; }
.pje-menu-link { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-family: 'Open Sans', Arial, sans-serif; font-size: 13px; color: var(--bs-body-color) !important; text-decoration: none !important; border-left: 3px solid transparent; transition: background 0.15s, color 0.15s, border-color 0.15s; line-height: 1.3; }
.pje-menu-link:hover  { background: var(--bs-secondary-bg); color: #0078AA !important; border-left-color: #b3d9ee; }
.pje-menu-link.active { background: var(--bs-secondary-bg); color: #0078AA !important; border-left-color: #0078AA; font-weight: 600; }

.pje-nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; color: #6c8fa8; }
.pje-menu-link.active .pje-nav-icon,
.pje-menu-link:hover  .pje-nav-icon { color: #0078AA; }

.app-sidebar.pje-sidebar::-webkit-scrollbar       { width: 4px; }
.app-sidebar.pje-sidebar::-webkit-scrollbar-thumb { background: var(--bs-border-color); border-radius: 2px; }
.app-sidebar.pje-sidebar::-webkit-scrollbar-track { background: transparent; }

/* =============================================================
   LAYOUT PRINCIPAL
   ============================================================= */

.app-wrapper {
    padding-top: calc(var(--header-height) + var(--subnav-height)) !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
}

.app-main,
.content-wrapper {
    margin-left: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-left: 0 !important;
}

/* Backdrop */
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 1039; background: rgba(0,0,0,0.35); cursor: pointer; }
.sidebar-backdrop.active { display: block; }

/* =============================================================
   LOGIN
   ============================================================= */
.no-sidebar { min-height: 100vh; }

.login-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; background: var(--bs-tertiary-bg); }
.login-container { background: var(--bs-body-bg); border-radius: 0.5rem; box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15); padding: 2rem; width: 100%; max-width: 420px; }
.login-container h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.75rem; font-weight: 600; }
.btn-login   { width: 100%; }
.extra-links { text-align: center; margin-top: 1rem; font-size: 0.9rem; }
.extra-links a { text-decoration: none; }
.extra-links a:hover { text-decoration: underline; }

/* =============================================================
   TABELAS
   ============================================================= */
.table-fixed          { table-layout: fixed; width: 100%; }
.table-fixed thead th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.table-fixed tbody td { overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.col-acoes  { width: 140px !important; text-align: center !important; }
.btn-acoes  { display: flex; gap: 4px; justify-content: center; flex-wrap: nowrap; }

/* =============================================================
   CARDS DE TAREFA
   ============================================================= */
.tarefa-card { border-left: 4px solid var(--bs-secondary-color); }
.tarefa-card:hover { box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15); transform: translateY(-2px); border-color: var(--bs-primary); }

/* =============================================================
   INFO BOX
   ============================================================= */
.info-box         { min-height: 80px; padding: 1rem; border-radius: 0.5rem; margin-bottom: 1rem; }
.info-box-content { display: flex; flex-direction: column; justify-content: center; }
.info-box-text    { font-size: 0.875rem; text-transform: uppercase; }
.info-box-number  { font-size: 1.5rem; font-weight: 700; }

/* =============================================================
   POST / ACTIVITY
   ============================================================= */
.post { border-bottom: 1px solid var(--bs-border-color); margin-bottom: 15px; padding-bottom: 15px; }
.post:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.user-block { position: relative; padding-left: 50px; min-height: 40px; }
.user-block .img-circle,
.user-block > span:first-child { position: absolute; left: 0; top: 0; border-radius: 50%; }
.user-block .img-bordered-sm   { border: 2px solid var(--bs-border-color); }
.user-block .username          { display: block; font-size: 1rem; font-weight: 600; margin-top: -2px; }
.user-block .username a        { color: var(--bs-body-color); text-decoration: none; }
.user-block .username a:hover  { color: var(--bs-primary); }
.user-block .description       { display: block; font-size: 0.85rem; color: var(--bs-secondary-color); margin-top: 2px; }
.user-block .comment           { margin-left: 50px; }

/* =============================================================
   AJUSTES FINOS DO TEMA ESCURO
   Só o que não tem variável Bootstrap perfeita; o resto inverte
   sozinho via var(--bs-*). Marca/status permanecem.
   ============================================================= */
/* Hover do "Sair": rosa-claro fixo estoura no escuro → vermelho translúcido */
html[data-bs-theme="dark"] .usuario-dropdown .dropdown-item.text-danger:hover {
    background: rgba(220, 53, 69, 0.18);
}

/* .table-light (cabeçalhos de tabela) não inverte sozinho → adapta as vars do Bootstrap */
html[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--bs-tertiary-bg);
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
}

/* =============================================================
   SELECT2 — tema-aware + alinhado ao .form-select do Bootstrap
   O Select2 substitui o <select> por um widget próprio com cores
   fixas (fundo branco/borda cinza) que NÃO seguem o dark/light e
   destoam dos campos nativos. Aqui igualamos ao form-select nos
   dois temas via var(--bs-*). (Ex.: "Sigla do Tribunal".)
   ============================================================= */
.select2-container--default .select2-selection--single {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    height: calc(1.5em + .75rem + 2px);
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--bs-body-color);
    line-height: normal;
    padding-left: .75rem;
    padding-right: 2rem;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--bs-secondary-color);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: .5rem;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--bs-secondary-color) transparent transparent transparent;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
    outline: 0;
}
.select2-dropdown,
.select2-container--default .select2-dropdown {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    border-radius: .25rem;
}
.select2-container--default .select2-results__option {
    color: var(--bs-body-color);
}
.select2-container--default .select2-results__option--highlighted {
    background-color: #0078AA;
    color: #fff;
}
.select2-container--default .select2-results__option[aria-selected=true],
.select2-container--default .select2-results__option[data-selected=true] {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}
.select2-container--default .select2-results__group {
    color: var(--bs-secondary-color);
    font-weight: 600;
}