/* Generador QR — estilos base (sin framework).
   Tema claro por defecto; el tema oscuro se activa con <html data-theme="dark">. */

:root {
    color-scheme: light;

    --font-display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --bg: #f6f7fb;
    --surface: #ffffff;
    --text: #1f2430;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #4f46e5;        /* botones y elementos interactivos */
    --primary-dark: #4338ca;
    --accent: #4f46e5;         /* texto de acento sobre el fondo */
    --accent-soft-bg: #eef2ff; /* fondos suaves de badges/secciones activas */
    --accent-soft-border: #c7d2fe;
    --ok: #16a34a;
    --bad: #dc2626;
    --success-bg: #f0fdf4;  --success-text: #166534;  --success-border: #bbf7d0;
    --error-bg: #fef2f2;    --error-text: #991b1b;    --error-border: #fecaca;
    --info-bg: #eff6ff;     --info-text: #1e40af;     --info-border: #bfdbfe;
    --active-badge-bg: #f0fdf4; --active-badge-border: #bbf7d0;
    --inactive-badge-bg: #f3f4f6;
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 8px 24px rgba(16, 24, 40, 0.06);
    --radius: 12px;
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0f1420;
    --surface: #171e2e;
    --text: #e6eaf2;
    --muted: #98a2b3;
    --border: #2a3348;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #a5b4fc;
    --accent-soft-bg: rgba(99, 102, 241, 0.16);
    --accent-soft-border: rgba(129, 140, 248, 0.45);
    --ok: #4ade80;
    --bad: #f87171;
    --success-bg: #10291a;  --success-text: #86efac;  --success-border: #14532d;
    --error-bg: #2b1416;    --error-text: #fca5a5;    --error-border: #7f1d1d;
    --info-bg: #14243f;     --info-text: #93c5fd;     --info-border: #1e3a8a;
    --active-badge-bg: #10291a; --active-badge-border: #14532d;
    --inactive-badge-bg: rgba(148, 163, 184, 0.12);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

/* El atributo hidden SIEMPRE oculta, aunque el elemento tenga display propio
   (sin esto, .user-menu-panel { display:flex } anulaba hidden y el menú
   quedaba visible todo el tiempo) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Jerarquía tipográfica: display con personalidad, cuerpo neutro y legible */
h1, h2, h3, .brand, .plan-price, .stat-number {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }

/* Enlace de salto para teclado (accesibilidad) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--primary);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus { left: 1rem; }

/* Foco visible uniforme para teclado */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Cabecera / pie ---------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }

@media (max-width: 900px) {
    .nav { gap: 0.75rem; font-size: 0.92rem; }
    .nav-user { display: none; } /* el nombre ocupa; el resto del menú respira */
}

/* Móvil: la navegación primaria se desliza horizontalmente sin romper la barra */
@media (max-width: 640px) {
    .header-inner { height: auto; padding: 0.6rem 1rem; flex-wrap: wrap; }
    .nav {
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .nav::-webkit-scrollbar { display: none; }
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    color: var(--text);
}
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
[data-theme="dark"] .theme-toggle .ti-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .ti-sun { display: none; }

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding: 1.25rem 0;
    color: var(--muted);
    font-size: 0.9rem;
}

main { padding: 2.5rem 0; }

/* ---------- Hero ---------- */

.hero { text-align: center; padding: 2.5rem 0 1rem; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin: 0 0 0.75rem; letter-spacing: -0.02em; }
.hero .accent {
    color: var(--accent);
    background: var(--accent-soft-bg);
    border-radius: 0.35em;
    padding: 0 0.18em;
    box-decoration-break: clone;
}
.lead { color: var(--muted); font-size: 1.1rem; max-width: 42rem; margin: 0 auto 1.5rem; }

.actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.db-status {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }

/* ---------- Tarjetas / features ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 2.5rem 0;
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-soft-bg);
    color: var(--accent);
    margin-bottom: 0.6rem;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Botones ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-lg { padding: 0.8rem 1.6rem; font-size: 1.05rem; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Generador ---------- */

.generator h1 { margin-bottom: 0.25rem; }
.generator > .lead { margin-bottom: 1.75rem; }

.generator-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 760px) {
    .generator-grid { grid-template-columns: 1fr; }
}

.tabs {
    display: inline-flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 1.25rem;
}
.tab {
    border: 0;
    background: transparent;
    padding: 0.4rem 1.1rem;
    border-radius: 7px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
    cursor: pointer;
}
.tab.is-active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.field { margin-bottom: 1.1rem; }
.field label, .field > .ecc-options { display: block; }
.field label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

/* Configuración del sitio (admin): tarjetas por grupo con ayudas por campo */
.admin-settings { max-width: 46rem; margin: 0 auto; }
.admin-settings-group { margin-bottom: 1.25rem; padding: 1.5rem; }
.admin-settings-group h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.admin-settings-group .field:last-child { margin-bottom: 0; }
.field-hint { color: var(--muted); font-size: 0.82rem; margin: 0.35rem 0 0; line-height: 1.45; }
.field-inline { display: flex; align-items: center; gap: 0.6rem; }
.field-inline input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
.field-inline label { margin: 0; }

textarea, select, input[type="email"], input[type="password"], input[type="text"], input[type="number"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    resize: vertical;
}
textarea:focus, select:focus,
input[type="email"]:focus, input[type="password"]:focus, input[type="text"]:focus, input[type="number"]:focus,
.ecc input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}

.hint { color: var(--muted); font-size: 0.82rem; margin: 0.35rem 0 0; }

.field-error { color: var(--bad); font-size: 0.85rem; margin: 0.4rem 0 0; font-weight: 500; }

.ecc-options { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.ecc {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}
.ecc:has(input:checked) { border-color: var(--accent); color: var(--accent); font-weight: 700; }

.preview-card { text-align: center; }
.qr-preview {
    --scan-c: var(--accent);
    --scan-w: 2px;
    --scan-s: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 0.5rem;
    background:
        linear-gradient(var(--scan-c) 0 0) top left / var(--scan-s) var(--scan-w) no-repeat,
        linear-gradient(var(--scan-c) 0 0) top left / var(--scan-w) var(--scan-s) no-repeat,
        linear-gradient(var(--scan-c) 0 0) top right / var(--scan-s) var(--scan-w) no-repeat,
        linear-gradient(var(--scan-c) 0 0) top right / var(--scan-w) var(--scan-s) no-repeat,
        linear-gradient(var(--scan-c) 0 0) bottom left / var(--scan-s) var(--scan-w) no-repeat,
        linear-gradient(var(--scan-c) 0 0) bottom left / var(--scan-w) var(--scan-s) no-repeat,
        linear-gradient(var(--scan-c) 0 0) bottom right / var(--scan-s) var(--scan-w) no-repeat,
        linear-gradient(var(--scan-c) 0 0) bottom right / var(--scan-w) var(--scan-s) no-repeat,
        var(--surface);
}
.qr-preview canvas, .qr-preview svg { max-width: 100%; height: auto; }
.preview-card .actions { margin-top: 1rem; }

/* ---------- Personalización del QR ---------- */

.swatches { display: flex; flex-wrap: wrap; gap: 0.55rem; }

.swatch {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--sw);
    cursor: pointer;
    padding: 0;
}

/* Área táctil ampliada sin agrandar el visual (mínimo recomendado 24px + margen) */
.swatch::after {
    content: '';
    position: absolute;
    inset: -5px;
}
.swatch:hover { transform: scale(1.1); }
.swatch.is-active { outline: 2px solid var(--accent); outline-offset: 1px; }

.swatch-picker { width: 36px; height: 30px; padding: 2px; }

.picker-row { display: flex; align-items: center; gap: 0.5rem; }

.customize-title { margin: 1.5rem 0 1rem; font-size: 1.05rem; }

.customize-tabs { display: flex; width: 100%; margin-bottom: 1.25rem; }
.customize-tabs .tab { flex: 1; text-align: center; }

.picker-row.is-locked { opacity: 0.55; }

.readonly-input {
    background: var(--bg);
    color: var(--muted);
    cursor: default;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88rem;
}

.pro-field.is-locked { opacity: 0.6; }

.badge.pro-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.pro-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
}
.picker-row input[type="color"] { width: 44px; height: 30px; padding: 2px; }

.check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.92rem; color: var(--text); cursor: pointer; }

.pro-label {
    display: flex !important;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
}

.pro-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.pro-field.is-locked .mode-fields,
.pro-field.is-locked .picker-row,
.pro-field.is-locked .image-field { opacity: 0.45; }
.pro-field.is-locked input[type="file"],
.pro-field.is-locked input[type="color"],
.pro-field.is-locked input[type="checkbox"],
.pro-field.is-locked select { opacity: 0.45; }

/* ---------- Guardar en la cuenta (generador) ---------- */

.save-area {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn-save {
    background: #059669;
    color: #fff;
    width: 100%;
}
.btn-save:hover:not(:disabled) { background: #047857; }

.save-status-error { color: var(--bad); font-weight: 600; }

/* ---------- Mis códigos ---------- */

.codes-page h1 { margin-bottom: 0.25rem; }
.codes-page > .lead { margin-bottom: 1.5rem; }

.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.empty-state p { color: var(--muted); margin: 0 0 1rem; }

.codes-list { display: flex; flex-direction: column; gap: 0.9rem; }

.code-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}
@media (max-width: 640px) {
    .code-item { flex-direction: column; align-items: stretch; }
}

.code-info { min-width: 0; }
.code-badges { display: flex; gap: 0.4rem; margin-bottom: 0.35rem; }

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-active {
    background: var(--active-badge-bg);
    color: var(--ok);
    border: 1px solid var(--active-badge-border);
}
.badge-expired {
    background: var(--inactive-badge-bg);
    color: var(--muted);
    border: 1px solid var(--border);
}
.badge-dynamic {
    background: var(--accent-soft-bg);
    color: var(--accent);
    border: 1px solid var(--accent-soft-border);
}
.badge-type {
    background: var(--accent-soft-bg);
    color: var(--accent);
    border: 1px solid var(--accent-soft-border);
}

.code-content {
    margin: 0 0 0.25rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.code-actions { display: flex; gap: 0.5rem; flex-shrink: 0; flex-wrap: wrap; }

.btn-danger { background: transparent; color: var(--bad); border-color: var(--error-border); }
.btn-danger:hover:not(:disabled) { background: var(--error-bg); border-color: var(--bad); }

/* ---------- Barra: sesión / plan / menú de perfil ---------- */

.user-menu { position: relative; }

/* Trigger en fila; el badge del plan se posiciona absoluto sobre la esquina
   superior derecha del nombre (pisando ligeramente la última letra) sin
   alterar el alto de la barra */
.user-menu-trigger {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 0;
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    font: inherit;
    color: var(--text);
    cursor: pointer;
}
.user-menu-trigger:hover { background: var(--accent-soft-bg); }

.nav-user-wrap { position: relative; display: inline-flex; }

.nav-user {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
}

.user-menu-caret { font-size: 0.6rem; color: var(--muted); line-height: 1; }

.user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0.4rem;
    z-index: 40;
}
.user-menu-panel a,
.user-menu-panel button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: 7px;
    text-decoration: none;
    color: var(--text);
    background: none;
    border: 0;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.user-menu-panel a:hover,
.user-menu-panel button:hover { background: var(--accent-soft-bg); color: var(--accent); }
.user-menu-panel button { color: var(--bad); }
.user-menu-panel button:hover { background: var(--error-bg); color: var(--bad); }

.user-menu-sep { border-top: 1px solid var(--border); margin: 0.3rem 0.25rem; }

.plan-badge {
    position: absolute;
    top: -0.55rem;
    right: -0.4rem;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--surface);
    border-radius: 999px;
    padding: 0.02rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .plan-badge { color: #1f2430; }

/* ---------- Mensajes flash ---------- */

.flash {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.flash-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.flash-error { background: var(--error-bg); color: var(--error-text); border-color: var(--error-border); }
.flash-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }

/* ---------- Páginas de autenticación ---------- */

.auth-wrap { display: flex; justify-content: center; padding: 1.5rem 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.auth-card .lead { font-size: 0.95rem; margin-bottom: 1.25rem; }
.auth-card form { margin-top: 0.5rem; }
.auth-card .field label { display: block; }

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.7rem 1.2rem;
}

.form-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.auth-alt {
    margin: 1.25rem 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}
.auth-alt a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }

/* ---------- Mi perfil ---------- */

.auth-card-wide {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.auth-card-flat h2 { margin: 0 0 1rem; font-size: 1.15rem; }

/* ---------- Precios ---------- */

.pricing-page h1 { margin-bottom: 0.25rem; }
.pricing-page > .lead { margin-bottom: 1.75rem; }

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.plan-card { display: flex; flex-direction: column; position: relative; }
.plan-featured {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
}

.badge-current {
    position: absolute;
    top: -12px;
    right: 16px;
    background: var(--ok);
    color: #fff;
    border-radius: 999px;
    padding: 0.15rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.plan-card h3 { margin: 0; font-size: 1.2rem; }
.plan-price {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.4rem 0 1rem;
    color: var(--accent);
}

.plan-features {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    flex: 1;
}
.plan-features li {
    padding: 0.3rem 0 0.3rem 1.5rem;
    position: relative;
    color: var(--text);
    font-size: 0.95rem;
}
.plan-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--ok);
    font-weight: 700;
}

.plan-cta .is-current { cursor: default; opacity: 0.7; }
.plan-upgrade { text-align: center; }
.plan-cta .hint { text-align: center; margin-top: 0.4rem; }

.pricing-note { text-align: center; margin-top: 1.5rem; }

/* ---------- Publicidad ---------- */

.ad-slot {
    margin: 1.25rem auto;
    min-height: 90px; /* reserva espacio: evita CLS cuando AdSense carga */
    text-align: center;
}

.ad-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

/* Pauta interna: banner sencillo gestionado desde el panel */
.ad-internal {
    background: var(--surface);
    border: 1px solid var(--accent-soft-border);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    text-align: left;
}
.ad-internal-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.ad-internal-title { margin: 0; font-weight: 700; color: var(--text); }
.ad-internal-text { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.92rem; }

.ad-custom { overflow-x: auto; }

/* ---------- Panel de administración ---------- */

.admin-nav {
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.35rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.admin-nav a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.4rem 0.9rem;
    border-radius: 7px;
}
.admin-nav a:hover { color: var(--accent); }
.admin-nav a.is-active { background: var(--accent-soft-bg); color: var(--accent); }
.admin-nav a.admin-back { margin-left: auto; }
.admin-nav a.admin-back:hover { color: var(--bad); }

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.stat-card { text-align: center; padding: 1.25rem; }
.stat-number { font-size: 2rem; font-weight: 800; margin: 0; color: var(--accent); }
.stat-label { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td {
    text-align: left;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.admin-table thead th {
    background: var(--bg);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table a { color: var(--accent); font-weight: 600; text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }
.admin-table select { padding: 0.35rem 0.5rem; font-size: 0.88rem; }

.plans-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.admin-plan-form h3 { margin: 0 0 1rem; }
.admin-plan-form .check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.admin-plan-form .check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text);
}

/* Tarjeta de plan: el formulario de edición y el de borrado son hermanos
   (los form no se anidan) pero se pintan dentro de la misma tarjeta. */
.admin-plan-card { display: flex; flex-direction: column; }
.admin-plan-card .plan-delete-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.admin-settings-form { max-width: 640px; }

.inline-form { display: inline; margin: 0; }

/* ---------- Banner de consentimiento de cookies ---------- */

.cookie-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 50;
    max-width: 880px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.cookie-banner p { margin: 0; font-size: 0.9rem; flex: 1 1 320px; }
.cookie-banner a { color: var(--accent); font-weight: 600; }
.cookie-actions { display: flex; gap: 0.5rem; }

/* ---------- Editor Quill (tema snow) adaptado a ambos temas ---------- */
/* Especificidad alta: el CSS de Quill carga después de app.css */

/* ---------- Editor Quill (tema snow) adaptado a ambos temas ---------- */
/* El propio .rich-editor recibe las clases ql-container ql-snow de Quill;
   la toolbar se inserta como hermana anterior dentro del mismo .field */

.ql-toolbar.ql-snow {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
}

.rich-editor.ql-snow.ql-container {
    border: 0;
    border-top: 0;
    font-family: var(--font-body);
    font-size: 0.95rem;
}

.rich-editor.ql-snow .ql-editor {
    min-height: 220px;
    background: var(--surface);
    color: var(--text);
    line-height: 1.6;
}

.ql-editor.ql-blank::before {
    color: var(--muted);
    font-style: normal;
}

/* Iconos y selectores del toolbar visibles en ambos temas */
.ql-snow .ql-stroke { stroke: var(--text); }
.ql-snow .ql-fill,
.ql-snow .ql-stroke.ql-fill { fill: var(--text); }
.ql-snow .ql-picker-label { color: var(--text); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button:focus .ql-stroke { stroke: var(--accent); }
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
.ql-snow .ql-picker-label.ql-active { color: var(--accent); }
.ql-snow .ql-picker-options {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

/* ---------- Guías ---------- *//* ---------- Guías ---------- */

.guides-page h1 { margin-bottom: 0.25rem; }
.guides-page > .lead { margin-bottom: 1.5rem; }

.guide-title { margin: 0 0 0.25rem; font-size: 1.05rem; }
.guide-title a { color: var(--text); text-decoration: none; }
.guide-title a:hover { color: var(--accent); }
.guide-excerpt { margin: 0; color: var(--muted); font-size: 0.92rem; }

.guide-article { max-width: 720px; margin: 0 auto; }
.guide-article h1 { margin-bottom: 0.25rem; }
.guide-body { margin-top: 1.25rem; line-height: 1.75; }
.guide-body h2 { font-size: 1.3rem; margin: 1.75rem 0 0.5rem; }
.guide-body h3 { font-size: 1.1rem; }
.guide-body a { color: var(--accent); }
.guide-body img { max-width: 100%; height: auto; border-radius: 8px; }

.legal-page { max-width: 720px; margin: 0 auto; }
.legal-page h1 { margin-bottom: 1rem; }
.legal-body { line-height: 1.75; }
.legal-body h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.legal-body a { color: var(--accent); }

.inline-form { display: inline; margin: 0; }

/* ---------- Contenido editable ---------- */

.admin-content-form { max-width: 760px; }

.rich-editor {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #1f2430;
}
.rich-editor .ql-toolbar { border: 0; border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.rich-editor .ql-container { border: 0; border-radius: 0 0 10px 10px; font: inherit; }
.rich-editor .ql-editor { min-height: 90px; }

.content-field .image-field { display: flex; flex-direction: column; gap: 0.5rem; }
.image-preview {
    max-width: 220px;
    max-height: 120px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    padding: 0.25rem;
}

.feature-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.6rem;
}
