/* =========================================================
   TrackServe - Partner Agency Performance Stylesheet
   ========================================================= */

/* Compact KPI Summary Cards Grid */
.agencies-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.agencies-stats-grid .stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    min-height: auto !important;
    height: 68px;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.agencies-stats-grid .stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
    border-color: #cbd5e1;
}

.agencies-stats-grid .stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.agencies-stats-grid .stat-card .stat-icon.icon-blue {
    background: #eff6ff;
    color: #2563eb;
}

.agencies-stats-grid .stat-card .stat-icon.icon-sky {
    background: #f0f9ff;
    color: #0284c7;
}

.agencies-stats-grid .stat-card .stat-icon.icon-green {
    background: #ecfdf5;
    color: #059669;
}

.agencies-stats-grid .stat-card .stat-icon.icon-purple {
    background: #f5f3ff;
    color: #7c3aed;
}

.agencies-stats-grid .stat-card .stat-icon.icon-amber {
    background: #fffbeb;
    color: #d97706;
}

.agencies-stats-grid .stat-card .stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.agencies-stats-grid .stat-card .stat-label {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.agencies-stats-grid .stat-card .stat-value {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    letter-spacing: -0.3px;
    margin-top: 1px;
}

.agencies-stats-grid .stat-card .stat-sub {
    font-size: 10px;
    color: #94a3b8;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.agencies-stats-grid .stat-card .top-partner-name {
    font-size: 15px;
    color: #b45309;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Leaderboard Table Enhancements */
.leaderboard-table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
    margin-bottom: 24px;
    overflow: hidden;
}

.leaderboard-table-card .card-heading {
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.leaderboard-table-card .card-heading h2 {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.leaderboard-table-card .card-heading .muted {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.ipcrf-table {
    width: 100%;
    border-collapse: collapse;
}

.ipcrf-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 11px 14px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.ipcrf-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13px;
}

.ipcrf-table tbody tr {
    transition: background-color 0.12s ease;
}

.ipcrf-table tbody tr:hover {
    background-color: #f8fafc;
}

.ipcrf-table tbody tr:last-child td {
    border-bottom: none;
}

/* Rank Pills */
.rank-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 6px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 800;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.rank-pill.rank-gold {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.rank-pill.rank-silver {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

.rank-pill.rank-bronze {
    background: #ffedd5;
    color: #9a3412;
    border-color: #fed7aa;
}

/* Metric Values in Table */
.metric-val {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
}

.served-val {
    color: #059669;
    font-weight: 700;
    font-size: 13px;
    background: #ecfdf5;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #d1fae5;
    display: inline-block;
}

.pipeline-val {
    color: #0284c7;
    font-weight: 700;
    font-size: 13px;
    background: #f0f9ff;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e0f2fe;
    display: inline-block;
}

/* Turnaround Tag */
.turnaround-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* Rating Badges */
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.rating-badge.excellent { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.rating-badge.good { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.rating-badge.needs-coord { background: #fff8e6; color: #b45309; border: 1px solid #fde68a; }

/* Table Agency Avatar & Actions */
.table-agency-cell {
    display: flex;
    align-items: center;
    gap: 11px;
}

.table-agency-avatar {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.table-agency-avatar span {
    font-size: 10px;
    font-weight: 800;
    color: #1e3a8a;
    text-transform: uppercase;
}

.table-agency-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.table-agency-info {
    min-width: 0;
}

.table-agency-acronym {
    display: block;
    color: #0f172a;
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.2;
}

.table-agency-name {
    display: block;
    font-size: 11px;
    color: #64748b;
    line-height: 1.25;
    margin-top: 2px;
}

.table-actions-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.table-action-btn {
    padding: 3px 8px !important;
    font-size: 11px !important;
    height: 25px !important;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.12s ease;
}

/* Compressed Matrix Table Rules to fit screen */
.compressed-matrix-table {
    width: 100%;
    table-layout: auto;
}

.compressed-matrix-table th {
    padding: 8px 10px !important;
    font-size: 10.5px !important;
    white-space: nowrap;
}

.compressed-matrix-table td {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

.compressed-matrix-table .table-agency-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
}

.compressed-matrix-table .table-agency-logo-img {
    width: 22px !important;
    height: 22px !important;
}

.compressed-matrix-table .table-agency-acronym {
    font-size: 12px !important;
    line-height: 1.15;
}

.compressed-matrix-table .table-agency-name {
    font-size: 10px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    margin-top: 1px;
}

.compressed-matrix-table .metric-val {
    font-size: 12px !important;
}

.compressed-matrix-table .served-val,
.compressed-matrix-table .pipeline-val {
    font-size: 11px !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
}

.compressed-matrix-table .turnaround-tag {
    font-size: 10.5px !important;
    padding: 1px 5px !important;
}

.compressed-matrix-table .rating-badge {
    font-size: 10.5px !important;
    padding: 2px 6px !important;
}

.compressed-matrix-table .rank-pill {
    min-width: 24px;
    height: 22px;
    font-size: 10.5px;
}



/* Printable PAC Report Sheet */
.pac-report-sheet {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    padding: 36px 42px;
    max-width: 880px;
    margin: 0 auto;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #0f172a;
    line-height: 1.4;
}

@media print {
    body * {
        visibility: hidden;
    }
    .pac-report-sheet, .pac-report-sheet * {
        visibility: visible;
    }
    .pac-report-sheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
        border: none;
        box-shadow: none;
    }
    .slip-modal-header, .slip-modal-footer, .side-panel-backdrop, .app-shell {
        display: none !important;
    }
}

/* =========================================================
   Partner Agencies Mobile Responsiveness (max-width: 900px)
   ========================================================= */
@media (max-width: 900px) {
    .agencies-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 14px !important;
    }

    .agencies-stats-grid .stat-card {
        height: auto !important;
        min-height: 56px !important;
        padding: 8px 10px !important;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    .agencies-stats-grid .stat-card .stat-icon {
        width: 30px !important;
        height: 30px !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        flex-shrink: 0 !important;
    }

    .agencies-stats-grid .stat-card .stat-info {
        display: flex !important;
        flex-direction: column !important;
        min-width: 0 !important;
        flex: 1 !important;
        overflow: hidden !important;
    }

    .agencies-stats-grid .stat-card .stat-label {
        font-size: 9px !important;
        line-height: 1.15 !important;
        white-space: normal !important;
        overflow: visible !important;
    }

    .agencies-stats-grid .stat-card .stat-value {
        font-size: 15px !important;
        line-height: 1.15 !important;
        margin-top: 1px !important;
    }

    .agencies-stats-grid .stat-card .stat-sub {
        font-size: 8.5px !important;
        line-height: 1.15 !important;
        white-space: normal !important;
        overflow: visible !important;
    }
}

@media (max-width: 480px) {
    .agencies-stats-grid {
        grid-template-columns: 1fr !important;
    }
}

