/* ==========================================================================
   Cuenta, planes y páginas de acceso
   ========================================================================== */

/* ---------- Menú de la cuenta en la cabecera ---------- */
.appbar .brand { text-decoration: none; color: inherit; display: flex; align-items: center; }
.appbar-end { gap: 8px; align-items: center; }
.acct-slot { display: flex; align-items: center; gap: 8px; }
.acct-slot > .btn { text-decoration: none; }
.acct { position: relative; }
.acct-btn {
    display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border: 1px solid var(--line);
    background: #fff; border-radius: 999px; cursor: pointer; transition: border-color .2s, background .2s;
}
.acct-btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.acct-av {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.acct-txt { display: grid; text-align: left; line-height: 1.15; }
.acct-txt b { font-size: 13px; }
.acct-txt small { font-size: 11px; color: var(--muted); }
.acct-menu {
    position: absolute; right: 0; top: calc(100% + 8px); width: 290px; z-index: 60;
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px;
    box-shadow: 0 18px 50px -12px rgba(21, 26, 45, .25); animation: acctIn .18s var(--ease);
}
@keyframes acctIn { from { opacity: 0; transform: translateY(-4px); } }
.acct-head { display: grid; gap: 1px; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-head b { font-size: 14px; }
.acct-head small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.acct-usage { margin-top: 10px; display: grid; gap: 6px; font-size: 12px; color: var(--ink-2); }
.acct-usage-top { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.acct-usage-top span:first-child { display: inline-flex; gap: 5px; align-items: center; font-weight: 650; color: var(--accent-ink); }
.acct-usage .ico { width: 14px; height: 14px; }
.acct-bar { height: 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.acct-bar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.acct-menu a, .acct-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none;
    border-radius: 9px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; cursor: pointer; text-align: left;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--surface-2); color: var(--ink); }
.acct-menu .ico { width: 16px; height: 16px; color: var(--muted); }
.acct-menu [data-logout] { color: var(--danger); }
.acct-menu [data-logout] .ico { color: var(--danger); }

/* Chip de uso junto al menú (asistente) */
.usage-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
    text-decoration: none;
}
.usage-chip .ico { width: 14px; height: 14px; color: var(--accent); }
.usage-chip.low { background: var(--warn-soft); border-color: #f6dfb5; color: #92400e; }

/* Aviso para invitados */
.guest-notice {
    display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px;
    background: var(--accent-soft); border: 1px solid #dcdffc; color: var(--accent-ink); font-size: 13.5px;
}
.guest-notice .ico { color: var(--accent); }
.guest-notice p { margin: 0; flex: 1; }
.guest-notice .btn { flex-shrink: 0; }

/* Ventana de acceso (SweetAlert) */
.signup-popup { padding-bottom: 20px; }
.signup-popup .swal2-html-container { margin: 10px 20px 0; text-align: left; overflow: visible; }
.signup-msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: #92400e; font-size: 13.5px; }
.signup-tabs { margin: 0 0 16px; display: flex; }
.signup-tabs button { flex: 1; }
.signup-form .field { margin-bottom: 12px; }
.signup-hint { font-weight: 500; color: var(--muted); font-size: 12px; }
.signup-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ok); margin: 4px 0 0; }
.signup-note .ico { width: 16px; height: 16px; margin-top: 1px; }

/* ---------- Páginas de cuenta (acceso, cuenta, planes) ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 32px 20px 60px; }
.page-narrow { max-width: 440px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 28px; margin-bottom: 6px; }
.page-head p { margin: 0; color: var(--ink-2); }
.center { text-align: center; }
.card {
    background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h2 .ico { color: var(--accent); }
.field input, .field select, .field textarea {
    padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 11px; background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.field small { font-weight: 500; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-block { width: 100%; justify-content: center; }
.muted { color: var(--muted); }
.link { color: var(--accent); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; }
.alert { padding: 11px 13px; border-radius: 11px; font-size: 13.5px; margin-bottom: 14px; }
.alert-err { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }

/* Acceso */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 28px 16px 60px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .page-head { text-align: center; }
.auth-card .page-head h1 { font-size: 24px; }
.auth-card .seg-tabs { display: flex; margin-bottom: 18px; }
.auth-card .seg-tabs button { flex: 1; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 13px; color: var(--muted); }

/* Planes */
.billing-toggle { display: flex; justify-content: center; margin: 0 0 26px; }
.billing-toggle .seg-tabs { display: inline-flex; }
.save-tag { margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 1px 7px; border-radius: 999px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; align-items: stretch; }
.plan {
    position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
    border-radius: 18px; padding: 24px 22px; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s;
    animation: planIn .5s var(--ease) both;
}
.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.plan:nth-child(2) { animation-delay: .06s; } .plan:nth-child(3) { animation-delay: .12s; } .plan:nth-child(4) { animation-delay: .18s; }
@keyframes planIn { from { opacity: 0; transform: translateY(10px); } }
.plan.featured { border: 2px solid var(--accent); box-shadow: 0 18px 40px -18px rgba(79, 70, 229, .45); }
.plan-badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff;
    font-size: 11.5px; font-weight: 700; padding: 3px 12px; border-radius: 999px; white-space: nowrap;
}
.plan-current { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 2px 8px; border-radius: 999px; }
.plan h3 { font-size: 18px; }
.plan-desc { color: var(--muted); font-size: 13px; margin: 4px 0 16px; min-height: 36px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin-bottom: 4px; }
.plan-price b { font-size: 34px; letter-spacing: -.03em; }
.plan-price span { color: var(--muted); font-size: 13.5px; }
.plan-sub { font-size: 12.5px; color: var(--muted); min-height: 18px; margin-bottom: 16px; }
.plan ul { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 9px; font-size: 13.5px; flex: 1; }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li .ico { width: 16px; height: 16px; color: var(--ok); margin-top: 2px; }
.plan li.no { color: var(--muted); }
.plan li.no .ico { color: var(--muted); }
.plan .btn { justify-content: center; }
.plan .pp-box { margin-top: 10px; min-height: 0; }
.plans-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }

/* Cuenta */
.acct-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 20px; letter-spacing: -.02em; }
.meter { height: 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 8px; transition: width .8s var(--ease); }
.meter.warn span { background: var(--warn); }
.plan-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plan-line h3 { font-size: 20px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.acc { background: var(--accent-soft); color: var(--accent-ink); }
.empty-row { text-align: center; color: var(--muted); padding: 24px 10px !important; }

@media (max-width: 760px) {
    .acct-txt { display: none; }
    .appbar-center { display: none; }
    .acct-btn { padding: 3px; }
    .am-hide-xs { display: none !important; }
    .acct-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .stat { padding: 10px; }
    .stat b { font-size: 17px; }
    .page { padding: 22px 16px 60px; }
    .page-head h1 { font-size: 23px; }
    .card { padding: 18px 16px; }
    .acct-menu { position: fixed; top: 60px; right: 12px; left: 12px; width: auto; }
    .guest-notice { flex-wrap: wrap; }
    .usage-chip span { display: none; }
}

/* Formatos no incluidos en el plan */
.fmt.locked { cursor: pointer; }
.fmt.locked .fmt-box { opacity: .6; background: var(--surface-2); }
.fmt.locked .fmt-check { display: none; }
.fmt-lock {
    position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px;
}
.fmt-lock .ico { width: 12px; height: 12px; }
.fmt .fmt-box { position: relative; }

/* Recuperar contraseña */
.forgot-link { margin: -6px 0 14px; text-align: right; font-size: 13px; }
.auth-ico { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.auth-ico .ico { width: 22px; height: 22px; }
.pw-rules { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin: -4px 0 14px; }
.pw-rules.ok { color: var(--ok); }
.pw-rules .ico { width: 14px; height: 14px; }

/* Correo sin confirmar */
.verify-strip { background: var(--warn-soft); border-bottom: 1px solid #f6dfb5; color: #92400e; animation: acctIn .25s var(--ease); }
.verify-in { max-width: 1180px; margin: 0 auto; padding: 9px 24px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.verify-in .ico { width: 18px; height: 18px; flex-shrink: 0; }
.verify-in p { margin: 0; flex: 1; }
.verify-in .btn { flex-shrink: 0; background: #fff; color: #92400e; border: 1px solid #f6dfb5; }
.auth-ico.ok { background: var(--ok-soft); color: var(--ok); }
.auth-ico.bad { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 760px) {
    .verify-in { padding: 9px 16px; flex-wrap: wrap; font-size: 13px; }
}

/* Continuar con Google */
.gbtn { display: flex; justify-content: center; min-height: 44px; margin-bottom: 4px; }
.gbtn-err { margin: 0; font-size: 12.5px; color: var(--danger); text-align: center; }
.or-sep { display: flex; align-items: center; gap: 12px; margin: 12px 0 16px; font-size: 12.5px; color: var(--muted); }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.acct-av { overflow: hidden; }
.acct-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.google-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; margin-bottom: 12px; }
.google-tag svg { width: 14px; height: 14px; }
.small { font-size: 12.5px; }

/* Selector de idioma */
.lang-slot { display: flex; align-items: center; }
.lang { position: relative; }
.lang-btn {
    display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px; border: 1px solid var(--line);
    background: #fff; border-radius: 10px; cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--ink-2);
}
.lang-btn:hover { border-color: var(--line-2); background: var(--surface-2); color: var(--ink); }
.lang-btn .ico { width: 16px; height: 16px; }
.lang-menu {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 170px; z-index: 60; background: #fff; border: 1px solid var(--line);
    border-radius: 12px; padding: 5px; box-shadow: 0 18px 50px -12px rgba(21, 26, 45, .25); animation: acctIn .18s var(--ease);
}
.lang-menu button {
    display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 10px; border: 0; background: none;
    border-radius: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; text-align: left;
}
.lang-menu button:hover { background: var(--surface-2); color: var(--ink); }
.lang-menu button.on { color: var(--accent-ink); font-weight: 650; }
.lang-menu .ico { width: 15px; height: 15px; color: var(--accent); }
@media (max-width: 760px) {
    .lang-btn { padding: 0 8px; }
    .lang-btn span { display: none; }
}
/* En pantallas medianas se deja solo el icono de ayuda */
@media (max-width: 900px) {
    #btnHowTo span { display: none; }
}

/* Pie de página con enlaces legales */
.site-footer {
    max-width: 1080px; margin: 0 auto; padding: 18px 20px 28px; display: flex; flex-wrap: wrap; gap: 8px 18px;
    justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted);
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
body.page-admin .site-footer { display: none; }

/* Aceptación de términos */
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 16px; font-size: 13px; color: var(--ink-2); line-height: 1.45; cursor: pointer; text-align: left; }
.consent input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.consent a, .consent-note a { color: var(--accent); font-weight: 600; }
.consent-note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.4; }
.consent.shake { animation: consentShake .4s; }
@keyframes consentShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Aviso de cookies (informativo) */
.cookie-note {
    position: fixed; left: 16px; bottom: 16px; z-index: 80; max-width: 420px; display: flex; gap: 12px; align-items: flex-start;
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 14px 16px;
    box-shadow: 0 18px 50px -12px rgba(21, 26, 45, .3); font-size: 13px; color: var(--ink-2); animation: acctIn .3s var(--ease);
    transition: opacity .25s, transform .25s;
}
.cookie-note.out { opacity: 0; transform: translateY(8px); }
.cookie-note .ico { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.cookie-note p { margin: 0; flex: 1; line-height: 1.45; }
.cookie-note a { color: var(--accent); font-weight: 600; }
.cookie-note .btn { flex-shrink: 0; align-self: center; }
body[data-inline-auth="1"] .cookie-note { bottom: 96px; }
@media (max-width: 760px) {
    .cookie-note { left: 12px; right: 12px; max-width: none; flex-wrap: wrap; }
}

/* Privacidad y datos (Mi cuenta) */
.privacy-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.privacy-actions > div { display: grid; gap: 2px; }
.privacy-actions b { font-size: 14px; }
.privacy-actions small { font-size: 12.5px; color: var(--muted); }
.privacy-actions .btn { flex-shrink: 0; text-decoration: none; }
.privacy-actions.danger b { color: var(--danger); }
.consent-plans { margin-top: 6px; } .consent-plans a { color: var(--accent); font-weight: 600; }

/* ---------- Indicador de pasos del asistente: fuera de la cabecera ---------- */
.appbar.appbar-wizard { grid-template-columns: minmax(0, 1fr) auto; }
.stepbar { display: flex; justify-content: center; padding: 18px 20px 2px; }
.stepbar .stepper {
    display: flex; align-items: center; gap: 12px; padding: 6px 10px; margin: 0;
    background: #fff; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm);
}
.stepbar .stepper .step { padding: 5px 10px 5px 5px; border-radius: 999px; }
.stepbar .stepper .step-label { white-space: nowrap; }
.stepbar .step-line { width: 36px; }
.stepbar + .mstep + .shell, .stepbar ~ .shell { padding-top: 16px; }
/* Hay espacio para los cuatro nombres hasta tablet; más abajo solo se nombra el paso actual */
@media (max-width: 980px) {
    .stepbar .stepper .step-label { display: inline; }
    .stepbar .step-line { width: 24px; }
}
@media (max-width: 760px) {
    .stepbar .stepper .step:not(.active) .step-label { display: none; }
    .stepbar .stepper .step:not(.active) { padding-right: 5px; }
}
@media (max-width: 640px) {
    .stepbar { display: none; }   /* en el móvil se usa la barra de progreso .mstep */
}

/* Móvil: aviso de invitado a lo ancho (el botón baja) y "Entrar" solo con icono */
@media (max-width: 760px) {
    .guest-notice p { flex: 1 1 calc(100% - 40px); }
    .guest-notice .btn { margin-left: 30px; }
}
@media (max-width: 640px) {
    .acct-slot > .btn-ghost span { display: none; }
    .acct-slot > .btn-ghost { padding: 7px 9px; }
}
.plan-renew { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin: -8px 0 14px; } .plan-renew .ico { width: 13px; height: 13px; color: var(--accent); }
.sub-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; margin-bottom: 8px; } .sub-card .btn { margin-top: 4px; }
