/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    display: flex;
    min-height: 100vh;
}
a { color: #4a7cf7; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: width 0.2s;
}
.sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}
.sidebar-logo .logo-text {
    font-weight: 700;
    font-size: 16px;
    color: #333;
}
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}
.sidebar-nav .nav-section {
    padding: 12px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.5px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.15s;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: #f5f7fa;
    color: #333;
    text-decoration: none;
}
.sidebar-nav a.active {
    background: #f0f4ff;
    color: #4a7cf7;
    border-left-color: #4a7cf7;
    font-weight: 600;
}
.sidebar-nav a .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}
.sidebar-nav a .nav-badge {
    margin-left: auto;
    background: #ff5252;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #999;
}
.topbar-breadcrumb a { color: #999; }
.topbar-breadcrumb a:hover { color: #333; }
.topbar-breadcrumb .current { color: #333; font-weight: 600; }
.topbar-breadcrumb .sep { color: #ccc; }
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}
.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: #666;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px;
    flex: 1;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

/* ===== STAT CARDS (верхние карточки как на скринах) ===== */
.stat-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    min-width: 160px;
    border: 1px solid #e8e8e8;
    flex-shrink: 0;
}
.stat-card.accent-green { border-left: 3px solid #4caf50; }
.stat-card.accent-blue { border-left: 3px solid #2196f3; }
.stat-card.accent-orange { border-left: 3px solid #ff9800; }
.stat-card.accent-red { border-left: 3px solid #f44336; }
.stat-card.accent-purple { border-left: 3px solid #9c27b0; }
.stat-card .stat-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
    font-weight: 500;
}
.stat-card .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}
.stat-card .stat-sub {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background: #fff;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}
.filter-btn:hover { border-color: #4a7cf7; color: #4a7cf7; }
.filter-btn.active {
    background: #4a7cf7;
    color: #fff;
    border-color: #4a7cf7;
}
.filter-btn.green.active { background: #4caf50; border-color: #4caf50; }
.filter-btn.orange.active { background: #ff9800; border-color: #ff9800; }
.filter-btn.red.active { background: #f44336; border-color: #f44336; }

.filter-input {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    background: #fff;
}
.filter-input:focus { border-color: #4a7cf7; }
.filter-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #fff;
    cursor: pointer;
}

/* ===== TABLE ===== */
.data-table-wrapper {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
.data-table thead th {
    background: #fafbfc;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #e8e8e8;
    white-space: nowrap;
    width: auto;
}
.data-table tbody td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    vertical-align: middle;
    white-space: nowrap;
}
.data-table tbody td.wrap { white-space: normal; word-break: break-word; }
.data-table tbody td.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}
.data-table tbody tr { cursor: default; }
.data-table tbody tr:hover { background: #f8f9ff; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: #eef2ff; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Detail card */
.detail-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    padding: 24px;
    margin-bottom: 20px;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.detail-item { }
.detail-label {
    font-size: 12px;
    color: #999;
    font-weight: 500;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.detail-value {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-blue { background: #e3f2fd; color: #1565c0; }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-red { background: #fce4ec; color: #c62828; }
.badge-gray { background: #f5f5f5; color: #757575; }
.badge-purple { background: #f3e5f5; color: #7b1fa2; }
.badge-yellow { background: #fffde7; color: #f57f17; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary { background: #4a7cf7; color: #fff; }
.btn-primary:hover { background: #3a6ae0; }
.btn-secondary { background: #f5f5f5; color: #555; border: 1px solid #ddd; }
.btn-secondary:hover { background: #e8e8e8; }
.btn-success { background: #4caf50; color: #fff; }
.btn-success:hover { background: #43a047; }
.btn-danger { background: #f44336; color: #fff; }
.btn-danger:hover { background: #e53935; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #e8e8e8;
    font-size: 13px;
    color: #888;
}
.pagination-pages {
    display: flex;
    gap: 4px;
}
.pagination-pages button {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}
.pagination-pages button.active {
    background: #4a7cf7;
    color: #fff;
    border-color: #4a7cf7;
}

/* ===== MONEY COLORS ===== */
.money-positive { color: #2e7d32; font-weight: 600; }
.money-negative { color: #c62828; font-weight: 600; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 15px; }

/* ===== TABLE INFO ROW ===== */
.table-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #e8e8e8;
    font-size: 13px;
    color: #888;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .logo-text,
    .sidebar .nav-section,
    .sidebar-nav a span:not(.nav-icon) { display: none; }
    .sidebar-nav a { justify-content: center; padding: 12px; }
    .main-content { margin-left: 60px; }
    .stat-cards { flex-direction: column; }
    .page-content { padding: 16px; }
}
