/* ============================================
   TWELVE BUSINESS - SISTEMA FINANCEIRO
   CSS Principal - Design Profissional
   ============================================ */

/* --- CSS Variables (Tema Claro Profissional) --- */
:root {
    --primary: #1B2A4A;
    --primary-light: #2C3E6B;
    --primary-dark: #0F1B33;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --accent-light: #DBEAFE;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #6366F1;
    --info-light: #E0E7FF;

    --bg-body: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1B2A4A;
    --bg-header: #FFFFFF;

    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-white: #FFFFFF;
    --text-sidebar: #CBD5E1;

    --border-color: #E2E8F0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px 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);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;

    --transition-fast: 0.15s ease;
    --transition: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Scrollbar Custom --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

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

/* --- Layout Principal --- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
    max-width: calc(100vw - var(--sidebar-collapsed));
}

.content-area {
    flex: 1;
    padding: 24px 32px;
    margin-top: var(--header-height);
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 1040;
    transition: width var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 80px;
}

.sidebar-brand img {
    height: 40px;
    transition: var(--transition);
}

.sidebar-brand .brand-text {
    color: var(--text-white);
    font-size: 1.1rem;
    font-weight: 700;
    margin-left: 12px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition);
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.35);
    padding: 12px 16px 8px;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-section-title {
    text-align: center;
    font-size: 0;
}

.sidebar.collapsed .sidebar-section-title::after {
    content: '•••';
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.25);
}

.sidebar-item {
    list-style: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    margin: 2px 0;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--accent);
    color: var(--text-white);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sidebar-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link span {
    margin-left: 12px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Submenu */
.sidebar-submenu-toggle {
    cursor: pointer;
}

.sidebar-submenu-toggle::after {
    content: '\F282';
    font-family: 'bootstrap-icons';
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--transition);
}

.sidebar-submenu-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-submenu-toggle::after {
    display: none;
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.sidebar-submenu .sidebar-link {
    padding-left: 52px;
    font-size: 0.825rem;
}

.sidebar-submenu .sidebar-link::before {
    content: '';
    position: absolute;
    left: 32px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: background var(--transition-fast);
}

.sidebar-submenu .sidebar-link:hover::before,
.sidebar-submenu .sidebar-link.active::before {
    background: var(--accent);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 28px;
    right: -14px;
    width: 28px;
    height: 28px;
    background: var(--accent);
    border: 3px solid var(--bg-body);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    transition: all var(--transition);
    font-size: 0.7rem;
}

.sidebar-toggle:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
}

.sidebar-user-name {
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* ============================================
   HEADER / TOP BAR
   ============================================ */
.top-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 32px;
    transition: left var(--transition);
    box-shadow: var(--shadow-sm);
}

.top-header.sidebar-collapsed {
    left: var(--sidebar-collapsed);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.header-breadcrumb a:hover {
    text-decoration: underline;
}

.header-breadcrumb .separator {
    color: var(--text-muted);
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    font-size: 1.15rem;
}

.header-btn:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.header-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-header);
}

.header-search {
    position: relative;
    margin-right: 16px;
}

.header-search input {
    width: 280px;
    height: 40px;
    padding: 0 16px 0 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-body);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    width: 320px;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.header-divider {
    width: 1px;
    height: 32px;
    background: var(--border-color);
    margin: 0 8px;
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-user-btn:hover {
    background: var(--bg-body);
}

.header-user-btn .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--info));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.header-user-btn .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    overflow: visible;
    max-width: 100%;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* KPI Cards */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px 24px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.kpi-card.kpi-primary::before { background: var(--accent); }
.kpi-card.kpi-success::before { background: var(--success); }
.kpi-card.kpi-warning::before { background: var(--warning); }
.kpi-card.kpi-danger::before { background: var(--danger); }
.kpi-card.kpi-info::before { background: var(--info); }

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

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

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.kpi-icon.icon-primary { background: var(--accent-light); color: var(--accent); }
.kpi-icon.icon-success { background: var(--success-light); color: var(--success); }
.kpi-icon.icon-warning { background: var(--warning-light); color: var(--warning); }
.kpi-icon.icon-danger { background: var(--danger-light); color: var(--danger); }
.kpi-icon.icon-info { background: var(--info-light); color: var(--info); }

.kpi-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.kpi-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.kpi-trend.up {
    color: var(--success);
    background: var(--success-light);
}

.kpi-trend.down {
    color: var(--danger);
    background: var(--danger-light);
}

/* ============================================
   CHART CONTAINERS
   ============================================ */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

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

.chart-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-card-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.chart-actions {
    display: flex;
    gap: 4px;
}

.chart-action-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chart-action-btn:hover,
.chart-action-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    overflow-y: visible;
}

/* DataTables - styles handled in datatables-enhanced.css */

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

.table-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-body);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

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

.table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.status-open { background: var(--warning-light); color: #B45309; }
.status-badge.status-open::before { background: var(--warning); }

.status-badge.status-paid { background: var(--success-light); color: #047857; }
.status-badge.status-paid::before { background: var(--success); }

.status-badge.status-overdue { background: var(--danger-light); color: #B91C1C; }
.status-badge.status-overdue::before { background: var(--danger); }

.status-badge.status-partial { background: var(--info-light); color: #4338CA; }
.status-badge.status-partial::before { background: var(--info); }

.status-badge.status-reconciled { background: var(--success-light); color: #047857; }
.status-badge.status-reconciled::before { background: var(--success); }

.status-badge.status-not-reconciled { background: var(--danger-light); color: #B91C1C; }
.status-badge.status-not-reconciled::before { background: var(--danger); }

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary-custom {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary-custom:hover {
    background: var(--accent-hover);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-outline-custom {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-outline-custom:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.btn-success-custom {
    background: var(--success);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-success-custom:hover {
    background: #059669;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-danger-custom {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-danger-custom:hover {
    background: #DC2626;
    color: white;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */
.alert-custom {
    border-radius: var(--border-radius-sm);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    border: none;
}

.alert-custom.alert-info-custom {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.alert-custom.alert-success-custom {
    background: var(--success-light);
    color: #047857;
}

.alert-custom.alert-warning-custom {
    background: var(--warning-light);
    color: #B45309;
}

.alert-custom.alert-danger-custom {
    background: var(--danger-light);
    color: #B91C1C;
}

/* ============================================
   PAGE TITLE
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 200px;
    height: 38px;
    font-size: 0.825rem;
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    background: var(--bg-card);
}

.dropdown-item {
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.dropdown-item i {
    margin-right: 8px;
    width: 18px;
    text-align: center;
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #0a1628 100%);
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: white;
}

.login-left h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.login-left p {
    font-size: 1.1rem;
    opacity: 0.7;
    max-width: 400px;
    text-align: center;
}

.login-right {
    width: 480px;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    border-radius: 24px 0 0 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-card h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.login-card .form-control {
    height: 48px;
    border-radius: var(--border-radius-sm);
}

.login-card .btn-login {
    width: 100%;
    height: 48px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    font-size: 1rem;
    transition: all var(--transition);
}

.login-card .btn-login:hover {
    background: var(--accent-hover);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

.animate-slide-in {
    animation: slideInLeft 0.3s ease forwards;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ============================================
   DATATABLES OVERRIDE
   ============================================ */
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 16px;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    color: var(--text-primary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 6px 12px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

.dataTables_wrapper .dataTables_info {
    color: var(--text-muted);
    font-size: 0.825rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    background: var(--bg-card) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--accent-light) !important;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

/* ============================================
   SELECT2 OVERRIDE (Tema Claro)
   ============================================ */
.select2-container--bootstrap-5 .select2-selection--single,
.select2-selection--single {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--border-radius-sm) !important;
    height: 42px !important;
}

.select2-dropdown {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
}

.select2-results__option {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    padding: 8px 14px !important;
}

.select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--accent-light) !important;
    color: var(--accent) !important;
}

.select2-results__option[aria-selected="true"],
.select2-results__option--selected {
    background-color: var(--accent-light) !important;
    color: var(--accent) !important;
}

.select2-search__field {
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    border-radius: 6px !important;
}

.select2-selection__rendered {
    color: var(--text-primary) !important;
}

/* ============================================
   QUICK STATS ROW
   ============================================ */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h5 {
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* --- Notebooks e telas menores que Full HD (< 1400px) --- */
@media (max-width: 1400px) {
    :root {
        --sidebar-width: 220px;
    }
    .content-area {
        padding: 20px 24px;
    }
    .sidebar-brand {
        padding: 16px 14px;
        min-height: 64px;
    }
    .sidebar-brand img {
        height: 32px;
    }
    .sidebar-brand .brand-text {
        font-size: 0.95rem;
    }
    .sidebar-nav .nav-link {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    .sidebar-nav .nav-section-title {
        font-size: 0.65rem;
        padding: 14px 14px 6px;
    }
    .page-title {
        font-size: 1.3rem;
    }
    .kpi-card {
        padding: 16px 18px;
    }
    .kpi-value {
        font-size: 1.3rem;
    }
    .kpi-label {
        font-size: 0.72rem;
    }
    .chart-card {
        padding: 18px;
    }
    .page-header .btn,
    .page-header .btn-sm {
        font-size: 0.78rem;
        padding: 5px 12px;
    }
    .page-header .d-flex {
        flex-wrap: wrap;
    }
    .page-header .btn-outline-custom,
    .page-header .btn-primary-custom {
        font-size: 0.76rem;
        padding: 4px 10px;
    }
}

/* --- Telas 1200-1400px (notebooks 14") --- */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 200px;
    }
    .content-area {
        padding: 16px 20px;
    }
    .kpi-value {
        font-size: 1.15rem;
    }
    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .quick-stats {
        gap: 12px;
    }
    .page-header {
        gap: 10px;
    }
    .filter-bar {
        padding: 12px 16px;
        gap: 8px;
    }
    .filter-bar .form-control,
    .filter-bar .form-select {
        max-width: 160px;
        height: 34px;
        font-size: 0.78rem;
    }
}

/* --- Telas <= 992px: sidebar escondida (mobile/tablet) --- */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        max-width: 100vw !important;
    }

    .top-header {
        left: 0 !important;
    }

    .header-search input {
        width: 200px;
    }

    .content-area {
        padding: 14px 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .page-header .d-flex {
        flex-wrap: wrap;
        gap: 6px;
    }

    .login-left {
        display: none;
    }

    .login-right {
        width: 100%;
        border-radius: 0;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 12px;
    }

    .quick-stats {
        grid-template-columns: 1fr 1fr;
    }

    .header-search {
        display: none;
    }

    .kpi-value {
        font-size: 1.1rem;
    }

    .kpi-card {
        padding: 12px 14px;
    }

    .chart-card {
        padding: 14px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control,
    .filter-bar .form-select {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 1.1rem;
    }
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   NOTIFICATION PANEL
   ============================================ */
.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-xl);
    z-index: 1060;
    transition: right var(--transition);
    display: flex;
    flex-direction: column;
}

.notification-panel.open {
    right: 0;
}

.notification-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-header h5 {
    font-weight: 700;
    margin: 0;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.notification-item:hover {
    background: var(--bg-body);
}

.notification-item .notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.notification-item .notif-content {
    flex: 1;
}

.notification-item .notif-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-item .notif-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.notification-item .notif-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   LOADING SKELETON
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, #f0f0f0 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   TOOLTIP CUSTOM
   ============================================ */
.tooltip-custom {
    position: relative;
}

.tooltip-custom::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.tooltip-custom:hover::after {
    opacity: 1;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-custom {
    height: 8px;
    background: var(--bg-body);
    border-radius: 4px;
    overflow: hidden;
}

.progress-custom .progress-bar-custom {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.progress-bar-primary { background: var(--accent); }
.progress-bar-success { background: var(--success); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-danger { background: var(--danger); }


/* ============================================
   COMPATIBILIDADE COM TEMPLATES EXISTENTES
   Estilos para modernizar automaticamente
   ============================================ */

/* --- Override Bootstrap Tables --- */
.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(241, 245, 249, 0.5);
    --bs-table-accent-bg: transparent;
}

.table-bordered {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.table-bordered th,
.table-bordered td {
    border-color: var(--border-color) !important;
}

.thead-dark th,
.table thead th {
    background: var(--primary) !important;
    color: var(--text-white) !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    padding: 12px 16px !important;
    border-color: rgba(255,255,255,0.1) !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table tbody td {
    padding: 10px 16px !important;
    font-size: 0.85rem !important;
    vertical-align: middle !important;
    color: var(--text-primary);
}

.table-responsive {
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
}

/* --- Override Bootstrap Buttons --- */
.btn-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
    border-radius: var(--border-radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    padding: 8px 16px !important;
    transition: all var(--transition) !important;
}

.btn-success:hover {
    background: #059669 !important;
    border-color: #059669 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.btn-secondary {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--border-radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    padding: 8px 16px !important;
    transition: all var(--transition) !important;
}

.btn-secondary:hover {
    background: var(--bg-body) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning) !important;
    border-color: var(--warning) !important;
    color: white !important;
    border-radius: var(--border-radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    padding: 8px 16px !important;
}

.btn-warning:hover {
    background: #D97706 !important;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    border-radius: var(--border-radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    padding: 8px 16px !important;
}

.btn-danger:hover {
    background: #DC2626 !important;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    border-radius: var(--border-radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    padding: 8px 16px !important;
}

.btn-primary:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}

.btn-info {
    background: var(--info) !important;
    border-color: var(--info) !important;
    color: white !important;
    border-radius: var(--border-radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    padding: 8px 16px !important;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

/* --- Override Bootstrap Alerts --- */
.alert {
    border-radius: var(--border-radius-sm) !important;
    border: none !important;
    font-size: 0.85rem !important;
    padding: 12px 16px !important;
    font-weight: 500;
    margin-bottom: 16px;
}

.alert-success {
    background: var(--success-light) !important;
    color: #047857 !important;
}

.alert-danger, .alert-error {
    background: var(--danger-light) !important;
    color: #B91C1C !important;
}

.alert-warning {
    background: var(--warning-light) !important;
    color: #B45309 !important;
}

.alert-info {
    background: var(--info-light) !important;
    color: #4338CA !important;
}

/* --- Override Bootstrap Cards (existing templates) --- */
.card-title {
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    color: var(--text-primary) !important;
}

.card-text {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

.card-footer {
    background: var(--bg-body) !important;
    border-top: 1px solid var(--border-color) !important;
    padding: 10px 16px !important;
}

/* --- Override Bootstrap Forms --- */
.form-control, .form-select {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 10px 14px !important;
    font-size: 0.875rem !important;
    color: var(--text-primary) !important;
    background: var(--bg-card) !important;
    transition: all var(--transition-fast) !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

.form-label {
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    color: var(--text-secondary) !important;
    margin-bottom: 6px !important;
}

/* --- Override Bootstrap Pagination --- */
.pagination {
    gap: 4px;
}

.page-link {
    border-radius: var(--border-radius-sm) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-size: 0.85rem !important;
    padding: 8px 14px !important;
    transition: all var(--transition-fast) !important;
}

.page-link:hover {
    background: var(--accent-light) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

.page-item.active .page-link {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

/* --- Override Bootstrap Modals --- */
.modal-content {
    border-radius: var(--border-radius) !important;
    border: none !important;
    box-shadow: var(--shadow-xl) !important;
}

.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 16px 24px !important;
}

.modal-title {
    font-weight: 700 !important;
    font-size: 1rem !important;
}

.modal-body {
    padding: 24px !important;
}

.modal-footer {
    border-top: 1px solid var(--border-color) !important;
    padding: 16px 24px !important;
}

/* --- Override Bootstrap Dropdowns --- */
.dropdown-menu {
    border-radius: var(--border-radius-sm) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 8px !important;
    animation: fadeInDown 0.15s ease !important;
}

.dropdown-item {
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    color: var(--text-primary) !important;
    transition: all var(--transition-fast) !important;
}

.dropdown-item:hover {
    background: var(--bg-body) !important;
    color: var(--accent) !important;
}

.dropdown-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.dropdown-header {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 8px 12px !important;
}

.dropdown-divider {
    border-color: var(--border-color) !important;
    margin: 4px 0 !important;
}

/* --- Override Select2 --- */
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    min-height: 42px !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 6px 14px !important;
    font-size: 0.875rem !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

.select2-dropdown {
    border-radius: var(--border-radius-sm) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* --- Override DataTables --- */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    padding-top: 12px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--border-radius-sm) !important;
    border: 1px solid var(--border-color) !important;
    margin: 0 2px !important;
    font-size: 0.85rem !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

/* --- Existing template card with colored left border --- */
.card .card-body div[style*="position: absolute"] {
    border-radius: 12px 0 0 12px !important;
}

/* --- Override badge styles --- */
.badge {
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    padding: 4px 10px !important;
}

.badge.bg-success, .badge.bg-primary, .badge.bg-info, .badge.bg-warning, .badge.bg-danger {
    font-weight: 600 !important;
}

/* --- Checkbox styling --- */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* --- Filter forms styling --- */
.card .card-body form .form-control,
.card .card-body form .form-select {
    font-size: 0.85rem !important;
}

/* --- Action buttons in tables --- */
.table a.btn-sm {
    padding: 4px 8px !important;
    font-size: 0.78rem !important;
    border-radius: 6px !important;
}

/* --- Breadcrumb override --- */
.breadcrumb {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--accent) !important;
    text-decoration: none !important;
}

.breadcrumb-item.active {
    color: var(--text-muted) !important;
}

/* --- Print styles --- */
@media print {
    .sidebar, .top-header, .app-footer, .sidebar-overlay,
    .notification-panel, .btn, .btn-primary-custom, .btn-outline-custom,
    .page-header .d-flex, .dropdown {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .content-area {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    body {
        background: white !important;
    }
}
