/* ==========================================================================
   Design System - JurisSystem IA
   Tema 100% Claro & Elegante com Botões Vermelhos e Tons Slate
   ========================================================================== */

:root {
    /* Cores fiéis ao modelo: Topbar & Sidebar em Azul Oceano (#02476d) e Destaques em Ciano (#00b0ff) */
    --bg-header: #02476d;         /* Topbar Azul Oceano Corporativo */
    --bg-sidebar: #02476d;        /* Sidebar Azul Oceano Corporativo */
    --bg-primary: #edf2f6;        /* Fundo Geral Gelo Claro */
    --bg-card: #ffffff;           /* Cards e Painéis Brancos Limpos */
    --bg-table-header: #f1f5f9;   /* Cabeçalho de Tabela Claro */
    
    --text-header: #ffffff;       /* Texto Topbar Branco */
    --text-sidebar: #ffffff;      /* Texto Sidebar Branco */
    --text-primary: #0f172a;      /* Texto Principal Escuro Slate */
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: #cbd5e1;
    --border-hover: #94a3b8;
    
    /* Tons do Modelo: Azul Oceano e Ciano Vibrante */
    --color-ocean: #02476d;
    --color-ocean-dark: #003654;
    --color-ocean-light: #035a8c;
    
    --color-cyan: #00b0ff;
    --color-cyan-hover: #009ae5;
    --color-cyan-gradient: linear-gradient(135deg, #009ae5 0%, #00b0ff 100%);
    --shadow-cyan-glow: 0 4px 14px rgba(0, 176, 255, 0.35);

    /* Retrocompatibilidade com componentes */
    --color-red: #00b0ff;
    --color-red-hover: #009ae5;
    --color-red-gradient: linear-gradient(135deg, #009ae5 0%, #00b0ff 100%);
    --shadow-red-glow: 0 4px 14px rgba(0, 176, 255, 0.35);

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --transition: all 0.2s ease-in-out;
}

[data-theme="dark"] {
    --bg-header: #02476d;
    --bg-sidebar: #02476d;
    --bg-primary: #edf2f6;
    --bg-card: #ffffff;
    --bg-table-header: #f1f5f9;
    
    --text-header: #ffffff;
    --text-sidebar: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: #cbd5e1;
    --border-hover: #94a3b8;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Scrollbar Customizado */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar Header em Azul Marinho Corporativo */
.topbar {
    height: 58px;
    background-color: var(--bg-header);
    color: var(--text-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.topbar-left .brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-left .brand-logo {
    font-size: 22px;
    color: #ffffff;
}

.topbar-left .brand-info h2 {
    font-size: 19px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.topbar-left .brand-sub {
    font-size: 11px;
    background: #00b0ff;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    margin-left: 2px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #ffffff;
    padding: 4px 6px 4px 14px;
    border-radius: 4px;
    width: 490px;
    max-width: 100%;
    border: 1px solid #cbd5e1;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.topbar-search:focus-within {
    border-color: #00b0ff;
    box-shadow: 0 0 0 3px rgba(0, 176, 255, 0.2);
    background-color: #ffffff;
}

.topbar-search i {
    color: #64748b;
    font-size: 14px;
}

.topbar-search input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-size: 12.5px;
    color: #0f172a;
    font-family: inherit;
}

.search-kbd {
    background: #f1f5f9;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    font-family: inherit;
    pointer-events: none;
}

/* Botão da busca topbar em Ciano Destaque */
.topbar-search .btn {
    white-space: nowrap;
    border-radius: 4px;
    font-size: 11.5px;
    padding: 6px 14px;
    background: #00b0ff;
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 176, 255, 0.3);
}
.topbar-search .btn:hover {
    background: #009ae5;
    transform: translateY(-1px);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.topbar-icon-wrapper {
    position: relative;
}

.topbar-icon-link {
    position: relative;
    color: #ffffff;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    padding: 7px 9px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
    text-decoration: none;
}

.topbar-icon-link:hover, .topbar-icon-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
}

.topbar-icon-link .icon-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background: #ef4444;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #02476d;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: var(--transition);
}

/* Painel Flutuante da Central de Notificações */
.notifications-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: -70px;
    width: 340px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.14);
    z-index: 2000;
    overflow: hidden;
    animation: dropdownFade 0.2s ease-out;
}

.notifications-dropdown-panel.active {
    display: block;
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.notifications-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notifications-title i {
    color: #ef4444;
}

.btn-text-sm {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-text-sm:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.notifications-list {
    max-height: 290px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: #f8fafc;
}

.notification-item.unread {
    background-color: #fef2f2;
}

.notification-item.unread:hover {
    background-color: #fee2e2;
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.bg-blue-soft { background: #eff6ff; color: #2563eb; }
.bg-emerald-soft { background: #ecfdf5; color: #10b981; }
.bg-rose-soft { background: #fef2f2; color: #ef4444; }

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-content strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.notif-content p {
    font-size: 11.5px;
    color: #475569;
    margin-top: 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-time {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
}

.notifications-footer {
    padding: 10px 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    background-color: #f8fafc;
}

.notifications-footer a {
    color: #ef4444;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.notifications-footer a:hover {
    color: #dc2626;
    text-decoration: underline;
}

.topbar-divider {
    color: rgba(255, 255, 255, 0.4);
}

.topbar-nav-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 12.5px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topbar-nav-link i {
    font-size: 13px;
    color: #8bb3cd;
}

.topbar-nav-link:hover {
    text-decoration: none;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
}

.topbar-nav-link:hover i {
    color: #00b0ff;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: var(--transition);
}
.theme-toggle:hover {
    color: #00b0ff;
    background-color: rgba(255, 255, 255, 0.15);
}

/* User Menu Container e Dropdown Flutuante */
.user-menu-wrapper {
    position: relative;
}

.user-menu-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #ffffff !important;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    user-select: none;
}

.user-menu-dropdown:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-sm);
}

.user-menu-dropdown,
.user-menu-dropdown *,
.user-menu-info-box,
.user-menu-info-box span,
#user-email,
#user-oab-sub {
    color: #ffffff !important;
}

.user-menu-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #00b0ff;
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 176, 255, 0.4);
}

.user-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    z-index: 2000;
    padding: 8px 0;
    animation: dropdownFade 0.2s ease-out;
}

.user-dropdown-panel.active {
    display: block;
}

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

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.user-dropdown-header strong {
    display: block;
    font-size: 13px;
    color: #0f172a;
    font-weight: 700;
}

.user-dropdown-header span {
    display: block;
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
}

.user-dropdown-header .badge-plan {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    font-size: 10.5px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 12px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 12.5px;
    color: #334155;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.user-dropdown-item i {
    font-size: 14px;
    width: 18px;
    color: #64748b;
}

.user-dropdown-item:hover {
    background-color: #f8fafc;
    color: #ef4444;
}

.user-dropdown-item:hover i {
    color: #ef4444;
}

.user-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

/* App Body Layout */
.app-body {
    display: flex;
    flex: 1;
}

/* Sidebar Navigation em Estilo Azul Oceano Corporativo com Destaque Ciano */
.sidebar {
    width: 240px;
    background-color: #02476d;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 58px);
    border-right: 1px solid #003654;
}

.sidebar-group-label {
    padding: 18px 20px 8px 20px;
    font-size: 11px;
    font-weight: 700;
    color: #8bb3cd;
    letter-spacing: 0.9px;
    display: block;
    text-transform: uppercase;
}

.sidebar-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu li a i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    color: #ffffff;
}

.sidebar-menu li a .nav-arrow {
    margin-left: auto;
    font-size: 11px;
    color: #8bb3cd;
}

.sidebar-menu li a:hover {
    background-color: #035a8c;
    color: #ffffff;
}

.sidebar-menu li a:hover i {
    color: #ffffff;
}

/* Item Ativo com Destaque Ciano (#00b0ff) Idêntico ao Modelo */
.sidebar-menu li.active a {
    background-color: #00b0ff;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0, 176, 255, 0.4);
    border-left: none;
}

.sidebar-menu li.active a i {
    color: #ffffff;
}

.sidebar-menu li.active a .nav-arrow {
    color: #ffffff;
}

.sidebar-menu li a.highlight-menu {
    background: rgba(0, 176, 255, 0.2);
    color: #ffffff;
    border: 1px solid #00b0ff;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-red-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    box-shadow: var(--shadow-red-glow);
}

.user-details h4 {
    font-size: 12.5px;
    color: #ffffff;
    font-weight: 600;
}

.user-details span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
}

/* Main Content Area */
.main-content {
    flex: 1;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.content-body {
    padding: 24px 32px;
    flex: 1;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* Header de Seção */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.section-subtext {
    font-size: 12.5px;
    color: var(--text-muted);
}

.header-action-btns {
    display: flex;
    gap: 10px;
}

/* BOTÕES GERAIS DO SISTEMA (Estilo Vermelho Destaque & Azul Marinho) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

/* Botão Principal Vermelho */
.btn-primary, .btn-emerald, .btn-red {
    background: var(--color-red-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-red-glow);
}

.btn-primary:hover, .btn-emerald:hover, .btn-red:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.4);
}

/* Botão Secundário / Delineado */
.btn-secondary, .btn-outline-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover, .btn-outline-secondary:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-red);
    color: var(--color-red);
}

/* Botão de Busca Vermelho */
.btn-search-red, .btn-search-gray {
    background: var(--color-red-gradient);
    color: #ffffff;
    border: none;
    padding: 8px 22px;
    border-radius: 0 4px 4px 0;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
    box-shadow: var(--shadow-red-glow);
}

.btn-search-red:hover, .btn-search-gray:hover {
    background: #dc2626;
}

/* Botão de Perigo / Exclusão */
.btn-danger {
    background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
    color: #ffffff;
    box-shadow: var(--shadow-red-glow);
}

.btn-danger:hover {
    background: #991b1b;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* Card de Filtro e Busca */
.filter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.filter-card-header label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.filter-input-wrapper {
    display: flex;
}

.filter-input {
    flex: 1;
    border-radius: 4px 0 0 4px;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
}

.filter-input:focus {
    border-color: var(--color-red);
}

/* Painéis e Tabelas */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background-color: var(--bg-table-header);
    color: var(--text-primary);
    padding: 12px 16px;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
}

.sort-icon {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: rgba(239, 68, 68, 0.04);
}

.client-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* Ícones da Coluna de Opções */
.table-opcoes-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-op-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-op-icon:hover {
    color: var(--color-red);
    background: rgba(239, 68, 68, 0.12);
}

.table-footer-actions {
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

/* Modais de Cadastro */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 560px;
    box-shadow: var(--shadow-lg);
    animation: modalZoom 0.2s ease-out;
}

@keyframes modalZoom {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-table-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}
.close-modal:hover {
    color: var(--color-red);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Chat e Dashboard */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.card-info h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bg-blue { background: #1d4ed8; }
.bg-indigo { background: #2563eb; }
.bg-amber { background: #f59e0b; }
.bg-rose { background: #ef4444; }
.bg-emerald { background: #10b981; }
.bg-purple { background: #8b5cf6; }

.metric-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    display: block;
    margin: 2px 0;
    white-space: nowrap;
}

.metric-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.3;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 220px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-red-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

.message-content {
    background-color: var(--bg-table-header);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    line-height: 1.5;
    border: 1px solid var(--border-color);
}

.chat-message.user .message-content {
    background: var(--color-red-gradient);
    color: #fff;
    border: none;
}

/* Badges do Agente IA no topo */
.agent-badges-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 11.5px;
    font-weight: 700;
}

.ai-badge-groq {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.ai-badge-tavily {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.ai-badge-rag {
    background: rgba(29, 78, 216, 0.12);
    color: #1d4ed8;
    border: 1px solid rgba(29, 78, 216, 0.3);
}

/* Card de Boas-Vindas e Sugestões */
.chat-welcome-card {
    background: var(--bg-table-header);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px 24px;
    margin-bottom: 16px;
}

.welcome-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.welcome-header h3 {
    font-size: 16.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.welcome-header p {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.ai-tag {
    font-size: 10px;
    background: var(--color-red);
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 800;
    margin-left: 6px;
}

.prompt-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.prompt-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    font-family: inherit;
}

.prompt-card:hover {
    border-color: var(--color-red);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background: rgba(239, 68, 68, 0.04);
}

.prompt-icon {
    font-size: 18px;
    color: var(--color-red);
    flex-shrink: 0;
    margin-top: 2px;
}

.prompt-text strong {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.prompt-text span {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

/* Chat Input Wrapper Estilo Copilot */
.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-top: 12px;
    box-shadow: var(--shadow-sm);
}

.chat-input-wrapper textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    resize: none;
    padding: 6px 0;
}

.chat-input-actions-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.chat-action-btn:hover, .chat-action-btn.active {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-red);
    border-color: var(--color-red);
}

/* Badges de Status */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.badge-info { background: rgba(29, 78, 216, 0.15); color: #1d4ed8; }

/* ==========================================================================
   Estilização Glassmorphism para SweetAlert2 - JurisSystem IA
   ========================================================================== */
.swal2-popup.swal2-glassmorphism {
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12), inset 0 0 1px rgba(255, 255, 255, 0.9) !important;
    color: #0f172a !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

[data-theme="light"] .swal2-popup.swal2-glassmorphism {
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    color: #0f172a !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12), inset 0 0 1px rgba(255, 255, 255, 0.9) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-title {
    font-weight: 700 !important;
    font-size: 18px !important;
    color: inherit !important;
}

.swal2-html-container {
    font-size: 13.5px !important;
    color: inherit !important;
    opacity: 0.9;
}

.swal2-confirm.swal2-btn-red {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4) !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    padding: 10px 24px !important;
    font-size: 13px !important;
    border: none !important;
}

.swal2-confirm.swal2-btn-red:hover {
    background: #dc2626 !important;
    transform: translateY(-1px);
}

.swal2-cancel.swal2-btn-gray {
    background: rgba(100, 116, 139, 0.1) !important;
    color: inherit !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    font-size: 13px !important;
}

.swal2-cancel.swal2-btn-gray:hover {
    background: rgba(100, 116, 139, 0.2) !important;
}

/* Glassmorphism Toast Compact & Sleek */
.swal2-toast.swal2-glass-toast {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    border-radius: 10px !important;
    color: #0f172a !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12) !important;
    padding: 8px 14px !important;
    align-items: center !important;
    max-width: 380px !important;
}

[data-theme="light"] .swal2-toast.swal2-glass-toast {
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    color: #0f172a !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12) !important;
}

.swal2-toast.swal2-glass-toast .swal2-title {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.swal2-toast.swal2-glass-toast .swal2-icon {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    margin: 0 8px 0 0 !important;
    font-size: 10px !important;
}

.swal2-toast.swal2-glass-toast .swal2-timer-progress-bar {
    background: var(--color-red) !important;
}

/* ==========================================================================
   Grid de Relatórios Executivos - JurisSystem IA
   ========================================================================== */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.report-card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.report-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.report-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.report-formats {
    display: flex;
    gap: 4px;
}

.format-pill {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--bg-table-header);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.report-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.report-card p {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
    flex: 1;
}

.report-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Abas de Administração & Auditoria Estilo Pill Bar */
.admin-tabs-wrapper {
    margin-bottom: 20px;
}

.admin-tabs {
    display: inline-flex;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 5px;
    border-radius: 30px;
    box-shadow: var(--shadow-sm);
}

.admin-tabs .tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 22px;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    background: transparent;
    transition: var(--transition);
    font-family: inherit;
}

.admin-tabs .tab-btn:hover:not(.active) {
    color: var(--color-red);
    background: rgba(239, 68, 68, 0.08);
}

.admin-tabs .tab-btn.active {
    background: var(--color-red-gradient);
    color: #ffffff;
    font-weight: 700;
    box-shadow: var(--shadow-red-glow);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-outline-danger:hover {
    background: #ef4444;
    color: #ffffff;
}

.btn-xs {
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 4px;
}
