:root {
    color-scheme: dark;
    --bg: #0d0f12;
    --bg-secondary: #12151a;
    --surface: #171b21;
    --surface-hover: #1c2129;
    --surface-active: #222832;
    --surface-elevated: #1b2028;
    --surface-soft: #14181e;
    --text-primary: #f6f7f9;
    --text-secondary: #b7bec8;
    --text-muted: #7f8996;
    --border: #292f39;
    --border-strong: #3a424f;
    --accent: #4191CE;
    --accent-hover: #5fa6df;
    --accent-active: #337bb5;
    --accent-soft: rgba(65, 145, 206, 0.11);
    --accent-border: rgba(65, 145, 206, 0.28);
    --text-on-accent: #ffffff;
    --success: #58c98b;
    --success-soft: rgba(88, 201, 139, 0.11);
    --warning: #f1b75b;
    --warning-soft: rgba(241, 183, 91, 0.11);
    --danger: #ee7378;
    --danger-soft: rgba(238, 115, 120, 0.10);
    --info: #7ba6ff;
    --info-soft: rgba(123, 166, 255, 0.10);
    --shadow-modal: 0 24px 70px rgba(0, 0, 0, 0.48);
    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --sidebar-width: 248px;
    --content-max: 1180px;
    --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
    --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
    --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px));
    --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px));

    /* aliases kept for existing JS/templates */
    --bg-color: var(--bg);
    --card-bg: var(--surface);
    --card-hover: var(--surface-hover);
    --card-border: var(--border);
    --text-main: var(--text-primary);
    --accent-primary: var(--accent);
    --accent-secondary: var(--accent);
    --accent-emerald: var(--success);
    --accent-red: var(--danger);
    --accent-pink: var(--danger);
    --input-bg: var(--surface-soft);
    --input-text: var(--text-primary);
    --modal-bg: var(--surface-elevated);
    --overlay-bg: rgba(6, 8, 11, 0.76);
    --item-bg: var(--surface-soft);
    --item-hover-bg: var(--surface-hover);
    --item-hover-border: var(--border-strong);
}

* {
    box-sizing: border-box;
    touch-action: manipulation;
}

html {
    min-height: 100%;
    background: var(--bg);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text-primary);
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    touch-action: manipulation;
}

button,
input,
select,
textarea {
    font: inherit;
    touch-action: manipulation;
}

@media screen and (max-width: 768px) {

    input,
    select,
    textarea,
    .ref-input,
    .admin-input,
    .admin-select {
        font-size: 16px !important;
    }
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

img,
svg {
    max-width: 100%;
}

a {
    color: inherit;
}

::selection {
    background: rgba(65, 145, 206, 0.28);
    color: var(--text-primary);
}

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 99px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

html.preloading,
body.preloading {
    overflow: hidden !important;
    height: 100vh !important;
}

html.preloading body> :not(.app-preloader) {
    opacity: 0 !important;
    visibility: hidden !important;
}

.app-preloader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    background: var(--bg);
    opacity: 1;
    visibility: visible;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.app-preloader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-logo-mask {
    width: min(42vw, 168px);
    height: 72px;
    background: var(--accent);
    -webkit-mask: url('/logo.svg') no-repeat center / contain;
    mask: url('/logo.svg') no-repeat center / contain;
    animation: preloaderPulse 900ms ease-in-out infinite alternate;
}

@keyframes preloaderPulse {
    from {
        opacity: .5;
    }

    to {
        opacity: 1;
    }
}

.ambient-glow {
    display: none;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 90;
    min-height: calc(66px + var(--safe-top));
    padding: calc(10px + var(--safe-top)) max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

html.is-twa body:not(.auth-page) .navbar {
    display: none !important;
}

html.is-twa body:not(.auth-page) .container {
    padding-top: max(16px, var(--safe-top));
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: auto;
    height: 38px;
    color: var(--text-primary);
}

.brand-logo .fil0,
.brand-logo .fil1 {
    fill: var(--text-primary) !important;
}

.navbar-meta {
    margin-left: auto;
    min-width: 0;
    text-align: right;
}

.navbar-meta-label {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.navbar-meta-value {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 12px;
}

.container {
    position: relative;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 22px max(16px, var(--safe-right)) calc(104px + var(--safe-bottom)) max(16px, var(--safe-left));
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: tabIn 160ms ease-out both;
}

@keyframes tabIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(25px, 7vw, 34px);
    line-height: 1.08;
    letter-spacing: -.035em;
    font-weight: 760;
}

.page-subtitle {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    max-width: 620px;
    overflow-wrap: anywhere;
}

#user-email-text {
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
        'balance balance'
        'days devices'
        'wl wl';
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    min-width: 0;
    min-height: 132px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: left;
    appearance: none;
    box-shadow: none;
    transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
}

button.stat-card {
    width: 100%;
    cursor: pointer;
}

button.stat-card:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

button.stat-card:active {
    transform: scale(.992);
    background: var(--surface-active);
}

.stat-card-balance {
    grid-area: balance;
    min-height: 176px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

button.stat-card-balance:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

button.stat-card-balance:active {
    background: var(--accent-active);
}

.stat-card-wl {
    grid-area: wl;
    min-height: 118px;
}

.stat-card-days {
    grid-area: days;
}

.stat-card-devices {
    grid-area: devices;
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}

.stat-card-balance .stat-label {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 750;
}

.stat-value {
    font-size: clamp(25px, 7vw, 34px);
    line-height: 1;
    letter-spacing: -.04em;
    font-weight: 770;
    font-variant-numeric: tabular-nums;
}

.stat-card-balance .stat-value {
    font-size: clamp(38px, 11vw, 54px);
    color: #ffffff;
}

.stat-sub {
    margin-top: 9px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.stat-card-balance .stat-sub {
    color: rgba(255, 255, 255, 0.88);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 18px;
}

.balance-topup-badge,
.wl-buy-badge {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.balance-topup-badge {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.wl-buy-badge {
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
}

.wl-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    vertical-align: 1px;
}

.wl-status-dot.active {
    background: var(--success);
}

.wl-status-dot.exhausted {
    background: var(--danger);
}

.referral-box,
.info-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.referral-box+.referral-box,
.info-card+.info-card {
    margin-top: 12px;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-header h2,
.section-header h3,
.referral-box h3,
.info-card h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 17px;
    line-height: 1.25;
    letter-spacing: -.02em;
    font-weight: 720;
}

.section-description {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.btn {
    min-height: 44px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-weight: 720;
    line-height: 1;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease, opacity 140ms ease;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(.985);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .52;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent) !important;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-primary:active {
    background: var(--accent-active);
    border-color: var(--accent-active);
}

.btn-secondary {
    background: var(--surface-soft);
    border-color: var(--border);
    color: var(--text-primary) !important;
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.btn-danger-outline {
    min-width: 44px;
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-danger-outline:hover {
    background: var(--danger-soft);
    border-color: rgba(238, 115, 120, .32);
    color: var(--danger);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 44px;
    padding: 0;
}

.charges-list,
.devices-list {
    display: grid;
    gap: 8px;
}

.charge-item,
.device-item {
    min-width: 0;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: background 140ms ease, border-color 140ms ease;
}

.charge-item:hover,
.device-item:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}

.charge-info,
.device-info {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}

.charge-icon,
.device-platform-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 18px;
}

.charge-icon.credit {
    color: var(--success);
    background: var(--success-soft);
    border-color: rgba(88, 201, 139, .2);
}

.charge-icon.debit {
    color: var(--text-secondary);
}

.charge-details,
.device-details {
    min-width: 0;
}

.charge-desc,
.device-name {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 680;
}

.charge-date,
.device-meta {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
}

.device-meta {
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
    overflow-wrap: anywhere;
}

.charge-amount {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 760;
    font-variant-numeric: tabular-nums;
}

.charge-amount.credit {
    color: var(--success);
}

.charge-amount.debit {
    color: var(--text-secondary);
}

.ref-link-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.ref-input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    outline: none;
    background: var(--surface-soft);
    color: var(--text-secondary);
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
    font-size: 12px;
    text-overflow: ellipsis;
}

.ref-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.link-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.platform-tabs-wrapper {
    position: relative;
    width: 100%;
    margin-top: 1rem;
}

.platform-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-soft);
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.platform-tabs::-webkit-scrollbar {
    height: 3px;
}

.platform-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.platform-tabs::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 99px;
}

.platform-tab {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.75rem 1.15rem;
    cursor: pointer;
    font-weight: 650;
    white-space: nowrap;
    transition: background 160ms ease, color 160ms ease;
    font-family: inherit;
    font-size: 0.88rem;
    flex: 1 0 auto;
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.platform-tab:last-child {
    border-right: none;
}

.platform-tab:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.platform-tab.active {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
}

.platform-content {
    display: none;
    margin-top: 1rem;
}

.platform-content.active {
    display: block;
    animation: fadeInPlatform 0.25s ease;
}

@keyframes fadeInPlatform {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.platforms-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
    width: 100%;
}

.platform-card {
    width: 100%;
    box-sizing: border-box;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.platform-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    width: 100%;
}

.platform-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.platform-info {
    min-width: 0;
    flex: 1;
}

.platform-title {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    color: var(--text-primary);
}

.platform-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.platform-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.platform-btn {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 10px;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

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

.platform-guide {
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.guide-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.step-text {
    flex: 1;
}

.guide-link {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.guide-link:hover {
    color: var(--accent-hover);
}

.guide-note {
    margin-top: 0.3rem;
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .platform-tabs {
        padding: 4px;
        gap: 4px;
        background: var(--surface-soft);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
    }

    .platform-tab {
        flex: 0 0 auto;
        min-width: 84px;
        padding: 0.65rem 0.95rem;
        font-size: 0.84rem;
        border: 1px solid transparent;
        border-radius: var(--radius-sm);
    }

    .platform-tab:last-child {
        border-right: 1px solid transparent;
    }

    .platform-tab.active {
        border-color: var(--accent);
    }

    .platforms-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
        margin-top: 0.75rem;
    }

    .platform-card {
        padding: 1rem;
    }

    .platform-card-header {
        gap: 0.65rem;
        margin-bottom: 1rem;
    }

    .platform-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 1.5rem;
    }

    .platform-title {
        font-size: 1rem;
    }

    .platform-subtitle {
        font-size: 0.8rem;
    }

    .platform-actions {
        gap: 0.45rem;
    }

    .platform-btn {
        padding: 0.65rem;
        font-size: 0.85rem;
    }
}

.empty-state {
    min-height: 150px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 24px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 28px;
}

.empty-state p {
    margin: 0;
    font-size: 13px;
}

.bonus-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-color: rgba(88, 201, 139, .2);
    background: var(--success-soft);
}

.bonus-card-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    background: rgba(88, 201, 139, .10);
    color: var(--success);
    font-size: 19px;
}

.bonus-card-copy {
    min-width: 0;
}

.bonus-card-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

#ref-bonus-balance {
    margin-top: 3px;
    color: var(--success);
    font-size: 25px;
    line-height: 1.1;
    letter-spacing: -.03em;
    font-weight: 780;
}

.ref-settings-card {
    margin-top: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.ref-settings-info {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ref-settings-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 17px;
}

.ref-settings-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 690;
}

.ref-settings-desc {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

.switch-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    flex: 0 0 auto;
    cursor: pointer;
}

.switch-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 99px;
    background: var(--surface-active);
    border: 1px solid var(--border-strong);
    transition: background 160ms ease, border-color 160ms ease;
}

.switch-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: transform 160ms ease, background 160ms ease;
}

.switch-toggle input:checked+.switch-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.switch-toggle input:checked+.switch-slider::after {
    transform: translateX(20px);
    background: var(--text-on-accent);
}

.switch-toggle input:focus-visible+.switch-slider {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.custom-table th {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    text-align: left;
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.custom-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.custom-table tbody tr:last-child td {
    border-bottom: 0;
}

.alert-banner {
    margin-bottom: 14px;
    padding: 12px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
}

.alert-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(65, 145, 206, .12);
    color: var(--accent);
    font-size: 18px;
}

.alert-content {
    min-width: 0;
}

.alert-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 720;
}

.alert-desc {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.45;
}

.btn-warning-sm {
    grid-column: 1 / -1;
    min-height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 9px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--text-on-accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.alert-banner.alert-warning {
    background: var(--warning-soft);
    border-color: rgba(241, 183, 91, 0.28);
}

.alert-banner.alert-warning .alert-icon {
    background: rgba(241, 183, 91, 0.14);
    color: var(--warning);
}

.alert-banner.alert-warning .btn-warning-sm {
    background: var(--warning);
    border-color: var(--warning);
    color: #12151a;
}

.alert-banner.alert-warning .btn-warning-sm:hover {
    opacity: 0.9;
}

.alert-banner.alert-telegram {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.alert-banner.alert-telegram .alert-icon {
    background: rgba(65, 145, 206, 0.12);
    color: var(--accent);
}

.alert-banner.alert-telegram .btn-warning-sm {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

.not-twa-only {
    display: none !important;
}

html.not-twa .not-twa-only {
    display: inline-flex !important;
}

html.is-twa .not-twa-only {
    display: none !important;
}

.navbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.navbar-logout-btn {
    height: 38px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.navbar-logout-btn:hover {
    background: var(--danger-soft);
    border-color: rgba(238, 115, 120, 0.3);
    color: var(--danger);
    text-decoration: none;
}

.navbar-logout-btn i {
    font-size: 16px;
}

.tabs-nav-wrapper {
    position: fixed;
    z-index: 120;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px max(12px, var(--safe-right)) calc(8px + var(--safe-bottom)) max(12px, var(--safe-left));
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.tabs {
    width: min(100%, 520px);
    margin: 0 auto;
    display: flex;
    gap: 4px;
}

.tab-btn {
    min-width: 0;
    min-height: 56px;
    flex: 1;
    padding: 7px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease, transform 100ms ease;
}

.tab-btn i {
    font-size: 20px;
    line-height: 1;
}

.tab-btn span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 720;
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: var(--surface-soft);
}

.tab-btn:active {
    transform: scale(.98);
}

.tab-btn.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: var(--overlay-bg);
    opacity: 1;
    transition: opacity 180ms ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal-box {
    width: 100%;
    max-height: calc(92dvh - var(--safe-top));
    overflow-y: auto;
    padding: 14px 16px calc(18px + var(--safe-bottom));
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-modal);
    transform: translateY(0);
    animation: sheetIn 220ms cubic-bezier(.2, .75, .25, 1) both;
}

@keyframes sheetIn {
    from {
        transform: translateY(16px);
        opacity: .7;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.modal-header h3 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
    letter-spacing: -.025em;
    font-weight: 740;
}

.modal-close-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 19px;
}

.modal-close-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.modal-label {
    display: block;
    margin: 0 0 7px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.amount-input-wrap {
    width: 100%;
}

.topup-amount-input,
.wl-amount-input {
    width: 100%;
    height: 62px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    outline: none;
    background: var(--surface-soft);
    color: var(--text-primary);
    text-align: center;
    font-size: 25px;
    font-weight: 760;
    letter-spacing: -.025em;
    font-variant-numeric: tabular-nums;
}

.topup-amount-input:focus,
.wl-amount-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.payment-methods-grid {
    display: grid;
    gap: 8px;
}

.method-card {
    min-height: 64px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

.method-card:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.method-card.active {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.method-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex: 0 0 auto;
    border-radius: 8px;
}

.method-icon.method-icon-bonus {
    display: grid;
    place-items: center;
    background: var(--success-soft);
    color: var(--success);
    font-size: 19px;
    border: 1px solid rgba(88, 201, 139, .2);
}

.method-info {
    min-width: 0;
    flex: 1;
}

.method-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}

.method-currency {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
}

.method-radio {
    position: relative;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
}

.method-card.active .method-radio {
    border-color: var(--accent);
}

.method-card.active .method-radio::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.btn-pay {
    width: 100%;
    min-height: 50px;
    margin-top: 16px;
    font-size: 14px;
}

.wl-info-banner {
    padding: 11px;
    display: flex;
    gap: 9px;
    align-items: flex-start;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.wl-info-icon {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 17px;
}

.wl-status-box {
    margin-top: 10px;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}

.wl-status-item {
    min-width: 0;
}

.wl-status-label {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
}

.wl-status-val {
    display: block;
    margin-top: 4px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 720;
}

.wl-status-pill {
    display: inline-flex;
    margin-top: 4px;
    padding: 3px 7px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 720;
}

.wl-status-pill.active {
    background: var(--success-soft);
    color: var(--success);
}

.wl-status-pill.exhausted {
    background: var(--danger-soft);
    color: var(--danger);
}

.wl-amount-wrap {
    position: relative;
    width: 100%;
}

.wl-amount-input {
    width: 100%;
    height: 56px;
    font-size: 21px;
    text-align: center;
}

.wl-calc-summary {
    margin-top: 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    font-size: 11px;
}

.wl-calc-summary b {
    color: var(--text-secondary);
    font-weight: 720;
}

#wl-deposit-alert {
    margin: 10px 0 0 !important;
}

.terms-link-btn {
    min-height: 48px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--text-primary) !important;
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
}

.terms-link-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.terms-modal-box {
    text-align: left;
}

.terms-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 22px;
}

.terms-title {
    margin: 0;
    font-size: 21px;
    letter-spacing: -.025em;
}

.terms-copy {
    margin: 8px 0 16px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.55;
}

.terms-links {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.qr-content {
    text-align: center;
}

.qr-copy {
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-size: 12px;
}

.qr-frame {
    width: fit-content;
    margin: 0 auto;
    padding: 10px;
    border-radius: 14px;
    background: #fff;
}

#qr-code-img {
    width: 220px;
    height: 220px;
    display: block;
}

.payment-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: grid;
    place-items: center;
    padding: 16px;
    background: var(--overlay-bg);
    opacity: 1;
    transition: opacity 180ms ease;
}

.payment-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.payment-box {
    width: min(100%, 330px);
    padding: 24px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-modal);
    text-align: center;
}

.loader {
    width: 36px;
    height: 36px;
    margin: 0 auto 13px;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.spin {
    display: inline-block;
    animation: spin 700ms linear infinite;
}

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

.payment-text {
    font-size: 13px;
    font-weight: 700;
}

.redirect-timer {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.toast-container {
    position: fixed;
    z-index: 20000;
    left: 50%;
    bottom: calc(86px + var(--safe-bottom));
    width: min(92vw, 420px);
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    text-align: center;
    font-size: 12px;
}

.skeleton {
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--surface-active) 0%, var(--surface-hover) 50%, var(--surface-active) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
}

.stat-card-balance .skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0.15) 100%);
    background-size: 200% 100%;
}

@keyframes skeletonShimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.list-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.list-loader .spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

@media (min-width: 430px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    .ref-link-group {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    #tab-referrals .ref-link-group {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .alert-banner {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
    }

    .btn-warning-sm {
        grid-column: auto;
    }
}

@media (min-width: 680px) {
    .container {
        padding-top: 28px;
        padding-left: 28px;
        padding-right: 28px;
    }

    .stats-grid {
        grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(150px, .75fr));
        grid-template-areas:
            'balance days devices'
            'balance wl wl';
        gap: 12px;
    }

    .stat-card-balance {
        min-height: 276px;
    }

    .stat-card-wl {
        min-height: 132px;
    }

    .referral-box,
    .info-card {
        padding: 20px;
    }

    .platforms-grid {
        grid-template-columns: 1fr;
    }

    .platform-card {
        padding: 14px;
    }

    .bonus-card {
        padding: 18px 20px;
    }

    .modal-box {
        max-width: 520px;
    }
}

@media (min-width: 960px) {
    body {
        padding-left: var(--sidebar-width);
    }

    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 94px;
        min-height: 94px;
        padding: 24px 22px;
        align-items: center;
        background: var(--bg-secondary);
        border-right: 1px solid var(--border);
        border-bottom: 0;
    }

    .brand-logo {
        height: 42px;
    }

    .navbar-meta {
        display: none;
    }

    .tabs-nav-wrapper {
        top: 94px;
        left: 0;
        right: auto;
        bottom: 0;
        width: var(--sidebar-width);
        padding: 12px 14px 24px;
        background: var(--bg-secondary);
        border-top: 0;
        border-right: 1px solid var(--border);
    }

    .tabs {
        width: 100%;
        margin: 0;
        flex-direction: column;
        gap: 5px;
    }

    .tab-btn {
        min-height: 50px;
        flex: 0 0 auto;
        padding: 0 13px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 11px;
        border-radius: var(--radius-sm);
        text-align: left;
    }

    .tab-btn i {
        width: 21px;
        font-size: 19px;
        text-align: center;
    }

    .tab-btn span {
        font-size: 13px;
    }

    .tab-btn.active {
        background: var(--accent);
        color: var(--text-on-accent);
    }

    .tab-btn.active:hover {
        color: var(--text-on-accent);
        background: var(--accent-hover);
    }

    .container {
        max-width: var(--content-max);
        padding: 42px 38px 72px;
    }

    .page-heading {
        margin-bottom: 24px;
    }

    .page-heading h1 {
        font-size: 36px;
    }

    .stats-grid {
        gap: 14px;
        margin-bottom: 18px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card-balance {
        padding: 22px;
    }

    .stat-card-balance .stat-value {
        font-size: 56px;
    }

    .charge-item,
    .device-item {
        padding: 13px 14px;
    }

    .modal-overlay {
        align-items: center;
        padding: 24px;
    }

    .modal-box {
        max-width: 470px;
        max-height: min(820px, 88vh);
        padding: 20px;
        border-bottom: 1px solid var(--border);
        border-radius: var(--radius-lg);
        animation: dialogIn 190ms ease-out both;
    }

    @keyframes dialogIn {
        from {
            transform: translateY(8px) scale(.985);
            opacity: .6;
        }

        to {
            transform: none;
            opacity: 1;
        }
    }

    .terms-modal-box {
        max-width: 500px;
        padding: 24px;
    }

    .toast-container {
        bottom: 24px;
    }
}

@media (min-width: 1280px) {
    :root {
        --content-max: 1220px;
    }

    .container {
        padding-left: 46px;
        padding-right: 46px;
    }

    .referral-box,
    .info-card {
        padding: 22px;
    }
}

@media (min-width: 1600px) {
    :root {
        --content-max: 1280px;
    }

    .container {
        padding-top: 50px;
    }
}

@media (max-width: 390px) {
    .navbar {
        padding-left: max(13px, var(--safe-left));
        padding-right: max(13px, var(--safe-right));
    }

    .brand-logo {
        height: 34px;
    }

    .navbar-meta-value {
        max-width: 145px;
    }

    .container {
        padding-left: max(13px, var(--safe-left));
        padding-right: max(13px, var(--safe-right));
    }

    .page-heading h1 {
        font-size: 26px;
    }

    .stat-card {
        min-height: 126px;
        padding: 14px;
    }

    .stat-card-balance {
        min-height: 166px;
    }

    .stat-card-balance .stat-value {
        font-size: 40px;
    }

    .stat-value {
        font-size: 25px;
    }

    .balance-topup-badge,
    .wl-buy-badge {
        min-height: 32px;
        padding: 0 8px;
        font-size: 11px;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
    }

    .referral-box,
    .info-card {
        padding: 14px;
    }

    .ref-settings-desc {
        display: none;
    }

    .wl-calc-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}

/* ==========================================================================
   Auth Page (index.php)
   ========================================================================== */
body.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background-color: var(--bg);
    color: var(--text-primary);
}

.auth-page .navbar {
    display: flex !important;
    position: relative;
    z-index: 20;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0 0 2rem 0;
    background: transparent;
    border-bottom: none;
    pointer-events: none;
}

.auth-page .layout-spacer {
    height: 104px;
    width: 100%;
    pointer-events: none;
    flex-shrink: 0;
}

.auth-page .brand {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.auth-page .brand-logo {
    height: 72px;
    width: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.auth-page .brand:hover .brand-logo {
    transform: scale(1.02);
}

.auth-page .container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
    width: 100%;
    transition: all 0.25s ease;
}

.card-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.card-header h2 {
    font-family: 'Outfit', 'Manrope', sans-serif;
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.card-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 auto;
    line-height: 1.5;
    max-width: 320px;
}

.field {
    margin-bottom: 1.25rem;
    display: block;
}

.field-label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-page .input,
.auth-card .input,
.input {
    width: 100%;
    display: block;
    padding: 0.85rem 1rem;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.auth-page .input:focus,
.auth-card .input:focus,
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-page .input::placeholder,
.auth-card .input::placeholder,
.input::placeholder {
    color: rgba(159, 176, 195, 0.6);
}

.auth-page .btn,
.auth-card .btn {
    width: 100%;
    min-height: 48px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.divider span {
    position: relative;
    background: var(--surface);
    padding: 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.tg-login-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    width: 100%;
}

.tg-card {
    padding: 1.15rem;
}

.tg-btn {
    background: #2481cc !important;
    border: 1px solid #2481cc !important;
    min-height: 3.5rem !important;
    font-size: 1.1rem !important;
    border-radius: var(--radius-md) !important;
    color: #ffffff !important;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.tg-btn:hover:not(:disabled) {
    background: #1c74b8 !important;
    border-color: #1c74b8 !important;
}

.tg-btn i {
    font-size: 1.5rem;
    margin-right: 0.25rem;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
    box-sizing: border-box;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--success);
}

.dev-link {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    color: var(--success);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    word-break: break-all;
}

.turnstile-wrapper {
    min-height: 0;
    margin: 0;
    display: none;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.turnstile-wrapper.visible {
    display: flex !important;
    min-height: 65px;
    margin: 0.5rem 0 1.25rem;
}

.legal {
    margin-top: 1.5rem;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.5;
}

.legal a {
    color: var(--accent);
    text-decoration: none;
}

.legal a:hover {
    text-decoration: underline;
}

/* Telegram WebApp (TWA) Specific Styles for Auth */
html.is-twa body.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--tg-viewport-height, 100vh);
    padding-top: max(2rem, calc(var(--safe-top) + 1rem)) !important;
    padding-bottom: max(1.5rem, calc(var(--safe-bottom) + 1rem)) !important;
    padding-left: max(1rem, var(--safe-left)) !important;
    padding-right: max(1rem, var(--safe-right)) !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

html.is-twa body.auth-page .navbar {
    display: flex !important;
    margin-bottom: 1.25rem;
}

html.is-twa body.auth-page .brand-logo {
    height: 52px;
}

html.is-twa body.auth-page .container {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 0 !important;
}

html.is-twa body.auth-page .layout-spacer {
    display: none;
}

@media (max-width: 640px) {
    html.is-twa body.auth-page {
        padding-top: max(2rem, calc(var(--safe-top) + 1rem)) !important;
        padding-bottom: max(1.25rem, calc(var(--safe-bottom) + 0.75rem)) !important;
    }

    body.auth-page {
        padding: 1.25rem 1rem;
    }

    .auth-page .container {
        max-width: 480px;
        padding: 0;
    }

    .auth-page .navbar {
        margin-bottom: 1.25rem;
    }

    .auth-page .layout-spacer {
        height: 60px;
    }

    .auth-page .brand-logo {
        height: 52px;
    }

    .auth-card {
        padding: 1.15rem 1rem;
    }

    .card-header h2 {
        font-size: 1.35rem;
    }

    .card-header p {
        font-size: 0.86rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}