/* ============================================================
   RedKing OS — Modern Dropshipping Dashboard

   Los colores NO se escriben a mano en las reglas: todo sale de
   los tokens de :root. Para el tema claro solo se redefinen los
   tokens en :root[data-theme="light"] y el resto se ajusta solo.
   ============================================================ */

:root {
    color-scheme: dark;

    /* Superficies */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-inset: rgba(255, 255, 255, 0.03);
    --bg-tint: rgba(255, 255, 255, 0.04);
    --bg-tint-2: rgba(255, 255, 255, 0.06);
    --bg-tint-3: rgba(255, 255, 255, 0.05);
    --bg-tint-4: rgba(255, 255, 255, 0.1);
    --bg-code: #0a0a14;
    --code-text: #a8b5d1;

    /* Bordes */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);

    /* Texto */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --heading-from: #f1f5f9;
    --heading-to: #94a3b8;

    /* Sombras */
    --shadow-soft: rgba(0, 0, 0, 0.2);
    --shadow-hover: rgba(0, 0, 0, 0.3);

    /* Gráficos */
    --ring-track: rgba(255, 255, 255, 0.1);

    /* Acentos */
    --accent: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.25);

    /* Oro de la marca: varias paradas para simular metal pulido */
    --gold-hi: #fff3c4;
    --gold-1: #f2cd68;
    --gold-2: #d9a02f;
    --gold-3: #a86a17;
    --gold-text: #b9a06a;
    --font-brand: 'Cinzel', 'Trajan Pro', Georgia, 'Times New Roman', serif;

    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.25);
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.25);
    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, 0.25);
    --red: #ef4444;

    --sidebar-width: 260px;
    --radius: 16px;
    --radius-sm: 10px;
}

/* ============================================================
   Tema claro
   ============================================================ */
:root[data-theme="light"] {
    color-scheme: light;

    --bg-primary: #eef1f6;
    --bg-secondary: #ffffff;
    --bg-card: rgba(16, 24, 40, 0.035);
    --bg-card-hover: rgba(16, 24, 40, 0.06);
    --bg-inset: rgba(16, 24, 40, 0.025);
    --bg-tint: rgba(16, 24, 40, 0.04);
    --bg-tint-2: rgba(16, 24, 40, 0.07);
    --bg-tint-3: rgba(16, 24, 40, 0.05);
    --bg-tint-4: rgba(16, 24, 40, 0.1);
    --bg-code: #f2f4f9;
    --code-text: #3a465e;

    --border-glass: rgba(16, 24, 40, 0.12);
    --border-glass-hover: rgba(16, 24, 40, 0.22);

    --text-primary: #0f172a;
    --text-secondary: #46536b;
    --text-muted: #6b7891;
    --heading-from: #0f172a;
    --heading-to: #55617a;

    --shadow-soft: rgba(16, 24, 40, 0.08);
    --shadow-hover: rgba(16, 24, 40, 0.14);

    --ring-track: rgba(16, 24, 40, 0.12);

    /* Oro más oscuro: el de antes se perdía sobre blanco */
    --gold-hi: #d2a12c;
    --gold-1: #b07c17;
    --gold-2: #96620f;
    --gold-3: #6d4407;
    --gold-text: #8a7443;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ============================================================
    Login
    La autenticación ya no vive aquí ni en nginx: la app pide
    cuenta (registro/login) en /app/login.html contra /api/.
    ============================================================ */

/* Estilos de sesión/upsell que antes injectaba sesion.js inline */
.rk-usuario {display:flex;align-items:center;gap:8px;margin-bottom:10px;font-size:12px;color:var(--text-muted)}
.rk-usuario .rk-correo {flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rk-usuario .rk-plan {background:var(--accent-glow);color:var(--accent);border-radius:20px;padding:3px 9px;font-weight:700}
.rk-usuario button {background:var(--bg-tint);border:1px solid var(--border-glass);color:var(--text-secondary);
    border-radius:20px;padding:5px 10px;cursor:pointer;font:inherit;font-size:12px}
.rk-usuario button:hover {color:var(--red);border-color:rgba(239,68,68,.3)}
.rk-bloqueado {opacity:.55}
.rk-upsell {text-align:center;padding:32px 24px}
.rk-upsell h3 {margin-bottom:8px}
.rk-upsell p {color:var(--text-secondary);font-size:14px;margin-bottom:16px}
.rk-upsell a {display:inline-block}

/* ============================================================
    Particles Background
   ============================================================ */
.particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.15;
    animation: float linear infinite;
}

@keyframes float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.15; }
    90% { opacity: 0.15; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    backdrop-filter: blur(20px);
    transition: transform 0.3s ease, background-color 0.25s ease;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 22px 20px 20px;
    border-bottom: 1px solid var(--border-glass);
}

.brand-icon {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    animation: pulse-glow 3s ease-in-out infinite;
}

/* Las paradas del degradado del emblema salen de los tokens, así el
   medallón también cambia con el tema. */
.gold-stop-hi { stop-color: var(--gold-hi); }
.gold-stop-1 { stop-color: var(--gold-1); }
.gold-stop-2 { stop-color: var(--gold-2); }
.gold-stop-3 { stop-color: var(--gold-3); }

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 8px var(--accent-glow)); }
    50% { filter: drop-shadow(0 0 20px var(--accent-glow)); }
}

.brand-text h1 {
    font-family: var(--font-brand);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.1;
    background: linear-gradient(180deg,
        var(--gold-hi) 0%, var(--gold-1) 32%, var(--gold-2) 58%,
        #e8c064 80%, var(--gold-3) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-text p {
    font-size: 10px;
    color: var(--gold-text);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
}

.nav-section {
    padding: 20px 0;
    flex: 1;
}

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 20px 12px;
    font-weight: 600;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-tint);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(245,158,11,0.1);
    border-left-color: var(--accent);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    right: 12px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--accent-glow);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-glass);
}

/* Preferencias: tema e idioma */
.prefs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.seg {
    display: flex;
    flex: 1;
    gap: 2px;
    padding: 3px;
    background: var(--bg-inset);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
}

.seg-lang { flex: 0 0 auto; }

.seg-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 9px;
    background: transparent;
    border: none;
    border-radius: 16px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.seg-btn:hover { color: var(--text-primary); }

.seg-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.seg-btn[aria-pressed="true"] {
    background: var(--accent-glow);
    color: var(--accent);
}

/* En la sidebar solo el icono: el nombre accesible va en aria-label */
.seg-txt { display: none; }

.btn-reset {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tint);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    border-radius: 20px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-reset:hover {
    color: var(--red);
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.08);
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 100;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    padding: 10px;
}

.mobile-toggle svg { width: 100%; height: 100%; }

/* ============================================================
   Content Area
   ============================================================ */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 40px;
    position: relative;
    z-index: 1;
    max-width: 1200px;
}

.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--heading-from), var(--heading-to));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.header-date {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    white-space: nowrap;
}

/* ============================================================
   Glass Card
   ============================================================ */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: var(--border-glass-hover);
    box-shadow: 0 8px 32px var(--shadow-soft);
}

/* ============================================================
   Stats Grid
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px var(--shadow-hover);
}

.stat-card.stat-green::before { background: linear-gradient(90deg, var(--green), var(--green-glow)); }
.stat-card.stat-orange::before { background: linear-gradient(90deg, var(--accent), var(--accent-glow)); }
.stat-card.stat-blue::before { background: linear-gradient(90deg, var(--blue), var(--blue-glow)); }
.stat-card.stat-purple::before { background: linear-gradient(90deg, var(--purple), var(--purple-glow)); }

.stat-icon { font-size: 28px; }

.stat-info { flex: 1; }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    margin-top: 4px;
    letter-spacing: -0.5px;
}

.stat-card.stat-green .stat-value { color: var(--green); }
.stat-card.stat-orange .stat-value { color: var(--accent); }
.stat-card.stat-blue .stat-value { color: var(--blue); }
.stat-card.stat-purple .stat-value { color: var(--purple); }

.stat-trend {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

/* ============================================================
   Welcome Card
   ============================================================ */
.welcome-card {
    background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.02));
    border: 1px solid rgba(245,158,11,0.15);
}

.welcome-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-content p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    max-width: 600px;
}

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-glow {
    background: linear-gradient(135deg, var(--accent), #f97316);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-glow);
}

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

.btn-ghost {
    background: var(--bg-tint-2);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-ghost:hover {
    background: var(--bg-tint-4);
    border-color: var(--border-glass-hover);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
}

.section-icon { width: 22px; height: 22px; color: var(--accent); }

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.quick-step {
    background: var(--bg-inset);
    padding: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    transition: all 0.3s ease;
}

.quick-step:hover { background: var(--bg-tint-2); }

.step-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #f97316);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: white;
    margin-bottom: 12px;
}

.quick-step h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.quick-step p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   Forms
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.input-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-tint);
    border: 1.5px solid var(--border-glass);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.input-prefix, .input-suffix {
    padding: 0 12px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-inset);
    height: 100%;
    display: flex;
    align-items: center;
}

.input-prefix { border-right: 1px solid var(--border-glass); }
.input-suffix { border-left: 1px solid var(--border-glass); }

.input-wrapper input, .input-full {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.input-full {
    background: var(--bg-tint);
    border: 1.5px solid var(--border-glass);
    border-radius: var(--radius-sm);
}

.input-full:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper input[type="number"]::-webkit-inner-spin-button { opacity: 0.5; }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-glass);
    border-radius: 3px;
    outline: none;
    padding: 0;
    margin: 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent), #f97316);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 16px var(--accent-glow);
}

.range-value {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    color: var(--accent);
    font-size: 16px;
}

.input-with-suffix { padding-right: 0; }

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent), #f97316);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-glow);
    font-family: 'Inter', sans-serif;
}

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

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

.btn-full { width: 100%; }

/* ============================================================
   Result Card
   ============================================================ */
.result-card {
    display: none;
    margin-top: 24px;
    padding: 24px;
    background: var(--bg-inset);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    animation: fadeIn 0.3s ease;
}

.result-card.show { display: block; }

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-glass);
    font-size: 14px;
}

.result-row:last-child { border-bottom: none; }

.result-label { color: var(--text-secondary); }

.result-value { font-weight: 600; }

.result-highlight {
    border-top: 2px solid var(--accent);
    margin-top: 8px;
    padding-top: 16px;
}

.result-highlight .result-label { font-weight: 700; font-size: 15px; }
.result-highlight .result-value {
    font-size: 26px;
    color: var(--accent);
    font-weight: 800;
}

.veredicto {
    font-size: 20px;
    font-weight: 700;
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.veredicto.go { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.veredicto.fix { background: rgba(245,158,11,0.1); color: var(--accent); border: 1px solid rgba(245,158,11,0.2); }
.veredicto.kill { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

/* El bloque de ROAS que genera app.js */
.roas-box {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tint);
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================================
   Checklist
   ============================================================ */
#checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.checklist-category h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-glass);
}

.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.check-item:hover { color: var(--text-primary); }

.check-item input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.check-item input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--accent), #f97316);
    border-color: var(--accent);
}

.check-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.check-item input[type="checkbox"]:checked ~ span {
    color: var(--text-primary);
    text-decoration: line-through;
    opacity: 0.6;
}

/* Progress Ring */
.page-header .progress-ring {
    position: relative;
    flex-shrink: 0;
}

.ring-track { stroke: var(--ring-track); }
.ring-bar { stroke: var(--accent); }

.progress-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.progress-center span {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
}

/* ============================================================
   Prompts
   ============================================================ */
.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.prompt-card { padding: 24px; }

.prompt-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.prompt-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.prompt-badge {
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-glow);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(245,158,11,0.2);
}

.prompt-code {
    background: var(--bg-code);
    color: var(--code-text);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.7;
    font-family: 'SF Mono', 'Fira Code', monospace;
    border: 1px solid var(--border-glass);
    margin-bottom: 16px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.btn-copy {
    width: 100%;
    padding: 10px;
    background: var(--bg-tint-3);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.btn-copy:hover {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: rgba(245,158,11,0.3);
}

/* ============================================================
   Navegación: los items son <button>, hay que neutralizar
   el estilo nativo del botón y dejar solo el nuestro.
   ============================================================ */
button.nav-item {
    width: 100%;
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    font-family: inherit;
    text-align: left;
}

.nav-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* ============================================================
   Tabla de productos
   ============================================================ */
.tabla-scroll { overflow-x: auto; }

.tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tabla th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 12px 12px;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.tabla td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover td { background: var(--bg-tint); }

.td-nombre {
    font-weight: 600;
    white-space: normal;
    min-width: 160px;
}

.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.pill.go   { background: rgba(16,185,129,0.12); color: var(--green);  border: 1px solid rgba(16,185,129,0.25); }
.pill.fix  { background: rgba(245,158,11,0.12); color: var(--accent); border: 1px solid rgba(245,158,11,0.25); }
.pill.kill { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.25); }

.btn-del {
    padding: 6px 12px;
    background: var(--bg-tint);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-del:hover {
    color: var(--red);
    border-color: rgba(239,68,68,0.35);
    background: rgba(239,68,68,0.08);
}

/* Estado "armado" de los botones que confirman en dos pasos */
.armado {
    color: var(--red) !important;
    border-color: rgba(239,68,68,0.4) !important;
    background: rgba(239,68,68,0.1) !important;
}

/* Acciones de la tabla de productos */
.td-acciones { white-space: nowrap; }
.td-acciones .btn-del + .btn-del { margin-left: 6px; }

.btn-wa:hover {
    color: var(--green);
    border-color: rgba(16,185,129,0.35);
    background: rgba(16,185,129,0.08);
}

/* La fila de la tasa de devolución que tienes puesta en el formulario */
.tabla tbody tr.fila-actual td {
    background: var(--accent-glow);
    font-weight: 600;
}

.marca-actual {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    border: 1px solid rgba(245,158,11,0.35);
    border-radius: 10px;
    padding: 1px 6px;
    margin-left: 4px;
}

/* Mensaje de WhatsApp generado */
.wa-mensaje {
    background: var(--bg-code);
    color: var(--code-text);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.7;
    font-family: 'SF Mono', 'Fira Code', monospace;
    border: 1px solid var(--border-glass);
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.wa-mensaje.vacio {
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    text-align: center;
    padding: 28px 16px;
}

/* ============================================================
   Barra de datos (exportar / importar)
   ============================================================ */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; }

.tools-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    max-width: 620px;
}

.tool-msg {
    display: none;
    font-size: 13px;
    margin-top: 14px;
}

.tool-msg.show { display: block; }
.tool-msg.ok { color: var(--green); }
.tool-msg.error { color: var(--red); }

.estado-vacio {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 40px 28px;
}

.val-aviso {
    display: none;
    font-size: 13px;
    color: var(--green);
    text-align: center;
    margin-top: 14px;
}

.val-aviso.show { display: block; }

.val-aviso.aviso { color: var(--accent); }

.btn-copy.copiado {
    background: rgba(16,185,129,0.15);
    color: var(--green);
    border-color: rgba(16,185,129,0.3);
}

/* ============================================================
   Página de ayuda (uso.html)
   ============================================================ */
.doc {
    margin-left: var(--sidebar-width);
    flex: 1;
    max-width: 880px;
    padding: 40px 40px 72px;
    position: relative;
    z-index: 1;
}

.doc-head { margin-bottom: 28px; }

.doc-head h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.doc-head p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 6px;
}

.doc h2 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 14px;
}

.doc h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 18px 0 6px;
}

.doc p, .doc li, .doc dd {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.doc p { margin-bottom: 12px; }
.doc ul, .doc ol { padding-left: 20px; margin-bottom: 12px; }
.doc li { margin-bottom: 6px; }

.doc code {
    background: var(--bg-code);
    color: var(--code-text);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.lista-def { margin-bottom: 8px; }

.lista-def dt {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 14px;
}

.lista-def dt:first-child { margin-top: 0; }
.lista-def dd { margin: 4px 0 0; }

.pasos { list-style: none; padding-left: 0; }

.pasos > li {
    border-left: 2px solid var(--accent);
    padding: 2px 0 2px 16px;
    margin-bottom: 16px;
}

.pasos h3 { margin-top: 0; }

.reglas { list-style: none; padding-left: 0; }

.reglas li {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    border: 1px solid var(--border-glass);
    font-size: 13px;
}

.reglas li.ok  { color: var(--green);  background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.2); }
.reglas li.mid { color: var(--accent); background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2); }
.reglas li.bad { color: var(--red);    background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.2); }

.dos-columnas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 8px;
}

.dos-columnas h3 { margin-top: 0; }

.nota { color: var(--text-muted); font-size: 13px; }

.nota-destacada {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-tint);
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

/* El índice del lateral son enlaces, no botones */
a.nav-item { text-decoration: none; }

.btn-volver {
    display: block;
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 10px;
    text-align: center;
    text-decoration: none;
    background: var(--bg-tint);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.btn-volver:hover {
    color: var(--accent);
    border-color: rgba(245,158,11,0.35);
    background: var(--accent-glow);
}

.doc-pie { margin-top: 8px; text-align: center; }

.btn-volver-pie {
    display: inline-block;
    width: auto;
    padding: 10px 20px;
    margin: 0;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card { animation: slideUp 0.5s ease backwards; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .content { padding: 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .mobile-toggle { display: block; }
    .content {
        margin-left: 0;
        padding: 16px;
        padding-top: 72px;
    }
    .doc {
        margin-left: 0;
        padding: 16px;
        padding-top: 72px;
    }
    .dos-columnas { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    #checklist-grid { grid-template-columns: 1fr; }
    .prompts-grid { grid-template-columns: 1fr; }
    .quick-actions { flex-direction: column; }
    .btn-glow, .btn-ghost { width: 100%; text-align: center; }
}
