/* =============================================
   Usage Statistics — 1:1 复刻 usage-statistics.html
   ============================================= */

#usOverlay {
    position: fixed;
    inset: 0;
    left: 260px;
    z-index: 1040;
    display: none;
    overflow-y: auto;
    background: #0c0c0c;
    color: #fff;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
#usOverlay.visible { display: block; }

#usClose {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 10;
    display: flex;
    align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border: none; border-radius: 50%;
    background: rgba(26, 26, 26, 0.85);
    color: #999;
    cursor: pointer;
}
#usClose:hover { background: rgba(31, 31, 31, 0.9); color: #fff; }
#usClose svg { width: 18px; height: 18px; }

/* ── 主容器（grid 布局，gap 同参考） ── */
.us-container {
    display: grid;
    gap: 1.5rem;
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
    min-width: 0;
}
@media (min-width: 640px) { .us-container { padding: 4rem; } }

/* ── 头部 ── */
.us-header { max-width: 1000px; }

.us-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.125rem;
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 500;
}
@media (min-width: 768px) { .us-title-row { font-size: 1.25rem; } }
.us-title-row svg { width: 20px; height: 20px; color: #6b6b6b; }

.us-desc { font-size: 0.875rem; color: #999; }

.us-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.us-btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 0.5rem;
    height: 2.5rem;
    padding: 0 2.5rem;
    border: none; border-radius: 9999px;
    font-size: 0.875rem; font-weight: 350;
    background: #272727; color: #fff;
    cursor: pointer; white-space: nowrap;
    transition: background-color 0.15s;
}
.us-btn:hover { background: rgba(39,39,39,0.8); }
.us-btn:active { transform: scale(0.98); }
.us-btn svg { width: 1rem; height: 1rem; }

/* ── 日期筛选 ── */
.us-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; }
@media (min-width: 768px) { .us-filters { gap: 1rem; } }
.us-filter-group { width: 100%; }
@media (min-width: 640px) { .us-filter-group { width: auto; } }

.us-filter-label {
    display: block; margin-bottom: 0.375rem;
    font-size: 0.875rem; font-weight: 500; color: #d4d4d4;
}

.us-filter-select {
    display: flex; align-items: center;
    gap: 0.5rem; height: 2.25rem; padding: 0.5rem 0.75rem;
    border: 1px solid #404040; border-radius: 0.375rem;
    background: rgba(64, 64, 64, 0.3); color: #fff;
    font-size: 0.875rem; cursor: pointer; white-space: nowrap;
    transition: box-shadow 0.15s, background-color 0.15s;
    outline: none;
}
.us-filter-select:hover { background: rgba(64, 64, 64, 0.5); }
@media (min-width: 640px) { .us-filter-select { width: 160px; } }
.us-filter-icon { width: 1rem; height: 1rem; opacity: 0.5; flex-shrink: 0; }
.us-filter-chevron { width: 1rem; height: 1rem; opacity: 0.5; flex-shrink: 0; margin-left: auto; }

/* ── 日期下拉菜单 ── */
.us-dropdown {
    position: absolute;
    top: 100%; left: 0;
    margin-top: 4px;
    min-width: 160px;
    padding: 0.25rem;
    border-radius: 0.5rem;
    background: rgba(26, 26, 26, 0.95);
    border: 0.5px solid rgba(64, 64, 64, 0.5);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 10;
    overflow: hidden;
}
.us-dropdown-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #fff;
    border-radius: 0.125rem;
    cursor: pointer;
    transition: background-color 0.15s;
}
.us-dropdown-item:hover { background-color: #2D2D2D; }

/* ── 统计卡片 ── */
.us-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    min-width: 0;
}
@media (min-width: 640px) { .us-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .us-cards { grid-template-columns: repeat(3, 1fr); } }

.us-card {
    padding: 1rem;
    border: 1px solid #1f1f1f;
    border-radius: 0.5rem;
    background: rgba(20, 20, 20, 0.5);
}

.us-card-header {
    display: flex; align-items: center; justify-content: space-between;
}
.us-card-title { font-size: 0.875rem; font-weight: 500; color: #999; }
.us-card-icon { width: 1rem; height: 1rem; color: #6b6b6b; }

.us-card-value {
    margin-top: 0.25rem;
    font-size: 1.5rem; font-weight: 700;
}
.us-card-sub { margin-top: 0.25rem; font-size: 0.75rem; color: #999; }

/* ── 图表区 ── */
.us-chart-wrap {
    padding: 1.5rem;
    border: 1px solid #1f1f1f;
    border-radius: 0.5rem;
    background: rgba(20, 20, 20, 0.5);
    min-width: 0;
}
.us-chart-title { margin-bottom: 1rem; font-size: 1.125rem; font-weight: 500; color: #d4d4d4; }

.us-chart-outer {
    display: flex;
    position: relative;
    height: 300px;
    width: 100%;
    overflow: hidden;
}

/* Y 轴 */
.us-chart-yaxis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 40px;
    flex-shrink: 0;
    padding-bottom: 2rem;
}
.us-chart-ytick { font-size: 11px; color: #999; text-align: right; padding-right: 8px; line-height: 0; }

/* 柱状图区域 */
.us-chart-area {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 2rem;
    padding: 0 0 2rem 0;
    position: relative;
    border-left: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* 水平网格线 */
.us-chart-grid {
    position: absolute;
    inset: 0 0 2rem 0;
    pointer-events: none;
}
.us-chart-gridline {
    position: absolute;
    left: 0; right: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.us-chart-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    position: relative;
    z-index: 1;
}

.us-chart-bars {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
}

.us-chart-bar {
    width: 40%;
    max-width: 64px;
    border-radius: 2px 2px 0 0;
}

.us-chart-label { margin-top: 0.5rem; font-size: 10px; color: #999; text-align: center; }

.us-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 1rem; }
.us-legend-item { display: flex; align-items: center; gap: 0.375rem; }
.us-legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.us-legend-label { font-size: 0.75rem; color: #999; }

/* ── 任务历史 ── */
.us-table-wrap {
    padding: 1.5rem;
    border: 1px solid #1f1f1f;
    border-radius: 0.5rem;
    background: rgba(20, 20, 20, 0.5);
    min-width: 0;
}
.us-table-title { margin-bottom: 1rem; font-size: 1.125rem; font-weight: 500; color: #d4d4d4; }

.us-search-wrap { position: relative; width: 100%; margin-bottom: 1rem; }
@media (min-width: 640px) { .us-search-wrap { width: 16rem; } }
.us-search-input {
    width: 100%; height: 2.25rem;
    padding: 0.375rem 0.75rem 0.375rem 2.25rem;
    border: 1px solid transparent; border-radius: 0.375rem;
    background: #141414; color: #fff;
    font-size: 0.875rem; outline: none;
}
.us-search-input:focus { border-color: oklch(48.8% .243 264.376); box-shadow: 0 0 0 2px oklch(48.8% .243 264.376); }
.us-search-input::placeholder { color: #6b6b6b; }
.us-search-icon {
    position: absolute; top: 50%; left: 0.75rem;
    transform: translateY(-50%);
    width: 1rem; height: 1rem; color: #6b6b6b;
}

.us-table-border { overflow-x: auto; border: 1px solid transparent; border-radius: 0.375rem; background: #0f0f0f; }

.us-table { width: 100%; border-collapse: collapse; }
.us-table th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem; font-weight: 500;
    text-align: left; white-space: nowrap;
    background: #141414; color: #fff;
    position: sticky; top: 0;
}
@media (min-width: 640px) { .us-table th { font-size: 0.875rem; } }

.us-table td {
    padding: 0.75rem 1rem;
    font-size: 0.75rem; white-space: nowrap;
    border-top: 1px solid #1a1a1a;
}
@media (min-width: 640px) { .us-table td { font-size: 0.875rem; } }
.us-table tbody tr:hover td { background: #1a1a1a; }

.col-date { width: 35%; color: #999; }
.col-tool { width: 25%; }
.us-table th.col-cost { text-align: right; }
.us-table td.col-cost { text-align: right; }
.col-cost { width: 40%; font-weight: 500; font-variant-numeric: tabular-nums; }
.col-cost .th-sort { display: flex; margin-left: auto; }

.th-sort {
    display: inline-flex; align-items: center; gap: 0.25rem;
    cursor: pointer; border: none; background: none;
    color: #fff; font: inherit;
}
.th-sort svg { width: 1rem; height: 1rem; }

.us-tool-badge {
    display: inline-flex; align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px; border: 1px solid;
    font-size: 0.75rem; font-weight: 500;
}

/* ── 分页 ── */
.us-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem; border-top: 1px solid #1a1a1a; background: #141414;
}
.us-page-left { display: flex; align-items: center; gap: 1rem; }
.us-page-show { display: flex; align-items: center; gap: 0.5rem; }
.us-page-show span { font-size: 0.875rem; color: #d4d4d4; }
.us-page-info { font-size: 0.875rem; color: #d4d4d4; }
.us-page-total { font-size: 0.875rem; color: #6b6b6b; }

.us-page-right { display: flex; align-items: center; gap: 0.5rem; }
.us-page-btn {
    display: flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem;
    border: 1px solid rgba(58,58,58,0.5); border-radius: 0.375rem;
    background: #1f1f1f; color: #d4d4d4; cursor: pointer;
}
.us-page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.us-page-btn:hover:not(:disabled) { background: #3a3a3a; }
.us-page-btn svg { width: 1rem; height: 1rem; }

.us-page-select {
    padding: 0.25rem 0.5rem; padding-right: 1.75rem;
    border: 1px solid rgba(58,58,58,0.5); border-radius: 0.375rem;
    background: #1f1f1f; color: #fff; font-size: 0.875rem;
    appearance: auto; -webkit-appearance: auto;
}

[data-placeholder] {
    opacity: 0.35;
    pointer-events: none;
}
