:root {
    --primary: #2d1b4a;
    --accent: #7c3aed;
    --accent-light: #ede9fe;
    --accent-hover: #6d28d9;
    --bg: #f5f0f8;
    --card-bg: #ffffff;
    --text: #2d1b4a;
    --text-secondary: #6b5a8a;
    --border: #e5dce8;
    --shadow-sm: 0 1px 3px rgba(45,27,74,0.04);
    --shadow-md: 0 4px 16px rgba(124,58,237,0.06);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.2s ease;
}

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

html, body {
    height: 100%;
    width: 100%;
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    justify-content: center;
}

.app {
    width: 100%;
    max-width: 1400px;
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

/* ===== Верхнє меню ===== */
.topbar {
    background: var(--card-bg);
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    flex-shrink: 0;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 32px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-icon { font-size: 24px; }
.logo-text {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
}
.logo-text .highlight {
    color: var(--accent);
    font-weight: 700;
}
.top-nav {
    display: flex;
    gap: 4px;
}
.top-nav .nav-item {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-nav .nav-item i { font-size: 14px; }
.top-nav .nav-item:hover {
    background: var(--accent-light);
    color: var(--text);
}
.top-nav .nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.search-box {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 4px 14px;
    gap: 8px;
}
.search-box i {
    color: var(--text-secondary);
    font-size: 14px;
}
.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 400;
    min-width: 160px;
}
.search-box input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.btn-icon {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.btn-refresh {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-refresh:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.2);
}

/* ===== Контент ===== */
.content {
    padding: 24px 32px 16px;
    flex: 1;
}

/* ===== Метрики ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.stat-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.stat-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--accent);
}
.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}
.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== Графік ===== */
.chart-section {
    margin-bottom: 28px;
}
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-header h3 i { color: var(--accent); }
.chart-badge {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 4px 14px;
    border-radius: 30px;
    border: 1px solid var(--border);
    font-weight: 400;
}
.chart-container {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 130px;
    overflow-x: auto;
    border: 1px solid var(--border);
}
.chart-bar {
    flex: 1;
    min-width: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.chart-bar .bar {
    width: 100%;
    max-width: 40px;
    background: var(--accent);
    border-radius: 4px 4px 0 0;
    transition: height 0.6s ease;
    min-height: 4px;
}
.chart-bar .bar.high { background: #34d399; }
.chart-bar .bar.low { background: #f87171; }
.chart-bar .bar-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== Оператори ===== */
.operators-section { margin-bottom: 24px; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-header h2 i { color: var(--accent); }
.section-count {
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 14px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
}

.operators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
}

.operator-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px 18px 16px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.operator-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.operator-card .avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}
.operator-card .name {
    font-size: 17px;
    font-weight: 600;
}
.operator-card .stats-row {
    display: flex;
    gap: 12px;
    margin: 8px 0 12px;
    flex-wrap: wrap;
}
.operator-card .stats-row span {
    background: var(--bg);
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}
.operator-card .stats-row span i { margin-right: 4px; color: var(--accent); }
.operator-card .top-tag {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 14px;
}
.operator-card .top-tag strong {
    color: var(--text);
    font-weight: 600;
}

.operator-card .btn-profile {
    margin-top: auto;
    background: var(--bg);
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.operator-card .btn-profile:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(124,58,237,0.15);
}

/* ===== Футер ===== */
.footer {
    background: var(--card-bg);
    color: var(--text-secondary);
    padding: 12px 32px;
    font-size: 13px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: auto;
}
.footer-inner { text-align: center; }
.footer i { color: var(--accent); }

.loading-text {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 15px;
}

/* ===== Адаптивність ===== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .topbar { padding: 12px 16px; flex-direction: column; align-items: stretch; }
    .topbar-left { flex-direction: column; align-items: stretch; gap: 12px; }
    .top-nav { flex-wrap: wrap; }
    .content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .operators-grid { grid-template-columns: 1fr; }
    .search-box input { min-width: 120px; }
}
/* Додаткові стилі для таблиці в профілі */
.table-wrap {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 700px;
}
.table-wrap thead th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
}
.table-wrap thead th i { margin-right: 6px; }
.table-wrap tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td { background: var(--accent-light); }
