/* Mo Agent 官网 · 登录后的个人中心：左侧导航 + 内容区、概览仪表盘、图表、表格。
   颜色、圆角、字体都沿用 site.css 的那一套，这里只加图表要用的四种数据色。 */

:root,
:root[data-theme='light'] {
  /* 图表的数据色：输入、输出、缓存写入、缓存读取。和暖橙主色放在一起不打架，深浅两套主题下都看得清 */
  --cs-c1: #0f8f82;
  --cs-c2: #7a54d6;
  --cs-c3: #c9622f;
  --cs-c4: #2f7fc9;
  --cs-balance: linear-gradient(135deg, #fff 0%, #fff 46%, rgba(224, 138, 91, 0.16) 100%);
}
:root[data-theme='dark'] {
  --cs-c1: #3fc7b6;
  --cs-c2: #a98bf2;
  --cs-c3: #e08a5b;
  --cs-c4: #6aaef0;
  --cs-balance: linear-gradient(135deg, #1a1a18 0%, #1a1a18 46%, rgba(224, 138, 91, 0.2) 100%);
}

/* ---------- 外壳 ---------- */
.console {
  min-height: calc(100vh - 68px);
  background: var(--bg-soft);
}
.console__inner {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 28px 72px;
}
.console__shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.console__shell[hidden] {
  display: none;
}
.console__side {
  position: sticky;
  top: 92px;
  min-width: 0;
}
.console__main {
  min-width: 0;
}
.console__head {
  margin-bottom: 20px;
}
.console__head h1 {
  font-size: 26px;
}
.console__head p {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 14.5px;
}

/* 左侧：账号 + 导航 */
.cs-who {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 18px;
  min-width: 0;
}
.cs-who__av {
  width: 38px;
  height: 38px;
  font-size: 15px;
}
.cs-who__text {
  min-width: 0;
}
.cs-who__text b,
.cs-who__text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-who__text b {
  font-size: 15px;
  line-height: 1.3;
}
.cs-who__text small {
  color: var(--text-3);
  font-size: 12.5px;
}
.cs-nav {
  display: grid;
  gap: 2px;
}
.cs-nav--extra {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.cs-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--text-2);
  font-size: 15px;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.cs-nav__item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.cs-nav__item.is-on {
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.cs-nav__item.is-on .icon {
  color: var(--accent);
}

/* ---------- 卡片 ---------- */
.cs-view[hidden] {
  display: none;
}
.cs-view.is-loading {
  cursor: progress;
}
.cs-card {
  min-width: 0;
  padding: 22px 24px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.cs-card--flush {
  padding: 0;
  overflow: hidden;
}
.cs-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.cs-card__head--pad {
  padding: 20px 24px 0;
  margin-bottom: 6px;
}
.cs-card__head h3 {
  font-size: 16.5px;
}
.cs-card__sub {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 13px;
}
.cs-card__tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.cs-more {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 13.5px;
}
.cs-more:hover {
  color: var(--text);
}
.cs-more .icon {
  width: 15px;
  height: 15px;
}
.cs-first {
  margin-top: 0;
}
/* 同一个栏目里上下排的几块之间留一样的空 */
.cs-view > .panel + .cs-card,
.cs-view > .cs-card + .cs-card,
.cs-view > .cs-card + .panel {
  margin-top: 18px;
}
.cs-empty {
  padding: 34px 20px;
  border-radius: 16px;
  font-size: 14px;
}
.cs-empty b {
  font-size: 15.5px;
}
.cs-card--flush > .cs-empty,
.cs-card--flush > div > .cs-empty {
  margin: 20px;
}
.cs-card--flush > .plans-skeleton,
.cs-card--flush > div > .plans-skeleton {
  margin: 20px;
  border-radius: 14px;
}
.cs-card--flush > .notice,
.cs-card--flush > div > .notice {
  margin: 20px 20px 12px;
}
.cs-card--flush > .btn,
.cs-card--flush > div > .btn {
  margin: 0 20px 20px;
}
.cs-foot {
  padding: 12px 24px 16px;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- 概览：最上面一排 ---------- */
.cs-top {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 18px;
}
.cs-top > .plans-skeleton {
  grid-column: 1 / -1;
}
.cs-balance {
  display: flex;
  flex-direction: column;
  padding: 26px 28px;
  background: var(--cs-balance);
}
.cs-balance__head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 14.5px;
}
.cs-balance__head .icon {
  color: var(--accent);
}
.cs-balance__amount {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 22px;
}
.cs-balance__amount b {
  font-family: 'Segoe UI Variable Display', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei UI', system-ui, sans-serif;
  font-size: clamp(34px, 4.2vw, 46px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.cs-balance__amount span {
  color: var(--text-2);
  font-size: 16px;
}
.cs-balance__note {
  margin-top: 10px;
  color: var(--text-3);
  font-size: 13.5px;
}
.cs-balance__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 24px;
}
.cs-today {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0;
  overflow: hidden;
}
.cs-today__cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 22px 14px;
  border-left: 1px solid var(--border);
}
.cs-today__cell:first-child {
  border-left: 0;
}
.cs-today__value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.cs-cell__label {
  display: block;
  color: var(--text-3);
  font-size: 13.5px;
}
.cs-cell__sub {
  display: block;
  margin-top: 5px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.5;
}
.cs-spark {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: auto;
  padding-top: 12px;
  overflow: visible;
  box-sizing: content-box;
}
.cs-spark__line {
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.cs-spark__area {
  fill: var(--text-3);
  opacity: 0.08;
}
.cs-spark__dot {
  fill: none;
  stroke: var(--cs-c1);
  stroke-width: 6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ---------- 一排统计数字 ---------- */
.cs-statrow {
  margin-top: 18px;
}
.cs-cells,
.cs-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0;
  overflow: hidden;
}
.cs-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}
.cs-strip--one {
  grid-template-columns: 1fr;
}
.cs-cell {
  min-width: 0;
  padding: 20px 22px;
  border-left: 1px solid var(--border);
}
.cs-cell:first-child {
  border-left: 0;
}
.cs-cell__value {
  display: block;
  margin-top: 6px;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.cs-strip .cs-cell__value {
  font-size: 26px;
}

/* ---------- 用量分析 ---------- */
.cs-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 34px 0 16px;
}
.cs-section-head h2 {
  font-size: 19px;
}
.cs-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.cs-grid--even {
  align-items: start;
}
.cs-grid + .cs-grid {
  margin-top: 18px;
}
.cs-grid--even {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.cs-grid--even .panel:first-child,
.cs-pay > .panel {
  margin-top: 0;
}
.cs-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.cs-seg__btn {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  color: var(--text-3);
  font-size: 13.5px;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.cs-seg__btn .icon {
  width: 16px;
  height: 16px;
}
.cs-seg__btn:hover {
  color: var(--text);
}
.cs-seg__btn.is-on {
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.cs-seg__btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.cs-refresh {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}
.cs-view.is-loading .cs-refresh .icon {
  animation: spin 0.9s linear infinite;
}
.cs-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 13px;
}
.cs-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.cs-legend__item i,
.cs-tip__row i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}
.cs-legend__item b {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cs-chart-host {
  position: relative;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  touch-action: pan-y;
}
.cs-chart {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
  cursor: crosshair;
}
.cs-chart__grid {
  stroke: var(--border);
  stroke-width: 1;
}
.cs-chart__tick {
  fill: var(--text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.cs-chart__line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cs-chart__guide {
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.cs-chart__dot {
  stroke: var(--bg-elev);
  stroke-width: 2;
}
.cs-tip {
  position: absolute;
  top: 8px;
  z-index: 2;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  pointer-events: none;
}
.cs-tip[hidden] {
  display: none;
}
.cs-tip b {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}
.cs-tip__row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  line-height: 1.75;
  color: var(--text-2);
  white-space: nowrap;
}
.cs-tip__row span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.cs-tip__row span:last-child {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* 模型分布、按平台拆分里的条 */
.cs-bar {
  display: block;
  height: 6px;
  border-radius: 6px;
  background: var(--bg-hover);
  overflow: hidden;
}
.cs-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--cs-c1);
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cs-dist {
  display: grid;
  gap: 16px;
}
.cs-dist__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px 12px;
  font-size: 13px;
}
.cs-dist__name {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 550;
}
.cs-dist__name.is-muted {
  color: var(--text-3);
  font-weight: 400;
}
.cs-dist__num {
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cs-dist__pct {
  min-width: 44px;
  text-align: right;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.cs-av {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 13px;
}
.cs-recent {
  display: grid;
}
.cs-recent__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}
.cs-recent__row:first-child {
  border-top: 0;
  padding-top: 2px;
}
.cs-recent__main {
  flex: 1;
  min-width: 0;
}
.cs-recent__main b,
.cs-recent__main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-recent__main b {
  font-size: 14.5px;
  font-weight: 600;
}
.cs-recent__main small,
.cs-recent__cost small {
  color: var(--text-3);
  font-size: 12.5px;
}
.cs-recent__cost {
  flex: none;
  text-align: right;
}
.cs-recent__cost b {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cs-recent__cost small {
  display: block;
}
.cs-vendors {
  display: grid;
  gap: 18px;
}
.cs-vendor__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  font-size: 14.5px;
}
.cs-vendor__top > b {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.cs-vendor__name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.cs-vendor__name b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-vendor small {
  display: block;
  margin-top: 7px;
  color: var(--text-3);
  font-size: 12.5px;
}

/* ---------- 表格（使用记录、订单、到账记录） ---------- */
.cs-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cs-select {
  width: auto;
  min-width: 150px;
  max-width: 100%;
  height: 40px;
  border-radius: 11px;
  font-size: 14.5px;
}
.cs-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cs-table-wrap--short {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.cs-table th,
.cs-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cs-table th:first-child,
.cs-table td:first-child {
  padding-left: 22px;
}
.cs-table th:last-child,
.cs-table td:last-child {
  padding-right: 22px;
}
.cs-table th {
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
}
.cs-table tbody tr:last-child td {
  border-bottom: 0;
}
.cs-table tbody tr:hover td {
  background: var(--bg-soft);
}
.cs-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cs-table td {
  color: var(--text-2);
}
.cs-table .cs-strong {
  color: var(--text);
  font-weight: 600;
}
.cs-table .mono {
  font-size: 13px;
}
.cs-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13.5px;
}
.cs-pager[hidden] {
  display: none;
}
.cs-pager span {
  margin-right: auto;
}
.cs-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12.5px;
}
.cs-badge.is-ok {
  border-color: transparent;
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
}
.cs-badge.is-warn {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- 充值、兑换、套餐 ---------- */
.cs-redeem .row {
  margin-top: 16px;
}
.cs-tips {
  margin: 12px 0 0;
  padding-left: 20px;
  list-style: disc;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.8;
}
.cs-plans.plans {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  max-width: none;
  margin: 0;
}
.cs-plans .plan {
  padding: 26px 24px 24px;
  box-shadow: none;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 1180px) {
  .cs-cells {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .cs-cells .cs-cell:nth-child(n + 4) {
    border-top: 1px solid var(--border);
  }
  .cs-cells .cs-cell:nth-child(4) {
    border-left: 0;
  }
  .cs-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .console__inner {
    padding: 0 0 56px;
  }
  .console__shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  /* 手机上导航变成顶部一横排，自己左右滑，页面本身不会横向滚动 */
  .console__side {
    position: sticky;
    top: 68px;
    z-index: 20;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .console__side::-webkit-scrollbar {
    display: none;
  }
  .cs-who {
    display: none;
  }
  .cs-nav {
    display: flex;
    gap: 4px;
  }
  .cs-nav--extra {
    margin: 0 0 0 4px;
    padding: 0 0 0 4px;
    border-top: 0;
    border-left: 1px solid var(--border);
  }
  .cs-nav__item {
    height: 36px;
    padding: 0 12px;
    gap: 7px;
    font-size: 14px;
  }
  .cs-nav__item .icon {
    width: 16px;
    height: 16px;
  }
  .console__main {
    padding: 22px 16px 0;
  }
  #console-loading,
  #console-notice {
    margin: 16px;
  }
  .cs-top {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .console__head h1 {
    font-size: 22px;
  }
  .cs-card {
    padding: 18px;
    border-radius: 18px;
  }
  .cs-card--flush,
  .cs-today,
  .cs-cells,
  .cs-strip {
    padding: 0;
  }
  .cs-balance {
    padding: 22px 20px;
  }
  .cs-today,
  .cs-strip {
    grid-template-columns: minmax(0, 1fr);
  }
  .cs-today__cell,
  .cs-strip .cs-cell {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .cs-today__cell:first-child,
  .cs-strip .cs-cell:first-child {
    border-top: 0;
  }
  /* 手机上三张今日卡片竖着排：文字在左，走势线在右，省得页面拉得太长 */
  .cs-today__cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42%;
    column-gap: 14px;
    padding: 18px 18px 16px;
  }
  .cs-today__cell > * {
    grid-column: 1;
  }
  .cs-today__cell > .cs-spark {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .cs-cells {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cs-cells .cs-cell {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .cs-cells .cs-cell:nth-child(-n + 2) {
    border-top: 0;
  }
  .cs-cells .cs-cell:nth-child(even) {
    border-left: 1px solid var(--border);
  }
  .cs-cells .cs-cell:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .cs-cell {
    padding: 16px 18px;
  }
  .cs-section-head {
    margin-top: 26px;
  }
  .cs-card__tools {
    width: 100%;
  }
  .cs-grid--even {
    grid-template-columns: minmax(0, 1fr);
  }
  .cs-select {
    flex: 1 1 140px;
    min-width: 0;
  }
  .cs-table th,
  .cs-table td {
    padding: 11px 12px;
  }
  .cs-table th:first-child,
  .cs-table td:first-child {
    padding-left: 16px;
  }
}
