/* ─────────────────────────────────────────────────────────────────────────
   Mandatory password-change dialog — shown after a successful sign-in when
   the account is still on an administrator-issued password.

   Visual language follows the login card it sits over: #1A1A1A ground,
   #222 plate, amber #F2B735 accent, Inter. The dialog reads as a brass-rimmed
   instrument plate lifted off the chart table — hairline top rim, inset ring,
   and a single amber light source behind the seal.

   There is no dismiss affordance anywhere in here, by design: no close button,
   no backdrop click, no Escape. The session is not authenticated until the
   password is changed, so a dismissable dialog would only be theatre.
   ───────────────────────────────────────────────────────────────────────── */

.ypm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: radial-gradient(circle at 50% 35%, rgba(24, 24, 24, 0.82) 0%, rgba(8, 8, 8, 0.93) 70%);
    backdrop-filter: blur(7px) saturate(0.85);
    -webkit-backdrop-filter: blur(7px) saturate(0.85);
    animation: ypm-veil 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
    overflow-y: auto;
}

@keyframes ypm-veil {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ypm-plate {
    position: relative;
    width: 100%;
    max-width: 452px;
    background: linear-gradient(180deg, #232323 0%, #1D1D1D 100%);
    border: 1px solid #2E2E2E;
    border-radius: 16px;
    padding: 2.1rem 1.9rem 1.75rem;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.62),
        0 2px 0 rgba(255, 255, 255, 0.03) inset,
        0 0 0 1px rgba(242, 183, 53, 0.05);
    animation: ypm-rise 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 60ms;
}

/* Brass rim: a hairline that catches the light at the centre and falls off. */
.ypm-plate::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 14%;
    right: 14%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent 0%, #F2B735 45%, #FFD98A 50%, #F2B735 55%, transparent 100%);
    opacity: 0.85;
}

@keyframes ypm-rise {
    from { opacity: 0; transform: translateY(18px) scale(0.975); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Seal ─────────────────────────────────────────────────────────────── */
.ypm-seal {
    width: 58px;
    height: 58px;
    margin: 0 auto 1.05rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #F2B735;
    font-size: 1.45rem;
    background: radial-gradient(circle at 50% 38%, rgba(242, 183, 53, 0.20) 0%, rgba(242, 183, 53, 0.05) 60%, transparent 100%);
    border: 1px solid rgba(242, 183, 53, 0.34);
    box-shadow: 0 0 26px rgba(242, 183, 53, 0.16), 0 0 0 6px rgba(242, 183, 53, 0.035);
}

.ypm-head { text-align: center; }

.ypm-title {
    margin: 0 0 0.3rem;
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #F5F5F5;
}

.ypm-sub {
    margin: 0 0 1.45rem;
    font-size: 0.855rem;
    line-height: 1.5;
    color: #9A9A9A;
}

.ypm-sub strong { color: #D8D8D8; font-weight: 600; }

/* ── Fields ───────────────────────────────────────────────────────────── */
.ypm-field { position: relative; margin-bottom: 0.85rem; }

.ypm-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.735rem;
    font-weight: 600;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: #8C8C8C;
}

.ypm-input {
    width: 100%;
    padding: 0.82rem 2.85rem 0.82rem 0.95rem;
    background: #181818;
    border: 1px solid #333;
    border-radius: 11px;
    color: #F0F0F0;
    font-size: 0.96rem;
    font-family: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ypm-input::placeholder { color: #5E5E5E; }

.ypm-input:focus {
    outline: none;
    background: #1C1C1C;
    border-color: #F2B735;
    box-shadow: 0 0 0 3px rgba(242, 183, 53, 0.14);
}

.ypm-input.is-bad:not(:focus) { border-color: #B3453C; }
.ypm-input.is-good:not(:focus) { border-color: #3E7D52; }

/* Reveal toggle — sits inside the field, never covers text due to input padding */
.ypm-reveal {
    position: absolute;
    right: 0.55rem;
    bottom: 0.5rem;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    background: none;
    border: 0;
    border-radius: 7px;
    color: #7C7C7C;
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease;
}

.ypm-reveal:hover { color: #F2B735; background: rgba(242, 183, 53, 0.09); }
.ypm-reveal:focus-visible { outline: 2px solid #F2B735; outline-offset: 1px; }

/* ── Strength gauge ───────────────────────────────────────────────────── */
.ypm-gauge { display: flex; gap: 4px; margin: 0.15rem 0 0.5rem; }

.ypm-gauge span {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: #2F2F2F;
    transition: background 300ms ease;
}

.ypm-gauge span.lit-1 { background: #B3453C; }
.ypm-gauge span.lit-2 { background: #C97A32; }
.ypm-gauge span.lit-3 { background: #D9A02E; }
.ypm-gauge span.lit-4 { background: #3E7D52; }

.ypm-gauge-text {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    margin-bottom: 1rem;
    min-height: 1rem;
}

.ypm-t1 { color: #B3453C; }
.ypm-t2 { color: #C97A32; }
.ypm-t3 { color: #D9A02E; }
.ypm-t4 { color: #56A46F; }

/* ── Rules checklist ──────────────────────────────────────────────────── */
.ypm-rules {
    list-style: none;
    margin: 0 0 1.2rem;
    padding: 0.85rem 0.95rem;
    background: rgba(255, 255, 255, 0.018);
    border: 1px solid #2B2B2B;
    border-radius: 11px;
}

.ypm-rules li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.815rem;
    color: #7E7E7E;
    padding: 0.16rem 0;
    transition: color 220ms ease;
}

.ypm-rules li.met { color: #BFBFBF; }

.ypm-tick {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1.5px solid #3C3C3C;
    display: grid;
    place-items: center;
    font-size: 8.5px;
    color: transparent;
    transition: border-color 220ms ease, background 220ms ease, color 220ms ease, transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ypm-rules li.met .ypm-tick {
    border-color: #3E7D52;
    background: #3E7D52;
    color: #0E1A12;
    transform: scale(1.12);
}

/* ── Error ────────────────────────────────────────────────────────────── */
.ypm-error {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 1rem;
    padding: 0.7rem 0.85rem;
    background: rgba(179, 69, 60, 0.11);
    border: 1px solid rgba(179, 69, 60, 0.4);
    border-radius: 10px;
    color: #E3948C;
    font-size: 0.83rem;
    line-height: 1.45;
    animation: ypm-shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes ypm-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}

/* ── Submit ───────────────────────────────────────────────────────────── */
.ypm-submit {
    width: 100%;
    padding: 0.92rem;
    background: linear-gradient(135deg, #F2B735 0%, #D9A02E 100%);
    border: none;
    border-radius: 12px;
    color: #222;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(242, 183, 53, 0.32);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.ypm-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(242, 183, 53, 0.42);
    filter: brightness(1.06);
}

.ypm-submit:disabled {
    background: #3A3A3A;
    color: #7A7A7A;
    box-shadow: none;
    cursor: not-allowed;
}

/* The two exits that must survive a dropped circuit — "Back to sign in" and the
   post-reset "Sign in" — are real <a href> navigations rather than buttons, so
   they need the box a <button> gets for free. */
.ypm-submit-link {
    box-sizing: border-box;
    display: block;
    text-align: center;
    text-decoration: none;
}

.ypm-submit-link:hover {
    color: #222;
    text-decoration: none;
}

.ypm-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 0.5rem;
    vertical-align: -2px;
    border: 2px solid rgba(34, 34, 34, 0.32);
    border-top-color: #222;
    border-radius: 50%;
    animation: ypm-spin 0.7s linear infinite;
}

@keyframes ypm-spin { to { transform: rotate(360deg); } }

.ypm-foot {
    margin: 0.95rem 0 0;
    text-align: center;
    font-size: 0.755rem;
    line-height: 1.5;
    color: #6E6E6E;
}

/* Staggered reveal of the plate's contents. */
.ypm-stagger > * { animation: ypm-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.ypm-stagger > *:nth-child(1) { animation-delay: 150ms; }
.ypm-stagger > *:nth-child(2) { animation-delay: 205ms; }
.ypm-stagger > *:nth-child(3) { animation-delay: 255ms; }
.ypm-stagger > *:nth-child(4) { animation-delay: 300ms; }
.ypm-stagger > *:nth-child(5) { animation-delay: 340ms; }
.ypm-stagger > *:nth-child(6) { animation-delay: 375ms; }

@keyframes ypm-in {
    from { opacity: 0; transform: translateY(9px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 420px) {
    .ypm-plate { padding: 1.7rem 1.25rem 1.4rem; }
    .ypm-title { font-size: 1.15rem; }
}

/* Motion is decoration here; the dialog must still work without it. */
@media (prefers-reduced-motion: reduce) {
    .ypm-backdrop,
    .ypm-plate,
    .ypm-stagger > *,
    .ypm-error {
        animation: none !important;
    }
    .ypm-gauge span,
    .ypm-tick,
    .ypm-submit,
    .ypm-input {
        transition: none !important;
    }
}

/* ── Standalone plate ─────────────────────────────────────────────── */
/* The set-password page shows the same plate as the modal but with no login card
   behind it, so it needs the backdrop's centring without the backdrop's scrim. */
.ypm-standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #1A1A1A;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(242, 183, 53, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(242, 183, 53, 0.03) 0%, transparent 50%);
}
