/* ============================================================
   CONCILIADOR v2.1 — Premium Fintech Dark Design
   Sky Eleven — One Percent Group
   ============================================================ */

:root {
    --bg:            #070b14;
    --bg-2:          #0d1424;
    --sidebar-bg:    #0d1422;
    --card:          rgba(15, 23, 42, 0.7);
    --card-hover:    rgba(22, 33, 60, 0.85);
    --border:        rgba(148, 163, 184, 0.1);
    --border-hover:  rgba(148, 163, 184, 0.2);

    --accent:        #6366f1;   /* Indigo */
    --accent-2:      #8b5cf6;   /* Violet */
    --accent-glow:   rgba(99, 102, 241, 0.22);
    --accent-subtle: rgba(99, 102, 241, 0.08);
    --grad-accent:   linear-gradient(135deg, #6366f1, #8b5cf6);

    --income:        #10b981;
    --income-bg:     rgba(16, 185, 129, 0.08);
    --expense:       #f43f5e;
    --expense-bg:    rgba(244, 63, 94, 0.08);

    --accent:         #6E59FF;
    --accent-hover:   #5b46e6;
    --grad-primary:   linear-gradient(135deg, #6E59FF 0%, #8E7CFF 100%);
    --grad-error:     linear-gradient(135deg, #ff4d4d 0%, #ff7676 100%);
    --grad-success:   linear-gradient(135deg, #00c853 0%, #64dd17 100%);
    --glass:          rgba(255, 255, 255, 0.03);
    --glass-border:   rgba(255, 255, 255, 0.08);

    --text:          #f1f5f9;
    --text-2:        #94a3b8;
    --text-3:        #475569;

    --radius:        1rem;
    --radius-sm:     0.6rem;
    --font:          'Outfit', sans-serif;

    --shadow-sm:     0 1px 3px rgba(0,0,0,0.3);
    --shadow:        0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg:     0 20px 60px rgba(0,0,0,0.5);
    --shadow-glow:   0 0 40px rgba(99,102,241,0.2);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    /* Subtle animated starfield-like background */
    background-image:
        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 60%);
}

/* ============================================================
   SCROLLBAR PREMIUM
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.4); }

/* ============================================================
   SELECT / DROPDOWN — force dark colors on native popup
   ============================================================ */
select {
    background-color: #1e293b;
    color: #f1f5f9;
}

select option,
select optgroup {
    background-color: #1e293b;
    color: #f1f5f9;
}

select option:hover,
select option:focus,
select option:checked {
    background-color: #6366f1;
    color: #ffffff;
}

select optgroup {
    font-weight: 700;
    font-size: 0.8rem;
    color: #94a3b8;
    background-color: #0f172a;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }

.glass {
    background: var(--card);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid var(--border);
}

.income { color: var(--income); }
.expense { color: var(--expense); }

.card {
    border-radius: var(--radius);
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes countUp {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes shimmer {
    from { background-position: -200% center; }
    to   { background-position: 200% center; }
}

/* ============================================================
   LOGIN SCREEN — Cinematic
   ============================================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background:
        radial-gradient(ellipse 120% 80% at 50% 0%, rgba(99, 102, 241, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse 80% 60% at 80% 100%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
        linear-gradient(160deg, #070b14 0%, #0d1424 100%);
}

/* Animated grid overlay */
.login-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99,102,241,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, black 0%, transparent 100%);
}

.login-card {
    position: relative;
    max-width: 440px;
    width: 90%;
    background: rgba(13, 20, 36, 0.8);
    backdrop-filter: blur(40px) saturate(1.5);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 1.5rem;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

/* Top glow bar */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99,102,241,0.8), rgba(139,92,246,0.8), transparent);
}

.login-logo img {
    width: 190px;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 24px rgba(99,102,241,0.3));
}

.login-logo p {
    color: var(--text-2);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.login-info p {
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

.login-btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: white;
    color: #1e293b;
    border: none;
    border-radius: 0.875rem;
    font-family: var(--font);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.login-btn-google::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.login-btn-google:hover::after { transform: translateX(100%); }

.login-btn-google:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}

.login-btn-google img { width: 22px; }

.login-footer {
    margin-top: 2.5rem;
    font-size: 0.78rem;
    color: var(--text-3);
}
.login-footer a { color: var(--accent); text-decoration: none; font-weight: 600; transition: color 0.2s; }
.login-footer a:hover { color: var(--accent-2); }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR — Premium
   ============================================================ */
.sidebar {
    width: 268px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.75rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    animation: slideInLeft 0.5s ease;
}

.sidebar-logo {
    margin-bottom: 1.75rem;
    padding: 0 0.25rem;
    display: flex;
    justify-content: center;
}

.sidebar-logo img {
    width: 148px;
    filter: drop-shadow(0 2px 12px rgba(99,102,241,0.25));
    transition: filter 0.3s;
}

.sidebar-logo img:hover {
    filter: drop-shadow(0 4px 20px rgba(99,102,241,0.5));
}

/* Account Selector */
.account-selector {
    margin-bottom: 1.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.account-selector label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-3);
    display: block;
    margin-bottom: 0.5rem;
}

.account-select-wrapper {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.account-select-wrapper select {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.account-select-wrapper select:focus { border-color: var(--accent); }

.account-select-wrapper button {
    background: var(--grad-accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    width: 30px;
    height: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.account-select-wrapper button:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* Nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.nav-btn svg {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--border);
    color: var(--text);
}

.nav-btn:hover svg { transform: scale(1.1); }

.nav-btn.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.15));
    border-color: rgba(99,102,241,0.35);
    color: #a5b4fc;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(99,102,241,0.15);
}

/* Active indicator line */
.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--grad-accent);
    border-radius: 0 3px 3px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 1rem;
}

.user-pill { display: flex; flex-direction: column; gap: 0.5rem; }

.user-info span {
    font-size: 0.77rem;
    color: var(--text-2);
    word-break: break-all;
    display: block;
    padding: 0.5rem 0;
}

.logout-btn {
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: #fb7185;
    border-radius: var(--radius-sm);
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.4);
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.view-section { display: flex; flex-direction: column; gap: 1.5rem; }
.view-section.hidden { display: none !important; }
.view-section.active { animation: fadeInUp 0.4s ease; }

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.view-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem; }
.subtitle { color: var(--text-2); font-size: 0.88rem; }

/* ============================================================
   CONFIG PANEL — Upload Zone
   ============================================================ */
.config-panel {
    border-top: 1px solid rgba(99,102,241,0.3);
}

.config-panel h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, var(--text), var(--text-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.input-group { display: flex; flex-direction: column; gap: 0.5rem; }

.input-group label {
    font-size: 0.72rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.currency-input {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.25s;
}

.currency-input:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.currency-input span {
    padding: 0.8rem 1rem;
    color: var(--text-3);
    border-right: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
}

.currency-input input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 0.8rem 1rem;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 600;
    outline: none;
}

.input-hint { font-size: 0.76rem; color: var(--accent); }

/* DROP ZONE */
.drop-zone {
    grid-column: 1 / -1;
    border: 2px dashed rgba(99,102,241,0.25);
    border-radius: var(--radius);
    padding: 2.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(99,102,241,0.03);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--grad-accent);
    opacity: 0;
    border-radius: var(--radius);
    transition: opacity 0.3s;
    z-index: -1;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: rgba(99,102,241,0.07);
    transform: scale(1.01);
}

.drop-zone.drag-over {
    border-color: var(--accent-2);
    background: rgba(99,102,241,0.12);
    box-shadow: 0 0 0 4px var(--accent-subtle);
    transform: scale(1.01);
}

.upload-icon {
    width: 44px;
    height: 44px;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

/* BOTONES PREMIUM */
.btn-primary, .primary-btn {
    background: var(--grad-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(110, 89, 255, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(110, 89, 255, 0.4);
    filter: brightness(1.1);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* INPUTS Y DROPDOWNS */
select, input {
    background: #1a1b26 !important;
    color: white !important;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px;
}

option {
    background: #1a1b26;
    color: white;
}

/* CARDS GLASS */
.glass {
    backdrop-filter: blur(12px);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* --- AUDIT WORKFLOW STYLES --- */
.section-step {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.step-badge {
    background: var(--accent);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 0 15px rgba(110, 89, 255, 0.4);
}

.audit-summary-box {
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--glass-border);
    border-radius: 12px;
    padding: 24px;
    animation: fadeIn 0.4s ease;
}

.integrity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.integrity-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.integrity-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-3);
    letter-spacing: 0.5px;
}

.integrity-item .value {
    font-size: 1.4rem;
    font-weight: 700;
}

.success-btn {
    background: var(--grad-success) !important;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.25) !important;
}

.success-btn:hover {
    box-shadow: 0 8px 25px rgba(0, 200, 83, 0.4) !important;
}

.result-actions {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.integrity-actions, .declaration-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-big {
    padding: 16px 40px;
    font-size: 1.1rem;
}

.section-desc {
    color: var(--text-2);
    margin: -15px 0 30px 47px;
}

.declaration-grid {
    gap: 25px;
    margin-bottom: 35px;
}

.input-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.2s ease;
}

.input-card:focus-within {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.currency-symbol {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-3);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-3);
    font-style: italic;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.drop-zone-content p {
    color: var(--text-2);
    font-size: 0.95rem;
    margin-top: 0.75rem;
    line-height: 1.5;
}

.drop-zone-content strong { color: var(--text); }
.drop-hint { font-size: 0.78rem; color: var(--accent); margin-top: 0.35rem; display: block; opacity: 0.8; }

/* ============================================================
   ALERTS
   ============================================================ */
.alerts-container { display: flex; flex-direction: column; gap: 0.65rem; }

.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.87rem;
    line-height: 1.55;
    animation: fadeInUp 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fcd34d;
}

.alert-error {
    background: var(--expense-bg);
    border: 1px solid rgba(244, 63, 94, 0.25);
    color: #fb7185;
}

.alert-info {
    background: var(--accent-subtle);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

/* ============================================================
   METRIC CARDS — Premium with gradient borders
   ============================================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.metric-card {
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(148,163,184,0.2), transparent);
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.metric-card .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-2);
    font-weight: 600;
}

.metric-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    animation: countUp 0.5s ease;
}

.metric-card.highlight {
    border-left: none;
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(139,92,246,0.08));
    border: 1px solid rgba(99,102,241,0.25);
}

.metric-card.success {
    background: var(--income-bg);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.metric-card.success .value { color: var(--income); }

.metric-card.error {
    background: var(--expense-bg);
    border: 1px solid rgba(244, 63, 94, 0.25);
}

.metric-card.error .value { color: var(--expense); }

/* ============================================================
   RECONCILIATION BANNER
   ============================================================ */
.rec-banner {
    padding: 1.1rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.025em;
    animation: fadeInUp 0.4s ease;
}

.success-banner {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(5,150,105,0.08));
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    box-shadow: 0 0 24px rgba(16,185,129,0.1);
}

.error-banner {
    background: linear-gradient(135deg, rgba(244,63,94,0.12), rgba(190,18,60,0.08));
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fb7185;
    box-shadow: 0 0 24px rgba(244,63,94,0.1);
}

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.chart-container {
    height: 270px;
    position: relative;
    padding: 0.5rem;
}

.chart-container-full {
    height: 380px;
    position: relative;
    padding: 0.5rem;
}

.analytics-charts { margin-top: 1rem; }

.card h3 {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h3::before {
    content: '';
    display: block;
    width: 3px;
    height: 14px;
    background: var(--grad-accent);
    border-radius: 2px;
}

/* ============================================================
   SUMMARY TABLES
   ============================================================ */
.summary-tables {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 420px;
    overflow-y: auto;
}

.concept-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.9rem;
    background: rgba(255,255,255,0.025);
    border: 1px solid transparent;
    border-radius: 0.6rem;
    transition: all 0.2s;
    cursor: default;
}

.concept-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border);
    transform: translateX(3px);
}

.concept-name {
    font-weight: 600;
    font-size: 0.83rem;
    color: var(--text);
}

.concept-count {
    font-size: 0.73rem;
    color: var(--text-3);
    margin-left: 0.4rem;
}

.concept-value { font-weight: 700; font-size: 0.85rem; }

/* TABLE PREMIUM */
.table-container { overflow-x: auto; max-height: 420px; overflow-y: auto; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.86rem; }

thead th {
    text-align: left;
    padding: 0.7rem 1rem;
    color: var(--text-2);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(13, 20, 36, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1;
}

tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
}

tbody tr:hover { background: rgba(99,102,241,0.04); }
tbody tr:last-child { border-bottom: none; }

td {
    padding: 0.7rem 1rem;
    color: var(--text-2);
    vertical-align: middle;
}

td:first-child { color: var(--text-2); font-size: 0.82rem; }
td:nth-child(2) { color: var(--text); font-weight: 500; }

/* ============================================================
   NOTES SECTION
   ============================================================ */
.notes-section h3 { margin-bottom: 0.75rem; }

.notes-section textarea {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text);
    padding: 1rem;
    font-family: var(--font);
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: all 0.25s;
    margin-bottom: 1rem;
    line-height: 1.6;
    min-height: 100px;
}

.notes-section textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.notes-section textarea::placeholder { color: var(--text-3); }

/* ============================================================
   BUTTONS
   ============================================================ */
.actions-bar { display: flex; gap: 1rem; padding-top: 0.5rem; flex-wrap: wrap; }

.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--grad-accent);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 16px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: -50%; left: -60%;
    width: 40%;
    height: 200%;
    background: rgba(255,255,255,0.15);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.primary-btn:hover::before { left: 120%; }

.primary-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 28px var(--accent-glow);
}

.primary-btn:active { transform: scale(0.98); }

.secondary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.06);
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
    border-color: var(--border-hover);
}

.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; border-radius: var(--radius-sm); }

/* ============================================================
   HISTORY CARDS
   ============================================================ */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.history-card {
    border-radius: var(--radius);
    padding: 1.35rem;
    border: 1px solid var(--border);
    background: var(--card);
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

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

.card-success::before { background: var(--income); }
.card-error::before { background: var(--expense); }

.history-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
    border-color: var(--border-hover);
    background: var(--card-hover);
}

.hc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

.hc-period { font-weight: 700; font-size: 0.88rem; }

.hc-badge {
    font-size: 0.72rem;
    padding: 0.22rem 0.65rem;
    border-radius: 99px;
    font-weight: 600;
}

.badge-ok { background: rgba(16,185,129,0.12); color: var(--income); border: 1px solid rgba(16,185,129,0.2); }
.badge-err { background: var(--expense-bg); color: var(--expense); border: 1px solid rgba(244,63,94,0.2); }

.hc-body { display: flex; flex-direction: column; gap: 0.35rem; padding-left: 0.5rem; }

.hc-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.83rem;
    padding: 0.25rem 0;
}

.hc-row span { color: var(--text-2); }
.hc-row strong { font-weight: 600; color: var(--text); }

.hc-notes {
    margin-top: 0.85rem;
    padding: 0.6rem 0.9rem;
    background: rgba(255,255,255,0.03);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-2);
    font-style: italic;
    border-left: 2px solid var(--accent);
}

/* ============================================================
   REPORTS
   ============================================================ */
.reports-container { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    transition: all 0.2s;
}

.report-item:hover { background: rgba(255,255,255,0.05); border-color: var(--border-hover); }

.report-period { font-weight: 600; font-size: 0.92rem; }

.report-info { display: flex; flex-direction: column; gap: 0.3rem; }
.report-info span:last-child { font-size: 0.8rem; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    max-width: 560px;
    width: 90%;
    background: rgba(13, 20, 36, 0.95);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 1.5rem;
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.04);
    animation: fadeInUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card h2 { margin-bottom: 0.4rem; font-size: 1.2rem; }
.modal-card > p { color: var(--text-2); font-size: 0.88rem; margin-bottom: 1.5rem; }

.mapping-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.mapping-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-2);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.mapping-field select {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.mapping-field select:focus { border-color: var(--accent); }

.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

#new-account-name {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 0.75rem;
    padding: 0.8rem 1rem;
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.25s;
    display: block;
    width: 100%;
    margin: 0.75rem 0 1.5rem;
}

#new-account-name:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ============================================================
   LOADER — Cinematic
   ============================================================ */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 20, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.loader-card {
    background: rgba(13, 20, 36, 0.9);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 1.25rem;
    padding: 2.25rem 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(99,102,241,0.15);
    border-top-color: var(--accent);
    border-right-color: var(--accent-2);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

#loader-text {
    color: var(--text-2);
    font-size: 0.88rem;
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-2);
    font-size: 0.92rem;
}

.empty-state::before {
    content: '📂';
    display: block;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1280px) {
    .content-area { padding: 1.5rem 2rem; }
    .charts-grid { grid-template-columns: 250px 1fr; }
}

@media (max-width: 1100px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .summary-tables { grid-template-columns: 1fr; }
}


@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: column; }
    .content-area { padding: 1rem; }
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .config-grid { grid-template-columns: 1fr; }
    .mapping-grid { grid-template-columns: 1fr; }
    .actions-bar { flex-direction: column; }
    .rec-logic-grid { grid-template-columns: 1fr; }
    .add-partida-form { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   RECONCILIATION PANEL — RT 8 FACPCE
   ============================================================ */
.rec-panel {
    border-top: 2px solid rgba(99,102,241,0.4);
}

.rec-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.rec-panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.rec-panel-header h3::before {
    content: '';
    display: block;
    width: 3px;
    height: 16px;
    background: var(--grad-accent);
    border-radius: 2px;
}

.rec-norm-label {
    font-size: 0.72rem;
    color: var(--text-3);
    letter-spacing: 0.05em;
    padding-left: 0.65rem;
}

.rec-badge {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
    border-radius: 99px;
    white-space: nowrap;
}

.rec-badge.badge-ok  { background: rgba(16,185,129,0.12); color: var(--income); border: 1px solid rgba(16,185,129,0.25); }
.rec-badge.badge-err { background: var(--expense-bg); color: var(--expense); border: 1px solid rgba(244,63,94,0.25); }

/* Logic grid: steps left, diagnostic right */
.rec-logic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Steps */
.rec-steps {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rec-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.15s;
}

.rec-step:hover { background: rgba(255,255,255,0.03); }

.rec-label {
    font-size: 0.86rem;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rec-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.rec-sign {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.82rem;
    font-weight: 800;
    flex-shrink: 0;
}

.rec-sign.income  { background: rgba(16,185,129,0.12); color: var(--income); }
.rec-sign.expense { background: var(--expense-bg); color: var(--expense); }

.rec-step.credit-row { background: rgba(16,185,129,0.04); }
.rec-step.debit-row  { background: rgba(244,63,94,0.04); }

.rec-step.rec-calculated .rec-label,
.rec-step.rec-calculated .rec-value { font-weight: 700; color: var(--text); }

.rec-step.rec-declared .rec-label { color: var(--accent); font-weight: 600; }
.rec-step.rec-declared .rec-value { color: var(--accent); }

.rec-step.rec-brute {
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 0.6rem;
    padding: 0.7rem 0.9rem;
}

.rec-step.rec-brute .rec-label {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text);
}

.rec-step.rec-brute .rec-value { font-size: 1.05rem; }

.rec-divider {
    height: 1px;
    background: var(--border);
    margin: 0.4rem 0;
}

.rec-divider.thick {
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    opacity: 0.4;
    margin: 0.6rem 0;
}

/* Diagnostic Panel */
.rec-diagnostic-panel {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rec-diag-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.rec-diagnostic-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow-y: auto;
    max-height: 220px;
}

.diag-item {
    display: flex;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.825rem;
    line-height: 1.5;
    animation: fadeInUp 0.3s ease;
}

.diag-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

.diag-ok       { background: rgba(16,185,129,0.08);  color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.diag-info     { background: rgba(99,102,241,0.08);  color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }
.diag-warning  { background: rgba(251,191,36,0.08);  color: #fcd34d; border: 1px solid rgba(251,191,36,0.2); }
.diag-neutral  { background: rgba(148,163,184,0.06); color: var(--text-2); border: 1px solid var(--border); }

.diag-placeholder { color: var(--text-3); font-size: 0.83rem; padding: 0.5rem; }

/* ============================================================
   PARTIDAS CONCILIATORIAS
   ============================================================ */
.partidas-section { padding: 1.5rem; }

.partidas-header {
    margin-bottom: 1.25rem;
}

.partidas-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.partidas-header h3::before {
    content: '';
    display: block;
    width: 3px;
    height: 16px;
    background: linear-gradient(to bottom, #f59e0b, #ef4444);
    border-radius: 2px;
}

.partidas-hint {
    font-size: 0.82rem;
    color: var(--text-2);
    line-height: 1.5;
}

.partidas-hint strong { color: var(--income); }

/* Partidas list */
.partidas-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    min-height: 40px;
}

.partidas-empty {
    text-align: center;
    padding: 1.25rem;
    color: var(--text-3);
    font-size: 0.85rem;
    border: 1px dashed var(--border);
    border-radius: 0.5rem;
}

.partida-row {
    display: grid;
    grid-template-columns: 160px 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    animation: fadeInUp 0.25s ease;
    transition: background 0.2s;
}

.partida-row:hover { background: rgba(255,255,255,0.05); }

.partida-tipo-badge {
    font-size: 0.7rem;
    background: rgba(99,102,241,0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 99px;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
    text-align: center;
}

.partida-concepto {
    font-size: 0.85rem;
    color: var(--text-2);
}

.partida-importe {
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
}

.partida-sign {
    font-size: 0.82rem;
    opacity: 0.7;
    margin-right: 2px;
}

.partida-remove {
    background: rgba(244,63,94,0.08);
    border: 1px solid rgba(244,63,94,0.2);
    color: #fb7185;
    border-radius: 0.4rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.partida-remove:hover { background: rgba(244,63,94,0.2); }

/* Add partida form */
.add-partida-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto auto;
    gap: 0.65rem;
    align-items: center;
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
}

.partida-select,
.partida-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 0.6rem;
    padding: 0.6rem 0.8rem;
    font-family: var(--font);
    font-size: 0.84rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.partida-select:focus,
.partida-input:focus { border-color: var(--accent); }

.partida-amount { font-weight: 600; }

/* Partidas footer: totals */
.partidas-footer {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

.partidas-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
}

.ps-label {
    font-size: 0.84rem;
    color: var(--text-2);
}

.ps-value {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.ps-residual {
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.partidas-divider {
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    opacity: 0.35;
    margin: 0.35rem 0;
}

.residual-row { padding: 0.4rem 0; }

.residual-status {
    font-size: 0.83rem;
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    margin-top: 0.4rem;
    line-height: 1.5;
}

.residual-ok {
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.2);
    color: #6ee7b7;
}

.residual-pending {
    background: rgba(251,191,36,0.07);
    border: 1px solid rgba(251,191,36,0.2);
    color: #fcd34d;
}

/* ============================================================
   RUNNING BALANCE — Saldo c/ta column
   ============================================================ */
.saldo-col {
    text-align: right;
    font-weight: 700;
    font-size: 0.84rem;
    padding-right: 1.25rem !important;
    font-variant-numeric: tabular-nums;
    min-width: 120px;
    color: var(--text-2);
}

thead th.saldo-col {
    text-align: right;
    background: rgba(13,20,36,0.98);
    color: var(--text-3);
}

tbody tr.last-row {
    background: rgba(99,102,241,0.05);
    border-top: 1px solid rgba(99,102,241,0.2);
}

tbody tr.last-row td { font-weight: 600; }

