:root {
    --ink: #231e25;
    --ink-2: #55556a;
    --muted: #87808d;
    --line: #e8e8ef;
    --line-2: #dcd6e3;
    --bg: #ffffff;
    --field: #ffffff;
    --primary: var(--bzq-accent, #8B33FF);
    --primary-dark: var(--bzq-accent-2, #5A00CC);
    --danger: #c8103f;
    --success: #007a56;
    --night: #2b0b53;
}

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

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "DM Sans", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
}

[hidden] {
    display: none !important;
}

.auth {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    min-height: 100vh;
}

.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 48px 56px;
    overflow: hidden;
    background: linear-gradient(155deg, #2b0b53 0%, #4a0fa8 55%, #7b2ff7 100%);
    color: #ffffff;
}

.auth-brand::after {
    content: "";
    position: absolute;
    right: -160px;
    bottom: -160px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle,
            rgba(240, 66, 130, 0.45) 0%,
            rgba(240, 66, 130, 0) 70%);
    pointer-events: none;
}

.auth-brand img {
    height: 40px;
    width: auto;
    align-self: flex-start;
}

.auth-brand-body {
    margin: auto 0;
    max-width: 440px;
}

.auth-brand h1 {
    margin: 0 0 28px;
    font-size: 36px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.auth-brand ul {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-brand li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.auth-brand li i {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    font-size: 12px;
    color: #7cf0c5;
}

.auth-brand small {
    position: relative;
    z-index: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.auth-main {
    display: flex;
    flex-direction: column;
    padding: 32px 48px;
}

.auth-top {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    font-size: 14px;
    color: var(--ink-2);
}

.auth-top form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.auth-top button {
    padding: 8px 18px;
    border: 1px solid var(--line-2);
    border-radius: 50px;
    background: #ffffff;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.auth-top button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.auth-top a {
    padding: 8px 18px;
    border: 1px solid var(--line-2);
    border-radius: 50px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}

.auth-top a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 40px 0;
}

.auth-card h2 {
    margin: 0 0 6px;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--night);
}

.auth-card .auth-lead {
    margin: 0 0 32px;
    color: var(--ink-2);
}

.auth-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
}

.auth-alert i {
    margin-top: 3px;
}

.auth-alert.is-error {
    background: #ffedf1;
    color: var(--danger);
}

.auth-alert.is-success {
    background: #e6f7f1;
    color: var(--success);
}

.field {
    margin-bottom: 18px;
}

.field-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.field-head label {
    margin: 0;
}

.field-head a {
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.field-head a:hover {
    text-decoration: underline;
}

.input-wrap {
    position: relative;
}

.input-wrap>i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 16px 0 44px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: var(--field);
    font: inherit;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input.no-icon {
    padding-left: 16px;
}

.input.has-toggle {
    padding-right: 48px;
}

.input::placeholder {
    color: #a097a7;
}

.input:hover {
    border-color: #c7b3f5;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(var(--bzq-accent-rgb, 139 51 255) / 0.12);
}

.input.is-invalid,
.has-error .input {
    border-color: var(--danger);
}

.input.is-valid {
    border-color: #00a574;
}

.field-error {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--danger);
}

.toggle-password {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.toggle-password:hover {
    color: var(--primary);
}

.rules {
    display: grid;
    gap: 4px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    color: var(--muted);
}

.rules li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rules li i {
    width: 14px;
    font-size: 12px;
}

.rules li.is-ok {
    color: var(--success);
}

.strength {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}

.strength span {
    flex: 1;
    height: 4px;
    border-radius: 50px;
    background: var(--line);
    transition: background 0.2s;
}

.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    margin-top: 8px;
    border: 0;
    border-radius: 50px;
    background: var(--primary);
    font: inherit;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-submit:not(:disabled):hover {
    background: var(--primary-dark);
}

.btn-submit:disabled {
    background: var(--line);
    color: #a097a7;
    cursor: not-allowed;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    margin-top: 10px;
    border: 1px solid var(--line-2);
    border-radius: 50px;
    background: #ffffff;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:not(:disabled):hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-secondary:disabled {
    color: #a097a7;
    cursor: not-allowed;
}

a.btn-submit {
    text-decoration: none;
}

.auth-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    border-radius: 18px;
    background: #f2ecff;
    font-size: 26px;
    color: var(--primary);
}

.auth-icon.is-success {
    background: #e6f7f1;
    color: var(--success);
}

.auth-icon.is-error {
    background: #ffedf1;
    color: var(--danger);
}

.auth-lead b {
    color: var(--ink);
    word-break: break-all;
}

.auth-note {
    margin: 18px 0 0;
    font-size: 13px;
    text-align: center;
    color: var(--muted);
}

.auth-note button,
.auth-note a {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.auth-note button:disabled {
    color: var(--muted);
    cursor: default;
}

.code-input {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.code-input input {
    width: 100%;
    height: 56px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: var(--field);
    font: inherit;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.code-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(var(--bzq-accent-rgb, 139 51 255) / 0.12);
}

.code-input.is-invalid input {
    border-color: var(--danger);
}

.auth-msg {
    margin: 8px 0 0;
    font-size: 13px;
}

.auth-msg.is-error {
    color: var(--danger);
}

.auth-msg.is-success {
    color: var(--success);
}

.method-list {
    display: grid;
    gap: 10px;
}

.method {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #ffffff;
    font: inherit;
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.method:hover {
    border-color: #c7b3f5;
    box-shadow: 0 6px 20px rgb(var(--bzq-accent-rgb, 139 51 255) / 0.08);
}

.method>span:first-child {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f2ecff;
    font-size: 18px;
    color: var(--primary);
}

.method img {
    width: 26px;
    height: 26px;
}

.method b {
    flex: 1;
    font-weight: 600;
}

.method>i {
    color: var(--muted);
}

.auth-loading {
    display: flex;
    justify-content: center;
    margin-top: 8px;
    font-size: 28px;
    color: var(--primary);
}

.auth-switch {
    margin: 24px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--ink-2);
}

.auth-switch a {
    font-weight: 600;
}

.auth-terms {
    margin: 16px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.auth-terms a {
    color: inherit;
}

.auth-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    font-size: 13px;
}

.auth-foot a {
    color: var(--muted);
    text-decoration: none;
}

.auth-foot a:hover,
.auth-foot a.is-current {
    color: var(--primary);
}

.auth-foot a.is-current {
    font-weight: 600;
}

@media (max-width: 960px) {
    .auth {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-brand {
        padding: 24px;
    }

    .auth-brand::after,
    .auth-brand-body,
    .auth-brand small {
        display: none;
    }

    .auth-brand img {
        height: 30px;
    }

    .auth-main {
        padding: 16px 20px 28px;
    }

    .auth-card {
        padding: 24px 0;
    }

    .auth-card h2 {
        font-size: 26px;
    }
}

.pub {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px 16px;
    background: #f6f5fa;
}

.pub-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(43, 11, 83, 0.06);
}

.pub-card.is-wide {
    max-width: 760px;
}

.pub-card h2 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--night);
}

.pub-card .auth-lead {
    margin: 0 0 24px;
    color: var(--ink-2);
}

.pub-card .auth-icon {
    margin-bottom: 20px;
}

.pub-foot {
    font-size: 12px;
    color: var(--muted);
}

.pub-logo-mark {
    display: inline-block;
    width: 52px;
    height: 20px;
    margin-left: 6px;
    vertical-align: -5px;
}

.pub-logo,
.pub-logo-mark {
    background: linear-gradient(135deg, var(--bzq-accent-2, #5A00CC), #7b2ff7);
    -webkit-mask: var(--pub-logo) no-repeat left center / contain;
    mask: var(--pub-logo) no-repeat left center / contain;
}

.pub-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pub-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.pub-option:hover {
    border-color: #c7b3f5;
}

.pub-option:has(input:checked) {
    border-color: var(--primary);
    background: #f7f2ff;
}

.pub-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.pub-textarea {
    display: block;
    width: 100%;
    min-height: 96px;
    margin-top: 10px;
    padding: 12px 16px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    font: inherit;
    color: var(--ink);
    resize: vertical;
}

.pub-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(var(--bzq-accent-rgb, 139 51 255) / 0.12);
}

.pub-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.pub-status-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.pub-status-text .fa-check-circle {
    color: var(--success);
}

.pub-status-text .fa-times-circle {
    color: var(--danger);
}

.pub-switch {
    position: relative;
    flex: none;
    width: 48px;
    height: 28px;
    border-radius: 28px;
    background: #dcd6e3;
    cursor: pointer;
    transition: background 0.2s;
}

.pub-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.pub-switch.btn-success {
    background: var(--primary);
}

.pub-switch.btn-success::after {
    transform: translateX(20px);
}

.pub-switch input,
.pub-switch .toggle-group {
    display: none;
}

@media (max-width: 560px) {
    .pub-card {
        padding: 24px 20px;
    }
}

.pub-logo {
    position: absolute;
    top: 32px;
    left: 40px;
    width: 96px;
    height: 36px;
}

.err {
    width: 100%;
    max-width: 560px;
    text-align: center;
}

.err-code {
    margin-bottom: 8px;
    font-size: 128px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #2b0b53 0%, var(--bzq-accent, #8B33FF) 55%, #9b5cff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.err .auth-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 24px;
    font-size: 32px;
}

.err h1 {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--night);
}

.err p {
    margin: 0 auto 28px;
    max-width: 460px;
    color: var(--ink-2);
}

.err-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.err-actions form {
    margin: 0;
}

.err-actions .btn-submit,
.err-actions .btn-secondary {
    width: auto;
    min-width: 180px;
    margin: 0;
    padding: 0 28px;
}

.err .auth-switch {
    margin-top: 28px;
}

@media (max-width: 560px) {
    .pub-logo {
        position: static;
        align-self: flex-start;
    }

    .err-code {
        font-size: 96px;
    }

    .err h1 {
        font-size: 24px;
    }

    .err-actions .btn-submit,
    .err-actions .btn-secondary {
        width: 100%;
    }
}

select.input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2387808D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

.auth-services {
    margin-top: 10px;
    font-size: 14px;
    color: var(--ink-2);
}

.auth-loading {
    position: absolute;
    right: 14px;
    top: 50%;
    width: 24px;
    height: 24px;
    transform: translateY(-50%);
    display: none;
}

.auth-loading svg {
    width: 24px;
    height: 24px;
}

.auth-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff5eb;
    font-size: 14px;
    color: #9a4d00;
}

.auth-warning svg {
    flex: none;
}

.auth-warning label {
    margin: 0;
}

body.pub-dark {
    --ink: #e8e8ef;
    --ink-2: #b9b4c4;
    --muted: #8f889b;
    --line: #2e2a3a;
    --line-2: #3a3548;
    --bg: #14111c;
    --night: #f2ecff;
    --primary: #9b5cff;
    --primary-dark: #b488ff;
    --danger: #ff6b8b;
    --success: #3ddc97;
    color-scheme: dark;
}

body.pub-dark .pub {
    background: #14111c;
}

body.pub-dark .pub-card {
    background: #1c1827;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

body.pub-dark .pub-logo,
body.pub-dark .pub-logo-mark {
    background: linear-gradient(135deg, #b488ff, #e4d4ff);
}

body.pub-dark .err-code {
    background: linear-gradient(135deg, #e4d4ff 0%, #9b5cff 55%, #6a2fd0 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

body.pub-dark .auth-icon {
    background: rgba(155, 92, 255, 0.16);
}

body.pub-dark .auth-icon.is-success {
    background: rgba(61, 220, 151, 0.14);
}

body.pub-dark .auth-icon.is-error {
    background: rgba(255, 107, 139, 0.14);
}

body.pub-dark .btn-submit {
    background: #7b2ff7;
}

body.pub-dark .btn-submit:not(:disabled):hover {
    background: #9b5cff;
}

body.pub-dark .btn-secondary {
    background: transparent;
    border-color: var(--line-2);
    color: var(--ink);
}

body.pub-dark .btn-secondary:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.06);
}
body.is-hr {
    --bzq-accent: #f6772b;
    --bzq-accent-rgb: 246 119 43;
    --bzq-accent-2: #c33f18;
    --primary: #f6772b;
    --primary-dark: #c33f18;
    --night: #2a1810;
}

body.is-hr .auth-brand {
    background: linear-gradient(155deg, #5a1e08 0%, #c33f18 55%, #f6772b 100%);
}

body.is-hr .auth-brand::after {
    background: radial-gradient(circle,
            rgba(255, 181, 71, 0.45) 0%,
            rgba(255, 181, 71, 0) 70%);
}

body.is-hr .pub-logo,
body.is-hr .pub-logo-mark {
    background: var(--pub-logo) no-repeat left center / contain;
    -webkit-mask: none;
    mask: none;
}

body.is-hr .err-code {
    background: linear-gradient(135deg, #5a1e08 0%, #f6772b 55%, #ffb547 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

body.pub-dark.is-hr {
    --bzq-accent: #ff9a5c;
    --bzq-accent-rgb: 255 154 92;
    --bzq-accent-2: #f6772b;
    --primary: #ff9a5c;
    --primary-dark: #ffb98c;
}

body.pub-dark.is-hr .err-code {
    background: linear-gradient(135deg, #ffe2cc 0%, #ff9a5c 55%, #c33f18 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

body.pub-dark.is-hr .auth-icon {
    background: rgba(255, 154, 92, 0.16);
}

body.pub-dark.is-hr .btn-submit {
    background: #f6772b;
}

body.pub-dark.is-hr .btn-submit:not(:disabled):hover {
    background: #ff9a5c;
}

body.is-hr :is(.input:hover, .method:hover, .pub-option:hover) {
    border-color: #ffc9a8;
}

body.is-hr :is(.auth-icon, .method>span:first-child) {
    background: #fff1e8;
}

body.is-hr .pub-option:has(input:checked) {
    background: #fff6f0;
}
