/**
 * Auth screens — painted amber top + rising white sheet
 */
body.rx-auth-modern {
    margin: 0;
    min-height: 100dvh;
    font-family: 'Manrope', system-ui, sans-serif;
    background: #ea580c;
    color: #45210f;
    -webkit-tap-highlight-color: transparent;
}

.rx-auth-screen {
    position: relative;
    min-height: 100dvh;
    max-width: 430px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(58% 26% at 82% 6%, rgba(254, 240, 138, 0.6), transparent 62%),
        radial-gradient(52% 22% at 10% 20%, rgba(253, 186, 116, 0.55), transparent 64%),
        radial-gradient(64% 26% at 92% 48%, rgba(251, 191, 36, 0.5), transparent 62%),
        linear-gradient(178deg, #fbbf24 0%, #f59e0b 38%, #ea580c 100%);
    box-shadow: 0 0 0 1px rgba(255, 237, 213, 0.35), 0 28px 70px rgba(124, 45, 18, 0.2);
}

.rx-auth-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.26;
    mix-blend-mode: soft-light;
    background-image:
        repeating-linear-gradient(114deg, rgba(255, 255, 255, 0.24) 0 3px, transparent 3px 9px),
        repeating-linear-gradient(28deg, rgba(124, 45, 18, 0.16) 0 2px, transparent 2px 11px);
}

/* painted blobs behind the header */
.rx-auth-paint {
    position: absolute;
    inset: 0 0 auto 0;
    height: 46vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.rx-blob {
    position: absolute;
    display: block;
    filter: blur(2px);
}

.rx-blob--a {
    top: -30%;
    right: -22%;
    width: 78%;
    height: 120%;
    border-radius: 60% 40% 48% 52% / 44% 56% 44% 56%;
    background: linear-gradient(150deg, #fef3c7, #fcd34d 55%, #f59e0b);
    opacity: 0.55;
}

.rx-blob--b {
    top: 6%;
    left: -30%;
    width: 68%;
    height: 92%;
    border-radius: 52% 48% 42% 58% / 55% 40% 60% 45%;
    background: linear-gradient(170deg, #fdba74, #ea580c 70%);
    opacity: 0.45;
}

.rx-blob--c {
    top: 40%;
    right: 8%;
    width: 46%;
    height: 62%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 251, 235, 0.7), transparent 65%);
    opacity: 0.6;
}

/* ── Painted header ── */
.rx-auth-top {
    position: relative;
    z-index: 2;
    padding: max(1.6rem, calc(env(safe-area-inset-top) + 0.6rem)) 1.6rem 1.35rem;
    color: #fff8ef;
    text-align: left;
}

.rx-crest {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 10px 22px rgba(124, 45, 18, 0.28);
}

.rx-crest img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rx-crest__txt {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fffaf0;
    letter-spacing: 0.04em;
}

.rx-auth-top__brand {
    margin: 0.7rem 0 0.55rem;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(255, 246, 234, 0.85);
}

.rx-auth-top__title {
    margin: 0 0 0.3rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.95rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: #fffdf8;
    text-shadow: 0 2px 8px rgba(124, 45, 18, 0.32);
}

.rx-auth-top__sub {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 245, 232, 0.9);
}

/* ── Rising sheet ── */
.rx-sheet {
    position: relative;
    z-index: 3;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.7rem 1.35rem calc(1.6rem + env(safe-area-inset-bottom));
    border-radius: 34px 34px 0 0;
    background: linear-gradient(180deg, #fffdfa 0%, #fff7ef 100%);
    box-shadow:
        0 -1px 0 rgba(255, 255, 255, 0.9) inset,
        0 -18px 40px rgba(124, 45, 18, 0.22);
}

.rx-sheet__grip {
    width: 46px;
    height: 5px;
    margin: 0 auto 1rem;
    border-radius: 999px;
    background: #f4d9c2;
}

/* segmented tab switch */
.rx-seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 1.15rem;
    border-radius: 999px;
    background: #fdeee0;
    box-shadow: inset 0 1px 3px rgba(124, 45, 18, 0.12);
}

.rx-seg a {
    padding: 0.62rem 0;
    border-radius: 999px;
    text-align: center;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #b0764c;
    transition: color 0.18s ease;
}

.rx-seg a.is-active {
    color: #fff;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 52%),
        linear-gradient(140deg, #fb923c, #c2410c);
    box-shadow: 0 5px 12px rgba(194, 65, 12, 0.3);
}

/* ── Fields: chip + caption + input ── */
.rx-input {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
    padding: 0.6rem 0.85rem 0.6rem 0.6rem;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(194, 65, 12, 0.14);
    box-shadow: 0 4px 12px rgba(124, 45, 18, 0.07);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.rx-input:focus-within {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rx-input__chip {
    --chip-a: #38bdf8;
    --chip-b: #0284c7;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 0.88rem;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 55%),
        linear-gradient(150deg, var(--chip-a), var(--chip-b));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.rx-input__chip--blue  { --chip-a: #60a5fa; --chip-b: #2563eb; }
.rx-input__chip--amber { --chip-a: #fbbf24; --chip-b: #d97706; }
.rx-input__chip--lime  { --chip-a: #a3e635; --chip-b: #4d7c0f; }

.rx-input__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.rx-input__cap {
    font-size: 0.54rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #b0764c;
}

.rx-input input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    color: #2f1608;
    padding: 1px 0 0;
}

.rx-input input::placeholder {
    color: #c9a288;
    font-weight: 600;
}

.rx-input__eye {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0.3rem;
    cursor: pointer;
    color: #b0764c;
    font-size: 0.9rem;
}

.rx-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0.55rem 0.15rem 0.2rem;
    font-size: 0.73rem;
}

.rx-auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #8a5a35;
    font-weight: 700;
    cursor: pointer;
}

.rx-auth-check input {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: #2563eb;
    cursor: pointer;
}

.rx-auth-link {
    color: #2563eb;
    font-weight: 800;
    text-decoration: none;
}

.rx-auth-terms {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-top: 0.5rem;
    padding: 0.6rem 0.7rem;
    border-radius: 14px;
    background: linear-gradient(150deg, rgba(163, 230, 53, 0.2), rgba(190, 242, 100, 0.1));
    border: 1px solid rgba(101, 163, 13, 0.3);
    cursor: pointer;
    user-select: none;
}

.rx-auth-terms input {
    appearance: none;
    -webkit-appearance: none;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0.1rem 0 0;
    flex-shrink: 0;
    border: 2px solid #a3e635;
    border-radius: 0.3rem;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.rx-auth-terms input:checked {
    background: linear-gradient(135deg, #a3e635, #4d7c0f);
    border-color: #4d7c0f;
}

.rx-auth-terms input:checked::after {
    content: '';
    position: absolute;
    left: 0.2rem;
    top: 0.02rem;
    width: 0.28rem;
    height: 0.52rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.rx-auth-terms span {
    font-size: 0.74rem;
    line-height: 1.45;
    font-weight: 700;
    color: #3f6212;
}

.rx-auth-terms a {
    color: #4d7c0f;
    font-weight: 900;
    text-decoration: none;
}

/* ── CTA ── */
.rx-cta {
    --cta-a: #60a5fa;
    --cta-b: #1d4ed8;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin: 1.1rem 0 0;
    padding: 0.95rem 0.75rem 0.95rem 1.35rem;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    overflow: hidden;
    font: inherit;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, transparent 48%),
        linear-gradient(140deg, var(--cta-a) 0%, var(--cta-b) 84%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 12px 24px rgba(29, 78, 216, 0.28);
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.13s ease, filter 0.13s ease;
}

.rx-cta--ember {
    --cta-a: #fb923c;
    --cta-b: #c2410c;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 12px 24px rgba(194, 65, 12, 0.28);
}

.rx-cta:active {
    transform: scale(0.985);
    filter: brightness(1.06);
}

.rx-cta__txt {
    font-size: 0.86rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.rx-cta__arrow {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 0.8rem;
    color: var(--cta-b);
    background: #fff;
    box-shadow: 0 3px 8px rgba(40, 20, 10, 0.2);
}

.rx-auth-foot {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #a97a55;
}

.rx-auth-foot a {
    color: #c2410c;
    font-weight: 900;
    text-decoration: none;
}

/* ── Messages ── */
.rx-auth-msg {
    margin: 0 0 0.8rem;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.4;
}

.rx-auth-msg.is-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.rx-auth-msg.is-success {
    background: #f7fee7;
    color: #3f6212;
    border: 1px solid #d9f99d;
}

.rx-auth-msg.hidden {
    display: none;
}

.rx-auth-fab {
    display: none !important;
}

@media (max-height: 700px) {
    .rx-auth-top { padding-top: max(1rem, env(safe-area-inset-top)); padding-bottom: 1rem; }
    .rx-auth-top__title { font-size: 1.6rem; }
    .rx-crest { width: 46px; height: 46px; border-radius: 15px; }
}
