:root {
    /* Brand Palette - EP Alves Energia */
    --primary: #05518B;
    --primary-light: #0D70BB;
    --primary-dark: #033D6B;
    
    --secondary: #F7941E;
    --secondary-hover: #E68512;
    
    --accent: var(--secondary);
    
    /* Neutral Palette */
    --bg-color: #F1F5F9;
    --surface: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    
    /* Text and UI */
    --text-color: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    
    /* Status */
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;

    --font-family: 'Inter', sans-serif;
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 4px 0 12px rgba(0,0,0,0.03);
}

.sidebar-header {
    padding: 32px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    margin-bottom: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: #F8FAFC;
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background-color: #F1F5F9;
    color: var(--primary);
    font-weight: 700;
    box-shadow: inset 4px 0 0 var(--primary);
}

.nav-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 32px; /* Reduzido de 32px 48px */
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-title h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-title p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--secondary);
    color: white;
    box-shadow: 0 4px 10px rgba(247, 148, 30, 0.25);
}

.btn-primary:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(247, 148, 30, 0.4);
}

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

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

.btn-icon {
    padding: 10px;
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 8px;
}

.btn-icon:hover {
    color: var(--primary);
    background-color: var(--bg-color);
}

/* Widgets */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px; /* Reduzido de 32px */
}

.widget {
    background-color: var(--surface);
    padding: 16px; /* Reduzido de 24px para 16px */
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px; /* Reduzido de 16px para 12px */
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid transparent;
    min-width: 0;
    overflow: hidden;
}

.widget:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.widget-icon {
    width: 44px; /* Reduzido de 56px */
    height: 44px; /* Reduzido de 56px */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px; /* Reduzido de 24px */
    flex-shrink: 0;
}

/* Brand Colored Borders for widgets */
.widget-total-geral { border-top: 4px solid var(--primary); }
.widget-pendente { border-top: 4px solid var(--secondary); }
.widget-pago { border-top: 4px solid var(--success); }
.widget-hoje { border-top: 4px solid var(--danger); }

.widget-total .widget-icon {
    background-color: #E0F2FE;
    color: var(--primary);
}

.widget-vencendo .widget-icon {
    background-color: #FFFBEB;
    color: var(--warning);
}

.widget-pago .widget-icon {
    background-color: #ECFDF5;
    color: var(--success);
}

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

.widget-info h3 {
    font-size: 11px; /* Levemente menor */
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-info p.value {
    font-size: 18px; /* Reduzido de 20px para garantir que caiba em uma linha */
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -0.2px;
    line-height: 1.2;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.widget-info span.count {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Data Table */
/* Period Filters */
.period-filters-container {
    margin-bottom: 24px;
    background: var(--surface);
    padding: 16px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-chip {
    background: white;
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 110px;
    transition: var(--transition);
    color: var(--text-color);
}

.filter-chip:hover {
    border-color: var(--primary-light);
    background: #F8FAFC;
    transform: translateY(-2px);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 81, 139, 0.3);
}

.filter-chip.danger {
    border-color: #FCA5A5;
    background-color: #FEF2F2;
    color: #B91C1C;
}

.filter-chip.danger:hover {
    background-color: #FEE2E2;
    border-color: #EF4444;
}

.filter-chip.danger.active {
    background-color: #EF4444;
    border-color: #EF4444;
    color: white;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.filter-chip .label {
    font-size: 14px;
    font-weight: 600;
}

.filter-chip .sub {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 400;
    margin-top: 2px;
}

.filter-chip.active .sub {
    opacity: 0.9;
}

/* Data Table section adjustment */
.boletos-section {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 16px 20px; /* Reduzido de 24px */
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px; /* Reduzido de 24px */
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.filters {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #F8FAFC;
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.date-range:focus-within {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 2px rgba(5, 81, 139, 0.1);
}

.date-range span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-range input {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    font-size: 13px;
    box-shadow: none !important;
    width: 105px;
}

.subtotal-badge {
    background-color: #EEF2FF;
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 12px;
    border: 1px solid rgba(5, 81, 139, 0.1);
    white-space: nowrap;
    display: none;
}

.subtotal-badge.active {
    display: inline-block;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #F8FAFC;
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    flex: 1;
    min-width: 240px;
}

.search-box:focus-within {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 2px rgba(5, 81, 139, 0.1);
}

.search-box i {
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    font-size: 14px;
    outline: none;
    width: 100%;
    color: var(--text-color);
}

.filters select,
.filters > input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    color: var(--text-color);
    background-color: white;
    transition: var(--transition);
}

.filters select:focus,
.filters input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 10px 14px; /* Reduzido de 16px */
    background-color: var(--bg-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px; /* Levemente menor para cabeçalho */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 10px 14px; /* Reduzido de 16px */
    border-bottom: 1px solid var(--border-color);
    font-size: 13px; /* Reduzido de 14px */
    color: var(--text-color);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #F8FAFC;
}

.data-table .desc {
    font-weight: 500;
}

.data-table .referencia {
    color: var(--text-muted);
    font-size: 13px;
}

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

.badge-pendente {
    background-color: #FEF2F2;
    color: var(--danger);
}

.badge-vencendo {
    background-color: #FFFBEB;
    color: var(--warning);
}

.badge-pago {
    background-color: #ECFDF5;
    color: var(--success);
}

/* Action Buttons in Table */
.action-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-small {
    padding: 6px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background-color: transparent;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-pay {
    color: var(--success);
}

.btn-pay:hover {
    background-color: #ECFDF5;
}

.btn-delete {
    color: var(--danger);
}

.btn-delete:hover {
    background-color: #FEF2F2;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    /* Slate 900 */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--surface);
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

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

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

/* Form Styles */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.flex-3 {
    flex: 3;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* Login Screen Premium Styling */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('../energia.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 56px 48px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 440px;
    text-align: center;
    animation: loginFadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translateY(30px);
    opacity: 0;
}

@keyframes loginFadeInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-logo img {
    height: 75px;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.login-logo img:hover {
    transform: scale(1.05);
}

.login-container h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
}

.login-container p {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 15px;
}

.login-container form {
    text-align: left;
}

.login-container .form-group {
    margin-bottom: 20px;
}

.login-container .form-group label {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
    display: block;
    font-size: 14px;
}

.login-container .form-group input {
    width: 100%;
    background: #F8FAFC;
    border: 2px solid transparent;
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    outline: none;
    color: var(--text-color);
}

.login-container .form-group input:focus {
    background: #FFFFFF;
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(247, 148, 30, 0.15);
}

.login-container button[type="submit"] {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-hover));
    box-shadow: 0 4px 15px rgba(247, 148, 30, 0.3);
    border: none;
    transition: all 0.3s ease;
    color: white;
    cursor: pointer;
    margin-top: 10px;
}

.login-container button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(247, 148, 30, 0.4);
    background: linear-gradient(135deg, var(--secondary-hover), #D9770E);
}