.rankings-wrap,
.analytics-wrap {
    padding: 24px 0;
}
.rankings-filter-card,
.analytics-filter-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: var(--shadow-1);
    margin-bottom: 18px;
}

.atc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.atc-title .country-flag-inline {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
    vertical-align: middle;
    margin: 0 6px;
}
.atc-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 15px;
    flex-shrink: 0;
    background: var(--brand-50);
    color: var(--brand);
}

.atc-title {
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink);
    flex: 1;
    min-width: 0;
}

.atc-title .country-flag-inline {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
    vertical-align: middle;
    margin: 0 6px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}
.filter-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}
.country-select-wrap {
    position: relative;
    flex: 2 1 60%;
    min-width: 240px;
}
.country-select-wrap select {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    background: #fff;
    cursor: pointer;
    transition: border-color .15s;
}
.country-select-wrap select:hover,
.country-select-wrap select:focus {
    border-color: var(--brand);
    outline: none;
}
.ts-mode-tabs,
.ts-year-tabs {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ts-mode-tabs .nav-link {
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    background: #fff;
    transition: all .18s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}
.ts-mode-tabs .nav-link:hover {
    border-color: var(--brand-light);
    color: var(--brand);
    background: var(--brand-50);
}
.ts-mode-tabs .nav-link.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 4px 12px rgba(45, 125, 210, .25);
}
.ts-year-tabs .nav-link {
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    background: #fff;
    transition: all .18s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.ts-year-tabs .nav-link:hover {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-soft);
}
.ts-year-tabs .nav-link.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    box-shadow: 0 4px 12px rgba(46, 158, 95, .25);
}
.rankings-table-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-1);
}
.rankings-table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.rankings-table-card thead th {
    background: #f8fafc;
    color: var(--ink-soft);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}
.rankings-table-card thead th.col-num {
    width: 48px;
    text-align: center;
}
.rankings-table-card tbody tr {
    border-bottom: 1px solid #f0f3f7;
    transition: background .12s;
}
.rankings-table-card tbody tr:last-child { border-bottom: none; }
.rankings-table-card tbody tr:hover      { background: #f7fafd; }
.rankings-table-card tbody td {
    padding: 10px 14px;
    color: var(--ink);
    vertical-align: middle;
}
.rankings-table-card tbody td.td-rank {
    text-align: center;
    font-weight: 700;
    color: var(--muted);
    font-size: 13px;
    width: 48px;
}
.rankings-table-card tbody td a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
    transition: color .15s;
}
.rankings-table-card tbody td a:hover {
    color: var(--brand-700);
    text-decoration: underline;
}
.analytics-chart-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px 20px 20px;
    box-shadow: var(--shadow-1);
    margin-bottom: 18px;
}
.analytics-chart-card .chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 14px;
}
.analytics-chart-card .chart-title i { color: var(--brand); }
.chart-canvas-wrap {
    position: relative;
    height: 380px;
    width: 100%;
}
#topCountriesBarChart {
    width:  100% !important;
    height: 100% !important;
}
.chart-axis-flag {
    display: inline-block;
    width: 16px;
    height: 11px;
    margin-right: 4px;
    vertical-align: middle;
}
.analytics-tables-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 24px;
}
.analytics-tables-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.analytics-table-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-1);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
}
.analytics-table-card:hover { box-shadow: var(--shadow-2); }
.analytics-table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.analytics-table-card thead th {
    background: #f8fafc;
    color: var(--ink-soft);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}
.analytics-table-card thead th.col-num   { width: 48px; text-align: center; }
.analytics-table-card thead th.col-count { width: 80px; text-align: right; }
.analytics-table-card tbody tr {
    border-bottom: 1px solid #f0f3f7;
    transition: background .12s;
}
.analytics-table-card tbody tr:last-child { border-bottom: none; }
.analytics-table-card tbody tr:hover      { background: #f7fafd; }
.analytics-table-card tbody td {
    padding: 10px 14px;
    color: var(--ink);
    vertical-align: middle;
}
.analytics-table-card tbody td.td-rank {
    text-align: center;
    font-weight: 700;
    color: var(--muted);
    font-size: 13px;
    width: 48px;
}
.analytics-table-card tbody td.td-count {
    text-align: right;
    font-weight: 700;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    width: 80px;
}
.analytics-table-card tbody td a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
    transition: color .15s;
}
.analytics-table-card tbody td a:hover {
    color: var(--brand-700);
    text-decoration: underline;
}
.sci-row-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.sci-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--brand-50);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(20, 36, 60, .08);
}
.sci-avatar-fallback {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(20, 36, 60, .08);
}
.sci-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.sci-info .sci-name {
    font-weight: 600;
    color: var(--ink);
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sci-info .sci-name a       { color: var(--ink); }
.sci-info .sci-name a:hover { color: var(--brand); }
.sci-info .sci-verified {
    color: var(--brand);
    font-size: 11px;
    margin-left: 4px;
    vertical-align: middle;
}
.sci-info .sci-field {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sci-info .sci-field i {
    margin-right: 4px;
    font-size: 10px;
    color: var(--brand);
}
.inst-cell {
    color: var(--ink-soft);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}
.inst-cell .flag-img {
    margin-right: 6px;
    vertical-align: middle;
}
.flag-img {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}
.country-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.country-cell span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.placeholder-row td {
    color: var(--muted);
    font-style: italic;
}
.rank-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 12px;
}
.rankings-table-card tbody tr:nth-child(1) .rank-pill,
.analytics-table-card  tbody tr:nth-child(1) .rank-pill { background: #fdf5e4; color: var(--gold); }
.rankings-table-card tbody tr:nth-child(2) .rank-pill,
.analytics-table-card  tbody tr:nth-child(2) .rank-pill { background: #f0f3f7; color: #7a8696; }
.rankings-table-card tbody tr:nth-child(3) .rank-pill,
.analytics-table-card  tbody tr:nth-child(3) .rank-pill { background: #fbeee0; color: #b87333; }
@keyframes skeleton-shine {
    0%   { background-position:  200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f0f4f8 0%, #e6ecf3 50%, #f0f4f8 100%);
    background-size: 200% 100%;
    animation: skeleton-shine 1.4s ease-in-out infinite;
    border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; }
}
.chart-skeleton { height: 380px; }
.footer-ad-strip {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 16px 0 24px;

}
.footer-ad-label {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.analytics-empty {
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    color: var(--ink-soft);
}
.analytics-empty i {
    font-size: 32px;
    color: var(--muted);
    margin-bottom: 10px;
    display: block;
}
@media (max-width: 900px) {
    .filter-row { gap: 14px; }
}
@media (max-width: 768px) {
    .analytics-tables-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .rankings-filter-card,
    .analytics-filter-card { padding: 14px; }
    .ts-mode-tabs .nav-link,
    .ts-year-tabs .nav-link { font-size: 12px; padding: 5px 12px; }
    .atc-header { padding: 12px 14px; }
    .atc-title  { font-size: .75rem; }
    .rankings-table-card thead th,
    .rankings-table-card tbody td { padding: 9px 10px; }
    .analytics-chart-card  { padding: 14px 12px 16px; }
    .chart-canvas-wrap     { height: 340px; }
    .analytics-table-card thead th,
    .analytics-table-card tbody td { padding: 9px 10px; }
    .analytics-table-card tbody td.td-rank .rank-pill {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    .sci-avatar,
    .sci-avatar-fallback  { width: 34px; height: 34px; }
    .sci-info .sci-name   { font-size: 13px; }
    .sci-info .sci-field  { font-size: 11px; }
    .inst-cell            { font-size: 12.5px; max-width: 160px; }
}