:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17191f;
  --muted: #677083;
  --line: #e4e7ec;
  --primary: #0f766e;
  --primary-2: #115e59;
  --danger: #b42318;
  --soft: #eef7f4;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  /* FX:深色 hero + 动效 token(仅落地首屏用深色,正文继续浅色) */
  --hero-bg-1: #060b18;
  --hero-bg-2: #0a1a2e;
  --hero-text: #eef6f4;
  --hero-muted: #9fb4c2;
  --hero-accent: #818cf8;
  --hero-accent-2: #a78bfa;
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --dur: .7s;
  /* 落地页间距/字号体系(统一各区块垂直节奏与字体层级) */
  --sp-section: 72px;            /* 区块上下 padding */
  --sp-section-m: 44px;          /* 移动端区块上下 padding */
  --sp-foot: 40px;               /* footer 上下 padding */
  --fs-h2: 30px;
  --fs-h3: 18px;
  --fs-body: 14px;
}

/* ===== 用量监控仪表盘 ===== */
.usage-dashboard { display: flex; flex-direction: column; gap: 16px; }
.ud-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ud-cards article { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.ud-cards small { color: var(--muted); font-size: 12px; }
.ud-cards strong { display: block; font-size: 24px; margin-top: 4px; color: var(--primary-2); font-variant-numeric: tabular-nums; }
.ud-cards span { color: var(--muted); font-size: 12px; }
.ud-chart { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.ud-chart h4 { margin: 0 0 14px; font-size: 14px; color: var(--text); }
.ud-bars { display: flex; flex-direction: column; gap: 10px; }
.ud-bar-row { display: grid; grid-template-columns: 120px 1fr 140px; align-items: center; gap: 10px; font-size: 13px; }
.ud-bar-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ud-bar-track { background: var(--bg); border-radius: 6px; height: 18px; overflow: hidden; }
.ud-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 6px; min-width: 2px; }
.ud-bar-val { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
/* 近 7 天消耗:平滑面积折线图(SVG) */
.ud-chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ud-chart-head h4 { margin: 0; }
.ud-chart-stats { font-size: 12px; color: var(--muted); }
.ud-chart-stats b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ud-trend-wrap { width: 100%; }
.ud-area { width: 100%; height: auto; display: block; overflow: visible; }
.ud-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.ud-area-fill { fill: url(#udAreaGrad); }
.ud-area-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ud-pt { cursor: pointer; }
.ud-dot { fill: #fff; stroke: var(--primary); stroke-width: 2; transform-box: fill-box; transform-origin: center; transition: transform .15s ease, fill .15s ease, stroke .15s ease; }
.ud-pt:hover .ud-dot { transform: scale(1.6); }
.ud-pt-today .ud-dot { fill: var(--primary); stroke: var(--primary-2); stroke-width: 2.5; }
.ud-peak-label { fill: var(--primary-2); font-size: 11px; font-weight: 600; text-anchor: middle; }
.ud-xlab { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.ud-trend-empty { padding: 36px 0; text-align: center; color: var(--muted); font-size: 13px; }
.ud-empty { padding: 40px; text-align: center; color: var(--muted); }
.usage-subsection { margin-top: 24px; padding-top: 24px; border-top: 1px dashed var(--line); }
.usage-subsection > .panel-head { margin-bottom: 14px; }
.api-key-usage-dashboard { gap: 18px; }
.aku-availability-note { margin: 0; padding: 11px 13px; color: #9a6700; background: #fff7e5; border: 1px solid #f5d99a; border-radius: 10px; font-size: 13px; }
.aku-key-section { display: grid; gap: 12px; }
.aku-key-section > .ud-chart-head { margin: 0; }
.aku-key-section h4 { margin: 0; font-size: 15px; }
.aku-key-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.aku-key-card { min-width: 0; padding: 17px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgba(15, 23, 42, .04); }
.aku-key-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.aku-key-head small, .aku-key-models > small { color: var(--muted); font-size: 12px; }
.aku-key-head h4 { max-width: 240px; margin: 3px 0 2px; overflow: hidden; color: var(--text); font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.aku-key-head p { margin: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.aku-key-status { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; color: #087443; background: #eaf8f0; font-size: 12px; font-weight: 700; }
.aku-key-status.disabled { color: #9a6700; background: #fff5d6; }
.aku-key-status.deleted { color: #667085; background: #f2f4f7; }
.aku-key-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 12px; padding: 12px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.aku-key-metrics div { min-width: 0; }
.aku-key-metrics dt { color: var(--muted); font-size: 12px; }
.aku-key-metrics dd { margin: 4px 0 1px; overflow: hidden; color: var(--primary-2); font-size: 18px; font-variant-numeric: tabular-nums; font-weight: 750; text-overflow: ellipsis; }
.aku-key-metrics small { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.aku-key-last { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.aku-key-last b { color: var(--text); font-weight: 600; }
.aku-key-models { display: grid; gap: 6px; }
.aku-key-models > div { display: flex; flex-wrap: wrap; gap: 6px; }
.aku-key-models span { max-width: 100%; padding: 4px 7px; overflow: hidden; color: #345; background: var(--soft); border-radius: 7px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.aku-key-models span b { color: var(--primary-2); font-variant-numeric: tabular-nums; }
.aku-key-models span.empty { color: var(--muted); background: var(--bg); }
.aku-trend { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: end; gap: 10px; height: 174px; padding-top: 8px; }
.aku-trend-item { display: grid; grid-template-rows: 18px 1fr 18px; align-items: end; gap: 5px; min-width: 0; text-align: center; }
.aku-trend-item strong { overflow: hidden; color: var(--primary-2); font-size: 11px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.aku-trend-track { display: flex; align-items: flex-end; height: 112px; padding: 0 6px; background: var(--bg); border-radius: 7px 7px 3px 3px; overflow: hidden; }
.aku-trend-track i { width: 100%; min-height: 0; background: linear-gradient(180deg, #41b2a4, var(--primary)); border-radius: 6px 6px 2px 2px; transition: height .35s ease; }
.aku-trend-item small { color: var(--muted); font-size: 11px; }
@media (max-width: 720px) {
  .ud-cards { grid-template-columns: repeat(2, 1fr); }
  .ud-bar-row { grid-template-columns: 84px 1fr 116px; font-size: 12px; }
  .aku-key-grid { grid-template-columns: 1fr; }
  .aku-key-head h4 { max-width: 200px; }
  .aku-key-metrics { gap: 6px; }
  .aku-key-metrics dd { font-size: 16px; }
  .aku-trend { gap: 5px; }
  .aku-trend-track { padding: 0 3px; }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 650;
}
button:hover { background: var(--primary-2); }
button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
button.mini {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12px;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  resize: vertical;
}
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.hidden { display: none !important; }
.file-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 20px; }
.small { font-size: 12px; }
.login {
  min-height: 100vh;
  display: block;
  padding: 0;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
}
.admin-entry {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.admin-entry:hover {
  background: #fff;
  color: var(--text);
}
.login-shell {
  width: min(1180px, 100%);
  min-height: 700px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}
.login-art {
  position: relative;
  min-height: 680px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(15, 23, 42, 0.42)),
    url("/assets/login-ai-platform-bg.svg") center/cover;
}
.login-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.28), transparent 45%);
}
.login-art > * {
  position: relative;
  z-index: 1;
}
.login-brand-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}
.login-brand-card img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}
.login-brand-card small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
}
.login-art-copy {
  max-width: 560px;
}
.login-art-copy .eyebrow {
  color: #a7f3d0;
}
.login-art-copy h2 {
  margin: 10px 0 14px;
  font-size: 44px;
  line-height: 1.12;
}
.login-art-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.75;
}
.login-forms {
  display: grid;
  place-items: center;
  padding: 34px;
}
.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}
.register-code {
  display: grid;
  gap: 7px;
}
.register-code .code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.register-code .code-row input[name="code"] {
  flex: 1 1 auto;
  min-width: 0;
}
.admin-login-panel {
  position: fixed;
  top: 62px;
  right: 18px;
  z-index: 30;
  width: min(320px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}
.admin-login-panel h3 {
  margin: 4px 0 0;
}
.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 800;
}
.login h1 { margin: 0 0 8px; font-size: 30px; }
.link-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.link-button {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
}
.link-button:hover {
  background: transparent;
  color: var(--primary-2);
  text-decoration: underline;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: #f2f4f7;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.segmented button {
  background: transparent;
  color: var(--muted);
}
.segmented button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.08);
}
.app {
  min-height: 100vh;
  display: block;
  background: #f8fafc;
}
.sidebar {
  background: #111827;
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: 0 0 auto;
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.22);
}
.mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #18a058;
  font-weight: 900;
}
.brand small { display: block; color: #b6bfce; margin-top: 3px; }
nav { display: grid; gap: 6px; }
.nav {
  text-align: left;
  background: transparent;
  color: #d0d5dd;
  border-radius: 8px;
}
.nav:hover, .nav.active { background: #1d2939; color: white; }
.main { padding: 24px; overflow: auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.topbar h2 { margin: 0; font-size: 26px; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.metrics article, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.metrics article { padding: 18px; }
.metrics small { color: var(--muted); }
.metrics strong { display: block; font-size: 28px; margin-top: 8px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panel { padding: 18px; margin-bottom: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel h3 { margin: 0; font-size: 17px; white-space: nowrap; flex-shrink: 0; }
.form-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .wide { grid-column: 1 / -1; }
.setting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.form-grid button { align-self: end; }
.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 12px 10px;
  font-size: 14px;
}
th { color: var(--muted); font-size: 12px; font-weight: 800; }
.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.plan-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
}
.plan-card h4 { margin: 0 0 8px; }
.plan-card strong { font-size: 24px; }
.plan-card button { width: 100%; margin-top: 10px; }
.list { display: grid; gap: 10px; }
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #101828;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.customer {
  min-height: 100vh;
}
.customer-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: #101828;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.customer-main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px;
}
.hero-band {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
}
.hero-band > div,
.hero-band > article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.hero-band h1 { margin: 0 0 8px; font-size: 28px; }
.hero-band article strong {
  display: block;
  font-size: 34px;
  margin: 8px 0;
}
.key-box {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fff7e6;
  border: 1px solid #ffd591;
  color: #7a4b00;
  overflow-wrap: anywhere;
}
.key-create {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}
.field-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}
.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
  padding-right: 4px;
}
.search-input {
  margin-bottom: 8px;
}
.model-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.model-toggle span {
  color: var(--muted);
  font-size: 12px;
}
.model-picker {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
}
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}
.check-item input {
  width: auto;
  margin: 0;
}
.chat-controls {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(180px, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.chat-shell {
  display: grid;
  gap: 10px;
}
.chat-box {
  min-height: 360px;
  max-height: 480px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 250, 252, 0.92)),
    radial-gradient(circle at 16% 12%, rgba(15, 118, 110, 0.12), transparent 24%),
    radial-gradient(circle at 84% 10%, rgba(37, 99, 235, 0.1), transparent 24%),
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    #f8fafc;
  background-size: auto, auto, auto, 28px 28px, 28px 28px, auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}
.chat-empty {
  color: var(--muted);
  display: grid;
  place-items: center;
  min-height: 180px;
}
.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 82%;
}
.msg.user {
  justify-self: end;
  flex-direction: row-reverse;
}
.msg.assistant {
  justify-self: start;
}
.msg .avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: #111827;
  font-size: 12px;
  font-weight: 900;
}
.msg.assistant .avatar {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.msg .avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
.msg.user .avatar {
  background: var(--primary);
}
.msg .bubble {
  border-radius: 12px;
  padding: 8px 10px;
  white-space: normal;
  line-height: 1.42;
}
.msg .bubble small {
  display: block;
  margin-bottom: 2px;
  color: inherit;
  opacity: 0.72;
  font-size: 12px;
  font-weight: 800;
}
.msg .bubble p {
  margin: 0;
  white-space: pre-wrap;
}
.message-image {
  display: block;
  width: min(220px, 60vw);
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  margin: 2px 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.32);
}
.msg.assistant .message-image {
  border-color: var(--line);
}
.msg.user .bubble {
  background: var(--primary);
  color: #fff;
}
.msg.assistant .bubble {
  background: transparent;
  border: 0;
  box-shadow: none;
}
/* 代码块白框(模型回复中的 ``` 代码块) */
.code-block {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  margin: 8px 0; overflow: hidden;
}
.code-block-head {
  display: flex; align-items: center; padding: 6px 12px;
  background: #f6f8fa; border-bottom: 1px solid var(--line); font-size: 12px;
}
.code-block-lang { color: #6b7280; font-family: monospace; }
.code-block pre { margin: 0; padding: 12px; overflow-x: auto; }
.code-block code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 13px; line-height: 1.5; white-space: pre; color: #1f2937; tab-size: 2;
}
/* 代码生成完成后的产物气泡:内联在文字中间,紧凑单行卡片 */
.artifact-bubble {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  margin: 10px 0;
  padding: 9px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.artifact-bubble:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(78, 45, 204, 0.12);
  transform: translateY(-1px);
}
.artifact-bubble-icon {
  flex-shrink: 0; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: #f4f5f7; border-radius: 9px;
}
.artifact-bubble-info { flex: 1; min-width: 0; }
.artifact-bubble-name {
  font-size: 13px; font-weight: 600; color: #1f2937;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artifact-bubble-meta {
  font-size: 11px; color: #9aa3b2; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artifact-bubble-open {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  color: #fff; background: var(--primary); border: 0; border-radius: 8px;
  cursor: pointer; transition: background .15s;
}
.artifact-bubble-open:hover { background: #3a23a8; }
.bubble.loading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 2px solid rgba(15, 118, 110, 0.22);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: chat-spin 0.7s linear infinite;
}
.chat-typing-text {
  color: var(--muted);
  font-size: 13px;
}
/* 推理模型思考中提示 */
.msg.assistant .bubble p.thinking {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}
.msg.assistant .bubble p.thinking::after {
  content: "";
  display: inline-block;
  animation: thinking-dots 1.4s steps(4, end) infinite;
}
@keyframes thinking-dots {
  0%   { content: ""; }
  25%  { content: " ·"; }
  50%  { content: " · ·"; }
  75%  { content: " · · ·"; }
  100% { content: ""; }
}
/* 推理(思考过程)折叠块 */
.msg.assistant .bubble details.reasoning { margin: 2px 0 8px; }
.msg.assistant .bubble details.reasoning > summary {
  cursor: pointer; font-size: 12px; color: var(--muted); user-select: none; list-style: none;
}
.msg.assistant .bubble details.reasoning > summary::-webkit-details-marker { display: none; }
.msg.assistant .bubble details.reasoning > summary::before { content: "▸ "; }
.msg.assistant .bubble details.reasoning[open] > summary::before { content: "▾ "; }
.msg.assistant .bubble .reasoning-body {
  margin-top: 6px; padding: 8px 10px;
  background: rgba(0, 0, 0, 0.03); border-left: 3px solid #d0d0d0;
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
  white-space: pre-wrap; max-height: 320px; overflow-y: auto; border-radius: 4px;
}
/* 模型广场 */
/* —— 模型广场顶部 hero 横幅(落地页风格) —— */
.ms-hero {
  position: relative; overflow: hidden;
  border-radius: 16px; margin-bottom: 20px;
  padding: 40px 28px; text-align: center;
  background:
    radial-gradient(ellipse 70% 60% at 20% 20%, rgba(99,102,241,0.14), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(167,139,250,0.10), transparent 55%),
    linear-gradient(135deg, #0f1729 0%, #1a1340 40%, #0b1f3a 100%);
  color: #eef2ff;
}
.ms-hero-inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }
.ms-hero-eyebrow { margin: 0 0 8px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #a5b4fc; }
.ms-hero-title {
  margin: 0 0 10px; font-size: clamp(24px, 3.5vw, 34px); font-weight: 800; line-height: 1.15;
  background: linear-gradient(110deg, #fff 8%, #c7d2fe 40%, #a5b4fc 60%, #fff 96%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: ms-hero-shimmer 7s linear infinite;
}
@keyframes ms-hero-shimmer { to { background-position: 220% center; } }
.ms-hero-sub { margin: 0 auto 22px; max-width: 560px; font-size: 14.5px; line-height: 1.7; color: #a5adcb; }
.ms-hero-stats { display: flex; align-items: center; justify-content: center; gap: 24px; }
.ms-hero-stat { display: flex; flex-direction: column; gap: 2px; }
.ms-hero-stat strong { font-size: 26px; font-weight: 800; color: #fff; line-height: 1; }
.ms-hero-stat small { font-size: 12px; color: #9aa1bc; }
.ms-hero-divider { width: 1px; height: 32px; background: rgba(255,255,255,0.12); }
@media (max-width: 560px) {
  .ms-hero { padding: 28px 16px; }
  .ms-hero-stats { gap: 14px; }
  .ms-hero-stat strong { font-size: 20px; }
}

.ms-search {
  padding: 7px 12px; border: 1px solid var(--border, #ddd); border-radius: 8px;
  font-size: 13px; min-width: 120px; flex: 1 1 160px; max-width: 320px;
  background: var(--surface, #fff); color: var(--text, #111);
}
.ms-grid { display: flex; flex-direction: column; gap: 26px; }
.ms-vendor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ms-vendor-head img { width: 28px; height: 28px; border-radius: 6px; }
.ms-vendor-head h3 { margin: 0; font-size: 16px; }
.ms-vendor-head small { color: var(--muted); }
.ms-vendor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: auto;
  align-items: stretch;
  gap: 14px;
}
.ms-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px; width: 100%; height: 100%; min-height: 0; padding: 16px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: box-shadow .18s ease, border-color .18s ease, transform .12s ease;
}
.ms-card:hover { z-index: 2; border-color: #cbd5e1; box-shadow: 0 12px 30px rgba(16, 24, 40, 0.13); transform: translateY(-2px); }
/* 悬浮展开:模型介绍 + 功能 + 上下文 + 价格(覆盖卡片,不影响网格布局) */
.ms-desc-full {
  display: none; position: absolute; inset: 0; padding: 16px;
  background: #fff; border-radius: 14px; z-index: 8;
  flex-direction: column; gap: 10px; overflow: auto;
}
.ms-card:hover .ms-desc-full { display: flex; }
.ms-desc-full .ms-hover-id { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-all; }
.ms-desc-full .ms-hover-desc { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--muted); }
.ms-desc-full .ms-hover-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.ms-desc-full .ms-hover-meta { font-size: 12px; color: var(--muted); }
.ms-desc-full .ms-hover-price { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--text); font-weight: 600; }
.ms-desc-full .ms-hover-price em { color: var(--muted); font-style: normal; font-weight: 400; }

/* 发票 · 订单选择表 */
.inv-order-wrap { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.inv-order-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-order-table th {
  position: sticky; top: 0; z-index: 1; background: #f8fafc; color: var(--muted);
  font-weight: 600; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.inv-order-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.inv-order-table tr:last-child td { border-bottom: 0; }
.inv-order-table tbody tr:hover td { background: #f7faf9; }
.inv-order-table .inv-chk { width: 36px; text-align: center; }
.inv-order-table .inv-order-number-head { min-width: 160px; }
.inv-order-table .inv-order-id {
  color: var(--muted);
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.inv-order-table .inv-amt { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.inv-order-empty { padding: 28px; text-align: center; }

.order-type-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.order-type-badge.recharge { color: #2457a6; background: #eef5ff; border-color: #d7e6ff; }
.order-type-badge.consumption { color: #087443; background: #eaf8f0; border-color: #ccebd9; }

/* ============================================================
   P1+P2:共享顶栏 + 登录浮层 + 落地页(SiliconFlow 风格)
   ============================================================ */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  height: 60px; padding: 0 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; transition: opacity 0.2s ease, filter 0.2s ease; }
.topnav-brand:hover { opacity: 0.72; filter: brightness(1.08); }
.topnav-brand img { width: 30px; height: 30px; border-radius: 8px; transition: transform 0.25s ease; }
.topnav-brand:hover img { transform: scale(1.06) rotate(-3deg); }
.topnav-links { display: flex; align-items: center; gap: 4px; }
.nav-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--muted, #768198); cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-toggle-btn svg { width: 24px; height: 24px; }
.nav-toggle-btn:hover { background: rgba(79, 70, 229, .08); color: #4f46e5; }
.topnav-brand .nav-toggle-btn { margin-left: auto; }
#customerApp.nav-collapsed .nav-toggle-btn svg { transform: rotate(180deg); }
.topnav-link {
  padding: 7px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.topnav-link:hover { background: var(--soft); color: var(--primary-2); }
.topnav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.auth-modal {
  position: relative; width: min(440px, 92vw); max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 16px; padding: 32px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}
.auth-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  background: #f2f4f7; color: var(--muted); font-size: 15px; line-height: 1;
}
.auth-close:hover { background: #e4e7ec; color: var(--text); }

/* —— 落地页正文:三区块共享浅紫渐变背景(去重,cards 深色过渡另用伪元素) —— */
.login .landing-cards,
.login .landing-adv,
.login .landing-scenes {
  position: relative;
  background: #fff;
}
/* Public content follows the hero directly; no inherited dark transition band. */
.login .landing-cards::before {
  display: none;
}
.login .landing-cards > * { position: relative; z-index: 1; }

/* 区块布局:背景铺满整宽(full-bleed),内容用内层 max-width 居中 */
.landing-cards, .landing-adv, .landing-scenes { padding: var(--sp-section) 28px; }
/* cards 顶部多留一点承接深色过渡带,但不破坏整体节奏(其余区块统一 72px) */
.login .landing-cards { padding-top: calc(var(--sp-section) + 24px); }
/* 内容容器居中(标题 + grid) */
.login .landing-cards h2, .login .landing-adv h2, .login .landing-scenes h2,
.landing-card-grid, .landing-adv-grid, .landing-scene-strip {
  max-width: 1080px; margin-left: auto; margin-right: auto;
}

/* 区块标题统一(字号 token + 紫/靛/橙渐变) */
.login .landing-cards h2,
.login .landing-adv h2,
.login .landing-scenes h2 {
  text-align: center; font-size: var(--fs-h2); font-weight: 700; margin: 0 auto 32px;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 50%, #f59e0b 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.landing-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 0 auto; }

/* —— 落地页能力卡:硅基流动风格(白底 + 点阵网格 + 主题色光晕 + hover 动效) —— */
.login .landing-card {
  background:
    linear-gradient(135deg, rgba(8,10,20,0.62) 0%, rgba(8,10,20,0.72) 100%),
    linear-gradient(135deg, color-mix(in srgb, var(--ic1, #7c3aed) 45%, transparent), color-mix(in srgb, var(--ic2, #a78bfa) 45%, transparent)),
    var(--bg-img, none) center/cover no-repeat, #1a1a2e;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 32px;
  position: relative;
  overflow: hidden;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 8px 24px rgba(0,0,0,0.14);
  --rx: 0deg; --ry: 0deg;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out, box-shadow 0.3s ease, border-color 0.3s ease;
}
/* 每张卡片对应一张办公环境实拍图(Unsplash,免版权) */
.login .landing-card[data-target-view="square"]  { --bg-img: url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?w=900&q=80&auto=format&fit=crop"); }
.login .landing-card[data-target-view="chat"]    { --bg-img: url("https://images.unsplash.com/photo-1524758631624-e2822e304c36?w=900&q=80&auto=format&fit=crop"); }
.login .landing-card[data-target-view="account"] { --bg-img: url("https://images.unsplash.com/photo-1551434678-e076c223a692?w=900&q=80&auto=format&fit=crop"); }
.login .landing-card[data-target-view="agents"]  { --bg-img: url("https://images.unsplash.com/photo-1521737604893-d14cc237f11d?w=900&q=80&auto=format&fit=crop"); }
/* 顶部常驻主题色渐变光晕(增强暗背景下卡片顶部层次) */
.login .landing-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 50%;
  background: radial-gradient(ellipse 90% 100% at 50% 0%, color-mix(in srgb, var(--ic1, #7c3aed) 32%, transparent), transparent 75%);
  opacity: 0.65; transition: opacity 0.35s ease;
  pointer-events: none;
}
/* hover 时的光泽扫过(对角线高光带) */
.login .landing-card::after {
  content: ""; position: absolute; top: -60%; left: -80%;
  width: 60%; height: 220%;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%);
  transform: rotate(0deg) translateX(-120%);
  transition: transform 0.7s cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
}
.login .landing-card:hover {
  border-color: color-mix(in srgb, var(--ic1, #7c3aed) 55%, transparent);
  box-shadow: 0 14px 40px rgba(0,0,0,0.35), 0 0 0 1px color-mix(in srgb, var(--ic1, #7c3aed) 32%, transparent);
}
.login .landing-card:hover::before { opacity: 1; }
.login .landing-card:hover::after { transform: rotate(0deg) translateX(320%); }
/* 卡片角落装饰线稿(硅基流动风格,半透明主题色描边,对称布局) */
.login .landing-card-deco {
  position: absolute; width: 120px; height: 120px; z-index: 0;
  opacity: 0.65; transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}
.login .landing-card-deco svg {
  width: 100%; height: 100%; fill: none;
  stroke: var(--ic1, #7c3aed); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.login .landing-card-deco.deco-tl { top: -12px; left: -12px; }
.login .landing-card-deco.deco-tr { top: -12px; right: -12px; }
.login .landing-card:hover .landing-card-deco { opacity: 0.85; transform: scale(1.06); }
/* 内容层在装饰之上 */
.login .landing-card-icon, .login .landing-card h3, .login .landing-card p { position: relative; z-index: 1; }
.login .landing-card-icon {
  width: 50px; height: 50px; border-radius: 14px;
  background: linear-gradient(135deg, var(--ic1, #7c3aed), var(--ic2, #a78bfa));
  display: grid; place-items: center; margin-bottom: 16px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ic1, #7c3aed) 28%, transparent);
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), box-shadow 0.35s ease;
}
.login .landing-card-icon svg {
  width: 26px; height: 26px; fill: none;
  stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.4s ease;
}
.login .landing-card:hover .landing-card-icon {
  transform: scale(1.1) rotate(-6deg);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--ic1, #7c3aed) 42%, transparent);
}
.login .landing-card:hover .landing-card-icon svg { transform: rotate(6deg); }
.login .landing-card h3 {
  margin: 0 0 8px; font-size: var(--fs-h3); color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
  transition: background 0.3s ease;
  position: relative; z-index: 1;
}
.login .landing-card:hover h3 {
  background: linear-gradient(135deg, #fff, color-mix(in srgb, var(--ic2, #a78bfa) 80%, #fff));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login .landing-card p {
  margin: 0; font-size: var(--fs-body); line-height: 1.65; color: rgba(255,255,255,0.82);
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
  position: relative; z-index: 1;
}

/* —— 落地页优势卡:硅基流动风格(纯白 + 细灰边框 + 渐变图标 + hover 主题色) —— */
.login .landing-adv article {
  position: relative; overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px; padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.login .landing-adv article:hover {
  border-color: color-mix(in srgb, var(--ic1, #7c3aed) 35%, transparent);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--ic1, #7c3aed) 12%, transparent);
  transform: translateY(-3px);
}
/* 渐变图标(硅基流动风格:彩色渐变方块 + 白色线条图标) */
.login .landing-adv-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--ic1, #7c3aed), var(--ic2, #a78bfa));
  display: grid; place-items: center; margin-bottom: 16px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ic1, #7c3aed) 25%, transparent);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
}
.login .landing-adv-icon svg {
  width: 24px; height: 24px; fill: none;
  stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.login .landing-adv article:hover .landing-adv-icon { transform: scale(1.08); }
/* ::before 伪元素不再用左侧指示条,改为 hover 顶部主题色光晕 */
.login .landing-adv article::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 80px;
  background: radial-gradient(ellipse 80% 100% at 50% 0%, color-mix(in srgb, var(--ic1, #7c3aed) 12%, transparent), transparent 75%);
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.login .landing-adv article:hover::before { opacity: 1; }
.login .landing-adv-icon, .login .landing-adv-k, .login .landing-adv article p { position: relative; z-index: 1; }
.login .landing-adv-k {
  font-size: 17px; font-weight: 700; margin-bottom: 8px; color: #1f2937;
}
.login .landing-adv p { margin: 0; font-size: var(--fs-body); line-height: 1.65; color: #6b7280; }

.landing-adv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 0 auto; }

/* —— 场景药丸 —— */
.landing-scene-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.landing-scene-strip span { padding: 11px 22px; border-radius: 999px; font-size: 14.5px; }
.login .landing-scenes span {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  color: #5b5e68;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.25s ease;
}
.login .landing-scenes span:hover {
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(99,102,241,0.06));
  border-color: rgba(124,58,237,0.2);
  color: #4c1d95;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(124,58,237,0.10);
}

/* —— 落地页页脚淡紫 —— */
.login .landing-footer { background: linear-gradient(180deg, #faf9ff, #f5f3ff) !important; border-top: 1px solid rgba(124,58,237,0.06); }
.login .landing-footer strong { color: #7c3aed !important; }
.login .landing-footer small, .login .landing-footer .muted { color: #9ca0aa !important; }

.landing-footer {
  padding: var(--sp-foot) 28px;
  border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.landing-footer-brand { display: flex; align-items: center; gap: 10px; }
.landing-footer-brand img { width: 30px; height: 30px; border-radius: 8px; }
.landing-footer-brand strong { font-size: 16px; color: var(--text); }
.landing-footer-brand small { display: block; color: var(--muted); font-size: 12px; }

@media (max-width: 860px) {
  .topnav { padding: 0 16px; gap: 12px; }
  .topnav-links { display: none; }
  .landing-hero { padding: 24px 18px 36px; min-height: calc(100vh - 60px); }
  .landing-hero-inner { padding: 56px 18px 32px; }
  .landing-cards, .landing-adv, .landing-scenes { padding: var(--sp-section-m) 18px; }
  .login .landing-cards { padding-top: var(--sp-section-m); }
  .landing-card-grid, .landing-adv-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .login .landing-card { padding: 24px; }
  .ms-vendor-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .landing-card-grid, .landing-adv-grid { grid-template-columns: 1fr; }
  .ms-vendor-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .ms-card { height: auto; min-height: 0; }
}

/* P3:客户/管理顶栏里的导航按钮(横向胶囊) */
.topnav .customer-nav,
.topnav .nav {
  width: auto; text-align: center; padding: 7px 14px; border-radius: 999px; font-size: 14px;
  background: transparent; color: var(--muted); border: 1px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.topnav .customer-nav:hover,
.topnav .nav:hover { background: var(--soft); color: var(--primary-2); }
.topnav .customer-nav.active,
.topnav .nav.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.topnav .customer-nav.recharge-nav { margin-top: 0; }

/* ============================================================
   FX:首屏深华丽 + 全站动效(粒子/霓虹/跑马灯/滚动揭示/数字滚动)
   纯 vanilla,数据契约零改动;reduced-motion 全局降级
   ============================================================ */
/* —— 落地 hero:深色渐变 + 粒子层 + 霓虹流光标题 —— */
.landing-hero {
  position: relative; overflow: hidden;
  min-height: 88vh; max-width: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(99,102,241,0.15), transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 70%, rgba(129,140,248,0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(129,140,248,0.10), transparent 60%),
    linear-gradient(180deg, #060b18 0%, #0a1525 40%, #0b1f1d 100%);
  color: var(--hero-text);
}
/* 动态渐变光球 */
.landing-hero::before {
  content: ""; position: absolute; top: -20%; left: -10%;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.20), transparent 65%);
  filter: blur(60px);
  animation: yb-orb-a 14s ease-in-out infinite alternate;
  pointer-events: none;
}
.landing-hero::after {
  content: ""; position: absolute; bottom: -15%; right: -10%;
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(129,140,248,0.18), transparent 65%);
  filter: blur(70px);
  animation: yb-orb-b 18s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes yb-orb-a {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(60px,40px) scale(1.15); }
}
@keyframes yb-orb-b {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(-50px,-30px) scale(1.1); }
}
.landing-hero .eyebrow { color: var(--hero-accent); letter-spacing: .14em; text-transform: uppercase; font-size: 13px; }
.hero-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.landing-hero-inner { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 96px 28px 40px; }
.landing-hero .hero-title {
  margin: 16px auto 18px; max-width: 860px;
  font-size: clamp(34px, 5.6vw, 60px); line-height: 1.1; font-weight: 800;
  background: linear-gradient(110deg, #ffffff 8%, var(--hero-accent) 38%, var(--hero-accent-2) 62%, #ffffff 96%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hero-shimmer 7s linear infinite;
  filter: drop-shadow(0 0 28px rgba(99, 102, 241, .25));
}
@keyframes hero-shimmer { to { background-position: 220% center; } }
.landing-hero .landing-sub { color: var(--hero-muted); max-width: 680px; margin: 0 auto; font-size: 17px; line-height: 1.75; }
.landing-hero .landing-cta { margin-top: 30px; }
.landing-hero .landing-cta button { position: relative; padding: 13px 30px; border-radius: 999px; font-size: 15px; font-weight: 600; border: 1px solid transparent; transition: transform .18s var(--ease-out-expo), box-shadow .25s ease, background .2s ease; }
.landing-hero .landing-cta button#heroRegisterBtn {
  background: linear-gradient(120deg, var(--hero-accent), var(--hero-accent-2));
  color: #fff; animation: hero-pulse 2.8s ease-in-out infinite;
}
@keyframes hero-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0), 0 10px 30px rgba(129, 140, 248, .30); }
  50%      { box-shadow: 0 0 0 14px rgba(129, 140, 248, 0), 0 16px 42px rgba(129, 140, 248, .52); }
}
.landing-hero .landing-cta button#heroRegisterBtn:hover { transform: translateY(-2px); }
.landing-hero .landing-cta button.secondary { background: rgba(255, 255, 255, .06); color: var(--hero-text); border-color: rgba(255, 255, 255, .22); backdrop-filter: blur(6px); }
.landing-hero .landing-cta button.secondary:hover { background: rgba(255, 255, 255, .12); transform: translateY(-2px); }

/* —— 厂商跑马灯 —— */
.landing-hero .landing-vendors {
  position: relative; z-index: 1; margin-top: 56px; padding: 14px 0; overflow: hidden; max-width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.landing-hero .vendors-track { display: flex; gap: 14px; width: max-content; padding: 0 28px; animation: vendor-marquee 32s linear infinite; }
.landing-hero .vendors-track:hover { animation-play-state: paused; }
.landing-hero .landing-vendors span {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; color: var(--hero-text);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(6px);
}
.landing-hero .landing-vendors img { width: 20px; height: 20px; border-radius: 5px; }
@keyframes vendor-marquee { to { transform: translateX(-50%); } }

/* —— 顶栏:白玻璃 + 深字(始终清晰可读) —— */
.topnav[data-topnav="landing"] {
  background: rgba(255,255,255,0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(0,0,0,0.06);
  transition: background .3s ease, box-shadow .3s ease;
}
.topnav[data-topnav="landing"] .topnav-brand,
.topnav[data-topnav="landing"] .topnav-brand strong { color: #1a1a2e; }
.topnav[data-topnav="landing"] .topnav-link { color: #555; }
.topnav[data-topnav="landing"] .topnav-link:hover { background: rgba(0,0,0,0.05); color: #7c3aed; }
.topnav[data-topnav="landing"] .topnav-btn { background: rgba(255,255,255,0.6); border-color: rgba(0,0,0,0.1); color: #333; }
.topnav[data-topnav="landing"] .topnav-btn-ghost { background: transparent; border-color: transparent; color: #666; }
/* 滚动后加阴影增强层次 */
.topnav[data-topnav="landing"].scrolled {
  background: rgba(255,255,255,0.92);
  box-shadow: 0 1px 12px rgba(0,0,0,0.05);
}

/* —— 落地页顶栏按钮:硅基流动风格(浅底深字 + 实色注册) —— */
.topnav-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.6);
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
}
.topnav-btn:hover { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.15); transform: translateY(-1px); }
.topnav-btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.topnav-btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
.topnav-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #666;
}
.topnav-btn-ghost:hover { background: rgba(0,0,0,0.05); border-color: transparent; color: #333; }

/* —— 滚动揭示(全站通用,[data-reveal] + .in)—— */
[data-reveal] { opacity: 0; transform: translateY(18px); will-change: opacity, transform;
  transition: opacity var(--dur) var(--ease-out-expo), transform var(--dur) var(--ease-out-expo);
  transition-delay: calc(var(--d, 0) * 80ms); }
[data-reveal].in { opacity: 1; transform: none; }

/* —— 卡片玻璃质感(非落地页兜底) —— */
.landing-card { background: rgba(255, 255, 255, .72); backdrop-filter: blur(8px); }
.landing-card:hover { box-shadow: 0 18px 44px rgba(16, 24, 40, .12); }

/* —— 落地页卡片 3D 倾斜增强(桌面 pointer:fine 才启用) —— */
@media (pointer: fine) {
  .login .landing-card:hover {
    transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateZ(14px);
  }
  .login .landing-card-icon { transform: translateZ(28px); }
  .login .landing-card:hover .landing-card-icon { transform: translateZ(32px) scale(1.1) rotate(-6deg); }
  .login .landing-card h3, .login .landing-card p { transform: translateZ(18px); }
}
@media (pointer: coarse) {
  .login .landing-card { transform: none !important; }
  .login .landing-card:hover { transform: translateY(-4px); }
}

/* —— reduced-motion 全局降级 —— */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .landing-hero .hero-title, .landing-hero .vendors-track, .landing-hero .landing-cta button#heroRegisterBtn { animation: none !important; }
  .hero-fx { display: none; }
}
.ms-card-top { display: flex; align-items: center; gap: 8px; }
.ms-logo { width: 26px; height: 26px; border-radius: 7px; object-fit: contain; background: #f1f5f9; flex-shrink: 0; }
.ms-vendor { font-size: 13px; color: var(--muted); }
.ms-type { margin-left: auto; font-size: 11px; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--primary-2); }
.ms-id { font-size: 15px; font-weight: 600; color: var(--text); word-break: break-all; line-height: 1.35; }
.ms-date { font-size: 12px; color: var(--muted); }
.ms-desc { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ms-feat { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-feat-chip { font-size: 11.5px; padding: 3px 9px; border-radius: 8px; background: #f1f5f9; color: #475569; }
.ms-price { display: flex; gap: 10px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ms-price-cell { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ms-price-cell small { font-size: 11px; color: var(--muted); }
.ms-price-cell strong { font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.ms-price-cell em { font-size: 11px; color: var(--muted); font-style: normal; }
.ms-ctx { font-size: 12px; color: var(--muted); }
.ms-loading { padding: 32px; text-align: center; color: var(--muted); }
.chat-send.loading {
  opacity: 0.7;
  cursor: progress;
}
.chat-send.paused,
#customerApp .chat-input .chat-send.paused,
.chat-input .chat-send.paused {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #fff !important;
  cursor: pointer;
  opacity: 1;
}
.chat-send.paused .pause-icon,
#customerApp .chat-input .chat-send.paused .pause-icon {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0 auto;
}
/* 用户消息编辑按钮 */
.msg-edit-btn {
  align-self: center;
  margin-left: 6px;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s;
  display: grid;
  place-items: center;
}
.msg.user:hover .msg-edit-btn { opacity: 1; }
.msg-edit-btn:hover { background: rgba(15,23,40,.08); color: #111827; }
/* 编辑消息模态框 */
.edit-message-modal {
  position: relative;
  width: min(640px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(16,24,40,.24);
  overflow: hidden;
}
.modal-overlay.open .edit-message-modal { animation: yb-pop .2s ease; }
@keyframes yb-pop {
  from { transform: scale(.96); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.edit-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.edit-message-header h3 { margin: 0; font-size: 16px; }
.edit-message-body {
  padding: 16px 20px;
  flex: 1;
  overflow: auto;
}
.edit-message-textarea {
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  background: #fafbfc;
  box-sizing: border-box;
}
.edit-message-textarea:focus { outline: 2px solid #0f766e; border-color: transparent; background: #fff; }
.edit-attachment-preview {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
}
.edit-attachment-preview:not(.has-item) { display: none; }
.edit-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.edit-attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
}
.attachment-preview-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
}
.edit-attachment-item img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.attachment-preview-item img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.edit-attachment-item .attach-file-icon { color: var(--primary-2); flex-shrink: 0; }
.attachment-preview-item .attach-file-icon { color: var(--primary-2); flex-shrink: 0; }
.attachment-preview .attach-file-icon { color: var(--primary-2); flex-shrink: 0; }
.edit-attachment-item span,
.attachment-preview-item span {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 13px;
}
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.message-attachment {
  display: inline-flex;
  max-width: 100%;
}
.edit-attachment-remove {
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px;
}
.edit-attachment-remove:hover { color: #ef4444; }
.attachment-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}
.attachment-remove:hover { color: #ef4444; }
.edit-message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}
.edit-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.edit-attach-btn:hover { color: #0f766e; border-color: #0f766e; }
.edit-message-actions { display: flex; gap: 10px; }
.edit-message-actions button {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}
.edit-message-actions #editMessageSubmit {
  background: #0f766e; color: #fff; border-color: #0f766e;
}
.edit-message-actions #editMessageSubmit:hover { background: #0c5d56; }
@keyframes chat-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-spinner { animation: none; }
}
.chat-input {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  position: relative;
  z-index: 20;
}
.chat-input textarea {
  min-height: 42px;
  max-height: 132px;
  padding: 10px 8px;
  border: 0;
  resize: none;
  line-height: 1.45;
  background: transparent;
}
.chat-input textarea:focus,
.chat-input button:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  outline-offset: 2px;
}
/* 选中具体任务模式时,输入框文字使用偏淡色(需覆盖 #c-chat 高优先级规则) */
#c-chat .chat-input textarea.task-active { color: #8a93a4 !important; }
.chat-input textarea {
  flex: 1 1 200px;
  min-width: 120px;
}
.chat-input .attachment-button {
  flex: 0 0 auto;
}
.chat-input .chat-send {
  flex: 0 0 auto;
}
.attachment-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  background: #eef7f4;
  color: var(--primary-2);
  border: 1px solid #cce8e2;
  font-size: 22px;
  line-height: 1;
}
.attachment-button:hover {
  background: #dff3ef;
  color: var(--primary-2);
}
.chat-send {
  min-height: 42px;
  border-radius: 12px;
}
.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.attachment-preview img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
}
.attachment-preview span {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 13px;
}
/* 附件预览的移除按钮:叉叉图标,与编辑框风格统一,覆盖 .mini 方块样式 */
.attachment-preview #removeAttachment {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}
.attachment-preview #removeAttachment:hover {
  color: #ef4444;
}
.portal {
  min-height: 100vh;
  display: block;
  background:
    radial-gradient(circle at 78% 8%, rgba(32, 122, 116, 0.12), transparent 32%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
}
.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: #111827;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.portal-brand {
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.portal-nav {
  display: grid;
  gap: 6px;
}
.customer-nav {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 11px 12px;
}
.customer-nav:hover,
.customer-nav.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.customer-nav.recharge-nav {
  margin-top: 8px;
}
.portal-main {
  min-width: 0;
  padding: 24px;
}
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.portal-topbar h2 {
  margin: 4px 0 6px;
  font-size: 28px;
}
.portal-topbar p {
  margin: 0;
}
.portal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.balance-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
  white-space: nowrap;
}
.balance-chip span,
.balance-chip small {
  color: var(--muted);
  font-size: 12px;
}
.balance-chip strong {
  font-size: 16px;
  color: var(--primary-2);
}
.customer-view {
  animation: viewIn 140ms ease-out;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.marketing-hero {
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: 28px;
  padding: 38px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--soft), #ffffff);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.marketing-hero h1 {
  margin: 0 0 12px;
  font-size: 42px;
  line-height: 1.12;
}
.marketing-hero p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}
.marketing-hero .eyebrow {
  color: var(--primary);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.hero-actions .secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}
.hero-visual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.hero-visual span {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}
.hero-visual img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.vendor-section {
  padding: 18px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.vendor-grid,
.channel-grid,
.quick-grid,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.vendor-card {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
  align-content: center;
}
.vendor-card img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}
.vendor-card strong { font-size: 18px; }
.vendor-card small {
  color: var(--muted);
}
.vendor-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.14);
  transform: translateY(-2px);
}
.customer-plan-card {
  display: grid;
  gap: 10px;
}
.customer-plan-card h4 {
  font-size: 22px;
  margin: 0;
}
.customer-plan-card strong {
  font-size: 30px;
  color: var(--primary-2);
}
.customer-metrics {
  margin-bottom: 16px;
}
/* ============================================================
  聊天面板（参考 877ai 模型选择器 + 对话区）
  ============================================================ */
.chat-panel {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 120px);
  min-height: 600px;
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
}
.chat-sidebar {
  flex: 0 0 240px;
  width: 240px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #f7f9fb;
  overflow: hidden;
}
.conv-new {
  margin: 14px auto 8px;
  padding: 10px 12px;
  border: 1px dashed var(--primary);
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.06);
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  flex-shrink: 0;
}
.conv-new:hover {
  background: rgba(15, 118, 110, 0.12);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.12);
}
.conv-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 12px;
}
.conv-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.conv-item:hover {
  background: rgba(15, 118, 110, 0.06);
}
.conv-item.active {
  background: rgba(15, 118, 110, 0.12);
}
.conv-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  overflow: hidden;
  font-size: 14px;
}
.conv-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.conv-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-delete {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.conv-item:hover .conv-delete,
.conv-item.active .conv-delete {
  opacity: 1;
}
.conv-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  flex-shrink: 0;
}
.chat-model-picker {
  position: relative;
}
.chat-model-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
  transition: border-color .2s, box-shadow .2s;
}
.chat-model-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15,118,110,.12);
}
.chat-model-icon {
  font-size: 22px;
  line-height: 1;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.chat-model-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.chat-model-label {
  display: grid;
  text-align: left;
}
.chat-model-label small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.chat-model-label strong {
  font-size: 15px;
  font-weight: 700;
}
.chat-caret {
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
.chat-model-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 300px;
  max-height: 320px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16,24,40,.16);
  z-index: 50;
}
.chat-model-list {
  overflow: auto;
  max-height: 260px;
  padding: 4px;
}
.chat-model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.chat-model-option:hover {
  background: #f2f7f6;
}
.chat-model-option.active {
  background: rgba(15,118,110,.1);
  color: var(--primary-2);
  font-weight: 700;
}
.chat-model-vendor {
  font-size: 11px;
  color: var(--muted);
  background: #f2f4f7;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.chat-model-option.active .chat-model-vendor {
  background: rgba(15,118,110,.14);
  color: var(--primary);
}
.chat-model-text {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-model-label {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}
.chat-model-label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.chat-model-option.active .chat-model-label small {
  color: var(--primary);
}
.chat-model-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.console-panel {
  min-height: calc(100vh - 150px);
  background:
    radial-gradient(circle at 12% 8%, rgba(15, 118, 110, 0.08), transparent 26%),
    radial-gradient(circle at 88% 18%, rgba(37, 99, 235, 0.08), transparent 28%),
    #fff;
}
.chat-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  padding: 0 20px 20px;
}
.chat-panel .chat-box {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin: 16px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  background-image:
    radial-gradient(circle at 16% 12%, rgba(15, 118, 110, 0.06), transparent 24%),
    radial-gradient(circle at 84% 10%, rgba(37, 99, 235, 0.05), transparent 24%);
}
.chat-panel .chat-input {
  margin: 0;
  border-radius: 16px;
}
.quick-card {
  min-height: 108px;
  text-align: left;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  align-content: center;
}
.quick-card:hover {
  background: #f8fbfa;
  color: var(--text);
}
.quick-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.channel-card,
.profile-grid article,
.subscription-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 16px;
}
.channel-card {
  display: grid;
  gap: 10px;
}
.channel-card div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.channel-card p {
  margin: 0;
  color: var(--primary-2);
  font-weight: 800;
}
.channel-card small {
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #12b76a;
  box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.14);
}
.subscription-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.subscription-card h3 {
  margin: 0 0 8px;
}
.redeem-panel {
  max-width: 760px;
  display: grid;
  gap: 18px;
}
.redeem-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.profile-grid article {
  min-height: 112px;
  display: grid;
  gap: 8px;
  align-content: center;
}
.profile-grid small {
  color: var(--muted);
}
.profile-grid strong {
  overflow-wrap: anywhere;
}
.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics, .grid.two, .cards, .form-grid { grid-template-columns: 1fr; }
  .hero-band { grid-template-columns: 1fr; }
  .key-create { grid-template-columns: 1fr; }
  .chat-controls { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .portal { grid-template-columns: 1fr; }
  .portal-sidebar {
    position: static;
    height: auto;
  }
  .portal-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .marketing-hero,
  .vendor-grid,
  .channel-grid,
  .quick-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-art {
    min-height: 360px;
  }
}
@media (max-width: 620px) {
  .main { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  nav, .form-row { grid-template-columns: 1fr; }
  .portal-main { padding: 16px; }
  .portal-topbar,
  .portal-actions,
  .subscription-card {
    align-items: stretch;
    flex-direction: column;
  }
  .portal-nav { grid-template-columns: 1fr; }
  .marketing-hero { padding: 24px; }
  .marketing-hero h1 { font-size: 32px; }
  .hero-visual { grid-template-columns: 1fr; }
  .redeem-form { grid-template-columns: 1fr; }
  .login { padding: 14px; }
  .login-art { padding: 24px; }
  .login-art-copy h2 { font-size: 30px; }
  .login-forms { padding: 24px; }
}

/* ============================================================
   左栏 + 导航（盈倍云视觉·简洁单色版）
   单色底、纯色按钮、无渐变、无极光动画
   ============================================================ */
.sidebar,
.portal-sidebar {
  isolation: isolate;
  overflow: hidden;
  color: #1f2937;
}
.sidebar { position: relative; } /* 管理端侧栏；.portal-sidebar 保留原 sticky */
.sidebar,
.portal-sidebar {
  background: #eef1f7; /* 单一浅冷灰，无渐变 */
}
.brand small { color: #6b7280; }
.portal-brand { border-bottom-color: rgba(15, 23, 42, 0.08) !important; }

.nav,
.customer-nav {
  color: #334155;
  background: #ffffff; /* 纯白按钮，单色 */
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.nav:hover,
.customer-nav:hover {
  color: #0f172a;
  background: #f3f5f9;
  border-color: rgba(15, 23, 42, 0.14);
}
.nav.active,
.customer-nav.active {
  color: #ffffff;
  background: var(--primary); /* 单色品牌青，无渐变 */
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.22);
}
.customer-nav.recharge-nav {
  margin-top: 10px;
}

/* ============================================================
   页面内 tab（用量监控 / 账户中心）—— 与右栏浅色内容区协调
   ============================================================ */
.yb-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}
.yb-tab {
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: color .25s ease, background .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.yb-tab:hover {
  color: var(--text);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.yb-tab.active {
  color: #ffffff;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.28);
}
.yb-tab-panel { display: none; }
.yb-tab-panel.active {
  display: block;
  animation: yb-tab-in .3s ease;
}

/* ============================================================
   厂商模型详情页
   ============================================================ */
.vendor-models-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.vendor-models-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vendor-models-title img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.vendor-models-title h3 {
  margin: 0;
}
.vendor-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.vendor-model-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.vendor-model-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.1);
}
.vendor-model-name {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}
@keyframes yb-tab-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   新手教程弹窗
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: flex;
  animation: yb-fade-in .25s ease;
}
@keyframes yb-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.tutorial-modal {
  position: relative;
  width: min(680px, 92vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(24px) scale(0.96);
  transition: transform .3s ease;
}
.modal-overlay.open .tutorial-modal {
  transform: translateY(0) scale(1);
}
.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  z-index: 2;
}
.modal-close-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
/* 顶栏新手教程入口按钮 */
.tutorial-entry-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
  cursor: pointer;
  transition: background .15s, box-shadow .15s, color .15s, transform .12s;
}
.tutorial-entry-btn:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.28);
  transform: translateY(-1px);
}
.portal-actions .logoutBtn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .12s;
}
.portal-actions .logoutBtn:hover {
  background: #fff5f5;
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.3);
  box-shadow: 0 6px 16px rgba(180, 35, 24, 0.14);
  transform: translateY(-1px);
}
.tutorial-entry-btn .tutorial-entry-icon {
  font-size: 15px;
  line-height: 1;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.tutorial-header {
  position: relative;
  padding: 28px 32px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(180deg, rgba(15,118,110,0.04), transparent);
}
.tutorial-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}
.tutorial-header p {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
}
.tutorial-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 20px;
}
/* 教程入口卡片 */
.tutorial-home {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tutorial-card {
  padding: 24px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  background:
    radial-gradient(circle at 100% 0%, rgba(15,118,110,0.05), transparent 50%),
    #fff;
}
.tutorial-card:hover {
  border-color: #0d9488;
  box-shadow: 0 8px 28px rgba(15, 118, 110, 0.12);
  transform: translateY(-3px);
}
.tutorial-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.tutorial-card:first-child .tutorial-card-icon { background: rgba(15,118,110,0.1); }
.tutorial-card:last-child .tutorial-card-icon { background: rgba(37,99,235,0.1); }
.tutorial-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.tutorial-card p {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.55;
}
.tutorial-card-arrow {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: #0d9488;
}
/* 步骤视图 */
.tutorial-steps-view {
  display: none;
}
.tutorial-steps-view.active {
  display: block;
}
/* 步骤指示器 */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  transition: background .25s, width .25s;
}
.step-dot.active {
  width: 28px;
  background: #0d9488;
}
.step-dot.done {
  background: #0d9488;
}
/* 步骤内容 */
.step-slide {
  display: none;
  animation: tutorialFadeUp .35s ease;
}
.step-slide.active {
  display: block;
}
@keyframes tutorialFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.step-slide .step-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(15,118,110,0.08);
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}
.step-slide h4 {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}
.step-slide .step-desc {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.7;
  margin-bottom: 16px;
}
.step-slide .step-visual {
  padding: 16px 18px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  line-height: 1.65;
  color: #334155;
}
.step-slide .step-visual code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  font-family: "Fira Code", "Consolas", monospace;
  font-size: 12px;
  color: #0f766e;
}
.step-slide .step-visual .visual-title {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 8px;
}
.step-slide .step-tip {  margin-top: 12px;
  padding: 10px 14px;
  border-left: 3px solid #0d9488;
  background: rgba(15,118,110,0.04);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  color: #475569;
}
.step-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.28);
  transition: transform .15s, box-shadow .15s;
}
.step-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.36);
}
/* 完成页 */
.step-done {
  display: none;
  text-align: center;
  padding: 20px 0 10px;
  animation: tutorialFadeUp .35s ease;
}
.step-done.active {
  display: block;
}
.step-done .done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: rgba(16,185,129,0.1);
  display: grid;
  place-items: center;
  font-size: 28px;
}
.step-done h4 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}
.step-done p {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.6;
}
/* 底部导航 */
.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-top: 1px solid #e5e7eb;
  background: #fafbfc;
}
.tutorial-back-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s;
}
.tutorial-back-btn:hover {
  border-color: #cbd5e1;
}
.tutorial-step-nav {
  display: flex;
  gap: 10px;
}
.tutorial-nav-btn {
  padding: 10px 22px;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.tutorial-nav-btn:active {
  transform: scale(0.97);
}
.tutorial-nav-btn.prev {
  background: #f1f5f9;
  color: #475569;
}
.tutorial-nav-btn.prev:hover {
  background: #e2e8f0;
}
.tutorial-nav-btn.next {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15,118,110,0.25);
}
.tutorial-nav-btn.next:hover {
  box-shadow: 0 6px 18px rgba(15,118,110,0.3);
}
.tutorial-nav-btn.finish {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}
/* 响应式 */
@media (max-width: 560px) {
  .tutorial-home { grid-template-columns: 1fr; }
  .tutorial-header, .tutorial-body, .tutorial-footer { padding-left: 20px; padding-right: 20px; }
}

/* ============================================================
   厂商选择器（左上）+ 模型内联选择器（左下）
   ============================================================ */
.chat-vendor-picker {
  position: relative;
}
.chat-vendor-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
  transition: border-color .2s, box-shadow .2s;
}
.chat-vendor-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15,118,110,.12);
}
.chat-vendor-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 18px;
}
.chat-vendor-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.chat-vendor-label {
  display: grid;
  text-align: left;
}
.chat-vendor-label small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.chat-vendor-label strong {
  font-size: 14px;
  font-weight: 700;
}
.chat-vendor-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16,24,40,.16);
  z-index: 50;
  padding: 6px;
}
.vendor-card-item {
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}
.vendor-card-item:hover {
  background: #f2f7f6;
}
.vendor-card-item.active {
  background: rgba(15,118,110,.1);
  border-color: rgba(15,118,110,.3);
}
.vendor-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vendor-card-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 6px;
}
.vendor-card-row strong {
  font-size: 14px;
  color: var(--text);
}
.vendor-card-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  background: #f2f4f7;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.vendor-card-item.active .vendor-card-count {
  background: rgba(15,118,110,.14);
  color: var(--primary);
}
.vendor-card-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* 模型内联选择器（输入框左下） */
.chat-model-picker-inline {
  position: relative;
  flex: 0 0 auto;
}
.chat-model-picker-inline .chat-model-btn {
  padding: 7px 12px;
  gap: 7px;
}
.chat-model-picker-inline .chat-model-btn strong {
  font-size: 13px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-model-picker-inline .chat-model-icon {
  width: 20px;
  height: 20px;
}
.chat-model-picker-inline .chat-model-dropdown {
  bottom: calc(100% + 6px);
  top: auto;
  left: 0;
  width: 280px;
}

/* ============================================================
   会话更多按钮 + 操作菜单 + 置顶角标
   ============================================================ */
.conv-pin {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
}
.conv-more {
  flex: 0 0 auto;
  margin-left: auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;            /* 正圆 */
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;                      /* 三个圆点间距 */
  opacity: 0;
  transition: opacity .15s, box-shadow .2s, color .15s, background .15s;
}
/* 三个真实圆点，不依赖字体字形，保证像素级居中 */
.conv-more .dot {
  width: 3px !important;
  height: 3px !important;
  border-radius: 50% !important;
  background: currentColor !important;
  display: block !important;
  flex: 0 0 auto !important;
  padding: 0 !important;
  margin: 0 !important;
}
.conv-item:hover .conv-more,
.conv-item.active .conv-more {
  opacity: 1;
}
.conv-more:hover {
  background: rgba(15, 23, 42, 0.08);   /* 恢复之前的灰色 */
  color: var(--text);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);  /* 圆形阴影 */
}
.conv-menu {
  width: 150px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
  padding: 4px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conv-menu-item {
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.conv-menu-item:hover {
  background: #f2f4f7;
}
.conv-menu-item.danger {
  color: #ef4444;
}
.conv-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================================
   厂商选择器（左上）+ 模型内联选择器（左下）
   ============================================================ */
.chat-vendor-picker,
.chat-model-picker-inline {
  position: relative;
}
.chat-vendor-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
  transition: border-color .2s, box-shadow .2s;
}
.chat-vendor-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15,118,110,.12);
}
.chat-vendor-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 20px;
}
.chat-vendor-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.chat-vendor-label {
  display: grid;
  text-align: left;
}
.chat-vendor-label small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.chat-vendor-label strong {
  font-size: 15px;
  font-weight: 700;
}
.chat-vendor-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  max-height: 380px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16,24,40,.16);
  z-index: 50;
}
.chat-vendor-list {
  overflow-y: auto;
  max-height: 372px;
  padding: 6px;
}
.vendor-card-item {
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}
.vendor-card-item:hover {
  background: #f2f7f6;
}
.vendor-card-item.active {
  background: rgba(15,118,110,.1);
  border-color: rgba(15,118,110,.3);
}
.vendor-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vendor-card-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}
.vendor-card-row strong {
  font-size: 14px;
  color: var(--text);
}
.vendor-card-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  background: #f2f4f7;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.vendor-card-item.active .vendor-card-count {
  background: rgba(15,118,110,.14);
  color: var(--primary);
}
.vendor-card-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding-left: 36px;
}

/* 模型内联选择器（输入框内左侧） */
.chat-model-picker-inline {
  flex: 0 0 auto;
  align-self: center;
}
.chat-panel .chat-model-btn {
  padding: 6px 12px;
  gap: 8px;
}
.chat-panel .chat-model-btn .chat-model-icon {
  width: 20px;
  height: 20px;
}
.chat-panel .chat-model-btn .chat-model-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.chat-panel .chat-model-btn #chatModelName {
  font-size: 13px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   会话列表：更多菜单 + 置顶
   ============================================================ */
.conv-pin {
  flex: 0 0 auto;
  font-size: 13px;
  filter: grayscale(0.3);
}
.conv-item.pinned .conv-title {
  font-weight: 600;
}

/* ============================================================
   厂商图标渲染优化（解决 .ico/png 放大模糊问题）
   ============================================================ */
.chat-vendor-icon img,
.vendor-card-icon,
.vendor-card-item img,
.chat-model-icon img,
.chat-model-option img,
.conv-icon img,
.msg .avatar img,
.hero-visual img,
.vendor-grid img,
.vendor-models-title img {
  image-rendering: -webkit-optimize-contrast;
  -ms-interpolation-mode: nearest-neighbor;
  shape-rendering: geometricPrecision;
}
/* SVG 矢量图保持平滑（不需要锐化） */
img[src$=".svg"] {
  image-rendering: auto !important;
}

/* ============================================================
   厂商图标渲染优化（解决 .ico / 小尺寸 png 模糊问题）
   ============================================================ */
.msg .avatar img,
.conv-icon img,
.chat-model-icon img,
.chat-vendor-icon img,
.vendor-card-icon,
.vendor-models-title img,
.hero-visual img,
.vendor-grid img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ============================================================
   对话输入栏 · 统一尺寸 + 美化
   附件 / 模型 / 输入框 / 发送
   全部控件统一 42px 高、12px 圆角、一致的悬浮/聚焦反馈
   视觉层级:发送=主操作(实心青)、附件=薄荷强调、模型=中性悬浮转青
   ============================================================ */
.chat-task-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 18px 10px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: #f2f4f8;
  border: 1px solid #e4e7ee;
  border-radius: 9px;
}
.chat-task-strip::-webkit-scrollbar { display: none; }
.chat-task-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 13px;
  color: #667085;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.chat-task-btn:hover { color: #362393; background: rgba(255,255,255,.72); }
.chat-task-btn.active {
  color: #4e2dcc;
  background: #fff;
  border-color: #d9d3f5;
  box-shadow: 0 2px 7px rgba(44,36,83,.08);
}

.chat-input { gap: 8px; align-items: flex-end; }

/* —— 统一基底:高度 / 圆角 / 字号 / 过渡 —— */
.chat-input .attachment-button,
.chat-input .chat-model-btn,
.chat-input .chat-send {
  height: 42px;
  box-sizing: border-box;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease,
              box-shadow .18s ease, transform .08s ease;
}
.chat-input .chat-model-btn strong { font-size: 13px; }

/* —— 附件按钮:薄荷色方形图标钮 —— */
.chat-input .attachment-button {
  width: 42px;
  padding: 0;
  background: var(--soft);
  color: var(--primary);
  border: 1px solid #cce0d8;
  font-size: 22px;
  font-weight: 400;
}
.chat-input .attachment-button:hover {
  background: #d8efe8;
  border-color: var(--primary);
}
.chat-input .attachment-button:active { transform: translateY(1px); }

/* —— 模型选择:中性,悬浮抬升转青 —— */
.chat-input .chat-model-btn {
  padding: 0 12px;
  gap: 8px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
.chat-input .chat-model-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.12);
}
.chat-input .chat-model-btn .chat-caret { color: var(--muted); transition: color .18s ease; }
.chat-input .chat-model-btn:hover .chat-caret { color: var(--primary); }

/* —— 发送:主操作,实心青 CTA(避开 paused/loading 态) —— */
.chat-input .chat-send:not(.paused):not(.loading) {
  padding: 0 20px;
  min-height: 42px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.22);
}
.chat-input .chat-send:not(.paused):not(.loading):hover {
  background: var(--primary-2);
  border-color: var(--primary-2);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.30);
}
.chat-input .chat-send:not(.paused):not(.loading):active { transform: translateY(1px); }

/* —— 统一聚焦环(键盘可达) —— */
.chat-input .attachment-button:focus-visible,
.chat-input .chat-model-btn:focus-visible,
.chat-input .chat-send:focus-visible,
.chat-input textarea:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

.msg.assistant .assistant-content {
  min-width: 0;
  max-width: 100%;
}
.msg-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
}
.msg-result-actions .msg-preview-btn,
.msg-result-actions .msg-artifact-btn { margin-top: 0; }
.msg-artifact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 12px;
  color: #4e2dcc;
  background: #f7f5ff;
  border: 1px solid #d9d3f5;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.msg-artifact-btn:hover { background: #eeeaff; border-color: #aa99ed; transform: translateY(-1px); }
.msg-artifact-btn:disabled { cursor: wait; opacity: .65; transform: none; }
.chat-task-result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  margin: 1px 0 8px;
  padding: 2px 8px;
  color: #5135bb;
  background: #f0edff;
  border: 1px solid #dfd8ff;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

/* ============================================================
   模型对话 2026 · 聚焦式智能工作台
   保留盈倍云青绿色品牌，以更轻的层级和大输入焦点重组体验
   ============================================================ */
#c-chat {
  --chat-accent: #4f46e5;
  --chat-accent-2: #6558f5;
  --chat-ink: #172033;
  --chat-subtle: #768198;
  --chat-line: #e4e8f1;
  /* 抵消 .portal-main 的 24px padding,让对话界面充满整个区域 */
  margin: -24px;
}
/* 对话视图:标题栏保持和其他界面一致,但缩小上下间距减少留白 */
.portal-main:has(#c-chat:not(.hidden)) { padding-top: 10px; }
.portal-main:has(#c-chat:not(.hidden)) .portal-topbar { margin-bottom: 6px; }
#c-chat .chat-panel {
  min-height: 640px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#c-chat .chat-sidebar {
  flex-basis: 240px;
  width: 240px;
  padding: 12px;
  border-right: 1px solid #e8ebf2;
  background: linear-gradient(180deg, #f7f8fc 0%, #f3f5fa 100%);
  transition: flex-basis .2s ease, width .2s ease, padding .2s ease;
  overflow: hidden;
}
#c-chat .conv-new {
  width: 100%;
  min-height: 48px;
  margin: 0 0 12px;
  border: 1px solid #d8d9f7;
  border-radius: 13px;
  background: #fff;
  color: #4338ca;
  font-size: 14px;
  box-shadow: 0 5px 18px rgba(57, 48, 145, .06);
}
#c-chat .conv-new:hover { background: #f8f7ff; box-shadow: 0 8px 22px rgba(57, 48, 145, .1); }
#c-chat .conv-list { padding: 0; }
#c-chat .conv-item { min-height: 44px; padding: 9px 11px; border-radius: 11px; }
#c-chat .conv-item:hover { background: rgba(79, 70, 229, .055); }
#c-chat .conv-item.active { background: #eae9fb; }
#c-chat .chat-main {
  background:
    radial-gradient(circle at 50% 32%, rgba(92, 82, 232, .045), transparent 32%),
    linear-gradient(180deg, #fff 0%, #fcfcff 100%);
}
#c-chat .chat-topbar {
  min-height: 70px;
  padding: 12px 24px;
  justify-content: space-between;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
  /* Keep the vendor picker above the chat canvas and welcome actions. */
  position: relative;
  z-index: 100;
}
#c-chat .chat-vendor-dropdown { z-index: 110; }
#c-chat .chat-vendor-btn {
  min-width: 172px;
  min-height: 46px;
  border-color: #dfe4ed;
  border-radius: 13px;
  box-shadow: 0 4px 16px rgba(31,42,68,.055);
}
#c-chat .chat-vendor-btn:hover { border-color: #8b83ef; box-shadow: 0 7px 20px rgba(79,70,229,.12); }
.chat-capability-bar { display: flex; align-items: center; gap: 10px; color: var(--chat-subtle); font-size: 12px; }
.chat-capability-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid #dce9e6; border-radius: 999px; background: #f3faf8; color: #14786d; font-weight: 700; }
.capability-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a394; box-shadow: 0 0 0 4px rgba(22,163,148,.11); }
.chat-capability-divider { width: 1px; height: 18px; background: #e2e6ee; }
#c-chat .chat-shell { padding: 0 16px 8px; }
#c-chat .chat-panel .chat-box {
  margin: 0;
  padding: 16px 8px 8px;
  background: transparent;
  scrollbar-gutter: stable;
  position: relative;
  z-index: 1;
}
#c-chat .chat-welcome {
  width: min(820px, 92%);
  min-height: 100%;
  margin: 0 auto;
  padding: 48px 0 24px;
  align-content: center;
  text-align: center;
  animation: chat-welcome-in .5s cubic-bezier(.2,.75,.25,1) both;
}
#c-chat .chat-welcome-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 22px;
  padding: 13px;
  border: 1px solid rgba(79,70,229,.14);
  border-radius: 18px;
  background: linear-gradient(145deg, #f0efff, #eefaf8);
  box-shadow: 0 16px 38px rgba(55,48,135,.12);
}
#c-chat .chat-welcome-mark img { width: 100%; height: 100%; }
.chat-welcome-eyebrow { display: block; margin-bottom: 9px; color: #6558e8; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
#c-chat .chat-welcome h3 { margin: 0; color: var(--chat-ink); font-size: clamp(28px, 3vw, 40px); line-height: 1.18; letter-spacing: -.035em; }
#c-chat .chat-welcome > p { margin: 10px 0 28px; color: var(--chat-subtle); font-size: 15px; }
#c-chat .chat-welcome-prompt-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; }
#c-chat .chat-welcome-prompt {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid #e1e5ed;
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  color: #3b4559;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(31,42,68,.035);
  transition: transform .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
#c-chat .chat-welcome-prompt:hover { transform: translateY(-2px); border-color: #afa9ef; color: #4338ca; box-shadow: 0 10px 24px rgba(79,70,229,.1); }
#c-chat .chat-task-strip {
  width: min(900px, 100%);
  margin: 0 auto 10px;
  padding: 5px;
  border-color: #e3e6ef;
  border-radius: 13px;
  background: #f3f4f8;
  position: relative;
  z-index: 1;
}
/* 确保模型下拉向上展开时覆盖在任务条之上(不被遮挡) */
#c-chat .chat-model-picker-inline .chat-model-dropdown {
  z-index: 100;
}
#c-chat .chat-task-btn { flex: 1 0 auto; min-height: 34px; border-radius: 9px; }
#c-chat .chat-task-btn.active { color: #4338ca; border-color: #d9d5fb; box-shadow: 0 3px 10px rgba(44,36,83,.08); }
#c-chat .chat-panel .chat-input {
  position: relative;
  z-index: 30;
  width: min(900px, 100%);
  min-height: 68px;
  margin: 0 auto;
  padding: 8px;
  border: 1.5px solid #8f87ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(58,48,145,.12), 0 0 0 4px rgba(99,88,245,.06);
  transition: border-color .2s ease, box-shadow .2s ease;
}
#c-chat .chat-panel .chat-input:focus-within { border-color: #5c52e8; box-shadow: 0 15px 38px rgba(58,48,145,.16), 0 0 0 4px rgba(99,88,245,.1); }
#c-chat .chat-input textarea { min-height: 46px; max-height: 160px; padding: 12px 6px; color: var(--chat-ink); font-size: 14px; line-height: 1.55; }
#c-chat .chat-input .attachment-button { width: 46px; height: 46px; border-color: #e1e5ed; background: #f7f8fb; color: #657086; }
#c-chat .chat-input .attachment-button:hover { border-color: #aaa4ec; background: #f2f1ff; color: #4f46e5; }
#c-chat .chat-input .chat-model-btn { height: 46px; border-color: #e1e5ed; border-radius: 12px; background: #fafbfc; }
#c-chat .chat-input .chat-model-btn:hover { border-color: #aaa4ec; box-shadow: none; }
#c-chat .chat-input .chat-send:not(.paused):not(.loading) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  min-width: 104px;
  padding: 0 17px;
  border-color: var(--chat-accent);
  border-radius: 12px;
  background: linear-gradient(135deg, #6558f5, #4f46e5);
  box-shadow: 0 8px 18px rgba(79,70,229,.25);
}
#c-chat .chat-input .chat-send:not(.paused):not(.loading):hover { background: linear-gradient(135deg, #574bea, #4338ca); border-color: #4338ca; box-shadow: 0 10px 22px rgba(79,70,229,.32); }
#c-chat .chat-input .chat-send.paused { width: 46px; min-width: 46px; height: 46px; border-radius: 12px; }
#c-chat .attachment-preview {
  width: 100%;
  max-width: none;
  margin: 0 0 10px;
  align-self: flex-start;
  box-sizing: border-box;
}
@keyframes chat-welcome-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 980px) {
  #c-chat .chat-panel { height: calc(100vh - 100px); min-height: 560px; }
  #c-chat .chat-sidebar { flex-basis: 200px; width: 200px; }
  #c-chat .chat-welcome-prompt-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .chat-capability-copy, .chat-capability-divider { display: none; }
}
@media (max-width: 620px) {
  #c-chat .chat-panel { border-radius: 0; }
  #c-chat .chat-sidebar { display: none; }
  #c-chat .chat-topbar { min-height: 62px; padding: 9px 12px; }
  #c-chat .chat-vendor-btn { min-width: 140px; }
  #c-chat .chat-shell { padding: 0 10px 12px; }
  #c-chat .chat-welcome { padding-top: 26px; }
  #c-chat .chat-welcome h3 { font-size: 27px; }
  #c-chat .chat-welcome-prompt-grid { grid-template-columns: 1fr 1fr; }
  #c-chat .chat-model-picker-inline { order: 2; }
  #c-chat .chat-input textarea { order: 1; flex-basis: calc(100% - 108px); }
  #c-chat .chat-input .chat-send { order: 3; min-width: 46px; width: 46px; padding: 0; }
  #c-chat .chat-input .chat-send span { display: none; }
}

/* ============================================================
   Phase B: 客户端首页 + 管理后台 动效
   (浅色主题内的滚动揭示 / 数字滚动 / 微交互 / 光晕)
   ============================================================ */

/* —— 客户端首页 hero 浅色光晕背景 —— */
.portal .marketing-hero,
#customerApp .marketing-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 15% 10%, rgba(15,118,110,0.10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(99,102,241,0.08), transparent 55%),
    linear-gradient(135deg, var(--soft, #eef7f4), #ffffff);
}
.portal .marketing-hero::after,
#customerApp .marketing-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 200px at 50% 120%, rgba(15,118,110,0.06), transparent 70%);
  pointer-events: none;
  animation: yb-glow-shift 8s ease-in-out infinite alternate;
}
@keyframes yb-glow-shift {
  0% { transform: translateX(-30px) scale(1); opacity: 0.6; }
  100% { transform: translateX(30px) scale(1.1); opacity: 1; }
}

/* —— 客户端 metrics 卡片:玻璃质感 + hover 微交互 + 渐变数字 —— */
.portal .metrics article,
#customerApp .metrics article,
.app .metrics article,
#adminApp .metrics article {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(15,118,110,0.10);
  border-radius: 14px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.portal .metrics article:hover,
#customerApp .metrics article:hover,
.app .metrics article:hover,
#adminApp .metrics article:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(15,118,110,0.12);
  border-color: rgba(15,118,110,0.25);
}
.portal .metrics article strong,
#customerApp .metrics article strong,
.app .metrics article strong,
#adminApp .metrics article strong {
  background: linear-gradient(135deg, var(--primary,#0f766e), var(--primary-2,#115e59));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* —— 滚动揭示(客户端/后台 panel + section) —— */
.portal .panel,
.app .panel,
.portal .vendor-section,
#customerApp .panel,
#adminApp .panel {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.portal .panel.in,
.app .panel.in,
.portal .vendor-section.in,
#customerApp .panel.in,
#adminApp .panel.in {
  opacity: 1;
  transform: none;
}

/* —— reduced-motion:客户端/后台也降级 —— */
@media (prefers-reduced-motion: reduce) {
  .portal .marketing-hero::after,
  #customerApp .marketing-hero::after { animation: none; }
  .portal .metrics article:hover,
  #customerApp .metrics article:hover,
  .app .metrics article:hover,
  #adminApp .metrics article:hover { transform: none; }
  .portal .panel, .app .panel, .portal .vendor-section,
  #customerApp .panel, #adminApp .panel { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   工作台 hero 合并落地页华丽视觉(粒子 + 霓虹标题 + 跑马灯)
   ============================================================ */
.marketing-hero-fx {
  display: block;
  position: relative;
  padding: 48px 38px 32px;
  min-height: 340px;
}
.marketing-hero-fx .marketing-hero-inner { position: relative; z-index: 1; max-width: 720px; }
.marketing-hero-fx .hero-title {
  background: linear-gradient(90deg, #ffffff, #5eead4, #93c5fd, #ffffff);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hero-shimmer 5s linear infinite;
  text-shadow: 0 0 30px rgba(94, 234, 212, 0.25);
}
.marketing-hero-fx .eyebrow { color: #5eead4; }
.marketing-hero-fx p { color: rgba(255,255,255,0.78); }
.marketing-hero-fx .hero-actions button {
  background: linear-gradient(135deg, #0f766e, #115e59);
  color: #fff;
  border: 1px solid rgba(94,234,212,0.3);
  box-shadow: 0 0 20px rgba(15,118,110,0.35);
  animation: hero-pulse 2.4s ease-in-out infinite;
}
.marketing-hero-fx .hero-actions button.secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: none;
  animation: none;
}
/* 跑马灯(复用落地页 vendor-marquee) */
.marketing-hero-fx .landing-vendors {
  position: relative;
  z-index: 1;
  margin-top: 36px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marketing-hero-fx .vendors-track {
  display: flex;
  gap: 14px;
  width: max-content;
  padding: 0 28px;
  animation: vendor-marquee 32s linear infinite;
}
.marketing-hero-fx .vendors-track:hover { animation-play-state: paused; }
.marketing-hero-fx .vendors-track span {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600; color: #fff !important; white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.marketing-hero-fx .vendors-track img { width: 20px; height: 20px; border-radius: 5px; }
/* 背景覆盖为深色(配合粒子 + 霓虹) */
.portal .marketing-hero-fx,
#customerApp .marketing-hero-fx {
  background: linear-gradient(135deg, #0a1628 0%, #0d2535 40%, #0a1f1d 100%);
  color: #fff;
  border-color: rgba(94,234,212,0.12);
}
.portal .marketing-hero-fx::after,
#customerApp .marketing-hero-fx::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .marketing-hero-fx .hero-title,
  .marketing-hero-fx .hero-actions button,
  .marketing-hero-fx .vendors-track { animation: none !important; }
  .marketing-hero-fx .hero-title { -webkit-text-fill-color: #fff; background: none; }
}

/* ============================================================
   智能体中心(Agent Hub)
   ============================================================ */
/* 用户端智能体卡片网格 */
.agent-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.agent-card {
  display: flex; flex-direction: column; gap: 10px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 20px;
  cursor: pointer; transition: box-shadow .25s, border-color .25s, transform .25s;
}
.agent-card:hover { border-color: #d946ef; box-shadow: 0 8px 28px rgba(217,70,239,.12); transform: translateY(-3px); }
.agent-card-avatar { font-size: 32px; line-height: 1; }
.agent-card-name { font-size: 16px; font-weight: 700; color: #1f2937; }
.agent-card-cat { font-size: 11px; color: #a855f7; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.agent-card-desc { font-size: 12.5px; line-height: 1.5; color: #6b7280; flex: 1; }
.agent-card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.agent-card-uses { font-size: 11.5px; color: #9ca3af; }
.agent-start-btn { font-size: 12px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #c026d3, #e879f9); border: 0; border-radius: 8px; padding: 5px 14px; cursor: pointer; transition: opacity .2s; }
.agent-start-btn:hover { opacity: .88; }

/* 对话页智能体 banner */
.agent-banner { display: flex; align-items: center; gap: 8px; padding: 8px 14px; margin-bottom: 8px; background: linear-gradient(135deg, rgba(217,70,239,.08), rgba(168,85,247,.06)); border: 1px solid rgba(217,70,239,.15); border-radius: 10px; font-size: 13px; color: #7c2d6f; }
.agent-banner strong { color: #a21caf; }
.agent-exit-btn { margin-left: auto; font-size: 11px; color: #9ca3af; background: transparent; border: 1px solid #e5e7eb; border-radius: 6px; padding: 2px 10px; cursor: pointer; }
.agent-exit-btn:hover { border-color: #d946ef; color: #a21caf; }
.agent-tools-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: linear-gradient(135deg, rgba(34,197,94,.12), rgba(16,185,129,.10)); border: 1px solid rgba(34,197,94,.25); color: #15803d; font-weight: 600; }
.agent-tools-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; cursor: pointer; padding: 6px 10px; border: 1px dashed #d1d5db; border-radius: 8px; background: #f9fafb; }
.agent-tools-toggle:hover { border-color: #10b981; background: #ecfdf5; }
.agent-tools-toggle input { width: 16px; height: 16px; cursor: pointer; }

/* 工具调用轨迹卡片(agent loop 命中工具时显示) */
.tool-trace { margin: 6px 0 8px; border-radius: 10px; font-size: 13px; }
.tool-trace-running { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: linear-gradient(135deg, rgba(99,102,241,.10), rgba(168,85,247,.08)); border: 1px solid rgba(99,102,241,.25); color: #4338ca; }
.tool-trace-icon { font-size: 18px; }
.tool-trace-spin { font-weight: 600; }
.tool-trace-spin::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 4px; border: 2px solid rgba(99,102,241,.3); border-top-color: #6366f1; border-radius: 50%; animation: toolSpin .8s linear infinite; vertical-align: -2px; }
@keyframes toolSpin { to { transform: rotate(360deg); } }
.tool-trace-detail { color: #6b7280; font-size: 12px; margin-left: auto; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-trace-done { background: #f0fdf4; border: 1px solid #bbf7d0; padding: 0; }
.tool-trace-done > summary { cursor: pointer; padding: 8px 14px; color: #15803d; font-weight: 600; list-style: none; }
.tool-trace-done > summary::-webkit-details-marker { display: none; }
.tool-trace-done > summary::before { content: "▸ "; transition: transform .2s; display: inline-block; }
.tool-trace-done[open] > summary::before { transform: rotate(90deg); }
.tool-trace-list { padding: 2px 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.tool-trace-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(255,255,255,.7); border-radius: 8px; font-size: 12px; color: #374151; }
.tool-trace-icon-sm { font-size: 15px; }
.tool-trace-label { font-weight: 600; color: #166534; min-width: 64px; }
.tool-trace-desc { color: #6b7280; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-trace-time { color: #9ca3af; font-size: 11px; }
.tool-ok { color: #16a34a; font-weight: 700; }
.tool-err { color: #dc2626;; font-weight: 700; }

/* 知识库管理 */
.kb-status-badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; margin-left: 8px; font-weight: 600; }
.kb-status-badge.ready { background: #dcfce7; color: #15803d; }
.kb-status-badge.notready { background: #fef3c7; color: #b45309; }
.kb-upload-zone { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; border: 2px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; cursor: pointer; color: #64748b; font-size: 14px; transition: all .2s; }
.kb-upload-zone:hover { border-color: #6366f1; background: #eef2ff; color: #4338ca; }
.kb-upload-progress { margin-top: 8px; padding: 10px 14px; background: #eef2ff; border-radius: 8px; font-size: 13px; color: #4338ca; }
.kb-upload-progress.error { background: #fef2f2; color: #dc2626; }
.kb-docs-list { display: flex; flex-direction: column; gap: 8px; }
.kb-doc-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; }
.kb-doc-item .kb-doc-name { flex: 1; font-weight: 500; color: #334155; }
.kb-doc-item .kb-doc-meta { color: #94a3b8; font-size: 11px; }
.kb-doc-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.kb-doc-status.ready { background: #dcfce7; color: #15803d; }
.kb-doc-status.processing { background: #fef3c7; color: #b45309; }
.kb-doc-status.failed { background: #fef2f2; color: #dc2626; }
.kb-mgr-card { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; margin-bottom: 8px; }
.kb-mgr-card .kb-name { font-weight: 600; color: #1e293b; }
.kb-mgr-card .kb-desc { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.kb-mgr-card .kb-stats { font-size: 11px; color: #64748b; margin-top: 4px; }
.kb-mgr-actions { margin-left: auto; display: flex; gap: 6px; }

/* ===== 智能体右侧 Canvas 侧边栏 ===== */
.agent-preview-panel {
  flex: 0 0 460px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}
.agent-preview-panel.hidden { display: none; }
.agent-preview-head {
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px 0 0; border-bottom: 1px solid var(--line);
  background: #fafbfc; flex-shrink: 0; height: 44px;
}
/* tab 切换 */
.agent-preview-tabs { display: flex; gap: 0; height: 100%; }
.agent-preview-tab {
  padding: 0 16px; font-size: 13px; font-weight: 500;
  border: 0; background: transparent; color: #6b7280; cursor: pointer;
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
  height: 100%; display: flex; align-items: center;
}
.agent-preview-tab:hover { color: #374151; }
.agent-preview-tab.active { color: #111827; border-bottom-color: #111827; }
.agent-preview-tab.hidden { display: none; }
/* 图标按钮组 */
.agent-preview-actions { margin-left: auto; display: flex; gap: 2px; }
.agent-preview-icon-btn {
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: #6b7280; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s;
}
.agent-preview-icon-btn:hover { background: #eef0f3; color: #111827; }
.agent-preview-icon-btn.hidden { display: none; }
.agent-preview-body {
  flex: 1; min-height: 0; overflow: auto; padding: 20px;
}
/* 文本阅读视图(文案/翻译) */
.agent-preview-body.preview-text {
  font-size: 15px; line-height: 1.85; color: #1f2937;
  white-space: pre-wrap; word-break: break-word;
}
/* 代码编辑视图 — 可编辑 textarea */
.agent-preview-body.view-code {
  padding: 0; background: #1e1e2e; overflow: hidden; display: flex; flex-direction: column;
}
.agent-preview-body.view-code textarea {
  flex: 1; width: 100%; border: 0; resize: none; outline: none;
  background: #1e1e2e; color: #cdd6f4; padding: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 13.5px; line-height: 1.6; tab-size: 2; white-space: pre;
}
.agent-preview-code-toolbar {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: #181825; border-top: 1px solid #313244;
}
.agent-preview-code-lang { font-size: 12px; color: #6c7086; font-family: monospace; }
.agent-preview-code-run-btn {
  margin-left: auto; padding: 4px 14px; font-size: 12px; font-weight: 600;
  border: 0; border-radius: 6px; background: #cba6f7; color: #11111b; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; transition: opacity .15s;
}
.agent-preview-code-run-btn:hover { opacity: .85; }
.agent-preview-code-run-btn:disabled { opacity: .5; cursor: not-allowed; }
/* 预览视图 — iframe 铺满 */
.agent-preview-body.preview-code { padding: 0; }
.agent-preview-body.preview-code iframe {
  width: 100%; height: 100%; border: 0; background: #fff; display: block;
}
/* 控制台视图 — 终端风格 */
.agent-preview-body.view-console {
  padding: 0; background: #0c0c0c; overflow: auto;
}
.agent-preview-console {
  padding: 12px 16px; font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 13px; line-height: 1.6; color: #e0e0e0; white-space: pre-wrap; word-break: break-word;
}
.agent-preview-console .console-stdout { color: #4ade80; }
.agent-preview-console .console-stderr { color: #f87171; }
.agent-preview-console .console-compile { color: #fbbf24; }
.agent-preview-console .console-error { color: #f87171; font-weight: 600; }
.agent-preview-console .console-info { color: #60a5fa; }
.agent-preview-console .console-empty { color: #6b7280; font-style: italic; }
.agent-preview-console .console-running { color: #fbbf24; }
/* 空状态 */
.agent-preview-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: #9ca3af; gap: 8px; padding: 40px;
}
.agent-preview-empty svg { opacity: .4; }
/* 对话底部预览操作按钮条 */
.chat-preview-bar {
  display: flex; justify-content: center; padding: 8px 0 4px;
}
.msg-preview-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); cursor: pointer; transition: all .15s;
}
.msg-preview-btn:hover { background: #f2f4f7; border-color: var(--primary); }

/* 管理后台智能体列表 */
.agent-mgr-list { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; padding: 10px 8px; border-bottom: 2px solid #e5e7eb; color: #6b7280; font-size: 12px; white-space: nowrap; }
.admin-table td { padding: 10px 8px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.admin-table tr:hover td { background: #faf5ff; }
.agent-status { font-size: 11px; padding: 2px 10px; border-radius: 999px; font-weight: 600; }
.agent-status-published { background: #ecfdf5; color: #059669; }
.agent-status-draft { background: #f3f4f6; color: #6b7280; }
.agent-status-offline { background: #fef2f2; color: #dc2626; }
.agent-actions { white-space: nowrap; }
.link-btn { font-size: 12px; background: transparent; border: 0; color: #6366f1; cursor: pointer; padding: 2px 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #dc2626; }

/* 智能体响应式 */
@media (max-width: 860px) { .agent-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .agent-grid { grid-template-columns: 1fr; } }

/* ===== 财务日清月结监控驾驶舱 ===== */
.finance-monitor {
  --fm-ink: #102a43;
  --fm-teal: #0f766e;
  --fm-blue: #2563eb;
  --fm-gold: #d89b2b;
  --fm-red: #c2413b;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--fm-ink);
  font-variant-numeric: tabular-nums;
}
.fm-commandbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; border: 1px solid #dce4ea; border-radius: 12px;
  background: linear-gradient(110deg, #f8fbfc, #f1f7f6); box-shadow: 0 5px 18px rgba(16,42,67,.04);
}
.fm-commandbar > div:first-child { display: flex; align-items: center; gap: 12px; }
.fm-commandbar small { color: #627d98; }
.fm-live { display: inline-flex; align-items: center; gap: 7px; color: #087f5b; font-weight: 700; font-size: 13px; }
.fm-live i { width: 8px; height: 8px; border-radius: 50%; background: #20c997; box-shadow: 0 0 0 5px rgba(32,201,151,.12); animation: fmPulse 2s ease-out infinite; }
@keyframes fmPulse { 50% { box-shadow: 0 0 0 8px rgba(32,201,151,0); } }
.fm-actions { display: flex; align-items: end; gap: 8px; }
.fm-actions label { display: grid; gap: 3px; color: #627d98; font-size: 11px; }
.fm-actions select, .fm-actions button { height: 36px; border-radius: 8px; }
.fm-actions select { border: 1px solid #ccd8e1; background: #fff; color: var(--fm-ink); padding: 0 32px 0 10px; }
.fm-actions button { padding: 0 15px; background: var(--fm-ink); }

.fm-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.fm-metric {
  position: relative; overflow: hidden; min-height: 116px; padding: 17px 18px;
  border: 1px solid #dce4ea; border-radius: 12px; background: #fff;
  box-shadow: 0 7px 20px rgba(16,42,67,.05);
}
.fm-metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--fm-teal); }
.fm-metric:nth-child(2)::before { background: var(--fm-gold); }
.fm-metric:nth-child(3)::before { background: var(--fm-blue); }
.fm-metric:nth-child(4)::before { background: #7c3aed; }
.fm-metric.risk::before { background: var(--fm-red); }
.fm-metric small { display: block; color: #627d98; font-size: 12px; }
.fm-metric strong { display: block; margin: 9px 0 8px; font-size: clamp(20px, 2vw, 28px); line-height: 1; letter-spacing: -.03em; color: var(--fm-ink); }
.fm-metric span { color: #829ab1; font-size: 11px; }
.fm-metric span b { color: #486581; }

.fm-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(270px, .8fr); gap: 14px; }
.fm-panel { border: 1px solid #dce4ea; border-radius: 12px; background: #fff; box-shadow: 0 7px 22px rgba(16,42,67,.05); padding: 18px; }
.fm-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.fm-panel-head h3 { margin: 0; font-size: 15px; letter-spacing: .01em; color: var(--fm-ink); }
.fm-panel-head p { margin: 4px 0 0; color: #829ab1; font-size: 11px; }
.fm-panel-head > strong { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--fm-red); font-size: 16px; }
.fm-legend { display: flex; gap: 12px; color: #627d98; font-size: 11px; }
.fm-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin: 0 5px 3px 0; border-radius: 4px; background: var(--fm-blue); }
.fm-legend .received::before { background: var(--fm-teal); }
.fm-legend .token::before { background: #7c3aed; }
.fm-chart { min-height: 260px; }
.fm-chart svg { display: block; width: 100%; height: 260px; overflow: visible; }
.fm-chart-grid line { stroke: #e8eef2; stroke-width: 1; stroke-dasharray: 3 5; }
.fm-chart-grid text { fill: #829ab1; font-size: 10px; }
.fm-chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.fm-chart-line.receivable { stroke: var(--fm-blue); }
.fm-chart-line.received { stroke: var(--fm-teal); }
.fm-chart-line.token { stroke: #7c3aed; stroke-dasharray: 5 4; }
.fm-empty { min-height: 240px; display: grid; place-items: center; color: #829ab1; font-size: 13px; }

.fm-risk-list { display: grid; gap: 8px; }
.fm-risk-list article { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #e7edf2; border-radius: 9px; background: #fafcfd; }
.fm-risk-list article > i { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 30px; border-radius: 8px; background: #e8f5f2; color: var(--fm-teal); font-style: normal; font-weight: 800; }
.fm-risk-list article.active { border-color: #f2cbc7; background: #fff8f7; }
.fm-risk-list article.active > i { background: #fbe4e2; color: var(--fm-red); }
.fm-risk-list article strong, .fm-risk-list article small { display: block; }
.fm-risk-list article strong { color: #334e68; font-size: 12px; }
.fm-risk-list article small { margin-top: 2px; color: #829ab1; font-size: 10px; }
.fm-all-clear { min-height: 184px; display: grid; place-content: center; justify-items: center; gap: 10px; color: #627d98; font-size: 12px; }
.fm-all-clear b { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #e8f5f2; color: var(--fm-teal); font-size: 22px; }

.fm-month-panel, .fm-token-panel { min-height: 220px; }
.fm-progress-item { margin: 15px 0; }
.fm-progress-item > div { display: flex; justify-content: space-between; color: #486581; font-size: 12px; }
.fm-progress-item > i { display: block; height: 7px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #e8eef2; }
.fm-progress-item > i > em { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--fm-teal); transition: width .45s ease; }
.fm-progress-item.gold > i > em { background: var(--fm-gold); }
.fm-month-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 19px 0 0; background: #e7edf2; border: 1px solid #e7edf2; border-radius: 8px; overflow: hidden; }
.fm-month-values div { padding: 10px; background: #f9fbfc; }
.fm-month-values dt { color: #829ab1; font-size: 10px; }
.fm-month-values dd { margin: 5px 0 0; color: #334e68; font-size: 13px; font-weight: 700; }
.fm-token-mix { display: flex; align-items: center; justify-content: space-around; gap: 18px; }
.fm-token-ring { width: 122px; height: 122px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--fm-blue) 0 var(--prompt), #7c3aed var(--prompt) 360deg); }
.fm-token-ring::before { content: ""; grid-area: 1/1; width: 82px; height: 82px; border-radius: 50%; background: #fff; }
.fm-token-ring span { z-index: 1; grid-area: 1/1; text-align: center; }
.fm-token-ring b, .fm-token-ring small { display: block; }
.fm-token-ring b { color: var(--fm-ink); font-size: 16px; }
.fm-token-ring small { color: #829ab1; font-size: 9px; }
.fm-token-mix dl { min-width: 150px; margin: 0; }
.fm-token-mix dl div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #edf2f5; font-size: 11px; }
.fm-token-mix dt { color: #627d98; }
.fm-token-mix dd { margin: 0; color: #334e68; font-weight: 700; }
.fm-token-mix dt i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #94a3b8; }
.fm-token-mix dt i.prompt { background: var(--fm-blue); }
.fm-token-mix dt i.completion { background: #7c3aed; }
.fm-token-mix dt i.cache { background: var(--fm-teal); }
.fm-ledger-panel { padding-bottom: 8px; }
.fm-ledger th { white-space: nowrap; color: #627d98; font-size: 11px; }
.fm-ledger td { white-space: nowrap; color: #486581; font-size: 12px; }
.fm-ledger tbody tr:hover td { background: #f5f9fa; }

@media (max-width: 1120px) {
  .fm-metrics { grid-template-columns: repeat(3, 1fr); }
  .fm-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .fm-commandbar, .fm-commandbar > div:first-child { align-items: flex-start; flex-direction: column; }
  .fm-actions { width: 100%; }
  .fm-actions label { flex: 1; }
  .fm-actions select { width: 100%; }
  .fm-metrics { grid-template-columns: repeat(2, 1fr); }
  .fm-legend { display: none; }
}
@media (max-width: 480px) {
  .fm-metrics { grid-template-columns: 1fr; }
  .fm-token-mix { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .fm-live i { animation: none; }
  .fm-progress-item > i > em { transition: none; }
}

/* 财务监控明细 Tab */
.fm-detail-section { margin-top: 20px; background: #fff; border-radius: 12px; border: 1px solid #edf2f5; overflow: hidden; }
.fm-detail-tabs { display: flex; gap: 0; border-bottom: 2px solid #f0f4f8; padding: 0 8px; overflow-x: auto; }
.fm-detail-tab { padding: 12px 18px; border: none; background: transparent; cursor: pointer; font-size: 14px; color: #627d98; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: all .15s; }
.fm-detail-tab:hover { color: #334e68; }
.fm-detail-tab.active { color: #4338ca; border-bottom-color: #4338ca; font-weight: 600; }
.fm-detail-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fafbfc; border-bottom: 1px solid #edf2f5; flex-wrap: wrap; }
.fm-detail-toolbar label { font-size: 12px; color: #627d98; display: flex; align-items: center; gap: 4px; }
.fm-detail-toolbar input[type=date], .fm-model-filter { padding: 6px 10px; border: 1px solid #dbe3ea; border-radius: 6px; font-size: 13px; }
.fm-export-btn { margin-left: auto; background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.fm-export-btn:hover { opacity: .9; }
.fm-detail-table-wrap { max-height: 600px; overflow: auto; }
.fm-detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fm-detail-table th { position: sticky; top: 0; background: #f0f4f8; padding: 10px 12px; text-align: left; font-weight: 600; color: #334e68; border-bottom: 2px solid #dbe3ea; white-space: nowrap; z-index: 1; }
.fm-detail-table td { padding: 8px 12px; border-bottom: 1px solid #f0f4f8; color: #486581; white-space: nowrap; }
.fm-detail-table tr:hover td { background: #f9fbfd; }
.fm-detail-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fm-detail-table .profit-positive { color: #16a34a; font-weight: 600; }
.fm-detail-table .profit-negative { color: #dc2626; font-weight: 600; }
.fm-detail-summary { padding: 10px 16px; background: #f0fdf4; border-top: 2px solid #bbf7d0; font-size: 13px; color: #15803d; font-weight: 600; display: flex; gap: 24px; flex-wrap: wrap; }
.fm-detail-empty { padding: 40px; text-align: center; color: #9aa5b1; font-size: 14px; }
.tag-self { color: #4338ca; font-weight: 600; }
.tag-resale { color: #b45309; }

/* ============================================================
   移动端工作台 (<= 768px)
   桌面端保持原布局；手机端切换为抽屉导航 + 底部快捷栏。
   ============================================================ */
.topnav-drawer { display: contents; }
.mobile-view-label,
.mobile-bottom-nav,
.mobile-nav-backdrop,
.mobile-conversation-btn,
.mobile-chat-backdrop { display: none; }

@media (max-width: 768px) {
  :root { --mobile-topbar-h: 56px; --mobile-bottom-nav-h: 64px; }
  html, body { max-width: 100%; overflow-x: hidden; }
  body.mobile-overlay-open { overflow: hidden; touch-action: none; }
  #customerApp.portal { min-height: 100dvh; background: #f5f7fb; }

  /* 顶部栏与侧滑主导航 */
  #customerApp > .topnav {
    position: sticky;
    top: 0;
    z-index: 190;
    height: var(--mobile-topbar-h);
    padding: 0 12px;
    gap: 8px;
    background: rgba(255,255,255,.96);
    border-bottom-color: #e7eaf1;
  }
  #customerApp .topnav-brand { width: 100%; min-width: 0; gap: 8px; }
  #customerApp .topnav-brand:hover { opacity: 1; filter: none; }
  #customerApp .topnav-brand img { width: 30px; height: 30px; }
  #customerApp .topnav-brand > strong { font-size: 15px; }
  #customerApp .nav-toggle-btn { display: none; }
  .mobile-view-label {
    display: block;
    margin-left: auto;
    max-width: 36vw;
    overflow: hidden;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #customerApp .topnav-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 230;
    display: flex;
    flex-direction: column;
    width: min(86vw, 320px);
    padding: calc(20px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
    background: #f7f8fc;
    border-right: 1px solid #e1e5ed;
    box-shadow: 18px 0 48px rgba(15,23,42,.16);
    transform: translateX(-105%);
    transition: transform .22s ease;
    overflow-y: auto;
  }
  #customerApp.mobile-nav-open .topnav-drawer { transform: translateX(0); }
  #customerApp .topnav-links {
    display: grid;
    width: 100%;
    gap: 7px;
  }
  #customerApp .topnav-links::before {
    content: "功能导航";
    padding: 4px 6px 8px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
  }
  #customerApp .topnav-links .customer-nav {
    min-height: 46px;
    padding: 11px 14px;
    border-radius: 12px;
    text-align: left;
  }
  #customerApp .topnav-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: auto 0 0;
    padding-top: 18px;
    border-top: 1px solid #e2e6ee;
  }
  #customerApp .balance-group { display: grid; grid-template-columns: 1fr; }
  #customerApp .balance-chip { justify-content: space-between; border-radius: 12px; }
  #customerApp .topnav-actions > button { width: 100%; min-height: 44px; }
  .mobile-nav-backdrop,
  .mobile-chat-backdrop {
    position: fixed;
    inset: 0;
    z-index: 220;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15,23,42,.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  #customerApp.mobile-nav-open > .mobile-nav-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  /* 底部高频导航 */
  .mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 180;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    border-top: 1px solid #e3e6ee;
    background: rgba(255,255,255,.97);
    box-shadow: 0 -8px 24px rgba(15,23,42,.07);
    backdrop-filter: blur(16px);
  }
  #customerApp .mobile-bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 52px;
    padding: 3px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    color: #7b8497;
    text-align: center;
  }
  #customerApp .mobile-bottom-nav-btn span { font-size: 21px; line-height: 1; }
  #customerApp .mobile-bottom-nav-btn small { font-size: 11px; font-weight: 700; }
  #customerApp .mobile-bottom-nav-btn.active { color: #4f46e5; background: #f0efff; }

  /* 通用内容页 */
  #customerApp .portal-main {
    padding: 14px 12px calc(var(--mobile-bottom-nav-h) + 18px + env(safe-area-inset-bottom));
  }
  #customerApp .portal-topbar { margin-bottom: 12px; }
  #customerApp .portal-topbar .eyebrow,
  #customerApp .portal-topbar #cViewSubTitle { display: none; }
  #customerApp .portal-topbar h2 { margin: 0; font-size: 22px; line-height: 1.25; }
  #customerApp .panel { padding: 14px; border-radius: 14px; }
  #customerApp .panel-head { align-items: flex-start; gap: 8px; }
  #customerApp .marketing-hero { min-height: 0; padding: 24px 18px; border-radius: 14px; }
  #customerApp .marketing-hero h1 { font-size: 29px; }
  #customerApp .ms-hero { padding: 24px 16px !important; border-radius: 14px !important; }
  #customerApp .ms-grid,
  #customerApp .agent-grid,
  #customerApp .cards,
  #customerApp .quick-grid,
  #customerApp .profile-grid { grid-template-columns: 1fr; }
  #customerApp .table-wrap,
  #customerApp .inv-order-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #customerApp table { min-width: 660px; }
  #customerApp .yb-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #customerApp .yb-tabs::-webkit-scrollbar { display: none; }
  #customerApp .yb-tab { flex: 0 0 auto; min-height: 42px; }
  #customerApp .form-grid,
  #customerApp .form-row { grid-template-columns: 1fr; }
  #customerApp .modal-overlay { padding: 10px; }
  #customerApp .tutorial-modal,
  #customerApp .edit-message-modal { width: min(100%, 680px); max-height: 92dvh; border-radius: 18px; }

  /* 手机端聊天:全屏、历史会话抽屉、固定输入区 */
  #customerApp.customer-chat-active .portal-main {
    height: calc(100dvh - var(--mobile-topbar-h));
    padding: 0 0 calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  #customerApp.customer-chat-active .portal-topbar { display: none; }
  #c-chat {
    height: 100%;
    margin: 0;
  }
  #c-chat .chat-panel {
    position: relative;
    height: 100%;
    min-height: 0;
    border-radius: 0;
  }
  #c-chat .chat-main { width: 100%; min-width: 0; }
  #c-chat .chat-topbar { min-height: 58px; padding: 7px 10px; gap: 8px; }
  .mobile-conversation-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    border: 1px solid #e0e4ec;
    border-radius: 12px;
    background: #f8f9fc;
    color: #556176;
  }
  #c-chat .chat-vendor-picker { min-width: 0; }
  #c-chat .chat-vendor-btn { min-width: 0; max-width: 180px; min-height: 42px; padding: 6px 10px; }
  #c-chat .chat-vendor-label strong { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #c-chat .chat-capability-chip { padding: 7px 9px; font-size: 0; }
  #c-chat .chat-capability-chip::after { content: "联网"; font-size: 11px; }
  #c-chat .chat-sidebar {
    position: fixed;
    inset: var(--mobile-topbar-h) auto calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom)) 0;
    z-index: 240;
    display: flex !important;
    width: min(86vw, 320px);
    max-width: none;
    padding: 14px;
    border-right: 1px solid #e1e5ed;
    background: #f6f7fb;
    box-shadow: 18px 0 48px rgba(15,23,42,.16);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  #customerApp.mobile-chat-history-open #c-chat .chat-sidebar { transform: translateX(0); }
  #c-chat .mobile-chat-backdrop {
    inset: var(--mobile-topbar-h) 0 calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom));
    z-index: 230;
  }
  #customerApp.mobile-chat-history-open #c-chat .mobile-chat-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  #c-chat .chat-shell { min-height: 0; padding: 0 8px 8px; }
  #c-chat .chat-panel .chat-box {
    margin: 0;
    padding: 12px 4px 8px;
    scrollbar-gutter: auto;
    overscroll-behavior: contain;
  }
  #c-chat .chat-welcome { width: 100%; padding: 20px 4px 14px; }
  #c-chat .chat-welcome-mark { width: 50px; height: 50px; margin-bottom: 14px; padding: 10px; border-radius: 15px; }
  #c-chat .chat-welcome h3 { font-size: 24px; }
  #c-chat .chat-welcome > p { margin: 8px 8px 18px; font-size: 13px; }
  #c-chat .chat-welcome-prompt-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  #c-chat .chat-welcome-prompt { min-height: 52px; padding: 8px; font-size: 12px; }
  #c-chat .chat-composer-dock { flex: 0 0 auto; min-width: 0; }
  #c-chat .attachment-preview {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    margin-bottom: 7px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #c-chat .attachment-preview::-webkit-scrollbar { display: none; }
  #c-chat .attachment-preview-item { flex: 0 0 auto; max-width: 78vw; }
  #c-chat .chat-task-strip {
    width: 100%;
    margin: 0 0 7px;
    padding: 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }
  #c-chat .chat-task-btn { flex: 0 0 auto; min-height: 36px; padding: 0 12px; scroll-snap-align: start; }
  #c-chat .chat-panel .chat-input {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-areas: "text text text" "attach model send";
    gap: 7px;
    width: 100%;
    min-height: 0;
    padding: 7px;
    border-radius: 16px;
    box-shadow: 0 7px 22px rgba(58,48,145,.12), 0 0 0 3px rgba(99,88,245,.05);
  }
  #c-chat .chat-input textarea {
    grid-area: text;
    order: initial;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    max-height: 112px;
    padding: 9px 8px;
    font-size: 16px;
  }
  #c-chat .chat-input .attachment-button { grid-area: attach; width: 44px; height: 42px; }
  #c-chat .chat-model-picker-inline { grid-area: model; order: initial; width: 100%; min-width: 0; }
  #c-chat .chat-input .chat-model-btn { width: 100%; height: 42px; justify-content: space-between; }
  #c-chat .chat-input .chat-model-btn #chatModelName { max-width: calc(100vw - 190px); }
  #c-chat .chat-input .chat-send,
  #c-chat .chat-input .chat-send:not(.paused):not(.loading) {
    grid-area: send;
    order: initial;
    width: 44px;
    min-width: 44px;
    height: 42px;
    padding: 0;
  }
  #c-chat .chat-input .chat-send span { display: none; }
  #c-chat .chat-vendor-dropdown,
  #c-chat .chat-model-picker-inline .chat-model-dropdown {
    position: fixed;
    inset: auto 10px calc(var(--mobile-bottom-nav-h) + 10px + env(safe-area-inset-bottom));
    z-index: 260;
    width: auto;
    max-height: min(62dvh, 520px);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15,23,42,.24);
  }

  /* 阅读视图/代码 Canvas 在手机端改为全屏层 */
  #c-chat .agent-preview-panel {
    position: fixed;
    inset: var(--mobile-topbar-h) 0 calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom));
    z-index: 270;
    width: auto;
    max-width: none;
    flex-basis: auto;
    border-left: 0;
    background: #fff;
  }
  #c-chat .agent-preview-head { min-height: 50px; height: 50px; padding-right: 6px; }
  #c-chat .agent-preview-tab { padding: 0 13px; }
  #c-chat .agent-preview-icon-btn { width: 38px; height: 38px; }
  #c-chat .agent-preview-body { padding: 16px; }
  #c-chat .agent-preview-body.preview-text { font-size: 16px; line-height: 1.8; }
}

@media (max-width: 390px) {
  #customerApp .topnav-brand > strong { display: none; }
  .mobile-view-label { max-width: 44vw; }
  #c-chat .chat-vendor-btn { max-width: 150px; }
  #c-chat .chat-welcome-prompt-grid { grid-template-columns: 1fr; }
  #c-chat .chat-capability-chip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #customerApp .topnav-drawer,
  #c-chat .chat-sidebar,
  .mobile-nav-backdrop,
  .mobile-chat-backdrop { transition: none; }
}
