/* ===== ОБЩИЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #fff;
    min-height: 100vh;
    color: #000;
}

/* ===== СТРАНИЦА ВХОДА ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 48px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    margin-bottom: 24px;
}

.logo-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-description {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 32px;
    line-height: 1.6;
}

.error-message {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
}

.telegram-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #0088cc, #00a0e4);
    color: white;
    text-decoration: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4);
}

.telegram-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 136, 204, 0.5);
}

.telegram-icon {
    width: 24px;
    height: 24px;
}

.login-features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.feature-icon {
    font-size: 20px;
}

/* ===== ДАШБОРД ===== */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    padding: 12px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .logo-icon {
    font-size: 28px;
    margin-bottom: 0;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 600;
}

.back-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    margin-right: 16px;
    transition: color 0.2s;
}

.back-link:hover {
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-weight: 500;
}

.user-tariff {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.user-tariff.tariff-free {
    background: rgba(107, 114, 128, 0.3);
    color: #9ca3af;
}

.logout-button {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.logout-button:hover {
    color: #ef4444;
}

/* ===== НАВИГАЦИЯ ===== */
.dashboard-nav {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: rgba(0, 0, 0, 0.6);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.nav-item:last-child {
    border-right: none;
}

.nav-item:hover {
    color: #000;
}

.nav-item.active {
    color: #000;
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
}

/* ===== КОНТЕНТ ===== */
.dashboard-content {
    flex: 1;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

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

.content-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.add-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #000;
    color: white;
    border: none;
    padding: 0 14px;
    height: 36px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.add-button:hover {
    opacity: 0.8;
}

.add-button span {
    font-size: 18px;
    font-weight: 700;
}

/* ===== ФИЛЬТР КАМПАНИЙ ===== */
.filter-buttons {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 3px;
}

.filter-btn {
    padding: 0 14px;
    height: 30px;
    display: flex;
    align-items: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.filter-btn:hover {
    color: #374151;
}

.filter-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 24px;
}

/* ===== ТАБЛИЦА КАМПАНИЙ ===== */
.campaigns-table {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.campaigns-table table {
    width: 100%;
    border-collapse: collapse;
}

.campaigns-table th {
    text-align: left;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.7);
}

.campaigns-table td {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== ПОПАП ===== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.popup-box {
    background: linear-gradient(135deg, #1e1e3f 0%, #2a2a5a 100%);
    border-radius: 24px;
    padding: 40px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.popup-close:hover {
    color: white;
}

.popup-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.popup-box h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.popup-box p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.popup-limits,
.popup-features {
    list-style: none;
    text-align: left;
    margin-bottom: 20px;
}

.popup-limits li,
.popup-features li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.popup-limits li::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: rgba(255, 255, 255, 0.5);
}

.popup-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
}

.popup-button {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    text-decoration: none;
    padding: 14px 40px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    margin-bottom: 20px;
}

.popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(124, 58, 237, 0.5);
}

.popup-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
}

.popup-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ===== СТРАНИЦА ТАРИФОВ ===== */
.tariffs-content {
    flex: 1;
    padding: 40px 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.tariffs-header {
    text-align: center;
    margin-bottom: 48px;
}

.tariffs-header h2 {
    font-size: 32px;
    margin-bottom: 12px;
}

.tariffs-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
}

.tariffs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.tariff-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    transition: all 0.3s ease;
}

.tariff-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124, 58, 237, 0.3);
}

.tariff-card.popular {
    border-color: rgba(124, 58, 237, 0.5);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
}

.tariff-card.current {
    border-color: rgba(16, 185, 129, 0.5);
}

.tariff-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tariff-badge.popular {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
}

.tariff-card h3 {
    font-size: 20px;
    margin-bottom: 16px;
    margin-top: 8px;
}

.tariff-price {
    margin-bottom: 24px;
}

.tariff-price .price {
    font-size: 36px;
    font-weight: 700;
    display: block;
}

.tariff-price .period {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.tariff-features {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
}

.tariff-features li {
    padding: 8px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.tariff-features li.highlight {
    color: #10b981;
    font-weight: 600;
}

.tariff-button {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.tariff-button.coming-soon {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}

.tariff-button.disabled {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    cursor: default;
}

.tariffs-notice {
    text-align: center;
    margin-top: 48px;
    padding: 20px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.tariffs-notice p {
    color: #fbbf24;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .login-box {
        padding: 32px 24px;
    }
    
    .dashboard-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .dashboard-nav {
        width: 100%;
        overflow-x: auto;
        order: 3;
    }

    .nav-item {
        padding: 8px 12px;
        white-space: nowrap;
        font-size: 13px;
    }
    
    .dashboard-content {
        padding: 20px 16px;
    }
    
    .content-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .tariffs-grid {
        grid-template-columns: 1fr;
    }

}

/* ===== СТРАНИЦА АККАУНТОВ ===== */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.account-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    border: 1px solid #000;
    transition: all 0.3s ease;
}

.account-card:hover {
    transform: translateY(-2px);
}

.account-card.status-error {
    border-color: #000;
}

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

.account-icon {
    font-size: 32px;
}

.status-badge {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.account-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #000;
}

.account-info p {
    color: rgba(0, 0, 0, 0.6);
    font-size: 13px;
    margin-bottom: 4px;
}

.account-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.account-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-actions button img {
    width: 16px;
    height: 16px;
}

.account-actions .btn-refresh {
    background: #fff;
    border: 1px solid #000 !important;
}

.account-actions .btn-refresh img {
    filter: brightness(0);
}

.account-actions .btn-refresh:hover {
    background: rgba(0, 0, 0, 0.05);
    opacity: 1;
}

.account-actions .btn-delete {
    background: #000;
    color: #fff;
    border: none;
}

.account-actions .btn-delete img {
    filter: brightness(0) invert(1);
}

.account-actions .btn-delete:hover {
    opacity: 0.8;
}

.info-box {
    background: #fff;
    border: 1px solid #000;
    border-radius: 20px;
    padding: 24px;
    margin-top: 32px;
}

.info-box h4 {
    margin-bottom: 16px;
    font-size: 16px;
    color: #000;
}

.info-box ol {
    margin-left: 20px;
    color: rgba(0, 0, 0, 0.8);
}

.info-box li {
    margin-bottom: 8px;
}

.info-box a {
    color: #60a5fa;
}

/* ===== ФОРМА ДОБАВЛЕНИЯ АККАУНТА ===== */
.form-content {
    flex: 1;
    padding: 40px 32px;
    display: flex;
    justify-content: center;
}

.form-container {
    max-width: 500px;
    width: 100%;
}

.form-header {
    text-align: center;
    margin-bottom: 32px;
}

.form-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.form-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.form-header p {
    color: rgba(0, 0, 0, 0.6);
}

.account-form {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #000;
    border-radius: 20px;
    color: #000;
    font-size: 16px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #000;
    background: #fff;
}

.form-group input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
}

.submit-button {
    width: 100%;
    padding: 16px;
    background: #000;
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-button:hover {
    opacity: 0.8;
}

.form-instructions {
    margin-top: 32px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 24px;
}

.form-instructions h4 {
    margin-bottom: 16px;
}

.form-instructions ol {
    margin-left: 20px;
    color: rgba(255, 255, 255, 0.8);
}

.form-instructions li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.form-instructions a {
    color: #60a5fa;
}

.warning-box {
    margin-top: 20px;
    padding: 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    font-size: 14px;
    color: #fbbf24;
}
/* ===== КАМПАНИИ ===== */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.campaign-card {
    background: #fff;
    border-radius: 20px;
    padding: 14px 18px;
    border: 1px solid #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.campaign-card:hover {
    transform: translateY(-2px);
}

.campaign-card.status-active {
    border-color: #000;
}

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

.campaign-status {
    flex-shrink: 0;
    white-space: nowrap;
}

.campaign-title {
    min-width: 0;
    flex: 1;
}

.campaign-title h3 {
    font-size: 15px;
    margin-bottom: 1px;
    word-wrap: break-word;
}

.campaign-city {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.7);
    display: block;
    word-wrap: break-word;
}

.campaign-account {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
}

.status-badge.paused {
    background: rgba(107, 114, 128, 0.3);
    color: #9ca3af;
}

.campaign-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    margin-top: auto;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
}

.campaign-actions {
    display: flex;
    gap: 8px;
}

.campaign-actions button,
.campaign-actions a {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-start {
    background: #000;
    color: #fff;
}

.btn-start:hover {
    opacity: 0.8;
}

.btn-pause {
    background: #000;
    color: #fff;
}

.btn-pause:hover {
    opacity: 0.8;
}

.btn-reset {
    background: #000;
    color: #fff;
}

.btn-reset:hover {
    opacity: 0.8;
}

.btn-details {
    background: #000;
    color: #fff;
    flex: 0 0 auto;
    width: 44px;
}

.btn-details:hover {
    opacity: 0.8;
}

.btn-edit {
    background: #000;
    color: #fff;
    flex: 0 0 auto;
    width: 44px;
}

.btn-edit:hover {
    opacity: 0.8;
}

.campaign-actions .btn-delete {
    background: #000;
    color: #fff;
}

.campaign-actions .btn-delete:hover {
    opacity: 0.8;
}

.campaign-actions button img,
.campaign-actions a img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* ===== СТАТИСТИКА AVITO В КАМПАНИЯХ ===== */
.campaign-avito-stats {
    margin-top: 10px;
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

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

.stats-title {
    font-size: 13px;
    font-weight: 600;
    color: #000;
}

.stats-period-selector {
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #000;
    border-radius: 10px;
    color: #000;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.stats-period-selector:hover {
    background: rgba(0, 0, 0, 0.05);
}

.stats-period-selector option {
    background: #fff;
    color: #000;
}

.avito-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.avito-stat-item {
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: #fff;
    border: 1px solid #000;
    border-radius: 10px;
}

.avito-stat-label {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 4px;
}

.avito-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #000;
}

/* ===== ПЕРЕКЛЮЧАТЕЛЬ ПЕРИОДА ===== */
.period-toggle {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 3px;
}

.period-btn {
    padding: 0 14px;
    height: 30px;
    display: flex;
    align-items: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
}

.period-btn:hover {
    color: #374151;
}

.period-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== ПЕРЕКЛЮЧАТЕЛЬ ВИДА ===== */
.view-toggle {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 3px;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: #9ca3af;
    transition: all 0.2s;
}

.view-btn:hover {
    color: #374151;
}

.view-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ===== ТАБЛИЧНЫЙ ВИД КАМПАНИЙ ===== */
.campaigns-table-wrapper {
    margin-top: 20px;
}

.campaigns-table-scroll {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.campaigns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
}

.campaigns-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.campaigns-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.campaigns-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #d1d5db;
    color: #111827;
}

.campaigns-table tbody tr {
    transition: background 0.15s;
}

.campaigns-table tbody tr:hover {
    background: #f3f4f6;
}

.campaigns-table tbody tr:last-child td {
    border-bottom: none;
}

.campaigns-table tbody tr.status-paused {
    opacity: 0.6;
}

/* Сортировка */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: color 0.15s;
}

th.sortable:hover {
    color: #111827;
}

.sort-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 4px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.25;
    border-bottom: 5px solid currentColor;
    transition: opacity 0.15s, transform 0.15s;
}

th.sort-asc .sort-arrow {
    opacity: 1;
    border-bottom: 5px solid currentColor;
    border-top: none;
}

th.sort-desc .sort-arrow {
    opacity: 1;
    border-top: 5px solid currentColor;
    border-bottom: none;
}

/* Статус-точка */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
}

.status-dot.active {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.4);
}

.status-dot.paused {
    background: #9ca3af;
}

/* Ячейка названия */
.td-title {
    white-space: normal;
    min-width: 200px;
    max-width: 320px;
}

.table-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table-title-link {
    color: #111827;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    display: block;
}

.table-title-link:hover {
    color: #3b82f6;
}

.table-item-id {
    font-size: 11px;
    color: #9ca3af;
}

.table-address {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    display: block;
}

/* Позиция */
.table-position-value {
    font-weight: 600;
    font-size: 15px;
}

/* Бейдж режима */
.mode-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.mode-tracking {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.mode-bidding {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* Статистика в таблице */
.table-stat {
    font-size: 13px;
    color: #374151;
}

/* Кнопки действий в таблице */
.table-actions {
    display: flex;
    gap: 4px;
}

.tbl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: #000;
    transition: opacity 0.2s;
    text-decoration: none;
}

.tbl-btn:hover {
    opacity: 0.7;
}

.tbl-btn img {
    width: 14px;
    height: 14px;
    filter: brightness(0) invert(1);
}

/* Колонки таблицы */
.th-status { width: 40px; }
.th-position, .th-target, .th-step, .th-bid, .th-maxbid, .th-budget, .th-views, .th-favorites, .th-contacts, .th-conv { text-align: center; }
.td-position, .td-target, .td-step, .td-bid, .td-maxbid, .td-budget, .td-views, .td-favorites, .td-contacts, .td-conv { text-align: center; }
.th-actions { text-align: right; }
.td-actions { text-align: right; }

/* Раскрытая строка с графиком */
.table-row {
    cursor: pointer;
}

.table-row.row-expanded {
    background: #f3f4f6;
}

.table-row.row-expanded td {
    border-bottom-color: transparent;
}

.expanded-chart-row td {
    padding: 0 !important;
    border-bottom: 1px solid #e5e7eb;
    background: #f3f4f6;
}

.expanded-chart-container {
    padding: 14px 20px 10px;
    position: relative;
    overflow: hidden;
    width: 0;
    min-width: 100%;
}

.expanded-chart-loading {
    text-align: center;
    padding: 32px 0;
    color: #9ca3af;
    font-size: 13px;
}

/* Легенда */
.bc-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 11px;
    color: #6b7280;
}

.bc-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bc-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

.bc-dot.bar-ok { background: #22c55e; }
.bc-dot.bar-out { background: #f59e0b; }
.bc-dot.bar-off { background: #d1d5db; }

/* Область графика */
.bc-chart {
    position: relative;
    height: 140px;
    display: flex;
    align-items: flex-end;
}

.bc-chart::before,
.bc-chart::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s;
}

.bc-chart::before {
    left: 0;
    background: linear-gradient(to right, #f3f4f6, transparent);
}

.bc-chart::after {
    right: 0;
    background: linear-gradient(to left, #f3f4f6, transparent);
}

.bc-chart.fade-left::before {
    opacity: 1;
}

.bc-chart.fade-right::after {
    opacity: 1;
}

.bc-target-zone {
    position: absolute;
    left: 0;
    right: 0;
    background: rgba(34, 197, 94, 0.06);
    border-top: 1px dashed rgba(34, 197, 94, 0.3);
    border-bottom: 1px dashed rgba(34, 197, 94, 0.3);
    pointer-events: none;
    z-index: 0;
}

/* Столбики */
.bc-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 100%;
    width: 100%;
    overflow-x: auto;
    position: relative;
    z-index: 1;
    padding-bottom: 18px;
}

.bc-col {
    flex: 1 1 0;
    min-width: 18px;
    max-width: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    cursor: default;
}

.bc-bar {
    width: 100%;
    border-radius: 4px 4px 1px 1px;
    min-height: 4px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transition: opacity 0.15s;
    position: relative;
}

.bc-bar.bar-ok {
    background: #22c55e;
}

.bc-bar.bar-out {
    background: #f59e0b;
}

.bc-bar.bar-off {
    background: #d1d5db;
}

.bc-col:hover .bc-bar {
    opacity: 1;
}

.bc-val {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    margin-top: 3px;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.bc-time {
    font-size: 9px;
    color: #9ca3af;
    margin-top: 3px;
    white-space: nowrap;
}

/* Адаптив для таблицы */
@media (max-width: 768px) {
    .campaigns-table-scroll {
        border-radius: 12px;
    }
    .campaigns-table th,
    .campaigns-table td {
        padding: 10px 8px;
    }
    .bc-chart {
        height: 120px;
    }
    .expanded-chart-container {
        padding: 10px 8px 8px;
    }
}

/* ===== ФОРМА КАМПАНИИ ===== */
.form-container.wide {
    max-width: 600px;
}

.form-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.form-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #000;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

.form-group select {
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #000;
    border-radius: 20px;
    color: #000;
    font-size: 16px;
}

.form-group select option {
    background: #fff;
    color: #000;
}

.campaign-form .form-group input {
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #000;
    border-radius: 20px;
    color: #000;
    font-size: 16px;
}

/* ===== ДЕТАЛЬНАЯ СТРАНИЦА ===== */
.detail-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #000;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.detail-item {
    background: #fff;
    padding: 16px;
    border-radius: 15px;
    border: 1px solid #000;
}

.detail-label {
    display: block;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 8px;
}

.detail-value {
    font-size: 16px;
    font-weight: 500;
    color: #000;
}

.detail-value.big {
    font-size: 24px;
    font-weight: 700;
    color: #000;
}

.detail-actions {
    display: flex;
    gap: 8px;
}

.detail-actions button {
    padding: 10px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.detail-actions button:hover {
    opacity: 0.8;
}

.detail-actions button img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #000;
    border-radius: 20px;
    overflow: hidden;
}

.stats-table th,
.stats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: #000;
}

.stats-table th {
    color: #000;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.05);
}

.no-stats {
    color: rgba(0, 0, 0, 0.5);
    text-align: center;
    padding: 40px;
}

/* ===== ВИЗУАЛИЗАЦИЯ ВРЕМЕННОЙ ШКАЛЫ ===== */
.position-timeline {
    margin-bottom: 32px;
    padding: 24px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #000;
    overflow-x: auto;
}

.timeline-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-width: min-content;
    min-height: 200px;
    padding: 20px 0;
    position: relative;
}

.timeline-container::before {
    content: '';
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(0, 0, 0, 0.2);
}

.timeline-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 60px;
    position: relative;
}

.timeline-marker {
    width: 12px;
    height: 12px;
    background: #000;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.3);
    z-index: 1;
    transition: all 0.3s ease;
}

.timeline-point:hover .timeline-marker {
    transform: scale(1.5);
}

.timeline-position {
    font-size: 16px;
    font-weight: 600;
    color: #000;
    min-height: 24px;
}

.timeline-time {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* ===================================
   НАСТРОЙКИ ПРОКСИ
   =================================== */

.proxy-source-toggle {
    display: flex;
    gap: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.2s ease;
}

.radio-option:hover {
    color: rgba(255, 255, 255, 1);
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

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

.btn-add-proxy {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-add-proxy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.proxy-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.proxy-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    transform: translateX(4px);
}

.proxy-info {
    flex: 1;
}

.proxy-host {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
}

.proxy-auth {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.proxy-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-delete:hover {
    opacity: 0.8;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    padding: 14px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.form-description {
    color: rgba(255, 255, 255, 0.6);
    margin-top: 8px;
}

/* ===== БАЛАНС АККАУНТА ===== */
.account-balances {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.balance-badge {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.balance-badge.cpa {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.balance-badge.wallet {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.balance-badge .balance-header {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 4px;
}

.balance-badge .balance-amount {
    font-size: 16px;
    font-weight: 600;
}

.balance-badge.cpa .balance-amount {
    color: #16a34a;
}

.balance-badge.wallet .balance-amount {
    color: #0891b2;
}

.balance-badge .balance-loading {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.4);
}

.balance-badge .balance-error {
    font-size: 12px;
    color: #ff6b6b;
}

/* Детальная статистика Avito */
.detail-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.detail-stat-box {
    background: #fff;
    border: 1px solid #000;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.detail-stat-box:hover {
    background: rgba(0, 0, 0, 0.02);
}

.detail-stat-box .stat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-stat-box .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #000;
}

.detail-stat-box .stat-label {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 640px) {
    .detail-stats-grid {
        grid-template-columns: 1fr;
    }
}