:root {
    --al-primary: #ff00a6;
    --al-primary-dark: #d4008a;
    --al-primary-soft: #fff0fa;
    --al-text: #1f2937;
    --al-muted: #6b7280;
    --al-border: #e7e7ee;
    --al-bg: #f7f7f9;
    --al-error: #e5384f;
    --al-radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[pinova-cloak] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body.al-body {
    font-family: var(--al-font, YekanBakh, Tahoma, sans-serif);
    font-size: 15px;
    line-height: 1.7;
    color: var(--al-text);
    background: var(--al-bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
a { color: var(--al-primary); text-decoration: none; }

.al-page { min-height: 100vh; min-height: 100dvh; display: flex; }

/* Brand panel (desktop) */
.al-brand { display: none; }

.al-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
}

/* Form column */
.al-main {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 calc(24px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    overflow: hidden;
}

/* Mobile hero behind the card */
.al-hero {
    position: absolute;
    inset: 0 0 auto 0;
    height: calc(210px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    background: linear-gradient(135deg, #ff2db5 0%, #ff00a6 45%, #c3008a 100%);
    border-radius: 0 0 36px 36px;
    overflow: hidden;
}
.al-hero .al-blob--1 { width: 220px; height: 220px; top: -90px; left: -60px; background: rgba(255, 255, 255, .14); }
.al-hero .al-blob--2 { width: 140px; height: 140px; bottom: -50px; right: -30px; background: rgba(255, 255, 255, .1); }

.al-card {
    position: relative;
    width: calc(100% - 32px);
    max-width: 420px;
    margin-top: calc(56px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    background: #fff;
    border-radius: 24px;
    padding: 20px 20px 24px;
    box-shadow: 0 20px 50px -20px rgba(120, 0, 80, .35), 0 2px 6px rgba(17, 24, 39, .04);
    animation: al-rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.al-card.is-busy .al-step { opacity: .7; pointer-events: none; }

.al-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -4px -6px 14px;
}
.al-back {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--al-text);
    cursor: pointer;
    transition: background .15s;
}
.al-back:hover { background: var(--al-bg); }
.al-back--ghost { visibility: hidden; }
.al-logo { display: block; line-height: 0; }
.al-logo img { height: 58px; width: auto; display: block; }
.al-logo span { font-size: 22px; font-weight: 800; line-height: 1.4; color: var(--al-primary); }

.al-step { animation: al-fade .3s ease both; transition: opacity .2s; }

.al-title { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.al-sub { margin: 0 0 20px; font-size: 14px; color: var(--al-muted); }
.al-sub b { color: var(--al-text); font-weight: 700; margin: 0 2px; }

.al-field { margin-bottom: 16px; }
.al-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #374151; }

.al-input {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--al-bg);
    border: 1.5px solid transparent;
    border-radius: 14px;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.al-input:focus-within {
    background: #fff;
    border-color: var(--al-primary);
    box-shadow: 0 0 0 4px rgba(255, 0, 166, .1);
}
.al-input.has-error { border-color: var(--al-error); background: #fff; }
.al-input__icon { display: flex; padding: 0 14px 0 4px; color: #9ca3af; }
.al-input:focus-within .al-input__icon { color: var(--al-primary); }
.al-input input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 0 0 14px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .5px;
    text-align: right;
}
.al-input input::placeholder { color: #b8bcc6; font-weight: 400; letter-spacing: 1px; }
.al-input--pass input { padding-left: 4px; }
.al-eye {
    display: flex;
    padding: 0 12px;
    height: 52px;
    align-items: center;
    border: 0;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
}

.al-error { margin: 6px 2px 0; font-size: 12.5px; color: var(--al-error); }
.al-error:empty { display: none; }
.al-hint { margin: 8px 2px 0; font-size: 12px; color: #9ca3af; }

/* Code boxes */
.al-otp { position: relative; margin: 4px 0 6px; }
.al-otp input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    font-size: 16px;
    z-index: 2;
    cursor: text;
}
.al-otp__boxes { display: flex; justify-content: center; gap: 10px; }
.al-otp__box {
    width: 58px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    background: var(--al-bg);
    border: 1.5px solid transparent;
    border-radius: 16px;
    transition: border-color .15s, background .15s, transform .15s;
}
.al-otp__box.is-filled { background: var(--al-primary-soft); border-color: rgba(255, 0, 166, .35); color: var(--al-primary-dark); }
.al-otp:focus-within .al-otp__box.is-current {
    background: #fff;
    border-color: var(--al-primary);
    box-shadow: 0 0 0 4px rgba(255, 0, 166, .1);
}
.al-otp:focus-within .al-otp__box.is-current::after {
    content: "";
    width: 2px;
    height: 26px;
    background: var(--al-primary);
    animation: al-caret 1s steps(1) infinite;
}
.al-otp.has-error .al-otp__box { border-color: var(--al-error); animation: al-shake .35s; }

.al-resend { margin: 14px 0 18px; text-align: center; font-size: 13px; color: var(--al-muted); }
.al-resend b { color: var(--al-text); font-weight: 700; }

.al-row { display: flex; justify-content: flex-end; margin: -6px 0 16px; }

.al-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--al-primary);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.al-link--sm { font-size: 13px; margin-right: 4px; }
.al-link svg { width: 16px; height: 16px; }

/* Main button */
.al-btn {
    position: relative;
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #ff2db5, var(--al-primary) 50%, var(--al-primary-dark));
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px -10px rgba(255, 0, 166, .7);
    transition: transform .12s, box-shadow .2s, filter .2s;
}
.al-btn:hover { filter: brightness(1.05); }
.al-btn:active { transform: scale(.98); }
.al-btn:disabled { cursor: default; }
.al-btn__spin {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: al-spin .7s linear infinite;
}
.al-btn.is-loading .al-btn__text { opacity: 0; }
.al-btn.is-loading .al-btn__spin { opacity: 1; }

.al-alt {
    width: 100%;
    height: 50px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px solid var(--al-border);
    border-radius: 14px;
    background: #fff;
    color: var(--al-text);
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.al-alt:hover { border-color: var(--al-primary); background: var(--al-primary-soft); }
.al-alt svg { color: var(--al-primary); }

.al-terms {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 18px 0 0;
    padding: 12px 14px;
    background: var(--al-bg);
    border-radius: 12px;
    font-size: 12.5px;
    color: var(--al-muted);
}
.al-terms svg { flex: none; width: 18px; height: 18px; color: #10b981; margin-top: 1px; }
.al-terms a { font-weight: 700; }

/* Password strength */
.al-strength { display: flex; align-items: center; gap: 6px; margin: -6px 0 16px; font-size: 12px; color: var(--al-muted); }
.al-strength i { flex: 1; height: 4px; border-radius: 4px; background: var(--al-border); transition: background .2s; }
.al-strength span { min-width: 34px; text-align: left; font-weight: 700; }
.al-strength[data-level="1"] i:nth-child(-n+1),
.al-strength[data-level="2"] i:nth-child(-n+2) { background: var(--al-error); }
.al-strength[data-level="1"] span, .al-strength[data-level="2"] span { color: var(--al-error); }
.al-strength[data-level="3"] i:nth-child(-n+3) { background: #f59e0b; }
.al-strength[data-level="3"] span { color: #d97706; }
.al-strength[data-level="4"] i { background: #10b981; }
.al-strength[data-level="4"] span { color: #059669; }

.al-foot { position: relative; margin: 18px 0 0; font-size: 13px; }
.al-foot a { color: var(--al-muted); font-weight: 600; }
.al-foot a:hover { color: var(--al-primary); }

/* Toasts */
.notyf { font-family: var(--al-font, YekanBakh, Tahoma, sans-serif) !important; padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); }
.notyf__toast { border-radius: 14px !important; }

/* Admin re-login iframe */
.interim-login-success .al-card { display: none; }

@media (max-width: 360px) {
    .al-card { padding: 18px 16px 22px; }
    .al-otp__boxes { gap: 8px; }
    .al-otp__box { width: 52px; height: 56px; }
}

/* Desktop: brand panel + centered form */
@media (min-width: 960px) {
    .al-brand {
        position: relative;
        display: flex;
        align-items: center;
        flex: 0 0 46%;
        max-width: 640px;
        padding: 64px 56px;
        color: #fff;
        background: linear-gradient(150deg, #ff3dbb 0%, #ff00a6 40%, #a30075 100%);
        overflow: hidden;
    }
    .al-brand .al-blob--1 { width: 420px; height: 420px; top: -160px; left: -140px; background: rgba(255, 255, 255, .12); }
    .al-brand .al-blob--2 { width: 260px; height: 260px; bottom: -80px; right: -60px; background: rgba(255, 255, 255, .1); }
    .al-brand .al-blob--3 { width: 120px; height: 120px; top: 22%; right: 12%; background: rgba(255, 255, 255, .08); }
    .al-brand__inner { position: relative; max-width: 440px; }
    .al-brand h2 { margin: 0 0 14px; font-size: 38px; line-height: 1.45; font-weight: 800; }
    .al-brand p { margin: 0 0 34px; font-size: 16px; opacity: .9; }
    .al-perks { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
    .al-perks li {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        background: rgba(255, 255, 255, .12);
        border: 1px solid rgba(255, 255, 255, .18);
        border-radius: 16px;
        backdrop-filter: blur(6px);
        font-weight: 600;
    }
    .al-perks span {
        flex: none;
        width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        background: #fff;
        color: var(--al-primary);
    }
    .al-perks svg { fill: currentColor; }

    .al-main { justify-content: center; padding: 40px 24px; }
    .al-hero { display: none; }
    .al-card { margin-top: 0; padding: 28px 32px 32px; box-shadow: 0 24px 60px -28px rgba(17, 24, 39, .25), 0 2px 6px rgba(17, 24, 39, .04); }
}

@keyframes al-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes al-fade { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes al-spin { to { transform: rotate(360deg); } }
@keyframes al-caret { 50% { opacity: 0; } }
@keyframes al-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
    .al-card, .al-step, .al-otp.has-error .al-otp__box { animation: none; }
}
