.forgot-container {
    position: relative; /* Anchor for the corner "Back to Login" link */
    background-color: #2e3b4e;
    padding: 1.25rem;
    padding-top: 2.25rem; /* Extra room so the corner link doesn't crowd the heading */
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 28rem; /* a bit wider than login-container -- more fields */
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #cfe5ff;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

.back-to-login-corner {
    position: absolute;
    top: 0.75rem;
    left: 0.9375rem; /* 15px, lines up with the container's padding */
    background-color: #a52a53; /* Red pulled from the terminal.mk logo mark */
    color: #ffffff;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.back-to-login-corner:hover {
    background-color: #841f41;
}

.forgot-container h2 {
    margin-bottom: 0.5rem;
}

.forgot-hint {
    color: #a0b5d3;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.forgot-container form {
    width: 100%;
}

.contact-warning {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: #ff8c00;
    border: 1px solid #ff8c00;
    background-color: #ffe4b5;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.35;
    /* A flex item's default min-width is "auto" (content-based), so
       without this the box refuses to shrink below its text's
       intrinsic width and pushes past the form's edge on narrow
       screens -- the .forgot-container overflow-wrap rule never gets
       a chance to kick in because the item itself won't shrink to
       trigger a wrap. */
    min-width: 0;
    box-sizing: border-box;
}

.contact-warning span {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.contact-warning strong {
    color: #a52a53;
}

/* -------------------------------------------------
   Status banner (success/error) -- same shape/placement rules as
   ACM's .acm-status-msg (see ACM.css), shown right under the title +
   hint instead of buried below the form near the submit button.
   ------------------------------------------------- */
.forgot-status-msg {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    margin: 0 0 1rem 0;
    font-size: 0.88rem;
    line-height: 1.4;
    border: 1px solid transparent;
}

.forgot-status-success {
    background-color: rgba(61, 220, 132, 0.12);
    border-color: #3ddc84;
    color: #3ddc84;
}

.forgot-status-error {
    background-color: rgba(165, 42, 83, 0.12);
    border-color: #a52a53;
    color: #ff9db3;
}

.input-group {
    margin-bottom: 0.9375rem;
    width: 100%;
}

.input-group.half-pair {
    display: flex;
    gap: 0.75rem;
}

.input-half {
    flex: 1 1 0;
    min-width: 0;
}

.login-input {
    border: 1px solid #ccc;
    background: transparent;
    color: #cfe5ff;
    outline: none;
    font-size: 1rem;
    padding: 0.5rem;
    height: 2.5em;
    width: calc(100% - 1rem);
}

.login-input::placeholder {
    color: #7d93b8;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* -------------------------------------------------
   Phone field: country select + national number as two
   distinct bordered boxes, side by side. Ported from
   register.css so this matches the register view exactly --
   forgot.css didn't previously define any of these classes,
   so the phone row was falling back to unstyled defaults.
   ------------------------------------------------- */
.phone-field {
    display: flex;
    gap: 0.5rem;
    flex-grow: 1;
    min-width: 0;
}

.phone-field-country {
    flex: 0 0 auto;
    width: 6rem;
}

.phone-field-number {
    flex: 1 1 auto;
    min-width: 0;
}

.phone-country-select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    background: #2e3b4e;
    color: #cfe5ff;
    outline: none;
    font-size: 0.9rem;
    padding: 0.5rem 0.6rem;
    height: 2.5em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.phone-number-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    background: #2e3b4e;
    color: #cfe5ff;
    outline: none;
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    height: 2.5em;
}

.phone-number-input::placeholder {
    color: #7c93ad;
}

/* -------------------------------------------------
   Optional TOTP token field
   ------------------------------------------------- */
#totpTokenGroup {
    transition: opacity 0.2s ease;
}

.field-hint {
    color: #a0b5d3;
    font-size: 0.8rem;
    margin: 0.35rem 0 0;
    line-height: 1.4;
}

/* -------------------------------------------------
   Messages
   ------------------------------------------------- */
.error-message {
    display: flex;
    color: #a52a53;
    text-align: center;
    width: 100%;
    margin-top: 0.625rem;
    justify-content: center;
    flex-wrap: wrap;
}

.details-message {
    display: flex;
    color: #cfe5ff;
    background-color: #344357;
    border-radius: 0.25rem;
    padding: 0.6rem;
    text-align: center;
    width: 100%;
    margin-top: 0.625rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* -------------------------------------------------
   Success modal
   ------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 20, 28, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background-color: #2e3b4e;
    color: #cfe5ff;
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.35);
    padding: 1.5rem;
    max-width: 24rem;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.modal-message {
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.modal-box .button.inverted {
    min-width: 6rem;
}

/* -------------------------------------------------
   Buttons
   ------------------------------------------------- */
.button.inverted {
    background-color: #cfe5ff;
    color: #2e3b4e;
    border: none;
    padding: 0.625rem 0.9375rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.3s;
    text-align: center;
    display: inline-block;
    text-decoration: none;
    font-size: 1rem;
}

.button.inverted:hover {
    background-color: #46608a;
    color: #cfe5ff;
}

/* Red -- continues the "forgot password" passive/negative accent from
   the login page, since this whole flow starts from that action. */
.button.inverted.reset-request-button {
    background-color: #a52a53;
    color: #cfe5ff;
    width: 100%;
    margin-top: 0.625rem;
}

.button.inverted.reset-request-button:hover {
    background-color: #8a2245;
}

.accent-button {
    background-color: #ff8c00;
    color: #2e3b4e;
    border: none;
    padding: 0.625rem 0.9375rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.3s;
    text-align: center;
    display: inline-block;
    text-decoration: none;
    font-size: 1rem;
}

.accent-button:hover {
    background-color: #e07b00;
}

/* -------------------------------------------------
   Media Queries
   ------------------------------------------------- */
@media (max-width: 600px) {
    .input-group.half-pair {
        flex-direction: column;
        gap: 0;
    }

    .login-input {
        font-size: 0.9rem;
    }

    .back-to-login-corner {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .toggle-label {
        font-size: 0.88rem;
    }
}
