.usage-dashboard {
    padding-top: 22px;
    padding-bottom: 34px;
}

.usage-heading {
    margin-bottom: 14px;
}

.usage-heading h1 {
    font-size: 24px;
    line-height: 32px;
}

.usage-heading p {
    margin-top: 3px;
    font-size: 12px;
}

.usage-toolbar {
    min-height: 58px;
    margin-bottom: 14px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-filter {
    width: 148px;
    height: 40px;
    padding: 0 8px;
    color: var(--brand);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 8px;
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.usage-filter:focus-within,
.usage-filter:hover {
    border-color: #9fc4ff;
}

.usage-filter:focus-within {
    box-shadow: 0 0 0 3px rgb(0 82 217 / 8%);
}

.usage-filter > i {
    width: 17px;
    text-align: center;
    font-size: 14px;
}

.usage-filter > span {
    min-width: 0;
    flex: 1;
}

.usage-filter small {
    display: block;
    margin-bottom: 1px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 11px;
}

.usage-filter select {
    width: 100%;
    height: 18px;
    padding: 0 17px 0 0;
    color: var(--text-secondary);
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12px;
    cursor: pointer;
}

.toolbar-spacer {
    min-width: 12px;
    flex: 1;
}

.permission-badge,
.data-updated {
    height: 32px;
    padding: 0 10px;
    color: var(--text-secondary);
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fafbfc;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-size: 12px;
}

.permission-badge {
    color: #426993;
    border-color: #d6e5f7;
    background: #f6faff;
    cursor: pointer;
}

.permission-badge:hover {
    color: var(--brand);
    border-color: #b9d4ff;
    background: var(--brand-soft);
}

.permission-badge i,
.data-updated i {
    color: var(--brand);
    font-size: 12px;
}

.usage-refresh {
    min-height: 32px;
    padding: 0 11px;
    font-size: 12px;
}

.usage-refresh.is-refreshing i {
    animation: usage-spin 0.5s linear;
}

@keyframes usage-spin {
    to {
        transform: rotate(360deg);
    }
}

.usage-metrics {
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.usage-metric {
    min-height: 86px;
    padding: 13px 15px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.16s ease;
}

.usage-metric:hover {
    border-color: #b9d4ff;
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.metric-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 15px;
}

.metric-search {
    color: var(--brand);
    background: var(--brand-soft);
}
.metric-view {
    color: var(--success);
    background: var(--success-soft);
}
.metric-citation {
    color: var(--purple);
    background: var(--purple-soft);
}
.metric-reuse {
    color: var(--warning);
    background: var(--warning-soft);
}

.usage-metric > span:last-child {
    min-width: 0;
}

.usage-metric small,
.usage-metric strong,
.usage-metric em {
    display: block;
}

.usage-metric small {
    color: var(--text-secondary);
    font-size: 12px;
}

.usage-metric strong {
    margin: 2px 0 1px;
    font-size: 23px;
    line-height: 27px;
    letter-spacing: -0.3px;
}

.usage-metric em {
    color: var(--success);
    font-size: 12px;
    font-style: normal;
    white-space: nowrap;
}

.usage-metric em i {
    margin-left: 2px;
    font-size: 12px;
}

.usage-top-grid,
.usage-bottom-grid {
    min-width: 0;
    display: grid;
    gap: 14px;
}

.usage-top-grid {
    grid-template-columns: minmax(410px, 0.82fr) minmax(640px, 1.35fr);
    margin-bottom: 14px;
}

.usage-bottom-grid {
    grid-template-columns: minmax(650px, 1.45fr) minmax(380px, 0.8fr);
    align-items: stretch;
}

.usage-card {
    min-width: 0;
}

.usage-card-header {
    min-height: 45px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.usage-card-header h2 {
    font-size: 13px;
    line-height: 18px;
}

.usage-card-header > span {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.trend-card,
.hot-materials {
    height: 292px;
}

.usage-chart-legend {
    height: 31px;
    padding: 9px 14px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.usage-chart-legend span {
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 12px;
}

.legend-line {
    width: 12px;
    height: 2px;
    border-radius: 2px;
}

.line-search {
    background: var(--brand);
}
.line-view {
    background: var(--success);
}
.line-citation {
    background: var(--purple);
}
.line-reuse {
    background: var(--warning);
}

.usage-line-chart {
    height: 211px;
    padding: 1px 9px 8px 4px;
}

.usage-line-chart svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.chart-grid line {
    stroke: #edf0f4;
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.chart-y-labels text,
.chart-x-labels text {
    fill: #9aa1ad;
    font-size: 12px;
}

.trend-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.search-line {
    stroke: var(--brand);
}
.view-line {
    stroke: var(--success);
}
.citation-line {
    stroke: var(--purple);
}
.reuse-line {
    stroke: var(--warning);
}

.usage-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.usage-table {
    width: 100%;
    border-spacing: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.usage-table th {
    height: 32px;
    padding: 0 7px;
    color: var(--text-muted);
    background: #fafbfc;
    border-bottom: 1px solid var(--line-light);
    text-align: left;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 400;
}

.usage-table td {
    height: 42px;
    padding: 0 7px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--line-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.usage-table tbody tr:last-child td {
    border-bottom: 0;
}

.usage-table tbody tr:hover {
    background: #fafcff;
}

.usage-table button {
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    color: var(--text);
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: inherit;
}

.usage-table button:hover {
    color: var(--brand);
}

.material-table th:first-child,
.material-table td:first-child {
    text-align: center;
}

.material-table th:nth-child(1) {
    width: 6%;
}
.material-table th:nth-child(2) {
    width: 29%;
}
.material-table th:nth-child(3) {
    width: 12%;
}
.material-table th:nth-child(4),
.material-table th:nth-child(5),
.material-table th:nth-child(6),
.material-table th:nth-child(7) {
    width: 8%;
    text-align: center;
}
.material-table th:nth-child(8) {
    width: 13%;
}
.material-table td:nth-child(4),
.material-table td:nth-child(5),
.material-table td:nth-child(6),
.material-table td:nth-child(7) {
    text-align: center;
}
.material-table td:nth-child(8) {
    color: var(--text-muted);
}

.rank {
    width: 18px;
    height: 18px;
    color: #fff;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 12px;
    font-weight: 600;
}

.rank-1 {
    background: #f2a33a;
}
.rank-2 {
    background: #8b9caf;
}
.rank-3 {
    background: #b7794b;
}

.department-source {
    height: 288px;
}

.source-table th:nth-child(1) {
    width: 18%;
}
.source-table th:nth-child(2) {
    width: 15%;
}
.source-table th:nth-child(3),
.source-table th:nth-child(4) {
    width: 10%;
    text-align: center;
}
.source-table th:nth-child(5) {
    width: 19%;
}
.source-table th:nth-child(6) {
    width: 14%;
}
.source-table th:nth-child(7) {
    width: 14%;
}
.source-table td:nth-child(3),
.source-table td:nth-child(4) {
    text-align: center;
}
.source-table td:nth-child(7) button {
    color: var(--brand);
}
.source-table td:nth-child(7) button:hover {
    color: var(--brand-hover);
    text-decoration: underline;
}

.permission-ok {
    color: var(--success);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.permission-ok i {
    width: 5px;
    height: 5px;
    background: var(--success);
    border-radius: 50%;
}

.usage-side-grid {
    height: 288px;
    display: grid;
    grid-template-columns: minmax(145px, 0.72fr) minmax(220px, 1.2fr);
    grid-template-rows: 194px 80px;
    gap: 14px;
}

.hot-libraries,
.recent-updates {
    height: 194px;
}

.hot-libraries ol,
.recent-updates ul {
    margin: 0;
    padding: 8px 13px;
    list-style: none;
}

.hot-libraries li {
    min-height: 45px;
    border-bottom: 1px solid var(--line-light);
    display: flex;
    align-items: center;
    gap: 7px;
}

.hot-libraries li:last-child {
    border-bottom: 0;
}

.hot-libraries .rank {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

.hot-libraries strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-libraries em {
    margin-left: auto;
    color: var(--text);
    font-size: 12px;
    font-style: normal;
}

.recent-updates ul {
    padding-top: 6px;
    padding-bottom: 6px;
}

.recent-updates li {
    min-height: 28px;
    border-bottom: 1px solid var(--line-light);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.recent-updates li:last-child {
    border-bottom: 0;
}

.recent-updates li span {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-updates time {
    color: var(--text-muted);
    white-space: nowrap;
}

.usage-permission-tip {
    grid-column: 1 / -1;
    min-height: 80px;
    padding: 12px 15px;
    color: #55789f;
    border: 1px solid #cfe2ff;
    border-radius: 8px;
    background: #f2f7ff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.usage-permission-tip > i {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    color: var(--brand);
    border-radius: 50%;
    background: #deecff;
    display: grid;
    place-items: center;
    font-size: 15px;
}

.usage-permission-tip strong,
.usage-permission-tip small {
    display: block;
}

.usage-permission-tip strong {
    color: #255e9f;
    font-size: 12px;
}

.usage-permission-tip small {
    margin-top: 5px;
    color: #6d86a2;
    font-size: 12px;
    line-height: 14px;
}

@media (max-width: 1300px) {
    .usage-toolbar {
        flex-wrap: wrap;
    }
    .toolbar-spacer {
        display: none;
    }
    .usage-top-grid {
        grid-template-columns: minmax(380px, 0.85fr) minmax(570px, 1.25fr);
    }
    .usage-bottom-grid {
        grid-template-columns: minmax(610px, 1.45fr) minmax(340px, 0.8fr);
    }
    .usage-side-grid {
        grid-template-columns: minmax(130px, 0.65fr) minmax(198px, 1fr);
    }
}
