/**
 * AgroCO2 Capital — Hoja de Estilos Principal
 * Diseño fintech/impacto ambiental · Responsive · Dark Mode
 */

/* ═══════════ VARIABLES / TEMAS ═══════════ */
:root {
    --primary:      #1B4332;
    --primary-mid:  #2D6A4F;
    --primary-light:#52B788;
    --accent:       #40916C;
    --accent-light: #B7E4C7;
    --accent-bg:    #D8F3DC;
    --surface:      #ffffff;
    --surface-2:    #f4f7f5;
    --surface-3:    #e9ecef;
    --text:         #212529;
    --text-secondary:#6c757d;
    --border:       #dee2e6;
    --danger:       #dc3545;
    --warning:      #f0ad4e;
    --info:         #17a2b8;
    --success:      #28a745;
    --shadow:       0 2px 12px rgba(0,0,0,.08);
    --shadow-lg:    0 8px 30px rgba(0,0,0,.12);
    --radius:       12px;
    --radius-sm:    8px;
    --transition:   .25s ease;
    --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
    --max-width:    1200px;
}

body.dark {
    --primary:      #52B788;
    --primary-mid:  #40916C;
    --primary-light:#B7E4C7;
    --accent:       #52B788;
    --accent-light: #2D6A4F;
    --accent-bg:    #1a2e25;
    --surface:      #121820;
    --surface-2:    #1a2230;
    --surface-3:    #222d3a;
    --text:         #e4e4e4;
    --text-secondary:#9ea7b0;
    --border:       #2d3748;
    --shadow:       0 2px 12px rgba(0,0,0,.3);
    --shadow-lg:    0 8px 30px rgba(0,0,0,.4);
}

/* ═══════════ RESET / BASE ═══════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--surface-2);
    color: var(--text);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}
a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1,h2,h3,h4 { color: var(--primary); line-height: 1.3; }

.hidden { display: none !important; }

/* ═══════════ LAYOUT ═══════════ */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-secondary { color: var(--text-secondary); }

/* ═══════════ NAVBAR ═══════════ */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.navbar-brand {
    font-size: 1.3rem; font-weight: 700; color: var(--primary);
    display: flex; align-items: center; gap: 8px;
}
.navbar-logo {
    height: 38px; width: auto; border-radius: 6px;
    object-fit: contain; vertical-align: middle;
}
.footer-logo {
    height: 28px; width: auto; border-radius: 4px;
    object-fit: contain; vertical-align: middle; margin-right: 6px;
}
.navbar-links { display: flex; align-items: center; gap: 12px; }
.navbar-links a { color: var(--text-secondary); font-size: .9rem; padding: 6px 10px; border-radius: var(--radius-sm); transition: var(--transition); }
.navbar-links a:hover, .navbar-links a.active { color: var(--primary); background: var(--accent-bg); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-user .user-name { font-weight: 600; font-size: .9rem; }

/* Dark mode toggle */
.dark-toggle {
    background: var(--surface-3); border: 1px solid var(--border);
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.dark-toggle:hover { background: var(--accent-bg); }

/* ═══════════ BOTONES ═══════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 22px; border-radius: var(--radius-sm); border: none;
    font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: var(--transition); text-decoration: none;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary-mid); color: #fff; }
.btn-primary:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-accent { background: var(--primary-light); color: var(--primary); }
.btn-outline { background: transparent; border: 2px solid var(--primary-mid); color: var(--primary-mid); }
.btn-outline:hover { background: var(--primary-mid); color: #fff; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ═══════════ CARDS ═══════════ */
.card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 24px;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; color: var(--primary); }

/* Stat cards */
.stat-card {
    background: var(--surface); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
    transition: var(--transition); border-left: 4px solid var(--primary-light);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { font-size: 2rem; }
.stat-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.stat-label { display: block; font-size: .82rem; color: var(--text-secondary); }

/* ═══════════ FORMULARIOS ═══════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: .85rem; font-weight: 600;
    margin-bottom: 6px; color: var(--text);
}
.form-control {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: .95rem; font-family: var(--font);
    background: var(--surface); color: var(--text);
    transition: border var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(82,183,136,.2); }
.form-control.input-error { border-color: var(--danger); }
.field-error { font-size: .78rem; color: var(--danger); margin-top: 4px; min-height: 18px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.select-sm { padding: 4px 8px; font-size: .82rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }

/* Checkbox / Toggle */
.toggle-group { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toggle-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary-light); }

/* ═══════════ WIZARD / STEPS ═══════════ */
.wizard-header { margin-bottom: 24px; }
.wizard-steps {
    display: flex; justify-content: space-between; position: relative;
    margin-bottom: 8px;
}
.wizard-steps::before {
    content: ''; position: absolute; top: 18px; left: 24px; right: 24px;
    height: 3px; background: var(--surface-3); z-index: 0;
}
.step-indicator {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    position: relative; z-index: 1;
}
.step-circle {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface-3); color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem; border: 2px solid var(--border);
    transition: var(--transition);
}
.step-indicator.active .step-circle {
    background: var(--primary-mid); color: #fff; border-color: var(--primary-mid);
}
.step-indicator.completed .step-circle {
    background: var(--primary-light); color: var(--primary); border-color: var(--primary-light);
}
.step-label { font-size: .7rem; color: var(--text-secondary); text-align: center; max-width: 70px; }
.step-indicator.active .step-label { color: var(--primary); font-weight: 600; }
.step-indicator.completed .step-label { color: var(--accent); }

.progress-bar-container {
    width: 100%; height: 4px; background: var(--surface-3);
    border-radius: 2px; overflow: hidden; margin-top: 8px;
}
.progress-bar {
    height: 100%; background: linear-gradient(90deg, var(--primary-mid), var(--primary-light));
    transition: width .4s ease; border-radius: 2px;
}

.wizard-panel { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.wizard-actions { display: flex; justify-content: space-between; margin-top: 24px; gap: 12px; }

/* Payment options */
.payment-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.payment-option {
    border: 2px solid var(--border); border-radius: var(--radius);
    padding: 16px; text-align: center; cursor: pointer;
    transition: var(--transition);
}
.payment-option:hover { border-color: var(--primary-light); }
.payment-option.selected { border-color: var(--primary-mid); background: var(--accent-bg); }
.payment-option input { display: none; }
.payment-option .pay-icon { font-size: 2rem; margin-bottom: 6px; }
.payment-option .pay-label { font-size: .85rem; font-weight: 600; }

/* ═══════════ TABLA ═══════════ */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
    background: var(--accent-bg); color: var(--primary);
    padding: 10px 12px; text-align: left; font-weight: 600; white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table tr:hover { background: var(--surface-2); }

/* ═══════════ BADGES ═══════════ */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: .75rem; font-weight: 600; text-transform: capitalize;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-danger  { background: #f8d7da; color: #721c24; }
body.dark .badge-success { background: #1a3d2a; color: #7dcea0; }
body.dark .badge-warning { background: #3d3510; color: #f0c040; }
body.dark .badge-info    { background: #0f3038; color: #6dd5ed; }
body.dark .badge-danger  { background: #3b1a1d; color: #e88a93; }

/* ═══════════ MODALES ═══════════ */
.modal {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--surface); border-radius: var(--radius);
    padding: 32px; width: 100%; max-width: 520px;
    box-shadow: var(--shadow-lg); position: relative;
    max-height: 90vh; overflow-y: auto;
    animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 1.4rem;
    cursor: pointer; color: var(--text-secondary);
}
.modal-title { font-size: 1.2rem; margin-bottom: 20px; }

/* Certificate modal wider */
.modal-content.modal-wide { max-width: 760px; }

/* ═══════════ HERO ═══════════ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 50%, var(--accent) 100%);
    color: #fff; padding: 80px 20px; text-align: center;
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: url('../../assets/img/bg-hero-agro.svg') center bottom / cover no-repeat;
    opacity: .35; pointer-events: none;
}
.hero::after {
    content: ''; position: absolute; top: -50%; right: -20%; width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
}

/* ═══════════ SECTION BACKGROUNDS ═══════════ */
.section-bg-leaves {
    position: relative; overflow: hidden;
}
.section-bg-leaves::before {
    content: ''; position: absolute; inset: 0;
    background: url('../../assets/img/bg-co2-leaves.svg') center center / cover no-repeat;
    opacity: 1; pointer-events: none; z-index: 0;
}
.section-bg-leaves > * { position: relative; z-index: 1; }

.section-bg-process {
    position: relative; overflow: hidden;
}
.section-bg-process::before {
    content: ''; position: absolute; inset: 0;
    background: url('../../assets/img/bg-process.svg') center center / cover no-repeat;
    opacity: 1; pointer-events: none; z-index: 0;
}
.section-bg-process > * { position: relative; z-index: 1; }

.section-bg-earth {
    position: relative; overflow: hidden;
}
.section-bg-earth::before {
    content: ''; position: absolute; inset: 0;
    background: url('../../assets/img/bg-earth.svg') center center / cover no-repeat;
    opacity: 1; pointer-events: none; z-index: 0;
}
.section-bg-earth > * { position: relative; z-index: 1; }

.section-bg-cta {
    position: relative; overflow: hidden;
}
.section-bg-cta::before {
    content: ''; position: absolute; inset: 0;
    background: url('../../assets/img/bg-cta-agro.svg') center bottom / cover no-repeat;
    opacity: 1; pointer-events: none; z-index: 0;
}
.section-bg-cta > * { position: relative; z-index: 1; }
.hero h1 { font-size: 2.6rem; color: #fff; margin-bottom: 16px; position: relative; }
.hero p { font-size: 1.15rem; opacity: .92; max-width: 600px; margin: 0 auto 24px; position: relative; }
.hero .btn { font-size: 1.05rem; position: relative; }

/* ═══════════ SECTIONS ═══════════ */
.section { padding: 60px 20px; }
.section-alt { background: var(--surface); }
.section-title {
    text-align: center; font-size: 1.8rem; margin-bottom: 12px; color: var(--primary);
}
.section-subtitle {
    text-align: center; color: var(--text-secondary); max-width: 600px;
    margin: 0 auto 40px; font-size: 1rem;
}

/* Feature cards */
.feature-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 28px; text-align: center; box-shadow: var(--shadow);
    transition: var(--transition);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 2.5rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { font-size: .9rem; color: var(--text-secondary); }

/* ═══════════ DASHBOARD LAYOUT ═══════════ */
.dash-layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
    width: 240px; background: var(--surface); border-right: 1px solid var(--border);
    padding: 24px 0; flex-shrink: 0;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 24px; color: var(--text-secondary);
    font-size: .9rem; transition: var(--transition);
    text-decoration: none;
}
.sidebar-nav a:hover { background: var(--surface-2); color: var(--primary); }
.sidebar-nav a.active { background: var(--accent-bg); color: var(--primary); font-weight: 600; border-right: 3px solid var(--primary-light); }
.sidebar-nav .nav-icon { font-size: 1.1rem; }
.dash-main { flex: 1; padding: 28px; overflow-x: hidden; }
.dash-main h2 { margin-bottom: 20px; }

/* ═══════════ CERTIFICADOS ═══════════ */
.cert-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow); margin-bottom: 12px;
    border-left: 4px solid var(--primary-light);
}
.cert-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cert-card-id { font-weight: 700; font-family: monospace; color: var(--primary); }
.cert-card-body p { font-size: .88rem; color: var(--text-secondary); margin-bottom: 4px; }

/* Certificate (printable) */
.certificate { font-family: 'Georgia', serif; }
.cert-border {
    border: 3px solid var(--primary-mid); padding: 40px;
    border-radius: 12px; position: relative; background: #fff; color: #333;
}
.cert-border::before {
    content: ''; position: absolute; top: 6px; left: 6px; right: 6px; bottom: 6px;
    border: 1px solid var(--accent-light); border-radius: 8px; pointer-events: none;
}
.cert-header { text-align: center; margin-bottom: 28px; }
.cert-logo { font-size: 1.5rem; color: #2D6A4F; font-weight: bold; margin-bottom: 8px; }
.cert-header h2 { font-size: 1rem; color: #1B4332; margin-bottom: 6px; }
.cert-disclaimer { font-size: .7rem; color: #999; }
.cert-body { margin-bottom: 20px; }
.cert-row { padding: 8px 0; border-bottom: 1px dotted #ccc; font-size: .9rem; }
.cert-qr-section { text-align: center; margin: 16px 0; }
.cert-qr-section small { display: block; color: #999; margin-top: 4px; font-size: .7rem; }
.cert-footer { text-align: center; margin-top: 24px; font-size: .78rem; color: #666; }
.cert-sig { margin-top: 24px; }

/* ═══════════ TOKENS ═══════════ */
.token-item {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px; background: var(--surface-2);
    border-radius: var(--radius-sm); margin-bottom: 6px;
    font-size: .88rem;
}
.token-id { font-family: monospace; font-weight: 600; color: var(--primary); }
.token-co2 { color: var(--text-secondary); }

/* ═══════════ SIMULADOR ═══════════ */
.sim-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; }
.sim-results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.sim-result-item {
    background: var(--surface-2); border-radius: var(--radius-sm);
    padding: 12px 16px;
}
.sim-result-item .label { font-size: .78rem; color: var(--text-secondary); }
.sim-result-item .value { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.chart-container { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chart-container canvas { width: 100%; }
.formulas-box {
    background: var(--surface-2); border-radius: var(--radius-sm);
    padding: 16px; font-size: .85rem; margin-top: 16px;
    border-left: 3px solid var(--primary-light);
}
.formulas-box code { background: var(--surface-3); padding: 2px 6px; border-radius: 4px; font-size: .82rem; }

/* ═══════════ DISCLAIMER ═══════════ */
.disclaimer {
    background: #fff8e1; border-left: 4px solid #f0ad4e;
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: .82rem; color: #7a6520; margin: 16px 0;
}
body.dark .disclaimer { background: #2e2a18; color: #dfc06a; }

/* ═══════════ FOOTER ═══════════ */
.footer {
    background: var(--primary); color: rgba(255,255,255,.8);
    padding: 40px 20px; font-size: .85rem;
}
.footer a { color: var(--accent-light); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.footer h4 { color: #fff; margin-bottom: 12px; font-size: 1rem; }
.footer-bottom { text-align: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.15); font-size: .78rem; }

/* ═══════════ TOAST ═══════════ */
#toast-container {
    position: fixed; top: 80px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm);
    color: #fff; font-size: .9rem; font-weight: 500;
    box-shadow: var(--shadow-lg); animation: toastIn .3s ease;
    min-width: 260px;
}
.toast-success { background: #2D6A4F; }
.toast-error { background: #dc3545; }
.toast-info { background: #17a2b8; }
.toast-hide { opacity: 0; transform: translateX(60px); transition: .4s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }

/* ═══════════ SPINNER ═══════════ */
.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 3px solid rgba(255,255,255,.3); border-top-color: #fff;
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════ EMPTY STATE ═══════════ */
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--text-secondary);
}
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: 8px; }

/* ═══════════ CONFIRMATION SUMMARY ═══════════ */
.summary-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    background: var(--surface-2); padding: 20px; border-radius: var(--radius);
}
.summary-item .label { font-size: .78rem; color: var(--text-secondary); }
.summary-item .value { font-size: 1.05rem; font-weight: 600; }

/* ═══════════ HAMBURGER MENU ═══════════ */
.hamburger {
    display: none;
    background: none; border: none; cursor: pointer;
    width: 40px; height: 40px; padding: 6px;
    flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.hamburger:hover { background: var(--surface-2); }
.hamburger span {
    display: block; width: 22px; height: 2.5px;
    background: var(--text); border-radius: 2px;
    transition: transform .3s ease, opacity .3s ease;
}
.hamburger.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ═══════════ RESPONSIVE ═══════════ */

/* —— TABLET (≤1024px) —— */
@media (max-width: 1024px) {
    .container { padding: 0 16px; }
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1.05rem; }
    .section { padding: 48px 16px; }
    .section-title { font-size: 1.6rem; }

    /* Grid tablet */
    .grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
    .grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

    /* Dashboard sidebar más estrecho */
    .sidebar { width: 200px; }
    .sidebar-nav a { padding: 10px 16px; font-size: .85rem; }

    /* Simulador grid */
    .sim-grid { grid-template-columns: 280px 1fr; gap: 20px; }
}

/* —— MOBILE (≤768px) —— */
@media (max-width: 768px) {
    /* Navbar hamburger */
    .hamburger { display: flex; }
    .navbar .container { position: relative; }
    .navbar-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 64px; left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        padding: 16px 20px;
        gap: 8px;
        z-index: 99;
        animation: slideDown .25s ease;
    }
    @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
    .navbar-links.open { display: flex; }
    .navbar-links a { padding: 10px 12px; font-size: .9rem; width: 100%; border-radius: var(--radius-sm); }
    .navbar-links a:hover { background: var(--surface-2); }
    .nav-user { flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
    #nav-auth-buttons { flex-direction: column; width: 100%; }
    #nav-auth-buttons .btn { width: 100%; justify-content: center; }

    /* Hero */
    .hero { padding: 50px 16px; }
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: .95rem; max-width: 100%; }

    /* Sections */
    .section { padding: 40px 16px; }
    .section-title { font-size: 1.5rem; }
    .section-subtitle { font-size: .9rem; margin-bottom: 28px; }

    /* Grids */
    .grid-2 { grid-template-columns: 1fr; gap: 14px; }
    .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }

    /* Dashboard layout */
    .dash-layout { flex-direction: column; }
    .sidebar {
        width: 100%; border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 0;
    }
    .sidebar-nav {
        display: flex; overflow-x: auto; gap: 0;
        scrollbar-width: none; -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        padding: 0 8px;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }
    .sidebar-nav a {
        white-space: nowrap; padding: 8px 14px;
        border-right: none !important;
        font-size: .82rem;
        flex-shrink: 0;
    }
    .sidebar-nav a.active {
        border-bottom: 3px solid var(--primary-light);
        border-right: none !important;
        background: transparent;
    }
    .dash-main { padding: 16px; }
    .dash-main h2 { font-size: 1.3rem; margin-bottom: 14px; }

    /* Simulador */
    .sim-grid { grid-template-columns: 1fr; }
    .sim-results-grid { grid-template-columns: 1fr 1fr; }

    /* Wizard */
    .wizard-steps { gap: 2px; }
    .step-circle { width: 32px; height: 32px; font-size: .82rem; }
    .step-label { font-size: .6rem; max-width: 50px; }
    .wizard-actions { flex-wrap: wrap; gap: 8px; }
    .wizard-actions .btn { flex: 1; min-width: 120px; text-align: center; justify-content: center; }

    /* Summary grid */
    .summary-grid { grid-template-columns: 1fr; padding: 14px; gap: 10px; }

    /* Payment options */
    .payment-options { grid-template-columns: 1fr 1fr; gap: 10px; }

    /* Modales responsive */
    .modal { padding: 12px; }
    .modal-content { padding: 24px 18px; max-width: 100%; border-radius: var(--radius-sm); }
    .modal-content.modal-wide { max-width: 100%; }
    .modal-title { font-size: 1.1rem; }

    /* Certificado imprimible */
    .cert-border { padding: 20px 16px; }
    .cert-logo { font-size: 1.2rem; }
    .cert-header h2 { font-size: .9rem; }
    .cert-row { font-size: .82rem; }

    /* Stat card */
    .stat-card { padding: 14px; gap: 12px; }
    .stat-value { font-size: 1.2rem; }

    /* Feature cards */
    .feature-card { padding: 20px; }
    .feature-icon { font-size: 2rem; margin-bottom: 10px; }
    .feature-card h3 { font-size: 1rem; }
    .feature-card p { font-size: .85rem; }

    /* Footer */
    .footer { padding: 30px 16px; }
    .footer-grid { grid-template-columns: 1fr; gap: 20px; text-align: center; }
    .footer-bottom { font-size: .72rem; }

    /* Tablas */
    .table { font-size: .8rem; }
    .table th, .table td { padding: 8px 8px; }

    /* Token items */
    .token-item { flex-wrap: wrap; gap: 8px; font-size: .82rem; }

    /* Buttons ajuste */
    .btn-lg { padding: 12px 24px; font-size: .95rem; }

    /* Toast */
    #toast-container { left: 12px; right: 12px; top: 72px; }
    .toast { min-width: auto; width: 100%; }

    /* Disclaimer */
    .disclaimer { font-size: .78rem; padding: 10px 12px; }

    /* Paso 5: botones post-emisión */
    .flex.flex-wrap.gap-2 { flex-direction: column; }
    .flex.flex-wrap.gap-2 .btn { width: 100%; justify-content: center; }
}

/* —— SMALL MOBILE (≤480px) —— */
@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: .88rem; }
    .hero { padding: 40px 12px; }

    .section { padding: 32px 12px; }
    .section-title { font-size: 1.3rem; }
    .section-subtitle { font-size: .85rem; margin-bottom: 22px; }

    /* Grids 1 columna */
    .grid-4 { grid-template-columns: 1fr; }
    .sim-results-grid { grid-template-columns: 1fr; }

    /* Stat cards vertical */
    .stat-card { flex-direction: column; text-align: center; padding: 14px; }
    .stat-value { font-size: 1.15rem; }

    /* Payment options 1 col */
    .payment-options { grid-template-columns: 1fr; }

    /* Wizard labels ocultos, solo círculos */
    .step-label { display: none; }
    .step-circle { width: 28px; height: 28px; font-size: .75rem; }
    .wizard-steps::before { top: 14px; }

    /* Cards menos padding */
    .card { padding: 16px; }
    .card-header { font-size: 1rem; margin-bottom: 12px; }

    /* Sidebar iconos + texto corto */
    .sidebar-nav a { padding: 8px 10px; font-size: .78rem; gap: 6px; }

    /* Cert card */
    .cert-card { padding: 14px; }
    .cert-card-header { flex-direction: column; align-items: flex-start; gap: 6px; }

    /* Navbar brand */
    .navbar-brand { font-size: 1.1rem; gap: 6px; }
    .navbar-logo { height: 32px; }

    /* Container */
    .container { padding: 0 12px; }

    /* Form controls */
    .form-control { padding: 8px 12px; font-size: .9rem; }
    .btn { padding: 8px 18px; font-size: .88rem; }
    .btn-sm { padding: 5px 12px; font-size: .78rem; }
}

/* —— ULTRA SMALL (≤360px) —— */
@media (max-width: 360px) {
    .hero h1 { font-size: 1.3rem; }
    .navbar-brand { font-size: 1rem; }
    .navbar-logo { height: 28px; }
    .dash-main { padding: 12px 8px; }
    .card { padding: 12px; }
    .stat-card { padding: 10px; }
    .stat-value { font-size: 1rem; }
    .stat-label { font-size: .75rem; }
    .summary-grid { padding: 10px; }
    .summary-item .value { font-size: .95rem; }
    .cert-border { padding: 14px 10px; }
}

/* ═══════════ PRINT ═══════════ */
@media print {
    body * { visibility: hidden; }
    .certificate, .certificate * { visibility: visible; }
    .certificate { position: absolute; top: 0; left: 0; width: 100%; }
}

/* ═══════════ ICONOS SVG INSTITUCIONALES ═══════════ */
.icon {
    display: inline-block;
    width: 1em; height: 1em;
    vertical-align: -0.125em;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}
.icon-sm  { width: .85em; height: .85em; }
.icon-lg  { width: 1.25em; height: 1.25em; }
.icon-xl  { width: 1.5em; height: 1.5em; }

/* Icono decorativo grande en feature-cards y empty-states */
.feature-icon .icon,
.pay-icon .icon {
    width: 2.2rem; height: 2.2rem;
}
.stat-icon .icon {
    width: 1.6rem; height: 1.6rem;
}
.empty-state .icon {
    width: 3rem; height: 3rem;
    opacity: .45;
}
.nav-icon .icon {
    width: 1.1rem; height: 1.1rem;
    vertical-align: -0.15em;
}
.dark-toggle .icon {
    width: 1.1rem; height: 1.1rem;
}
.disclaimer .icon {
    width: 1rem; height: 1rem;
    vertical-align: -0.15em;
    color: var(--warning);
}
.disclaimer .icon-info {
    color: var(--info);
}

/* Modal body scroll */
.modal-open { overflow: hidden; }
