:root {
    --primary: #007AFF;
    --primary-dark: #0056CC;
    --secondary: #5856D6;
    --success: #34C759;
    --danger: #FF3B30;
    --warning: #FF9500;
    --dark: #1C1C1E;
    --light: #F2F2F7;
    --gray: #8E8E93;
    --gray-light: #C7C7CC;
    --white: #FFFFFF;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: var(--light);
    color: var(--dark);
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.5;
}

.container {
    max-width: 100%;
    padding: 20px;
}

/* Загрузка */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Шапка */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray-light);
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

.user-menu {
    display: flex;
    gap: 12px;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 14px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary);
}

/* Карточка баланса */
.balance-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.balance-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    opacity: 0.9;
}

.balance-amount {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 5px;
}

.balance-days {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 20px;
}

.balance-actions {
    display: flex;
    gap: 10px;
}

/* Кнопки */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--white);
    color: var(--primary);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    backdrop-filter: blur(10px);
}

.btn-full {
    width: 100%;
    margin-top: 15px;
}

.btn-large {
    padding: 18px;
    font-size: 18px;
}

.btn-icon {
    font-size: 20px;
    font-weight: bold;
}

/* Секции */
.devices-section,
.referral-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.devices-count {
    color: var(--gray);
    font-size: 14px;
}

/* Список устройств */
.devices-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--light);
    border-radius: 10px;
    border: 1px solid var(--gray-light);
}

.device-info h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.device-info p {
    color: var(--gray);
    font-size: 14px;
}

.device-status {
    padding: 5px 12px;
    background: var(--success);
    color: var(--white);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.device-status.inactive {
    background: var(--gray);
}

/* Реферальная программа */
.referral-bonus {
    font-size: 24px;
    font-weight: bold;
    color: var(--success);
    margin: 15px 0;
    text-align: center;
}

.bonus-amount {
    background: rgba(52, 199, 89, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
}

.referral-text {
    color: var(--gray);
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.6;
}

.referral-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.referral-stats {
    display: flex;
    justify-content: space-around;
    padding-top: 15px;
    border-top: 1px solid var(--light);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

/* Страницы */
.page {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--primary);
    cursor: pointer;
    margin-right: 15px;
    padding: 5px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
}

/* Страница пополнения */
.topup-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
}

.topup-section h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--dark);
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.amount-btn {
    padding: 20px;