html, body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: #f5f5f7;
}

.mud-nav-link {
    border-radius: 8px !important;
    margin: 2px 8px !important;
}

.mud-nav-link.active {
    background: rgba(255, 107, 53, 0.15) !important;
    color: #FF6B35 !important;
}

.mud-nav-link .mud-nav-link-text {
    font-size: 0.85rem;
}

.mud-drawer .mud-navmenu .mud-nav-group .mud-nav-link {
    padding-left: 24px !important;
}

.stat-card {
    border-radius: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ══════════════════════ TICKETS (R5) ══════════════════════ */
/* Native HTML/CSS по брендбуку (24px card radius, 100px pill radius,
   Space Grotesk заголовки, Outfit текст). Цель: уйти от MudTable-дефолтов
   и выглядеть консистентно с основным приложением. */

.tk-root { font-family: 'Outfit', sans-serif; }

.tk-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}
.tk-head__title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 28px;
    margin: 0;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 12px;
}
.tk-head__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 10px;
    border-radius: 100px;
    background: #FF6B35;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

/* Фильтры — пилюли под брендбук */
.tk-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.tk-filter-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    border-radius: 100px;
    border: 1px solid rgba(0,0,0,0.06);
}
.tk-filter {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 8px 16px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 32px;
}
.tk-filter:hover { background: rgba(255,107,53,0.08); color: #FF6B35; }
.tk-filter.is-active {
    background: #1a1a1a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Карточка тикета */
.tk-list { display: flex; flex-direction: column; gap: 12px; }
.tk-card {
    background: #fff;
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 20px 24px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}
.tk-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    border-color: rgba(255,107,53,0.35);
}

.tk-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tk-card__icon svg { width: 22px; height: 22px; }

/* Цвет иконки — по типу тикета */
.tk-card__icon--lesson { background: rgba(255,107,53,0.12); color: #FF6B35; }
.tk-card__icon--teacher { background: rgba(124,58,237,0.12); color: #7C3AED; }
.tk-card__icon--complaint { background: rgba(239,68,68,0.12); color: #ef4444; }

.tk-card__body { min-width: 0; }
.tk-card__title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tk-card__id {
    font-size: 12px;
    color: #999;
    font-weight: 500;
}
.tk-card__desc {
    font-size: 13px;
    color: #666;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.tk-card__meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 6px;
    font-size: 12px;
    color: #999;
}

/* Статус-бейдж */
.tk-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.tk-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.tk-status--open { background: rgba(255,107,53,0.12); color: #FF6B35; }
.tk-status--inprogress { background: rgba(59,130,246,0.12); color: #3b82f6; }
.tk-status--resolved { background: rgba(16,185,129,0.12); color: #10b981; }
.tk-status--rejected { background: rgba(107,114,128,0.12); color: #6b7280; }

/* Empty state */
.tk-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    background: #fff;
    border-radius: 24px;
    border: 1px dashed rgba(0,0,0,0.12);
}
.tk-empty svg { width: 48px; height: 48px; opacity: 0.35; margin-bottom: 12px; }
.tk-empty__title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #666;
    margin-bottom: 4px;
}

/* Диалог деталей */
.tk-details { padding: 4px 8px 8px; }
.tk-details__row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 14px;
}
.tk-details__row:last-of-type { border-bottom: 0; }
.tk-details__key {
    color: #999;
    font-weight: 500;
    font-size: 13px;
}
.tk-details__val {
    color: #1a1a1a;
    font-weight: 500;
    word-break: break-word;
}
.tk-details__desc {
    background: #f7f7f8;
    border-radius: 12px;
    padding: 14px 16px;
    color: #333;
    line-height: 1.5;
    margin-top: 12px;
    white-space: pre-wrap;
}

.tk-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.tk-btn {
    appearance: none;
    border: 0;
    padding: 10px 20px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tk-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tk-btn--primary {
    background: linear-gradient(135deg, #FF6B35, #F7931E, #FFB347);
    color: #fff;
    box-shadow: 0 4px 14px -3px rgba(255,107,53,0.5);
}
.tk-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px -3px rgba(255,107,53,0.55);
}
.tk-btn--secondary {
    background: transparent;
    color: #1a1a1a;
    border: 1px solid rgba(0,0,0,0.12);
}
.tk-btn--secondary:hover:not(:disabled) {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.2);
}
.tk-btn--danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.4);
}
.tk-btn--danger:hover:not(:disabled) {
    background: rgba(239,68,68,0.08);
    border-color: #ef4444;
}

/* Бейдж в сайдбаре */
.tk-sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 100px;
    background: #FF6B35;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
}

@media (max-width: 768px) {
    .tk-card {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
    }
    .tk-card > .tk-status { grid-column: 1 / -1; justify-self: start; }
    .tk-details__row { grid-template-columns: 1fr; gap: 4px; }
}

/* ══════════════════════ METRICS (R2) ══════════════════════ */

.mt-root { font-family: 'Outfit', sans-serif; padding-top: 8px; }

.mt-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.mt-head__title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 28px;
    margin: 0;
    color: #1a1a1a;
}
.mt-period {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    border-radius: 100px;
    border: 1px solid rgba(0,0,0,0.06);
}
.mt-period__btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 8px 18px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mt-period__btn:hover { background: rgba(255,107,53,0.08); color: #FF6B35; }
.mt-period__btn.is-active {
    background: #1a1a1a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* KPI cards */
.mt-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.mt-kpi {
    background: #fff;
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 20px 24px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}
.mt-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.mt-kpi__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.mt-kpi__icon svg { width: 20px !important; height: 20px !important; flex-shrink: 0; }
.mt-kpi__icon--orange { background: rgba(255,107,53,0.12); color: #FF6B35; }
.mt-kpi__icon--purple { background: rgba(124,58,237,0.12); color: #7C3AED; }
.mt-kpi__icon--green  { background: rgba(16,185,129,0.12); color: #10b981; }
.mt-kpi__icon--red    { background: rgba(239,68,68,0.12); color: #ef4444; }
.mt-kpi__icon--blue   { background: rgba(59,130,246,0.12); color: #3b82f6; }

.mt-kpi__value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: #1a1a1a;
    line-height: 1;
    margin-bottom: 4px;
}
.mt-kpi__label {
    font-size: 13px;
    color: #999;
    font-weight: 500;
}
.mt-kpi__sub {
    font-size: 12px;
    color: #bbb;
    margin-top: 2px;
}

/* Panels */
.mt-panel {
    background: #fff;
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 24px;
    margin-bottom: 20px;
}
.mt-panel__title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #1a1a1a;
    margin: 0 0 16px;
}
.mt-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Chart bars */
.mt-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding-top: 8px;
}
.mt-chart__bar {
    flex: 1;
    min-width: 0;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #FF6B35 0%, #F7931E 100%);
    transition: height 0.3s ease;
    position: relative;
    cursor: default;
}
.mt-chart__bar:hover { opacity: 0.85; }
.mt-chart__bar[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    margin-bottom: 4px;
}
.mt-chart--purple .mt-chart__bar {
    background: linear-gradient(180deg, #7C3AED 0%, #a78bfa 100%);
}
.mt-chart--green .mt-chart__bar {
    background: linear-gradient(180deg, #10b981 0%, #6ee7b7 100%);
}
.mt-chart--red .mt-chart__bar {
    background: linear-gradient(180deg, #ef4444 0%, #fca5a5 100%);
}
.mt-chart__footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #bbb;
    margin-top: 6px;
}

/* Teachers table */
.mt-teachers { width: 100%; border-collapse: collapse; }
.mt-teachers th {
    text-align: left;
    font-size: 12px;
    color: #999;
    font-weight: 500;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.mt-teachers td {
    padding: 10px 12px;
    font-size: 14px;
    color: #1a1a1a;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.mt-teachers tr:hover td { background: rgba(255,107,53,0.04); }
.mt-teachers__rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,107,53,0.1);
    color: #FF6B35;
    font-weight: 700;
    font-size: 13px;
}
.mt-teachers__rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #f59e0b;
    font-weight: 600;
}

/* Skeleton */
.mt-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: mt-shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes mt-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (max-width: 768px) {
    .mt-grid-2 { grid-template-columns: 1fr; }
    .mt-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .mt-kpi__value { font-size: 22px; }
}
@media (max-width: 480px) {
    .mt-kpi-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════ FUNNEL (R14a) ══════════════════════ */
/* Воронка: KPI-полоса + bar-chart с двумя стэкируемыми значениями
   на неделю (registered = серый фон, activated = оранжевый overlay). */

.mt-funnel-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.mt-funnel-kpi {
    background: #fafafa;
    border-radius: 16px;
    padding: 14px 18px;
    border: 1px solid rgba(0,0,0,0.04);
}
.mt-funnel-kpi__label {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    margin-bottom: 4px;
}
.mt-funnel-kpi__value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: #1a1a1a;
    line-height: 1.1;
}
.mt-funnel-kpi__hint {
    font-size: 11px;
    color: #bbb;
    margin-top: 2px;
}

.mt-funnel-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    padding-top: 8px;
}
.mt-funnel-bar {
    flex: 1;
    min-width: 0;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    cursor: default;
}
.mt-funnel-bar__registered {
    width: 100%;
    background: linear-gradient(180deg, #d4d4d8 0%, #e4e4e7 100%);
    border-radius: 4px 4px 0 0;
    position: relative;
}
.mt-funnel-bar__activated {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, #FF6B35 0%, #F7931E 100%);
    border-radius: 4px 4px 0 0;
}
.mt-funnel-bar:hover .mt-funnel-bar__registered { opacity: 0.85; }
.mt-funnel-bar[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    margin-bottom: 4px;
    z-index: 5;
}
.mt-funnel-legend {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: #888;
}
.mt-funnel-legend__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mt-funnel-legend__chip::before {
    content: '';
    width: 12px; height: 12px;
    border-radius: 3px;
    background: var(--legend-color, #d4d4d8);
}
.mt-funnel-legend__chip--reg::before { background: #d4d4d8; }
.mt-funnel-legend__chip--act::before { background: linear-gradient(180deg, #FF6B35, #F7931E); }

.mt-funnel-trial-note {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(124,58,237,0.06);
    border-radius: 12px;
    font-size: 12px;
    color: #6b48b3;
    border-left: 3px solid #7C3AED;
}

/* ══════════════════════ REFERRALS (R13) ══════════════════════ */

.mt-ref-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.mt-ref-table { width: 100%; border-collapse: collapse; }
.mt-ref-table thead th {
    text-align: left;
    font-size: 12px;
    color: #999;
    font-weight: 500;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.mt-ref-table tbody tr.mt-ref-row {
    cursor: pointer;
    transition: background 0.12s ease;
}
.mt-ref-table tbody tr.mt-ref-row:hover td { background: rgba(255,107,53,0.04); }
.mt-ref-table tbody td {
    padding: 12px;
    font-size: 14px;
    color: #1a1a1a;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.mt-ref-row__caret {
    display: inline-block;
    width: 18px;
    transition: transform 0.18s ease;
    color: #999;
}
.mt-ref-row.is-open .mt-ref-row__caret { transform: rotate(90deg); }

.mt-ref-code {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(124,58,237,0.08);
    color: #7C3AED;
    border-radius: 100px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 12px;
    font-weight: 600;
}
.mt-ref-code--empty {
    background: rgba(0,0,0,0.04);
    color: #999;
}

.mt-ref-students {
    background: #fafafa;
    padding: 0 24px 12px 64px;
}
.mt-ref-students table { width: 100%; border-collapse: collapse; }
.mt-ref-students thead th {
    text-align: left;
    font-size: 11px;
    color: #aaa;
    font-weight: 500;
    padding: 8px 10px;
    border-bottom: 1px dashed rgba(0,0,0,0.08);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mt-ref-students tbody td {
    padding: 10px;
    font-size: 13px;
    color: #1a1a1a;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.mt-ref-students tbody tr:last-child td { border-bottom: 0; }

.mt-ref-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mt-ref-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.mt-ref-badge--attached { background: rgba(16,185,129,0.12); color: #10b981; }
.mt-ref-badge--detached { background: rgba(107,114,128,0.12); color: #6b7280; }

.mt-ref-empty {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 40px 0;
}

@media (max-width: 768px) {
    .mt-funnel-kpis,
    .mt-ref-kpis { grid-template-columns: 1fr; }
    .mt-ref-students { padding: 0 12px 12px; }
    .mt-ref-table th:nth-child(3),
    .mt-ref-table td:nth-child(3) { display: none; }
}
