:root {
    --ink: #111111;
    --muted: #71717a;
    --line: #e4e4e7;
    --blue: #3b82f6;
    --blue-2: #2563eb;
    --card: #ffffff;
    --page: #f9f9fb;
    --input: #f4f4f5;
    --mark: #141416;
    --mark-ink: #ffffff;
    --chip: #ffffff;
    --shadow: 0 24px 60px rgba(17, 17, 17, 0.08);
    --glow-a: rgba(59, 130, 246, 0.16);
    --glow-b: rgba(16, 185, 129, 0.12);
}
body[data-theme="dark"] {
    --ink: #f4f4f5;
    --muted: #a1a1aa;
    --line: #27272a;
    --card: #202022;
    --page: #0d0d0f;
    --input: #27272a;
    --mark: #f4f4f5;
    --mark-ink: #111111;
    --chip: #202022;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    --glow-a: rgba(59, 130, 246, 0.22);
    --glow-b: rgba(16, 185, 129, 0.12);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, sans-serif;
    color: var(--ink);
    background: var(--page);
}
.auth-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 28px;
}
.auth-langs, .auth-tools { display: flex; align-items: center; gap: 10px; }
.lang-selector { position: relative; }
.lang-btn { height: 40px; padding: 0 12px; border-radius: 20px; background: var(--input); border: 1px solid var(--line); display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 600; font-family: inherit; }
.lang-btn:hover { background: var(--line); }
.lang-flag { font-size: 14px; line-height: 1; }
.lang-dropdown { position: absolute; top: calc(100% + 8px); left: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px; min-width: 180px; box-shadow: var(--shadow); display: none; flex-direction: column; gap: 2px; z-index: 20; }
.lang-dropdown.open { display: flex; }
.lang-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--ink); text-decoration: none; }
.lang-option.active { background: var(--input); font-weight: 600; }
.lang-option svg { color: var(--blue); }
.auth-country { height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip); color: var(--muted); font-size: 13px; font-weight: 700; }
.theme-toggle { width: 40px; height: 40px; border-radius: 50%; justify-content: center; padding: 0; cursor: pointer; background: var(--input); border: 1px solid var(--line); color: var(--ink); display: inline-flex; align-items: center; }
.theme-toggle .icon-moon { display: none; }
body[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
body[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 108px 20px 40px;
    background:
        radial-gradient(720px 320px at 12% 0%, var(--glow-a), transparent 60%),
        radial-gradient(640px 280px at 100% 100%, var(--glow-b), transparent 55%);
}
.auth-card {
    width: min(440px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 30px;
    padding: 32px 28px 26px;
    box-shadow: var(--shadow);
}
.auth-brand { display: flex; gap: 14px; align-items: center; }
.auth-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--mark);
    color: var(--mark-ink);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.04em;
}
.auth-brand strong { display: block; font-size: 16px; letter-spacing: -0.03em; }
.auth-brand span { color: var(--muted); font-size: 13px; font-weight: 600; }
h1 { margin: 22px 0 0; font-size: 34px; line-height: 1.1; letter-spacing: -0.045em; }
.auth-sub { margin: 10px 0 22px; color: var(--muted); font-weight: 600; line-height: 1.45; }
.auth-error { background: #fef2f2; color: #b91c1c; border-radius: 16px; padding: 12px 14px; font-weight: 700; margin-bottom: 14px; }
body[data-theme="dark"] .auth-error { background: #3f1d1d; color: #fecaca; }
form { display: flex; flex-direction: column; gap: 14px; }
label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
input, select {
    width: 100%;
    height: 52px;
    border: 1px solid transparent;
    background: var(--input);
    color: var(--ink);
    border-radius: 16px;
    padding: 0 16px;
    font: inherit;
    font-weight: 600;
    outline: none;
}
input:focus, select:focus { border-color: var(--blue); background: var(--card); }
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--input) inset;
    -webkit-text-fill-color: var(--ink);
    caret-color: var(--ink);
}
button[type=submit] {
    height: 52px;
    margin-top: 4px;
    border: 0;
    border-radius: 16px;
    background: var(--blue);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
button[type=submit]:hover { background: var(--blue-2); }
button[disabled] { opacity: .65; cursor: wait; }
.auth-remember { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 700; color: var(--ink); }
.auth-remember input { width: 18px; height: 18px; padding: 0; border-radius: 6px; }
.session-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.session-row form { margin: 0; }
.session-row button { height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 800; cursor: pointer; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.auth-links a { color: var(--blue-2); font-weight: 800; font-size: 14px; text-decoration: none; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.iti { width: 100%; display: block; }
.iti__flag-container { height: 52px; }
.iti--separate-dial-code .iti__selected-flag { background: transparent; border-radius: 16px 0 0 16px; padding-left: 12px; }
.iti__country-list { border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.iti__country.iti__highlight { background: var(--input); }
.iti__dial-code, .iti__country-name { color: inherit; }
body[data-theme="dark"] .iti__arrow { border-top-color: var(--muted); }
.sent-to { margin: 0 0 16px; color: var(--muted); font-weight: 650; }
.sent-to strong { color: var(--ink); }
.text-btn {
    margin-top: 14px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--blue-2);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.alt-dialog {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 17, 17, 0.46);
}
.alt-dialog[hidden] { display: none; }
.alt-window {
    width: min(460px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--card);
    color: var(--ink);
    border-radius: 30px;
    box-shadow: var(--shadow);
    padding: 28px 26px 24px;
}
.alt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.alt-window h2 { margin: 0; font-size: 24px; letter-spacing: -0.04em; }
.alt-window p { color: var(--muted); line-height: 1.45; }
.alt-x {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: var(--input);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.alt-left { font-weight: 800; color: var(--ink) !important; }
.alt-ok { background: #ecfdf3; color: #047857; border-radius: 16px; padding: 12px 14px; font-weight: 800; }
#alt-code { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
#alt-code[hidden] { display: none; }
body[data-theme="dark"] .alt-ok { background: #052e22; color: #a7f3d0; }
.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 18px; }
.channel-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 96px;
    padding: 14px 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.channel-card.is-on { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }
.channel-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
}
.channel-icon svg { width: 24px; height: 24px; }
.channel-sms { background: #e8eefc; color: #2563eb; }
.channel-whatsapp { background: #e7f8ef; color: #16a34a; }
.channel-telegram { background: #e7f4fd; color: #229ed9; }
.alt-actions { display: flex; justify-content: flex-end; gap: 10px; }
.alt-actions button, #send-alt {
    height: 48px;
    padding: 0 16px;
    border-radius: 16px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.alt-actions .ghost { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
#send-alt { border: 0; background: var(--blue); color: #fff; }
#send-alt:hover { background: var(--blue-2); }
#send-alt:disabled, .alt-actions button:disabled { opacity: .65; cursor: wait; }
@media (max-width: 576px) {
    .auth-top { padding: 16px; }
    h1 { font-size: 28px; }
    .auth-card { padding: 24px 18px; }
    .auth-links, .auth-langs { flex-wrap: wrap; }
}
