:root {
    --c-success:        #16a34a;
    --c-danger:         #dc2626;
    --c-danger-soft:    #fee2e2;
    --c-border:         #cbd5e1;
}

@property --auth-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.auth {
    min-height: 100vh;
    padding: var(--section-y) var(--gutter);
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

.auth__back {
    position: absolute;
    top: clamp(0.75rem, 2vw, 1.5rem);
    left: clamp(0.75rem, 2vw, 1.5rem);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    color: #1e3a8a; font-weight: 600;
    font-size: clamp(0.78rem, 1.1vw, 0.9rem);
    background: rgba(30, 58, 138, 0.05);
    transition: background .15s, color .15s;
    text-decoration: none;
}
.auth__back svg { width: 14px; height: 14px; }
.auth__back:hover { background: rgba(30, 58, 138, 0.10); color: #0f172a; }
@media (max-width: 299px) {
    .auth__back span { display: none; }
    .auth__back { padding: 6px; }
}

.auth__card {
    position: relative;
    width: 100%; max-width: 100%;
    background: #ffffff;
    border-radius: 14px;
    padding: clamp(1rem, 4vw, 1.75rem);
    box-shadow: 0 30px 80px -40px rgba(15, 23, 42, .15),
                0 1px 3px rgba(15, 23, 42, .04);
    margin-top: clamp(1.5rem, 5vw, 3rem);
    isolation: isolate;
}
@media (min-width: 540px)  { .auth__card { max-width: 440px; padding: 1.75rem; border-radius: 16px; } }
@media (min-width: 915px)  { .auth__card { max-width: 480px; padding: 2rem;    border-radius: 18px; } }
@media (min-width: 1200px) { .auth__card { max-width: 520px; padding: 2.25rem; } }
@media (min-width: 1920px) { .auth__card { max-width: 560px; padding: 2.5rem;  } }

.auth__card-border {
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1.5px;
    background: conic-gradient(
        from var(--auth-angle, 0deg),
        rgba(30, 58, 138, 0)  0%,
        rgba(30, 58, 138, 0) 35%,
        rgba(30, 58, 138, .55) 47%,
        rgba(59, 130, 246, .85) 50%,
        rgba(30, 58, 138, .55) 53%,
        rgba(30, 58, 138, 0) 65%,
        rgba(30, 58, 138, 0) 100%
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    animation: auth-border-spin 7s linear infinite;
    z-index: -1;
}
.auth__card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    border: 1px solid rgba(30, 58, 138, .10);
    pointer-events: none;
    z-index: -1;
}
@keyframes auth-border-spin {
    from { --auth-angle: 0deg; } to { --auth-angle: 360deg; }
}
@media (prefers-reduced-motion: reduce) { .auth__card-border { animation: none; } }

.auth__header { text-align: center; margin-bottom: clamp(1rem, 2vw, 1.25rem); }
.auth__brand {
    display: inline-block;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    letter-spacing: 0.10em;
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    background-image: linear-gradient(
        180deg, #1e3a8a 0%, #2563eb 12.5%, #3b82f6 25%, #2563eb 37.5%,
        #1e3a8a 50%, #2563eb 62.5%, #3b82f6 75%, #2563eb 87.5%, #1e3a8a 100%
    );
    background-size: 100% 200%;
    background-position: 0 0%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter:
        drop-shadow(0 0 4px rgba(59, 130, 246, 0.35))
        drop-shadow(0 -2px 8px rgba(96, 165, 250, 0.22));
    animation:
        hero-fire           18s linear      infinite,
        auth-brand-cycle    18s ease-in-out infinite;
}
@keyframes auth-brand-cycle {
    0%   { clip-path: inset(0 100% 0 0); }
    22%  { clip-path: inset(0   0% 0 0); }
    78%  { clip-path: inset(0   0% 0 0); }
    100% { clip-path: inset(0 100% 0 0); }
}
@media (prefers-reduced-motion: reduce) { .auth__brand { animation: none; } }

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}
.auth-tabs__link {
    text-align: center; text-decoration: none;
    padding: clamp(8px, 1.5vw, 12px) clamp(6px, 2vw, 14px);
    font-weight: 700;
    font-size: clamp(0.75rem, 1.3vw, 0.92rem);
    color: #475569;
    border-radius: 9px;
    transition: background .2s, color .2s, box-shadow .2s;
}
.auth-tabs__link:hover { color: #1e3a8a; }
.auth-tabs__link.is-active {
    background: #ffffff; color: #0b1220;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px rgba(30, 58, 138, .12);
}

.auth-form { display: flex; flex-direction: column; gap: clamp(1rem, 2vw, 1.25rem); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 0.85rem; font-weight: 600; color: #334155; letter-spacing: 0.01em; }
.req { color: var(--c-danger); margin-left: 2px; }

.field__control { position: relative; display: flex; min-width: 0; }
.field__input {
    flex: 1; width: 100%; min-width: 0;
    padding: clamp(10px, 1.5vw, 12px) clamp(10px, 1.5vw, 14px);
    font-size: clamp(0.88rem, 1.3vw, 0.95rem);
    color: #0f172a;
    background: #ffffff;
    border: 1.5px solid var(--c-border);
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit; line-height: 1.4;
}
.field__input::placeholder { color: #94a3b8; }
.field__input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}
.field.is-invalid .field__input { border-color: var(--c-danger); }
.field.is-invalid .field__input:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15); }

.field__error { color: var(--c-danger); font-size: 0.82rem; line-height: 1.4; }
.field__error:empty { display: none; }
.field__error--top:not(:empty) {
    background: var(--c-danger-soft);
    border-radius: 8px;
    padding: 10px 12px;
    border-left: 3px solid var(--c-danger);
    font-weight: 600;
}

.field__eye {
    position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
    width: 36px; height: 36px;
    border: none; background: transparent; color: #64748b;
    border-radius: 8px; cursor: pointer;
    transition: color .15s, background .15s;
    display: block;
}
.field__eye:hover { color: #1e3a8a; background: rgba(15, 23, 42, .04); }
.field__eye-icon {
    position: absolute; top: 50%; left: 50%;
    width: 20px; height: 20px;
    transform: translate(-50%, -50%);
    transition: opacity .18s ease;
    pointer-events: none;
}
.field__eye-icon--show { opacity: 1; }
.field__eye-icon--hide { opacity: 0; }
.field__control.is-revealed .field__eye-icon--show { opacity: 0; }
.field__control.is-revealed .field__eye-icon--hide { opacity: 1; }

.auth-form__forgot { text-align: right; margin: -4px 0 0; }
.auth-form__link {
    background: none; border: none; padding: 0;
    color: #1e3a8a;
    font-weight: 700; font-size: 0.88rem;
    cursor: pointer;
    border-bottom: 1px dashed rgba(30, 58, 138, 0.4);
    text-decoration: none;
    font-family: inherit;
}
.auth-form__link:hover { color: #2563eb; border-bottom-color: #2563eb; }

.auth-form__submit {
    width: 100%;
    padding: 14px 18px;
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: #ffffff;
    border: none; border-radius: 12px;
    font-weight: 700; font-size: 1rem;
    letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, opacity .15s;
    box-shadow: 0 8px 22px -8px rgba(30, 58, 138, .55);
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 8px;
    font-family: inherit;
}
.auth-form__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -10px rgba(30, 58, 138, .6);
}
.auth-form__submit:disabled {
    opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none;
}
.auth-form__spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 314px) {
    .field__control .field__input { padding-right: 32px; }
    .field__eye { width: 32px; height: 32px; right: 4px; }
    .field__eye-icon { width: 16px; height: 16px; }
}
