:root {
    --bg: #020617;
    --bg-alt: #020617;
    --surface: #020617;
    --card-bg: #020617;
    --accent: #ef4444;
    --accent-soft: rgba(239, 68, 68, 0.14);
    --accent-strong: rgba(239, 68, 68, 0.4);
    --border-subtle: rgba(148, 163, 184, 0.22);
    --text-head: #111827;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
}

body.app-body.theme-dark,
body.app-body:not(.theme-light):not(.theme-dark) {
    --bg: #020617;
    --bg-alt: #020617;
    --surface: #020617;
    --card-bg: #020617;
    --text-head: #111827;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --border-subtle: rgba(148, 163, 184, 0.22);
}

body.app-body.theme-light {
    --bg: #f9fafb;
    --bg-alt: #ffffff;
    --surface: #f9fafb;
    --card-bg: #ffffff;
    --text-head: #111827;
    --text-main: #374151;
    --text-muted: #6b7280;
    --border-subtle: rgba(209, 213, 219, 1);
}

* {
    box-sizing: border-box;
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 1));
    color: var(--text-main);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
}

/* Theme toggle */
.theme-toggle-wrapper {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    position: relative;
    width: 56px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    cursor: pointer;
    color: #e5e7eb;
    font-size: 10px;
}

.theme-toggle__thumb {
    position: absolute;
    top: 3px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 55%), linear-gradient(135deg, #facc15, #f97316);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.9);
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle__icon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.theme-toggle__icon--moon::before { content: "🌙"; }
.theme-toggle__icon--sun::before { content: "☀"; }

body.app-body.theme-dark .theme-toggle__icon--moon,
body.app-body:not(.theme-light):not(.theme-dark) .theme-toggle__icon--moon { opacity: 1; }

body.app-body.theme-dark .theme-toggle__icon--sun,
body.app-body:not(.theme-light):not(.theme-dark) .theme-toggle__icon--sun { opacity: 0; }

body.app-body.theme-light .theme-toggle__thumb {
    transform: translateX(22px);
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 55%),
                linear-gradient(135deg, #facc15, #f97316);
}

body.app-body.theme-light .theme-toggle__icon--sun { opacity: 1; }
body.app-body.theme-light .theme-toggle__icon--moon { opacity: 0; }

/* Language switcher */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-switcher__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: radial-gradient(circle at top left, rgba(248, 113, 113, 0.3), transparent 55%),
                radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.3), transparent 55%),
                rgba(15, 23, 42, 0.98);
    color: var(--text-main);
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.9);
}

body.app-body.theme-light .lang-switcher__button {
    background: radial-gradient(circle at top left, rgba(248, 113, 113, 0.08), transparent 55%),
                radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.08), transparent 55%),
                #ffffff;
    color: #111827;
}

.lang-switcher__current {
    font-weight: 600;
    letter-spacing: 0.06em;
}

.lang-switcher__chevron {
    font-size: 10px;
    opacity: 0.85;
}

.lang-switcher__menu {
    position: absolute;
    right: 0;
    margin-top: 6px;
    min-width: 150px;
    padding: 6px 4px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.5);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
    display: none;
    z-index: 60;
}

body.app-body.theme-light .lang-switcher__menu { background: #ffffff; }

.lang-switcher.is-open .lang-switcher__menu { display: block; }

.lang-switcher__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-main) !important;
    text-decoration: none !important;
    gap: 8px;
}

.lang-switcher__item:hover { background: rgba(248, 113, 113, 0.24); }

.lang-switcher__item-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.lang-switcher__item-code {
    font-weight: 600;
    letter-spacing: 0.06em;
    font-size: 11px;
}

.lang-switcher__item-name {
    font-size: 11px;
    opacity: 0.8;
}

.lang-switcher__item-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316, #ef4444);
}

/* Auth */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}

.auth-card {
    width: 100%;
    max-width: 760px;
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 26px 26px 22px;
    box-shadow: 0 32px 60px rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-subtle);
}

.auth-card--split {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 22px;
}

.auth-info { padding-right: 6px; }

.auth-form-col {
    padding-left: 26px;
    border-left: 1px solid var(--border-subtle);
}

.auth-brand {
    font-size: 12px;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.auth-title {
    margin: 0 0 4px;
    font-size: 24px;
    letter-spacing: -0.03em;
}

.auth-subtitle {
    margin: 4px 0 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.auth-meta-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-meta-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.auth-meta-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316, #ef4444);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.8);
}

.auth-panel-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
}

@media (max-width: 800px) {
    .auth-card--split { grid-template-columns: minmax(0, 1fr); }

    .auth-form-col {
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        padding-left: 0;
        padding-top: 16px;
        margin-top: 8px;
    }
}

.auth-alert {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.5);
    color: #fecaca;
    font-size: 13px;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 18px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    font-size: 14px;
}

body.app-body.theme-light .form-group input {
    background: #fefefe;
    color: #111827;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}

.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: none;
    padding: 10px 16px;
    background: linear-gradient(90deg, #f97316, #ef4444);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(87, 87, 87, 0.8);
}

.btn-primary:hover { filter: brightness(1.05); }
