﻿/* ===== 自由画布（卡片式生成工作台） ===== */

.cv-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: calc(100dvh - 72px);
  min-height: 0;
  background: #f6f7fb;
}

/* ---------- 左侧：项目列表 ---------- */
.cv-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px;
  border-right: 1px solid var(--border, #e2e8f0);
  background: #fff;
  min-height: 0;
}
.cv-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #0f172a;
}
.cv-sidebar-head button { padding: 6px 10px; font-size: 12px; }
.cv-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.cv-list-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cv-list-item:hover { border-color: #93c5fd; }
.cv-list-item.active { border-color: #2563eb; background: #eff6ff; }
.cv-list-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cv-list-meta { font-size: 11px; color: #64748b; }
.cv-sidebar-foot { margin-top: auto; }
.cv-hint { margin: 0; font-size: 11.5px; line-height: 1.7; color: #94a3b8; }

/* ---------- 主区 ---------- */
.cv-main {
  position: relative;          /* 浮动助手面板的定位参照 */
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.cv-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: #fff;
}
.cv-toolbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cv-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.cv-toolbar-actions > button { padding: 6px 10px; font-size: 12px; }

.cv-zoom {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 9px;
  background: #fff;
}
.cv-zoom button {
  border: 0;
  background: transparent;
  color: #475569;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  place-items: center;
  min-width: 30px;
}
.cv-zoom button:hover { background: #f1f5f9; color: #0f172a; }

.cv-title-input {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  padding: 4px 8px;
  min-width: 160px;
  max-width: 320px;
}
.cv-title-input:hover { border-color: var(--border, #e2e8f0); }
.cv-title-input:focus { outline: none; border-color: #2563eb; background: #fff; }
.cv-title-meta, .cv-title-empty { font-size: 12px; color: #94a3b8; }

/* ---------- 画布视口 ---------- */
.cv-board-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  background-color: #f8fafc;
  background-image: radial-gradient(circle, #d7dfea 1px, transparent 1px);
  background-size: 22px 22px;
}
.cv-board-wrap.is-panning { cursor: grabbing; }
.cv-board {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.cv-board-hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--border, #e2e8f0);
  font-size: 11px;
  color: #94a3b8;
  pointer-events: none;
}
.cv-board-empty {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  gap: 6px;
  width: 520px;
  height: 300px;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.cv-board-empty svg { width: 40px; height: 40px; color: #cbd5e1; }
.cv-board-empty-hint { font-size: 11.5px; max-width: 420px; line-height: 1.7; }

/* ---------- 卡片 ---------- */
.bd-card {
  position: absolute;
  width: 300px;
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  transition: box-shadow .15s, border-color .15s, transform .12s;
}
.bd-card:hover { box-shadow: 0 10px 26px rgba(15, 23, 42, .13); }
.bd-card.is-dragging { cursor: grabbing; box-shadow: 0 16px 36px rgba(15, 23, 42, .2); }
.bd-card.is-selected { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .16), 0 10px 26px rgba(15, 23, 42, .12); }
.bd-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  background: #fbfcfe;
  font-size: 11.5px;
  color: #475569;
}
.bd-kind {
  padding: 1px 6px;
  border-radius: 5px;
  background: #ecfdf5;
  color: #047857;
  font-size: 10.5px;
  font-weight: 600;
}
.bd-card[data-kind="video"] .bd-kind { background: #fef2f2; color: #b91c1c; }
.bd-card[data-kind="text"] .bd-kind { background: #eef2ff; color: #4338ca; }
.bd-card-title {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #0f172a;
}
.bd-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 10px;
}
.bd-badge.ghost { background: #f1f5f9; color: #64748b; }

.bd-card-media-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #f8fafc;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.bd-card-media { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-card-text {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.75;
  color: #334155;
  white-space: pre-wrap;
  text-align: left;
  place-self: stretch;
}
.bd-card-skeleton {
  display: grid;
  place-items: center;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
}
.bd-card-skeleton.is-failed { color: #b91c1c; }
.bd-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  border-top-color: #2563eb;
  animation: bd-spin .8s linear infinite;
}
@keyframes bd-spin { to { transform: rotate(360deg); } }

.bd-card-prompt {
  padding: 6px 10px 0;
  font-size: 11px;
  line-height: 1.6;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.bd-card-actions {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-top: 1px solid #f1f5f9;
  margin-top: 6px;
  justify-content: flex-end;
}
.bd-act {
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  color: #475569;
  border-radius: 7px;
  padding: 3px 7px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
}
.bd-act:hover { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.bd-act.danger:hover { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }

/* ---------- 底部生成栏 ---------- */
.cv-composer {
  border-top: 1px solid var(--border, #e2e8f0);
  background: #fff;
  padding: 12px 16px;
}
.bd-composer { display: flex; flex-direction: column; gap: 8px; }
.bd-modality { display: flex; gap: 6px; }
.bd-mod {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 12.5px;
  cursor: pointer;
}
.bd-mod:hover { border-color: #93c5fd; }
.bd-mod.active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.bd-input-row { display: flex; gap: 10px; align-items: stretch; }
.bd-input-row textarea {
  flex: 1 1 auto;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 46px;
}
.bd-input-row textarea:focus { outline: none; border-color: #2563eb; }
.bd-generate {
  flex: 0 0 auto;
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  border-radius: 11px;
}
.bd-options { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #475569; }
.bd-options label { display: inline-flex; align-items: center; gap: 6px; }
.bd-options select {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  background: #fff;
  color: #0f172a;
}
.bd-tip { margin-left: auto; font-size: 11px; color: #94a3b8; }
.bd-recent { display: flex; gap: 6px; flex-wrap: wrap; }
.bd-chip {
  border: 1px dashed var(--border, #e2e8f0);
  background: #fbfcfe;
  color: #64748b;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bd-chip:hover { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.cv-notice { margin: 2px 0 0; font-size: 12px; color: #2563eb; }

/* ---------- 右侧：浮动助手 ---------- */
.cv-agent {
  position: absolute;
  right: 16px;
  top: 64px;
  z-index: 30;
  width: 344px;
  height: min(560px, calc(100% - 120px));
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
  overflow: hidden;
  transition: box-shadow .15s, opacity .15s;
}
.cv-agent.is-dragging { box-shadow: 0 18px 44px rgba(15, 23, 42, .24); }
.cv-agent.is-collapsed { height: auto !important; width: 220px !important; }
.cv-agent.is-collapsed .cv-agent-convs,
.cv-agent.is-collapsed .cv-agent-body,
.cv-agent.is-collapsed .cv-agent-composer,
.cv-agent.is-collapsed .cv-agent-grip { display: none; }
.cv-agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, .8);
  font-size: 13px;
  color: #0f172a;
  cursor: grab;
  user-select: none;
}
.cv-agent.is-dragging .cv-agent-head { cursor: grabbing; }
.cv-agent-head strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
  vertical-align: 1px;
}
.cv-agent-head-actions { display: flex; gap: 6px; }
.cv-agent-head-actions button { padding: 4px 8px; font-size: 11.5px; }
.cv-agent-toggle {
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  padding: 2px 4px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.cv-agent-toggle:hover { background: rgba(148, 163, 184, .2); }
.cv-agent-convs {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(226, 232, 240, .7);
  min-height: 40px;
  align-items: center;
  background: rgba(248, 250, 252, .6);
}
.cv-agent-conv {
  flex: 0 0 auto;
  max-width: 150px;
  padding: 5px 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  font-size: 11.5px;
  color: #475569;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cv-agent-conv.active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.cv-agent-loading { font-size: 11.5px; color: #94a3b8; }
.cv-agent-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(248, 250, 252, .55);
}
.cv-agent-composer {
  border-top: 1px solid rgba(226, 232, 240, .8);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, .72);
}
.cv-agent-composer textarea {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 12.5px;
  font-family: inherit;
  resize: vertical;
  background: rgba(255, 255, 255, .95);
}
.cv-agent-composer textarea:focus { outline: none; border-color: #2563eb; }
.cv-agent-foot { display: flex; align-items: center; justify-content: space-between; }
.cv-agent-tip { font-size: 11px; color: #94a3b8; }
.cv-agent-grip {
  position: absolute;
  left: 6px;
  bottom: 6px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  cursor: nwse-resize;
  background-image: radial-gradient(circle, rgba(100, 116, 139, .55) 1px, transparent 1px);
  background-size: 5px 5px;
  opacity: .7;
}
.cv-agent-grip:hover { opacity: 1; }

/* 消息气泡 */
.ag-msg { display: flex; flex-direction: column; gap: 4px; max-width: 94%; }
.ag-msg.is-user { align-self: flex-end; align-items: flex-end; }
.ag-msg.is-assistant { align-self: flex-start; }
.ag-msg-role { font-size: 10.5px; color: #94a3b8; }
.ag-msg-body {
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.ag-msg.is-user .ag-msg-body { background: #2563eb; color: #fff; border-bottom-right-radius: 4px; }
.ag-msg.is-assistant .ag-msg-body {
  background: rgba(255, 255, 255, .94);
  color: #1f2937;
  border: 1px solid var(--border, #e2e8f0);
  border-bottom-left-radius: 4px;
}
.ag-tool {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 10.5px;
}
.ag-tool.is-error { background: #fef2f2; color: #b91c1c; }
.ag-tool-name { font-weight: 600; }

.cv-insp-empty { font-size: 11.5px; color: #94a3b8; line-height: 1.7; }
.cv-empty {
  padding: 18px 12px;
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.7;
  color: #94a3b8;
  text-align: center;
}

/* ===== 充值申请表单 / 完整密钥（v2.4） ===== */
.recharge-form { display: flex; flex-direction: column; gap: 10px; }
.recharge-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: #475569; }
.recharge-form input,
.recharge-form select,
.recharge-form textarea {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.recharge-form input:focus,
.recharge-form select:focus,
.recharge-form textarea:focus { outline: none; border-color: #2563eb; }
.recharge-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.api-key-row-main code.api-key-full {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 11.5px;
  padding: 2px 6px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
}
.api-key-row-main [data-copy-key] { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; }

@media (max-width: 1280px) {
  .cv-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .cv-agent { width: 310px; }
}
@media (max-width: 860px) {
  .cv-shell { grid-template-columns: 1fr; height: auto; }
  .cv-sidebar { border-right: 0; border-bottom: 1px solid var(--border, #e2e8f0); }
  .cv-board-wrap { height: 56vh; }
  .cv-agent {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 8px;
    width: auto !important;
    height: 46vh !important;
  }
}

/* ===== 参考图 / 批量模式（v2.6） ===== */
.bd-batch { margin-left: 4px; }
.bd-batch.active { border-color: #7c3aed; background: #f5f3ff; color: #6d28d9; font-weight: 600; }
.bd-refs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border: 1px dashed #c7d2fe;
  border-radius: 10px;
  background: #f8faff;
}
.bd-refs-label { font-size: 11.5px; color: #4338ca; font-weight: 600; }
.bd-ref {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #c7d2fe;
  background: #fff;
}
.bd-ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-ref button {
  position: absolute;
  right: 1px;
  top: 1px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, .6);
  color: #fff;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.bd-ref button:hover { background: #dc2626; }
.bd-card-media-wrap[data-preview] { cursor: zoom-in; }

/* ===== 画框 / 右键菜单 / 进度条 / 拖拽上传（v2.7） ===== */
.bd-frame {
  position: absolute;
  z-index: 1;
  border: 1.5px dashed var(--frame-color, #6366f1);
  border-radius: 18px;
  background: color-mix(in srgb, var(--frame-color, #6366f1) 7%, transparent);
  pointer-events: none;
}
.bd-frame-head {
  position: absolute;
  left: 0;
  top: -30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--frame-color, #6366f1);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  white-space: nowrap;
}
.bd-frame-head:active { cursor: grabbing; }
.bd-frame-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.9); }
.bd-frame-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bd-frame-count { font-weight: 400; opacity: .85; }
.bd-frame-del {
  border: 0;
  background: rgba(255, 255, 255, .22);
  color: #fff;
  border-radius: 999px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.bd-frame-del:hover { background: #dc2626; }
.bd-frame-grip {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  cursor: nwse-resize;
  pointer-events: auto;
  background-image: radial-gradient(circle, var(--frame-color, #6366f1) 1px, transparent 1px);
  background-size: 5px 5px;
  opacity: .6;
}
.bd-frame-grip:hover { opacity: 1; }

/* 右键菜单 */
.bd-menu {
  position: fixed;
  z-index: 9999;
  min-width: 168px;
  padding: 6px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}
.bd-menu button,
.bd-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-size: 12.5px;
}
.bd-menu button:hover,
.bd-menu a:hover { background: #f1f5f9; }
.bd-menu .danger { color: #b91c1c; }
.bd-menu .danger:hover { background: #fef2f2; }

/* 生成进度 */
.bd-progress {
  width: 72%;
  height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.bd-progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #22c55e);
  transition: width .8s linear;
}
.bd-elapsed { font-size: 11px; color: #94a3b8; }
.bd-error { font-size: 10.5px; color: #b91c1c; opacity: .85; max-width: 90%; text-align: center; }

/* 拖拽上传 */
.cv-board-wrap.is-drop-target,
.cv-composer.is-drop-target {
  outline: 2px dashed #6366f1;
  outline-offset: -6px;
  background-color: #eef2ff;
}

.bd-badge.fail { background: #fef2f2; color: #b91c1c; }

/* ===== 后台渠道开关（v2.9） ===== */
.model-check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 190px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 9px;
  background: #fbfcfe;
}
.model-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  padding: 2px 0;
}
.model-check input { margin: 0; }
.model-check span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-check em { font-style: normal; color: #94a3b8; font-size: 11px; }

/* ===== 后台用户明细（v2.10） ===== */
.ud-uid { color: #94a3b8; font-size: 12px; font-weight: 400; }
.ud-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 6px;
}
.ud-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdff, #f4f7fb);
}
.ud-stat-label { font-size: 11px; color: #7c8798; }
.ud-stat-value { font-size: 18px; color: #0f172a; }
.ud-stat-hint { font-size: 11px; color: #9aa5b4; }
.ud-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.ud-title {
  font-size: 12px;
  margin: 16px 0 6px;
  color: #334155;
  letter-spacing: 0.04em;
}
.ud-title small { color: #94a3b8; font-weight: 400; }
.ud-scroll { max-height: 210px; overflow: auto; border: 1px solid #e6ebf2; border-radius: 9px; }
.ud-table { font-size: 12px; }
.ud-table th { position: sticky; top: 0; background: #f6f8fb; z-index: 1; }
.ud-table td { vertical-align: top; }
.ud-minus { color: #dc2626; font-weight: 600; }
.ud-plus { color: #059669; font-weight: 600; }
.ud-err { color: #dc2626; }
.ud-empty { padding: 10px 4px; font-size: 12px; }
@media (max-width: 760px) {
  .ud-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 门户配置里的开关行 */
.admin-switch-line {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}
.admin-switch-line input { width: auto; margin: 0; }

/* ===== 自由聊天（v2.14） ===== */
.chat-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 168px);
  min-height: 460px;
}
.chat-side {
  display: flex;
  flex-direction: column;
  border: 1px solid #e6ebf2;
  border-radius: 14px;
  background: #fbfcfe;
  overflow: hidden;
}
.chat-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
}
.chat-new { font-size: 12px; padding: 5px 10px; }
.chat-list { flex: 1 1 auto; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-list-item {
  position: relative;
  padding: 9px 30px 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}
.chat-list-item:hover { border-color: #dfe7f1; }
.chat-list-item.active { border-color: #6366f1; background: #eef0ff; }
.chat-list-title { font-size: 12.5px; font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-preview { font-size: 11px; color: #94a3b8; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-del {
  position: absolute; right: 4px; top: 8px;
  border: none; background: transparent; color: #cbd5e1; cursor: pointer; padding: 2px;
}
.chat-list-del:hover { color: #dc2626; }
.chat-list-empty { font-size: 12px; color: #94a3b8; padding: 10px; }
.chat-main {
  display: flex;
  flex-direction: column;
  border: 1px solid #e6ebf2;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.chat-main-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #eef2f7;
}
.chat-main-head h2 { font-size: 15px; margin: 0; }
.chat-main-head p { margin: 3px 0 0; font-size: 11.5px; color: #94a3b8; }
.chat-balance { font-size: 12px; color: #64748b; white-space: nowrap; }
.chat-stream { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; background: #fcfdff; }
.chat-row { display: flex; gap: 10px; align-items: flex-start; }
.chat-row.mine { flex-direction: row-reverse; }
.chat-avatar {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #eef2ff; color: #4f46e5;
}
.chat-row.mine .chat-avatar { background: #e0f2fe; color: #0284c7; }
.chat-bubble { max-width: min(680px, 78%); }
.chat-text { font-size: 13.5px; line-height: 1.65; color: #1f2937; }
.chat-row.mine .chat-text {
  background: #eef2ff; border-radius: 12px; padding: 9px 12px;
}
.chat-time { font-size: 10.5px; color: #b6c0cd; margin-top: 4px; }
.chat-tasks { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chat-task {
  margin: 0; width: 240px; border: 1px solid #e6ebf2; border-radius: 12px;
  overflow: hidden; background: #fff;
}
.chat-task-head { display: flex; align-items: center; gap: 6px; padding: 7px 9px; font-size: 11px; color: #64748b; }
.chat-task-kind { display: inline-flex; align-items: center; gap: 4px; }
.chat-task-cost { margin-left: auto; color: #94a3b8; }
.chat-media { display: block; width: 100%; height: auto; background: #f1f5f9; }
.chat-task figcaption { font-size: 11px; color: #94a3b8; padding: 6px 9px 8px; }
.chat-task-skeleton {
  padding: 34px 10px; text-align: center; font-size: 11.5px; color: #94a3b8;
  background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 10px, #f1f5f9 10px, #f1f5f9 20px);
}
.chat-empty { margin: auto; text-align: center; max-width: 520px; }
.chat-empty-icon { color: #a5b4fc; margin-bottom: 6px; }
.chat-empty h3 { font-size: 15px; margin: 0 0 4px; }
.chat-empty p { font-size: 12.5px; color: #94a3b8; margin: 0 0 14px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-chip {
  border: 1px solid #e2e8f0; background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 12px; color: #475569; cursor: pointer;
}
.chat-chip:hover { border-color: #6366f1; color: #4f46e5; }
.chat-composer { border-top: 1px solid #eef2f7; padding: 10px 14px 12px; background: #fff; }
.chat-composer textarea {
  width: 100%; resize: vertical; min-height: 52px; max-height: 180px;
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 9px 11px;
  font-size: 13px; line-height: 1.6; font-family: inherit;
}
.chat-composer textarea:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.chat-composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.chat-hint { font-size: 11px; color: #b6c0cd; }
.chat-notice { padding: 8px 14px; font-size: 12px; color: #b45309; background: #fffbeb; border-top: 1px solid #fef3c7; }
@media (max-width: 900px) {
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .chat-side { max-height: 200px; }
  .chat-main { min-height: 60vh; }
}
