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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 500px;
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #5a67d8;
}

.error {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 5px;
    margin-top: 20px;
    text-align: center;
}

.success {
    background: #efe;
    color: #3c3;
    padding: 10px;
    border-radius: 5px;
    margin-top: 20px;
    text-align: center;
}

a {
    color: #667eea;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

header button {
    width: auto;
    padding: 8px 16px;
}

.user-info {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.user-info h2 {
    color: #333;
    margin-bottom: 15px;
}

.websocket-info {
    background: #f0f4ff;
    padding: 20px;
    border-radius: 5px;
}

.websocket-info h2 {
    color: #333;
    margin-bottom: 15px;
}

#wsStatus {
    margin-bottom: 10px;
    font-weight: 500;
}

#wsStatus.connected {
    color: #3c3;
}

#wsStatus.disconnected {
    color: #c33;
}

#wsMessages {
    max-height: 200px;
    overflow-y: auto;
    background: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
}

.ws-message {
    padding: 5px;
    border-bottom: 1px solid #eee;
}

.ws-message:last-child {
    border-bottom: none;
}

.message-time {
    color: #999;
    font-size: 0.8em;
    margin-right: 10px;
}

.message-data {
    color: #333;
}

/* Современная страница входа */
.login-page {
    display: block;
    min-height: 100vh;
    padding: 24px;
    color: #0f172a;
    background:
        radial-gradient(circle at 8% 8%, rgba(45, 212, 191, 0.15), transparent 28%),
        radial-gradient(circle at 92% 92%, rgba(59, 130, 246, 0.14), transparent 30%),
        #eaf1f7;
}

.login-shell {
    display: grid;
    width: min(1120px, 100%);
    min-height: calc(100vh - 48px);
    margin: 0 auto;
    overflow: hidden;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(15, 39, 66, 0.15);
}

.login-promo {
    position: relative;
    display: flex;
    min-height: 640px;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    overflow: hidden;
    color: #f8fafc;
    background: linear-gradient(145deg, #082f49 0%, #0b4f65 48%, #0f766e 100%);
}

.login-promo::before,
.login-promo::after {
    position: absolute;
    content: "";
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.login-promo::before { right: -160px; bottom: -170px; width: 460px; height: 460px; }
.login-promo::after { right: -45px; bottom: -55px; width: 230px; height: 230px; }

.login-brand,
.login-system-state {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
}

.login-brand { gap: 12px; font-size: 18px; font-weight: 750; letter-spacing: -0.02em; }
.login-brand__mark { display: grid; width: 42px; height: 42px; color: #083344; background: #5eead4; border-radius: 13px; place-items: center; }
.login-brand__mark svg { width: 23px; fill: currentColor; }

.login-promo__content { position: relative; z-index: 1; max-width: 510px; }
.login-eyebrow { margin: 0 0 12px; color: #0f9487; font-size: 11px; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; }
.login-promo .login-eyebrow { color: #5eead4; }
.login-promo h1 { margin: 0 0 22px; color: #fff; font-size: clamp(34px, 4.2vw, 55px); line-height: 1.06; text-align: left; letter-spacing: -0.045em; }
.login-promo__content > p:last-child { max-width: 470px; color: #cbd5e1; font-size: 16px; line-height: 1.7; }
.login-system-state { z-index: 1; gap: 9px; color: #ccfbf1; font-size: 12px; font-weight: 650; }
.login-system-state span { width: 8px; height: 8px; background: #34d399; border-radius: 50%; box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.13); }

.login-panel { display: grid; padding: clamp(35px, 6vw, 78px); background: rgba(255, 255, 255, 0.96); place-items: center; }
.login-form-wrap { width: min(100%, 390px); }
.login-heading { margin-bottom: 32px; }
.login-heading h2 { margin: 0 0 10px; color: #0f172a; font-size: 32px; letter-spacing: -0.035em; }
.login-heading > p:last-child { color: #64748b; font-size: 14px; line-height: 1.6; }
.login-form { display: grid; gap: 21px; }
.login-field label { margin-bottom: 8px; color: #334155; font-size: 13px; font-weight: 700; }
.login-input-wrap { position: relative; }
.login-input-wrap > svg { position: absolute; top: 50%; left: 15px; width: 19px; fill: none; stroke: #94a3b8; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; transform: translateY(-50%); pointer-events: none; }
.login-input-wrap input { height: 52px; padding: 0 90px 0 46px; color: #0f172a; font-size: 14px; background: #f8fafc; border: 1px solid #dbe4ee; border-radius: 12px; transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.login-input-wrap input::placeholder { color: #94a3b8; }
.login-input-wrap input:focus { background: #fff; border-color: #14b8a6; box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12); }
.password-toggle { position: absolute; top: 50%; right: 9px; width: auto; padding: 7px 8px; color: #0f766e; font-size: 11px; background: transparent; border: 0; transform: translateY(-50%); }
.password-toggle:hover { color: #115e59; background: #e6fffb; }

.login-submit { position: relative; display: flex; height: 52px; align-items: center; justify-content: center; margin-top: 3px; background: linear-gradient(135deg, #0f9487, #087b82); border: 0; border-radius: 12px; box-shadow: 0 10px 24px rgba(15, 148, 135, 0.22); transition: box-shadow 150ms ease, transform 150ms ease, opacity 150ms ease; }
.login-submit:hover { background: linear-gradient(135deg, #0d887c, #076e75); box-shadow: 0 13px 28px rgba(15, 148, 135, 0.28); transform: translateY(-1px); }
.login-submit:disabled { cursor: wait; opacity: 0.72; transform: none; }
.login-submit__spinner { display: none; width: 19px; height: 19px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: login-spin .7s linear infinite; }
.login-submit.is-loading .login-submit__text { display: none; }
.login-submit.is-loading .login-submit__spinner { display: block; }
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-error { margin: -12px 0 20px; padding: 12px 14px; color: #b91c1c; font-size: 13px; line-height: 1.45; text-align: left; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; }
.login-register { margin-top: 26px; color: #64748b; font-size: 13px; text-align: center; }
.login-register a { color: #0f766e; font-weight: 750; }

@media (max-width: 820px) {
    .login-page { padding: 0; background: #fff; }
    .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; }
    .login-promo { min-height: auto; padding: 28px; }
    .login-promo__content { margin: 70px 0 55px; }
    .login-promo h1 { max-width: 600px; font-size: clamp(31px, 8vw, 45px); }
    .login-panel { padding: 50px 24px 60px; }
}

@media (max-width: 480px) {
    .login-promo { padding: 22px; }
    .login-promo__content { margin: 55px 0 42px; }
    .login-promo__content > p:last-child { font-size: 14px; }
    .login-panel { padding: 40px 20px 50px; }
    .login-heading h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-page *, .login-page *::before, .login-page *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Регистрация */
.register-shell { grid-template-columns: minmax(330px, 0.8fr) minmax(520px, 1.2fr); }
.register-shell .login-promo { min-height: 720px; }
.register-panel { padding: 44px clamp(38px, 5vw, 68px); }
.register-form-wrap { width: min(100%, 610px); }
.register-heading { margin-bottom: 24px; }
.register-form { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 17px; }
.register-field--full { grid-column: 1 / -1; }
.register-form .login-field label { display: flex; justify-content: space-between; }
.register-form .login-field label span { color: #94a3b8; font-size: 10px; font-weight: 500; }
.register-input--plain { padding-left: 15px !important; padding-right: 15px !important; }
.register-submit { margin-top: 4px; }

.register-benefits {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    color: #d5f5f0;
    font-size: 12px;
    font-weight: 600;
}

.register-benefits span { display: flex; align-items: center; gap: 9px; }
.register-benefits i { display: grid; width: 21px; height: 21px; color: #064e3b; font-size: 11px; font-style: normal; background: #6ee7b7; border-radius: 50%; place-items: center; }
.register-success { margin: -8px 0 18px; padding: 12px 14px; color: #047857; font-size: 13px; line-height: 1.45; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 10px; }

@media (max-width: 900px) {
    .register-shell { grid-template-columns: 1fr; }
    .register-shell .login-promo { min-height: auto; }
    .register-panel { padding: 50px 24px 60px; }
}

@media (max-width: 580px) {
    .register-form { grid-template-columns: 1fr; }
    .register-field--full { grid-column: auto; }
    .register-panel { padding: 40px 20px 50px; }
}
