:root {
    --p:      #793FED;
    --p2:     #5960E4;
    --grad:   linear-gradient(135deg, #793FED 0%, #5960E4 100%);
    --bg:     #f4f3ff;
    --card:   #ffffff;
    --text:   #0f172a;
    --sub:    #64748b;
    --border: #e2e8f0;
    --ok:     #10b981;
    --err:    #ef4444;
    --r:      20px;
    --rf:     10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Background ────────────────────────────────── */
body {
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 60% at 0% 0%,   rgba(121, 63,237,.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 60% at 100% 100%, rgba(89, 96,228,.10) 0%, transparent 60%);
    background-attachment: fixed;
}

/* ── Shell ─────────────────────────────────────── */
.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px 32px;
    gap: 24px;
}

/* ── Card ──────────────────────────────────────── */
.card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: var(--r);
    border: 1px solid rgba(226,232,240,.8);
    box-shadow:
        0 0 0 1px rgba(121,63,237,.04),
        0 4px 6px -2px rgba(0,0,0,.05),
        0 24px 48px -12px rgba(89,96,228,.18);
    padding: 36px 36px 28px;
}

/* ── Brand ─────────────────────────────────────── */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--grad);
    box-shadow: 0 4px 12px -3px rgba(121,63,237,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.025em;
    color: var(--text);
}

/* ── Headings ──────────────────────────────────── */
.card-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.2;
}

.card-sub {
    font-size: 14px;
    color: var(--sub);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ── Form ──────────────────────────────────────── */
form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    letter-spacing: -.005em;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forgot-link {
    font-size: 12.5px;
    color: var(--p);
    text-decoration: none;
    font-weight: 500;
    transition: opacity .15s;
}
.forgot-link:hover { opacity: .75; text-decoration: underline; }

/* ── Shared input styles ───────────────────────── */
.solo-input,
.input-wrap input,
.pass-wrap input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text);
    background: #fafbff;
    border: 1.5px solid var(--border);
    border-radius: var(--rf);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
    -webkit-appearance: none;
}

.solo-input::placeholder,
.input-wrap input::placeholder,
.pass-wrap input::placeholder {
    color: #b0bac8;
    font-size: 13.5px;
}

.solo-input:focus,
.input-wrap input:focus,
.pass-wrap input:focus {
    border-color: var(--p);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(121,63,237,.13);
}

/* ── RUC wrap (has status icon on right) ────────── */
.input-wrap {
    position: relative;
}

.input-wrap input {
    padding-right: 42px;
}

.input-wrap.is-ok input {
    border-color: var(--ok);
    background: #f0fdf9;
}
.input-wrap.is-ok input:focus {
    box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}

.input-wrap.is-error input {
    border-color: var(--err);
    background: #fff5f5;
}
.input-wrap.is-error input:focus {
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

/* ── Status icon ───────────────────────────────── */
.status-icon {
    position: absolute;
    right: 12px;
    top: 0;
    bottom: 0;
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 14px;
    font-weight: 700;
}

.status-icon.is-loading::after {
    content: '';
    display: block;
    width: 15px; height: 15px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--p);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

.status-icon.is-ok::after  { content: '✓'; color: var(--ok); }
.status-icon.is-err::after { content: '✕'; color: var(--err); }

/* ── Password wrap (has eye button on right) ─────── */
.pass-wrap {
    position: relative;
}

.pass-wrap input {
    padding-right: 44px;
}

.eye-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 var(--rf) var(--rf) 0;
    transition: color .15s;
}
.eye-btn:hover { color: var(--p); }

/* ── Hint under RUC ───────────────────────────── */
.field-hint {
    font-size: 12px;
    color: var(--sub);
    min-height: 15px;
    padding-left: 1px;
    transition: color .2s;
}
.field-hint.is-ok  { color: var(--ok); }
.field-hint.is-err { color: var(--err); }

/* ── Submit button ─────────────────────────────── */
.submit-btn {
    width: 100%;
    height: 46px;
    margin-top: 2px;
    border: none;
    border-radius: var(--rf);
    background: var(--grad);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.01em;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 14px -4px rgba(121,63,237,.55);
    transition: transform .1s, box-shadow .15s, opacity .15s;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -6px rgba(121,63,237,.65);
}
.submit-btn:active:not(:disabled) { transform: translateY(0); }

.submit-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-btn.is-loading .btn-text { opacity: 0; }

.btn-spin {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
.submit-btn.is-loading .btn-spin { display: block; }

/* ── Error message ─────────────────────────────── */
.form-error {
    min-height: 18px;
    font-size: 13px;
    color: var(--err);
    text-align: center;
    line-height: 1.4;
    padding: 0 4px;
}

/* ── Card footer ───────────────────────────────── */
.card-foot {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    font-size: 13px;
    color: var(--sub);
}

.foot-link {
    color: var(--p);
    font-weight: 500;
    text-decoration: none;
    transition: opacity .15s;
}
.foot-link:hover { opacity: .75; text-decoration: underline; }

/* ── Legal ─────────────────────────────────────── */
.legal {
    font-size: 11.5px;
    color: #94a3b8;
    text-align: center;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile ────────────────────────────────────── */
@media (max-width: 480px) {
    .card { padding: 28px 22px 22px; border-radius: 16px; }
    .card-title { font-size: 20px; }
}
