@layer surfaces {

    /* ── Account page body override — scrollable ────── */
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    /* ── Layout ──────────────────────────────────────── */
    .account-wrapper {
        flex: 1;
        padding: var(--space-5) var(--space-4);
    }
    .account-container {
        max-width: 680px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        gap: var(--space-5);
    }

    /* ── Page header ─────────────────────────────────── */
    .account-page-header {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding-bottom: var(--space-4);
        border-bottom: 1px solid hsl(var(--line));
    }
    .account-page-title {
        font-family: var(--font-heading);
        font-size: var(--text-base);
        font-weight: 600;
        color: var(--text);
    }

    /* ── Tab strip ───────────────────────────────────── */
    .account-tabs {
        display: flex;
        gap: 2px;
        border-bottom: 1px solid hsl(var(--line));
    }
    .account-tab {
        padding: 0.375rem 0.75rem;
        font-size: var(--text-sm);
        font-weight: 500;
        color: var(--text-muted);
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        font-family: inherit;
        transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
        margin-bottom: -1px;
    }
    .account-tab:hover { color: var(--text); }
    .account-tab.active {
        color: hsl(var(--accent));
        border-bottom-color: hsl(var(--accent));
        font-weight: 600;
    }

    /* ── Tab panels ──────────────────────────────────── */
    .account-panel { display: none; flex-direction: column; gap: var(--space-4); }
    .account-panel.active { display: flex; }

    /* ── Section cards ───────────────────────────────── */
    .account-section {
        background: hsl(var(--surface-raised) / 0.3);
        border: 1px solid hsl(var(--line));
        border-radius: var(--radius-md);
        padding: var(--space-4);
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
    }
    .account-section__title {
        font-size: var(--text-xs);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-muted);
        padding-bottom: var(--space-2);
        border-bottom: 1px solid hsl(var(--line) / 0.5);
    }
    .account-section__actions {
        display: flex;
        gap: var(--space-2);
        margin-top: var(--space-1);
    }

    /* ── Field rows ──────────────────────────────────── */
    .acct-field {
        display: flex;
        align-items: baseline;
        gap: var(--space-3);
        padding: var(--space-1) 0;
    }
    .acct-field__label {
        font-size: var(--text-xs);
        font-weight: 500;
        color: var(--text-muted);
        flex: 0 0 130px;
    }
    .acct-field__value {
        font-size: var(--text-sm);
        color: var(--text);
        flex: 1;
    }
    .acct-field__value--muted { color: var(--text-muted); }

    /* ── Save feedback ───────────────────────────────── */
    .acct-save-msg {
        font-size: var(--text-xs);
        color: hsl(var(--success));
        min-height: 1em;
        margin-top: var(--space-1);
    }
    .acct-save-msg--error { color: hsl(var(--danger)); }

    /* ── Password change inline form ─────────────────── */
    .pw-change-form {
        display: none;
        flex-direction: column;
        gap: var(--space-2);
        margin-top: var(--space-2);
    }
    .pw-change-form.visible { display: flex; }

    /* ── Notification toggle rows ────────────────────── */
    .notif-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        padding: var(--space-2) 0;
        border-bottom: 1px solid hsl(var(--line) / 0.4);
    }
    .notif-row:last-child { border-bottom: none; }
    .notif-row__info { flex: 1; }
    .notif-row__label { font-size: var(--text-sm); font-weight: 500; color: var(--text); }
    .notif-row__desc  { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

    /* Toggle switch */
    .notif-toggle {
        position: relative;
        display: inline-block;
        width: 36px;
        height: 20px;
        flex-shrink: 0;
        cursor: pointer;
    }
    .notif-checkbox {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }
    .notif-toggle__track {
        position: absolute;
        inset: 0;
        background: hsl(var(--surface-sunken));
        border: 1px solid hsl(var(--line));
        border-radius: var(--radius-pill);
        transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
    }
    .notif-toggle__track::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 14px;
        height: 14px;
        background: var(--text-muted);
        border-radius: var(--radius-pill);
        transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
    }
    .notif-checkbox:checked + .notif-toggle__track {
        background: hsl(var(--accent) / 0.25);
        border-color: hsl(var(--accent));
    }
    .notif-checkbox:checked + .notif-toggle__track::after {
        background: hsl(var(--accent));
        transform: translateX(16px);
    }
    .notif-checkbox:focus-visible + .notif-toggle__track {
        outline: 2px solid hsl(var(--accent));
        outline-offset: 2px;
    }

    /* ── Session rows ────────────────────────────────── */
    .session-list { display: flex; flex-direction: column; gap: 0; }
    .session-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        padding: var(--space-2) 0;
        border-bottom: 1px solid hsl(var(--line) / 0.4);
    }
    .session-row:last-child { border-bottom: none; }
    .session-row__info { flex: 1; }
    .session-row__device {
        font-size: var(--text-sm);
        font-weight: 500;
        color: var(--text);
    }
    .session-row__meta {
        font-size: var(--text-xs);
        color: var(--text-muted);
        margin-top: 2px;
    }
    .session-row--current .session-row__device::after {
        content: ' · Current';
        color: hsl(var(--success));
        font-weight: 400;
    }

    /* ── Brand rows ──────────────────────────────────── */
    .brand-row {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-2) 0;
        border-bottom: 1px solid hsl(var(--line) / 0.4);
    }
    .brand-row:last-child { border-bottom: none; }
    .brand-row__logo {
        width: 28px;
        height: 28px;
        border-radius: var(--radius-sm);
        object-fit: contain;
        background: hsl(var(--surface-sunken));
        border: 1px solid hsl(var(--line));
        flex-shrink: 0;
    }
    .brand-row__info { flex: 1; }
    .brand-row__name { font-size: var(--text-sm); font-weight: 500; color: var(--text); }
    .brand-row__tier { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

    /* ── Trial chip (Billing) ────────────────────────── */
    .trial-status-chip {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        background: hsl(var(--surface-sunken));
        border: 1px solid hsl(var(--line));
        border-radius: var(--radius-pill);
        padding: 4px 12px;
        font-size: var(--text-xs);
        font-weight: 500;
        color: var(--text-muted);
    }
    .trial-status-chip__days {
        font-weight: 700;
        color: var(--text);
    }
    .trial-expires-label {
        font-size: var(--text-xs);
        color: var(--text-muted);
        margin-left: var(--space-2);
    }

    /* ── Danger zone section ─────────────────────────── */
    .account-section--danger {
        background: hsl(var(--danger) / 0.04);
        border-color: hsl(var(--danger) / 0.2);
    }
    .account-section--danger .account-section__title {
        color: hsl(var(--danger) / 0.7);
        border-bottom-color: hsl(var(--danger) / 0.15);
    }

    /* ── Demo stub panel ─────────────────────────────── */
    .account-demo-stub {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-4);
        padding: var(--space-6);
        text-align: center;
        color: var(--text-muted);
    }
    .account-demo-stub__title { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
    .account-demo-stub__desc  { font-size: var(--text-sm); max-width: 360px; }

    /* ── Re-auth modal — blocking ────────────────────── */
    .reauth-method { display: none; flex-direction: column; gap: 0.625rem; }
    .reauth-method.active { display: flex; }
}
