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

:root {
    --primary: #1a56db;
    --primary-dark: #1e3a5f;
    --primary-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.6;
}

/* NAV */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-700);
}
.logo span { color: var(--primary); }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { text-decoration: none; color: var(--gray-700); font-size: 0.95rem; }
.btn-nav {
    background: var(--primary);
    color: white !important;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 600;
}
.btn-nav:hover { opacity: 0.9; }

/* HERO */
.hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    max-width: 800px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
    margin-bottom: 1.2rem;
}
.subtitle {
    font-size: 1.15rem;
    color: var(--gray-500);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.subtitle strong { color: var(--gray-700); }

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.85rem 2rem;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-lg); }

.btn-secondary {
    display: inline-block;
    background: white;
    color: var(--gray-700);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--gray-300);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: var(--gray-100); }

.trust {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* FEATURES */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
}
.feature {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}
.feature h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.feature p { color: var(--gray-500); font-size: 0.9rem; }

/* PRICING */
.pricing {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
}
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.pricing-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    border: 2px solid transparent;
}
.pricing-card.featured {
    border-color: var(--primary);
    transform: scale(1.05);
}
.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.2rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.pricing-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.pricing-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}
.pricing-price span { font-size: 1rem; font-weight: 400; color: var(--gray-500); }
.pricing-features {
    list-style: none;
    text-align: left;
    margin-bottom: 1.5rem;
}
.pricing-features li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}
.pricing-features li::before {
    content: "\2713 ";
    color: var(--success);
    font-weight: 700;
    margin-right: 0.5rem;
}

/* PRIVACY BANNER */
.privacy-banner {
    max-width: 800px;
    margin: 0 auto 3rem;
    padding: 1rem 1.5rem;
    background: var(--success-light);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: #065f46;
    text-align: center;
}

/* APP */
#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
}
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-200);
}
.app-nav { display: flex; gap: 0.5rem; }
.tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gray-500);
    transition: all 0.2s;
}
.tab:hover { color: var(--gray-700); border-color: var(--gray-300); }
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Tab dropdown */
.tab-dropdown { position: relative; display: inline-block; }
.tab-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 200px;
    padding: 0.25rem;
    margin-top: 0.25rem;
}
.tab-dropdown.open .tab-dropdown-menu { display: block; }
.tab-dropdown-menu .tab {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}
.tab-dropdown-menu .tab:hover { background: var(--gray-100); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* DROPZONE */
.dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.dropzone-icon { font-size: 3rem; margin-bottom: 1rem; }
.dropzone h2 { font-size: 1.3rem; color: var(--gray-700); margin-bottom: 0.5rem; }
.dropzone p { color: var(--gray-500); }
.dropzone-hint { font-size: 0.85rem; margin-top: 0.5rem; }

/* PROGRESS */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin: 1.5rem 0 0.5rem;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}
#progressText { font-size: 0.9rem; color: var(--gray-500); text-align: center; }

/* STATS */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--gray-500); margin-top: 0.25rem; }

.action-buttons { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }

/* RESUMEN */
.resumen-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.resumen-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.resumen-card h3 {
    font-size: 1rem;
    color: var(--gray-700);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
}
.resumen-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.9rem;
}
.resumen-row .label { color: var(--gray-500); }
.resumen-row .value { font-weight: 600; }
.resumen-row.total {
    border-top: 1px solid var(--gray-200);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-size: 1rem;
}
.resumen-row.positive .value { color: var(--success); }
.resumen-row.negative .value { color: var(--danger); }
.resumen-card.full-width { grid-column: 1 / -1; }

/* TABLES */
.table-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}
.search-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.filter-select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
}
.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
    background: var(--gray-100);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
td { padding: 0.6rem 0.75rem; border-top: 1px solid var(--gray-100); }
tr:hover { background: var(--gray-50); }
td.number { text-align: right; font-variant-numeric: tabular-nums; }

/* DIOT */
.diot-header { margin-bottom: 1.5rem; }
.diot-header h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.diot-header p { color: var(--gray-500); font-size: 0.9rem; margin-bottom: 1rem; }
.diot-controls { display: flex; gap: 1rem; align-items: center; }

/* IMPUESTOS */
.impuestos-header { margin-bottom: 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.impuestos-header h2 { font-size: 1.2rem; }
.imp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.imp-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.imp-card.iva { border-left-color: var(--primary); }
.imp-card.isr { border-left-color: var(--warning); }
.imp-card.result { border-left-color: var(--success); }
.imp-card.result.negative { border-left-color: var(--danger); }
.imp-card h3 { font-size: 0.95rem; color: var(--gray-700); margin-bottom: 1rem; }
.imp-amount {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.imp-amount.positive { color: var(--success); }
.imp-amount.negative { color: var(--danger); }
.imp-detail { font-size: 0.85rem; color: var(--gray-500); }

/* RFC STEP */
.rfc-step {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.rfc-step h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.rfc-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    cursor: pointer;
}
.rfc-badge:hover { background: var(--primary); color: white; }

/* Landing hide when app active */
body.app-active #landing { display: none; }

.hidden { display: none !important; }
.empty-state { text-align: center; padding: 3rem; color: var(--gray-500); }

/* FOOTER */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    font-size: 0.85rem;
    border-top: 1px solid var(--gray-200);
}
footer a { color: var(--primary); text-decoration: none; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .features { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .resumen-grid { grid-template-columns: 1fr; }
    .imp-grid { grid-template-columns: 1fr; }
    .app-nav { flex-wrap: wrap; }
    .table-controls { flex-wrap: wrap; }
    nav { padding: 1rem; }
    .hero { padding: 2rem 1rem; }
    .app-header { flex-direction: column; gap: 1rem; }
    .pricing-grid { grid-template-columns: 1fr; }
    .pricing-card.featured { transform: none; }
}

/* PRINT */
@media print {
    nav, .app-header, .tab, .btn-primary, .btn-secondary, .dropzone,
    #upload-stats, #email-capture, footer, .privacy-banner, .pricing,
    .features, .hero, .nav-links, .trust, #landing, .rfc-badge,
    .diot-controls button, .table-controls button, #pagination,
    .action-buttons, .search-input, .filter-select { display: none !important; }
    body { background: white !important; }
    #app { padding: 0 !important; }
    .tab-content { display: block !important; page-break-after: always; }
    .tab-content:empty, .tab-content .empty-state { display: none !important; }
    .resumen-card, .imp-card, .stat-card { box-shadow: none !important; border: 1px solid #ddd !important; }
    .table-wrapper { max-height: none !important; overflow: visible !important; }
    @page { margin: 1.5cm; }
    .print-header { display: block !important; text-align: center; margin-bottom: 1rem; }
}

/* Fix dropdown menu visibility */
.tab-dropdown { position: relative; z-index: 200; }
.tab-dropdown-menu { z-index: 9999; }
.app-nav { overflow: visible !important; }
.app-header { overflow: visible !important; }
#app { overflow: visible !important; }
