/* CSS Variables - Color Scheme */
:root {
    --bg: #f0f2f5;
    --sidebar-bg: #0a0a0a;
    --sidebar-border: rgba(196, 152, 47, 0.1);
    --gold: #C4982F;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-bg-dark: rgba(20, 20, 20, 0.6);
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-light: #999;
    --border-light: rgba(0, 0, 0, 0.08);
    --hover-bg: rgba(196, 152, 47, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #e8eaef 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #0f0f0f 0%, var(--sidebar-bg) 100%);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 1000;
}

/* Logo Area */
.sidebar-logo {
    padding: 24px 16px;
    text-align: center;
    border-bottom: 1px solid var(--sidebar-border);
}

.logo-svg {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    display: block;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--text-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 16px;
    margin-bottom: 12px;
    font-weight: 600;
}

.nav-section ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--gold);
    background: rgba(196, 152, 47, 0.05);
    border-left-color: rgba(196, 152, 47, 0.2);
}

.nav-item.active {
    color: var(--gold);
    background: rgba(196, 152, 47, 0.1);
    border-left-color: var(--gold);
    font-weight: 500;
}

.nav-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    stroke: currentColor;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-date {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

.btn-logout {
    padding: 10px 16px;
    background: rgba(196, 152, 47, 0.1);
    color: var(--gold);
    border: 1px solid rgba(196, 152, 47, 0.2);
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.btn-logout:hover {
    background: rgba(196, 152, 47, 0.2);
    border-color: var(--gold);
}

/* Main Content Wrapper */
.main-wrapper {
    margin-left: 240px;
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.main {
    max-width: 1400px;
    margin: 0 auto;
}

/* Glassmorphism Card Style */
.card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    padding: 20px;
}

.card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border-color: rgba(196, 152, 47, 0.2);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    transition: var(--transition);
}

.kpi-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: #ccc;
}

/* Highlight KPI Card â Resultado (gradient accent) */
.kpi-card.highlight {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--gold);
    position: relative;
    overflow: hidden;
}

.kpi-card.highlight::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at top right, rgba(196, 152, 47, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.kpi-card.highlight .kpi-icon {
    width: 36px;
    height: 36px;
    background: rgba(196, 152, 47, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.kpi-card.highlight .kpi-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--gold);
}

.kpi-card.highlight .kpi-label {
    color: #666;
    font-size: 11px;
}

.kpi-card.highlight .kpi-value {
    color: #1a1a1a;
    font-size: 30px;
}

.kpi-card.highlight.positive {
    border-left-color: #10b981;
}

.kpi-card.highlight.positive .kpi-icon {
    background: rgba(16, 185, 129, 0.1);
}

.kpi-card.highlight.positive .kpi-icon svg {
    stroke: #10b981;
}

.kpi-card.highlight.negative {
    border-left-color: #dc2626;
}

.kpi-card.highlight.negative .kpi-icon {
    background: rgba(220, 38, 38, 0.1);
}

.kpi-card.highlight.negative .kpi-icon svg {
    stroke: #dc2626;
}

.kpi-card.highlight.negative .kpi-value {
    color: #dc2626;
}

.kpi-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 12px;
    font-weight: 500;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.kpi-change {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

.kpi-change.positive {
    color: #333;
}

.kpi-change.negative {
    color: #dc2626;
}

/* Filter Bar */
.filter-bar {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--gold);
    outline: none;
    box-shadow: 0 0 0 2px rgba(196, 152, 47, 0.1);
}

/* Section Title */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--gold);
    border-radius: 2px;
}

/* Big Numbers Section */
.big-numbers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.big-number-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.big-number-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.big-number-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 12px;
    font-weight: 500;
}

.big-number-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    word-break: break-word;
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    padding: 24px;
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.chart-wrapper {
    position: relative;
    height: 350px;
}

.chart-wrapper canvas {
    max-height: 350px;
}

/* Financial Summary Table */
.summary-table-wrapper {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 800px;
}

.summary-table thead th {
    background: #fafafa;
    color: #555;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    text-align: right;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.summary-table thead th.row-label-header {
    text-align: left;
    min-width: 200px;
}

.summary-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.summary-table tbody tr:last-child td {
    border-bottom: none;
}

.summary-table tbody tr:hover {
    background: #fafbfc;
}

.summary-table .row-label {
    text-align: left;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.summary-table .val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #1a1a1a;
    white-space: nowrap;
}

.summary-table .val.negative {
    color: #dc2626;
}

.summary-table .val.pct {
    color: #555;
    font-size: 12px;
}

.summary-table .val.pct.negative {
    color: #dc2626;
}

.summary-table .col-total {
    background: #fafafa;
    font-weight: 600;
}

/* Indicator badges (+/-) */
.indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
    line-height: 1;
}

.indicator.plus {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.indicator.minus {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

/* RESULTADO row highlight */
.row-resultado {
    background: linear-gradient(90deg, rgba(196, 152, 47, 0.06) 0%, rgba(196, 152, 47, 0.02) 100%);
}

.row-resultado td {
    border-top: 2px solid rgba(196, 152, 47, 0.3);
    border-bottom: 2px solid rgba(196, 152, 47, 0.3) !important;
}

.row-resultado .row-label {
    color: var(--gold);
}

.row-resultado .val {
    color: #1a1a1a;
    font-size: 14px;
}

/* Percentage rows */
.row-pct td {
    background: #fafafa;
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.login-logo svg {
    width: 100%;
    height: 100%;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: 0.5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.form-input {
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--gold);
    background: white;
    box-shadow: 0 0 0 3px rgba(196, 152, 47, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
}

.btn-login {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--gold) 0%, #b38620 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.btn-login:hover {
    box-shadow: 0 8px 20px rgba(196, 152, 47, 0.3);
    transform: translateY(-2px);
}

.btn-login:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .kpi-grid,
    .big-numbers-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        padding: 20px;
    }

    .kpi-grid,
    .big-numbers-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-wrapper {
        padding: 16px;
    }

    .kpi-grid,
    .big-numbers-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .kpi-card,
    .big-number-card {
        padding: 16px;
    }

    .kpi-value {
        font-size: 24px;
    }

    .login-card {
        margin: 16px;
        padding: 32px 20px;
    }

    .section-title {
        font-size: 16px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(196, 152, 47, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 152, 47, 0.5);
}

/* Utility Classes */
.text-gold {
    color: var(--gold);
}

.text-muted {
    color: var(--text-light);
}

.mt-32 {
    margin-top: 32px;
}

.mb-20 {
    margin-bottom: 20px;
}

.gap-20 {
    gap: 20px;
}