/* ==========================================================================
   Account pages (Components/Account). Static SSR.
   - AccountLayout: signed-out pages in a centred card (.acct-shell)
   - ManageLayout: account settings with a section nav (.acct-manage)
   ========================================================================== */

/* --------------------------------------------------------------------------
   AccountLayout shell
   -------------------------------------------------------------------------- */
.acct-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-subtle);
}

.acct-topbar {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.acct-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--header-height);
}

.acct-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(24px, 6vw, 64px) var(--gutter);
}

.acct-main:focus {
    outline: none;
}

.acct-card {
    width: 100%;
    max-width: 440px;
}

.acct-card__body {
    --stack-gap: 20px;
    padding: clamp(24px, 5vw, 40px);
}

.acct-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    padding: 24px var(--gutter) 32px;
    color: var(--text-3);
    font-size: var(--fs-sm);
}

.acct-footer a {
    color: inherit;
}

@media (max-width: 420px) {
    .acct-topbar__home {
        padding-inline: 12px;
    }
}

/* Card content */
.acct-head {
    display: grid;
    gap: 8px;
}

.acct-head h1 {
    font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
}

.acct-lead {
    color: var(--text-3);
}

.acct-lead strong {
    color: var(--text);
    font-weight: 500;
    overflow-wrap: anywhere;
}

.acct-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--surface-muted);
    color: var(--text-2);
}

.acct-icon--success {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.acct-icon--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.acct-actions {
    --cluster-gap: 10px;
}

.acct-links {
    display: grid;
    gap: 6px;
    color: var(--text-3);
    font-size: 0.875rem;
    text-align: center;
}

.acct-links a {
    color: var(--text);
    font-weight: 500;
}

.acct-links a:hover {
    color: var(--brand-ink);
}

/* "or" divider between sign-in methods */
.acct-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    color: var(--text-4);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.acct-divider::before,
.acct-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.acct-external {
    display: grid;
    gap: 10px;
}

/* The passkey button needs PasskeySubmit.razor.js; hide it until the custom element is defined. */
.acct-passkey:has(passkey-submit:not(:defined)) {
    display: none;
}

.acct-form .form-actions .btn--block {
    flex: 1 1 100%;
}

.acct-form .check {
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   ManageLayout
   -------------------------------------------------------------------------- */
.acct-manage {
    display: grid;
    grid-template-columns: minmax(200px, 248px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.acct-manage__nav {
    position: sticky;
    top: calc(var(--header-height) + 16px);
    min-width: 0;
}

.acct-manage__content {
    min-width: 0;
}

.acct-nav {
    display: grid;
    gap: 2px;
}

.acct-nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-3);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.acct-nav__link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.acct-nav__link.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm);
}

.acct-nav__link.active svg {
    color: var(--brand-ink);
}

@media (max-width: 860px) {
    .acct-manage {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .acct-manage__nav {
        position: static;
    }

    /* Horizontal segmented strip that scrolls on its own, never the page. */
    .acct-nav {
        display: flex;
        gap: 2px;
        padding: 3px;
        overflow-x: auto;
        border: 1px solid var(--border);
        border-radius: var(--radius-pill);
        background: var(--surface-muted);
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .acct-nav::-webkit-scrollbar {
        display: none;
    }

    .acct-nav__link {
        flex: none;
        gap: 6px;
        min-height: 40px;
        padding: 8px 14px;
        border-radius: var(--radius-pill);
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .acct-nav__link svg {
        width: 16px;
        height: 16px;
    }

    .acct-nav__link.active {
        box-shadow: var(--shadow-sm);
    }
}

/* Section content */
.acct-section {
    --stack-gap: 24px;
}

.acct-section-head {
    display: grid;
    gap: 6px;
}

.acct-section-head p {
    max-width: 60ch;
    color: var(--text-3);
}

.acct-section .acct-form {
    max-width: 480px;
}

.acct-section .form-actions {
    margin-top: 24px;
}

.acct-section form > .form-actions:first-child,
.acct-actions-flush {
    margin-top: 0;
}

.acct-subsection {
    --stack-gap: 12px;
}

/* Static badges (the live badge pulses by default; not wanted for "Verified" / "On") */
.acct-badge-static::before {
    display: none;
}

/* Row blocks: copy on the left, action on the right */
.acct-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.acct-section-head + .acct-block,
.acct-section-head + .alert + .acct-block {
    padding-top: 0;
    border-top: 0;
}

.acct-block__copy {
    display: grid;
    flex: 1 1 280px;
    gap: 4px;
    min-width: 0;
}

.acct-block__copy p {
    color: var(--text-3);
    font-size: 0.9375rem;
}

.acct-block--danger h3 {
    color: var(--danger);
}

/* Lists (passkeys, external sign-ins) */
.acct-list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.acct-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 16px;
}

.acct-list__item + .acct-list__item {
    border-top: 1px solid var(--border);
}

.acct-list__name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.acct-list__name svg {
    color: var(--text-3);
}

.acct-empty {
    padding: 32px 16px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

/* Authenticator setup steps */
.acct-steps {
    display: grid;
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: acct-step;
}

.acct-steps > li {
    position: relative;
    display: grid;
    gap: 8px;
    padding-left: 44px;
    counter-increment: acct-step;
}

.acct-steps > li::before {
    content: counter(acct-step);
    position: absolute;
    left: 0;
    top: -2px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-muted);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.acct-steps p {
    color: var(--text-3);
}

.acct-steps .acct-form .form-actions {
    margin-top: 16px;
}

@media (max-width: 480px) {
    .acct-steps > li {
        padding-left: 0;
        padding-top: 36px;
    }
}

.acct-key {
    justify-self: start;
    max-width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 0.06em;
    overflow-wrap: anywhere;
    user-select: all;
}

.acct-qr:empty {
    display: none;
}

/* Recovery codes */
.acct-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
    gap: 8px;
    margin: 0;
    padding: 16px;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-subtle);
}

.acct-codes li {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
    text-align: center;
}

.acct-codes code {
    font-size: 0.9375rem;
    letter-spacing: 0.06em;
    user-select: all;
}
