/* ============================================================
   anota account settings (mg-*) — the /Account/Manage area.
   Lives inside the app portal shell (MainLayout + app.css tokens);
   inputs reuse the au-field floating-label treatment from auth.css.
   ============================================================ */

.mg-grid {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

/* ---------- side nav ---------- */
.mg-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 84px;
}

.mg-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--an-slate-600);
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.mg-nav-link svg { flex: none; opacity: .8; }
.mg-nav-link:hover { background: var(--an-slate-100); color: var(--an-ink); }
.mg-nav-link.active { background: var(--an-primary-subtle); color: var(--an-primary); }

/* ---------- content column ---------- */
.mg-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.mg-card {
    background: #fff;
    border: 1px solid var(--an-slate-200);
    border-radius: 8px;
    box-shadow: var(--an-shadow-sm);
    padding: 28px;
}

.mg-card-danger { border-color: #F2C6C6; }

.mg-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--an-ink);
    margin: 0 0 4px;
}

.mg-card-danger .mg-card-title { color: var(--an-error); }

.mg-card-sub {
    font-size: .875rem;
    color: var(--an-slate-500);
    line-height: 1.55;
    margin: 0 0 22px;
    max-width: 60ch;
}

.mg-card p:last-child { margin-bottom: 0; }

.mg-form { max-width: 440px; }

.mg-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.mg-actions form { margin: 0; }

.mg-text {
    font-size: .9rem;
    color: var(--an-slate-600);
    line-height: 1.55;
    margin: 0 0 14px;
    max-width: 60ch;
}

/* quiet inline link-button (e.g. "send verification email") */
.mg-btn-link {
    border: none;
    background: none;
    padding: 0;
    color: var(--an-primary);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
}

.mg-btn-link:hover { color: var(--an-primary-dark); text-decoration: underline; }

/* ---------- list rows (external logins, passkeys) ---------- */
.mg-rows { display: flex; flex-direction: column; }

.mg-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--an-slate-100);
}

.mg-rows .mg-row:last-child { border-bottom: none; padding-bottom: 0; }
.mg-rows .mg-row:first-child { padding-top: 0; }

.mg-row-name { font-weight: 600; color: var(--an-ink); font-size: .9375rem; }
.mg-row-actions { display: flex; gap: 8px; }
.mg-row-actions form { margin: 0; display: flex; gap: 8px; }

/* compact buttons inside rows */
.mg-row-actions .an-btn-secondary,
.mg-row-actions .an-btn-danger { padding: 7px 14px; font-size: .8125rem; }

/* ---------- 2FA status ---------- */
.mg-state {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.mg-state-label { font-weight: 600; color: var(--an-ink); font-size: .9375rem; }

/* ---------- authenticator setup steps ---------- */
.mg-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: mgstep;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mg-step {
    position: relative;
    padding-left: 44px;
    counter-increment: mgstep;
}

.mg-step::before {
    content: counter(mgstep);
    position: absolute;
    left: 0;
    top: -2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--an-primary-subtle);
    color: var(--an-primary);
    font-weight: 700;
    font-size: .8125rem;
    display: grid;
    place-items: center;
}

.mg-step > p { margin: 0 0 10px; }

.mg-kbd {
    display: inline-block;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 1rem;
    letter-spacing: .08em;
    color: var(--an-ink);
    background: var(--an-slate-50);
    border: 1px solid var(--an-slate-200);
    border-radius: 6px;
    padding: 10px 16px;
    margin: 4px 0 6px;
    word-break: break-all;
}

/* ---------- recovery codes ---------- */
.mg-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.mg-code {
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: .9375rem;
    letter-spacing: .04em;
    color: var(--an-ink);
    background: var(--an-slate-50);
    border: 1px solid var(--an-slate-200);
    border-radius: 6px;
    padding: 10px 12px;
    text-align: center;
}

/* ---------- company logo ---------- */
.mg-logo-preview {
    display: inline-flex;
    align-items: center;
    padding: 14px 18px;
    background: var(--an-slate-50);
    border: 1px solid var(--an-slate-200);
    border-radius: 8px;
    margin-bottom: 18px;
    max-width: 100%;
}

.mg-logo-preview img {
    display: block;
    max-height: 96px;
    max-width: 100%;
}

.mg-logo-form { max-width: 440px; }
.mg-logo-form + .mg-logo-form { margin-top: 14px; }

.mg-file-input {
    display: block;
    width: 100%;
    font-family: inherit;
    font-size: .875rem;
    color: var(--an-slate-600);
}

.mg-file-input::file-selector-button {
    background: #fff;
    color: var(--an-slate-600);
    font-family: inherit;
    font-weight: 600;
    font-size: .8125rem;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--an-slate-300);
    cursor: pointer;
    margin-right: 12px;
    transition: background 150ms ease, border-color 150ms ease;
}

.mg-file-input::file-selector-button:hover {
    background: var(--an-slate-50);
    border-color: var(--an-slate-400);
}

/* ---------- fields ---------- */
/* read-only values (username, current email) reuse au-input */
.mg-content .au-input:disabled {
    background: var(--an-slate-50);
    color: var(--an-slate-500);
    cursor: not-allowed;
}

.mg-field-inline { position: relative; }

.mg-verified {
    position: absolute;
    right: 14px;
    top: 14px;
    color: var(--an-success);
    font-weight: 700;
    pointer-events: none;
}

/* per-field messages carry the detail; hide the duplicate summary */
.mg-content .validation-errors,
.mg-content .validation-summary-errors { display: none; }

.mg-content .validation-message {
    display: block;
    margin-top: 6px;
    font-size: .8125rem;
    color: var(--an-error);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .mg-grid { grid-template-columns: 1fr; gap: 20px; }

    .mg-nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .mg-nav-link { white-space: nowrap; flex: none; }
    .mg-card { padding: 20px; }
}
