/* ======================================================================
   AUTH MODAL  -  compact, pharma-themed animations, responsive
   ====================================================================== */
.auth-modal,
.auth-modal *,
.auth-modal *::before,
.auth-modal *::after { box-sizing: border-box; }

.auth-modal {
    --am-primary: #ff6f61;
    --am-primary-dark: #f2584a;
    --am-primary-soft: #fff1ef;
    --am-ink: #1f2437;
    --am-muted: #6b7280;
    --am-line: #e8eaf0;
    --am-field: #f6f7fa;
    --am-ok: #16a34a;
    --am-ease: cubic-bezier(.2, .8, .2, 1);
    font-family: 'Inter', sans-serif;
}
.auth-modal input,
.auth-modal button,
.auth-modal select,
.auth-modal textarea { font-family: inherit; }

/* Font Awesome safety */
.auth-modal .fa-solid,
.auth-modal .fas {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 5 Free", "FontAwesome" !important;
    font-weight: 900 !important;
}
.auth-modal .fa-regular,
.auth-modal .far {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 5 Free", "FontAwesome" !important;
    font-weight: 400 !important;
}
.auth-modal .fa-brands,
.auth-modal .fab {
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands" !important;
    font-weight: 400 !important;
}
.auth-modal i[class*="fa-"] { font-style: normal; line-height: 1; display: inline-block; }

/* ----------------------------------------------------------------------
   Keyframes
   ---------------------------------------------------------------------- */
@keyframes amRise   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes amPop    { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes amShake  { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes amSpin   { to { transform: rotate(360deg); } }
@keyframes amShine  { 0% { transform: translateX(-120%) skewX(-20deg); } 100% { transform: translateX(260%) skewX(-20deg); } }
@keyframes amLine   { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes amTick   { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes amRing   { 0% { transform: scale(.9); opacity: .55; } 100% { transform: scale(1.6); opacity: 0; } }

/* pharma: heartbeat for icons */
@keyframes amBeat {
    0%, 100% { transform: scale(1); }
    14%      { transform: scale(1.18); }
    28%      { transform: scale(1); }
    42%      { transform: scale(1.12); }
    70%      { transform: scale(1); }
}
/* pharma: ECG line travelling across the header */
@keyframes amEcg  { from { stroke-dashoffset: 28; } to { stroke-dashoffset: -72; } }
/* pharma: capsules / tablets drop in like from a bottle, then float */
@keyframes amDrop {
    0%   { opacity: 0; transform: translateY(-40px) rotate(calc(var(--r, 0deg) - 120deg)); }
    60%  { opacity: 1; transform: translateY(5px) rotate(calc(var(--r, 0deg) + 8deg)); }
    100% { opacity: 1; transform: translateY(0) rotate(var(--r, 0deg)); }
}
@keyframes amFloat {
    0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
    50%      { transform: translateY(-6px) rotate(calc(var(--r, 0deg) + 14deg)); }
}
/* pharma: medical cross pulse */
@keyframes amCross { 0%, 100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.35); opacity: 1; } }

/* ----------------------------------------------------------------------
   Overlay
   ---------------------------------------------------------------------- */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: radial-gradient(circle at 50% 30%, rgba(255, 111, 97, .2), rgba(15, 23, 42, .6) 60%);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility 0s linear .25s;
}
.auth-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .25s ease, visibility 0s;
}

/* ----------------------------------------------------------------------
   Card (compact)
   ---------------------------------------------------------------------- */
.auth-modal .auth-container {
    width: 100%;
    max-width: 380px;
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 28px 70px -16px rgba(15, 23, 42, .5);
    scrollbar-width: none;
    -ms-overflow-style: none;
    opacity: 0;
    transform: translateY(36px) scale(.92);
    transition: transform .5s var(--am-ease), opacity .28s ease;
}
.auth-modal.is-open .auth-container { opacity: 1; transform: none; }
.auth-modal .auth-container::-webkit-scrollbar { display: none; width: 0; height: 0; }

.auth-modal .auth-card { position: relative; display: block; background: #fff; }

/* Close button */
.auth-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .28);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, color .2s, transform .35s var(--am-ease);
}
.auth-modal-close:hover { background: #fff; color: var(--am-primary); transform: rotate(90deg) scale(1.08); }

/* ----------------------------------------------------------------------
   Pharma header: ECG heartbeat + capsules + tablets + medical crosses
   ---------------------------------------------------------------------- */
.auth-modal .auth-brand {
    position: relative;
    overflow: hidden;
    padding: 14px 48px 22px 18px;
    background: linear-gradient(135deg, #ff6f61 0%, #ff8a6b 60%, #ffae94 100%);
    color: #fff;
}
.auth-modal .auth-brand::after {
    /* soft curve into the white form area */
    content: '';
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: -14px;
    height: 26px;
    border-radius: 50% 50% 0 0;
    background: #fff;
    z-index: 1;
}

.auth-modal .brand-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.auth-modal .brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .35);
}
.auth-modal .brand-logo { display: block; width: auto; max-width: 130px; height: 22px; margin: 0; object-fit: contain; }
.auth-modal .brand-tagline { margin: 0; font-size: 11.5px; line-height: 1.35; font-weight: 500; color: rgba(255, 255, 255, .96); }

/* ECG line */
.auth-modal .brand-ecg {
    position: absolute;
    right: 0;
    bottom: 12px;
    width: 62%;
    height: 34px;
    z-index: 0;
    overflow: visible;
    pointer-events: none;
}
.auth-modal .brand-ecg path {
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
.auth-modal .brand-ecg .ecg-base { stroke: rgba(255, 255, 255, .28); }
.auth-modal .brand-ecg .ecg-live {
    stroke: #fff;
    stroke-dasharray: 28 72;
    stroke-dashoffset: 28;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, .9));
}
.auth-modal.is-open .brand-ecg .ecg-live { animation: amEcg 2.4s linear infinite; }

/* Capsules / tablet / crosses */
.auth-modal .pill { position: absolute; pointer-events: none; z-index: 0; opacity: 0; }
.auth-modal .pill-capsule {
    width: 28px;
    height: 11px;
    border-radius: 11px;
    background: linear-gradient(90deg, #fff 50%, rgba(255, 255, 255, .5) 50%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .14);
}
.auth-modal .pill-capsule.c1 { top: 14px; right: 58px; --r: 28deg; }
.auth-modal .pill-capsule.c2 { top: 44px; right: 22px; --r: -34deg; width: 24px; height: 10px; }
.auth-modal .pill-tablet {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .14);
    top: 20px;
    right: 112px;
    --r: 0deg;
}
.auth-modal .pill-tablet::after {
    content: '';
    position: absolute;
    left: 3px;
    right: 3px;
    top: 50%;
    height: 1.5px;
    margin-top: -.75px;
    background: rgba(255, 111, 97, .55);
}
.auth-modal .med-cross { color: #fff; font-size: 10px; }
.auth-modal .med-cross.x1 { top: 12px; right: 150px; }
.auth-modal .med-cross.x2 { top: 50px; right: 96px; font-size: 8px; }

.auth-modal.is-open .pill-capsule.c1 { animation: amDrop .8s .10s var(--am-ease) both, amFloat 5.2s .9s ease-in-out infinite; }
.auth-modal.is-open .pill-capsule.c2 { animation: amDrop .8s .22s var(--am-ease) both, amFloat 4.6s 1.0s ease-in-out infinite; }
.auth-modal.is-open .pill-tablet     { animation: amDrop .8s .34s var(--am-ease) both, amFloat 5.8s 1.1s ease-in-out infinite; }
.auth-modal.is-open .med-cross.x1    { opacity: .6; animation: amCross 2.2s ease-in-out infinite; }
.auth-modal.is-open .med-cross.x2    { opacity: .6; animation: amCross 2.2s 1.1s ease-in-out infinite; }

/* ----------------------------------------------------------------------
   Forms area + section transitions (staggered)
   ---------------------------------------------------------------------- */
.auth-modal .auth-forms { position: relative; z-index: 3; min-width: 0; padding: 2px 20px 12px; background: #fff; }

.auth-modal .auth-section:not(.hidden) > * { animation: amRise .45s var(--am-ease) both; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(1) { animation-delay: .02s; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(2) { animation-delay: .06s; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(3) { animation-delay: .10s; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(4) { animation-delay: .14s; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(5) { animation-delay: .18s; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(6) { animation-delay: .22s; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(7) { animation-delay: .26s; }
.auth-modal .auth-section:not(.hidden) > *:nth-child(8) { animation-delay: .30s; }
.auth-modal #loginSection:not(.hidden),
.auth-modal #registerSection:not(.hidden) { animation: amRise .35s var(--am-ease) both; }

/* Headings */
.auth-modal .form-header { margin: 2px 0 10px; }
.auth-modal .form-header h2 {
    margin: 0 0 2px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.3px;
    color: var(--am-ink);
    line-height: 1.2;
}
.auth-modal .form-header p { margin: 0; font-size: 12.5px; color: var(--am-muted); }
.auth-modal .form-header.centered { text-align: center; }
/* login / signup title only (keeps the main screen short) */
.auth-modal #mainAuthSection .form-header p { display: none; }

/* Icon badge: pharma icon with heartbeat + ring */
.auth-modal .auth-badge {
    position: relative;
    width: 46px;
    height: 46px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: linear-gradient(135deg, #fff1ef, #ffd9d3);
    color: var(--am-primary);
    font-size: 19px;
    animation: amPop .5s var(--am-ease) both;
}
.auth-modal .auth-badge i { animation: amBeat 1.6s ease-in-out infinite; }
.auth-modal .auth-badge::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 15px;
    border: 2px solid rgba(255, 111, 97, .5);
    animation: amRing 2s ease-out infinite;
}

/* Step indicator (forgot password flow) */
.auth-modal .auth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px auto 10px;
    max-width: 170px;
}
.auth-modal .auth-steps .step {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef0f5;
    color: #9aa1b2;
    font-size: 11px;
    font-weight: 700;
    transition: all .3s;
}
.auth-modal .auth-steps .step b { font-weight: 700; }
.auth-modal .auth-steps .step.active { background: var(--am-primary); color: #fff; box-shadow: 0 0 0 4px rgba(255, 111, 97, .18); }
.auth-modal .auth-steps .step.done { background: var(--am-primary); color: #fff; }
.auth-modal .auth-steps .step.done b { font-size: 0; }
.auth-modal .auth-steps .step.done b::before {
    content: "\2713";
    font-size: 12px;
    display: inline-block;
    animation: amTick .35s var(--am-ease) both;
}
.auth-modal .auth-steps .step-line {
    flex: 1;
    height: 3px;
    margin: 0 5px;
    border-radius: 3px;
    background: #eef0f5;
    position: relative;
    overflow: hidden;
}
.auth-modal .auth-steps .step-line.done::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--am-primary);
    transform-origin: left;
    animation: amLine .5s .1s var(--am-ease) both;
}

/* ----------------------------------------------------------------------
   Tabs with sliding indicator
   ---------------------------------------------------------------------- */
.auth-modal .auth-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f1f2f6;
    border-radius: 12px;
    padding: 3px;
    margin-bottom: 10px;
}
.auth-modal .auth-tabs::before {
    content: '';
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(31, 36, 55, .1);
    transition: transform .4s var(--am-ease);
}
.auth-modal .auth-tabs:has(#tabRegisterBtn.active)::before { transform: translateX(100%); }
.auth-modal .auth-tab {
    position: relative;
    z-index: 1;
    height: 33px;
    border: 0;
    background: transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    color: var(--am-muted);
    cursor: pointer;
    transition: color .25s;
}
.auth-modal .auth-tab:hover { color: var(--am-ink); }
.auth-modal .auth-tab.active { color: var(--am-primary); }
@supports not selector(:has(*)) {
    .auth-modal .auth-tabs::before { display: none; }
    .auth-modal .auth-tab.active { background: #fff; box-shadow: 0 3px 10px rgba(31, 36, 55, .1); }
}

/* ----------------------------------------------------------------------
   Inputs
   ---------------------------------------------------------------------- */
.auth-modal .input-group-custom { margin-bottom: 8px; }
.auth-modal .input-icon { position: relative; }
.auth-modal .input-icon > i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    color: #a3a9b8;
    font-size: 13px;
    pointer-events: none;
    transition: color .2s, transform .3s var(--am-ease);
}
.auth-modal .input-icon:focus-within > i { color: var(--am-primary); transform: translateY(-50%) scale(1.15); }

.auth-modal .auth-input {
    width: 100%;
    height: 40px;
    border: 1.5px solid transparent;
    border-radius: 10px;
    padding: 0 12px 0 38px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--am-ink);
    background: var(--am-field);
    outline: none;
    transition: border-color .2s, box-shadow .25s, background .2s;
}
.auth-modal .auth-input::placeholder { color: #9aa1b2; font-weight: 400; }
.auth-modal .auth-input:hover { background: #f0f2f7; }
.auth-modal .auth-input:focus {
    background: #fff;
    border-color: var(--am-primary);
    box-shadow: 0 0 0 3.5px rgba(255, 111, 97, .14);
}
.auth-modal .auth-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px #fff inset;
    -webkit-text-fill-color: var(--am-ink);
}
.auth-modal .password-wrapper .auth-input { padding-right: 42px; }
.auth-modal .password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #8a91a3;
    font-size: 14px;
    cursor: pointer;
    z-index: 2;
    transition: color .2s, background .2s;
}
.auth-modal .password-toggle i { position: static; transform: none; color: inherit; }
.auth-modal .password-toggle:hover { color: var(--am-primary); background: var(--am-primary-soft); }

/* Inline login error (shakes every time it appears) */
.auth-modal .login-inline-error {
    display: none;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    margin: 0 0 8px;
    border: 1px solid #fbc4c4;
    border-left: 4px solid #e5484d;
    border-radius: 9px;
    background: #fff4f4;
    color: #c92a2a;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    animation: amShake .5s ease both;
}
.auth-modal .login-inline-error i { flex-shrink: 0; font-size: 14px; }
.auth-modal .login-inline-error span { flex: 1; min-width: 0; }

/* Forgot link */
.auth-modal .forgot-link { text-align: right; margin: -1px 0 9px; }
.auth-modal .forgot-link a {
    position: relative;
    font-size: 12px;
    font-weight: 700;
    color: var(--am-primary);
    text-decoration: none;
}
.auth-modal .forgot-link a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .3s var(--am-ease);
}
.auth-modal .forgot-link a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ----------------------------------------------------------------------
   Primary button (shine + capsule spinner)
   ---------------------------------------------------------------------- */
.auth-modal .auth-submit {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 42px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff6f61, #ff8a5c);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    cursor: pointer;
    box-shadow: 0 9px 20px -8px rgba(255, 111, 97, .7);
    transition: transform .2s var(--am-ease), box-shadow .25s, filter .2s;
}
.auth-modal .auth-submit::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: translateX(-120%) skewX(-20deg);
    pointer-events: none;
}
.auth-modal .auth-submit:hover { transform: translateY(-2px); box-shadow: 0 13px 26px -8px rgba(255, 111, 97, .8); }
.auth-modal .auth-submit:hover::after { animation: amShine .8s ease; }
.auth-modal .auth-submit:active { transform: translateY(0) scale(.99); }
.auth-modal .auth-submit:disabled { opacity: .88; cursor: not-allowed; transform: none; box-shadow: none; filter: saturate(.85); }
/* pharma loader: a spinning capsule */
.auth-modal .auth-submit[aria-busy="true"]::before {
    content: '';
    width: 20px;
    height: 9px;
    border-radius: 9px;
    background: linear-gradient(90deg, #fff 50%, rgba(255, 255, 255, .5) 50%);
    animation: amSpin .8s linear infinite;
}

/* Divider + Google */
.auth-modal .divider {
    display: flex;
    align-items: center;
    margin: 10px 0;
    color: #a3a9b8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
}
.auth-modal .divider::before,
.auth-modal .divider::after { content: ''; flex: 1; height: 1px; background: var(--am-line); }
.auth-modal .divider span { padding: 0 10px; }

.auth-modal .google-btn {
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1.5px solid var(--am-line);
    border-radius: 10px;
    background: #fff;
    color: var(--am-ink);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .2s var(--am-ease), border-color .2s, box-shadow .2s;
}
.auth-modal .google-btn i { font-size: 15px; color: #ea4335; transition: transform .3s var(--am-ease); }
.auth-modal .google-btn:hover { transform: translateY(-2px); border-color: var(--am-primary); box-shadow: 0 10px 20px -10px rgba(31, 36, 55, .3); }
.auth-modal .google-btn:hover i { transform: rotate(-12deg) scale(1.15); }

/* ----------------------------------------------------------------------
   Password rules (compact chips with live ticks)
   ---------------------------------------------------------------------- */
.auth-modal .password-hint {
    background: #fafbfc;
    border: 1px dashed #e0e3ec;
    border-radius: 10px;
    padding: 6px 8px;
    margin: 0 0 9px;
}
.auth-modal .password-hint .hint-title { display: none; }
.auth-modal .password-hint ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.auth-modal .password-hint li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef0f5;
    color: #7b8294;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.5;
    transition: background .25s, color .25s, transform .25s var(--am-ease);
}
.auth-modal .password-hint li::before { content: "\2022"; font-size: 12px; line-height: 1; }
.auth-modal .password-hint li.ok { background: #e3f6ea; color: var(--am-ok); transform: scale(1.04); }
.auth-modal .password-hint li.ok::before { content: "\2713"; font-size: 10px; animation: amTick .3s var(--am-ease) both; }

/* ----------------------------------------------------------------------
   OTP boxes
   ---------------------------------------------------------------------- */
.auth-modal .otp-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 2px 0 12px;
}
.auth-modal .otp-input {
    width: 42px;
    height: 48px;
    padding: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--am-ink);
    background: var(--am-field);
    border: 1.5px solid transparent;
    border-radius: 11px;
    outline: none;
    caret-color: var(--am-primary);
    transition: border-color .2s, box-shadow .25s, background .2s, transform .25s var(--am-ease);
}
.auth-modal .otp-input:hover { background: #f0f2f7; }
.auth-modal .otp-input:focus {
    background: #fff;
    border-color: var(--am-primary);
    box-shadow: 0 0 0 3.5px rgba(255, 111, 97, .15);
    transform: translateY(-3px);
}
.auth-modal .otp-input:not(:placeholder-shown) {
    background: var(--am-primary-soft);
    border-color: rgba(255, 111, 97, .55);
    color: var(--am-primary-dark);
    animation: amPop .25s var(--am-ease);
}
.auth-modal .resend-otp { text-align: center; margin: 0 0 10px; }
.auth-modal .resend-otp p { margin: 0; font-size: 12px; color: var(--am-muted); }
.auth-modal .resend-otp button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--am-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.auth-modal .resend-otp button:hover { text-decoration: underline; }
.auth-modal .resend-otp button:disabled { opacity: .6; cursor: not-allowed; text-decoration: none; }

/* ----------------------------------------------------------------------
   Back link, utilities, legal
   ---------------------------------------------------------------------- */
.auth-modal .hidden { display: none !important; }
.auth-modal .back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    margin-top: 4px;
    padding: 6px 0;
    border: 0;
    background: none;
    color: var(--am-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color .2s;
}
.auth-modal .back-link i { transition: transform .25s var(--am-ease); }
.auth-modal .back-link:hover { color: var(--am-primary); }
.auth-modal .back-link:hover i { transform: translateX(-4px); }

.auth-modal .auth-legal {
    margin-top: 8px;
    text-align: center;
    font-size: 10.5px;
    line-height: 1.5;
    color: #a3a9b8;
}
.auth-modal .auth-legal a { color: var(--am-primary); text-decoration: none; font-weight: 600; }
.auth-modal .auth-legal a:hover { text-decoration: underline; }

body.auth-modal-open { overflow: hidden; }

/* SweetAlert popups must always show ABOVE the auth modal */
.swal2-container { z-index: 100000 !important; }

/* ----------------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------------- */
@media (max-width: 480px) {
    .auth-modal { padding: 10px; }
    .auth-modal .auth-container { border-radius: 18px; max-height: calc(100dvh - 20px); }
    .auth-modal .auth-brand { padding: 12px 46px 20px 14px; }
    .auth-modal .auth-forms { padding: 2px 16px 12px; }
    /* 16px stops iOS Safari from zooming when an input is focused */
    .auth-modal .auth-input { font-size: 16px; }
    .auth-modal .otp-container { gap: 6px; }
    .auth-modal .otp-input { width: 40px; height: 46px; font-size: 19px; }
}
@media (max-width: 360px) {
    .auth-modal .brand-tagline { display: none; }
    .auth-modal .otp-input { width: 36px; height: 44px; }
}
/* Short screens: slim header, then drop it */
@media (max-height: 700px) {
    .auth-modal .brand-tagline,
    .auth-modal .pill,
    .auth-modal .brand-ecg { display: none; }
    .auth-modal .auth-brand { padding-bottom: 18px; }
    .auth-modal .auth-badge { width: 40px; height: 40px; font-size: 17px; margin-bottom: 6px; }
}
@media (max-height: 620px) {
    .auth-modal .auth-legal { display: none; }
    .auth-modal .form-header p { display: none; }
}
@media (max-height: 540px) {
    .auth-modal .auth-brand { display: none; }
    .auth-modal-close { background: #f1f2f6; color: var(--am-ink); }
    .auth-modal .auth-forms { padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-modal,
    .auth-modal *,
    .auth-modal *::before,
    .auth-modal *::after { animation: none !important; transition: none !important; }
    .auth-modal .pill { opacity: .8; }
}