/* =============================
   TOP BAR (HEADER)
================================ */

.tl-top-bar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.tl-top-bar-left {
    max-width: 480px;
}

.tl-top-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #6b7280;
    margin-bottom: 4px;
}

.tl-top-title {
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.tl-top-text {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 10px;
}

.tl-top-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.tl-top-meta-item {
    display: flex;
    flex-direction: column;
    font-size: 11px;
}

.tl-top-meta-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9ca3af;
}

.tl-top-meta-value {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

/* Right side */

.tl-top-bar-right {
    min-width: 240px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.tl-period-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #111827;
    font-size: 12px;
}

/* Month filter */

.tl-month-form {
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tl-month-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9ca3af;
}

.tl-month-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tl-month-input {
    max-width: 150px;
    font-size: 13px;
    height: 32px;
    padding: 4px 8px;
}

.tl-month-submit {
    height: 32px;
    padding: 4px 12px;
    font-size: 12px;
}

.tl-month-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tl-month-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #111827;
    text-decoration: none;
}

.tl-month-pill:hover {
    background: #e5e7eb;
    text-decoration: none;
}

.tl-month-pill--active {
    background: #111827;
    border-color: #111827;
    color: #f9fafb;
}

/* =============================
   PODIUM (TOP-3 CARDS)
================================ */

.tl-podium-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.tl-podium-card {
    position: relative;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.tl-podium-card--gold {
    border-color: #facc15;
    box-shadow: 0 12px 26px rgba(234, 179, 8, 0.25);
}

.tl-podium-card--silver {
    border-color: #9ca3af;
    box-shadow: 0 10px 22px rgba(148, 163, 184, 0.18);
}

.tl-podium-card--bronze {
    border-color: #fb923c;
    box-shadow: 0 10px 22px rgba(248, 113, 113, 0.18);
}

.tl-podium-rank-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #6b7280;
}

.tl-podium-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tl-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #111827;
    color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
}

.tl-podium-user-text {
    display: flex;
    flex-direction: column;
}

.tl-podium-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.tl-podium-email {
    font-size: 11px;
    color: #6b7280;
}

.tl-podium-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}

.tl-podium-metric {
    display: flex;
    flex-direction: column;
    font-size: 11px;
}

.tl-podium-label {
    color: #9ca3af;
}

.tl-podium-value {
    color: #111827;
    font-weight: 600;
}

/* =============================
   TABLE CARD (DESKTOP/TABLET)
================================ */

.tl-table-card {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.tl-table-header {
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.tl-table-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.tl-table-hint {
    font-size: 11px;
    color: #6b7280;
}

.tl-table-wrapper {
    max-height: 70vh;
    overflow-y: auto;
}

.tl-table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

/* =============================
   NAME / AVATAR / EMAIL
================================ */

.tl-name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tl-avatar-small {
    width: 30px;
    height: 30px;
    font-size: 13px;
}

.tl-name-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tl-name-main {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tl-name-sub {
    font-size: 11px;
    color: #6b7280;
}

.tl-rank-chip {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
}

/* Email block */

.tl-email-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tl-email-text {
    font-size: 13px;
    word-break: break-all;
}

.tl-impersonate-btn {
    font-size: 11px;
    padding: 2px 8px;
}

/* Короткий текст */

.tl-small {
    font-size: 11px;
    color: #6b7280;
}

/* Кабінети */

.tl-cabinets-badges .badge {
    font-size: 11px;
    margin-right: 4px;
}

/* =============================
   SCORE BADGES (GOOD / MID / BAD)
================================ */

.tl-score-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid transparent;
    white-space: nowrap;
    font-weight: 600;
    gap: 4px;
}

.tl-score-badge i {
    font-size: 12px;
}

/* 🟢 GOOD (високий рейтинг) */
.tl-badge-good {
    background: #dcfce7;
    color: #166534;
    border-color: #22c55e;
}

/* 🟡 MID (середній рейтинг) */
.tl-badge-mid {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

/* 🔴 BAD (поганий рейтинг) */
.tl-badge-bad {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #ef4444;
}

/* Сірий — немає даних */
.tl-badge-empty {
    background: #f3f4f6;
    color: #4b5563;
    border-color: #d1d5db;
}

/* =============================
   MOBILE CARDS
================================ */

.tl-mobile-list {
    display: none; /* показуємо тільки на мобайлі */
    margin-top: 10px;
}

.tl-mobile-card {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: radial-gradient(circle at top left, #eef2ff 0, #ffffff 50%, #f9fafb 100%);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.tl-mobile-card + .tl-mobile-card {
    margin-top: 8px;
}

.tl-mobile-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.tl-mobile-user {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tl-mobile-user-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tl-mobile-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tl-mobile-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.tl-mobile-email {
    font-size: 11px;
    color: #6b7280;
    word-break: break-all;
}

.tl-mobile-ranks {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tl-mobile-rank-text {
    font-size: 11px;
    color: #6b7280;
}

.tl-mobile-head-actions .btn {
    font-size: 11px;
    padding: 3px 8px;
    white-space: nowrap;
}

.tl-mobile-body {
    border-top: 1px dashed #e5e7eb;
    padding-top: 6px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tl-mobile-metric-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.tl-mobile-metric-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    min-width: 72px;
}

.tl-mobile-metric-value {
    flex: 1;
}

.tl-mobile-cabinets {
    margin-top: 4px;
}

.tl-mobile-cabinets-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 2px;
}

.tl-mobile-footer {
    margin-top: 8px;
}

/* =============================
   ADAPTIVE
================================ */

@media (max-width: 991.98px) {
    .tl-top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .tl-top-bar-right {
        align-items: flex-start;
    }

    .tl-table-wrapper {
        max-height: none;
    }
}

@media (max-width: 767.98px) {
    .tl-top-bar {
        padding: 12px 12px;
    }

    .tl-top-title {
        font-size: 20px;
    }

    .tl-top-text {
        font-size: 12px;
    }

    .tl-podium-row {
        grid-template-columns: 1fr;
    }

    .tl-table-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px;
    }

    .tl-table tbody td {
        font-size: 12px;
    }

    /* Головне: на телефоні показуємо картки, ховаємо таблицю */
    .tl-table-card {
        display: none;
    }

    .tl-mobile-list {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .tl-month-row {
        flex-direction: column;
        align-items: stretch;
    }

    .tl-month-input {
        max-width: 100%;
    }

    .tl-month-submit {
        width: 100%;
    }

    .tl-month-pills {
        width: 100%;
    }

    .tl-month-pill {
        flex: 1 1 auto;
        justify-content: center;
    }

    .tl-score-badge,
    .tl-rank-chip {
        font-size: 10px;
        padding: 2px 8px;
    }
}
