/* =========================================================
   TokenHub · pages/quota.css  员工配额管理
   ========================================================= */

/* 图表分类色（固定顺序，经 CVD 校验）。站点默认深色，亮色为 data-theme="light" */
:root {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s-other: #5d6785;
  --bar: var(--primary); --bar-muted: #4a5868; --bar-hl: var(--primary);
}
:root[data-theme="light"] {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s-other: #a3abbd;
  --bar-muted: #b9c4cf;
}

/* ---------- Hero ---------- */
.qt-hero-actions { justify-content: flex-start; }
.qt-hero-points { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: var(--sp-6); }
.qt-hero-points li { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.qt-hero-points svg { width: 16px; height: 16px; color: var(--success); flex: none; }

/* ---------- 员工 Key 卡片 ---------- */
.kc-head { display: flex; align-items: center; gap: 12px; }
.kc-avatar, .who i {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--av, #10b981); color: #fff; font-weight: 700; font-style: normal; font-size: 16px;
}
.kc-who { flex: 1; min-width: 0; line-height: 1.35; }
.kc-who b { display: block; font-size: 16px; color: var(--text); }
.kc-who span { font-size: 13px; color: var(--text-3); }
.kc-key {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; padding: 8px 12px;
  border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--border-strong);
}
.kc-key svg { width: 16px; height: 16px; color: var(--primary); flex: none; }
.kc-key code { background: none; padding: 0; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.kc-row:last-of-type { border-bottom: 0; }
.kc-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 6px; }
.kc-label span { color: var(--text-3); }
.kc-label b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.kc-row small { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.kc-models { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.mchip i, .mchoice i, .mname i {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--vm); color: #fff; font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: -.02em;
}
.mchip em { font-style: normal; font-size: 11px; color: var(--warning); font-weight: 600; }
.kc-foot {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--grad-brand); color: #06281c; font-size: 13.5px; font-weight: 600;
}
.kc-foot .muted { color: rgba(6,40,28,.75); font-weight: 500; font-size: 12px; }

.q-meter { height: 8px; border-radius: 4px; background: var(--bg-muted); overflow: hidden; }
.q-meter i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--grad-brand); transition: width .3s var(--ease); }
.q-meter.warn i { background: var(--warning); }
.q-meter.danger i { background: var(--danger); }
.q-meter.sm { height: 6px; width: 120px; margin-bottom: 4px; }

/* ---------- 三类配额 ---------- */
.qt-type .check-list { margin-top: var(--sp-4); }
.qt-type .check-list li { font-size: 14.5px; }

/* ---------- 配置演示 ---------- */
.cfg-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--sp-8); align-items: start; }
.cfg-form { display: grid; gap: var(--sp-5); }
.cfg-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.cfg-fs legend { padding: 0; }
.cfg-amount-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cfg-amount-head label { margin-bottom: 6px; }
.cfg-amount-head output { font-weight: 800; font-size: 18px; color: var(--primary); font-variant-numeric: tabular-nums; }
.cfg-form .form-note, .est-inputs .form-note { margin: 6px 0 0; }
.range { width: 100%; accent-color: var(--primary); height: 28px; margin: 0; cursor: pointer; }
.mchoice span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 5px; font-size: 13.5px; }
.cfg-preview { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: var(--sp-4); min-width: 0; }
.pv-list { margin: 8px 0 12px; display: grid; }
.pv-list > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.pv-list dt { color: var(--text-3); }
.pv-list dd { margin: 0; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.cfg-code pre { max-height: 300px; font-size: 12.5px; }
.cfg-preview .demo-note { margin-top: 0; }

/* ---------- 用量统计 ---------- */
.qt-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.qt-kpi { padding: var(--sp-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.qt-kpi span { display: block; font-size: 13px; color: var(--text-3); }
.qt-kpi b { display: block; font-size: clamp(24px, 2.6vw, 32px); font-weight: 800; color: var(--text); line-height: 1.25; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.qt-kpi small { font-size: 12.5px; color: var(--text-3); }

.st-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.st-head h3 { margin-bottom: 2px; }
.st-sub { font-size: 13px; margin: 0; }
.st-vendor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--sp-8); align-items: start; }
.st-vendor .hbar-chart { padding-top: 44px; }
.st-table .table { min-width: 460px; }
.table .t-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody th { font-weight: 600; color: var(--text); }
.table tbody tr:hover th { background: var(--bg-soft); }
.table .t-total th, .table .t-total td { font-weight: 700; color: var(--text); background: var(--surface-2); }
.st-card .demo-note { text-align: left; }

/* 横向条形图 */
.hbar-chart { display: grid; gap: 6px; }
.hb-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 4px 6px; border-radius: 6px; cursor: default; }
.hb-row:hover { background: var(--bg-soft); }
.hb-label { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { height: 14px; position: relative; }
.hb-track i { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; transition: width .35s var(--ease); }
.hb-val { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.est-compare .hb-track i { background: var(--bar-muted); }
.hb-row.is-hl .hb-track i, .est-compare .hb-row.is-hl .hb-track i { background: var(--bar-hl); }
.hb-row.is-hl .hb-label, .hb-row.is-hl .hb-val { color: var(--text); font-weight: 700; }

/* 堆叠条 + 图例 */
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: var(--sp-4); font-size: 13px; color: var(--text-2); }
.st-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw-s1 { background: var(--s1); } .sw-s2 { background: var(--s2); } .sw-s3 { background: var(--s3); }
.sw-s4 { background: var(--s4); } .sw-s5 { background: var(--s5); } .sw-other { background: var(--s-other); }
.st-emp-table { min-width: 720px; }
.st-stack-cell { width: 40%; }
.qstack { display: flex; flex-wrap: nowrap; gap: 2px; height: 14px; }
.qstack .seg { display: block; height: 100%; min-width: 3px; cursor: default; }
.qstack .seg:last-child { border-radius: 0 4px 4px 0; }
.qstack .seg:hover { filter: brightness(1.08); outline: 2px solid var(--surface); }
.who { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-weight: 600; color: var(--text); }
.who i { width: 28px; height: 28px; font-size: 12.5px; }
.table small { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 价格预估 ---------- */
.est-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--sp-8); align-items: start; }
.est-inputs { display: grid; gap: var(--sp-5); }
.est-row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.est-row4 label { font-size: 13px; white-space: nowrap; }
.est-price-wrap { max-height: 380px; overflow: auto; }
.est-price { min-width: 460px; font-size: 13.5px; }
.est-price th, .est-price td { padding: 6px 10px; }
.est-price thead th { z-index: 1; }
.est-price tfoot td { padding: 10px; font-weight: 700; color: var(--text); background: var(--surface-2); border-top: 1px solid var(--border); position: sticky; bottom: 0; }
#est-share-sum.is-off { color: var(--warning); }
.mname { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 500; }
.cell-input {
  width: 76px; height: 32px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 13.5px;
}
.cell-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.cell-input.share { width: 64px; font-weight: 600; }

.est-result { display: grid; gap: var(--sp-5); position: sticky; top: calc(var(--header-h) + 16px); min-width: 0; }
.est-hero span { display: block; font-size: 14px; color: var(--text-3); }
.est-hero b { display: block; font-size: clamp(34px, 4vw, 48px); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.est-hero small { font-size: 13px; color: var(--text-3); }
.est-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: var(--sp-5) 0 var(--sp-3); }
.est-kpis > div { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.est-kpis dt { font-size: 12.5px; color: var(--text-3); }
.est-kpis dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.est-summary .form-note { margin-bottom: var(--sp-4); }
.est-compare h3 { font-size: 17px; margin-bottom: 2px; }
.est-compare-sub { font-size: 13px; margin-bottom: var(--sp-4); }
.est-compare .hb-row { grid-template-columns: 118px minmax(0, 1fr) auto; padding: 2px 6px; }
.est-compare .hb-track { height: 10px; }

/* ---------- 管理员视角 ---------- */
.qt-admin-table { min-width: 900px; }
.qt-admin-table code { font-size: 12.5px; white-space: nowrap; }
.qt-admin-table td { white-space: nowrap; }
.qt-admin-feats { margin-top: var(--sp-10); }
.qt-admin-feats h3 { font-size: 17px; }
.qt-admin-feats p { font-size: 15px; margin: 0; }

/* ---------- 浮动提示 ---------- */
.viz-tip {
  position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none;
  padding: 8px 12px; border-radius: 8px; max-width: 260px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 12.5px; line-height: 1.6; font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity .12s;
}
.viz-tip b { color: var(--text); }
.viz-tip.is-show { opacity: 1; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .cfg-grid, .est-grid, .st-vendor { grid-template-columns: 1fr; }
  .cfg-preview, .est-result { position: static; }
  .st-vendor .hbar-chart { padding-top: 0; }
  .qt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .est-row4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hb-row, .est-compare .hb-row { grid-template-columns: 96px minmax(0, 1fr) auto; gap: 8px; }
}
@media (max-width: 480px) {
  .qt-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .qt-kpi { padding: var(--sp-4); }
  .est-kpis dd { font-size: 17px; }
  .kc-label { flex-direction: column; gap: 0; }
}
