/* /console 概览页「仪表盘」区块（对齐 Sub2API 自带用户面板的功能，版式走 lanox 风格）
 * 只作用于 #oj-dash，避免影响快照自带的 DOM。 */

#oj-dash {
  display: flex;
  flex-direction: column;
  gap: calc(2.5 * var(--mui-spacing, 8px));
  min-width: 0;
}

#oj-dash *,
#oj-dash *::before,
#oj-dash *::after {
  box-sizing: border-box;
}

.ojd-grid {
  display: grid;
  gap: calc(2 * var(--mui-spacing, 8px));
  min-width: 0;
}
.ojd-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ojd-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ojd-grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.ojd-grid > * { min-width: 0; }

.ojd-card {
  border: 1px solid #e8ecf3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 18px;
  min-width: 0;
}

.ojd-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.ojd-card-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: 0.2px;
}
.ojd-card-title p {
  margin: 0;
  font-size: 12px;
  color: #8a94a6;
}

/* ---------------------------- 统计卡片 ---------------------------- */
.ojd-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #e8ecf3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 16px;
  min-width: 0;
}
.ojd-stat-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ojd-stat-body { min-width: 0; }
.ojd-stat-label {
  margin: 0;
  font-size: 12px;
  color: #7b8794;
}
.ojd-stat-value {
  margin: 2px 0 0;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ojd-stat-value small {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
}
.ojd-stat-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: #8a94a6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ojd-accent-green { color: #059669; }
.ojd-accent-purple { color: #7c3aed; }
.ojd-accent-violet { color: #6d28d9; }
.ojd-quota-bar {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.ojd-quota-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #10b981;
}
.ojd-quota-bar > i.warn { background: #f59e0b; }
.ojd-quota-bar > i.full { background: #ef4444; }

/* ---------------------------- 平台拆分 ---------------------------- */
.ojd-plat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.ojd-plat {
  border: 1px solid #e8ecf3;
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
}
.ojd-plat.other {
  border-style: dashed;
  border-color: #d7dde7;
  background: #fafbfd;
}
.ojd-plat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.ojd-plat-head .cost {
  color: #7c3aed;
  font-variant-numeric: tabular-nums;
}
.ojd-plat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: #7b8794;
}
.ojd-plat-row b {
  font-weight: 600;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------- 筛选条 ---------------------------- */
.ojd-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}
.ojd-filter .ojd-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
}
.ojd-filter input[type="date"],
.ojd-filter select {
  height: 34px;
  border: 1px solid #dbe2ec;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  padding: 0 10px;
  font-family: inherit;
}
.ojd-filter .ojd-spacer { flex: 1 1 auto; }
.ojd-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #dbe2ec;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.ojd-btn:hover { background: #f6f8fc; }
.ojd-btn[disabled] { opacity: 0.6; cursor: default; }

/* ---------------------------- 图表 ---------------------------- */
.ojd-chart-wrap { position: relative; min-width: 0; }
.ojd-donut-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.ojd-donut { flex: 0 0 auto; width: 168px; height: 168px; }
.ojd-donut-empty {
  flex: 0 0 auto;
  width: 168px;
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #94a3b8;
}
.ojd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 14px 0 8px;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: #64748b;
}
.ojd-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ojd-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.ojd-legend i.line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}
.ojd-table-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 190px;
  overflow: auto;
}
.ojd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ojd-table th {
  text-align: right;
  font-weight: 500;
  color: #8a94a6;
  padding: 0 0 8px;
  white-space: nowrap;
}
.ojd-table th:first-child,
.ojd-table td:first-child { text-align: left; }
.ojd-table td {
  text-align: right;
  padding: 7px 0;
  border-top: 1px solid #f1f4f9;
  color: #475569;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ojd-table td.model {
  font-weight: 600;
  color: #0f172a;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ojd-table td.actual { color: #059669; }
.ojd-table td.standard { color: #94a3b8; }
.ojd-svg-chart {
  display: block;
  width: 100%;
  height: auto;
}
.ojd-axis-label { font-size: 11px; fill: #94a3b8; }
.ojd-axis-label.right { text-anchor: start; }
.ojd-grid-line { stroke: #eef2f7; stroke-width: 1; }
.ojd-axis-line { stroke: #e2e8f0; stroke-width: 1; }
.ojd-series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ojd-series-dash { stroke-dasharray: 5 5; }
.ojd-point { stroke: #fff; stroke-width: 1.5; }

/* ---------------------------- 最近使用 ---------------------------- */
.ojd-list { display: flex; flex-direction: column; gap: 10px; }
.ojd-usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px 14px;
  min-width: 0;
}
.ojd-usage-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.ojd-usage-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #eef2ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ojd-usage-model {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.ojd-usage-time { margin: 2px 0 0; font-size: 12px; color: #8a94a6; }
.ojd-usage-right { text-align: right; }
.ojd-usage-cost {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ojd-usage-tokens {
  margin: 2px 0 0;
  font-size: 12px;
  color: #8a94a6;
  font-variant-numeric: tabular-nums;
}
.ojd-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 2px;
  font-size: 13px;
  font-weight: 500;
  color: #3b6fef;
  text-decoration: none;
}
.ojd-more:hover { color: #2f5ed6; }
.ojd-empty {
  padding: 26px 0;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
}

/* ---------------------------- 快捷操作 ---------------------------- */
.ojd-quick { display: flex; flex-direction: column; gap: 10px; }
.ojd-quick a {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
  text-decoration: none;
  transition: background 0.18s ease;
}
.ojd-quick a:hover { background: #f1f5fb; }
.ojd-quick-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ojd-quick-body { flex: 1 1 auto; min-width: 0; }
.ojd-quick-body p { margin: 0; }
.ojd-quick-title { font-size: 13px; font-weight: 600; color: #0f172a; }
.ojd-quick-desc { margin-top: 2px !important; font-size: 12px; color: #8a94a6; }
.ojd-quick-arrow { flex: 0 0 auto; color: #b6c0cf; }

/* ---------------------------- 窄屏 ---------------------------- */
@media (max-width: 1100px) {
  .ojd-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ojd-plat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ojd-grid-2, .ojd-grid-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ojd-grid-4, .ojd-plat-grid { grid-template-columns: minmax(0, 1fr); }
  .ojd-donut-row { flex-direction: column; align-items: stretch; }
  .ojd-donut, .ojd-donut-empty { align-self: center; }
  .ojd-filter { gap: 10px; }
  .ojd-usage-model { max-width: 150px; }
}
