/* ===================================
   Portal de Materialidad CFDI
   Design System & Styles
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* === CSS Variables === */
:root {
    /* Colors - Dark Premium */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #818cf8;
    
    /* Accent Palette */
    --accent-indigo: #6366f1;
    --accent-indigo-light: #818cf8;
    --accent-indigo-dark: #4f46e5;
    --accent-violet: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-rose: #f43f5e;
    
    /* Risk Colors */
    --risk-low: #10b981;
    --risk-low-bg: rgba(16, 185, 129, 0.1);
    --risk-medium: #f59e0b;
    --risk-medium-bg: rgba(245, 158, 11, 0.1);
    --risk-high: #f97316;
    --risk-high-bg: rgba(249, 115, 22, 0.1);
    --risk-critical: #ef4444;
    --risk-critical-bg: rgba(239, 68, 68, 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-dark: linear-gradient(180deg, #0a0e1a 0%, #111827 100%);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing & Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background decoration */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.04) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

/* === Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Navigation === */
.navbar {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
    background: rgba(10, 14, 26, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
}

.nav-brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-brand-text span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.nav-links a.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-indigo-light);
}

/* === Hero Section === */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: var(--gradient-glow);
    border-radius: 50%;
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-full);
    color: var(--accent-indigo-light);
    font-size: 0.813rem;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

.hero-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-indigo-light);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    position: relative;
}

.hero h1 .gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

/* === Steps Wizard === */
.steps-container {
    padding: 0 0 60px;
}

.steps-wizard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 48px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-base);
    cursor: default;
}

.step-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.step-item.completed {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.813rem;
    font-weight: 700;
    transition: all var(--transition-base);
}

.step-item.active .step-number {
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    color: #fff;
}

.step-item.completed .step-number {
    background: var(--accent-emerald);
    border-color: var(--accent-emerald);
    color: #fff;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.step-item.active .step-label {
    color: var(--text-primary);
}

.step-item.completed .step-label {
    color: var(--accent-emerald);
}

.step-connector {
    width: 60px;
    height: 2px;
    background: var(--border-subtle);
    transition: background var(--transition-base);
}

.step-connector.active {
    background: var(--accent-indigo);
}

.step-connector.completed {
    background: var(--accent-emerald);
}

/* === Cards & Panels === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-medium);
}

.card-glow {
    box-shadow: var(--shadow-glow);
}

/* === Step 1: RFC Input === */
.rfc-section {
    max-width: 560px;
    margin: 0 auto;
}

.rfc-section .card {
    text-align: center;
}

.rfc-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.rfc-section p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 0.938rem;
}

.rfc-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.rfc-input-group input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: all var(--transition-fast);
    outline: none;
}

.rfc-input-group input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.rfc-input-group input.is-valid {
    border-color: var(--accent-emerald);
}

.rfc-input-group input.is-invalid {
    border-color: var(--accent-red);
}

.rfc-feedback {
    font-size: 0.813rem;
    min-height: 20px;
    margin-bottom: 8px;
    transition: all var(--transition-fast);
}

.rfc-feedback.success { color: var(--accent-emerald); }
.rfc-feedback.error { color: var(--accent-red); }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.938rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-glass-hover);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-accent);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.813rem;
}

/* === Step 2: Upload Zone === */
.upload-section {
    max-width: 720px;
    margin: 0 auto;
}

.drop-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-card);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent-indigo);
    background: rgba(99, 102, 241, 0.03);
}

.drop-zone:hover::before, .drop-zone.drag-over::before {
    opacity: 1;
}

.drop-zone.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.drop-zone-icon {
    font-size: 48px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.drop-zone h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.875rem;
    position: relative;
    z-index: 1;
}

.drop-zone .browse-link {
    color: var(--accent-indigo-light);
    text-decoration: underline;
    cursor: pointer;
}

.file-list {
    margin-top: 24px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.file-list::-webkit-scrollbar {
    width: 4px;
}

.file-list::-webkit-scrollbar-track {
    background: transparent;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 0.813rem;
    animation: fadeSlideIn 0.3s ease-out;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    min-width: 0;
}

.file-item-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    font-size: 16px;
    transition: all var(--transition-fast);
}

.file-item-remove:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.file-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.file-counter .count {
    color: var(--text-primary);
    font-weight: 600;
}

.file-counter .max {
    color: var(--text-muted);
}

.upload-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

/* === Progress Bar === */
.progress-container {
    margin-top: 24px;
    display: none;
}

.progress-container.visible {
    display: block;
}

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* === Step 3: Results === */
.results-section {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeSlideIn 0.5s ease-out;
}

/* Gauge meter */
.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 32px 0;
}

.gauge {
    position: relative;
    width: 220px;
    height: 120px;
    overflow: hidden;
}

.gauge-bg {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 16px solid var(--bg-secondary);
    border-bottom-color: transparent;
    border-left-color: transparent;
    transform: rotate(225deg);
    position: absolute;
    top: 0;
    left: 0;
}

.gauge-fill {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 16px solid transparent;
    border-top-color: var(--accent-indigo);
    border-right-color: var(--accent-indigo);
    transform: rotate(225deg);
    position: absolute;
    top: 0;
    left: 0;
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    clip-path: inset(0 0 50% 0);
}

.gauge-value {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.gauge-label {
    margin-top: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Risk level badges */
.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.risk-badge.bajo {
    background: var(--risk-low-bg);
    color: var(--risk-low);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.risk-badge.medio {
    background: var(--risk-medium-bg);
    color: var(--risk-medium);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.risk-badge.alto {
    background: var(--risk-high-bg);
    color: var(--risk-high);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.risk-badge.critico {
    background: var(--risk-critical-bg);
    color: var(--risk-critical);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 32px 0;
}

.stat-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Distribution bar */
.distribution-bar {
    display: flex;
    height: 12px;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 16px 0;
    background: var(--bg-secondary);
}

.distribution-bar .segment {
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.distribution-bar .segment.bajo { background: var(--risk-low); }
.distribution-bar .segment.medio { background: var(--risk-medium); }
.distribution-bar .segment.alto { background: var(--risk-high); }
.distribution-bar .segment.critico { background: var(--risk-critical); }

.distribution-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.bajo { background: var(--risk-low); }
.legend-dot.medio { background: var(--risk-medium); }
.legend-dot.alto { background: var(--risk-high); }
.legend-dot.critico { background: var(--risk-critical); }

/* Recommendations */
.recommendations {
    margin-top: 32px;
}

.recommendations h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendation-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    animation: fadeSlideIn 0.3s ease-out;
}

.recommendation-item .priority-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    margin-top: 6px;
}

.recommendation-item .priority-dot.critica { background: var(--accent-red); }
.recommendation-item .priority-dot.alta { background: var(--accent-amber); }
.recommendation-item .priority-dot.media { background: var(--accent-blue); }
.recommendation-item .priority-dot.baja { background: var(--accent-emerald); }

/* Analysis Code Box */
.analysis-code-box {
    margin-top: 32px;
    padding: 24px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-md);
    text-align: center;
}

.analysis-code-box h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analysis-code {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--accent-indigo-light);
    font-family: 'Courier New', monospace;
    margin-bottom: 12px;
    user-select: all;
}

.analysis-code-box .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.copy-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--accent-indigo-light);
    cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    margin-left: 8px;
}

.copy-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* === Contador Module === */
.search-section {
    max-width: 560px;
    margin: 0 auto;
}

.search-section .card {
    text-align: center;
}

.search-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-input-group input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: all var(--transition-fast);
    outline: none;
}

.search-input-group input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Detail Table */
.detail-section {
    margin-top: 40px;
    animation: fadeSlideIn 0.5s ease-out;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.detail-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.filter-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.filter-tab {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-tab:hover {
    color: var(--text-secondary);
}

.filter-tab.active {
    background: var(--accent-indigo);
    color: #fff;
}

/* CFDI Detail Cards */
.cfdi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all var(--transition-base);
    animation: fadeSlideIn 0.3s ease-out;
}

.cfdi-card:hover {
    border-color: var(--border-medium);
}

.cfdi-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    gap: 12px;
}

.cfdi-card-header:hover {
    background: var(--bg-glass-hover);
}

.cfdi-card-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.cfdi-card-info .uuid {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfdi-card-info .emisor {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfdi-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.cfdi-card-meta .monto {
    font-weight: 700;
    font-size: 0.938rem;
}

.cfdi-card-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
    line-height: 1;
}

.cfdi-card.expanded .cfdi-card-toggle {
    transform: rotate(180deg);
}

.cfdi-card-detail {
    padding: 0 20px 16px;
    display: none;
    border-top: 1px solid var(--border-subtle);
}

.cfdi-card.expanded .cfdi-card-detail {
    display: block;
    padding-top: 16px;
}

.alert-list {
    list-style: none;
}

.alert-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 0.813rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.alert-item .alert-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-item .alert-rule {
    font-weight: 600;
    color: var(--text-primary);
}

/* === Footer === */
.footer {
    margin-top: auto;
    padding: 32px 0;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--accent-indigo-light);
    text-decoration: none;
}

/* === Loading spinner === */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-medium);
    border-top-color: var(--accent-indigo);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 24px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    gap: 16px;
}

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

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.938rem;
}

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

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    min-width: 300px;
    max-width: 420px;
    animation: toastIn 0.3s ease-out;
    backdrop-filter: blur(12px);
    border: 1px solid;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.toast.info {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-indigo-light);
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .steps-wizard {
        flex-direction: column;
        gap: 8px;
    }
    
    .step-connector {
        width: 2px;
        height: 20px;
    }
    
    .rfc-input-group {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cfdi-card-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .cfdi-card-meta {
        gap: 8px;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card {
        padding: 20px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .upload-actions {
        flex-direction: column;
    }
    
    .nav-links {
        gap: 4px;
    }
    
    .nav-links a {
        padding: 6px 10px;
        font-size: 0.813rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .gauge {
        width: 180px;
        height: 100px;
    }
    
    .gauge-bg, .gauge-fill {
        width: 180px;
        height: 180px;
    }
    
    .gauge-value {
        font-size: 2.25rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* === Documentation Requirements === */
.doc-requirements {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.doc-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
}

.doc-group.doc-critico {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

.doc-group-title {
    font-size: 0.813rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.doc-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.doc-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.doc-item .doc-name {
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.doc-item .doc-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.doc-item.critico .doc-name {
    color: var(--risk-critical);
}

.doc-item.critico .doc-detail {
    color: var(--text-secondary);
}

.doc-item.obligatorio .doc-name::before {
    content: '📌 ';
}

.doc-item.recomendado .doc-name::before {
    content: '💡 ';
}

.doc-item.critico .doc-name::before {
    content: '🚨 ';
}
