* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4A90E2;
    --primary-dark: #357ABD;
    --secondary-color: #50C878;
    --text-color: #2C3E50;
    --text-light: #7F8C8D;
    --bg-color: #FFFFFF;
    --bg-light: #F8F9FA;
    --border-color: #E1E8ED;
    --error-color: #E74C3C;
    --success-color: #27AE60;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: var(--bg-color);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    color: var(--text-color);
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 16px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Forms */
.auth-form,
.code-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background: var(--bg-light);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-small {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    display: inline-block;
    width: auto;
}

.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.btn-small:active {
    transform: translateY(0);
}

.btn-link {
    background: none;
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    padding: 10px;
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* Logout Button */
.btn-logout {
    background: var(--bg-light);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    display: inline-block;
}

.btn-logout:hover {
    background: #f5f5f5;
    border-color: #ddd;
    color: var(--text-color);
}

.btn-logout:active {
    background: #ebebeb;
}

/* Messages */
.error-message,
.success-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 14px;
    text-align: center;
}

.error-message {
    background: #FEE;
    color: var(--error-color);
    border: 1px solid #FCC;
}

.success-message {
    background: #EFE;
    color: var(--success-color);
    border: 1px solid #CFC;
}

.hidden {
    display: none !important;
}

/* Footer */
.footer {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

/* Cabinet Page */
.cabinet-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 40px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.cabinet-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.welcome-section {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    clear: both;
    display: block;
}

.welcome-section h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-card h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .value.value-light {
    font-weight: 500;
    font-size: 28px;
}

.stat-card .expiration-date {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
    line-height: 1.2;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.info-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 16px;
    color: var(--text-color);
    font-weight: 600;
    word-break: break-all;
}

/* Status Colors */
.status-trial {
    color: #F59E0B !important;
    background: #FEF3C7;
    padding: 4px 12px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 600;
}

.status-expired {
    color: #EF4444 !important;
    background: #FEE2E2;
    padding: 4px 12px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 600;
}

.status-active {
    color: #10B981 !important;
    background: #D1FAE5;
    padding: 4px 12px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 600;
}

/* Tariffs Accordion */
.tariffs-accordion {
    margin-top: 20px;
}

.tariff-accordion-item {
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
}

.tariff-accordion-item.active {
    box-shadow: var(--shadow-hover);
}

.tariff-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    cursor: pointer;
    transition: background 0.3s;
    user-select: none;
}

.tariff-accordion-header:hover {
    background: var(--bg-light);
}

.accordion-arrow {
    font-size: 14px;
    color: var(--text-light);
    transition: transform 0.3s;
}

.tariff-accordion-content {
    display: none;
    padding: 0 30px 30px 30px;
}

.tariff-accordion-item.active .tariff-accordion-content {
    display: block;
}

.tariff-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tariff-option-card {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.tariff-option-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tariff-option-header {
    margin-bottom: 15px;
}

.tariff-option-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

.tariff-option-subtitle {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.4;
}

.tariff-option-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 15px 0;
}

/* Payment Dialog */
.payment-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.payment-dialog-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

.payment-dialog-content h3 {
    margin-bottom: 20px;
    font-size: 24px;
}

/* Device Setup Accordion */
.devices-accordion {
    margin-top: 20px;
}

.device-accordion-item {
    background: var(--bg-light);
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: none;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
}

.device-accordion-item.active {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
    margin-bottom: 20px;
}

.device-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    cursor: pointer;
    transition: background 0.3s;
    user-select: none;
}

.device-accordion-header:hover {
    background: var(--bg-light);
}

.device-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.device-icon {
    font-size: 32px;
}

.device-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.device-subtitle {
    font-size: 13px;
    color: var(--text-light);
}

.device-accordion-content {
    display: none;
    padding: 20px 25px 25px 25px;
    background: white;
    margin-top: 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.device-accordion-item.active .device-accordion-content {
    display: block;
}

.device-setup-info {
    animation: fadeIn 0.3s;
}

.setup-step-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.app-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
}

.app-buttons .btn-small {
    width: auto;
    text-align: center;
    display: inline-block;
    padding: 6px 14px;
    font-size: 12px;
}

.instruction-link {
    display: inline-block;
    padding: 10px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
    font-size: 14px;
}

.instruction-link:hover {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .login-card {
        padding: 30px 20px;
    }

    .login-title {
        font-size: 24px;
    }

    .cabinet-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .tariffs-grid {
        grid-template-columns: 1fr;
    }

    .devices-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .instruction-links {
        grid-template-columns: 1fr;
    }
}

