html, body {
    font-family: var(--font-sans);
}

body.identity-shell {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(180deg, color-mix(in oklch, var(--surface-2) 72%, var(--background)) 0, var(--background) 24rem),
        var(--background);
    color: var(--text);
    font-family: var(--font-sans);
}

.identity-shell__header,
.identity-shell__footer {
    border-color: color-mix(in oklch, var(--border) 76%, transparent);
    background: color-mix(in oklch, var(--background) 88%, transparent);
    color: var(--text-muted);
}

.identity-shell__header {
    min-height: 3rem;
    border-bottom: 1px solid color-mix(in oklch, var(--border) 76%, transparent);
    padding: 0.75rem clamp(1rem, 3vw, 2.75rem);
}

.identity-shell__brand {
    color: var(--text);
    font-weight: 650;
    text-decoration: none;
}

.identity-shell__brand:hover {
    color: var(--text);
}

.identity-shell__main {
    padding: 1.5rem clamp(1rem, 3vw, 2.75rem) 2rem;
}

.identity-shell__footer {
    border-top: 1px solid color-mix(in oklch, var(--border) 76%, transparent);
    padding: 0.75rem clamp(1rem, 3vw, 2.75rem);
    font-size: 0.875rem;
}

.identity-shell h1,
.identity-shell h2,
.identity-shell h3,
.identity-shell p,
.identity-shell label {
    color: var(--text);
}

.identity-shell hr {
    border-color: var(--border);
    opacity: 1;
}

.identity-shell .validation-summary-errors,
.identity-shell .field-validation-error {
    color: var(--danger);
}

/* ------------------------------------------------------------------------- */
/* Identity auth-card pattern (J18.B).                                       */
/* Scoped to body.identity-shell so it only affects the scaffolded           */
/* Areas/Identity/Pages/Account/ pages, never the rest of the app.           */
/* Razor Pages can't use Blazor <Button>/<Card> components, so we use a      */
/* set of plain CSS helpers built directly on the Teamworkk OKLCH tokens.   */
/* ------------------------------------------------------------------------- */

.identity-shell .auth-card {
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.identity-shell .auth-card--wide {
    max-width: 44rem;
}

.identity-shell .auth-card__head {
    padding: 1.5rem 1.5rem 0.5rem;
}

.identity-shell .auth-card__body {
    padding: 0.5rem 1.5rem 1.5rem;
}

.identity-shell .auth-card__foot {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

.identity-shell .auth-card__title {
    margin: 0;
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 650;
    line-height: 1.2;
}

.identity-shell .auth-card__lede {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.45;
}

.identity-shell .auth-form {
    display: grid;
    gap: 1rem;
    margin: 0;
}

.identity-shell .auth-field {
    display: grid;
    gap: 0.4375rem;
}

.identity-shell .auth-label {
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 550;
}

.identity-shell .auth-input {
    width: 100%;
    min-height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--surface);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font: inherit;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.identity-shell .auth-input::placeholder {
    color: var(--text-subtle);
}

.identity-shell .auth-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.identity-shell .auth-error {
    color: var(--danger);
    font-size: 0.8125rem;
    line-height: 1.3;
}

.identity-shell .auth-error:empty {
    display: none;
}

.identity-shell .auth-validation-summary {
    margin: 0;
    padding: 0.625rem 0.875rem;
    border: 1px solid color-mix(in oklch, var(--danger) 35%, var(--border));
    background: color-mix(in oklch, var(--danger) 10%, var(--surface));
    border-radius: 0.5rem;
    color: var(--danger);
    font-size: 0.875rem;
    line-height: 1.4;
}

.identity-shell .auth-validation-summary:empty,
.identity-shell .auth-validation-summary.validation-summary-valid {
    /* Razor's asp-validation-summary always renders the div with an empty <ul>
       inside when the form is valid (it just adds the .validation-summary-valid
       class). :empty wouldn't match in that case, so target the class too. */
    display: none;
}

.identity-shell .auth-validation-summary ul {
    margin: 0;
    padding-left: 1.25rem;
}

.identity-shell .auth-button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--accent);
    color: var(--accent-fg);
    padding: 0.625rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 150ms ease, opacity 150ms ease, transform 150ms ease;
}

.identity-shell .auth-button-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.identity-shell .auth-button-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.identity-shell .auth-button-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.identity-shell .auth-button-primary:disabled {
    opacity: 0.6;
    cursor: default;
}

.identity-shell .auth-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-size: 0.875rem;
}

.identity-shell .auth-checkbox-row input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}

.identity-shell .auth-link {
    color: var(--accent);
    text-decoration: none;
    transition: color 150ms ease;
}

.identity-shell .auth-link:hover {
    text-decoration: underline;
}

.identity-shell .auth-message {
    margin: 0;
    color: var(--text);
    font-size: 0.9375rem;
    line-height: 1.55;
}

.identity-shell .auth-message + .auth-message {
    margin-top: 0.75rem;
}

.identity-shell .auth-status {
    margin: 0 0 1rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.4;
}

.identity-shell .auth-status--success {
    border-color: color-mix(in oklch, var(--success) 35%, var(--border));
    background: color-mix(in oklch, var(--success) 10%, var(--surface));
    color: var(--success);
}

.identity-shell .auth-status--danger {
    border-color: color-mix(in oklch, var(--danger) 35%, var(--border));
    background: color-mix(in oklch, var(--danger) 10%, var(--surface));
    color: var(--danger);
}

/* External-login button placeholder for J18.B. Final J18.C styling replaces
   this with a per-provider button set (Google / Apple). For now the
   scaffolded section renders as a simple bordered list. */
.identity-shell .auth-external {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.identity-shell .auth-external__title {
    margin: 0 0 0.5rem;
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
}

.identity-shell .auth-external__empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.identity-shell .auth-external__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.identity-shell .auth-external__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    padding: 0.5rem 0.875rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 550;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.identity-shell .auth-external__button:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

/* Warning status banner (used by DeletePersonalData). */
.identity-shell .auth-status--warning {
    border-color: color-mix(in oklch, var(--warning) 35%, var(--border));
    background: color-mix(in oklch, var(--warning) 10%, var(--surface));
    color: var(--warning);
}

/* Secondary button (Cancel, "Back to ..." actions). */
.identity-shell .auth-button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    padding: 0.5rem 1rem;
    font: inherit;
    font-weight: 550;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.identity-shell .auth-button-secondary:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}

/* Danger button (Delete account, irreversible destructive actions). */
.identity-shell .auth-button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--danger);
    color: white;
    padding: 0.625rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 150ms ease, transform 150ms ease;
}

.identity-shell .auth-button-danger:hover {
    opacity: 0.9;
    color: white;
    text-decoration: none;
}

.identity-shell .auth-button-danger:active:not(:disabled) {
    transform: translateY(1px);
}

.identity-shell .auth-button-danger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--danger) 45%, transparent);
}

/* Auto-width modifier: drop the 100% so buttons sit inline with sibling controls. */
.identity-shell .auth-button-primary--inline,
.identity-shell .auth-button-danger--inline {
    width: auto;
}

/* Link-styled inline button (Send verification email, etc.). */
.identity-shell .auth-link-button {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--accent);
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.identity-shell .auth-link-button:hover {
    text-decoration: underline;
}

/* Inline status pill under a form field (e.g. "Confirmed" badge). */
.identity-shell .auth-field-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    align-self: flex-start;
    padding: 0.1875rem 0.5rem;
    border-radius: 0.4375rem;
    border: 1px solid color-mix(in oklch, var(--success) 35%, var(--border));
    background: color-mix(in oklch, var(--success) 10%, var(--surface));
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Row of buttons (Download + Delete on PersonalData, etc.). */
.identity-shell .auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ------------------------------------------------------------------------- */
/* Manage area shell (J18.D).                                                */
/* Settings-style 2-column layout: sidebar nav + content. Stacks to a single */
/* column on narrow screens.                                                 */
/* ------------------------------------------------------------------------- */

.identity-shell .manage-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    max-width: 64rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .identity-shell .manage-shell {
        grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
        gap: 2.5rem;
    }
}

.identity-shell .manage-nav {
    min-width: 0;
}

.identity-shell .manage-nav__title {
    margin: 0 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.identity-shell .manage-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.125rem;
}

.identity-shell .manage-nav__link {
    display: block;
    padding: 0.4375rem 0.625rem;
    border-radius: 0.4375rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 540;
    transition: background-color 150ms ease, color 150ms ease;
}

.identity-shell .manage-nav__link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.identity-shell .manage-nav__link.active {
    background: color-mix(in oklch, var(--accent) 12%, var(--surface-2));
    color: var(--text);
}

.identity-shell .manage-content {
    min-width: 0;
}

.identity-shell .manage-header {
    margin: 0 0 1.5rem;
}

.identity-shell .manage-header__title {
    margin: 0;
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 650;
    line-height: 1.2;
}

.identity-shell .manage-header__lede {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.identity-shell .manage-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.identity-shell .manage-section__title {
    margin: 0 0 0.75rem;
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 640;
    line-height: 1.2;
}

.identity-shell .manage-section__lede {
    margin: 0 0 1.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Recovery codes grid (ShowRecoveryCodes). Renders ten codes in a 2-column
   monospace grid so they're easy to copy or write down. */
.identity-shell .recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 480px) {
    .identity-shell .recovery-codes {
        grid-template-columns: minmax(0, 1fr);
    }
}

.identity-shell .recovery-codes__item {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    text-align: center;
    user-select: all;
}

/* Shared key block (EnableAuthenticator). Mono-typed, selectable. */
.identity-shell .auth-shared-key {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    word-break: break-all;
}

.identity-shell .auth-shared-key__label {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.identity-shell .auth-shared-key__value {
    flex: 1 1 auto;
    min-width: 0;
    user-select: all;
}

/* QR code container. The QR image is generated client-side by a JS library
   (deferred; see Teamworkk/PLAN.md backlog). When no library is loaded the
   container shows a fallback "Enter the shared key manually" message and
   users can still complete setup by typing the shared key. */
.identity-shell .auth-qr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 12rem;
    min-height: 12rem;
    padding: 0.75rem;
    border: 1px dashed var(--border-strong);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-align: center;
}

.identity-shell .auth-qr:not(:empty) {
    padding: 0;
    border-style: solid;
    background: white;
}

/* Numbered step list (EnableAuthenticator). */
.identity-shell .auth-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: auth-step;
    display: grid;
    gap: 1.25rem;
}

.identity-shell .auth-step {
    counter-increment: auth-step;
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.identity-shell .auth-step::before {
    content: counter(auth-step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 650;
    font-feature-settings: "tnum";
}

.identity-shell .auth-step__title {
    margin: 0 0 0.375rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.identity-shell .auth-step__body {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.55;
}

.identity-shell .auth-step__body > * + * {
    margin-top: 0.625rem;
}

/* Linked external accounts list (ExternalLogins management page). */
.identity-shell .auth-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.identity-shell .auth-link-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
}

.identity-shell .auth-link-list__name {
    font-size: 0.9375rem;
    font-weight: 550;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
}

.invalid {
    outline: 1px solid var(--danger);
}

.validation-message {
    color: var(--danger);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92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cuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }
