:root {
    --epe-primary: #00376e;
    --epe-hover: #006397;
    --epe-gray: #63666a;
    --epe-light-blue: #88c5e5;
    --epe-bg: #f8f9fa;
    --epe-white: #ffffff;
    --epe-text: #212529;
    --epe-text-secondary: #63666a;
    --epe-border: #dee2e6;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--epe-bg);
    color: var(--epe-text);
    min-height: 100vh;
    padding: 20px;
}

.container { max-width: 1600px; margin: 0 auto; }

#uploadZone {
    background: var(--epe-primary);
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 60px 30px;
    text-align: center;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
}

#uploadZone.dragover {
    border-color: var(--epe-light-blue);
    background: var(--epe-hover);
    transform: scale(1.02);
}

#uploadZone.processing {
    opacity: 0.6;
    cursor: not-allowed;
}

#uploadZone h2 {
    color: var(--epe-white);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

#uploadZone p {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 20px;
    font-size: 1rem;
}

#uploadZone .logo {
    max-width: 280px;
    height: auto;
    margin-bottom: 20px;
    mix-blend-mode: lighten;
}

#uploadZone .btn {
    background: var(--epe-white);
    color: var(--epe-primary);
    border: 2px solid var(--epe-white);
    font-weight: 600;
}

#uploadZone .btn:hover:not(:disabled) {
    background: var(--epe-light-blue);
    color: var(--epe-primary);
    border-color: var(--epe-light-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(136, 197, 229, 0.4);
}

#fileInput {
    display: none;
}

.btn {
    background: var(--epe-primary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn:hover:not(:disabled) {
    background: var(--epe-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 55, 110, 0.3);
}

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

.btn-secondary {
    background: var(--epe-gray);
    margin-left: 10px;
}

.btn-secondary:hover:not(:disabled) {
    background: #4a4d50;
}

#status {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

#status.info {
    background: #e0f2fe;
    border-left: 4px solid #0284c7;
    color: #075985;
    display: block;
}

#status.error {
    background: #fee2e2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
    display: block;
}

#status.success {
    background: #dcfce7;
    border-left: 4px solid #16a34a;
    color: #166534;
    display: block;
}

#fileList {
    background: var(--epe-white);
    border: 1px solid var(--epe-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: none;
}

#fileList.visible {
    display: block;
}

#fileList h3 {
    color: var(--epe-primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--epe-border);
    font-size: 0.9rem;
}

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

.file-item .name {
    flex: 1;
    color: var(--epe-text);
}

.file-item .status {
    margin-left: 15px;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.file-item .status.pending {
    background: #f3f4f6;
    color: var(--epe-gray);
}

.file-item .status.processing {
    background: #dbeafe;
    color: #1e40af;
}

.file-item .status.success {
    background: #dcfce7;
    color: #166534;
}

.file-item .status.error {
    background: #fee2e2;
    color: #991b1b;
}

.file-item .remove {
    margin-left: 10px;
    color: #dc2626;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 8px;
}

.file-item .remove:hover {
    color: #991b1b;
}

#dashboardArea {
    display: none;
}

#dashboardArea.visible {
    display: block;
}

header {
    margin-bottom: 40px;
    text-align: center;
    padding: 30px 0;
    background: var(--epe-primary);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 55, 110, 0.1);
}

header .header-logo {
    max-width: 280px;
    height: auto;
    margin-bottom: 20px;
    mix-blend-mode: lighten;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    color: var(--epe-white);
    font-weight: 600;
}

.subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 10px;
    font-weight: 400;
}

.note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    margin-top: 10px;
}

.inflation-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}

.inflation-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--epe-light-blue);
    cursor: pointer;
}

.inflation-toggle label { cursor: pointer; }

.inflation-info-link {
    color: var(--epe-light-blue);
    font-size: 0.85rem;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.inflation-info-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.cpi-stale-warning {
    margin-top: 10px;
    padding: 8px 16px;
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: 8px;
    color: #ffc107;
    font-size: 0.82rem;
    text-align: center;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: var(--epe-white);
    border-radius: 12px;
    padding: 40px;
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    line-height: 1.7;
    color: var(--epe-text);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--epe-gray);
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--epe-bg);
    color: var(--epe-text);
}

.modal-content h2 {
    color: var(--epe-primary);
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-right: 30px;
}

.modal-content h3 {
    color: var(--epe-primary);
    font-size: 1.1rem;
    margin-top: 24px;
    margin-bottom: 10px;
}

.modal-content p {
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.modal-content ul {
    margin: 0 0 12px 20px;
    font-size: 0.95rem;
}

.modal-content ul li {
    margin-bottom: 6px;
}

.modal-formula {
    background: var(--epe-bg);
    border-left: 4px solid var(--epe-primary);
    padding: 14px 18px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    margin: 12px 0 16px;
    color: var(--epe-primary);
}

.modal-source {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--epe-border);
    font-size: 0.85rem;
    color: var(--epe-text-secondary);
}

.modal-source a {
    color: var(--epe-hover);
}

@media (max-width: 768px) {
    .modal-content {
        padding: 24px;
    }
    .modal-content h2 {
        font-size: 1.3rem;
    }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background: var(--epe-white);
    border: 1px solid var(--epe-border);
    border-bottom: 4px solid var(--epe-primary);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 55, 110, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 55, 110, 0.15);
    border-bottom-color: var(--epe-hover);
}

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

.kpi-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--epe-primary);
    margin-bottom: 4px;
}

.kpi-subtext {
    font-size: 0.8rem;
    color: var(--epe-gray);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) {
    .charts-grid { grid-template-columns: 1fr; }
}

.chart-container {
    background: var(--epe-white);
    border: 1px solid var(--epe-border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 55, 110, 0.08);
    position: relative;
}

.chart-container h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: var(--epe-primary);
    display: flex;
    align-items: center;
    font-weight: 500;
}

.chart-inner { position: relative; height: 350px; }

canvas { max-width: 100%; }

.full-width { grid-column: 1 / -1; }

footer {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid var(--epe-border);
    color: var(--epe-text-secondary);
    font-size: 0.9rem;
    margin-top: 40px;
    background: var(--epe-white);
    border-radius: 8px;
}

.gradient-icon {
    display: inline-block;
    width: 6px;
    height: 20px;
    background: linear-gradient(180deg, var(--epe-primary) 0%, var(--epe-hover) 100%);
    border-radius: 3px;
    margin-right: 10px;
    vertical-align: middle;
}

@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    .kpi-grid { grid-template-columns: 1fr; }
    .chart-inner { height: 300px; }
    .charts-grid { grid-template-columns: 1fr !important; }
}
