/*
    The whole look of every page this service renders: the two sign-in steps, everything that can
    refuse or interrupt them, and the account settings behind them.

    Self-contained on purpose. This replaced Bootstrap rather than layering on top of it — the pages
    were a mix of framework defaults, three near-identical copies of the same <style> block and a
    handful of inline overrides, and every one of those was somewhere for one sign-in screen to
    drift away from the one next to it. One file, one set of tokens, no framework.
*/

:root {
    --primary: hsl(198 58.6% 39.8%);
    --primary-hover: hsl(198 58.6% 34%);
    --primary-soft: hsl(198 58.6% 39.8% / 0.08);

    --foreground: hsl(198 0% 10%);
    --muted-foreground: hsl(198 0% 40%);
    --placeholder: hsl(198 0% 60%);

    --background: hsl(198 0% 100%);
    --page: hsl(198 30% 97%);
    --subtle: hsl(198 20% 98%);

    --border: hsl(220 13% 91%);
    --input-border: hsl(220 13% 85%);
    --ring: hsl(198 58.6% 39.8% / 0.25);

    --destructive: hsl(0 60% 42%);
    --destructive-soft: hsl(0 70% 97%);
    --destructive-border: hsl(0 60% 88%);

    --warning: hsl(35 80% 30%);
    --warning-soft: hsl(40 90% 96%);
    --warning-border: hsl(40 70% 85%);

    --success: hsl(155 55% 27%);
    --success-soft: hsl(150 60% 96%);
    --success-border: hsl(150 45% 84%);

    --radius: 0.5rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--foreground);
    background:
        radial-gradient(1200px 600px at 80% -10%, var(--primary-soft), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, var(--primary-soft), transparent 55%),
        var(--page);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
}

/* -------------------------------------------------------------------------- */
/* The card every signed-out page is                                           */
/* -------------------------------------------------------------------------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    /* Wider than the reference's 26rem, and for one reason: a recovery-code grid and an
       authenticator QR have to fit in the same card, and a card that changes width between steps
       reads as a different page. */
    max-width: 28rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) * 2);
    box-shadow:
        0 1px 2px hsl(198 30% 20% / 0.04),
        0 12px 32px -12px hsl(198 30% 20% / 0.12);
    padding: 2.5rem 2rem 2rem;
}

.auth-card--wide {
    max-width: 34rem;
}

.auth-logo {
    display: block;
    margin: 0 auto 1.5rem;
    height: 44px;
}

.auth-title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.01em;
}

.auth-subtitle {
    margin: 0.375rem 0 1.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.auth-body {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
}

.auth-body p {
    margin: 0 0 0.875rem;
}

.auth-body p:last-child {
    margin-bottom: 0;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* Which account is being signed into. Shown, not editable — changing it has to go back through the
   address step, because that is where federation is resolved. */
.account-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
}

.account {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.875rem;
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    background: var(--subtle);
}

.account .avatar {
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

/* -------------------------------------------------------------------------- */
/* Fields                                                                      */
/* -------------------------------------------------------------------------- */

.field {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

input[type="email"],
input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"] {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

input::placeholder {
    color: var(--placeholder);
}

input:disabled,
input[readonly] {
    background: var(--subtle);
    color: var(--muted-foreground);
    cursor: not-allowed;
}

.input-wrap {
    position: relative;
}

/* Room for the reveal button, which sits inside the field rather than beside it. */
.input-wrap input {
    padding-right: 2.5rem;
}

.toggle-pw {
    position: absolute;
    right: 0.375rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    padding: 0.375rem;
    color: var(--muted-foreground);
    display: flex;
    border-radius: calc(var(--radius) / 2);
}

.toggle-pw:hover {
    color: var(--foreground);
}

.toggle-pw:focus-visible {
    outline: 2px solid var(--primary);
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    margin: 0;
}

.checkbox input {
    accent-color: var(--primary);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    margin: 0;
}

/* -------------------------------------------------------------------------- */
/* Buttons                                                                     */
/* -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 2.5rem;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
    background: var(--primary-hover);
    color: #fff;
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--ring);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn--secondary {
    background: var(--background);
    border-color: var(--input-border);
    color: var(--foreground);
}

.btn--secondary:hover {
    background: var(--subtle);
    color: var(--foreground);
}

.btn--danger {
    background: var(--destructive);
}

.btn--danger:hover {
    background: hsl(0 60% 36%);
}

.btn--inline {
    width: auto;
}

/* -------------------------------------------------------------------------- */
/* Messages                                                                    */
/* -------------------------------------------------------------------------- */

.alert {
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert p {
    margin: 0.375rem 0 0;
}

.alert p:first-child {
    margin-top: 0;
}

.alert--danger {
    background: var(--destructive-soft);
    border-color: var(--destructive-border);
    color: var(--destructive);
}

.alert--warning {
    background: var(--warning-soft);
    border-color: var(--warning-border);
    color: var(--warning);
}

.alert--success {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: var(--success);
}

.alert--info {
    background: var(--primary-soft);
    border-color: hsl(198 40% 85%);
    color: var(--primary-hover);
}

/*
    What asp-validation-summary and asp-validation-for actually render. Styled by the classes the
    tag helpers and jquery-validation-unobtrusive emit rather than by ones the markup adds, so a page
    that forgets to decorate its own error span still shows the error the same way.
*/
.validation-summary-errors {
    background: var(--destructive-soft);
    border: 1px solid var(--destructive-border);
    border-radius: var(--radius);
    color: var(--destructive);
    font-size: 0.875rem;
    padding: 0.75rem 0.875rem;
    margin-bottom: 1.25rem;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.125rem;
}

.validation-summary-valid {
    display: none;
}

.field-validation-error,
.text-danger {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--destructive);
}

input.input-validation-error {
    border-color: var(--destructive);
}

input.input-validation-error:focus-visible {
    box-shadow: 0 0 0 3px hsl(0 60% 42% / 0.2);
}

/* -------------------------------------------------------------------------- */
/* Account settings — the signed-in surface                                    */
/* -------------------------------------------------------------------------- */

.manage-shell {
    max-width: 60rem;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3rem;
}

.manage-header {
    margin-bottom: 1.75rem;
}

.manage-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.manage-header p {
    margin: 0.25rem 0 0;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.manage-grid {
    display: grid;
    grid-template-columns: 13rem 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 48rem) {
    .manage-grid {
        grid-template-columns: 1fr;
    }
}

.manage-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.manage-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
}

.manage-nav a:hover {
    background: var(--subtle);
    color: var(--foreground);
    text-decoration: none;
}

.manage-nav a.active {
    background: var(--primary-soft);
    color: var(--primary-hover);
}

.panel {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) * 1.5);
    padding: 1.75rem;
    box-shadow: 0 1px 2px hsl(198 30% 20% / 0.04);
}

.panel h2 {
    margin: 0 0 1.25rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.panel h3 {
    margin: 1.75rem 0 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.panel-form {
    max-width: 24rem;
}

/* Several settings pages are a paragraph and one button rather than a form. */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.actions .btn {
    width: auto;
}

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

.table td,
.table th {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.steps {
    padding-left: 1.25rem;
    margin: 0;
    color: var(--muted-foreground);
}

.steps li {
    margin-bottom: 1.25rem;
}

.steps li:last-child {
    margin-bottom: 0;
}

kbd,
code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    background: var(--subtle);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) / 2);
    padding: 0.125rem 0.375rem;
    color: var(--foreground);
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.recovery-codes code {
    display: block;
    text-align: center;
    padding: 0.5rem;
}

#qrCode {
    margin: 0.75rem 0;
}

#qrCode img {
    max-width: 100%;
    height: auto;
}

/* SUMX-5548: password rules checklist on Reset password, ported from branch staging onto this
   file's tokens. */
.pw-rules {
    background: var(--subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: -0.25rem 0 1rem;
    font-size: 13px;
}

.pw-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pw-rules li {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2px 0;
    color: var(--muted-foreground);
    transition: color 0.2s;
}

.pw-rules .rule-icon {
    font-size: 15px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.pw-rules li.rule-pass {
    color: var(--success);
}

.pw-rules li.rule-fail {
    color: var(--destructive);
}

.pw-rules li.rule-pass .rule-icon::before {
    content: '✓';
}

.pw-rules li.rule-fail .rule-icon::before {
    content: '✗';
}

.pw-rules li:not(.rule-pass):not(.rule-fail) .rule-icon::before {
    content: '○';
}
