    :root {
      --bg: #f4f5f7;
      --bg-card: #ffffff;
      --bg-soft: #f9fafb;
      --text: #111827;
      --text-muted: #6b7280;
      --border: #e5e7eb;
      --border-dark: #d8dce4;
      --primary: #2563eb;
      --primary-soft: #dbeafe;
      --radius: 14px;
      --shadow-soft: 0 10px 25px rgba(15,23,42,0.08);

      --sticky-left-width-1: 40px;   /* колонка # */
      --sticky-left-width-2: 180px;  /* колонка Менеджер */
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
      background: var(--bg);
      color: var(--text);
    }

    .page {
      max-width: 1400px;
      margin: 24px auto 40px;
      padding: 0 16px;
    }

    .header {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 16px;
      margin-bottom: 18px;
    }

    .title {
      font-size: 28px;
      font-weight: 700;
      letter-spacing: -0.02em;
    }

    .subtitle {
      font-size: 14px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    .header-info {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
    }

    .badge {
      padding: 6px 10px;
      border-radius: 999px;
      background: var(--primary-soft);
      color: var(--primary);
      font-size: 12px;
      white-space: nowrap;
    }

    /* Фильтры */
    .filters {
      background: var(--bg-card);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      box-shadow: var(--shadow-soft);
      padding: 16px 18px;
      margin-bottom: 18px;
    }

   
    .filters-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .filter {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 12px;
    }

    /* Блок с менеджерами на всю ширину */
    .filter--managers {
      grid-column: 1 / -1; /* растянуть от первой до последней колонки */
    }

    .filter label {
      color: var(--text-muted);
    }

    .filter input,
    .filter select {
      height: 34px;
      padding: 0 10px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--bg-soft);
      font-size: 13px;
      color: var(--text);
      outline: none;
      transition: 0.2s ease;
    }

    .filter input:focus,
    .filter select:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 1px var(--primary-soft);
    }

    .btn {
      padding: 9px 16px;
      border-radius: 8px;
      border: none;
      background: var(--primary);
      color: #fff;
      font-weight: 500;
      font-size: 14px;
      cursor: pointer;
    }

    .btn:hover {
        background: #05308b;
        color: #ffffff!important;
    }


    .btn-reset {
        padding: 9px 16px;
        background: #f3f4f6;
        border: 1px solid #d1d5db;
        color: #374151;
        border-radius: 8px;
        font-size: 14px;
        cursor: pointer;
        font-weight: 500;
        transition: background 0.2s ease, color 0.2s ease;
    }

    .btn-reset:hover {
        background: #e5e7eb;
        color: #111827;
    }


    /* KPI */
    .kpi-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 20px;
      margin-top: 20px;
    }

    .kpi {
      background: var(--bg-card);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      box-shadow: var(--shadow-soft);
      padding: 12px 14px;
    }

    .kpi-label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--text-muted);
      margin-bottom: 4px;
    }

    .kpi-value {
      font-size: 19px;
      font-weight: 700;
      margin-bottom: 2px;
    }

    .kpi-sub {
      font-size: 12px;
      color: var(--text-muted);
    }

    /* Графики */
    .charts-grid {
      display: grid;
      grid-template-columns: 2fr 2fr 2fr;
      gap: 12px;
      margin-bottom: 18px;
    }

    .chart-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      box-shadow: var(--shadow-soft);
      padding: 10px 12px 6px;
    }

    .chart-title {
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 4px;
    }

    .chart-sub {
      font-size: 11px;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    .chart {
      width: 100%;
      height: 220px;
    }

    /* Таблица */
    .table-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      box-shadow: var(--shadow-soft);
      overflow: hidden;
      padding: 20px 15px 40px;
    }

    .table-header {
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      font-size: 13px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .table-header span {
      color: var(--text-muted);
      font-size: 12px;
    }

    .table-wrapper {
      overflow-x: auto;
      width: 100%;
    }


    table {
      border-collapse: collapse;
      width: 2400px; /* для 24 столбцов */
      font-size: 14px;
      margin-bottom: 20px;
    }

    th, td {
      padding: 10px 8px;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
      background: #fff;
      text-align: center;
    }

    .table-card table th, 
    .table-card table td {
      border: 1px solid var(--border-dark);
    }

    th {
      background: var(--bg-soft);
      font-size: 14px;
      color: var(--text);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      position: sticky;
      top: 0;
      z-index: 10;
    }

    tbody tr:nth-child(even) td {
      background: #f9fafb;
    }

    tbody tr:hover td {
      background: var(--primary-soft);
    }

    /* sticky колонки # и Менеджер */
    th:nth-child(1),
    td:nth-child(1) {
      position: sticky;
      left: 0;
      width: var(--sticky-left-width-1);
      z-index: 11;
    }

    th:nth-child(2),
    td:nth-child(2) {
      position: sticky;
      left: var(--sticky-left-width-1);
      width: var(--sticky-left-width-2);
      z-index: 10;
    }

    th:nth-child(1),
    th:nth-child(2),
    td:nth-child(1),
    td:nth-child(2) {
      background: var(--bg-card);
    }

    .num {
      font-variant-numeric: tabular-nums;
    }

    .money {
      font-variant-numeric: tabular-nums;
    }

    .pill {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 999px;
      background: var(--primary-soft);
      color: var(--primary);
      font-size: 11px;
    }

    .sparkline {
      width: 80px;
      height: 26px;
    }

    .key-stage {
      font-weight: 600;
      margin-bottom: 2px;
      font-size: 11px;
    }

    @media (max-width: 1024px) {
      .header {
        flex-direction: column;
        align-items: flex-start;
      }
      .filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .charts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 768px) {
      .filters-grid {
        grid-template-columns: minmax(0, 1fr);
      }
      .kpi-row {
        grid-template-columns: minmax(0, 1fr);
      }
      .charts-grid {
        grid-template-columns: minmax(0, 1fr);
      }
    }





    /* loader */

#loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(3px);
}

#loader-overlay.show {
    display: flex; /* <-- лучший вариант вместо block */
}


/* Спиннер */
.loader-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Плавное появление */
#loader-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}



.filter select.filter-pending {
    border: 1px solid #d9534f; /* красный */
    transition: border-color .3s ease;
}

.filter select.filter-success {
    border: 1px solid #5cb85c; /* зелёный */
    transition: border-color .3s ease;
}
