/* ============================================================
   Account pages
   ============================================================ */

.account-main {
    flex: 1;
    padding: 7rem 1.5rem 4rem;
    background:
        radial-gradient(circle at 18% 18%, rgba(105, 172, 128, 0.16) 0%, transparent 55%),
        radial-gradient(circle at 82% 72%, rgba(176, 120, 87, 0.14) 0%, transparent 55%),
        var(--dark);
    min-height: 100vh;
}

.account-shell {
    margin: 0 auto;
}

.account-shell--narrow {
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 18px;
    padding: 2.5rem;
    backdrop-filter: blur(10px);
}

.account-shell--wide {
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.account-card {
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 18px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.account-card--form {
    max-width: 560px;
    margin: 0 auto;
}

/* ---------- Login / register typography ---------- */
.account-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.account-meta {
    color: var(--muted);
    margin: 1rem 0 0;
}

/* ---------- Forms ---------- */
.account-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.account-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: var(--muted);
}

.account-form input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--stroke);
    color: var(--light);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.account-form input:focus {
    border-color: var(--primary);
}

/* Show the current value as an italic hint; the field starts empty and typing
   replaces it, so submitting requires deliberately entering a new value. */
.account-form input.input-hint::placeholder {
    font-style: italic;
    color: var(--muted);
    opacity: 1;
}

.account-form button {
    margin-top: 0.25rem;
    width: 100%;
    justify-content: center;
}

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

/* ---------- Flash messages ---------- */
.account-error,
.account-flash {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.account-flash-msg {
    flex: 1;
}

.account-flash-dismiss {
    flex-shrink: 0;
    margin: -0.4rem -0.3rem -0.4rem 0;
    padding: 0 0.35rem;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.account-flash-dismiss:hover {
    opacity: 1;
}

.account-error,
.account-flash--err {
    background: rgba(220, 80, 80, 0.15);
    border: 1px solid rgba(220, 80, 80, 0.4);
    color: #ffb3b3;
}

.account-flash--ok {
    background: rgba(105, 172, 128, 0.15);
    border: 1px solid rgba(105, 172, 128, 0.4);
    color: #c8efd5;
}

.account-flash--warn {
    background: rgba(230, 180, 90, 0.15);
    border: 1px solid rgba(230, 180, 90, 0.4);
    color: #f1d9a7;
}

/* ============================================================
   Hero
   ============================================================ */
.account-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 2rem;
    background:
        linear-gradient(135deg, rgba(105, 172, 128, 0.18), rgba(176, 120, 87, 0.12)),
        var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.avatar--initials,
.avatar--preset {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.avatar--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar--lg { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar--lg .fas { font-size: 1.4rem; }
.avatar--xl { width: 84px; height: 84px; font-size: 2rem; letter-spacing: 1px; }
.avatar--xl .fas { font-size: 1.7rem; }

.account-hero-text {
    flex: 1;
    min-width: 220px;
}

.account-hero-eyebrow {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    margin: 0;
}

.account-hero-name {
    font-size: 2rem;
    margin: 0.15rem 0 0.35rem;
}

.account-hero-meta {
    color: var(--muted);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
}

.account-hero-meta i {
    margin-right: 0.35rem;
    opacity: 0.85;
}

/* Email is blurred by default; reveal on hover/focus or a persistent click toggle. */
.account-email-mask {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    filter: blur(5px);
    transition: filter 0.18s ease;
    user-select: none;
}

.account-email-mask:hover,
.account-email-mask:focus-visible,
.account-email-mask.is-revealed {
    filter: none;
    user-select: text;
}

.account-hero-sep {
    opacity: 0.5;
}

.account-hero-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.account-hero-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--stroke);
    color: var(--light);
    padding: 0.65rem 1.1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.account-hero-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
}

.account-hero-btn--ghost {
    background: transparent;
}

/* ============================================================
   Sections
   ============================================================ */
.account-section {
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 22px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.account-section-head {
    margin-bottom: 1.5rem;
}

.account-section-head h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.account-section-head h2 i {
    color: var(--primary);
    font-size: 1.1rem;
}

.account-section-head p {
    color: var(--muted);
    margin-top: 0.4rem;
    font-size: 0.95rem;
}

/* ============================================================
   Product cards
   ============================================================ */
.pcard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.pcard {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--stroke);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.pcard:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.pcard-banner {
    position: relative;
    height: 110px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcard-banner-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.22), transparent 60%);
    pointer-events: none;
}

.pcard-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.7rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.pcard-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.85rem;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    padding: 0.2rem 0.65rem;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pcard-body {
    padding: 1.25rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.pcard-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pcard-title {
    font-size: 1.25rem;
    margin: 0;
}

.pcard-status {
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

.pcard-status--owned {
    background: rgba(105, 172, 128, 0.22);
    color: #b4e8c3;
    border: 1px solid rgba(105, 172, 128, 0.35);
}

.pcard-status--available {
    background: rgba(255, 200, 120, 0.18);
    color: #ffd7a1;
    border: 1px solid rgba(255, 200, 120, 0.32);
}

.pcard-status--pending {
    background: rgba(230, 200, 90, 0.22);
    color: #ffe294;
    border: 1px solid rgba(230, 200, 90, 0.45);
    animation: pcard-pending-pulse 2s ease-in-out infinite;
}

@keyframes pcard-pending-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230, 200, 90, 0.18); }
    50% { box-shadow: 0 0 0 6px rgba(230, 200, 90, 0); }
}

.pcard-status--soon {
    background: rgba(140, 140, 140, 0.18);
    color: #d6d6d6;
    border: 1px solid rgba(180, 180, 180, 0.3);
}

.pcard--soon { opacity: 0.78; }
.pcard--pending .pcard-banner { filter: saturate(0.85); }

.pcard-dep-notice {
    background: rgba(95, 168, 211, 0.12);
    border: 1px solid rgba(95, 168, 211, 0.32);
    color: #aad7ef;
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    margin: 0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.pcard-dep-notice i { font-size: 0.8rem; opacity: 0.8; }

.pcard-dep-notice a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

.pcard-dep-notice a:hover { color: #fff; }

/* Status badge + early-access pill share the right side of the card head. */
.pcard-head-badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pcard-ea-badge {
    background: rgba(232, 161, 58, 0.2);
    color: #ffd79f;
    border: 1px solid rgba(232, 161, 58, 0.42);
}

.pcard-ea-badge[data-tip] { cursor: help; }

/* Amber warning callout explaining what early access means. */
.ea-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.45;
}

.ea-notice > i { margin-top: 0.15rem; flex-shrink: 0; font-size: 0.8rem; }
.ea-notice strong { color: #ffdca8; }

.ea-notice--card {
    background: rgba(232, 161, 58, 0.12);
    border: 1px solid rgba(232, 161, 58, 0.34);
    color: #f2ce9c;
    padding: 0.55rem 0.75rem;
}

.pcard-tagline {
    color: var(--muted);
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
}

.pcard-desc {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0;
}

.pcard-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.pcard-features li {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

.pcard-features i {
    color: var(--primary);
    font-size: 0.75rem;
}

.pcard-actions {
    margin-top: auto;
    padding-top: 0.5rem;
}

.pcard-cta {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pcard-buy {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.pcard-buy:has(.inline-form:only-child) {
    grid-template-columns: 1fr;
}

.pcard-buy .inline-form {
    display: contents;
}

.pcard-buy button.payment-method-link {
    width: 100%;
    cursor: pointer;
    font-family: inherit;
}

/* "Cancel & try again" link shown under a pending purchase. */
.pcard-cancel {
    margin-top: 0.5rem;
    text-align: center;
}

.pcard-cancel-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text-muted, #9aa0a6);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    opacity: 0.85;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.pcard-cancel-btn:hover {
    opacity: 1;
    color: var(--text, #e8eaed);
    text-decoration: underline;
}

/* Bundle card: list of included plugins. */
.pcard-bundle-items {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pcard-bundle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.75;
}

.pcard-bundle-item.is-owned {
    opacity: 1;
}

.pcard-bundle-item i {
    color: var(--product-accent, #69ac80);
}

/* ============================================================
   Bundles: "Show bundles" button + overlay
   ============================================================ */
.account-section-head--row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.bundles-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: var(--surface-2);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.bundles-toggle:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.bundles-toggle i { color: var(--primary); }

/* Per-buyer price summary shown on a bundle card. */
.pcard-bundle-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.pcard-bundle-total {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}

.pcard-bundle-was {
    text-decoration: line-through;
    color: var(--muted);
    font-size: 0.95rem;
}

.pcard-bundle-save {
    font-size: 0.8rem;
    font-weight: 600;
    color: #c8efd5;
    background: rgba(105, 172, 128, 0.15);
    border: 1px solid rgba(105, 172, 128, 0.4);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.bundle-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.bundle-overlay[hidden] { display: none; }

.bundle-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.bundle-overlay-panel {
    position: relative;
    /* Size to the cards inside (one bundle shouldn't float in a huge box),
       capped so many bundles wrap instead of stretching. */
    width: fit-content;
    max-width: min(900px, 100%);
    min-width: min(340px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--dark);
    border: 1px solid var(--stroke);
    border-radius: 20px;
    padding: 1.5rem 1.6rem 1.8rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.bundle-overlay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.bundle-overlay-head h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bundle-overlay-head h2 i { color: var(--primary); }

.bundle-overlay-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.9rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.4rem;
    transition: color 0.15s ease;
}

.bundle-overlay-close:hover { color: #fff; }

.bundle-overlay-sub {
    color: var(--muted);
    margin: 0.4rem 0 1.2rem;
    font-size: 0.95rem;
    max-width: 42ch;
}

/* Flex (not grid) so the panel's fit-content width tracks the cards: one card
   sits at roughly the same width as the plugin cards behind the modal;
   multiple bundles wrap into rows. */
.bundle-overlay-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.bundle-overlay-grid > .pcard {
    flex: 1 1 360px;
    max-width: 400px;
}

body.bundle-overlay-open { overflow: hidden; }

/* ============================================================
   Version history modal (owned product card)
   ============================================================ */
.version-history-btn {
    margin-top: 0.5rem;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--stroke);
    background: var(--surface);
    color: var(--muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.version-history-btn:hover {
    color: var(--light);
    background: var(--surface-2);
    border-color: rgba(105, 172, 128, 0.35);
}

/* The modal is anchored to its .pcard (position: relative) and clipped to the
   card's rounded corners, so it opens *over that card* rather than floating in
   the viewport. It scrolls internally when the version list is long. */
.vh-modal {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    /* Panel sizes to its content and hugs the bottom, so it folds up from the
       card's bottom edge; a long list is capped at the card height and scrolls. */
    align-items: flex-end;
    justify-content: center;
    padding: 8px;
    border-radius: inherit;
    overflow: hidden;
}

.vh-modal[hidden] { display: none; }

.vh-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    animation: vh-fade 0.2s ease both;
}

.vh-modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 100%;
    background: var(--dark);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
    /* Fold up from the bottom edge of the card. */
    transform-origin: bottom center;
    animation: vh-foldup 0.28s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

@keyframes vh-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes vh-foldup {
    from { opacity: 0; transform: translateY(100%) scaleY(0.85); }
    to { opacity: 1; transform: translateY(0) scaleY(1); }
}

.vh-modal-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.vh-modal-head h2 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.vh-modal-head h2 i { color: var(--primary); }

.vh-modal-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.4rem;
    transition: color 0.15s ease;
}

.vh-modal-close:hover { color: #fff; }

/* The list is the scrollable region; the header stays pinned above it. */
.vh-modal .version-history__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--stroke);
    border-radius: 12px;
}

/* ============================================================
   Requirements chip + modal (account product card)
   ============================================================ */
/* Clickable pill that replaces the inline "Requires ..." line so a long list
   never overflows the card; it opens the fold-up modal below. */
.pcard-req-chip {
    margin: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(95, 168, 211, 0.32);
    background: rgba(95, 168, 211, 0.12);
    color: #aad7ef;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pcard-req-chip:hover {
    background: rgba(95, 168, 211, 0.2);
    border-color: rgba(95, 168, 211, 0.5);
    color: #cfe9f7;
}

.pcard-req-chip > i:first-child { font-size: 0.8rem; opacity: 0.85; }

.pcard-req-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(95, 168, 211, 0.28);
    color: #eaf6fc;
    font-size: 0.72rem;
    font-weight: 700;
}

.pcard-req-chip__arrow {
    margin-left: auto;
    font-size: 0.72rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.pcard-req-chip:hover .pcard-req-chip__arrow { transform: translateX(2px); }

/* Overlay folds up over its card, same as .vh-modal (reuses those keyframes). */
.req-modal {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 8px;
    border-radius: inherit;
    overflow: hidden;
}

.req-modal[hidden] { display: none; }

.req-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    animation: vh-fade 0.2s ease both;
}

.req-modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 100%;
    background: var(--dark);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
    transform-origin: bottom center;
    animation: vh-foldup 0.28s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

.req-modal-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.req-modal-head h2 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.req-modal-head h2 i { color: #7fbfe0; }

.req-modal-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.4rem;
    transition: color 0.15s ease;
}

.req-modal-close:hover { color: #fff; }

.req-modal__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.req-modal__item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: var(--surface);
}

.req-modal__icon {
    flex-shrink: 0;
    width: 1.4rem;
    text-align: center;
    color: #7fbfe0;
    font-size: 0.9rem;
}

.req-modal__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.req-modal__name {
    font-weight: 600;
    color: var(--light);
    font-size: 0.92rem;
}

.req-modal__name a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.req-modal__name a:hover { color: #cfe9f7; text-decoration: underline; }

.req-modal__name a i { font-size: 0.7rem; opacity: 0.8; }

.req-modal__kind {
    font-size: 0.72rem;
    color: var(--muted);
}

/* Optional requirement: amber pill (with the note tucked behind a hover info
   icon) plus a subtly tinted row so it reads as "nice to have, not required". */
.req-modal__opt {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: rgba(224, 184, 119, 0.16);
    border: 1px solid rgba(224, 184, 119, 0.34);
    color: #e6c18a;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.req-modal__opt[data-tip] { cursor: help; }

.req-modal__opt i { font-size: 0.72rem; }

.req-modal__note-icon {
    margin-left: 0.4rem;
    font-size: 0.72rem;
    color: var(--muted);
    cursor: help;
    transition: color 0.15s ease;
}

.req-modal__note-icon:hover { color: #cfe9f7; }

.req-modal__item--optional {
    border-color: rgba(224, 184, 119, 0.3);
    background: rgba(224, 184, 119, 0.06);
}

.req-modal__item--optional .req-modal__icon { color: #e6c18a; }

/* Optional badge + version pill, right-aligned and stacked one per line. */
.req-modal__meta {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.req-modal__ver {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(95, 168, 211, 0.16);
    border: 1px solid rgba(95, 168, 211, 0.3);
    color: #aad7ef;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Dependency warning modal (buy buttons with an unmet dependency)
   ============================================================ */
.dep-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dep-modal[hidden] { display: none; }

.dep-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
    animation: dep-fade 0.18s ease both;
}

.dep-modal-panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    text-align: center;
    background: var(--dark);
    border: 1px solid var(--stroke);
    border-radius: 18px;
    padding: 1.9rem 1.6rem 1.5rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    animation: dep-pop 0.24s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

@keyframes dep-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dep-pop {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dep-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--primary);
    background: rgba(105, 172, 128, 0.14);
    border: 1px solid rgba(105, 172, 128, 0.3);
}

/* Amber icon for the early-access acknowledgement modal. */
.dep-modal-icon--warn {
    color: #f0b95e;
    background: rgba(232, 161, 58, 0.14);
    border-color: rgba(232, 161, 58, 0.4);
}

.dep-modal-title {
    font-size: 1.25rem;
    margin: 0 0 0.6rem;
}

.dep-modal-body {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 1.5rem;
}

.dep-modal-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: center;
}

.dep-modal-btn {
    flex: 1;
    max-width: 170px;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dep-modal-btn--ghost {
    background: transparent;
    border: 1px solid var(--stroke);
    color: var(--muted);
}

.dep-modal-btn--ghost:hover {
    color: #fff;
    border-color: var(--muted);
}

.dep-modal-btn--go {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #0d130f;
}

.dep-modal-btn--go:hover { filter: brightness(1.08); }

/* ============================================================
   Purchase history table
   ============================================================ */
.hist-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--stroke);
    border-radius: 14px;
}

.hist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.hist-table thead {
    background: rgba(0, 0, 0, 0.25);
}

.hist-table th {
    text-align: left;
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    border-bottom: 1px solid var(--stroke);
}

.hist-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}

.hist-table tr:last-child td {
    border-bottom: none;
}

.hist-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.hist-provider {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: capitalize;
}

.hist-ref code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.18rem 0.4rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--muted);
}

.hist-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.hist-status {
    text-transform: capitalize;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    display: inline-block;
}

.hist-status--ok {
    background: rgba(105, 172, 128, 0.2);
    color: #b4e8c3;
    border: 1px solid rgba(105, 172, 128, 0.32);
}

.hist-status--warn {
    background: rgba(255, 200, 120, 0.16);
    color: #ffd7a1;
    border: 1px solid rgba(255, 200, 120, 0.3);
}

.hist-status--err {
    background: rgba(220, 80, 80, 0.18);
    color: #ffb3b3;
    border: 1px solid rgba(220, 80, 80, 0.35);
}

.hist-link {
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

.hist-link:hover {
    color: var(--light);
}

/* "Cancel" action shown next to a pending purchase in the history table. */
.hist-cancel-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    font: inherit;
    font-weight: 600;
    color: #ffb3b3;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    opacity: 0.85;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.hist-cancel-btn:hover {
    opacity: 1;
    color: #ff8080;
    text-decoration: underline;
}

.hist-empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem 1rem;
    font-style: italic;
}

/* ============================================================
   Settings grid
   ============================================================ */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.25rem;
}

.settings-card {
    background: var(--surface-2);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-card h3 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
}

.settings-card h3 i {
    color: var(--primary);
    font-size: 0.95rem;
}

.settings-help {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
    /* Avoid a lone word wrapping onto its own last line. */
    text-wrap: pretty;
}

.settings-help code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 5px;
    font-size: 0.85em;
}

.cta-button--ghost {
    background: transparent;
    border: 1px solid var(--stroke);
    color: var(--light);
}

.cta-button--ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.cta-button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Slim, low-emphasis privacy/data actions row beneath the settings grid — most
   users never touch these GDPR controls, so they stay quiet until needed. */
.account-data-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.4rem;
    margin-top: 1.75rem;
    padding-top: 1.3rem;
    border-top: 1px solid var(--stroke);
    font-size: 0.85rem;
}

.data-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
    /* Also used on a <button> trigger, so strip native button chrome. */
    background: none;
    border: none;
    padding: 0;
    font: inherit;
}

.data-link:hover {
    color: var(--light);
}

.data-link i {
    font-size: 0.8rem;
}

.data-link--danger {
    color: rgba(224, 102, 102, 0.7);
    /* Desktop: push "Delete account" to the right, others stay left. */
    margin-left: auto;
    cursor: pointer;
}

.data-link--danger:hover {
    color: #e06666;
}

/* Screen-level "Delete account" confirmation modal. */
.delete-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.delete-modal[hidden] {
    display: none;
}

.delete-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    animation: del-fade 0.2s ease both;
}

.delete-modal-panel {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--dark);
    border: 1px solid rgba(220, 76, 76, 0.5);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    animation: del-pop 0.24s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

@keyframes del-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes del-pop {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

.delete-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.delete-modal-head h2 {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
}

.delete-modal-head h2 i {
    color: #e06666;
}

.delete-modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.4rem;
    transition: color 0.15s ease;
}

.delete-modal-close:hover {
    color: #fff;
}

.delete-modal-panel p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0 0 0.7rem;
}

.delete-modal-panel p strong {
    color: #e79a9a;
}

.delete-modal-panel .delete-modal-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(220, 76, 76, 0.12);
    border: 1px solid rgba(220, 76, 76, 0.4);
    color: #f2a1a1;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    margin: 0 0 0.9rem;
}

.delete-modal-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.1rem;
}

.delete-modal-actions .cta-button {
    flex: 1;
    justify-content: center;
}

/* Phones: shrink the row a touch and drop the right-align so all three links
   sit on a single line instead of wrapping "Delete account". */
@media (max-width: 560px) {
    .account-data-bar {
        font-size: 0.78rem;
        gap: 0.4rem 0.8rem;
    }

    .account-data-bar .data-link i {
        font-size: 0.72rem;
    }

    .data-link--danger {
        margin-left: 0;
    }
}

.cta-button--danger {
    background: rgba(220, 76, 76, 0.12);
    border: 1px solid rgba(220, 76, 76, 0.5);
    color: #f2a1a1;
}

.cta-button--danger:hover {
    background: rgba(220, 76, 76, 0.85);
    border-color: rgba(220, 76, 76, 0.85);
    color: #fff;
}

/* ============================================================
   Receipt page
   ============================================================ */
.receipt {
    max-width: 720px;
    margin: 0 auto;
}

.receipt-head {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--stroke);
    margin-bottom: 1.5rem;
}

.receipt-logo {
    height: 56px;
    width: auto;
}

.receipt-head h1 {
    font-size: 1.75rem;
    margin: 0;
}

.receipt-meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0.3rem 0 0;
}

.receipt-grid {
    display: grid;
    grid-template-columns: minmax(150px, max-content) 1fr;
    gap: 0.85rem 1.5rem;
    margin-bottom: 1.5rem;
}

.receipt-grid dt {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.receipt-grid dd {
    margin: 0;
    font-size: 1rem;
}

.receipt-grid code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85em;
}

.receipt-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

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

.receipt-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media print {
    .glass-nav, .receipt-actions { display: none !important; }
    .account-main { background: #fff !important; color: #000 !important; padding: 0 !important; }
    .account-card, .receipt-grid dd, .receipt-grid dt, .receipt-meta, .receipt-footer {
        background: #fff !important;
        color: #000 !important;
        border-color: #ccc !important;
    }
    .receipt-amount { color: #000 !important; }
}

/* ============================================================
   Verification banner + pill
   ============================================================ */
.verify-pill {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.6rem;
    vertical-align: middle;
}

.verify-pill--ok {
    background: rgba(105, 172, 128, 0.22);
    color: #b4e8c3;
    border: 1px solid rgba(105, 172, 128, 0.4);
}

.verify-pill--warn {
    background: rgba(230, 180, 90, 0.18);
    color: #ffd7a1;
    border: 1px solid rgba(230, 180, 90, 0.4);
}

.verify-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(230, 180, 90, 0.15), rgba(176, 120, 87, 0.1));
    border: 1px solid rgba(230, 180, 90, 0.32);
    flex-wrap: wrap;
}

.verify-banner--pending {
    background: linear-gradient(135deg, rgba(95, 168, 211, 0.15), rgba(95, 130, 211, 0.08));
    border-color: rgba(95, 168, 211, 0.35);
}

.verify-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffd7a1;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.verify-banner--pending .verify-banner-icon {
    color: #aad7ef;
}

.verify-banner-text {
    flex: 1;
    min-width: 200px;
}

.verify-banner-text p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.verify-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.verify-result-icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
}

.verify-result-icon.is-ok {
    background: rgba(105, 172, 128, 0.18);
    color: #b4e8c3;
}

.verify-result-icon.is-err {
    background: rgba(220, 80, 80, 0.18);
    color: #ffb3b3;
}

/* ============================================================
   Avatar settings card
   ============================================================ */
.settings-card--avatar { gap: 1.1rem; }

.avatar-preview-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-current-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.95rem;
}

.avatar-current-meta small {
    color: var(--muted);
    font-size: 0.8rem;
}

.avatar-upload-form { margin: 0; }

/* The avatar itself is the upload control: hovering (or keyboard-focusing) blurs
   the current avatar and reveals an upload icon; the hidden file input lives
   inside the label, so a click anywhere on the avatar opens the picker. */
.avatar-edit {
    position: relative;
    display: inline-block;
    border-radius: 50%;
    cursor: pointer;
    outline-offset: 3px;
}
.avatar-edit .avatar {
    transition: filter 0.2s ease;
}
.avatar-edit__overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.avatar-edit:hover .avatar,
.avatar-edit:focus-within .avatar {
    filter: blur(2px) brightness(0.85);
}
.avatar-edit:hover .avatar-edit__overlay,
.avatar-edit:focus-within .avatar-edit__overlay {
    opacity: 1;
}
.avatar-edit:focus-within {
    outline: 2px solid var(--primary);
}
.avatar-edit__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.avatar-presets-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    margin-top: 0.4rem;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color 0.15s ease;
}

.avatar-presets-toggle:hover {
    color: var(--light);
}

.avatar-presets-toggle i {
    font-size: 0.72rem;
    transition: transform 0.15s ease;
}

/* Reveal the full-width grid and spin the chevron when the toggle is checked. */
.avatar-presets-cb:checked ~ .avatar-presets {
    display: grid;
}

.avatar-presets-cb:checked ~ .avatar-preview-row .avatar-presets-toggle i {
    transform: rotate(90deg);
}

.avatar-presets {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.avatar-preset-btn {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}

.avatar-preset-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.avatar-preset-btn.is-selected {
    border-color: #fff;
}

/* ============================================================
   Discord settings card
   ============================================================ */
.discord-linked {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem;
    background: rgba(88, 101, 242, 0.10);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 12px;
}

.discord-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(88, 101, 242, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.discord-avatar--fallback i { font-size: 1.2rem; }

.discord-linked-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.discord-username {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.discord-linked-text small {
    color: var(--muted);
    font-size: 0.8rem;
}

.discord-connect-btn {
    background: #5865f2 !important;
    border-color: #5865f2 !important;
    color: #fff !important;
    width: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.discord-connect-btn:hover {
    background: #4752c4 !important;
    border-color: #4752c4 !important;
}

/* ============================================================
   Product icon (image variant)
   ============================================================ */
.pcard-icon--image {
    background: rgba(0, 0, 0, 0.45);
    padding: 8px;
}

.pcard-icon--image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ============================================================
   Nav helpers (kept)
   ============================================================ */
.nav-link--button {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    padding: 0;
}

.nav-logout-form {
    display: inline-flex;
    margin: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
    .account-main { padding: 6rem 1rem 3rem; }
    .account-shell--narrow { padding: 1.75rem 1.25rem; }
    .account-section { padding: 1.5rem 1.25rem; }
    .account-hero { padding: 1.5rem; }
    .account-hero-name { font-size: 1.5rem; }
    .account-avatar { width: 64px; height: 64px; font-size: 1.5rem; }
    .pcard-grid { grid-template-columns: 1fr; }
    .hist-table th, .hist-table td { padding: 0.7rem 0.75rem; }
}

/* ============================================================
   Two-factor authentication: setup / manage / backup-codes
   pages and the login challenge. Uses the account-card layout.
   ============================================================ */
/* The login 2FA challenge is a standalone page; collapse the outer narrow shell
   so it reads as one framed panel instead of a box inside a box. */
.account-shell--narrow:has(.twofa-panel) {
    max-width: 480px;
    background: none;
    border: 0;
    padding: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.twofa-panel {
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
}

/* Account-page 2FA modal (enrol / manage / recovery codes) - an overlay like
   the delete-account modal. */
.twofa-modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.twofa-modal[hidden] { display: none; }
.twofa-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    animation: twofa-fade 0.2s ease both;
}
.twofa-modal-panel {
    position: relative;
    width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
    background: var(--dark);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 1.5rem 1.6rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    animation: twofa-pop 0.24s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}
@keyframes twofa-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes twofa-pop { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.twofa-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.twofa-modal-head h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 0.5rem; }
.twofa-modal-head h2 i { color: var(--primary); }
.twofa-modal-close { background: none; border: none; color: var(--muted); font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 0.4rem; transition: color 0.15s ease; }
.twofa-modal-close:hover { color: #fff; }
.twofa-modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

.twofa-hero-icon {
    width: 64px; height: 64px; margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(105, 172, 128, 0.14);
    color: var(--primary, #69ac80);
    font-size: 1.7rem;
}
.twofa-code-input {
    letter-spacing: 0.35em;
    font-size: 1.15rem;
    text-align: center;
}

/* --- Settings-card pill (on/off) --- */
.twofa-pill {
    margin-left: auto;
    font-size: 0.72rem; font-weight: 700;
    padding: 0.15rem 0.55rem; border-radius: 99px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.settings-card h3 .twofa-pill { align-self: center; }
.twofa-pill--on { background: rgba(105, 172, 128, 0.18); color: #7ed09a; }
.twofa-pill--off { background: rgba(255, 255, 255, 0.08); color: var(--muted, rgba(255,255,255,0.7)); }

/* --- Combined Security card (2FA + active sessions) --- */
.security-item {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 0.6rem; padding: 0.85rem 0;
}
.security-item + .security-item { border-top: 1px solid var(--stroke, rgba(255,255,255,0.1)); }
.security-item__text { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.security-item__title { font-weight: 600; display: inline-flex; align-items: center; gap: 0.5rem; }
.security-item__title .twofa-pill { margin-left: 0; }
.security-item .settings-help { margin: 0; }
.security-item__action { flex-shrink: 0; white-space: nowrap; align-self: center; }
.security-note { align-self: flex-start; opacity: 0.85; }

/* Compact row variant: text on the left, button right-aligned on the same line
   (used for active sessions, which needs no emphasis). */
.security-item--row {
    flex-direction: row; align-items: center; flex-wrap: nowrap; gap: 1rem;
}
.security-item--row .security-item__text { flex: 1 1 auto; min-width: 0; }
.security-item--row .security-item__action { flex: 0 0 auto; align-self: center; margin-left: auto; }
/* Slightly compact button (with the short "Sign out" label) so the "Signed in
   on N devices" line keeps to one row without the button feeling tiny. */
.security-item--row .cta-button { padding: 0.6rem 1.2rem; font-size: 0.9rem; gap: 0.45rem; }
.security-item--row .settings-help { white-space: nowrap; }
@media (max-width: 360px) {
    .security-item--row { flex-wrap: wrap; }
}

/* The "Enable 2FA" call to action is deliberately louder than the other
   settings buttons: full width, heavier, with a soft pulsing glow. */
.security-cta {
    align-self: stretch;
    justify-content: center;
    font-weight: 700;
    animation: security-pulse 2.4s ease-in-out infinite;
}
@keyframes security-pulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(105, 172, 128, 0.25); }
    50% { box-shadow: 0 6px 24px rgba(105, 172, 128, 0.55); }
}
.security-item--nudge { position: relative; }

/* Account-page banner nudging the user to turn 2FA on. Reuses the verify-banner
   frame with a green (positive/security) accent to set it apart from the amber
   email one. */
.twofa-banner {
    background: linear-gradient(135deg, rgba(105, 172, 128, 0.16), rgba(105, 172, 128, 0.06));
    border-color: rgba(105, 172, 128, 0.4);
}
.twofa-banner .verify-banner-icon {
    color: #7ed09a;
    background: rgba(105, 172, 128, 0.16);
}
.twofa-banner__cta {
    animation: security-pulse 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .security-cta, .twofa-banner__cta { animation: none; }
}

/* --- Setup / enrollment --- */
.twofa-steps { margin: 0 0 1.25rem; padding-left: 1.2rem; color: var(--muted, rgba(255,255,255,0.7)); line-height: 1.6; }
.twofa-steps strong { color: var(--light, #f8f9fa); }
.twofa-qr {
    width: fit-content; margin: 0 auto 1.25rem;
    background: #fff; padding: 12px; border-radius: 14px;
    line-height: 0;
}
.twofa-qr svg { width: 200px; height: 200px; display: block; }
.twofa-manual { margin-bottom: 1rem; }
.twofa-manual summary { cursor: pointer; color: var(--primary, #69ac80); font-size: 0.9rem; }
.twofa-secret { text-align: center; margin: 0.75rem 0 0.25rem; }
.twofa-secret code {
    font-size: 1.05rem; letter-spacing: 0.12em;
    background: var(--surface, rgba(255,255,255,0.04));
    border: 1px solid var(--stroke, rgba(255,255,255,0.1));
    padding: 0.5rem 0.75rem; border-radius: 8px; display: inline-block;
    word-break: break-all;
}

/* --- Manage --- */
.twofa-status {
    display: flex; align-items: center; gap: 0.9rem;
    padding: 1rem 1.1rem; border-radius: 12px; margin-bottom: 1.25rem;
}
.twofa-status i { font-size: 1.5rem; flex-shrink: 0; }
.twofa-status p { margin: 0.15rem 0 0; color: var(--muted, rgba(255,255,255,0.7)); font-size: 0.9rem; }
.twofa-status--on { background: rgba(105, 172, 128, 0.12); border: 1px solid rgba(105, 172, 128, 0.3); }
.twofa-status--on i { color: #7ed09a; }
.twofa-block {
    border-top: 1px solid var(--stroke, rgba(255,255,255,0.1));
    padding-top: 1.25rem; margin-top: 1.25rem;
}
.twofa-block__title { font-size: 1rem; margin: 0 0 0.5rem; }
.twofa-block--danger .twofa-block__title { color: #e0938d; }
.twofa-remaining {
    font-weight: 800; color: #7ed09a;
    font-size: 1.05rem;
}
.twofa-remaining.is-low { color: #e6a95a; }

/* --- Backup codes --- */
.twofa-codes {
    list-style: none; margin: 1.25rem 0; padding: 1rem;
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
    background: var(--surface, rgba(255,255,255,0.04));
    border: 1px solid var(--stroke, rgba(255,255,255,0.1));
    border-radius: 12px;
}
.twofa-codes li { text-align: center; }
.twofa-codes code {
    font-size: 1.05rem; letter-spacing: 0.08em; color: var(--light, #f8f9fa);
}
.twofa-backup-actions { display: flex; justify-content: center; margin-bottom: 1.25rem; }

@media (max-width: 480px) {
    .twofa-codes { grid-template-columns: 1fr; }
    .twofa-qr svg { width: 170px; height: 170px; }
}

/* Download button on a requirement row that maps to a free companion jar. */
.req-modal__dl {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(105, 172, 128, 0.16);
    border: 1px solid rgba(105, 172, 128, 0.36);
    color: #a8dcbb;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.req-modal__dl:hover { background: rgba(105, 172, 128, 0.28); color: #d8f3e2; }
.req-modal__dl i { font-size: 0.7rem; }
