* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
}

@media (min-width: 768px) {
    .container {
        max-width: 1400px;
        padding: 20px;
    }
}

.header {
    background: linear-gradient(135deg, #cb11ab 0%, #9b11ab 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header h1 {
    font-size: 1.4rem;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .header {
        padding: 20px 30px;
    }
    .header h1 {
        font-size: 1.8rem;
    }
}

.nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Старые стили .nav-link удалены - теперь используется .navbar .nav-link */

.main {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .main {
        padding: 30px;
    }
}

.section {
    margin-bottom: 30px;
}

.section h2 {
    color: #cb11ab;
    margin-bottom: 10px;
}

.description {
    color: #666;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.controls .btn {
    flex: 0 0 auto;
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
    }
    .controls .btn {
        width: 100%;
        justify-content: center;
    }
}

.btn-primary {
    background-color: #cb11ab;
    color: white;
}

.btn-primary:hover {
    background-color: #ab0e8f;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 16px;
}

.btn-settings {
    background: #f0f0f0;
    border: 1px solid #ddd;
    min-width: 40px;
}

.btn-settings:hover {
    background: #cb11ab;
    color: white;
    border-color: #cb11ab;
}

.campaign-card-title {
    cursor: pointer;
    flex: 1;
}

.campaign-card-title:hover .campaign-name {
    color: #cb11ab;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: #666;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e0e0e0;
    border-top-color: #cb11ab;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-message {
    background-color: #ffe6e6;
    color: #cc0000;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Campaigns Grid */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

@media (min-width: 1200px) {
    .campaigns-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 20px;
    }
}

.campaign-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s;
    background: white;
}

.campaign-card:hover {
    border-color: #cb11ab;
    box-shadow: 0 4px 15px rgba(203, 17, 171, 0.2);
}

.campaign-card.selected {
    border-color: #cb11ab;
    background-color: #fff0fa;
}

.campaign-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}

.campaign-id {
    font-size: 12px;
    color: #999;
}

.campaign-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 5px 0;
}

.campaign-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background-color: #e6ffe6;
    color: #008000;
}

.status-paused {
    background-color: #fff3e6;
    color: #ff8000;
}

.status-stopped {
    background-color: #ffe6e6;
    color: #cc0000;
}

.status-draft {
    background-color: #e6e6ff;
    color: #0000cc;
}

.status-completed {
    background-color: #f0f0f0;
    color: #666;
}

.campaign-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 14px;
}

.info-label {
    color: #666;
}

.info-value {
    font-weight: 500;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background-color: #f8f8f8;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.data-table tr:hover {
    background-color: #f8f8f8;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tab:hover {
    color: #cb11ab;
}

.tab.active {
    color: #cb11ab;
    border-bottom-color: #cb11ab;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #cb11ab;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-card.primary {
    background: linear-gradient(135deg, #cb11ab 0%, #9b11ab 100%);
}

.stat-card.success {
    background: linear-gradient(135deg, #11cb99 0%, #0eab8f 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    margin-top: 30px;
}

/* Status Tabs */
.status-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.status-tab {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.status-tab:hover {
    border-color: #cb11ab;
    background: #fff0fa;
}

.status-tab.active {
    border-color: #cb11ab;
    background: #cb11ab;
    color: white;
}

/* Status Stats */
.status-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stat-item {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
}

.stat-item.stat-active {
    background: linear-gradient(135deg, #e6ffe6 0%, #ccffcc 100%);
}

.stat-item.stat-paused {
    background: linear-gradient(135deg, #fff3e6 0%, #ffe6cc 100%);
}

.stat-item.stat-stopped {
    background: linear-gradient(135deg, #ffe6e6 0%, #ffcccc 100%);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

/* Campaign Card Selection */
.campaign-card.selected {
    border-color: #cb11ab;
    background: linear-gradient(135deg, #fff0fa 0%, #ffe6f5 100%);
    box-shadow: 0 4px 15px rgba(203, 17, 171, 0.3);
}

.campaign-card.selected .campaign-card-header {
    position: relative;
}

.campaign-card.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #cb11ab;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

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

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .status-tabs {
        justify-content: center;
    }

    .status-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Campaign Detail Page */
.campaign-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.campaign-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
}

.btn-full-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-full-stats:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-back {
    padding: 8px 16px;
    font-size: 14px;
}

.campaign-info-block {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.campaign-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.campaign-detail-header h3 {
    color: #cb11ab;
    margin: 0;
    font-size: 20px;
}

.campaign-detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #666;
    font-weight: 500;
}

.info-value {
    color: #333;
    font-weight: 600;
}

.nm-section h3 {
    color: #cb11ab;
    margin-bottom: 20px;
}

.nm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.nm-section-header h3 {
    margin: 0;
}

.nm-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Таблица товаров */
.nm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.nm-table th,
.nm-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.nm-table th {
    background-color: #f8f8f8;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.nm-table tr:hover {
    background-color: #f8f8f8;
}

.nm-table tr.expanded {
    background-color: #f0f0ff;
}

.nm-table-row {
    cursor: pointer;
}

.nm-table-row:hover .nm-id-cell {
    color: #cb11ab;
}

.nm-id-cell {
    font-weight: 700;
    color: #333;
}

.nm-subject-cell {
    color: #666;
}

.nm-bid-cell {
    font-weight: 500;
}

.nm-phrases-count-cell {
    font-weight: 600;
}

.nm-phrases-count-cell.zero {
    color: #999;
}

.nm-phrases-count-cell.has {
    color: #cb11ab;
}

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

/* Раскрывающаяся секция с фразами */
.nm-expanded-row td {
    padding: 0;
    background: #f8f9ff;
}

.nm-expanded-content {
    padding: 20px;
}

.nm-expanded-content h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.nm-phrases-wrapper {
    padding: 15px 0;
}

.nm-phrases-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 12px;
    background: #fff;
    transition: border-color 0.2s;
    line-height: 1.5;
}

.nm-phrases-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.nm-phrases-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.phrase-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f2f5;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    border: 1px solid #e0e0e0;
}

.phrase-tag:hover {
    background: #e8eaed;
    border-color: #d0d0d0;
}

.phrase-text {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phrase-tag .remove-phrase-btn {
    background: transparent;
    color: #999;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.phrase-tag .remove-phrase-btn:hover {
    background: #ff4444;
    color: white;
}

.no-phrases {
    color: #999;
    font-style: italic;
    font-size: 13px;
    padding: 8px 0;
}

.nm-phrases-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.load-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #666;
}

.load-status.hidden {
    display: none;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: #cb11ab;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-clusters {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    white-space: nowrap;
}

.btn-clusters:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}


/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
    .modal-content {
        padding: 30px;
    }
}

.modal-large {
    max-width: 1200px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    color: #cb11ab;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 0;
}

.minus-phrases-actions {
    margin-bottom: 15px;
}

.minus-phrases-actions .btn {
    width: 100%;
}

.load-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #666;
}

.load-status.hidden {
    display: none;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: #cb11ab;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.minus-phrases-controls textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
}

.minus-phrases-controls textarea:focus {
    outline: none;
    border-color: #cb11ab;
    box-shadow: 0 0 0 3px rgba(203, 17, 171, 0.1);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.current-phrases h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

.phrases-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.phrase-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f0f0;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
}

.phrase-tag .remove-phrase {
    background: #ff4444;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s;
}

.phrase-tag .remove-phrase:hover {
    background: #cc0000;
}

.no-phrases {
    color: #666;
    font-style: italic;
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .campaign-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .modal-content {
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* Statistics Modal */
.btn-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-stats:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.modal-large {
    max-width: 1200px;
}

.stats-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.date-range label {
    font-weight: 600;
    color: #333;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.date-input:focus {
    outline: none;
    border-color: #667eea;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

@media (min-width: 640px) {
    .stats-summary {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-summary {
        grid-template-columns: repeat(5, 1fr);
        gap: 15px;
    }
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

@media (min-width: 1024px) {
    .stat-card {
        padding: 20px;
    }
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #11cb99 0%, #0eab8f 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #cb11ab 0%, #9b11ab 100%);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
}

@media (min-width: 768px) {
    .stat-value {
        font-size: 28px;
    }
}

.stat-label {
    font-size: 13px;
    opacity: 0.9;
}

.stats-content {
    margin-top: 20px;
}

/* Полная статистика - обновлённые стили */
.full-stats-summary {
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.full-stats-campaigns {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.full-stat-campaign {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.full-stat-campaign h3 {
    color: #cb11ab;
    margin-bottom: 20px;
    font-size: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #cb11ab;
}

.full-stat-campaign h4 {
    color: #cb11ab;
    margin-bottom: 15px;
    font-size: 16px;
}

/* Сводная карточка кампании */
.campaign-summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 15px;
}

.summary-item {
    text-align: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s;
}

.summary-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
}

.summary-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

/* Детализация по дням и приложениям */
.detail-section {
    background: white;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.detail-section summary {
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
    user-select: none;
    transition: all 0.2s;
    font-size: 15px;
}

.detail-section summary:hover {
    background: linear-gradient(90deg, #e9ecef 0%, #dee2e6 100%);
    color: #cb11ab;
}

.detail-section summary::-webkit-details-marker {
    display: none;
}

.detail-section summary::after {
    content: '▼';
    float: right;
    transition: transform 0.3s;
}

.detail-section[open] summary::after {
    transform: rotate(180deg);
}

.days-container,
.items-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Блоки дней */
.stat-block {
    background: #ffffff;
    border-radius: 10px;
    padding: 0;
    border: 2px solid #e0e0e0;
    overflow: hidden;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(90deg, #cb11ab 0%, #a80e8f 100%);
    color: white;
}

.stat-header strong {
    color: white;
    font-size: 15px;
}

.stat-metrics {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.day-header {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.day-header .stat-metrics {
    color: rgba(255, 255, 255, 0.95);
}

/* Блоки приложений */
.app-block {
    margin: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
}

.app-block .stat-header {
    background: linear-gradient(90deg, #119dcb 0%, #0e8ba8 100%);
    border-radius: 6px;
    margin: -15px -15px 15px -15px;
}

/* Таблица детализации */
.stats-detail-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

.stats-detail-table th,
.stats-detail-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.stats-detail-table th {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.stats-detail-table tbody tr {
    transition: background 0.2s;
}

.stats-detail-table tbody tr:hover {
    background: linear-gradient(90deg, #f0f4ff 0%, #e8f0fe 100%);
}

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

.stat-nm .nm-name {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    font-weight: 500;
}

/* Чередование строк */
.stats-detail-table tbody tr:nth-child(odd) {
    background: #fafbfc;
}

.stats-detail-table tbody tr:nth-child(even) {
    background: #ffffff;
}

/* Агрегированные товары */
.full-stat-nm {
    background: #ffffff;
    border-radius: 10px;
    padding: 0;
    border: 2px solid #e0e0e0;
    margin-bottom: 15px;
    overflow: hidden;
}

.full-stat-nm .nm-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #e0e0e0;
}

.full-stat-nm .nm-id {
    font-weight: 700;
    color: #cb11ab;
    font-size: 15px;
    background: #cb11ab;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
}

.full-stat-nm .nm-name {
    color: #666;
    font-size: 14px;
    flex: 1;
}

.nm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
    padding: 20px;
}

.nm-stat {
    text-align: center;
    padding: 12px 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.nm-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #cb11ab;
}

.nm-stat .nm-label {
    font-size: 10px;
    color: #666;
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nm-stat .nm-value {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.no-data {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .full-stat-campaign {
        padding: 15px;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stat-metrics {
        font-size: 11px;
    }
    
    .stats-detail-table {
        font-size: 11px;
    }
    
    .stats-detail-table th,
    .stats-detail-table td {
        padding: 6px 8px;
    }
    
    .nm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stats-table-container {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

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

@media (min-width: 768px) {
    .stats-table {
        font-size: 14px;
    }
}

.stats-table th,
.stats-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .stats-table th,
    .stats-table td {
        padding: 12px 15px;
    }
}

.stats-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    .stats-table th {
        font-size: 13px;
    }
}

.stats-table tr:hover {
    background: #f8f9fa;
}

.stats-table .phrase-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-add-minus {
    background: #ff4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-minus:hover {
    background: #cc0000;
}

/* Efficiency badges */
.efficiency-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.eff-excellent {
    background: #d4edda;
    color: #155724;
}

.eff-good {
    background: #c3e6cb;
    color: #0e4429;
}

.eff-average {
    background: #fff3cd;
    color: #856404;
}

.eff-bad {
    background: #f8d7da;
    color: #721c24;
}

.eff-terrible {
    background: #dc3545;
    color: white;
}

/* Row highlighting */
.phrase-row.eff-excellent {
    background: rgba(212, 237, 218, 0.3);
}

.phrase-row.eff-good {
    background: rgba(195, 230, 203, 0.2);
}

.phrase-row.eff-bad {
    background: rgba(248, 215, 218, 0.3);
}

.phrase-row.eff-terrible {
    background: rgba(220, 53, 69, 0.15);
}

/* Indicators for phrases already in minus */
.phrase-row.in-minus {
    background: rgba(203, 17, 171, 0.08);
}

.minus-indicator {
    display: inline-block;
    margin-right: 8px;
    font-size: 14px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.already-in-minus {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #d4edda;
    color: #155724;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.already-in-minus::before {
    content: '✓';
    font-weight: 700;
}

/* CPC индикаторы */
.cpc-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.cpc-delta {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
}

/* Дорогие клики */
.cpc-value.cpc-very-expensive,
.cpc-value.cpc-very-expensive .cpc-delta {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.cpc-value.cpc-expensive,
.cpc-value.cpc-expensive .cpc-delta {
    color: #fd7e14;
    background: rgba(253, 126, 20, 0.1);
}

/* Нормальная цена */
.cpc-value.cpc-normal {
    color: #333;
}

.cpc-value.cpc-normal .cpc-delta {
    color: #666;
}

/* Дешёвые клики */
.cpc-value.cpc-cheap,
.cpc-value.cpc-cheap .cpc-delta {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.cpc-value.cpc-very-cheap,
.cpc-value.cpc-very-cheap .cpc-delta {
    color: #1e7e34;
    background: rgba(30, 126, 52, 0.1);
}

/* Stats filters */
.stats-filters-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.stats-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

@media (min-width: 768px) {
    .stats-legend {
        gap: 15px;
        padding: 15px;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    flex: 0 0 calc(50% - 5px);
}

@media (min-width: 640px) {
    .legend-item {
        font-size: 13px;
        flex: 0 0 auto;
    }
}

.legend-item span:last-child {
    color: #666;
}

/* Product selection modal */
.select-product-hint {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.select-product-hint strong {
    color: #cb11ab;
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.product-item:hover {
    border-color: #cb11ab;
    background: #fff0fa;
    transform: translateX(5px);
}

.product-nm-id {
    font-weight: 700;
    color: #333;
    font-size: 16px;
}

.product-subject {
    color: #666;
    font-size: 14px;
    flex: 1;
    margin-left: 15px;
}

.product-bid {
    color: #cb11ab;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .product-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .product-subject {
        margin-left: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }

    .nav {
        justify-content: center;
        width: 100%;
    }

    .campaigns-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-filters-row {
        flex-direction: column;
        padding: 12px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        flex: 1;
    }
    
    .date-range {
        flex-direction: column;
        align-items: stretch;
    }

    .date-range .btn {
        width: 100%;
    }
    
    .legend-item {
        flex: 0 0 100%;
    }
    
    .modal-content {
        padding: 15px;
        max-height: 95vh;
    }
    
    .stats-table-container {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .main {
        padding: 15px;
    }
    
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 11px;
    }
}

/* Clusters Modal */
.clusters-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.clusters-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.cluster-stat {
    text-align: center;
    padding: 10px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cluster-stat .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.cluster-stat .stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.clusters-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.clusters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.cluster-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.3s;
}

.cluster-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.cluster-item.selected {
    border-color: #cb11ab;
    background: #fff0fa;
}

.cluster-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.cluster-text {
    flex: 1;
    font-size: 14px;
}

.cluster-type {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.cluster-type.active {
    background: #d4edda;
    color: #155724;
}

.cluster-type.excluded {
    background: #f8d7da;
    color: #721c24;
}

@media (max-width: 768px) {
    .clusters-filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .clusters-actions {
        flex-direction: column;
    }

    .clusters-actions .btn {
        width: 100%;
    }

    .cluster-item {
        flex-wrap: wrap;
    }
}

/* ==================== Аутентификация и Профиль ==================== */

.auth-wrapper {
    max-width: 450px;
    margin: 40px auto;
}

.auth-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.auth-description {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.auth-form input,
.auth-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.auth-form input:focus,
.auth-form textarea:focus {
    outline: none;
    border-color: #cb11ab;
    box-shadow: 0 0 0 3px rgba(203, 17, 171, 0.1);
}

.auth-form textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #666;
}

.btn-block {
    width: 100%;
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.auth-divider span {
    background: white;
    padding: 0 15px;
    position: relative;
    color: #666;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
}

.back-link {
    color: #cb11ab;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* Модальное окно */
.modal {
    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;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

/* Профиль пользователя */
.profile-grid {
    display: grid;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .profile-section:first-child {
        grid-column: 1 / -1;
    }
}

.profile-section .card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.profile-section h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.user-info {
    display: grid;
    gap: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #666;
    font-weight: 500;
}

.info-value {
    color: #333;
    font-weight: 400;
}

/* Статус токена */
.token-status {
    margin-bottom: 20px;
}

.token-form {
    margin-top: 15px;
}

.form-actions {
    margin-top: 20px;
}

.success-box,
.error-box {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.success-box {
    background: #e8f5e9;
    border: 1px solid #4caf50;
}

.error-box {
    background: #fff3e0;
    border: 1px solid #ff9800;
}

.success-box p,
.error-box p {
    margin-bottom: 10px;
}

.error-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px !important;
}

.token-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

/* Список токенов */
.tokens-list {
    margin-top: 15px;
}

.tokens-table {
    overflow-x: auto;
}

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

.tokens-table th,
.tokens-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.tokens-table th {
    background: #f9f9f9;
    font-weight: 600;
    font-size: 0.9rem;
}

.tokens-table tr:hover {
    background: #f9f9f9;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge.status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge.status-inactive {
    background: #ffebee;
    color: #c62828;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    margin-right: 5px;
}

.btn-small.btn-danger {
    background: #f44336;
    color: white;
}

.btn-small.btn-danger:hover {
    background: #d32f2f;
}

.empty-message {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Сообщения */
.message-container {
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-weight: 500;
}

.message-container.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.message-container.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.message-container.info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #2196f3;
}

/* Navbar component */
body .navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body .navbar, body .navbar * {
    box-sizing: border-box;
}

body .navbar .nav-brand a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

body .navbar .nav-brand a:hover {
    opacity: 0.9;
    color: #e94560;
}

body .navbar .nav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

body .navbar .nav-links .nav-link {
    color: #ffffff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 14px;
    white-space: nowrap;
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
}

body .navbar .nav-links .nav-link:hover {
    background-color: #e94560;
    color: #ffffff;
    transform: translateY(-2px);
}

body .navbar .nav-links .nav-link.active {
    background-color: #e94560;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.4);
}

/* User greeting in header */
body .navbar .user-greeting {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(233, 69, 96, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #ffffff;
    border: 1px solid rgba(233, 69, 96, 0.5);
}

@media (max-width: 768px) {
    body .navbar {
        padding: 12px 15px;
    }
    body .navbar .nav-brand a {
        font-size: 1.2rem;
    }
    body .navbar .nav-links {
        width: 100%;
        justify-content: center;
    }
    body .navbar .user-greeting {
        width: 100%;
        justify-content: center;
        order: -1;
        margin-bottom: 10px;
    }
}

/* ==================== Страница статистики - Компактный дизайн ==================== */
.stats-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 8px;
}

@media (min-width: 768px) {
    .stats-container {
        max-width: 1400px;
        padding: 16px;
    }
}

.stats-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
    .stats-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
        margin-bottom: 20px;
    }
}

.stats-dates {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.stats-dates input {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    min-width: 120px;
    height: 32px;
}

@media (min-width: 768px) {
    .stats-dates input {
        font-size: 13px;
        height: 36px;
    }
}

.stats-dates button {
    padding: 6px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    height: 32px;
    transition: background 0.2s;
}

@media (min-width: 768px) {
    .stats-dates button {
        padding: 8px 16px;
        font-size: 13px;
        height: 36px;
    }
}

.stats-dates button:hover {
    background: #2563eb;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

@media (min-width: 480px) {
    .stats-summary {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .stats-summary {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
    }
}

.stat-card {
    background: #fff;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
    border: 1px solid #e2e8f0;
}

@media (min-width: 768px) {
    .stat-card {
        padding: 12px;
    }
}

.stat-card h3 {
    margin: 0 0 4px 0;
    color: #64748b;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .stat-card h3 {
        font-size: 11px;
        margin-bottom: 6px;
    }
}

.stat-card .value {
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
    line-height: 1.2;
}

@media (min-width: 480px) {
    .stat-card .value {
        font-size: 20px;
    }
}

@media (min-width: 768px) {
    .stat-card .value {
        font-size: 24px;
    }
}

.stat-card .value.small {
    font-size: 14px;
}

@media (min-width: 480px) {
    .stat-card .value.small {
        font-size: 16px;
    }
}

@media (min-width: 768px) {
    .stat-card .value.small {
        font-size: 18px;
    }
}

.stats-section {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 16px;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
}

@media (min-width: 768px) {
    .stats-section {
        margin-bottom: 20px;
    }
}

.stats-section h2 {
    margin: 0;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

@media (min-width: 768px) {
    .stats-section h2 {
        padding: 12px 16px;
        font-size: 15px;
    }
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

@media (min-width: 768px) {
    .stats-table {
        font-size: 12px;
    }
}

.stats-table th,
.stats-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .stats-table th,
    .stats-table td {
        padding: 8px 10px;
    }
}

.stats-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

@media (min-width: 768px) {
    .stats-table th {
        font-size: 11px;
    }
}

.stats-table tr:hover {
    background: #f8fafc;
}

.stats-table td.number {
    text-align: right;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
}

@media (min-width: 768px) {
    .stats-table td.number {
        font-size: 12px;
    }
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #3b82f6;
    text-decoration: none;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.date-range-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.date-range-btn {
    padding: 4px 8px;
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
    height: 28px;
}

@media (min-width: 768px) {
    .date-range-btn {
        padding: 6px 10px;
        font-size: 12px;
        height: 32px;
    }
}

.date-range-btn:hover {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.date-range-btn:active {
    transform: translateY(0);
}

/* Легенда метрик - компактная */
.metrics-legend {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
    font-size: 11px;
}

@media (min-width: 768px) {
    .metrics-legend {
        padding: 12px;
        font-size: 12px;
        margin-bottom: 16px;
    }
}

.metrics-legend-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

@media (min-width: 480px) {
    .metrics-legend-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .metrics-legend-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .metrics-legend-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Страница минус-фраз и кластеров - компактный дизайн */
.minus-phrases-header,
.clusters-header {
    background: #fff;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
}

@media (min-width: 768px) {
    .minus-phrases-header,
    .clusters-header {
        padding: 16px;
        margin-bottom: 16px;
    }
}

.nm-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.nm-header {
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 768px) {
    .nm-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
    }
}

.nm-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

@media (min-width: 768px) {
    .nm-header h3 {
        font-size: 14px;
    }
}

.nm-body {
    padding: 10px;
}

@media (min-width: 768px) {
    .nm-body {
        padding: 14px;
    }
}

.minus-phrase-list,
.cluster-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.minus-phrase-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .minus-phrase-item {
        gap: 8px;
        padding: 8px 0;
    }
}

.minus-phrase-item:last-child {
    border-bottom: none;
}

.minus-phrase-text {
    flex: 1;
    font-size: 12px;
    word-break: break-word;
    color: #334155;
}

@media (min-width: 768px) {
    .minus-phrase-text {
        font-size: 13px;
    }
}

.add-phrase-form {
    margin-top: 10px;
}

.add-phrase-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 6px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .add-phrase-form textarea {
        min-height: 80px;
        font-size: 13px;
    }
}

.add-phrase-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-hint {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
}

@media (min-width: 768px) {
    .form-hint {
        font-size: 12px;
    }
}

/* Навигационные вкладки - компактные */
.nav-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.nav-tab {
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    color: #475569;
    transition: all 0.15s;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 500;
}

@media (min-width: 768px) {
    .nav-tab {
        padding: 8px 14px;
        font-size: 13px;
    }
}

.nav-tab:hover {
    background: #e2e8f0;
}

.nav-tab.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Страница кластеров - компактная */
.cluster-section {
    margin-bottom: 12px;
}

.cluster-section h4 {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

@media (min-width: 768px) {
    .cluster-section h4 {
        font-size: 13px;
    }
}

.cluster-item {
    padding: 6px 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    word-break: break-word;
}

@media (min-width: 768px) {
    .cluster-item {
        padding: 8px 12px;
        font-size: 13px;
    }
}

.cluster-item:last-child {
    border-bottom: none;
}

.cluster-item.active {
    background: #dcfce7;
    color: #166534;
}

.cluster-item.excluded {
    background: #fee2e2;
    color: #991b1b;
}

.cluster-info {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 11px;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .cluster-info {
        gap: 8px;
        font-size: 12px;
    }
}

.cluster-info-item {
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 4px;
    font-weight: 500;
}

.cluster-info-item strong {
    color: #1e293b;
}

.empty-state {
    text-align: center;
    padding: 24px;
    color: #64748b;
    font-size: 13px;
}

@media (min-width: 768px) {
    .empty-state {
        padding: 32px;
    }
}

/* Бейджи - компактные */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
}

@media (min-width: 768px) {
    .badge {
        padding: 4px 10px;
        font-size: 11px;
    }
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Кнопки в таблицах - компактные */
.btn-sm {
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-weight: 500;
}

@media (min-width: 768px) {
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Строка минус-фразы */
.minus-phrase-row {
    background-color: #fee2e2 !important;
}

.minus-phrase-row:hover {
    background-color: #fecaca !important;
}

/* Анимации уведомлений */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ==================== Страница задач ==================== */
.tasks-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.task-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.task-card h3 {
    margin: 0 0 15px 0;
    color: #1e293b;
    font-size: 16px;
}

.task-info {
    margin-bottom: 15px;
}

.task-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.task-info-row:last-child {
    border-bottom: none;
}

.task-info-label {
    color: #64748b;
}

.task-info-value {
    color: #1e293b;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #f1f5f9;
    color: #64748b;
}

.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
}

.modal-close:hover {
    color: #1e293b;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-hint {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.history-table th,
.history-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.history-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.history-table tr:hover {
    background: #f8fafc;
}
