/* Reset e Variáveis Modernas */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #374151;
    --primary-dark: #1f2937;
    --primary-light: #4b5563;
    --secondary: #6b7280;
    --accent: #9ca3af;
    --success: #059669;
    --warning: #d97706;
    --orange: #ea580c;
    --danger: #dc2626;
    --info: #0284c7;
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-light: #6b7280;
    
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f3f4f6;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navbar Moderna */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.logo-spitz {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -1rem;
    padding-bottom: calc(0.625rem + 1rem);
}

.nav-menu a:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}

.nav-menu a.active {
    color: var(--primary);
    background: var(--bg-tertiary);
    border-bottom-color: var(--orange);
}

.nav-user {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    padding: 0 0.5rem;
}

.nav-logout {
    color: var(--danger) !important;
    border-bottom-color: transparent !important;
}

.nav-logout:hover {
    background: #fef2f2 !important;
    color: var(--danger) !important;
}

/* Main Content */
.main-content {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 80px);
}

/* Card Principal Unificado */
.main-card {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Campo de Busca */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Container Principal: Tabela e Filtros */
.main-content-wrapper {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.table-section {
    flex: 1;
    min-width: 0; /* Permite que a tabela encolha */
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 3rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    font-family: 'Inter', sans-serif;
}

.search-box.has-clear-button .search-input {
    padding-right: 3.5rem;
}

.btn-limpar-busca {
    position: absolute;
    right: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    z-index: 2;
}

.btn-limpar-busca:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-limpar-busca svg {
    display: block;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(55, 65, 81, 0.1);
}

.search-box:focus-within .search-icon {
    color: var(--primary);
}

/* Filtros Sidebar */
.filters-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: sticky;
    top: 1rem;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.filters-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.filter-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-separator {
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.5;
}

.btn-marcar-todos,
.btn-desmarcar-todos {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    opacity: 0.7;
}

.btn-marcar-todos:hover,
.btn-desmarcar-todos:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
    opacity: 1;
    transform: scale(1.1);
}

.btn-marcar-todos:active,
.btn-desmarcar-todos:active {
    transform: scale(0.95);
}

.btn-marcar-todos svg,
.btn-desmarcar-todos svg {
    width: 16px;
    height: 16px;
    display: block;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.checkbox-label:hover {
    background: var(--bg-tertiary);
}

.filtro-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.checkbox-label span {
    flex: 1;
}

.btn-limpar-filtros {
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-limpar-filtros:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-limpar-filtros:active {
    transform: translateY(1px);
}

@media (max-width: 1024px) {
    .main-content-wrapper {
        flex-direction: column;
    }
    
    .filters-sidebar {
        width: 100%;
        min-width: 100%;
        position: static;
    }
    
    .table-section {
        width: 100%;
    }
}

.search-input::placeholder {
    color: var(--text-light);
}

.btn-search {
    padding: 1rem 2.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-search:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-search:active {
    transform: translateY(0);
}

/* Search Results */
.search-results {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results.show {
    display: block;
}

.search-results.success {
    background: #f0fdf4;
    border-left: 4px solid var(--success);
}

.search-results.error {
    background: #fef2f2;
    border-left: 4px solid var(--danger);
}

.search-results .result-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--text-secondary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.search-results .result-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

/* Contador de Processos */
.processos-count-wrapper {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.processos-count {
    background: var(--text-secondary);
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-top: 0;
}

/* Tabela de Modelos: sem scroll horizontal, colunas proporcionais */
.table-wrapper-modelos {
    overflow-x: visible;
    overflow: hidden;
}
.table-wrapper-modelos #tabela-modelos {
    table-layout: fixed;
    width: 100%;
}
.table-wrapper-modelos #tabela-modelos .col-modelo,
.table-wrapper-modelos #tabela-modelos th.col-modelo,
.table-wrapper-modelos #tabela-modelos td.col-modelo {
    width: 100%;
    min-width: 0;
    max-width: none;
    vertical-align: top;
}
.table-wrapper-modelos #tabela-modelos td.col-modelo {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}
.table-wrapper-modelos #tabela-modelos .modelo-titulo-line {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.table-wrapper-modelos #tabela-modelos .btn-favorito-modelo {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: transform 0.15s ease, color 0.15s ease;
}
.table-wrapper-modelos #tabela-modelos .btn-favorito-modelo:hover {
    transform: scale(1.15);
    color: var(--text-secondary);
}
.table-wrapper-modelos #tabela-modelos .modelo-conteudo {
    flex: 1;
    min-width: 0;
}
.table-wrapper-modelos #tabela-modelos .modelo-titulo-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.table-wrapper-modelos #tabela-modelos .modelo-titulo {
    flex: 1;
    min-width: 0;
}
.table-wrapper-modelos #tabela-modelos .modelo-previa {
    min-width: 0;
    overflow: hidden;
}
.table-wrapper-modelos #tabela-modelos .modelo-previa .previa-texto {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.4;
    font-size: 0.9rem;
}
.table-wrapper-modelos #tabela-modelos .btn-copiar-modelo-icon {
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}
.table-wrapper-modelos #tabela-modelos .btn-copiar-modelo-icon:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}
.table-wrapper-modelos #tabela-modelos .btn-copiar-modelo-icon.copiado {
    color: var(--success);
}
.table-wrapper-modelos #tabela-modelos .linha-modelo {
    cursor: pointer;
}
.table-wrapper-modelos #tabela-modelos .linha-modelo:hover {
    background: var(--bg-tertiary);
}
.table-wrapper-modelos #tabela-modelos .destaque-busca,
.table-wrapper-modelos #tabela-modelos mark.destaque-busca {
    background: #fef08a;
    color: inherit;
    padding: 0 0.1em;
    border-radius: 2px;
}

/* Cabeçalho Modelo com filtro à direita */
.table-wrapper-modelos #tabela-modelos th.th-modelo-com-filtro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.table-wrapper-modelos #tabela-modelos th.th-modelo-com-filtro > span {
    flex-shrink: 0;
}
.table-wrapper-modelos #tabela-modelos .filtro-estrela-modelos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* Filtro por estrela (favorito) na página Modelos */
.filtro-estrela-modelos .btn-filtro-estrela {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.filtro-estrela-modelos .btn-filtro-estrela:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text-primary);
}
.filtro-estrela-modelos .btn-filtro-estrela.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.filtro-estrela-modelos .btn-filtro-estrela svg {
    flex-shrink: 0;
}

/* Balão tooltip da prévia na tabela de Modelos */
.tooltip-previa-modelo {
    display: none;
    position: fixed;
    left: -9999px;
    top: 0;
    z-index: 9999;
    max-width: min(480px, calc(100vw - 24px));
    max-height: min(320px, calc(100vh - 24px));
    overflow-y: auto;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}
.tooltip-previa-modelo[aria-hidden="false"] {
    display: block;
    pointer-events: auto;
}

/* Modal Modelos: footer com Excluir à esquerda */
.modal-footer-modelos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.modal-footer-esquerda {
    order: 1;
}
.modal-footer-direita {
    order: 2;
    display: flex;
    gap: 0.5rem;
}

.processos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.processos-table thead {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.processos-table th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.processos-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.processos-table th.sortable:hover {
    background-color: transparent;
}

.processos-table th.sortable.active {
    background-color: transparent;
}

.processos-table th .sort-indicator {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: inline-block;
    min-width: 1rem;
}

.processos-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s ease;
    cursor: pointer;
    background: var(--bg-secondary);
}

.processos-table tbody tr:nth-child(even) {
    background: var(--bg-primary);
}

.processos-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.processos-table td {
    padding: 1.25rem 1rem;
    vertical-align: middle;
}

.processos-table .numero-processo {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.numero-processo .numero-texto {
    display: inline-block;
}

/* Badge mensagens não lidas na home */
.badge-nao-lidas {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--info);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-nao-lidas-count {
    background: var(--info);
    color: #fff;
    border-radius: var(--radius-full);
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    padding: 0 4px;
}

.btn-copiar-numero {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

.btn-copiar-numero:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
    opacity: 1;
    transform: scale(1.1);
}

.btn-copiar-numero:active {
    transform: scale(0.95);
}

.btn-copiar-numero.copiado {
    color: var(--success);
    opacity: 1;
}

.btn-copiar-numero svg {
    width: 16px;
    height: 16px;
    display: block;
}

.processo-tipo-tag {
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.35rem;
    border-radius: var(--radius-sm);
    margin-left: 0.5rem;
    vertical-align: super;
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Coluna de Status com largura fixa */
.processos-table th:nth-child(3),
.processos-table td:nth-child(3) {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    white-space: nowrap;
}

/* Lingueta de ações extras */
.acoes-extras-lingueta {
    position: fixed;
    z-index: 1000;
    background: var(--bg-primary);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.75rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    border-right: none;
    min-width: 120px;
    box-sizing: border-box;
}

.acoes-extras-lingueta.ativo {
    transform: translateX(0);
}

.acoes-extras-lingueta:not(.ativo) {
    transform: translateX(10px);
}

.acao-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.acao-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

.acao-btn:active {
    transform: scale(0.95);
}

.acao-excluir {
    color: #ef4444;
}

.acao-excluir:hover {
    background: #fee2e2;
    color: #dc2626;
}

.acao-btn svg {
    width: 20px;
    height: 20px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-sm);
}

.status-badge.clickable-status {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.status-badge.clickable-status:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.status-badge.clickable-status:active {
    transform: scale(0.98);
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-dinamico {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.responsaveis-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.responsavel-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem 0.25rem 0.25rem;
}

.btn-remover-responsavel {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}

.btn-remover-responsavel:hover {
    opacity: 1;
}

.responsaveis-adicionar {
    position: relative;
}

.autocomplete-sugestoes {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 10;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.autocomplete-item:hover {
    background: var(--bg-tertiary);
}

.drag-handle {
    display: inline-flex;
    cursor: grab;
    color: var(--text-light);
    padding: 4px 6px;
    user-select: none;
}

.linha-status.arrastando {
    opacity: 0.4;
}

.badge-dias {
    display: inline-block;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    padding: 1px 8px;
    margin-left: 4px;
    white-space: nowrap;
}

/* Classes de status para linha inteira - apenas borda esquerda colorida */
.status-row.status-em-andamento {
    border-left: 4px solid #eab308;
}

.status-row.status-em-andamento:hover {
    background: #fef08a;
}

.status-row.status-aguardando-assinatura {
    border-left: 4px solid #10b981;
}

.status-row.status-aguardando-assinatura:hover {
    background: #a7f3d0;
}

.status-row.status-com-pendencia {
    border-left: 4px solid #ef4444;
}

.status-row.status-com-pendencia:hover {
    background: #fecaca;
}

.status-row.status-anotacoes-pendente {
    border-left: 4px solid #f472b6;
}

.status-row.status-anotacoes-pendente:hover {
    background: #fbcfe8;
}

.status-row.status-finalizado {
    border-left: 4px solid #6b7280;
    color: var(--text-primary);
}

.status-row.status-finalizado:hover {
    background: #e5e7eb;
}

.status-row.status-finalizado td {
    color: var(--text-primary);
}

/* Badges de status */
.status-em-andamento {
    background: #fffbeb;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.status-em-andamento::before {
    background: #eab308;
}

.status-aguardando-assinatura {
    background: #f0fdf4;
    color: #065f46;
    border: 1px solid #86efac;
}

.status-aguardando-assinatura::before {
    background: #10b981;
}

.status-com-pendencia {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-com-pendencia::before {
    background: #ef4444;
}

.status-anotacoes-pendente {
    background: #fdf2f8;
    color: #9f1239;
    border: 1px solid #f9a8d4;
}

.status-anotacoes-pendente::before {
    background: #f472b6;
}

.status-finalizado {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #9ca3af;
}

.status-finalizado::before {
    background: #6b7280;
}

.status-concluido {
    background: #f0fdf4;
    color: #065f46;
    border: 1px solid #bbf7d0;
}

.status-concluido::before {
    background: var(--success);
}

.btn-action {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-view {
    background: var(--text-secondary);
    color: white;
}

.btn-view:hover {
    background: var(--primary);
    box-shadow: var(--shadow);
}

.btn-edit {
    background: var(--warning);
    color: white;
}

.btn-edit:hover {
    background: var(--orange);
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-style: italic;
    font-size: 1.1rem;
}

.loading::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    font-style: italic;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: flex-start;
    }
    
    .main-card {
        padding: 1.5rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-input {
        min-width: 100%;
    }
    
    .btn-search {
        width: 100%;
        justify-content: center;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .processos-table {
        font-size: 0.85rem;
    }
    
    .processos-table th,
    .processos-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .processos-table th {
        font-size: 0.75rem;
    }
}

/* Paginação */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-number {
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-number:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-number.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

.pagination-number.active:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .pagination-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .pagination-info {
        text-align: center;
    }
}

/* Scrollbar Moderna */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Modal de Confirmação */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    border: 1px solid var(--border);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-fechar-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-fechar-modal:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.modal-body p {
    margin: 0;
    font-size: 1rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
}

.btn-modal {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.btn-modal:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-modal:active {
    transform: translateY(0);
}

.btn-modal.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-modal.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-modal.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-modal.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-modal.btn-cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-modal.btn-cancel:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-copiado {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: #fff !important;
}

/* Modal de Cadastro */
.modal-cadastro {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-cadastro .modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-input[readonly] {
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

.avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #6b7280;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    border: 2px solid var(--border-color);
}

.avatar-circle-sm {
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
    border-width: 1px;
    flex-shrink: 0;
}

.form-input-color {
    width: 50px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    cursor: pointer;
}

.form-input-color::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.form-input-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.campo-personalizado-cadastro {
    border: 1px solid #d1d1d1;
    border-radius: var(--radius);
    padding: 1rem;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    vertical-align: middle;
}

.radio-label:hover {
    border-color: var(--primary);
}

.radio-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    vertical-align: middle;
    position: relative;
    top: 0;
}

.radio-label span {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

.radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary);
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: var(--primary);
}

/* Editor de Texto Rico */
.editor-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.editor-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.editor-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.editor-btn strong,
.editor-btn em,
.editor-btn u {
    font-weight: 600;
    font-style: normal;
    text-decoration: none;
}

.editor-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.editor-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.25rem;
}

.editor-select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 100px;
    height: 32px;
    transition: all 0.2s ease;
}

.editor-select:hover {
    border-color: var(--primary);
}

.editor-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}

.editor-color {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
}

.editor-content {
    min-height: 250px;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.6;
    outline: none;
}

.editor-content:empty:before {
    content: attr(data-placeholder);
    color: var(--text-light);
    font-style: italic;
}

.editor-content:focus {
    outline: none;
}

.editor-counter {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Botão de cadastrar processo */
.btn-cadastrar-processo {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cadastrar-processo:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-cadastrar-processo.btn-disabled,
.btn-cadastrar-processo:disabled {
    background: var(--bg-tertiary);
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-cadastrar-processo.btn-disabled:hover,
.btn-cadastrar-processo:disabled:hover {
    transform: none;
    box-shadow: none;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Página de Detalhes */
.status-row {
    cursor: pointer;
}

.detalhes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
    flex-wrap: wrap;
    gap: 1rem;
}

.detalhes-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.detalhes-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Título da página de Modelos (assinatura visual do produto) */
.titulo-produto-modelos {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    /* Tipografia já vem como Inter do body; o destaque fica nas cores da marca */
    background: linear-gradient(90deg, var(--orange) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 10px 24px rgba(234, 88, 12, 0.12);
    position: relative;
}

.titulo-produto-modelos::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    height: 4px;
    width: 110px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--orange), var(--primary-dark));
    opacity: 0.9;
}

.detalhes-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-acao-detalhes {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-acao-detalhes:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-acao-detalhes svg {
    flex-shrink: 0;
}

.btn-excluir-detalhes {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-excluir-detalhes:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.badge-urgente {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid #f59e0b;
}

.btn-urgente {
    color: #d97706;
    border-color: #d97706;
}

.btn-urgente:hover {
    background: #fef3c7;
    border-color: #d97706;
}

.btn-urgente.ativo {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}

.btn-urgente.ativo:hover {
    background: #d97706;
    border-color: #d97706;
}

tr.processo-urgente {
    background: #fee2e2 !important;
}

tr.processo-urgente:hover {
    background: #fecaca !important;
}


.btn-voltar {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-voltar:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-voltar svg {
    display: block;
}

/* Layout antigo mantido para compatibilidade, mas não usado mais */
.detalhes-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.detalhes-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detalhes-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detalhes-item label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detalhes-value {
    color: var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detalhes-item-full {
    width: 100%;
}

/* Removido - agora está no card-header */
.detalhes-observacoes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.detalhes-observacoes-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-editar-obs,
.btn-salvar-obs,
.btn-cancelar-obs {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-editar-obs {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-editar-obs:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-salvar-obs {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-salvar-obs:hover {
    background: var(--primary-dark);
}

.btn-salvar-obs:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-cancelar-obs {
    background: transparent;
    color: var(--text-secondary);
}

.btn-cancelar-obs:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.detalhes-observacoes-view {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 100px;
    line-height: 1.6;
    display: block; /* override .detalhes-value flex para que <p>/<div> e <br> quebrem linha */
}

.detalhes-observacoes-view p {
    margin: 0 0 1rem 0;
}

.detalhes-observacoes-view p:last-child {
    margin-bottom: 0;
}

.detalhes-observacoes-editor {
    margin-top: 0.5rem;
}

.detalhes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.detalhes-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.detalhes-card-responsaveis,
.detalhes-card-tags {
    overflow: visible;
}

.detalhes-card-responsaveis .detalhes-card-header {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.detalhes-card:hover {
    box-shadow: var(--shadow-md);
}

.detalhes-card-full {
    grid-column: 1 / -1;
}

.detalhes-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.detalhes-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detalhes-card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-editar-info,
.btn-salvar-info,
.btn-cancelar-info {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-editar-info {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-editar-info:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-salvar-info {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-salvar-info:hover {
    background: var(--primary-dark);
}

.btn-salvar-info:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-cancelar-info {
    background: transparent;
    color: var(--text-secondary);
}

.btn-cancelar-info:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.detalhes-input-edit {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.detalhes-input-edit:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.clickable-status-detalhes {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-status-detalhes:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.detalhes-card-body {
    padding: 1.5rem;
}

.detalhes-card-body .detalhes-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.detalhes-card-body .detalhes-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detalhes-card-body .detalhes-item:first-child {
    padding-top: 0;
}

.detalhes-numero {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.error-message p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.text-muted {
    color: var(--text-light);
    font-style: italic;
}

.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.3rem 0;
    text-align: right;
}

.topbar span {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.btn-toggle-ativo {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.btn-toggle-ativo:hover .status-badge {
    opacity: 0.8;
}

/* ===== Layout Detalhes com Chat ===== */
.detalhes-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.detalhes-coluna-esquerda {
    flex: 1;
    min-width: 0;
    margin-right: 440px;
}

.detalhes-coluna-direita {
    width: 420px;
    flex-shrink: 0;
    position: fixed;
    right: var(--chat-right, 24px);
    top: var(--chat-top, 148px);
    height: calc(100dvh - var(--chat-top, 148px) - 1rem);
}

/* ===== Chat Container ===== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.chat-header {
    padding: 1rem 1.25rem;
    background: var(--primary-dark);
    color: #fff;
    flex-shrink: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.chat-participantes {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 0.15rem;
    display: block;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Separador de data */
.chat-data-separador {
    text-align: center;
    margin: 0.5rem 0;
}

.chat-data-separador span {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* Mensagens */
.chat-mensagem {
    display: flex;
    margin-bottom: 0.15rem;
}

.chat-mensagem-proprio {
    justify-content: flex-end;
}

.chat-mensagem-outro {
    justify-content: flex-start;
}

.chat-balao {
    max-width: 80%;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.chat-mensagem-proprio .chat-balao {
    background: #dbeafe;
    border-top-right-radius: 0;
}

.chat-mensagem-outro .chat-balao {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top-left-radius: 0;
}

.chat-autor {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
}

.chat-autor .avatar-circle-chat {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.chat-texto {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.35;
    color: #111;
}

.chat-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    margin-top: 0.15rem;
    position: relative;
}

/* Botão olho - info de leitura */
.chat-btn-leitura {
    background: none;
    border: none;
    cursor: pointer;
    padding: 1px;
    color: var(--text-light);
    opacity: 0.5;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
}

.chat-btn-leitura:hover {
    opacity: 1;
}

/* Popover de leitura */
.chat-leitura-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.6rem 0.75rem;
    min-width: 260px;
    z-index: 10;
}

.chat-mensagem-outro .chat-leitura-popover {
    right: auto;
    left: 0;
}

.chat-leitura-popover.ativo {
    display: block;
}

.chat-leitura-titulo {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.chat-leitura-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0;
    font-size: 0.8rem;
}

.chat-leitura-item .avatar-circle-chat {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.chat-leitura-nome {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

.chat-leitura-data {
    color: var(--text-light);
    font-size: 0.7rem;
    white-space: nowrap;
}

.chat-hora {
    font-size: 0.68rem;
    color: var(--text-light);
}

/* Status de leitura (checks) */
.chat-status-leitura {
    display: inline-flex;
    align-items: center;
    color: var(--text-light);
}

.chat-status-leitura.chat-lido {
    color: var(--info);
}

.chat-status-leitura.chat-enviando {
    color: var(--accent);
    animation: chat-pulse 1s infinite;
}

@keyframes chat-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chat-erro-envio {
    color: var(--danger);
    font-size: 0.85rem;
    cursor: help;
}

/* Separador de não lidas */
.chat-nao-lidas {
    text-align: center;
    margin: 0.5rem 0;
}

.chat-nao-lidas span {
    background: var(--info);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Footer / Input */
.chat-footer {
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    flex-shrink: 0;
    border-top: 1px solid var(--border);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
    outline: none;
    background: #fff;
    line-height: 1.35;
}

.chat-input:focus {
    border-color: var(--primary);
}

.chat-btn-enviar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chat-btn-enviar:hover {
    background: var(--primary-dark);
}

/* Botão gravar áudio */
.chat-btn-gravar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chat-btn-gravar:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}

/* Estado de gravação */
.chat-gravacao-estado {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.chat-input-wrapper.gravando .chat-input,
.chat-input-wrapper.gravando .chat-btn-enviar,
.chat-input-wrapper.gravando .chat-btn-gravar {
    display: none;
}

.chat-input-wrapper.gravando .chat-gravacao-estado {
    display: flex;
}

.chat-gravacao-indicador {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    animation: chat-pulse 1s infinite;
}

.chat-gravacao-timer {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.chat-btn-cancelar-gravacao {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-btn-cancelar-gravacao:hover {
    background: #fef2f2;
}

.chat-btn-enviar-gravacao {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chat-btn-enviar-gravacao:hover {
    background: var(--primary-dark);
}

/* Player de áudio no balão */
.chat-audio-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 180px;
    padding: 0.15rem 0;
}

.chat-audio-btn-play {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    padding-left: 2px;
}

.chat-audio-btn-play:hover {
    background: var(--primary-dark);
}

.chat-audio-progress {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.chat-audio-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.chat-audio-duracao {
    font-size: 0.7rem;
    color: var(--text-light);
    min-width: 28px;
    text-align: right;
}

.chat-audio-player {
    display: none;
}

/* Responsividade */
@media (max-width: 1024px) {
    .detalhes-layout {
        flex-direction: column;
    }
    .detalhes-coluna-esquerda {
        margin-right: 0;
    }
    .detalhes-coluna-direita {
        width: 100%;
        position: static;
        right: auto;
        top: auto;
        height: 500px;
    }
}

/* ===== Edição Rápida ===== */
.edicao-rapida-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - 5rem);
    padding: 2rem;
}

.edicao-rapida-container {
    width: 100%;
    max-width: 520px;
    text-align: center;
}

.edicao-rapida-titulo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.edicao-rapida-subtitulo {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0 0 2rem;
}

.edicao-rapida-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: left;
}

.edicao-rapida-form .form-group {
    margin-bottom: 1rem;
}

.er-textarea {
    resize: vertical;
    min-height: 80px;
}

.er-mensagem-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.er-acoes {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.er-btn-mic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.er-btn-mic:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.er-btn-enviar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
}

.er-gravacao-estado {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.er-feedback {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    text-align: center;
}

.er-feedback-sucesso {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.er-feedback-erro {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Alerta processos sem vínculo */
.alerta-sem-vinculo {
    margin-top: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.alerta-sem-vinculo-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #991b1b;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.alerta-sem-vinculo-header svg {
    flex-shrink: 0;
    stroke: #dc2626;
}

.alerta-sem-vinculo-lista {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alerta-sem-vinculo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
}

.alerta-sem-vinculo-numero {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
}

.alerta-sem-vinculo-acoes {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.alerta-sem-vinculo-paginacao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.alerta-pag-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.775rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid #fecaca;
    background: #ffffff;
    color: #991b1b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.alerta-pag-btn:hover {
    background: #fecaca;
}

.alerta-pag-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.alerta-pag-btn:disabled:hover {
    background: #ffffff;
}

.alerta-pag-info {
    font-size: 0.775rem;
    color: #991b1b;
    font-weight: 500;
}

.btn-dispensar {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-dispensar:hover {
    background: var(--bg-tertiary);
    border-color: var(--secondary);
}

.btn-puxar {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--info);
    background: var(--info);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-puxar:hover {
    background: #0369a1;
    border-color: #0369a1;
}

/* Tags na tabela de processos */
.processo-tags-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.2rem;
    width: 100%;
}

.processo-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid;
    line-height: 1.4;
}

.processo-tag-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Tags no card de detalhes */
.btn-remover-tag {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.1rem;
    opacity: 0.6;
    color: inherit;
}

.btn-remover-tag:hover {
    opacity: 1;
}
