:root {
    /* Тот же фирменный градиент, что и в chat.css — страница логина
       не подключает chat.css, поэтому переменная продублирована здесь
       намеренно (единственное разумное место, раз стили не общие). */
    --accent-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #e8edf6 0%, #dbe4f2 45%, #c3d5ec 100%);
}

.bg-glow {
    position: fixed;
    inset: -25%;
    z-index: 0;
    pointer-events: none;
}

.bg-glow::before,
.bg-glow::after {
    content: '';
    position: absolute;
    inset: 0;
}

.bg-glow::before {
    background:
        radial-gradient(38% 32% at 18% 22%, rgba(59, 130, 246, 0.42) 0%, transparent 100%),
        radial-gradient(34% 30% at 82% 18%, rgba(255, 255, 255, 0.55) 0%, transparent 100%),
        radial-gradient(40% 34% at 78% 82%, rgba(37, 99, 235, 0.4) 0%, transparent 100%),
        radial-gradient(32% 28% at 15% 80%, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
    filter: blur(10px);
    animation: drift-a 16s ease-in-out infinite;
}

.bg-glow::after {
    background:
        radial-gradient(30% 26% at 55% 45%, rgba(255, 255, 255, 0.4) 0%, transparent 100%),
        radial-gradient(26% 22% at 90% 55%, rgba(37, 99, 235, 0.3) 0%, transparent 100%);
    animation: drift-b 22s ease-in-out infinite;
}

@keyframes drift-a {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    25% { transform: translate(5%, -4%) scale(1.15) rotate(8deg); }
    50% { transform: translate(2%, 5%) scale(1.05) rotate(-4deg); }
    75% { transform: translate(-5%, 2%) scale(1.12) rotate(-9deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

@keyframes drift-b {
    0% { transform: translate(0, 0) scale(1.1) rotate(0deg); }
    25% { transform: translate(-6%, 3%) scale(0.95) rotate(-8deg); }
    50% { transform: translate(-2%, -5%) scale(1.08) rotate(6deg); }
    75% { transform: translate(4%, 4%) scale(1) rotate(10deg); }
    100% { transform: translate(0, 0) scale(1.1) rotate(0deg); }
}

.card {
    position: relative;
    z-index: 1;
    background: #ffffff;
    padding: 40px 36px 32px;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(30, 58, 95, 0.14), 0 2px 8px rgba(30, 58, 95, 0.06);
    width: 100%;
    max-width: 380px;
    text-align: center;
    animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    border-radius: 16px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
    transition: transform 0.25s ease;
}

.card:hover .logo {
    transform: scale(1.05) rotate(-2deg);
}

.logo svg {
    width: 30px;
    height: 30px;
}

h1 {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 28px;
}

form {
    text-align: left;
}

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

.field {
    position: relative;
    margin-bottom: 18px;
}

.field input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e2e6ec;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
    color: #b0b7c3;
}

.field input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.15);
}

.field input:hover:not(:focus) {
    border-color: #c7ceda;
}

#password {
    padding-right: 44px;
}

.toggle-visibility {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #9aa3b2;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.toggle-visibility:hover {
    color: #4b5563;
    background: #f3f4f6;
}

.toggle-visibility svg {
    width: 19px;
    height: 19px;
    position: absolute;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.toggle-visibility .icon-eye-off {
    opacity: 0;
    transform: scale(0.8);
}

.toggle-visibility .icon-eye {
    opacity: 1;
    transform: scale(1);
}

.toggle-visibility.is-visible .icon-eye {
    opacity: 0;
    transform: scale(0.8);
}

.toggle-visibility.is-visible .icon-eye-off {
    opacity: 1;
    transform: scale(1);
}

.submit-btn {
    position: relative;
    width: 100%;
    padding: 13px;
    margin-top: 8px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.submit-btn:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.38);
}

.submit-btn:active {
    transform: scale(0.98);
}

.submit-btn .btn-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 17px;
    height: 17px;
    margin: -8.5px 0 0 -8.5px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.submit-btn.is-loading .btn-spinner {
    display: block;
}

.submit-btn:disabled {
    cursor: default;
}

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

.error {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    text-align: center;
    margin-top: 18px;
    padding: 10px;
    font-size: 13.5px;
    line-height: 1.4;
    animation: shake 0.35s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
