:root {
      --bg: #f7f8fa;
      --panel: #ffffff;
      --soft: #f5f6f8;
      --border: #e4e5e7;
      --text: #1f2022;
      --muted: #8c919a;
      --accent: #00a3ff;
      --accent-hover: #0088e0;
      --shadow: 0 8px 40px rgba(0, 0, 0, 0.06);
      --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.1);
      --sidebar-width: 68px;
      --sidebar-page-left: 96px;
      --sidebar-page-right: 28px;
      --sidebar-flyout-left: calc(var(--sidebar-width) + 12px);
      --outline-rail-width: 0px;
    }
    :root[data-theme="dark"] {
      --bg: #0f1117;
      --panel: #171a22;
      --soft: #202431;
      --border: #2f3543;
      --text: #f4f7fb;
      --muted: #9aa4b2;
      --accent: #38bdf8;
      --accent-hover: #0ea5e9;
      --shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
      --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    }
    :root[data-theme="dark"] .sidebar {
      background: rgba(23,26,34,0.9);
      border-right-color: rgba(47,53,67,.9);
    }
    :root[data-theme="dark"] .message.ai .message-body,
    :root[data-theme="dark"] .action-btn,
    :root[data-theme="dark"] .card-action {
      background: var(--panel);
    }
    :root[data-theme="dark"] .flow-chip,
    :root[data-theme="dark"] .history-item:hover {
      background: var(--soft);
    }
    :root[data-theme="dark"] .modal-overlay {
      background: rgba(0,0,0,.78);
    }
    :root[data-density="compact"] .message,
    :root[data-density="compact"] .message.ai .message-body {
      font-size: 12px;
      line-height: 1.5;
    }
    :root[data-density="compact"] .library-item,
    :root[data-density="compact"] .shot-row,
    :root[data-density="compact"] .chapter-row {
      padding: 8px;
    }
    :root[data-reduce-motion="true"] *,
    :root[data-reduce-motion="true"] *::before,
    :root[data-reduce-motion="true"] *::after {
      animation-duration: .001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .001ms !important;
      scroll-behavior: auto !important;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      background: var(--bg);
      color: var(--text);
      font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
      min-height: 100vh;
      overflow-x: hidden;
      overflow-y: auto;
    }

    .sidebar {
      position: fixed;
      left: 0;
      top: 0;
      width: var(--sidebar-width);
      height: 100vh;
      background: rgba(255,255,255,0.88);
      backdrop-filter: blur(20px);
      border-right: 1px solid rgba(228,229,231,0.7);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 18px 0;
      z-index: 1200;
      isolation: isolate;
      pointer-events: auto;
    }
    .sidebar-logo { width: 34px; height: 34px; margin-bottom: 20px; cursor: pointer; position: relative; z-index: 1; flex: 0 0 auto; }
    .sidebar-item {
      width: 46px;
      min-height: 46px;
      border-radius: 14px;
      border: none;
      background: transparent;
      color: var(--muted);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      cursor: pointer;
      transition: .2s ease;
      font: inherit;
      position: relative;
      pointer-events: auto;
    }
    .sidebar-item:hover { background: rgba(0,163,255,.07); color: var(--text); }
    .sidebar-item.active { background: rgba(0,163,255,.12); color: var(--accent); }
    .sidebar-item.has-task-alert { color: var(--accent); }
    .generation-task-badge {
      position: absolute;
      top: 5px;
      right: 5px;
      min-width: 16px;
      height: 16px;
      padding: 0 4px;
      border-radius: 999px;
      background: #e5484d;
      color: #fff;
      font-size: 10px;
      font-weight: 900;
      line-height: 16px;
      text-align: center;
      box-shadow: 0 2px 8px rgba(229,72,77,.35);
    }
    #sidebarUser.logged-in {
      background: rgba(0,163,255,.10);
      color: var(--accent);
    }
    .sidebar-item .icon { font-size: 18px; }
    .sidebar-item .label { font-size: 9px; font-weight: 700; white-space: nowrap; }
    .sidebar-item .tooltip {
      position: absolute;
      left: calc(100% + 12px);
      top: 50%;
      transform: translateY(-50%);
      background: #1f2022;
      color: white;
      font-size: 11px;
      font-weight: 700;
      padding: 6px 10px;
      border-radius: 8px;
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transition: opacity .15s;
      z-index: 300;
    }
    .sidebar-item .tooltip::before {
      content: '';
      position: absolute;
      right: 100%;
      top: 50%;
      transform: translateY(-50%);
      border: 5px solid transparent;
      border-right-color: #1f2022;
    }
    .sidebar-item:hover .tooltip { opacity: 1; }
    .sidebar-middle {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      flex-direction: column;
      gap: 4px;
      flex: none;
      justify-content: center;
      z-index: 1;
    }
    .sidebar-bottom {
      position: absolute;
      left: 50%;
      bottom: 18px;
      transform: translateX(-50%);
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 0;
      z-index: 1;
    }
    #sidebarUser {
      position: relative;
      z-index: 2;
      pointer-events: auto;
    }
    .user-flyout-menu {
      position: fixed;
      left: var(--sidebar-flyout-left);
      bottom: 18px;
      width: 180px;
      padding: 8px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--panel);
      box-shadow: var(--shadow-lg);
      z-index: 420;
      display: none;
    }
    .user-flyout-menu.show { display: grid; gap: 6px; }
    .user-flyout-item {
      width: 100%;
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      color: var(--text);
      padding: 10px 12px;
      text-align: left;
      cursor: pointer;
      font: inherit;
      font-size: 12px;
      font-weight: 800;
    }
    .user-flyout-item:hover {
      background: var(--soft);
      border-color: var(--border);
    }
    .user-flyout-item.danger { color: #f04438; }

    .generation-task-drawer {
      position: fixed;
      inset: 0;
      z-index: 980;
      pointer-events: none;
      background: rgba(17,24,39,0);
      transition: background .2s ease;
    }
    .generation-task-drawer.show {
      pointer-events: auto;
      background: rgba(17,24,39,.24);
    }
    .generation-task-panel {
      position: absolute;
      top: 16px;
      right: 16px;
      bottom: 16px;
      width: min(420px, calc(100vw - 88px));
      border: 1px solid var(--border);
      border-radius: 16px;
      background: var(--panel);
      box-shadow: var(--shadow-lg);
      display: grid;
      grid-template-rows: auto auto minmax(0, 1fr);
      overflow: hidden;
      transform: translateX(calc(100% + 24px));
      transition: transform .2s ease;
    }
    .generation-task-drawer.show .generation-task-panel { transform: translateX(0); }
    .generation-task-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 14px;
      padding: 18px 18px 12px;
      border-bottom: 1px solid var(--border);
    }
    .generation-task-kicker {
      color: var(--muted);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 0;
      line-height: 1.2;
    }
    .generation-task-heading {
      color: var(--text);
      font-size: 18px;
      font-weight: 900;
      line-height: 1.25;
    }
    .generation-task-meta {
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }
    .generation-task-header-actions {
      display: flex;
      gap: 8px;
      flex: 0 0 auto;
    }
    .generation-task-icon-btn {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--soft);
      color: var(--text);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: .2s ease;
    }
    .generation-task-icon-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
    }
    .generation-task-icon-btn .ui-icon { width: 17px; height: 17px; }
    .generation-task-filters {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 6px;
      padding: 12px 18px;
      border-bottom: 1px solid var(--border);
      background: var(--soft);
    }
    .generation-task-filter {
      min-width: 0;
      height: 32px;
      border: 1px solid var(--border);
      border-radius: 9px;
      background: var(--panel);
      color: var(--muted);
      font: inherit;
      font-size: 11px;
      font-weight: 900;
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .generation-task-filter.active {
      border-color: var(--accent);
      color: var(--accent);
      background: rgba(0,163,255,.08);
    }
    .generation-task-list {
      min-height: 0;
      overflow: auto;
      padding: 14px 18px 18px;
      display: grid;
      align-content: start;
      gap: 10px;
    }
    .generation-task-item {
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--panel);
      padding: 12px;
      display: grid;
      gap: 9px;
      min-width: 0;
    }
    .generation-task-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: start;
    }
    .generation-task-meta { min-width: 0; }
    .generation-task-title {
      color: var(--text);
      font-size: 13px;
      font-weight: 900;
      line-height: 1.35;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .generation-task-subtitle,
    .generation-task-footer {
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      line-height: 1.35;
    }
    .generation-task-status {
      border-radius: 999px;
      padding: 4px 8px;
      font-size: 10px;
      font-weight: 900;
      line-height: 1;
      color: #0f172a;
      background: #e5e7eb;
      white-space: nowrap;
    }
    .generation-task-status.status-running { background: #dbeafe; color: #1d4ed8; }
    .generation-task-status.status-queued { background: #fef3c7; color: #92400e; }
    .generation-task-status.status-succeeded { background: #dcfce7; color: #166534; }
    .generation-task-status.status-failed { background: #fee2e2; color: #b91c1c; }
    .generation-task-status.status-canceled { background: #e5e7eb; color: #374151; }
    .generation-task-progress {
      height: 7px;
      border-radius: 999px;
      background: var(--soft);
      overflow: hidden;
    }
    .generation-task-progress span {
      display: block;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, #00a3ff, #16a34a);
      transition: width .2s ease;
    }
    .generation-task-footer {
      display: flex;
      justify-content: space-between;
      gap: 8px;
    }
    .generation-task-error {
      color: #b91c1c;
      font-size: 11px;
      font-weight: 700;
      line-height: 1.45;
      overflow-wrap: anywhere;
    }
    .generation-task-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }
    .generation-task-action {
      border: 1px solid var(--border);
      border-radius: 9px;
      background: var(--soft);
      color: var(--text);
      min-height: 30px;
      padding: 6px 10px;
      font: inherit;
      font-size: 11px;
      font-weight: 900;
      cursor: pointer;
    }
    .generation-task-action.primary {
      border-color: var(--accent);
      background: var(--accent);
      color: #fff;
    }
    .generation-task-empty {
      min-height: 140px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
      text-align: center;
      border: 1px dashed var(--border);
      border-radius: 12px;
      padding: 18px;
    }
    .generation-task-empty.error {
      color: #b91c1c;
      overflow-wrap: anywhere;
    }
    @media (max-width: 720px) {
      .generation-task-panel {
        left: var(--sidebar-flyout-left);
        right: 10px;
        top: 10px;
        bottom: 10px;
        width: auto;
        border-radius: 14px;
      }
      .generation-task-header { padding: 14px 14px 10px; }
      .generation-task-filters { padding: 10px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .generation-task-list { padding: 12px 14px 14px; }
      .generation-task-row { grid-template-columns: minmax(0, 1fr); }
      .generation-task-status { justify-self: start; }
    }

    .page { display: none; flex-direction: column; min-height: 100vh; }
    .page.active { display: flex; }

        #page-home {
      justify-content: center;
      align-items: center;
      padding: 20px var(--sidebar-page-right) 20px var(--sidebar-page-left);
    }
    .home-content {
      width: 100%;
      max-width: 720px;
      display: flex;
      flex-direction: column;
      align-items: center;
      transform: translateY(-24px);
    }
    .home-logo { font-size: 42px; margin-bottom: 12px; }
    .home-title { font-size: 32px; font-weight: 900; letter-spacing: -.04em; margin-bottom: 8px; }
    .home-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 18px; }

    /* ===== 大纲目录栏（侧边栏右侧） ===== */
    .outline-directory-rail {
      position: fixed;
      left: var(--sidebar-width);
      top: 0;
      bottom: 0;
      width: 240px;
      background: var(--panel);
      border-right: 1px solid var(--border);
      display: none;
      flex-direction: column;
      z-index: 120;
    }
    .outline-directory-rail.show { display: flex; }
    #page-home.chat-mode.outline-rail-active {
      --outline-rail-width: 240px;
      padding-left: calc(var(--sidebar-page-left) + var(--outline-rail-width));
    }
    .odr-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 14px 10px;
      border-bottom: 1px solid var(--border);
      font-size: 13px;
      font-weight: 900;
      color: var(--text);
    }
    .odr-close {
      border: 0;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      font-size: 14px;
      padding: 2px 6px;
      border-radius: 6px;
    }
    .odr-close:hover { background: var(--soft); color: var(--text); }
    .odr-body { flex: 1; overflow-y: auto; padding: 10px; }
    /* 总体进度统计 */
    .odr-stats {
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px 11px;
      margin-bottom: 10px;
      background: var(--soft);
    }
    .odr-stats-head { font-size: 12px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
    .odr-stat-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; }
    .odr-stat-label { width: 32px; color: var(--muted); font-weight: 700; flex-shrink: 0; }
    .odr-stat-track { flex: 1; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
    .odr-stat-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #38bdf8); }
    .odr-stat-count { min-width: 30px; text-align: right; font-weight: 800; color: var(--muted); }
    .odr-stat-count.done { color: #16a34a; }
    /* 每集进度行（仅阶段状态点） */
    .odr-list { display: flex; flex-direction: column; gap: 6px; }
    .odr-episode {
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
      background: var(--soft);
    }
    .odr-episode-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 11px;
      font-size: 12px;
      font-weight: 700;
      color: var(--text);
    }
    .odr-episode-stage { display: inline-flex; gap: 4px; flex-shrink: 0; }
    .odr-dot {
      width: 20px;
      height: 20px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 900;
    }
    .odr-dot.done { background: rgba(34,197,94,.14); color: #16a34a; }
    .odr-dot.todo { background: rgba(148,163,184,.15); color: var(--muted); }
    /* 每集展开/收起 */
    .odr-episode { cursor: pointer; }
    .odr-episode-head:hover { background: rgba(0,163,255,.06); }
    .odr-episode.expanded .odr-episode-head { background: rgba(0,163,255,.08); }
    .odr-chevron { color: var(--muted); font-size: 10px; transition: transform .2s; margin-left: 2px; }
    .odr-episode.expanded .odr-chevron { transform: rotate(180deg); }
    .odr-episode-body { display: none; padding: 0 11px 11px; font-size: 12px; line-height: 1.7; color: var(--text); border-top: 1px solid var(--border); }
    .odr-episode.expanded .odr-episode-body { display: block; }
    /* 资产库详情页的大纲目录：原生 <details> 展开 */
    details.odr-episode > summary.odr-episode-head { list-style: none; cursor: pointer; }
    details.odr-episode > summary.odr-episode-head::-webkit-details-marker { display: none; }
    details.odr-episode[open] .odr-chevron { transform: rotate(180deg); }
    details.odr-episode[open] .odr-episode-body { display: block; }
    /* 项目级「角色模板」行：全剧可复用，不归属某一集 */
    .odr-project-char-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 9px 11px;
      margin-bottom: 6px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      font-size: 12px;
      font-weight: 800;
      color: var(--text);
    }
    .odr-project-char-row-action { cursor: pointer; transition: .2s; }
    .odr-project-char-row-action:hover { background: rgba(0,163,255,.06); border-color: rgba(0,163,255,.35); }
    .odr-project-char-name em { font-style: normal; font-weight: 600; color: var(--muted); font-size: 11px; margin-left: 4px; }
    .odr-project-char-status { color: var(--muted); font-weight: 800; }
    .odr-project-char-status.done { color: #16a34a; }
    /* 剧本卡片：无按钮，整卡可点击进入详情 */
    .script-card-clickable { cursor: pointer; }
    .script-card-clickable:hover { border-color: rgba(0,163,255,.35); }
    /* 资产库剧本详情：两栏布局（左大纲栏 / 右大纲详情） */
    .preview-asset-outline-layout { display: flex; gap: 14px; align-items: flex-start; margin-top: 12px; }
    .preview-asset-outline-left { width: 280px; flex-shrink: 0; min-width: 0; }
    .preview-asset-outline-right { flex: 1; min-width: 0; }
    .preview-asset-outline-right .cdp-meta { font-size: 13px; font-weight: 900; color: var(--text); margin-bottom: 8px; }
    .preview-asset-outline-right .cdp-section { margin-top: 8px; }
    .preview-asset-outline-right .cdp-section-title { font-weight: 800; color: var(--accent); font-size: 12px; margin-bottom: 2px; }
    .preview-asset-outline-right .cdp-content { font-size: 12px; line-height: 1.7; color: var(--text); }
    .odr-episode.selected { border-color: rgba(0,163,255,.55); }
    .odr-episode.selected .odr-episode-head { background: rgba(0,163,255,.1); }
    .preview-asset-outline-left .odr-episode-head { cursor: pointer; }
    .preview-asset-outline-left .odr-episode-head:hover { background: rgba(0,163,255,.08); }
    .preview-asset-outline-left .odr-stat-row-action { cursor: pointer; }
    .odr-stat-row.active-step { background: rgba(0,163,255,.12); }
    .odr-stat-row.active-step .odr-stat-label { color: var(--accent); }
    .preview-asset-step-empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 12px; }
    /* 角色模板卡片 */
    .ctpl-list { display: flex; flex-direction: column; gap: 12px; }
    .ctpl-card {
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--panel);
      padding: 16px 22px;
    }
    .material-picker-layer {
      position: fixed;
      inset: 0;
      z-index: 5100;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
      background: rgba(0, 0, 0, 0.45);
      backdrop-filter: blur(8px);
    }
    .material-picker-layer.show { display: flex; }
    .material-picker {
      width: min(720px, 100%);
      max-height: 86vh;
      display: flex;
      flex-direction: column;
      border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
      border-radius: 14px;
      background: var(--panel, #ffffff);
      color: var(--text, #1f2022);
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
      overflow: hidden;
    }
    .material-picker-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 18px 10px;
      font-size: 14px;
      font-weight: 800;
    }
    .material-picker-close {
      border: none;
      background: transparent;
      color: var(--muted);
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
      padding: 4px;
    }
    .material-picker-actions {
      display: flex;
      gap: 8px;
      padding: 0 18px 12px;
    }
    .material-picker-grid-wrap {
      padding: 0 18px 16px;
      overflow: auto;
      min-height: 120px;
    }
    .material-picker-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
      gap: 10px;
    }
    .material-picker-item {
      border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
      border-radius: 10px;
      overflow: hidden;
      cursor: pointer;
      background: var(--soft, #f5f6f8);
      transition: border-color 0.15s ease, transform 0.15s ease;
    }
    .material-picker-item:hover {
      border-color: var(--accent, #00a3ff);
      transform: translateY(-1px);
    }
    .material-picker-item img {
      width: 100%;
      height: 80px;
      object-fit: cover;
      display: block;
    }
    .material-picker-item-name {
      display: block;
      padding: 6px 8px;
      font-size: 11px;
      color: var(--muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .material-picker-hint {
      grid-column: 1 / -1;
      padding: 28px 0;
      text-align: center;
      color: var(--muted, #94a3b8);
      font-size: 13px;
    }
    .material-picker-empty {
      padding: 24px 0;
      text-align: center;
      color: var(--muted);
      font-size: 13px;
    }
    .ctpl-character-card {
      border-color: var(--accent, #00a3ff);
      box-shadow: 0 2px 14px rgba(0, 163, 255, 0.1);
    }
    .ctpl-outfit-card {
      margin-left: 20px;
      border-left: 3px solid var(--accent, #00a3ff);
    }
    /* 子卡片内容少：图片改为小缩略图，避免卡片被撑得过高 */
    .ctpl-outfit-card .ctpl-image {
      width: 140px;
      flex-shrink: 0;
    }
    .ctpl-outfit-card .ctpl-image img {
      height: 92px;
      object-fit: cover;
    }
    .ctpl-outfit-card .ctpl-image-empty {
      height: 92px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
    }
    .ctpl-outfit-card .ctpl-text {
      font-size: 11.5px;
    }
    .ctpl-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 8px;
    }
    .ctpl-char-summary {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      flex-wrap: wrap;
    }
    .ctpl-badge {
      font-size: 11px;
      font-weight: 700;
      padding: 2px 9px;
      border-radius: 999px;
      background: rgba(0, 163, 255, 0.1);
      color: var(--accent, #00a3ff);
      white-space: nowrap;
    }
    .ctpl-sections {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .ctpl-section {
      font-size: 12px;
      line-height: 1.65;
      color: var(--text);
    }
    .ctpl-section-label {
      display: block;
      font-size: 11px;
      font-weight: 800;
      color: var(--accent, #00a3ff);
      margin-bottom: 1px;
    }
    .ctpl-section-text {
      white-space: pre-wrap;
      word-break: break-word;
    }
    .ctpl-card-body {
      display: flex;
      gap: 22px;
      align-items: flex-start;
    }
    .ctpl-text {
      flex: 1;
      min-width: 0;
      font-size: 12px;
      line-height: 1.7;
      color: var(--text);
      white-space: pre-wrap;
      word-break: break-word;
    }
    .ctpl-text-actions { margin-top: 10px; }
    .scene-imgref-toggle {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      color: var(--muted);
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }
    .scene-imgref-toggle input { accent-color: var(--accent); cursor: pointer; margin: 0; }
    .ctpl-media-col {
      width: 260px;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .ctpl-media-col .ctpl-image { width: 100%; }
    .scene-imgref-preview { width: 100%; }
    .scene-imgref-preview-label {
      display: block;
      font-size: 11px;
      color: var(--accent, #00a3ff);
      margin-bottom: 6px;
    }
    .scene-imgref-preview-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .scene-imgref-preview-list img {
      width: 74px;
      height: 46px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
      cursor: zoom-in;
      display: block;
    }
    .scene-imgref-preview-empty {
      font-size: 11px;
      color: var(--muted);
      line-height: 1.6;
      border: 1px dashed var(--border, rgba(148, 163, 184, 0.28));
      border-radius: 8px;
      padding: 8px 10px;
    }
    .img-refs-preview { margin-bottom: 10px; }
    .img-refs-preview-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
    .img-refs-preview-list { display: flex; flex-wrap: wrap; gap: 8px; }
    .img-refs-preview-list img {
      width: 96px;
      height: 60px;
      object-fit: cover;
      border-radius: 8px;
      border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
      cursor: zoom-in;
      display: block;
    }
    .ctpl-image {
      width: 260px;
      flex-shrink: 0;
      border-radius: 10px;
      overflow: hidden;
      border: 1px solid var(--border);
      background: var(--soft);
    }
    .ctpl-image-group {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      width: 260px;
      flex-shrink: 0;
    }
    .ctpl-image-group .ctpl-image {
      width: 126px;
    }
    .ctpl-image-tag {
      display: block;
      padding: 3px 8px;
      font-size: 10px;
      color: var(--accent, #00a3ff);
      background: rgba(0, 163, 255, 0.08);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ctpl-image img { width: 100%; display: block; cursor: zoom-in; }
    .ctpl-image-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 10px;
      border-top: 1px solid var(--border);
    }
    .ctpl-image-actions .action-btn { margin: 0; }
    .ctpl-done-badge { font-size: 11px; font-weight: 700; color: #16a34a; white-space: nowrap; }
    .ctpl-card-status { font-size: 11px; font-weight: 700; color: #16a34a; }
    .ctpl-image-empty .action-btn { margin-top: 8px; }
    .ctpl-image-empty {
      min-height: 200px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      padding: 10px;
    }
    .ctpl-image-empty em { font-style: normal; font-size: 11px; opacity: .8; }
    .ctpl-name { font-size: 15px; font-weight: 900; color: var(--text); }
    .ctpl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
    /* 分镜表格：无外边框，行分隔线 + hover + 徽章 */
    .shot-table-wrap { overflow-x: auto; margin-top: 12px; border-radius: 12px; }
    .shot-table { width: 100%; border-collapse: collapse; font-size: 12.5px; border-spacing: 0; }
    .shot-table thead th {
      padding: 8px 12px;
      font-size: 11px;
      font-weight: 700;
      color: var(--muted);
      text-align: left;
      letter-spacing: .04em;
      white-space: nowrap;
      border-bottom: 1px solid var(--border);
      background: transparent;
    }
    .shot-table tbody td {
      padding: 10px 12px;
      border-bottom: 1px solid rgba(0, 0, 0, .06);
      line-height: 1.7;
      vertical-align: top;
      color: var(--text);
      background: transparent;
    }
    .shot-table tbody tr { transition: background .15s ease; }
    .shot-table tbody tr:hover { background: rgba(0, 163, 255, .05); }
    .shot-table tbody tr:last-child td { border-bottom: none; }
    .shot-table .col-no { width: 56px; text-align: center; white-space: nowrap; }
    .shot-table .no-badge {
      display: inline-flex;
      width: 26px;
      height: 26px;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      background: linear-gradient(135deg, rgba(0, 163, 255, .16), rgba(0, 163, 255, .05));
      color: var(--accent);
      font-weight: 800;
      font-size: 12px;
    }
    .shot-table .col-dur { width: 66px; white-space: nowrap; }
    .shot-table .dur-badge {
      display: inline-block;
      padding: 2px 9px;
      border-radius: 999px;
      background: var(--soft);
      color: var(--text);
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
    }
    .shot-table .col-view { min-width: 130px; font-weight: 600; color: var(--text); }
    .shot-table .col-content { min-width: 240px; }
    .shot-table .col-dialogue { width: 190px; min-width: 140px; }
    .shot-table .col-sound { width: 190px; min-width: 140px; }
    .shot-table .dialogue-line { color: var(--accent); }
    .shot-table .sound-line { color: var(--muted); }
    .shot-table .img-prompt {
      color: var(--muted);
      font-size: 11px;
      margin-top: 5px;
      opacity: .85;
      border-left: 2px solid rgba(0, 163, 255, .25);
      padding-left: 8px;
      white-space: pre-wrap;
    }
    /* 视频卡片（左文字 / 右视频） */
    .ctpl-video-col {
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .shot-ref-images { width: 100%; }
    .shot-ref-label {
      display: block;
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 5px;
    }
    .shot-ref-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .shot-ref-list img {
      width: 64px;
      height: 48px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
      cursor: zoom-in;
      display: block;
    }
    .ctpl-video {
      width: 320px;
      flex-shrink: 0;
      border-radius: 10px;
      overflow: hidden;
      border: 1px solid var(--border);
      background: #000;
    }
    .ctpl-video video { width: 100%; display: block; max-height: 260px; }
    .ctpl-video-empty {
      min-height: 160px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      padding: 10px;
      background: var(--soft);
    }
    .ctpl-video-empty em { font-style: normal; font-size: 11px; opacity: .8; }
    /* 输入框区域：本次生成引用的内容（发送前查阅） */
    .input-ref-preview {
      display: none;
      margin-top: 8px;
      border: 1px solid var(--accent);
      border-radius: 10px;
      background: rgba(0, 163, 255, .06);
      padding: 8px 10px;
      max-height: 220px;
      overflow: auto;
    }
    .input-ref-preview.show { display: block; }
    .input-ref-preview-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 12px;
      font-weight: 800;
      color: var(--accent);
      margin-bottom: 6px;
    }
    .input-ref-preview-close {
      border: none;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      padding: 0 2px;
    }
    .input-ref-preview-script { font-size: 11px; color: var(--text); line-height: 1.6; margin-bottom: 6px; }
    .input-ref-preview-tag {
      display: inline-block;
      background: var(--accent);
      color: #fff;
      border-radius: 4px;
      padding: 0 6px;
      font-size: 10px;
      margin-bottom: 4px;
    }
    .input-ref-preview-text { white-space: pre-wrap; word-break: break-word; max-height: 70px; overflow: auto; }
    .input-ref-preview-imgs { display: flex; gap: 8px; flex-wrap: wrap; }
    .input-ref-preview-img { width: 84px; text-align: center; }
    .input-ref-preview-img img {
      width: 100%;
      height: 56px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid var(--border);
      cursor: zoom-in;
      background: var(--soft);
    }
    .input-ref-preview-img span {
      display: block;
      font-size: 10px;
      color: var(--muted);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* 独立引用项（可删除/替换） */
    .input-ref-preview-items { display: flex; flex-direction: column; gap: 6px; }
    .input-ref-preview-item {
      display: flex;
      align-items: center;
      gap: 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 6px 8px;
      background: var(--panel);
    }
    .input-ref-preview-item img {
      width: 44px;
      height: 44px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid var(--border);
      cursor: zoom-in;
      flex-shrink: 0;
      background: var(--soft);
    }
    .input-ref-preview-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
    .input-ref-preview-item-tag {
      display: inline-block;
      align-self: flex-start;
      background: rgba(0, 163, 255, .1);
      color: var(--accent);
      border-radius: 4px;
      padding: 0 5px;
      font-size: 10px;
      font-weight: 700;
    }
    .input-ref-preview-item-label {
      font-size: 11px;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .input-ref-preview-item-actions { display: flex; gap: 6px; margin-top: 2px; }
    .input-ref-preview-item-actions .action-btn {
      font-size: 11px;
      padding: 2px 8px;
      min-height: 0;
    }
    .action-btn.danger { color: #dc2626; border-color: rgba(220, 38, 38, .35); }
    .action-btn.danger:hover { background: rgba(220, 38, 38, .08); }
    /* 替换图片选择浮层 */
    .video-ref-replace-picker {
      display: none;
      position: absolute;
      left: 0;
      right: 0;
      bottom: calc(100% + 8px);
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
      padding: 10px;
      z-index: 30;
    }
    .video-ref-replace-picker.show { display: block; }
    .video-ref-replace-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 12px;
      font-weight: 800;
      color: var(--text);
      margin-bottom: 8px;
    }
    .video-ref-replace-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
      gap: 8px;
      max-height: 200px;
      overflow: auto;
    }
    .video-ref-replace-opt {
      border: 1px solid var(--border);
      border-radius: 8px;
      overflow: hidden;
      cursor: pointer;
      background: var(--soft);
      text-align: center;
    }
    .video-ref-replace-opt img { width: 100%; height: 56px; object-fit: cover; display: block; }
    .video-ref-replace-opt span {
      display: block;
      font-size: 10px;
      color: var(--muted);
      padding: 3px 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .video-ref-replace-opt.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 163, 255, .25); }
    .video-ref-replace-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 0; }
    .ctpl-body {
      font-size: 12px;
      line-height: 1.7;
      color: var(--text);
      white-space: pre-wrap;
      word-break: break-word;
    }
    .odr-section { margin-top: 8px; }
    .odr-section-title { font-weight: 800; color: var(--accent); font-size: 11px; margin-bottom: 2px; }
    /* 状态卡 */
    .odr-status-card {
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel);
      padding: 8px 10px;
      margin-top: 10px;
    }
    .odr-status-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 5px; font-size: 11px; }
    .odr-status-row:first-child { margin-top: 0; }
    .odr-status-label { width: 46px; flex-shrink: 0; color: var(--muted); font-weight: 800; }
    .odr-status-value { flex: 1; color: var(--text); line-height: 1.6; }
    .odr-rel { line-height: 1.7; word-break: break-word; }
    .odr-rel-missing { display: flex; align-items: center; gap: 8px; color: var(--muted); }
    .odr-rel-missing .action-btn { padding: 4px 10px; font-size: 11px; }
    .odr-enter { width: 100%; margin-top: 10px; padding: 7px 12px; font-size: 12px; }
    .odr-dot-action { cursor: pointer; }
    .odr-dot-action:hover { outline: 1px solid var(--accent); }
    /* 每集展开：步骤进度（左标题 / 右进度） */
    .odr-step-progress { display: flex; flex-direction: column; gap: 6px; padding: 8px 11px 10px; }
    .odr-step-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 7px 10px;
      border-radius: 8px;
      background: var(--panel);
      border: 1px solid var(--border);
      cursor: pointer;
      font-size: 12px;
      transition: .2s;
    }
    .odr-step-row:hover { background: rgba(0,163,255,.06); border-color: rgba(0,163,255,.35); }
    .odr-step-label { font-weight: 800; color: var(--text); }
    .odr-step-value { font-weight: 700; }
    .odr-step-value.done { color: #16a34a; }
    .odr-step-value.todo { color: var(--muted); }
    .odr-stat-row-action { cursor: pointer; border-radius: 8px; padding: 6px 8px; margin-left: -8px; margin-right: -8px; }
    .odr-stat-row-action:hover { background: rgba(0,163,255,.06); }
    /* 单集环节工作区（独立视图） */
    .ep-step-workspace {
      position: fixed;
      left: calc(var(--sidebar-width) + var(--outline-rail-width));
      top: 0;
      right: 0;
      bottom: 0;
      background: var(--bg);
      z-index: 210;
      display: none;
      flex-direction: column;
    }
    .ep-step-workspace.show { display: flex; }
    /* 大纲目录栏 / 单集工作区只在对话流页面（#page-home.active）显示 */
    body:not(:has(#page-home.active)) .outline-directory-rail.show,
    body:not(:has(#page-home.active)) .ep-step-workspace.show { display: none !important; }
    .epsw-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 20px;
      border-bottom: 1px solid var(--border);
      background: var(--panel);
    }
    .epsw-title { font-size: 14px; font-weight: 900; color: var(--text); flex-shrink: 0; }
    .epsw-tabs { display: none; }
    .epsw-tab {
      padding: 6px 16px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--soft);
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      transition: .2s;
    }
    .epsw-tab:hover { border-color: var(--accent); color: var(--accent); }
    .epsw-tab.active { border-color: var(--accent); background: rgba(0,163,255,.1); color: var(--accent); }
    .epsw-close { border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
    .epsw-close:hover { background: var(--soft); color: var(--text); }
    .epsw-body { flex: 1; overflow-y: auto; padding: 20px 24px; max-width: 1120px; width: 100%; margin: 0 auto; }
    .epsw-section { margin-top: 14px; }
    .epsw-section:first-child { margin-top: 0; }
    .epsw-section-title { font-weight: 800; color: var(--accent); font-size: 12px; margin-bottom: 6px; }
    .epsw-content { font-size: 13px; line-height: 1.7; color: var(--text); white-space: pre-wrap; }
    .epsw-textarea {
      width: 100%;
      min-height: 320px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      color: var(--text);
      padding: 12px;
      font: inherit;
      font-size: 13px;
      line-height: 1.75;
      outline: none;
      resize: vertical;
    }
    .epsw-textarea:focus { border-color: var(--accent); }
    .epsw-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

    /* 单集操作步骤标题 */
    .ep-step-tabs { display: flex; gap: 8px; margin-top: 14px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
    .ep-step-tab {
      padding: 6px 16px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--soft);
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      transition: .2s;
    }
    .ep-step-tab:hover { border-color: var(--accent); color: var(--accent); }
    .ep-step-tab.active { border-color: var(--accent); background: rgba(0,163,255,.1); color: var(--accent); }

    /* ===== Chat UI ===== */
    .chat-container {
      display: none;
      flex-direction: column;
      width: 100%;
      max-width: 900px;
      min-height: calc(100vh - 40px);
      height: auto;
      padding: 0 0 16px 0;
    }
    .chat-container.active { display: flex; }
    /* 两列详情：容器占满内容区，左侧对话流为「整页宽度-侧边栏」的 50%，右侧详情占余下一半 */
    #page-home.chat-mode:has(.chat-container.inline-detail-mode) .home-content {
      max-width: none;
      width: 100%;
    }
    /* 两列状态下，对话输入框收进左侧聊天栏：居中并左右各留 20px 间距 */
    #page-home.chat-mode:has(.chat-container.inline-detail-mode) .input-card {
      left: calc(var(--sidebar-page-left) + var(--outline-rail-width) + 20px);
      right: auto;
      width: calc((100vw - var(--sidebar-width) - var(--outline-rail-width)) / 2 - 40px);
      max-width: calc((100vw - var(--sidebar-width) - var(--outline-rail-width)) / 2 - 40px);
      margin: 0;
    }
    #page-home.chat-mode .chat-container.inline-detail-mode {
      max-width: none;
      width: 100%;
      flex-direction: row;
      align-items: flex-start;
      gap: 0;
      position: relative;
      margin-top: -20px; /* 抵消页面顶部 20px 内边距，右栏贴到页面最顶部 */
    }
    /* 左右板块之间的分隔线：fixed 贯穿整页（顶部到底部，含输入框右侧区域） */
    #page-home.chat-mode .chat-container.inline-detail-mode::before {
      content: '';
      position: fixed;
      top: 0;
      bottom: 0;
      left: calc(var(--sidebar-page-left) + var(--outline-rail-width) + (100vw - var(--sidebar-width) - var(--outline-rail-width)) / 2);
      width: 1px;
      background: var(--border);
      pointer-events: none;
      opacity: 0;
      animation: inlineDetailDividerIn 0.3s ease 0.1s forwards;
    }
    @keyframes inlineDetailDividerIn {
      to { opacity: 1; }
    }
    #page-home.chat-mode .chat-container.inline-detail-mode .messages-area {
      flex: 0 0 calc((100vw - var(--sidebar-width) - var(--outline-rail-width)) / 2) !important;
      width: calc((100vw - var(--sidebar-width) - var(--outline-rail-width)) / 2) !important;
      min-width: 0 !important;
      max-width: none !important;
      overflow-y: auto;
      height: var(--outline-detail-max-height, auto);
      max-height: var(--outline-detail-max-height, 70vh);
      padding-right: 20px;
    }
    #page-home.chat-mode .chat-container.inline-detail-mode .chat-detail-panel {
      flex: 1 1 auto;
      width: auto;
      max-width: none;
      min-width: 0;
      margin-left: 0;
      height: var(--outline-detail-max-height, auto);
      max-height: var(--outline-detail-max-height, 70vh);
      /* 整体板块：无圆角、无阴影、无边框、无卡片背景 */
      border-radius: 0;
      box-shadow: none;
      border: none;
      background: transparent;
    }
    #page-home.chat-mode .chat-container.inline-detail-mode .chat-detail-panel .cdp-header {
      border-radius: 0;
    }
    /* 修改大纲 / 修改剧本：右侧编辑板块与剧情内容页一致（扁平整体，无卡片感） */
    #page-home.chat-mode .chat-container.inline-detail-mode .script-edit-panel {
      flex: 1 1 auto;
      width: auto;
      max-width: none;
      min-width: 0;
      min-height: 0;
      margin-left: 0;
      height: var(--outline-detail-max-height, auto);
      max-height: var(--outline-detail-max-height, 70vh);
      border-radius: 0;
      box-shadow: none;
      border: none;
      background: transparent;
      /* 与分隔线留出间距，与剧情内容页右侧内容一致；顶部留出间距避免头部贴页顶 */
      padding: 16px 16px 0;
    }
    #page-home.chat-mode .chat-container.inline-detail-mode .script-edit-header {
      border-radius: 0;
    }
    #page-home.chat-mode .chat-container.inline-detail-mode .script-edit-textarea {
      flex: 1;
      min-height: 0;
      resize: none;
    }
    .outline-edit-nav {
      margin: 0 0 12px;
      max-height: 88px;
      overflow-y: auto;
    }
    /* 右侧详情出现时的展开过渡动画 */
    #page-home.chat-mode .chat-container.inline-detail-mode .chat-detail-panel.show {
      animation: inlineDetailExpand 0.32s cubic-bezier(0.22, 1, 0.36, 1);
      will-change: clip-path, transform, opacity;
    }
    @keyframes inlineDetailExpand {
      from {
        clip-path: inset(0 0 0 100%);
        opacity: 0.15;
        transform: translateX(18px);
      }
      to {
        clip-path: inset(0 0 0 0%);
        opacity: 1;
        transform: translateX(0);
      }
    }
    /* 右侧详情收起过渡动画 */
    #page-home.chat-mode .chat-container.inline-detail-mode .chat-detail-panel.show.closing,
    #page-home.chat-mode .chat-container.inline-detail-mode .script-edit-panel.show.closing {
      animation: inlineDetailCollapse 0.28s ease-in forwards;
    }
    @keyframes inlineDetailCollapse {
      from {
        clip-path: inset(0 0 0 0%);
        opacity: 1;
        transform: translateX(0);
      }
      to {
        clip-path: inset(0 0 0 100%);
        opacity: 0.15;
        transform: translateX(18px);
      }
    }
    @media (prefers-reduced-motion: reduce) {
      #page-home.chat-mode .chat-container.inline-detail-mode .chat-detail-panel.show,
      #page-home.chat-mode .chat-container.inline-detail-mode .chat-detail-panel.show.closing {
        animation: none;
      }
    }
    .outline-overall {
      margin: 6px 0 10px;
      padding: 10px 12px;
      border-radius: 12px;
      background: rgba(0,163,255,.06);
      border: 1px solid rgba(0,163,255,.16);
      color: var(--text);
      font-size: 12px;
      line-height: 1.7;
      white-space: pre-wrap;
    }
    .chat-container.script-edit-mode {
      flex-direction: row;
      align-items: stretch;
      gap: 14px;
      max-width: 1180px;
    }
    .chat-container.script-edit-mode .messages-area {
      display: flex;
      flex: 0 0 auto;
      width: 190px;
      min-width: 80px;
      max-width: 260px;
      resize: horizontal;
      overflow: hidden;
      padding-right: 8px;
    }
    .chat-container.script-edit-mode .message {
      max-width: 100%;
    }
    .chat-container.script-edit-mode .message.ai {
      gap: 6px;
    }
    .chat-container.script-edit-mode .message.ai .message-head {
      width: 42px;
      flex-basis: 42px;
    }
    .chat-container.script-edit-mode .message.ai .role-name {
      display: none;
    }
    .chat-container.script-edit-mode .message.ai .message-body,
    .chat-container.script-edit-mode .message-text {
      font-size: 11px;
      line-height: 1.45;
    }

    /* Messages area */
    .messages-area {
      display: none;
      flex-direction: column;
      gap: 6px;
      padding: 16px 0;
      overflow: visible;
      flex: 0 0 auto;
      min-height: auto;
    }
    .messages-area.active { display: flex; }

    /* Individual message bubbles */
    .message {
      display: flex;
      flex-direction: column;
      max-width: 75%;
      padding: 10px 14px;
      border-radius: 16px;
      font-size: 13px;
      line-height: 1.6;
      animation: msgIn 0.25s ease;
    }
    @keyframes msgIn {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .message.ai {
      align-self: flex-start;
      max-width: 75%;
      background: transparent;
      border: none;
      border-radius: 0;
      padding: 4px 0;
    }
    .message.user {
      align-self: flex-end;
      background: #f1f5f9;
      color: #1f2937;
      border: 1px solid rgba(220, 227, 235, .9);
      border-radius: 16px 16px 4px 16px;
    }
    .message .msg-role {
      font-size: 10px;
      font-weight: 800;
      margin-bottom: 4px;
      opacity: 0.65;
    }
    .message.user .msg-role { text-align: right; }
    .message-text { white-space: pre-wrap; word-break: break-word; }
    .message-reference-summary {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 10px;
    }
    .message-reference-title {
      font-size: 11px;
      font-weight: 800;
      opacity: .85;
    }
    .message-reference-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
    }
    .message-reference-card {
      width: 92px;
      border: 1px solid rgba(203, 213, 225, .92);
      border-radius: 8px;
      background: rgba(255,255,255,.72);
      color: inherit;
      padding: 5px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      text-align: left;
      cursor: default;
      overflow: hidden;
    }
    button.message-reference-card {
      cursor: pointer;
    }
    .message-reference-card:hover {
      background: #fff;
    }
    .message-reference-thumb {
      width: 100%;
      aspect-ratio: 1 / 1;
      border-radius: 6px;
      overflow: hidden;
      background: rgba(15,23,42,.2);
      display: grid;
      place-items: center;
    }
    .message-reference-thumb img,
    .message-reference-thumb video {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
    }
    .message-reference-name {
      font-size: 11px;
      line-height: 1.25;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .message-reference-type {
      font-size: 10px;
      line-height: 1;
      opacity: .78;
    }

    /* Input area — fixed at bottom */
    .input-card {
      display: none;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 10px 14px;
      box-shadow: 0 4px 24px rgba(0,0,0,.08);
    }
    .input-card.active { display: block; }
    .input-card { position: relative; }
    .input-row { display: flex; align-items: stretch; gap: 10px; }
    /* @ 命令建议菜单 */
    .at-command-menu {
      position: absolute;
      left: 10px;
      bottom: calc(100% + 8px);
      width: 240px;
      max-width: calc(100vw - 24px);
      z-index: 130;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: 0 16px 40px rgba(15,23,42,.18);
      max-height: 320px;
      overflow-y: auto;
      display: none;
      transform: translateY(8px) scale(0.98);
      opacity: 0;
      transition: transform 0.16s ease, opacity 0.16s ease;
    }
    .at-command-menu.show {
      display: block;
      transform: translateY(0) scale(1);
      opacity: 1;
    }
    .at-menu-group-label {
      padding: 8px 14px 3px;
      font-size: 11px;
      font-weight: 800;
      color: var(--muted);
      letter-spacing: .5px;
    }
    .at-command-menu.show { display: block; }
    .at-command-item {
      display: flex;
      align-items: center;
      padding: 8px 14px;
      cursor: pointer;
      font-size: 13px;
      line-height: 1.4;
      color: var(--text);
      border-bottom: 1px solid rgba(220,227,235,.35);
    }
    .at-command-item:last-child { border-bottom: 0; }
    .at-command-item:hover,
    .at-command-item.active { background: var(--soft); }
    .at-command-item code {
      font-family: inherit;
      font-size: 13px;
      line-height: 1.4;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .at-command-menu[data-mode="at"] .at-command-item code {
      color: var(--accent);
    }
    .choice-panel {
      position: absolute;
      left: 10px;
      right: 10px;
      bottom: calc(100% + 8px);
      width: auto;
      z-index: 460;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 14px;
      box-shadow: 0 16px 40px rgba(15,23,42,.18);
      padding: 14px;
      display: none;
      max-height: 320px;
      overflow-y: auto;
      transform: translateY(8px) scale(0.98);
      opacity: 0;
      transition: transform 0.16s ease, opacity 0.16s ease;
    }
    .choice-panel.show {
      display: block;
      transform: translateY(0) scale(1);
      opacity: 1;
    }
    .choice-panel-title {
      font-size: 14px;
      font-weight: 900;
      color: var(--text);
      margin-bottom: 6px;
    }
    .choice-panel-message {
      font-size: 12.5px;
      color: var(--text);
      line-height: 1.6;
      opacity: .82;
    }
    .supplement-original {
      margin: 12px 0 2px;
      padding: 9px 11px;
      border-radius: 10px;
      background: var(--soft);
      color: var(--text);
      font-size: 12px;
      line-height: 1.55;
      word-break: break-word;
    }
    .supplement-options {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin: 14px 0 4px;
    }
    .supplement-option {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 3px;
      width: 100%;
      padding: 11px 14px;
      border-radius: 10px;
      border: 0;
      background: var(--soft);
      cursor: pointer;
      text-align: left;
      transition: .15s;
      font: inherit;
    }
    .supplement-option:hover {
      background: rgba(0,163,255,.08);
    }
    .supplement-option.primary {
      background: var(--accent);
    }
    .supplement-option.primary .supplement-option-label { color: #fff; }
    .supplement-option.primary .supplement-option-desc { color: rgba(255,255,255,.85); }
    .choice-panel-custom {
      margin-top: 12px;
      border-top: 1px solid var(--border);
      padding-top: 10px;
    }
    .choice-panel-custom-label {
      font-size: 11px;
      font-weight: 800;
      color: var(--muted);
      margin-bottom: 6px;
    }
    .choice-field {
      display: flex;
      flex-direction: column;
      gap: 5px;
      margin-top: 10px;
      font-size: 12px;
      font-weight: 800;
      color: var(--text);
    }
    .choice-field-inline {
      flex-direction: row;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .choice-field-input {
      margin-top: 0 !important;
    }
    .choice-field-input.compact {
      width: 88px;
      padding: 5px 8px;
      margin-top: 0 !important;
      border: none;
      border-bottom: 2px solid var(--accent);
      border-radius: 0;
      background: transparent;
      text-align: center;
      color: var(--text);
      font-size: 13px;
      font-weight: 800;
    }
    .choice-field-input.compact:focus {
      border-bottom-color: var(--accent-hover);
      box-shadow: none;
      outline: none;
    }
    .choice-panel-custom .choice-panel-input {
      margin-top: 0;
    }
    .choice-panel-input {
      width: 100%;
      margin-top: 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
      color: var(--text);
      padding: 10px 12px;
      font: inherit;
      font-size: 12px;
      line-height: 1.6;
      outline: none;
      resize: vertical;
      min-height: 72px;
      box-sizing: border-box;
    }
    .choice-panel-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(0,163,255,.14);
    }
    .choice-panel-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 12px;
    }
    .choice-panel-btn {
      min-width: 76px;
      height: 34px;
      border: 0;
      border-radius: 9px;
      background: var(--soft);
      color: var(--text);
      cursor: pointer;
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      transition: .15s;
    }
    .choice-panel-btn:hover {
      background: rgba(0,163,255,.1);
      color: var(--accent);
    }
    .choice-panel-btn.primary {
      background: var(--accent);
      color: #fff;
    }
    .choice-panel-btn.primary:hover {
      background: var(--accent-hover);
      color: #fff;
    }
    .supplement-option-label {
      font-size: 13px;
      font-weight: 800;
      color: var(--text);
    }
    .supplement-option-desc {
      font-size: 11px;
      color: var(--muted);
      line-height: 1.4;
    }
    #agentBtn {
      min-height: 30px;
      padding: 5px 8px;
      font-size: 10px;
      gap: 4px;
    }
    #agentBtn .ui-icon {
      width: 14px;
      height: 14px;
    }
    .composer-add-box {
      min-width: 72px;
      max-width: 330px;
      height: 76px;
      border: 1px dashed var(--border);
      border-radius: 10px;
      background: var(--soft);
      color: var(--accent);
      font: inherit;
      font-size: 24px;
      font-weight: 500;
      line-height: 1;
      display: flex;
      align-items: center;
      gap: 0;
      cursor: pointer;
      flex: 0 0 auto;
      overflow: visible;
      padding: 0;
      position: relative;
      scrollbar-width: none;
      transition: width .2s ease, background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
    }
    .composer-add-box::-webkit-scrollbar { display: none; }
    .composer-add-box img,
    .composer-add-box video {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
      transition: transform .18s ease;
    }
    .composer-add-box.has-media {
      border-style: solid;
      background: transparent;
      color: white;
      border-color: transparent;
      width: var(--stack-width, 72px);
    }
    .composer-add-box.has-media.show-add-next {
      width: var(--expanded-stack-width, 136px);
    }
    .composer-thumb,
    .composer-add-next {
      width: 56px;
      height: 56px;
      flex: 0 0 56px;
      overflow: hidden;
      border-radius: 10px;
      border: 1px solid rgba(220, 227, 235, .95);
      margin-left: var(--overlap, -38px);
      transform: translateX(var(--x, 0px)) translateY(var(--lift, 0px)) rotate(var(--angle, 0deg));
      transform-origin: 50% 92%;
      transition: transform .2s ease, margin-left .2s ease, box-shadow .2s ease, z-index .2s ease, opacity .18s ease;
      z-index: var(--z, 10);
      box-shadow: 0 8px 18px rgba(15,23,42,.14);
      position: relative;
    }
    .composer-thumb {
      background: #111;
    }
    .composer-thumb:first-child { margin-left: 0; }
    .composer-add-box.has-media:hover .composer-thumb {
      transform: translateX(var(--hover-x, 0px)) translateY(var(--hover-lift, 0px)) rotate(var(--hover-angle, 0deg));
    }
    .composer-add-box.has-media .composer-thumb:hover {
      transform: translateX(var(--hover-x, 0px)) translateY(-8px) rotate(0deg) scale(1.16);
      z-index: 120;
      box-shadow: 0 14px 30px rgba(15,23,42,.24);
    }
    .composer-thumb:hover img,
    .composer-thumb:hover video {
      transform: scale(1.08);
    }
    .composer-add-placeholder {
      display: grid;
      place-items: center;
      width: 100%;
      height: 100%;
    }
    .composer-add-remove {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 20px;
      height: 20px;
      border: none;
      border-radius: 999px;
      background: rgba(15, 23, 42, .82);
      color: white;
      cursor: pointer;
      display: grid;
      place-items: center;
      font: inherit;
      font-size: 13px;
      line-height: 1;
      padding: 0;
      opacity: 1;
      transition: opacity .16s ease, background .16s ease;
      z-index: 2;
    }
    .composer-add-remove:hover {
      background: #f04438;
    }
    .composer-add-more {
      position: absolute;
      right: 4px;
      bottom: 4px;
      width: 22px;
      height: 22px;
      border: 1px solid rgba(255,255,255,.72);
      border-radius: 999px;
      background: rgba(0, 163, 255, .92);
      color: #fff;
      display: grid;
      place-items: center;
      font: inherit;
      font-size: 14px;
      line-height: 1;
      padding: 0;
      cursor: pointer;
      z-index: 3;
      box-shadow: 0 2px 8px rgba(15,23,42,.18);
      transition: opacity .16s ease, transform .18s ease;
    }
    .composer-add-more:hover {
      background: var(--accent-hover);
    }
    .composer-add-box.show-add-next .composer-add-more {
      opacity: 0;
      pointer-events: none;
      transform: scale(.82);
    }
    .composer-add-next {
      border: 1px solid rgba(148, 163, 184, .9);
      background: #eef2f7;
      color: #64748b;
      display: grid;
      place-items: center;
      font: inherit;
      font-size: 24px;
      line-height: 1;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      padding: 0;
      transform: translateX(calc(var(--x, 0px) - 18px)) translateY(12px) rotate(var(--angle, 0deg)) scale(.36);
      transform-origin: 0% 100%;
    }
    .composer-add-box.show-add-next .composer-add-next {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(var(--hover-x, 0px)) translateY(var(--hover-lift, 0px)) rotate(var(--hover-angle, 0deg)) scale(1);
    }
    .composer-add-next:hover {
      background: #e2e8f0;
      color: #334155;
      z-index: 130;
    }
    .composer-add-box.drag-over {
      border-color: var(--accent);
    }
    .composer-add-box.drag-over {
      transform: translateY(-1px);
    }
    .composer-add-box.uploading {
      opacity: .7;
      pointer-events: none;
    }
    .input-area { flex: 1; }
    .input-area textarea {
      display: block;
      width: 100%;
      border: none;
      outline: none;
      resize: none;
      font: inherit;
      font-size: 13px;
      line-height: 1.5;
      text-align: left;
      vertical-align: top;
      background: transparent;
      color: var(--text);
      max-height: 120px;
      min-height: 24px;
    }
    #mainInput {
      text-align: left !important;
      vertical-align: top !important;
      line-height: 1.5;
      direction: ltr;
    }
    .main-input-editable {
      width: 100%;
      min-height: 20px;
      max-height: 160px;
      overflow-y: auto;
      outline: none;
      font: inherit;
      font-size: 13px;
      line-height: 1.5;
      color: var(--text);
      white-space: pre-wrap;
      word-break: break-word;
      background: transparent;
      border: none;
      padding: 0;
      text-align: left;
    }
    .main-input-editable:empty::before {
      content: attr(data-placeholder);
      color: var(--muted);
      pointer-events: none;
    }
    .input-chip {
      margin: 0 3px;
      cursor: default;
      user-select: none;
      vertical-align: baseline;
    }
    .input-chip-remove,
    .ref-chip-remove {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 15px;
      height: 15px;
      margin-left: 5px;
      border-radius: 50%;
      border: none;
      background: transparent;
      font-family: inherit;
      font-size: 15px;
      font-weight: 600;
      line-height: 0;
      color: inherit;
      opacity: .7;
      cursor: pointer;
      flex-shrink: 0;
      padding: 0;
      vertical-align: middle;
    }
    .input-chip-remove:hover,
    .ref-chip-remove:hover { opacity: 1; color: #f04438; background: rgba(240, 68, 56, .12); }
    /* 自定义悬浮提示（与网站风格一致） */
    .app-tooltip {
      position: fixed;
      z-index: 99999;
      display: none;
      max-width: 340px;
      padding: 8px 12px;
      border-radius: 10px;
      background: var(--panel);
      border: 1px solid var(--border);
      box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
      color: var(--text);
      font-size: 12px;
      line-height: 1.6;
      pointer-events: none;
      white-space: pre-wrap;
      word-break: break-all;
    }
    .app-tooltip.show { display: block; }
    .input-area textarea::placeholder { color: var(--muted); }
    .send-btn {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: none;
      background: var(--accent);
      color: white;
      font-size: 15px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background .2s;
      flex-shrink: 0;
    }
    .send-btn:hover { background: var(--accent-hover); }
    .send-btn:disabled { background: var(--muted); cursor: not-allowed; }

    .social-analysis-card {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .social-flow-steps {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .social-flow-step {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 4px 8px;
      border-radius: 999px;
      border: 1px solid var(--border);
      color: var(--muted);
      background: var(--soft);
      font-size: 11px;
      font-weight: 800;
    }
    .social-flow-step-done {
      color: var(--accent);
      border-color: rgba(0, 163, 255, .22);
      background: rgba(0, 163, 255, .08);
    }
    .social-flow-step-active {
      color: #fff;
      border-color: var(--accent);
      background: var(--accent);
    }
    .social-flow-panel {
      display: grid;
      gap: 10px;
      padding: 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
    }
    .social-flow-title {
      font-size: 13px;
      font-weight: 900;
      color: var(--text);
    }
    .social-flow-actions {
      margin-top: 2px;
    }
    .social-flow-mode-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
    .social-flow-mode {
      min-height: 64px;
      align-items: flex-start;
      flex-direction: column;
      text-align: left;
      white-space: normal;
      gap: 3px;
    }
    .social-flow-mode span {
      display: block;
      font-size: 11px;
      line-height: 1.45;
      color: inherit;
      opacity: .78;
      font-weight: 700;
    }
    .social-flow-meta {
      font-size: 12px;
      color: var(--muted);
      font-weight: 800;
    }
    .social-flow-details,
    .social-flow-advanced {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      padding: 10px;
    }
    .social-flow-details > summary,
    .social-flow-advanced > summary {
      cursor: pointer;
      color: var(--accent);
      font-size: 12px;
      font-weight: 900;
    }
    .social-flow-details > summary + *,
    .social-flow-advanced > summary + * {
      margin-top: 10px;
    }
    @media (max-width: 640px) {
      .social-flow-mode-grid { grid-template-columns: 1fr; }
    }
    .social-analysis-head {
      display: flex;
      gap: 12px;
      align-items: flex-start;
    }
    .social-analysis-cover {
      width: 96px;
      aspect-ratio: 9 / 16;
      border-radius: 10px;
      overflow: hidden;
      background: var(--soft);
      border: 1px solid var(--border);
      flex: 0 0 auto;
    }
    .social-analysis-cover img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .social-analysis-main {
      min-width: 0;
      flex: 1;
    }
    .social-analysis-kicker {
      font-size: 11px;
      font-weight: 900;
      color: var(--accent);
      margin-bottom: 4px;
    }
    .social-analysis-title {
      font-size: 15px;
      line-height: 1.45;
      font-weight: 900;
      color: var(--text);
    }
    .social-analysis-meta,
    .social-analysis-desc,
    .social-analysis-summary {
      margin-top: 6px;
      font-size: 12px;
      line-height: 1.65;
      color: var(--muted);
    }
    .social-analysis-status {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .social-analysis-status span {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 4px 8px;
      border-radius: 999px;
      background: rgba(0,163,255,.08);
      color: var(--accent);
      font-size: 11px;
      font-weight: 800;
    }
    .social-task-progress {
      display: grid;
      gap: 8px;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
    }
    .social-task-progress-head,
    .social-task-current-stage {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-width: 0;
      font-size: 11px;
      color: var(--muted);
      font-weight: 800;
    }
    .social-task-progress-head strong {
      color: var(--text);
      font-weight: 900;
    }
    .social-task-progress-track {
      height: 8px;
      border-radius: 999px;
      background: rgba(15, 23, 42, .08);
      overflow: hidden;
    }
    .social-task-progress-track span {
      display: block;
      height: 100%;
      min-width: 2px;
      border-radius: inherit;
      background: var(--accent);
    }
    .social-task-current-stage span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .social-task-event-log {
      display: grid;
      gap: 6px;
      margin: 0;
      padding: 0;
      list-style: none;
    }
    .social-task-event-log li {
      display: grid;
      gap: 2px;
      padding-top: 6px;
      border-top: 1px solid var(--border);
      font-size: 11px;
      line-height: 1.45;
      color: var(--muted);
    }
    .social-task-event-log strong {
      color: var(--text);
      font-weight: 900;
    }
    .social-task-event-log p {
      margin: 0;
      color: var(--muted);
      overflow-wrap: anywhere;
    }
    .social-canvas-summary {
      display: grid;
      gap: 8px;
    }
    .social-canvas-summary-counts,
    .social-canvas-node-types {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .social-canvas-summary-counts span,
    .social-canvas-node-types span {
      display: inline-flex;
      align-items: center;
      min-height: 22px;
      padding: 3px 8px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--soft);
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
    }
    .social-canvas-edges {
      display: grid;
      gap: 4px;
      margin: 0;
      padding: 0;
      list-style: none;
    }
    .social-canvas-edges li {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      gap: 6px;
      align-items: center;
      font-size: 11px;
      line-height: 1.35;
      color: var(--muted);
    }
    .social-canvas-edges span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .social-video-preview {
      display: grid;
      gap: 0;
      overflow: hidden;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
    }
    .social-video-preview-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 10px;
      font-size: 11px;
      font-weight: 900;
      color: var(--muted);
    }
    .social-video-preview-head span,
    .social-video-preview-head a {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .social-video-preview-head a {
      color: var(--accent);
      text-decoration: none;
    }
    .social-source-video {
      display: block;
      width: 100%;
      max-height: 360px;
      background: #0f172a;
    }
    .social-video-preview-meta {
      padding: 8px 10px;
      border-top: 1px solid var(--border);
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
    }
    .social-shot-timeline {
      display: grid;
      gap: 10px;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
    }
    .social-shot-timeline-head,
    .social-shot-timeline-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-width: 0;
    }
    .social-shot-timeline-head {
      color: var(--muted);
      font-size: 11px;
      font-weight: 900;
    }
    .social-shot-timeline-head strong {
      color: var(--text);
      font-weight: 900;
    }
    .social-shot-timeline-list {
      display: grid;
      gap: 10px;
      margin: 0;
      padding: 0;
      list-style: none;
    }
    .social-shot-timeline-list li {
      display: grid;
      grid-template-columns: 28px minmax(0, 1fr);
      gap: 8px;
      min-width: 0;
    }
    .social-shot-timeline-marker {
      position: relative;
      display: flex;
      justify-content: center;
    }
    .social-shot-timeline-marker::after {
      content: "";
      position: absolute;
      top: 28px;
      bottom: -10px;
      width: 1px;
      background: var(--border);
    }
    .social-shot-timeline-list li:last-child .social-shot-timeline-marker::after {
      display: none;
    }
    .social-shot-timeline-marker span {
      position: relative;
      z-index: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 999px;
      background: var(--accent);
      color: #fff;
      font-size: 11px;
      font-weight: 900;
    }
    .social-shot-timeline-body {
      display: grid;
      gap: 5px;
      min-width: 0;
      padding: 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--soft);
    }
    .social-shot-timeline-row strong,
    .social-shot-timeline-row span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .social-shot-timeline-row strong {
      color: var(--text);
      font-size: 12px;
      font-weight: 900;
    }
    .social-shot-timeline-row span {
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
    }
    .social-shot-timeline-body p,
    .social-shot-timeline-voice {
      margin: 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.55;
      overflow-wrap: anywhere;
    }
    .social-shot-timeline-voice {
      padding-top: 5px;
      border-top: 1px solid var(--border);
      color: var(--text);
    }
    .social-analysis-warning {
      padding: 9px 10px;
      border-radius: 10px;
      background: rgba(245, 158, 11, .1);
      color: #b45309;
      font-size: 12px;
      line-height: 1.55;
    }
    .social-analysis-warning p + p {
      margin-top: 4px;
    }
    .social-analysis-section {
      border-top: 1px solid var(--border);
      padding-top: 10px;
    }
    .social-analysis-section-title {
      font-size: 12px;
      font-weight: 900;
      margin-bottom: 6px;
    }
    .social-analysis-section ol {
      padding-left: 18px;
      font-size: 12px;
      line-height: 1.7;
      color: var(--text);
    }
    .social-analysis-section li + li {
      margin-top: 4px;
    }
    .social-transcript-input {
      width: 100%;
      min-height: 92px;
      resize: vertical;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      color: var(--text);
      padding: 9px 10px;
      font: inherit;
      font-size: 12px;
      line-height: 1.6;
      outline: none;
    }
    .social-transcript-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(0, 163, 255, .12);
    }
    .social-transcript-segments {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 8px;
    }
    .social-transcript-segment {
      display: grid;
      gap: 6px;
      padding: 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--soft);
    }
    .social-transcript-segment-meta,
    .social-transcript-segment-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      color: var(--muted);
    }
    .social-transcript-segment-meta > span {
      font-weight: 900;
      color: var(--text);
      margin-right: 2px;
    }
    .social-transcript-segment-meta label {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-weight: 700;
    }
    .social-transcript-time {
      width: 68px;
      min-height: 28px;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: var(--panel);
      color: var(--text);
      padding: 3px 6px;
      font: inherit;
      font-size: 11px;
    }
    .social-transcript-segment-text {
      min-height: 64px;
    }
    .social-transcript-rewrite-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 8px;
    }
    .social-analysis-options {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 12px;
      margin-top: 8px;
      font-size: 12px;
      color: var(--muted);
    }
    .social-analysis-options label {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-weight: 700;
    }
    .social-recreate-settings-panel {
      display: grid;
      gap: 8px;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
    }
    .social-recreate-settings-panel .social-analysis-section-title {
      margin-bottom: 0;
    }
    .social-recreate-settings-actions {
      display: grid;
      gap: 8px;
      padding-top: 8px;
      border-top: 1px solid var(--border);
    }
    .social-recreate-settings-action-title {
      color: var(--muted);
      font-size: 11px;
      font-weight: 900;
    }
    .social-recreate-settings-action-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      min-width: 0;
    }
    .social-analysis-muted {
      color: var(--muted);
      font-size: 12px;
    }

    .social-recreate-detail > summary {
      cursor: pointer;
      font-weight: 700;
      color: var(--text);
      list-style-position: inside;
    }

    .social-recreate-detail[open] > summary {
      margin-bottom: 10px;
    }

    /* Chat mode transitions */
    #page-home.chat-mode .home-logo,
    #page-home.chat-mode .home-title,
    #page-home.chat-mode .home-subtitle,
    #page-home.chat-mode .quick-enter { display: none; }
    #page-home.chat-mode .home-content { align-items: center; max-width: 1100px; transform: none; }
    #page-home.chat-mode .chat-container { display: flex; }
    #page-home.chat-mode .input-card { display: block; }

    .input-card {
      width: 100%;
      max-width: 720px;
      background: var(--panel);
      border-radius: 24px;
      box-shadow: var(--shadow-lg);
      padding: 18px 22px;
      border: 1px solid rgba(228,229,231,0.6);
    }

    .dropdown { position: relative; display: inline-block; }
    .dropdown-content {
      display: none;
      position: absolute;
      bottom: 100%;
      left: 0;
      margin-bottom: 8px;
      background: white;
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: var(--shadow-lg);
      z-index: 300;
      padding: 8px;
      flex-direction: row;
      flex-wrap: wrap;
      gap: 4px;
    }
    .dropdown-content.show { display: flex; }
    .dropdown-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-radius: 12px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 700;
      color: var(--text);
      flex: 1;
      min-width: 130px;
    }
    .dropdown-item:hover { background: var(--soft); }
    .dropdown-item.selected { color: var(--accent); background: rgba(0,163,255,.06); }
    .dropdown-item .check { margin-left: auto; }

    .ref-panel {
      display: none;
      position: static;
      background: white;
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: var(--shadow-lg);
      width: 100%;
      max-height: 360px;
      overflow-y: auto;
      padding: 8px;
    }
    .ref-panel.show { display: block; }
    .ref-panel-host {
      display: none;
      position: absolute;
      bottom: calc(100% + 8px);
      left: 0;
      z-index: 990;
      width: 380px;
      max-width: calc(100vw - 16px);
      box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    }
    .ref-panel-host.show {
      display: block;
    }
    .ref-label { font-size: 11px; color: var(--muted); padding: 4px 8px; font-weight: 700; }
    .ref-section + .ref-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
    .ref-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; color: var(--text); }
    .ref-item:hover { background: var(--soft); }
    .ref-item img,
    .ref-item video { width: 60px; height: 40px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #111; }
    .ref-item .ref-thumb-btn {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      cursor: zoom-in;
      line-height: 0;
      flex-shrink: 0;
    }
    .ref-item-main { min-width: 0; flex: 1; }
    .ref-item-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ref-item-meta { margin-top: 2px; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ref-item-sub { margin-left: 16px; }
    .ref-item-sub.ref-shot { margin-left: 32px; }
    .ref-back {
      width: auto;
      border: 1px solid var(--border);
      background: var(--soft);
      color: var(--text);
      border-radius: 8px;
      padding: 6px 12px;
      margin: 0 0 8px;
      text-align: left;
      font: inherit;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
    }
    .ref-back:hover { color: var(--accent); }
    .ref-empty { padding: 12px; text-align: center; color: var(--muted); font-size: 12px; }
    .ref-project-empty {
      padding: 18px 12px 14px;
      text-align: center;
      color: var(--muted);
      font-size: 12px;
    }
    .ref-empty-icon {
      font-size: 32px;
      line-height: 1;
      margin-bottom: 8px;
    }
    .ref-empty-title {
      color: var(--text);
      font-weight: 900;
      font-size: 13px;
      margin-bottom: 4px;
    }
    .ref-empty-meta {
      display: flex;
      justify-content: center;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
    }
    .ref-empty-meta span {
      padding: 4px 8px;
      border-radius: 999px;
      background: var(--soft);
      color: var(--muted);
      font-size: 10px;
      font-weight: 800;
    }
    .ref-empty-actions {
      display: flex;
      justify-content: center;
      gap: 8px;
      margin-top: 12px;
      flex-wrap: wrap;
    }
    .input-ref-chips {
      display: none;
      flex-wrap: wrap;
      gap: 6px;
      padding: 0 2px 8px;
    }
    .input-ref-chips.show { display: flex; }
    .input-inline-chip {
      display: none;
      align-self: flex-start;
      margin-bottom: 6px;
    }
    .input-inline-chip.show { display: inline-flex; }
    .input-inline-chip .ref-chip { cursor: default; }
    .ref-chip-row {
      display: none;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }
    .ref-chip-row.show { display: flex; }
    /* 胶囊统一基础样式（上方引用胶囊与输入框内胶囊保持一致，紧凑尺寸） */
    .ref-chip,
    .input-chip {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      max-width: 100%;
      padding: 7px 12px;
      border-radius: 999px;
      border: none;
      background: var(--soft);
      color: var(--text);
      font-size: 11px;
      font-weight: 600;
      line-height: 1.6;
      box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
      white-space: nowrap;
    }
    .ref-chip { cursor: default; }
    .ref-chip.has-thumb {
      padding: 4px 8px 4px 4px;
      border-radius: 12px;
      max-width: 280px;
    }
    .ref-chip-thumb {
      width: 42px;
      height: 30px;
      border-radius: 8px;
      overflow: hidden;
      background: #111;
      flex-shrink: 0;
      border: 1px solid rgba(0,0,0,.06);
    }
    .ref-chip-thumb img,
    .ref-chip-thumb video {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
    }
    .ref-chip-thumb img { cursor: zoom-in; }
    .ref-chip-type {
      color: var(--accent);
      font-weight: 800;
    }
    .ref-chip-text {
      max-width: 220px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .local-ref-row {
      display: none;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 10px;
    }
    .local-ref-row.show { display: flex; }
    .local-ref-card {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      max-width: min(100%, 360px);
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 16px;
      background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
    }
    .local-ref-card img,
    .local-ref-card video {
      width: 54px;
      height: 54px;
      border-radius: 12px;
      object-fit: cover;
      flex-shrink: 0;
      border: 1px solid rgba(0,0,0,.06);
      background: #eef4fa;
    }
    .local-ref-main {
      min-width: 0;
      flex: 1;
    }
    .local-ref-name {
      font-size: 12px;
      font-weight: 800;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .local-ref-meta {
      margin-top: 3px;
      font-size: 10px;
      color: var(--muted);
      line-height: 1.4;
    }
    .local-ref-actions {
      display: flex;
      flex-direction: column;
      gap: 6px;
      flex-shrink: 0;
    }
    .local-ref-btn {
      border: 1px solid var(--border);
      background: white;
      color: var(--text);
      border-radius: 999px;
      padding: 5px 9px;
      font: inherit;
      font-size: 10px;
      font-weight: 800;
      cursor: pointer;
      white-space: nowrap;
    }
    .local-ref-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
    }
    .local-ref-btn.primary {
      background: rgba(0,163,255,.1);
      border-color: rgba(0,163,255,.24);
      color: var(--accent);
    }
    .tool-btn.uploading {
      opacity: .7;
      pointer-events: none;
    }

    .select-panel {
      display: none;
      position: absolute;
      bottom: 100%;
      right: 0;
      margin-bottom: 8px;
      background: white;
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: var(--shadow-lg);
      z-index: 350;
      min-width: 200px;
      padding: 12px;
      flex-direction: column;
    }
    .select-panel.show { display: flex; flex-direction: column; }
    #videoCreationMenu {
      left: 0;
      right: auto;
    }
    .select-title { font-size: 12px; font-weight: 800; margin-bottom: 10px; color: var(--muted); }
    .select-options { display: flex; flex-direction: column; gap: 6px; }
    .select-opt {
      padding: 6px 12px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: var(--soft);
      font: inherit;
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      transition: .2s;
      text-align: left;
    }
    .select-opt:hover { border-color: var(--accent); }
    .select-opt.selected { border-color: var(--accent); background: rgba(0,163,255,.1); color: var(--accent); }
    .video-creation-panel { min-width: 180px; }
    .model-option {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      text-align: left;
      padding: 8px 10px;
      border-radius: 12px;
    }
    .model-option.selected::after {
      content: none;
    }
    .model-option-icon {
      width: 30px;
      height: 30px;
      flex: 0 0 30px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 9px;
      background: linear-gradient(135deg, #0f172a, #2563eb 58%, #34d399);
      color: #fff;
    }
    .model-logo-icon {
      width: 15px;
      height: 15px;
      fill: currentColor;
    }
    .model-option-main {
      display: flex;
      flex-direction: column;
      gap: 1px;
      min-width: 0;
    }
    .model-option-name {
      font-size: 12px;
      font-weight: 800;
      color: var(--text);
      line-height: 1.3;
    }
    .model-option-intro {
      font-size: 10.5px;
      font-weight: 400;
      color: var(--muted);
      line-height: 1.3;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* 模型下拉更宽：一行完整展示模型名称与介绍 */
    #textModelMenu, #imgModelMenu, #videoModelMenu { min-width: 580px; }
    .video-creation-options { flex-direction: column; }
    .video-creation-options .select-opt { width: 100%; text-align: left; white-space: nowrap; }

    #page-home.chat-mode .home-logo,
    #page-home.chat-mode .home-title,
    #page-home.chat-mode .home-subtitle { display: none; }
    #page-home.chat-mode .home-content { align-items: center; transform: none; }
    #page-home.chat-mode .chat-container { order: 1; }
    #page-home.chat-mode .input-card { order: 2; max-width: 900px; margin-top: 12px; }
    #page-home.chat-mode .messages-area { flex: 1; }
    #page-home.chat-mode .messages-area.active { display: flex; }
    #page-home.chat-mode {
      justify-content: flex-start;
      align-items: center;
      padding: 20px var(--sidebar-page-right) 20px var(--sidebar-page-left);
    }
    #page-home.chat-mode .home-content {
      width: 100%;
      max-width: 1100px;
      min-height: calc(100vh - 40px);
      height: auto;
      padding-bottom: 150px;
      transform: none;
    }
    #page-home.chat-mode .chat-container {
      width: 100%;
      max-width: 1100px;
      height: auto;
      flex: 0 0 auto;
      min-height: auto;
      padding: 0;
    }
    #page-home.chat-mode .input-card {
      position: fixed;
      left: var(--sidebar-page-left);
      right: var(--sidebar-page-right);
      bottom: 20px;
      z-index: 180;
      width: auto;
      max-width: 900px;
      margin: 0 auto;
      flex-shrink: 0;
    }

    #page-home.chat-mode.script-edit-active .input-card {
      display: none !important;
    }
    #page-home.chat-mode .message { max-width: 75%; }
    #page-home.chat-mode .messages-area {
      overflow: visible;
      flex: 0 0 auto;
      min-height: auto;
    }
    #page-home.chat-mode.script-edit-active .chat-container {
      flex-direction: row;
      align-items: stretch;
      max-width: 1180px;
    }
    #page-home.chat-mode.script-edit-active.video-prompt-editing .chat-container {
      max-width: 920px;
      justify-content: center;
    }
    #page-home.chat-mode.script-edit-active .messages-area {
      flex: 0 0 auto;
      width: 240px;
      min-width: 180px;
      max-width: 320px;
      overflow: hidden;
      resize: horizontal;
      padding-right: 12px;
    }
    #page-home.chat-mode.script-edit-active.video-prompt-editing .messages-area {
      display: none !important;
    }
    #page-home.chat-mode.script-edit-active .message {
      max-width: 100%;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message {
      align-self: stretch;
      padding: 10px 12px;
      background: rgba(255,255,255,.72);
      color: var(--text);
      border-radius: 12px;
      overflow: visible;
      border: 1px solid rgba(228,229,231,.85);
    }
    /* 左侧对话流完整显示（修改剧本 / 修改大纲统一，不做简略截断） */
    #page-home.chat-mode.script-edit-active .messages-area .message-text {
      display: block;
      overflow: visible;
      white-space: pre-wrap;
      font-size: 13px;
      line-height: 1.7;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message-body > :not(:first-child):not(.message-actions),
    #page-home.chat-mode.script-edit-active .messages-area .message-body > pre,
    #page-home.chat-mode.script-edit-active .messages-area .style-grid,
    #page-home.chat-mode.script-edit-active .messages-area .custom-style-panel {
      display: block !important;
    }
    /* 编辑器左栏：AI 消息改为上下排列（头像行在上、正文在下），避免 head 占满行宽把正文挤成细条 */
    #page-home.chat-mode.script-edit-active .messages-area .message.ai {
      flex-direction: column;
      align-items: stretch;
      gap: 0;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message.ai .message-head {
      width: 100%;
      flex-basis: auto;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;
      gap: 6px;
      margin: 0 0 6px;
      text-align: left;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message.ai .role-name {
      display: block;
      font-size: 12px;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message-body {
      width: 100%;
      font-size: 13px;
      line-height: 1.7;
      overflow: visible;
      padding-top: 0;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message-body > :first-child {
      display: block;
      overflow: visible;
      margin-top: 0 !important;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message-actions {
      display: flex !important;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 8px;
    }
    #page-home.chat-mode.script-edit-active .messages-area .message-actions .action-btn {
      display: inline-flex !important;
      width: auto;
      min-width: 0;
      padding: 6px 12px;
      font-size: 12px;
    }
    /* 宽度差异：修改剧本左栏 50%，修改大纲左栏更宽 */
    #page-home.chat-mode.script-edit-active.outline-edit-active:not(.video-prompt-editing) .messages-area {
      flex: 1 1 58% !important;
      width: 58% !important;
      max-width: 58% !important;
    }
    #page-home.chat-mode.script-edit-active.outline-edit-active:not(.video-prompt-editing) .script-edit-panel {
      flex: 1 1 42% !important;
      width: 42%;
    }
    #page-home.chat-mode.script-edit-active.video-prompt-editing .script-edit-panel {
      max-width: 920px;
      min-height: calc(100vh - 140px);
      background: rgba(255,255,255,.76);
      border: 1px solid rgba(228,229,231,.9);
      border-radius: 20px;
      padding: 18px;
      box-shadow: 0 12px 36px rgba(15, 23, 42, .08);
    }
    #page-home.chat-mode.script-edit-active.video-prompt-editing .script-edit-header {
      margin-bottom: 14px;
    }
    #page-home.chat-mode.script-edit-active.video-prompt-editing #scriptEditMeta {
      max-width: 100%;
    }
    #page-home.chat-mode.script-edit-active.video-prompt-editing .script-edit-textarea {
      min-height: calc(100vh - 250px);
      border-radius: 14px;
      box-shadow: none;
    }
    @media (max-width: 820px) {
      #page-home.chat-mode { padding-left: calc(var(--sidebar-width) + 10px); padding-right: 16px; }
      #page-home.chat-mode .home-content,
      #page-home.chat-mode .chat-container,
      #page-home.chat-mode .input-card { max-width: 100%; }
      #page-home.chat-mode .input-card {
        left: calc(var(--sidebar-width) + 10px);
        right: 16px;
        bottom: 16px;
      }
    }
    .asset-section { margin-top: 8px; }
    .asset-label { font-size: 10px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
    .asset-tags { display: flex; flex-wrap: wrap; gap: 4px; }
    .asset-tag { padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; color: white; }
    .asset-tag.char { background: linear-gradient(135deg, #667eea, #764ba2); }
    .asset-tag.scene { background: linear-gradient(135deg, #4facfe, #00f2fe); }
    .asset-tag.prop { background: linear-gradient(135deg, #f093fb, #f5576c); }
    .asset-tag.costume { background: linear-gradient(135deg, #d97706, #14b8a6); }
    .asset-tag.style { background: linear-gradient(135deg, #43e97b, #38f9d7); }
    .asset-workbench {
      margin-top: 12px;
      display: grid;
      grid-template-columns: 230px minmax(0, 1fr);
      gap: 12px;
      width: min(100%, 860px);
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--panel);
      overflow: hidden;
    }
    .asset-workbench-summary {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 8px;
      padding: 10px 10px 0;
      background: var(--panel);
    }
    .asset-workbench-count {
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px;
      background: var(--soft);
      min-width: 0;
    }
    .asset-workbench-count strong {
      display: block;
      color: var(--text);
      font-size: 16px;
      line-height: 1;
    }
    .asset-workbench-count span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 10px;
      font-weight: 800;
    }
    .asset-workbench-list {
      border-right: 1px solid var(--border);
      background: var(--soft);
      padding: 10px;
      max-height: 460px;
      overflow: auto;
    }
    .asset-workbench-group + .asset-workbench-group { margin-top: 12px; }
    .asset-workbench-group-title {
      font-size: 11px;
      font-weight: 900;
      color: var(--muted);
      margin-bottom: 6px;
    }
    .asset-workbench-item {
      width: 100%;
      display: flex;
      align-items: center;
      gap: 8px;
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      color: var(--text);
      padding: 8px;
      text-align: left;
      cursor: pointer;
      transition: .18s;
    }
    .asset-workbench-item:hover,
    .asset-workbench-item.active {
      border-color: var(--accent);
      background: rgba(0, 163, 255, .08);
    }
    .asset-workbench-dot {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      flex-shrink: 0;
      background: var(--accent);
    }
    .asset-workbench-dot.character { background: #667eea; }
    .asset-workbench-dot.scene { background: #00a3ff; }
    .asset-workbench-dot.prop { background: #f5576c; }
    .asset-workbench-dot.costume { background: #d97706; }
    .asset-workbench-name {
      min-width: 0;
      font-size: 12px;
      font-weight: 800;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .asset-workbench-state {
      margin-left: auto;
      font-size: 10px;
      color: var(--muted);
      flex-shrink: 0;
    }
    .asset-workbench-detail {
      min-width: 0;
      padding: 12px;
      max-height: 460px;
      overflow: auto;
    }
    .asset-detail-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }
    .asset-detail-title { font-size: 15px; font-weight: 900; color: var(--text); }
    .asset-detail-meta { margin-top: 3px; font-size: 11px; color: var(--muted); }
    .asset-prompt-box {
      width: 100%;
      min-height: 130px;
      resize: vertical;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
      color: var(--text);
      padding: 10px;
      font: inherit;
      font-size: 12px;
      line-height: 1.6;
      outline: none;
    }
    .asset-prompt-box:focus { border-color: var(--accent); }
    .asset-image-preview {
      margin-top: 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
      min-height: 180px;
      max-height: 240px;
      padding: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }
    .asset-image-preview img {
      display: block;
      width: 100%;
      height: 100%;
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      cursor: zoom-in;
    }
    .asset-image-empty {
      padding: 30px 16px;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
    }
    @media (max-width: 820px) {
      .asset-workbench { grid-template-columns: 1fr; }
      .asset-workbench-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .asset-workbench-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 220px; }
    }
    #page-assets {
      padding: 20px var(--sidebar-page-right) 20px var(--sidebar-page-left);
      align-items: stretch;
      justify-content: center;
    }
    .assets-shell {
      width: 100%;
      max-width: none;
      height: calc(100vh - 40px);
      display: block;
      overflow-y: auto;
    }
    .assets-shell.folder-mode {
      max-width: 100%;
    }
    .assets-shell.content-mode {
      max-width: none;
      overflow-y: auto;
    }
    .assets-shell.content-mode .assets-page-header {
      border-bottom: none;
      background: transparent;
      padding: 0 0 12px;
    }
    .assets-shell.content-mode .assets-tabs {
      padding: 14px 0 0;
    }
    .assets-shell.content-mode .library-panel {
      padding: 14px 0 0;
    }
    .assets-shell.folder-mode .assets-page-header {
      border-bottom: none;
      background: transparent;
      padding: 0 0 12px;
    }
    .assets-shell.folder-mode #projectListPanel {
      padding: 0 !important;
    }
    .assets-column {
      display: flex;
      flex-direction: column;
      gap: 16px;
      min-height: 100%;
    }
    .assets-list-block,
    .assets-detail-block {
      background: transparent;
      border: none;
      border-radius: 0;
      box-shadow: none;
      min-height: 0;
    }
    .assets-list-block {
      display: flex;
      flex-direction: column;
      overflow: visible;
    }
    .assets-detail-block {
      padding: 18px 20px 20px;
    }
    .assets-page-header {
      padding: 18px 18px 12px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, rgba(0,163,255,.06), rgba(0,163,255,0));
    }
    .library-nav {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 12px;
      min-height: 38px;
    }
    .library-nav-back {
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--text);
      border-radius: 999px;
      padding: 7px 12px;
      font: inherit;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      transition: .2s ease;
      flex-shrink: 0;
    }
    .library-nav-back:hover {
      border-color: rgba(0,163,255,.24);
      color: var(--accent);
    }
    .library-nav-text {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .library-nav-title {
      font-size: 12px;
      font-weight: 800;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-nav-path {
      font-size: 10px;
      color: var(--muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, rgba(0,163,255,.05), rgba(0,163,255,0));
    }
    .library-title { font-size: 13px; font-weight: 900; }
    .assets-header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .assets-upload-btn {
      border: none;
      background: var(--accent, #00a3ff);
      color: #fff;
      border-radius: 999px;
      padding: 7px 14px;
      font: inherit;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      transition: .2s ease;
      flex-shrink: 0;
    }
    .assets-upload-btn:hover {
      filter: brightness(1.08);
      box-shadow: 0 4px 12px rgba(0,163,255,.28);
    }
    .library-subtitle { font-size: 11px; color: var(--muted); margin-top: 2px; }
    .assets-tabs {
      display: flex;
      gap: 8px;
      padding: 14px 18px 0;
    }
    .assets-tab {
      border: 1px solid var(--border);
      background: var(--soft);
      color: var(--muted);
      border-radius: 999px;
      padding: 8px 12px;
      font: inherit;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      transition: .2s;
    }
    .assets-tab.active {
      border-color: rgba(0,163,255,.28);
      background: rgba(0,163,255,.12);
      color: var(--accent);
    }
    .library-panel {
      overflow-y: auto;
      padding: 14px 16px 16px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-height: 0;
      background: transparent;
    }
    .library-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
      background: transparent;
      border: none;
    }
    .library-group + .library-group { margin-top: 12px; }
    .library-group-title {
      font-size: 11px;
      font-weight: 900;
      color: var(--muted);
      letter-spacing: .04em;
      background: transparent;
    }
    .library-list { display: flex; flex-direction: column; gap: 10px; background: transparent; }
    .library-list.media-grid {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 10px;
      align-items: start;
    }
    .library-list.text-grid {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 10px;
      align-items: start;
    }
    .library-list.text-grid .library-empty {
      grid-column: 1 / -1;
    }
    .library-list.media-grid .library-empty {
      grid-column: 1 / -1;
    }
    .library-empty {
      padding: 12px;
      border-radius: 14px;
      background: transparent;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
    }
    .library-item {
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 12px;
      background: rgba(255,255,255,.9);
      cursor: pointer;
      transition: .2s ease;
      min-height: 244px;
      box-shadow: none;
    }
    .library-item:hover { border-color: rgba(0,163,255,.24); transform: translateY(-1px); }
    .library-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(0,163,255,.12); }
    .library-item.media-card {
      padding: 8px;
      border-radius: 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      height: 100%;
    }
    .library-item-head {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 4px;
      margin-bottom: 0;
    }
    .library-item.media-card .library-item-head {
      gap: 4px;
    }
    .library-item-name { font-size: 12px; font-weight: 800; color: var(--text); }
    .library-item-name-row {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
    }
    .library-item-name-row .library-item-name {
      flex: 1;
      min-width: 0;
    }
    .library-source-badge {
      flex: 0 0 auto;
      padding: 3px 7px;
      border-radius: 999px;
      background: #f1f5f9;
      color: #64748b;
      border: 1px solid rgba(203, 213, 225, .85);
      font-size: 10px;
      font-weight: 900;
      line-height: 1;
      white-space: nowrap;
    }
    .library-source-badge.canvas {
      background: rgba(56, 189, 248, .12);
      color: #0284c7;
      border-color: rgba(56, 189, 248, .28);
    }
    .library-item-time { font-size: 10px; color: var(--muted); white-space: nowrap; }
    .library-item-meta { font-size: 11px; color: var(--muted); margin-bottom: 0; }
    .library-item.media-card .library-item-name {
      font-size: 13px;
      line-height: 1.4;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-item.media-card .library-item-time {
      font-size: 10px;
      line-height: 1.35;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-item.media-card .library-item-meta {
      font-size: 11px;
      line-height: 1.45;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-item-body {
      font-size: 12px;
      color: var(--text);
      line-height: 1.6;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .library-item-body.clamp {
      display: -webkit-box;
      -webkit-line-clamp: 4;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .library-item.media-card .library-item-body {
      font-size: 10px;
      line-height: 1.45;
    }
    .library-item.media-card .library-item-body.clamp {
      -webkit-line-clamp: 2;
    }
    .library-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }
    .library-item.media-card .library-actions {
      gap: 6px;
      margin-top: 0;
    }
    .library-item.media-card .library-actions .action-btn {
      width: 100%;
      justify-content: center;
      padding: 7px 8px;
      font-size: 10px;
    }
    .library-thumb {
      width: 100%;
      border-radius: 12px;
      overflow: hidden;
      background: var(--soft);
    }
    .library-item.media-card .library-thumb {
      aspect-ratio: 1 / 1;
      border-radius: 12px;
    }
    .library-thumb img,
    .library-thumb video {
      width: 100%;
      display: block;
      max-height: 220px;
      object-fit: cover;
    }
    .library-item.media-card .library-thumb img,
    .library-item.media-card .library-thumb video {
      height: 100%;
      max-height: none;
    }
    .library-item.text-card {
      padding: 10px;
      border-radius: 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-height: 0;
      height: 100%;
    }
    .library-item.text-card .library-item-head {
      gap: 4px;
    }
    .library-item.text-card .library-item-name {
      font-size: 13px;
      line-height: 1.4;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-item.text-card .library-item-time {
      font-size: 10px;
      line-height: 1.35;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-item.text-card .library-item-meta {
      font-size: 11px;
      line-height: 1.45;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .library-item.text-card .library-item-body {
      font-size: 10px;
      line-height: 1.5;
      color: var(--muted);
    }
    .library-item.text-card .library-item-body.clamp {
      -webkit-line-clamp: 4;
    }
    .library-item.text-card .library-actions {
      gap: 6px;
      margin-top: auto;
    }
    .library-item.text-card .library-actions .action-btn {
      width: 100%;
      justify-content: center;
      padding: 7px 8px;
      font-size: 10px;
    }
    .library-text-card-thumb {
      aspect-ratio: 1 / 1;
      border-radius: 12px;
      border: 1px solid rgba(0,163,255,.08);
      background: linear-gradient(180deg, rgba(0,163,255,.12), rgba(255,255,255,.95));
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 10px;
      text-align: center;
    }
    .library-text-card-thumb.with-image {
      padding: 0;
      overflow: hidden;
      background: var(--soft);
    }
    .library-text-card-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .library-video-thumb {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: linear-gradient(180deg, rgba(15, 23, 42, .72), rgba(15, 23, 42, .9));
      color: #fff;
      text-align: center;
      padding: 12px;
    }
    .library-video-thumb-icon {
      width: 38px;
      height: 38px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: rgba(255,255,255,.14);
      font-size: 16px;
      font-weight: 800;
    }
    .library-video-thumb-label {
      font-size: 11px;
      line-height: 1.4;
      color: rgba(255,255,255,.9);
    }
    .library-text-card-icon {
      font-size: 24px;
      line-height: 1;
      margin-bottom: 6px;
      display: block;
    }
    .library-text-card-label {
      font-size: 11px;
      font-weight: 800;
      color: var(--accent);
      line-height: 1.35;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      word-break: break-word;
    }
    .chapter-directory {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 10px;
    }
    .chapter-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 10px 12px;
      border-radius: 12px;
      background: var(--soft);
      cursor: pointer;
    }
    .chapter-row:hover { background: rgba(0,163,255,.08); }
    .chapter-row.active {
      background: rgba(0,163,255,.12);
      box-shadow: 0 0 0 1px rgba(0,163,255,.12);
    }
    .chapter-name { font-size: 12px; font-weight: 700; color: var(--text); }
    .chapter-desc { font-size: 10px; color: var(--muted); margin-top: 2px; }
    .chapter-plus {
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--accent);
      border-radius: 999px;
      padding: 6px 10px;
      font: inherit;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      flex-shrink: 0;
    }
    .chapter-plus:hover { border-color: var(--accent); }
    .shot-directory {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 10px;
    }
    .shot-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: rgba(255,255,255,.7);
      cursor: pointer;
      transition: .2s ease;
    }
    .shot-row:hover { border-color: rgba(0,163,255,.24); background: rgba(0,163,255,.04); }
    .shot-row.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(0,163,255,.12); }
    .shot-name { font-size: 12px; font-weight: 800; color: var(--text); }
    .shot-desc { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
    .library-folder-note {
      margin-top: 8px;
      font-size: 11px;
      color: var(--muted);
      line-height: 1.6;
    }
    .project-folder-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
      gap: 18px 16px;
      margin-top: 14px;
    }
    .project-folder-tabs {
      display: inline-flex;
      align-items: center;
      align-self: flex-start;
      gap: 4px;
      padding: 3px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel);
    }
    .project-folder-tab-btn {
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      font: inherit;
      font-size: 13px;
      font-weight: 800;
      line-height: 1;
      padding: 8px 14px;
      transition: .18s ease;
      white-space: nowrap;
    }
    .project-folder-tab-btn:hover {
      color: var(--text);
    }
    .project-folder-tab-btn.active {
      background: rgba(0,163,255,.1);
      color: var(--accent);
      box-shadow: inset 0 0 0 1px rgba(0,163,255,.16);
    }
    .project-folder-tab-panel {
      margin-top: 0;
      background: transparent;
      border: 0;
      box-shadow: none;
      padding: 0;
    }
    .project-folder {
      border: none;
      border-radius: 8px;
      background: transparent;
      padding: 10px 10px 8px;
      cursor: pointer;
      transition: .2s ease;
      min-height: 108px;
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      gap: 3px;
    }
    .project-folder:hover {
      background: transparent;
      box-shadow: none;
      transform: translateY(-1px);
    }
    .project-folder.active {
      background: transparent;
      box-shadow: none;
      transform: translateY(-1px);
    }
    .project-folder.active .project-folder-name {
      color: var(--accent);
    }
    .project-folder-icon {
      position: relative;
      width: 72px;
      height: 54px;
      margin: 2px auto 1px;
      border-radius: 7px 7px 8px 8px;
      background: linear-gradient(180deg, #ffd978 0%, #f5b73b 100%);
      box-shadow: inset 0 -8px 14px rgba(140, 83, 0, .12), 0 8px 18px rgba(140, 83, 0, .12);
      flex: 0 0 auto;
    }
    .project-folder-tab {
      position: absolute;
      left: 8px;
      top: -8px;
      width: 31px;
      height: 14px;
      border-radius: 6px 6px 2px 2px;
      background: #ffe39a;
      box-shadow: inset 0 -4px 8px rgba(140, 83, 0, .08);
    }
    .project-folder-name {
      width: 100%;
      font-size: 12px;
      font-weight: 900;
      color: var(--text);
      line-height: 1.28;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow-wrap: anywhere;
    }
    .project-folder-meta {
      font-size: 11px;
      font-weight: 700;
      color: var(--muted);
      line-height: 1.15;
    }
    .project-folder-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 16px;
      margin-bottom: 8px;
    }
    .project-folder-tools {
      display: flex;
      align-items: center;
      gap: 8px;
      width: min(420px, 100%);
      margin-left: auto;
    }
    .project-folder-tools input {
      flex: 1;
      min-width: 0;
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font: inherit;
      font-size: 13px;
      background: var(--panel);
    }
    .project-folder.hidden { display: none; }
    .project-folder-context-menu {
      position: fixed;
      z-index: 1200;
      min-width: 132px;
      padding: 6px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
    }
    .project-folder-context-item {
      width: 100%;
      border: 0;
      border-radius: 6px;
      background: transparent;
      padding: 8px 10px;
      color: var(--text);
      font: inherit;
      font-size: 13px;
      font-weight: 800;
      text-align: left;
      cursor: pointer;
    }
    .project-folder-context-item:hover {
      background: rgba(0, 163, 255, .08);
    }
    .project-folder-context-item.danger {
      color: #dc2626;
    }
    .project-folder-context-item.danger:hover {
      background: rgba(220, 38, 38, .08);
    }
    .shot-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }
    .preview-empty {
      height: 100%;
      min-height: 320px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px dashed var(--border);
      border-radius: 18px;
      color: var(--muted);
      font-size: 13px;
      text-align: center;
      padding: 24px;
    }
    .preview-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 16px;
    }
    .preview-title { font-size: 22px; font-weight: 900; line-height: 1.3; }
    .preview-title-input {
      font: inherit;
      font-size: 20px;
      font-weight: 900;
      color: var(--text);
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 6px 10px;
      width: min(420px, 100%);
      outline: none;
    }
    .preview-title-input:focus { border-color: rgba(0,163,255,.5); }
    .preview-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .preview-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
    .preview-section {
      border: 1px solid var(--border);
      border-radius: 18px;
      background: rgba(255,255,255,.88);
      padding: 16px;
      margin-top: 14px;
    }
    .preview-section-title {
      font-size: 12px;
      font-weight: 900;
      color: var(--muted);
      margin-bottom: 10px;
      letter-spacing: .04em;
    }
    .preview-content {
      font-size: 13px;
      line-height: 1.8;
      color: var(--text);
      white-space: pre-wrap;
      word-break: break-word;
    }
    .preview-media {
      width: 100%;
      height: clamp(240px, 40vh, 420px);
      border-radius: 16px;
      overflow: hidden;
      background: var(--soft);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 10px;
    }
    .preview-media img,
    .preview-media video {
      width: 100%;
      height: 100%;
      display: block;
      max-height: 100%;
      object-fit: contain;
      background: #000;
    }
    .preview-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }
    .preview-tag {
      padding: 6px 10px;
      border-radius: 999px;
      background: var(--soft);
      color: var(--text);
      font-size: 11px;
      font-weight: 700;
    }
    @media (max-width: 980px) {
      #page-assets {
        padding-left: calc(var(--sidebar-width) + 12px);
        padding-right: 16px;
      }
      .assets-shell {
        height: auto;
      }
      .assets-list-block {
        min-height: 420px;
      }
      .assets-detail-block {
        min-height: 420px;
      }
      .library-list.media-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
      .library-list.text-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }
    @media (max-width: 720px) {
      .library-list.media-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
      .library-list.text-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
    }
    @media (max-width: 520px) {
      .library-list.media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .library-list.text-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    .home-logo { order: 1; }
    .home-title { order: 2; }
    .home-subtitle { order: 3; }
    .input-card { order: 4; }
    .quick-enter { order: 5; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 20px; width: 100%; }
    .chat-container { order: 6; }
    .quick-card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 16px 12px;
      text-align: center;
      cursor: pointer;
      transition: .2s;
    }
    .quick-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
    .quick-icon { font-size: 26px; margin-bottom: 6px; }
    .quick-title { font-size: 12px; font-weight: 800; margin-bottom: 3px; }
    .quick-desc { font-size: 10px; color: var(--muted); }

    .img-preview {
      margin-top: 10px;
      border-radius: 12px;
      overflow: hidden;
      background: var(--soft);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .img-preview img {
      display: block;
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: 260px;
      object-fit: contain;
      cursor: zoom-in;
    }
    .video-preview { margin-top: 10px; border-radius: 12px; overflow: hidden; background: #000; }
    .video-preview video { width: 100%; max-height: 260px; display: block; }

    .video-inline-debug {
      margin-top: 10px;
      padding: 12px 14px;
      border: 1px solid rgba(0, 163, 255, .24);
      background: rgba(0, 163, 255, .08);
      border-radius: 12px;
    }
    .video-inline-debug h4 {
      margin: 0 0 8px;
      font-size: 12px;
      line-height: 1.4;
      color: var(--text);
    }
    .video-inline-debug .meta {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.6;
      white-space: pre-wrap;
    }
    .video-inline-debug pre {
      margin: 8px 0 0;
      padding: 10px;
      border-radius: 10px;
      background: rgba(255,255,255,.72);
      white-space: pre-wrap;
      font-size: 12px;
      color: var(--text);
      font-family: inherit;
    }


    .message-head { display:flex;align-items:center;gap:6px;margin-bottom:6px;font-size:10px;color:var(--muted);font-weight:800; }
    .role-badge { width:20px;height:20px;border-radius:50%;background:rgba(0,163,255,.12);color:var(--accent);display:inline-flex;align-items:center;justify-content:center;font-size:10px;font-weight:900; }
    .role-name { color:var(--text); }
    .role-mode { display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;background:var(--soft);color:var(--muted);font-size:10px;line-height:1;white-space:nowrap; }
    .role-mode.task { background:rgba(0,163,255,.1); color:var(--accent); }
    .role-time { margin-left:auto;color:var(--muted);font-weight:700; }
    .message-body { font-size:13px;line-height:1.65; }
    .message-body pre { margin-top:8px;padding:10px;border-radius:12px;background:var(--soft);white-space:pre-wrap;font-family:inherit;font-size:12px;color:var(--text); }
    .message.ai {
      width: 100%;
      max-width: 100%;
      flex-direction: row;
      align-items: flex-start;
      gap: 12px;
      padding: 6px 0;
    }
    .message.ai .message-head {
      width: 62px;
      flex: 0 0 62px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      margin: 2px 0 0;
      text-align: center;
    }
    .message.ai .role-badge {
      width: 34px;
      height: 34px;
      background:
        radial-gradient(circle at 35% 45%, #1f2937 0 2px, transparent 2.4px),
        radial-gradient(circle at 65% 45%, #1f2937 0 2px, transparent 2.4px),
        radial-gradient(circle at 50% 62%, #ff7aa8 0 2px, transparent 2.5px),
        radial-gradient(circle at 30% 58%, rgba(255, 137, 172, .55) 0 3px, transparent 3.5px),
        radial-gradient(circle at 70% 58%, rgba(255, 137, 172, .55) 0 3px, transparent 3.5px),
        linear-gradient(180deg, #ffe0b8 0 100%);
      color: transparent;
      box-shadow: 0 8px 18px rgba(15, 23, 42, .18);
      font-size: 0;
      position: relative;
      overflow: hidden;
      border: 2px solid #2b3440;
      text-indent: 0;
    }
    .message.ai .role-badge::before {
      content: "";
      position: absolute;
      left: -3px;
      top: -4px;
      width: 40px;
      height: 16px;
      border-radius: 50% 50% 45% 45%;
      background:
        radial-gradient(circle at 25% 100%, #111827 0 8px, transparent 8.5px),
        radial-gradient(circle at 50% 105%, #111827 0 10px, transparent 10.5px),
        radial-gradient(circle at 76% 100%, #111827 0 8px, transparent 8.5px),
        #111827;
    }
    .message.ai .role-badge::after {
      content: "";
      position: absolute;
      width: 11px;
      height: 5px;
      border-bottom: 2px solid #1f2937;
      border-radius: 0 0 12px 12px;
      top: 20px;
      left: 50%;
      transform: translateX(-50%);
    }
    .message.ai .role-name {
      color: var(--muted);
      font-size: 11px;
      line-height: 1.2;
    }
    .message.ai .role-time {
      margin-left: 0;
    }
    .message.ai .message-body {
      flex: 1;
      min-width: 0;
      background: transparent;
      border: 0;
      border-radius: 0;
      padding: 2px 0 0;
      box-shadow: none;
      word-break: break-word;
      overflow: visible;
      max-height: none;
    }
    .message.ai .message-body pre {
      max-height: none !important;
      overflow: visible !important;
    }
    .message.ai .message-body > * {
      max-height: none !important;
      overflow: visible !important;
    }
    #home-loading .message-body {
      color: var(--muted);
      font-size: 12px;
    }
    @media (max-width: 640px) {
      .message.ai {
        gap: 8px;
      }
      .message.ai .message-head {
        width: 46px;
        flex-basis: 46px;
      }
      .message.ai .role-badge {
        width: 30px;
        height: 30px;
      }
    }
    .message-actions { display:flex;flex-wrap:wrap;gap:8px;margin-top:12px; }
    .action-btn { border:1px solid var(--border);background:var(--panel);color:var(--text);border-radius:999px;padding:7px 12px;font:inherit;font-size:11px;font-weight:800;cursor:pointer;transition:.2s; }
    .action-btn:hover { border-color:var(--accent);color:var(--accent); }
    .action-btn.primary { background:var(--accent);border-color:var(--accent);color:white; }
    .style-grid {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 10px;
      max-height: none;
      overflow: visible;
      margin-top: 12px;
      padding-right: 0;
    }
    .style-card {
      display: block;
      width: 100%;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--text);
      border-radius: 8px;
      padding: 6px;
      cursor: pointer;
      text-align: left;
      transition: .2s;
      position: relative;
    }
    .style-card:hover {
      border-color: var(--accent);
      box-shadow: 0 8px 22px rgba(0, 163, 255, .14);
    }
    .style-card.suggested:not(.selected)::after {
      content: "推荐";
      position: absolute;
      top: 8px;
      right: 8px;
      padding: 2px 6px;
      border-radius: 999px;
      background: rgba(0, 163, 255, .9);
      color: white;
      font-size: 10px;
      font-weight: 900;
    }
    .style-card.selected {
      border-color: var(--accent);
      background: rgba(0, 163, 255, .08);
      box-shadow: 0 10px 26px rgba(0, 163, 255, .2);
    }
    .style-card img {
      display: block;
      width: 100%;
      aspect-ratio: 4 / 3;
      object-fit: cover;
      border-radius: 6px;
      background: var(--soft);
      cursor: zoom-in;
    }
    .style-card-name {
      margin-top: 7px;
      font-size: 12px;
      font-weight: 900;
      line-height: 1.25;
    }
    .style-card-desc {
      margin-top: 3px;
      color: var(--muted);
      font-size: 10px;
      line-height: 1.35;
      min-height: 27px;
    }
    .style-confirm-bar {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 10px;
      margin-top: 12px;
      padding-top: 4px;
    }
    .style-confirm-actions {
      display: grid;
      grid-template-columns: max-content max-content;
      align-items: center;
      gap: 8px;
      justify-content: flex-end;
      white-space: nowrap;
    }
    .style-confirm-actions .action-btn {
      white-space: nowrap;
    }
    .style-confirm-label {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.5;
    }
    .custom-style-panel {
      display: none;
      margin-top: 10px;
      padding-top: 0;
      gap: 8px;
      align-items: stretch;
      flex-direction: column;
    }
    .custom-style-panel.show {
      display: flex;
    }
    .custom-style-input {
      width: 100%;
      min-height: 64px;
      resize: vertical;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 10px;
      font: inherit;
      font-size: 12px;
      line-height: 1.5;
      color: var(--text);
      background: var(--panel);
      outline: none;
    }
    .custom-style-input:focus {
      border-color: var(--accent);
    }
    @media (max-width: 680px) {
      .style-confirm-bar { grid-template-columns: 1fr; }
      .style-confirm-actions {
        width: 100%;
        grid-template-columns: 1fr 1fr;
      }
      .custom-style-panel .action-btn { width: 100%; }
    }
    @media (max-width: 980px) {
      .style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (max-width: 560px) {
      .style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    .flow-summary { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:10px; }
    .flow-chip { padding:6px 9px;border-radius:10px;background:var(--soft);font-size:11px;font-weight:700;color:var(--text); }
    .flow-chip span { color:var(--muted);font-weight:800;margin-right:4px; }
    .input-toolbar { display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:12px; }
    .composer-tools { display:flex;align-items:center;gap:6px;flex-wrap:wrap;position:relative; }
    .tool-btn { border:1px solid var(--border);background:var(--soft);color:var(--text);border-radius:999px;padding:7px 11px;font:inherit;font-size:11px;font-weight:800;cursor:pointer;display:inline-flex;align-items:center;gap:5px;transition:.2s; }
    .tool-btn:hover { border-color:var(--accent);color:var(--accent); }
    .tool-btn.primary { background:rgba(0,163,255,.1);border-color:rgba(0,163,255,.24);color:var(--accent); }
    @media (max-width: 720px) { .flow-summary { grid-template-columns:1fr; } .input-toolbar { align-items:flex-start;flex-direction:column; } }

    .chat-detail-panel {
      display: none;
      width: 380px;
      flex-shrink: 0;
      flex-direction: column;
      background: rgba(255,255,255,.92);
      border: 1px solid var(--border);
      border-radius: 20px;
      box-shadow: 0 4px 24px rgba(0,0,0,.08);
      overflow: hidden;
      max-height: calc(100vh - 40px);
    }
    .chat-detail-panel.show { display: flex; }
    .storyboard-detail-layout {
      display: flex;
      align-items: flex-start;
      gap: 16px;
      width: 100%;
      min-width: 0;
    }
    .storyboard-detail-main {
      flex: 1 1 0;
      min-width: 0;
    }
    .storyboard-detail-slot {
      display: none;
      flex: 0 0 380px;
      width: 380px;
      min-width: 0;
    }
    .storyboard-detail-slot.has-panel {
      display: block;
    }
    .storyboard-detail-slot > .chat-detail-panel {
      width: 100%;
      max-height: min(760px, calc(100vh - 150px));
    }
    .script-edit-panel {
      display: none;
      flex: 1;
      min-width: 0;
      min-height: calc(100vh - 190px);
      flex-direction: column;
      background: transparent;
    }
    .script-edit-panel.show {
      display: flex;
    }
    /* 剧本修改：左右 50% 分栏 */
    #page-home.chat-mode.script-edit-active:not(.video-prompt-editing) .chat-container,
    #page-home.chat-mode.script-edit-active:not(.video-prompt-editing) .chat-container.script-edit-mode {
      max-width: none;
      width: 100%;
    }
    #page-home.chat-mode.script-edit-active:not(.video-prompt-editing) .messages-area {
      flex: 1 1 50% !important;
      width: 50% !important;
      max-width: 50% !important;
      min-width: 0 !important;
      resize: none;
      overflow-y: auto;
    }
    #page-home.chat-mode.script-edit-active:not(.video-prompt-editing) .script-edit-panel {
      flex: 1 1 50% !important;
      width: 50%;
      min-width: 0;
      align-self: flex-start;
      max-height: calc(100vh - 140px);
      overflow-y: auto;
    }
    #page-home.chat-mode.script-edit-active:not(.video-prompt-editing) .script-edit-textarea {
      min-height: calc(100vh - 240px);
    }
    .script-edit-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }
    .script-edit-title {
      font-size: 14px;
      font-weight: 900;
      color: var(--text);
    }
    .script-edit-actions {
      display: flex;
      gap: 8px;
      flex-shrink: 0;
    }
    .script-edit-textarea {
      width: 100%;
      flex: 1;
      min-height: 520px;
      resize: vertical;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      color: var(--text);
      padding: 14px;
      font: inherit;
      font-size: 13px;
      line-height: 1.75;
      outline: none;
      box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
    }
    .script-edit-textarea:focus {
      border-color: var(--accent);
    }
    .cdp-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px 10px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, rgba(0,163,255,.06), rgba(0,163,255,0));
    }
    .cdp-title { font-size: 13px; font-weight: 900; color: var(--text); }
    .cdp-close {
      width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
      background: transparent; color: var(--muted); cursor: pointer; font-size: 14px;
      display: flex; align-items: center; justify-content: center; transition: .2s; flex-shrink: 0;
    }
    .cdp-close:hover { border-color: var(--accent); color: var(--accent); }
    .cdp-body { flex: 1; overflow-y: auto; padding: 16px; }
    .cdp-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
    .cdp-section {
      border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.8);
      padding: 14px; margin-top: 14px;
    }
    .cdp-section-title {
      font-size: 11px; font-weight: 900; color: var(--muted); margin-bottom: 10px; letter-spacing: .04em;
    }
    .cdp-content { font-size: 13px; line-height: 1.75; color: var(--text); white-space: pre-wrap; word-break: break-word; }
    .cdp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
    .cdp-prompt { background: var(--soft); border-radius: 10px; padding: 12px; margin-top: 10px; font-size: 12px; color: var(--text); white-space: pre-wrap; line-height: 1.6; }
    .cdp-nav { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
    .cdp-nav-chapter { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--soft); font-size: 11px; font-weight: 700; cursor: pointer; transition: .2s; color: var(--text); }
    .cdp-nav-chapter:hover { border-color: var(--accent); color: var(--accent); }
    .cdp-nav-chapter.active { border-color: var(--accent); background: rgba(0,163,255,.1); color: var(--accent); }
    .cdp-nav-shot { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--soft); font-size: 10px; font-weight: 700; cursor: pointer; transition: .2s; color: var(--muted); }
    .cdp-nav-shot:hover { border-color: var(--accent); color: var(--accent); }
    .cdp-nav-shot.active { border-color: var(--accent); background: rgba(0,163,255,.08); color: var(--accent); }
    .cdp-subshot {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: rgba(255,255,255,.8);
      margin-top: 10px;
      overflow: hidden;
    }
    .cdp-subshot-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px;
      background: linear-gradient(180deg, rgba(0,163,255,.04), rgba(0,163,255,0));
      border-bottom: 1px solid var(--border);
      gap: 10px;
    }
    .cdp-subshot-meta { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
    .cdp-view-tag {
      font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
      background: rgba(0,163,255,.1); color: var(--accent); white-space: nowrap;
    }
    .cdp-duration-tag {
      font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
      background: rgba(0,163,255,.06); color: var(--muted); white-space: nowrap;
    }
    .cdp-subshot-title { font-size: 12px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cdp-subshot-gen {
      width: 52px; height: 28px; border-radius: 8px; border: 1px solid var(--accent);
      background: var(--accent); color: white; font-size: 11px; font-weight: 800;
      cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: background .2s;
    }
    .cdp-subshot-gen:hover { background: var(--accent-hover); }
    .cdp-subshot-content { padding: 10px 14px; font-size: 12px; color: var(--text); line-height: 1.65; }
    .cdp-subshot-done { border-color: rgba(0, 200, 100, .3); background: rgba(0, 200, 100, .03); }
    .cdp-subshot-actions { display: flex; align-items: center; gap: 6px; }
    .cdp-gen-done { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(0, 180, 60, .15); color: #00b43c; }
    .cdp-subshot-preview { height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; transition: .2s; }
    .cdp-subshot-preview:hover { border-color: var(--accent); color: var(--accent); }
    .cdp-subshot-gen-video { height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: white; font-size: 11px; font-weight: 700; cursor: pointer; transition: .2s; }
    .cdp-subshot-gen-video:hover { background: var(--accent-hover); }
    .cdp-subshot-thumb { padding: 8px 14px 0; }
    .cdp-subshot-thumb img { width: 100%; max-height: 120px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }
    .cdp-asset-list { display: flex; flex-direction: column; gap: 10px; }
    .cdp-asset-empty { font-size: 12px; color: var(--muted); line-height: 1.7; }
    .cdp-asset-row {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--soft);
    }
    .cdp-asset-row.active { border-color: rgba(0,163,255,.35); background: rgba(0,163,255,.06); }
    .cdp-asset-check { margin-top: 2px; }
    .cdp-asset-check input { width: 14px; height: 14px; cursor: pointer; }
    .cdp-asset-thumb {
      width: 56px;
      height: 56px;
      border-radius: 10px;
      overflow: hidden;
      border: 1px solid var(--border);
      background: #fff;
      flex-shrink: 0;
    }
    .cdp-asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
    .cdp-asset-info { flex: 1; min-width: 0; }
    .cdp-asset-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .cdp-asset-name { font-size: 12px; font-weight: 800; color: var(--text); }
    .cdp-asset-kind {
      font-size: 10px;
      font-weight: 800;
      padding: 2px 8px;
      border-radius: 999px;
      background: rgba(0,163,255,.1);
      color: var(--accent);
    }
    .cdp-asset-desc { margin-top: 6px; font-size: 12px; color: var(--text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
    .cdp-asset-meta { margin-top: 6px; font-size: 11px; color: var(--muted); line-height: 1.5; }
    .cdp-asset-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
    .cdp-asset-summary {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }
    .cdp-asset-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 10px;
      border-radius: 999px;
      background: rgba(0,163,255,.08);
      color: var(--accent);
      font-size: 11px;
      font-weight: 800;
    }
    .cdp-asset-card {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--soft);
    }
    .cdp-asset-picker-modal {
      width: min(760px, calc(100vw - 48px));
      max-height: min(82vh, 880px);
      background: var(--panel);
      border-radius: 18px;
      box-shadow: var(--shadow-lg);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .cdp-asset-picker-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 16px 18px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, rgba(0,163,255,.06), rgba(0,163,255,0));
    }
    .cdp-asset-picker-title { font-size: 14px; font-weight: 900; color: var(--text); }
    .cdp-asset-picker-subtitle { font-size: 11px; color: var(--muted); margin-top: 4px; }
    .cdp-asset-picker-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
    .cdp-asset-picker-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      padding: 14px 18px 18px;
      border-top: 1px solid var(--border);
      background: rgba(255,255,255,.96);
    }
    .img-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(245,247,250,.58);
      backdrop-filter: blur(8px);
      z-index: 9999;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }
    .img-modal-shell {
      width: min(960px, calc(100vw - 48px));
      max-height: calc(100vh - 48px);
      background: rgba(255,255,255,.96);
      border: 1px solid rgba(15,23,42,.08);
      border-radius: 22px;
      box-shadow: 0 24px 80px rgba(15,23,42,.18);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .img-modal-shell.image-shell {
      width: auto;
      max-width: calc(100vw - 48px);
      background: transparent;
      border: none;
      border-radius: 0;
      box-shadow: none;
      overflow: visible;
    }
    .img-modal-shell.image-shell .img-modal-toolbar {
      display: none;
    }
    .img-modal-shell.image-shell .img-modal-close {
      position: fixed;
      top: 18px;
      right: 22px;
      z-index: 1;
      border-color: rgba(15,23,42,.12);
      background: rgba(255,255,255,.9);
      box-shadow: 0 8px 24px rgba(15,23,42,.12);
    }
    .img-modal-shell.video-shell {
      width: auto;
      max-width: calc(100vw - 48px);
      background: transparent;
      border: none;
      border-radius: 0;
      box-shadow: none;
      overflow: visible;
    }
    .img-modal-shell.video-shell .img-modal-toolbar {
      display: none;
    }
    .img-modal-shell.video-shell .img-modal-close {
      position: fixed;
      top: 18px;
      right: 22px;
      z-index: 1;
      border-color: rgba(15,23,42,.12);
      background: rgba(255,255,255,.9);
      box-shadow: 0 8px 24px rgba(15,23,42,.12);
    }
    .img-modal-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 18px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, rgba(0,163,255,.08), rgba(255,255,255,.92));
    }
    .img-modal-toolbar-left {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .img-modal-title {
      font-size: 14px;
      font-weight: 900;
      color: var(--text);
    }
    .img-modal-hint {
      font-size: 11px;
      color: var(--muted);
    }
    .img-modal-toolbar-right {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .img-modal-btn,
    .img-modal-close {
      border: 1px solid var(--border);
      background: rgba(255,255,255,.92);
      color: var(--text);
      border-radius: 999px;
      height: 34px;
      padding: 0 12px;
      cursor: pointer;
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: .2s ease;
    }
    .img-modal-btn:hover,
    .img-modal-close:hover {
      border-color: var(--accent);
      color: var(--accent);
    }
    .img-modal-close {
      min-width: 34px;
      padding: 0;
      font-size: 16px;
    }
    .img-modal-zoom {
      min-width: 54px;
      text-align: center;
      font-size: 12px;
      font-weight: 900;
      color: var(--text);
    }
    .img-modal-stage {
      flex: 1;
      min-height: 0;
      overflow: auto;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: linear-gradient(180deg, rgba(248,250,252,.94), rgba(241,245,249,.94));
    }
    .img-modal-shell.image-shell .img-modal-stage {
      padding: 0;
      background: transparent;
      overflow: visible;
    }
    .img-modal-shell.video-shell .img-modal-stage {
      padding: 0;
      background: transparent;
      overflow: visible;
    }
    .img-modal-image {
      display: block;
      width: auto;
      height: auto;
      max-width: none;
      max-height: none;
      border-radius: 0;
      box-shadow: none;
      background: transparent;
    }
    .img-modal-video {
      display: block;
      width: auto;
      max-width: min(50vw, calc(100vw - 48px));
      max-height: calc(100vh - 48px);
      border-radius: 0;
      background: transparent;
      box-shadow: none;
    }
    .cdp-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; padding: 24px; }
    @media (max-width: 900px) {
      .chat-detail-panel { width: 300px; }
      .storyboard-detail-layout {
        flex-direction: column;
      }
      .storyboard-detail-slot,
      .storyboard-detail-slot.has-panel {
        width: 100%;
        flex-basis: auto;
      }
      .storyboard-detail-slot > .chat-detail-panel {
        max-height: none;
      }
    }
    @media (max-width: 720px) { .chat-detail-panel { display: none; } }

    .loading-dots { display: inline-flex; gap: 3px; }
    .loading-dots span { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; animation: bounce 1s infinite ease-in-out; }
    .loading-dots span:nth-child(2) { animation-delay: .1s; }
    .loading-dots span:nth-child(3) { animation-delay: .2s; }
    @keyframes bounce {
      0%, 100% { transform: scale(0.7); opacity: .5; }
      50% { transform: scale(1.1); opacity: 1; }
    }
    .modal-overlay { display:none;position:fixed;inset:0;background:rgba(0,0,0,.7);backdrop-filter:blur(4px);z-index:500;align-items:center;justify-content:center; }
    .modal-overlay.show { display:flex; }
    .modal { background:var(--panel);border:1px solid var(--border);border-radius:18px;padding:28px;max-width:480px;width:90%;box-shadow:0 20px 60px rgba(0,0,0,.5);max-height:85vh;overflow-y:auto; }
/* 全局隐藏滚动条（保留滚动能力） */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* 对话回复气泡：淡色边框，无投影（覆盖主题表面样式） */
.message.ai .message-body,
:root[data-theme="light"] .message.ai .message-body,
:root[data-theme="dark"] .message.ai .message-body {
  background: var(--surface-glass) !important;
  border: 1px solid var(--line-soft) !important;
  box-shadow: none !important;
}

    .modal-header { display:flex;align-items:center;justify-content:space-between;margin-bottom:18px; }
    .modal-title { font-size:15px;font-weight:900;color:var(--text); }
    .modal-close { width:28px;height:28px;border-radius:8px;border:1px solid var(--border);background:transparent;color:var(--muted);cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;transition:.2s; }
    .modal-close:hover { border-color:var(--accent);color:var(--accent); }
    .modal-footer { display:flex;gap:8px;justify-content:flex-end;margin-top:18px; }
    .card-action { padding:6px 14px;border-radius:999px;border:1px solid var(--border);background:transparent;color:var(--text);font:inherit;font-size:11px;font-weight:700;cursor:pointer;transition:.2s; }
    .card-action:hover { border-color:var(--accent);color:var(--accent); }
    .card-action.primary { background:var(--accent);color:white;border-color:var(--accent); }
    .card-action.danger { border-color:#f04438;color:#f04438; }
    .recharge-packages { display:grid;grid-template-columns:repeat(2,1fr);gap:10px; }
    .recharge-card { border:1px solid var(--border);border-radius:14px;padding:16px 12px;text-align:center;transition:.2s;background:var(--soft); }
    .recharge-card:hover { border-color:var(--accent);transform:translateY(-2px); }
    .recharge-icon { font-size:24px;margin-bottom:6px; }
    .recharge-amount { font-size:18px;font-weight:900;color:var(--text);margin-bottom:2px; }
    .recharge-price { font-size:13px;font-weight:700;color:var(--muted); }
    .recharge-bonus { font-size:10px;color:var(--accent);font-weight:700;margin-top:4px; }
    .pay-channel-group { display:flex;flex-wrap:wrap;gap:8px;margin:8px 0 12px; }
    .pay-channel-btn { border:1px solid var(--border);border-radius:10px;background:var(--soft);color:var(--text);font:inherit;font-size:11px;font-weight:800;padding:8px 10px;cursor:pointer;transition:.2s;display:inline-flex;align-items:center;gap:6px;min-height:34px; }
    .pay-channel-btn:hover { border-color:var(--accent);color:var(--accent); }
    .pay-channel-btn.active { border-color:var(--accent);background:rgba(20,184,166,.12);color:var(--accent); }
    .pay-channel-icon { font-size:14px;line-height:1; }
    .form-group { display:flex;flex-direction:column;gap:6px;margin-bottom:12px; }
    .form-label { font-size:11px;font-weight:800;color:var(--muted); }
    .form-input { padding:9px 12px;border-radius:10px;border:1px solid var(--border);background:var(--soft);color:var(--text);font:inherit;font-size:12px;outline:none; }
    .form-input:focus { border-color:var(--accent); }
    .user-panel-profile { display:flex;align-items:center;gap:12px;padding:10px 0 14px;border-bottom:1px solid var(--border); }
    .user-avatar { width:48px;height:48px;border-radius:50%;background:linear-gradient(135deg,var(--accent),#14b8a6);color:white;display:flex;align-items:center;justify-content:center;font-size:20px;font-weight:900;flex-shrink:0; }
    .user-name { font-size:15px;font-weight:900;color:var(--text); }
    .user-meta { font-size:11px;color:var(--muted);font-weight:700;margin-top:4px; }
    .user-panel-section { padding:14px 0;border-bottom:1px solid var(--border); }
    .user-panel-section:last-child { border-bottom:0; }
    .user-section-title { font-size:12px;font-weight:900;color:var(--text);margin-bottom:10px; }
    .user-quota-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px; }
    .user-stat { background:var(--soft);border:1px solid var(--border);border-radius:10px;padding:10px;text-align:center; }
    .user-stat-value { font-size:18px;font-weight:900;color:var(--accent); }
    .user-stat-label { font-size:10px;color:var(--muted);margin-top:2px; }
    @media (max-width: 560px) {
      .user-quota-grid { grid-template-columns: 1fr; }
    }
    .setting-row { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0; }
    .setting-label { font-size:12px;font-weight:800;color:var(--text); }
    .setting-desc { font-size:10px;color:var(--muted);margin-top:2px;line-height:1.4; }
    .settings-tabs {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 4px;
      padding: 4px;
      margin-bottom: 14px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--soft);
    }
    .settings-tab {
      border: 0;
      border-radius: 9px;
      background: transparent;
      color: var(--muted);
      font: inherit;
      font-size: 12px;
      font-weight: 900;
      padding: 8px 10px;
      cursor: pointer;
    }
    .settings-tab.active {
      background: var(--panel);
      color: var(--accent);
      box-shadow: 0 4px 12px rgba(0,0,0,.08);
    }
    .settings-tab-panel[hidden] {
      display: none;
    }
    .segmented-control { display:inline-flex;gap:3px;padding:3px;border:1px solid var(--border);border-radius:10px;background:var(--soft); }
    .segmented-control button { border:0;background:transparent;color:var(--muted);border-radius:8px;padding:6px 9px;font:inherit;font-size:11px;font-weight:800;cursor:pointer;white-space:nowrap; }
    .segmented-control button.active { background:var(--panel);color:var(--accent);box-shadow:0 4px 12px rgba(0,0,0,.08); }
    .settings-select { min-width:96px;border:1px solid var(--border);border-radius:10px;background:var(--soft);color:var(--text);font:inherit;font-size:11px;font-weight:800;padding:7px 9px;outline:none; }
    .settings-number { width:72px;border:1px solid var(--border);border-radius:10px;background:var(--soft);color:var(--text);font:inherit;font-size:11px;font-weight:800;padding:7px 9px;outline:none; }
    .settings-text-input { width:100%;border:1px solid var(--border);border-radius:10px;background:var(--soft);color:var(--text);font:inherit;font-size:11px;font-weight:700;padding:8px 10px;outline:none; }
    .settings-inline-inputs { display:grid;grid-template-columns:1fr;gap:8px;width:100%;margin-top:8px; }
    .switch { position:relative;display:inline-flex;width:42px;height:24px; }
    .switch input { opacity:0;width:0;height:0; }
    .switch span { position:absolute;inset:0;border-radius:999px;background:var(--border);cursor:pointer;transition:.2s; }
    .switch span::before { content:'';position:absolute;width:18px;height:18px;left:3px;top:3px;border-radius:50%;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.25);transition:.2s; }
    .switch input:checked + span { background:var(--accent); }
    .switch input:checked + span::before { transform:translateX(18px); }
    .input-card.locked {
      opacity: .72;
    }
    #page-history {
      padding: 20px var(--sidebar-page-right) 20px var(--sidebar-page-left);
      align-items: stretch;
      justify-content: center;
    }
    #page-canvas {
      padding: 20px var(--sidebar-page-right) 20px var(--sidebar-page-left);
      background: var(--bg);
      min-height: 100vh;
    }
    .canvas-shell {
      width: 100%;
      height: 100vh;
      min-height: 520px;
      overflow: hidden;
      background: #080809;
      position: relative;
    }
    .canvas-frame {
      width: 100%;
      height: 100%;
      border: 0;
      display: block;
      background: #080809;
      opacity: 1;
      transition: opacity .18s ease;
    }
    .canvas-shell.is-loading .canvas-frame {
      opacity: 0;
      pointer-events: none;
    }
    .canvas-shell.is-loading.has-frame-src .canvas-frame {
      opacity: 1;
      pointer-events: auto;
    }
    .canvas-loading {
      position: absolute;
      inset: 0;
      z-index: 2;
      display: none;
      align-items: center;
      justify-content: center;
      gap: 10px;
      background: #f8fafc;
      color: #475569;
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0;
      pointer-events: none;
    }
    .canvas-shell.is-loading.has-frame-src .canvas-loading {
      inset: 14px 14px auto auto;
      width: auto;
      min-height: 30px;
      padding: 0 12px;
      border: 1px solid rgba(148, 163, 184, .25);
      border-radius: 999px;
      background: rgba(248, 250, 252, .86);
      box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
      backdrop-filter: blur(10px);
    }
    .canvas-shell.is-loading .canvas-loading {
      display: flex;
    }
    .canvas-loading-dot {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      background: #64748b;
      animation: canvasLoadingPulse .9s ease-in-out infinite alternate;
    }
    @keyframes canvasLoadingPulse {
      from { opacity: .35; transform: scale(.85); }
      to { opacity: 1; transform: scale(1.08); }
    }
    .history-shell {
      width: 100%;
      height: calc(100vh - 40px);
      overflow-y: auto;
    }
    .history-header {
      padding: 0 0 16px;
    }
    .history-title {
      font-size: 22px;
      font-weight: 900;
      color: var(--text);
    }
    .history-subtitle {
      margin-top: 6px;
      color: var(--muted);
      font-size: 12px;
    }
    .history-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .history-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
      cursor: pointer;
    }
    .history-item:hover .history-item-title { color: var(--accent); }
    .history-item-kind {
      flex: 0 0 auto;
      min-width: 42px;
      padding: 5px 8px;
      border-radius: 999px;
      background: var(--soft);
      color: var(--muted);
      font-size: 11px;
      font-weight: 900;
      text-align: center;
    }
    .history-item-kind.canvas {
      background: rgba(56, 189, 248, .12);
      color: #0284c7;
    }
    .history-item-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
    }
    .history-item-main { min-width: 0; flex: 1; }
    .history-item-title {
      font-size: 13px;
      font-weight: 900;
      color: var(--text);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .history-item-meta {
      margin-top: 4px;
      font-size: 11px;
      color: var(--muted);
    }
    .history-empty {
      padding: 40px 0;
      color: var(--muted);
      font-size: 13px;
      text-align: center;
    }

    /* ===== Dream UI Refresh: preserve flow, redesign surface ===== */
    :root {
      --bg: #eef2f6;
      --panel: #ffffff;
      --soft: #f5f7fa;
      --border: #dce3eb;
      --text: #152033;
      --muted: #68758a;
      --accent: #2563eb;
      --accent-hover: #1d4ed8;
      --accent-2: #18a77d;
      --warning: #e9a23b;
      --danger: #df625b;
      --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
      --shadow-lg: 0 20px 58px rgba(15, 23, 42, 0.14);
    }
    body {
      background:
        radial-gradient(circle at 50% 18%, rgba(37, 99, 235, .08), transparent 34%),
        linear-gradient(180deg, #f7f9fc 0%, #edf2f7 100%);
      letter-spacing: 0;
    }
    .ui-icon {
      width: 20px;
      height: 20px;
      display: block;
      fill: none;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex-shrink: 0;
    }
    .sidebar {
      width: var(--sidebar-width);
      background: #111827;
      border-right: 1px solid rgba(255,255,255,.08);
      box-shadow: 10px 0 34px rgba(15, 23, 42, .12);
      padding: 18px 0;
    }
    .sidebar-logo {
      width: 38px;
      height: 38px;
      margin-bottom: 18px;
      color: #fff;
      border-radius: 11px;
      padding: 8px;
      background: linear-gradient(135deg, #2563eb, #18a77d);
      box-shadow: 0 14px 28px rgba(37, 99, 235, .3);
    }
    .sidebar-item {
      width: 46px;
      min-height: 46px;
      border-radius: 10px;
      color: #9aa6b8;
      background: transparent;
      position: relative;
    }
    .sidebar-item:hover {
      background: rgba(255,255,255,.08);
      color: #ffffff;
    }
    .sidebar-item.active {
      background: #18a77d;
      color: #06131d;
      box-shadow: 0 12px 24px rgba(24, 167, 125, .28);
    }
    .sidebar-item .icon {
      font-size: 0;
      display: grid;
      place-items: center;
    }
    .sidebar-item .icon .ui-icon {
      width: 20px;
      height: 20px;
    }
    .sidebar-item .tooltip {
      left: 66px;
      background: #111827;
      border-radius: 7px;
      box-shadow: 0 10px 24px rgba(15,23,42,.2);
    }
    #page-home {
      padding-left: var(--sidebar-page-left);
      padding-right: var(--sidebar-page-right);
    }
    .home-content {
      max-width: 800px;
      transform: translateY(-18px);
    }
    .home-logo {
      width: 78px;
      height: 78px;
      margin-bottom: 16px;
      border-radius: 18px;
      display: grid;
      place-items: center;
      color: white;
      background: linear-gradient(135deg, #111827, #2563eb 58%, #18a77d);
      box-shadow: 0 18px 40px rgba(37, 99, 235, .22);
      font-size: 0;
    }
    .home-logo .ui-icon {
      width: 38px;
      height: 38px;
    }
    .home-title {
      font-size: clamp(30px, 4vw, 42px);
      letter-spacing: 0;
      line-height: 1.12;
      margin-bottom: 10px;
      color: #0f172a;
    }
    .blue {
      color: var(--accent);
    }
    .home-subtitle {
      color: var(--muted);
      font-size: 15px;
      margin-bottom: 22px;
    }
    .quick-enter {
      gap: 12px;
      margin-top: 22px;
    }
    .quick-card {
      min-height: 126px;
      border-radius: 10px;
      border: 1px solid rgba(220, 227, 235, .95);
      background: rgba(255,255,255,.9);
      box-shadow: 0 10px 28px rgba(15,23,42,.06);
      padding: 16px;
      text-align: left;
      display: grid;
      align-content: space-between;
    }
    .quick-card:hover {
      transform: translateY(-3px);
      border-color: rgba(37, 99, 235, .28);
      box-shadow: 0 18px 40px rgba(15,23,42,.1);
    }
    .quick-icon {
      width: 42px;
      height: 42px;
      border-radius: 10px;
      display: grid;
      place-items: center;
      margin-bottom: 10px;
      font-size: 0;
      background: #f1f5f9;
      color: var(--accent);
      border: 1px solid rgba(220, 227, 235, .9);
    }
    .quick-card:nth-child(2) .quick-icon { color: var(--accent-2); }
    .quick-card:nth-child(3) .quick-icon { color: var(--danger); }
    .quick-card:nth-child(4) .quick-icon { color: var(--warning); }
    .quick-card:nth-child(5) .quick-icon { color: var(--success, #10b981); }
    .quick-icon .ui-icon {
      width: 22px;
      height: 22px;
    }
    .quick-title {
      font-size: 14px;
      color: var(--text);
      margin-bottom: 4px;
    }
    .quick-desc {
      font-size: 12px;
      color: var(--muted);
    }
    .input-card,
    #page-home.chat-mode .input-card {
      max-width: 860px;
      border-radius: 12px;
      border: 1px solid rgba(220, 227, 235, .95);
      background: rgba(255,255,255,.96);
      box-shadow: 0 18px 46px rgba(15,23,42,.12);
      padding: 14px;
    }
    .input-area textarea {
      display: block;
      min-height: 92px;
      border-radius: 9px;
      padding: 10px 14px 15px;
      text-align: left;
      vertical-align: top;
      background: #fff;
      color: var(--text);
    }
    #mainInput {
      text-align: left !important;
      vertical-align: top !important;
      min-height: 92px;
      padding-top: 10px;
    }
    .input-area textarea::placeholder {
      color: #8a96a8;
    }
    .input-toolbar {
      margin-top: 10px;
      gap: 10px;
    }
    .composer-tools {
      gap: 8px;
    }
    .tool-btn,
    .select-opt,
    .dropdown-item {
      border-radius: 8px;
    }
    .tool-btn {
      min-height: 34px;
      border: 1px solid rgba(220, 227, 235, .95);
      background: #f8fafc;
      color: #26344a;
      padding: 7px 11px;
      gap: 6px;
      box-shadow: none;
    }
    .tool-btn:hover {
      background: #fff;
      border-color: rgba(37, 99, 235, .32);
      color: var(--accent);
      transform: translateY(-1px);
    }
    .tool-btn.primary {
      background: #111827;
      border-color: #111827;
      color: #fff;
    }
    .send-btn {
      width: 42px;
      height: 42px;
      border-radius: 10px;
      background: #111827;
      color: #fff;
      box-shadow: 0 10px 22px rgba(15,23,42,.2);
      display: grid;
      place-items: center;
      font-size: 0;
    }
    .send-btn:hover {
      background: var(--accent);
      transform: translateY(-1px);
    }
    .send-btn .ui-icon {
      width: 19px;
      height: 19px;
    }
    .select-panel,
    .dropdown-content {
      border-radius: 12px;
      border: 1px solid rgba(220, 227, 235, .95);
      box-shadow: 0 18px 42px rgba(15,23,42,.14);
    }
    .messages-area {
      gap: 10px;
      padding: 18px 0 138px;
    }
    .message.user {
      background: #f1f5f9;
      color: #1f2937;
      border: 1px solid rgba(220, 227, 235, .9);
      border-radius: 14px 14px 4px 14px;
    }
    .message.ai {
      gap: 14px;
      padding: 8px 0;
    }
    .message.ai .role-badge {
      width: 36px;
      height: 36px;
      border: 0;
      border-radius: 10px;
      background: linear-gradient(135deg, #111827, #2563eb);
      color: #fff;
      box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
    }
    .message.ai .role-badge::before,
    .message.ai .role-badge::after {
      display: none;
    }
    .message.ai .role-badge {
      font-size: 12px;
      text-indent: 0;
    }
    .message.ai .role-name {
      color: #334155;
      font-weight: 900;
    }
    .message.ai .message-body {
      padding: 14px 16px;
      border: 1px solid rgba(220, 227, 235, .86);
      border-radius: 12px;
      background: rgba(255,255,255,.92);
      box-shadow: 0 10px 24px rgba(15,23,42,.05);
      line-height: 1.68;
    }
    .message-actions {
      gap: 9px;
    }
    .action-btn,
    .card-action {
      border-radius: 8px;
      padding: 8px 12px;
      border-color: rgba(220, 227, 235, .95);
      background: #fff;
    }
    .action-btn.primary,
    .card-action.primary {
      background: #111827;
      border-color: #111827;
      color: #fff;
    }
    .flow-chip {
      border-radius: 8px;
      background: #f1f5f9;
      border: 1px solid rgba(220, 227, 235, .78);
    }
    .style-card,
    .recharge-card,
    .modal,
    .chat-detail-panel {
      border-radius: 12px;
      border-color: rgba(220, 227, 235, .95);
      box-shadow: 0 12px 30px rgba(15,23,42,.07);
    }
    .style-card.selected {
      border-color: rgba(24, 167, 125, .5);
      background: rgba(24, 167, 125, .08);
      box-shadow: 0 12px 28px rgba(24, 167, 125, .14);
    }
    #page-assets,
    #page-history {
      padding-left: var(--sidebar-page-left);
      padding-right: var(--sidebar-page-right);
    }
    .assets-tab,
    .library-nav-back {
      border-radius: 8px;
    }
    .assets-tab.active {
      border-color: rgba(37, 99, 235, .28);
      background: rgba(37, 99, 235, .1);
      color: var(--accent);
    }
    .history-item {
      border-bottom-color: rgba(220, 227, 235, .9);
      border-radius: 8px;
      padding: 12px;
    }
    .history-item:hover {
      background: rgba(255,255,255,.72);
    }
    /* Final theme coverage. Keep this late so it wins over refresh hardcodes. */
    :root[data-theme="light"] {
      --bg: #eef2f6;
      --panel: #ffffff;
      --soft: #f5f7fa;
      --border: #dce3eb;
      --text: #152033;
      --muted: #68758a;
      --accent: #2563eb;
      --accent-hover: #1d4ed8;
      --accent-2: #18a77d;
      --warning: #e9a23b;
      --danger: #df625b;
      --surface-glass: rgba(255,255,255,.92);
      --surface-strong: rgba(255,255,255,.98);
      --surface-soft: rgba(245,247,250,.9);
      --surface-hover: rgba(37,99,235,.07);
      --line-soft: rgba(220,227,235,.95);
      --control-bg: #f8fafc;
      --control-hover: #ffffff;
      --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
      --shadow-lg: 0 20px 58px rgba(15, 23, 42, 0.14);
    }
    :root[data-theme="dark"] {
      --bg: #0f1117;
      --panel: #171a22;
      --soft: #202431;
      --border: #2f3543;
      --text: #f4f7fb;
      --muted: #a5afbf;
      --accent: #38bdf8;
      --accent-hover: #0ea5e9;
      --accent-2: #34d399;
      --warning: #fbbf24;
      --danger: #fb7185;
      --surface-glass: rgba(23,26,34,.9);
      --surface-strong: rgba(23,26,34,.98);
      --surface-soft: rgba(32,36,49,.9);
      --surface-hover: rgba(56,189,248,.12);
      --line-soft: rgba(47,53,67,.95);
      --control-bg: #202431;
      --control-hover: #252b3a;
      --shadow: 0 10px 34px rgba(0,0,0,.34);
      --shadow-lg: 0 22px 64px rgba(0,0,0,.52);
    }
    :root[data-theme="light"] body {
      background:
        radial-gradient(circle at 50% 18%, rgba(37, 99, 235, .08), transparent 34%),
        linear-gradient(180deg, #f7f9fc 0%, #edf2f7 100%);
      color: var(--text);
    }
    :root[data-theme="dark"] body {
      background:
        radial-gradient(circle at 50% 18%, rgba(56, 189, 248, .11), transparent 34%),
        radial-gradient(circle at 88% 8%, rgba(52, 211, 153, .08), transparent 28%),
        linear-gradient(180deg, #0b0f19 0%, #111827 100%);
      color: var(--text);
    }
    :root[data-theme="light"] .sidebar {
      background: rgba(255,255,255,.94);
      border-right-color: var(--line-soft);
      box-shadow: 10px 0 34px rgba(15, 23, 42, .08);
    }
    :root[data-theme="light"] .sidebar-item {
      color: #64748b;
    }
    :root[data-theme="light"] .sidebar-item:hover {
      background: rgba(37,99,235,.08);
      color: var(--accent);
    }
    :root[data-theme="light"] .sidebar-item.active {
      background: var(--accent);
      color: #fff;
      box-shadow: 0 12px 24px rgba(37, 99, 235, .24);
    }
    :root[data-theme="light"] .sidebar-item .tooltip {
      background: #ffffff;
      color: var(--text);
      border: 1px solid var(--border);
    }
    :root[data-theme="dark"] .sidebar {
      background: rgba(11,15,25,.96);
      border-right-color: rgba(47,53,67,.9);
      box-shadow: 10px 0 34px rgba(0,0,0,.32);
    }
    :root[data-theme="dark"] .sidebar-item {
      color: #8b98ab;
    }
    :root[data-theme="dark"] .sidebar-item:hover {
      background: rgba(255,255,255,.08);
      color: #ffffff;
    }
    :root[data-theme="dark"] .sidebar-item.active {
      background: var(--accent-2);
      color: #06131d;
      box-shadow: 0 12px 24px rgba(52, 211, 153, .22);
    }
    :root[data-theme="dark"] .sidebar-item .tooltip {
      background: #111827;
      color: var(--text);
      border: 1px solid var(--border);
    }
    :root[data-theme="dark"] .home-title,
    :root[data-theme="dark"] .quick-title,
    :root[data-theme="dark"] .role-name,
    :root[data-theme="dark"] .message.ai .role-name,
    :root[data-theme="dark"] .library-item-name,
    :root[data-theme="dark"] .asset-detail-title,
    :root[data-theme="dark"] .chapter-name,
    :root[data-theme="dark"] .shot-name,
    :root[data-theme="dark"] .cdp-title,
    :root[data-theme="dark"] .setting-label,
    :root[data-theme="dark"] .user-section-title,
    :root[data-theme="dark"] .user-name,
    :root[data-theme="dark"] .modal-title {
      color: var(--text);
    }
    :root[data-theme="dark"] .home-subtitle,
    :root[data-theme="dark"] .quick-desc,
    :root[data-theme="dark"] .role-mode,
    :root[data-theme="dark"] .role-time,
    :root[data-theme="dark"] .library-subtitle,
    :root[data-theme="dark"] .library-item-time,
    :root[data-theme="dark"] .library-item-meta,
    :root[data-theme="dark"] .asset-detail-meta,
    :root[data-theme="dark"] .chapter-desc,
    :root[data-theme="dark"] .shot-desc,
    :root[data-theme="dark"] .preview-meta,
    :root[data-theme="dark"] .setting-desc,
    :root[data-theme="dark"] .user-meta,
    :root[data-theme="dark"] .user-stat-label,
    :root[data-theme="dark"] .form-label,
    :root[data-theme="dark"] .select-title,
    :root[data-theme="dark"] .ref-label,
    :root[data-theme="dark"] .ref-empty,
    :root[data-theme="dark"] .history-item-meta,
    :root[data-theme="dark"] .cdp-meta,
    :root[data-theme="dark"] .cdp-asset-picker-subtitle,
    :root[data-theme="dark"] .cdp-empty {
      color: var(--muted);
    }
    :root[data-theme="light"] .quick-card,
    :root[data-theme="light"] .input-card,
    :root[data-theme="light"] #page-home.chat-mode .input-card,
    :root[data-theme="light"] .message.ai .message-body,
    :root[data-theme="light"] .library-item,
    :root[data-theme="light"] .preview-section,
    :root[data-theme="light"] .modal,
    :root[data-theme="light"] .chat-detail-panel,
    :root[data-theme="light"] .cdp-section,
    :root[data-theme="light"] .cdp-subshot,
    :root[data-theme="light"] .cdp-asset-picker,
    :root[data-theme="light"] .img-modal-content {
      background: var(--surface-glass);
      border-color: var(--line-soft);
      color: var(--text);
    }
    :root[data-theme="dark"] .quick-card,
    :root[data-theme="dark"] .input-card,
    :root[data-theme="dark"] #page-home.chat-mode .input-card,
    :root[data-theme="dark"] .message.ai .message-body,
    :root[data-theme="dark"] .style-card,
    :root[data-theme="dark"] .asset-panel,
    :root[data-theme="dark"] .asset-detail,
    :root[data-theme="dark"] .asset-card,
    :root[data-theme="dark"] .asset-workbench-card,
    :root[data-theme="dark"] .chapter-row,
    :root[data-theme="dark"] .shot-row,
    :root[data-theme="dark"] .preview-section,
    :root[data-theme="dark"] .video-inline-debug pre,
    :root[data-theme="dark"] .modal,
    :root[data-theme="dark"] .recharge-card,
    :root[data-theme="dark"] .user-stat,
    :root[data-theme="dark"] .chat-detail-panel,
    :root[data-theme="dark"] .cdp-section,
    :root[data-theme="dark"] .cdp-subshot,
    :root[data-theme="dark"] .cdp-asset-row,
    :root[data-theme="dark"] .cdp-asset-picker,
    :root[data-theme="dark"] .cdp-asset-picker-modal,
    :root[data-theme="dark"] .img-modal-content {
      background: var(--surface-glass);
      border-color: var(--line-soft);
      color: var(--text);
      box-shadow: var(--shadow);
    }
    :root[data-theme="dark"] .quick-card:hover,
    :root[data-theme="dark"] .library-item:hover,
    :root[data-theme="dark"] .chapter-row:hover,
    :root[data-theme="dark"] .shot-row:hover,
    :root[data-theme="dark"] .cdp-asset-row.active {
      background: var(--surface-hover);
      border-color: rgba(56,189,248,.34);
    }
    :root[data-theme="dark"] .history-list {
      gap: 0;
    }
    :root[data-theme="dark"] .history-item {
      background: transparent;
      border: 0;
      border-bottom: 1px solid rgba(47,53,67,.85);
      border-radius: 0;
      box-shadow: none;
      color: var(--text);
      padding: 14px 0;
    }
    :root[data-theme="dark"] .history-item:hover {
      background: rgba(56,189,248,.06);
      box-shadow: none;
    }
    :root[data-theme="dark"] .input-area textarea,
    :root[data-theme="dark"] .form-input,
    :root[data-theme="dark"] .settings-select,
    :root[data-theme="dark"] #projectNameInput,
    :root[data-theme="dark"] .project-folder-tools input,
    :root[data-theme="dark"] .script-edit-textarea,
    :root[data-theme="dark"] .asset-prompt-box,
    :root[data-theme="dark"] .dropdown-content,
    :root[data-theme="dark"] .select-panel,
    :root[data-theme="dark"] .ref-panel,
    :root[data-theme="dark"] .local-ref-btn,
    :root[data-theme="dark"] .cdp-prompt,
    :root[data-theme="dark"] .cdp-nav-chapter,
    :root[data-theme="dark"] .cdp-nav-shot,
    :root[data-theme="dark"] .cdp-subshot-preview,
    :root[data-theme="dark"] .cdp-asset-thumb,
    :root[data-theme="dark"] .message-body pre {
      background: var(--control-bg);
      border-color: var(--border);
      color: var(--text);
    }
    :root[data-theme="dark"] .input-area textarea::placeholder,
    :root[data-theme="dark"] .form-input::placeholder,
    :root[data-theme="dark"] #projectNameInput::placeholder,
    :root[data-theme="dark"] .project-folder-tools input::placeholder,
    :root[data-theme="dark"] .script-edit-textarea::placeholder {
      color: #7f8b9d;
    }
    :root[data-theme="dark"] .tool-btn,
    :root[data-theme="dark"] .action-btn,
    :root[data-theme="dark"] .card-action,
    :root[data-theme="dark"] .select-opt,
    :root[data-theme="dark"] .dropdown-item,
    :root[data-theme="dark"] .flow-chip,
    :root[data-theme="dark"] .assets-tab,
    :root[data-theme="dark"] .library-nav-back,
    :root[data-theme="dark"] .segmented-control,
    :root[data-theme="dark"] .segmented-control button.active,
    :root[data-theme="dark"] .role-mode,
    :root[data-theme="dark"] .ref-chip,
    :root[data-theme="dark"] .chapter-plus {
      background: var(--control-bg);
      border-color: var(--border);
      color: var(--text);
    }
    :root[data-theme="dark"] #page-home.chat-mode.script-edit-active.video-prompt-editing .script-edit-panel,
    :root[data-theme="dark"] .asset-workbench,
    :root[data-theme="dark"] .asset-workbench-summary,
    :root[data-theme="dark"] .asset-workbench-detail,
    :root[data-theme="dark"] .ref-project-empty,
    :root[data-theme="dark"] .local-ref-card,
    :root[data-theme="dark"] .img-modal-shell,
    :root[data-theme="dark"] .cdp-asset-picker-actions {
      background: var(--surface-glass);
      border-color: var(--line-soft);
      color: var(--text);
    }
    :root[data-theme="dark"] .project-folder {
      background: transparent;
      color: var(--text);
    }
    :root[data-theme="dark"] .project-folder-tabs {
      background: var(--control-bg);
      border-color: var(--border);
    }
    :root[data-theme="dark"] .project-folder-tab-btn.active {
      background: rgba(56,189,248,.16);
      color: #7dd3fc;
      box-shadow: inset 0 0 0 1px rgba(56,189,248,.2);
    }
    :root[data-theme="dark"] .asset-workbench-list,
    :root[data-theme="dark"] .asset-workbench-count,
    :root[data-theme="dark"] .asset-image-preview,
    :root[data-theme="dark"] .asset-image-empty,
    :root[data-theme="dark"] .preview-empty,
    :root[data-theme="dark"] .preview-media,
    :root[data-theme="dark"] .preview-tag,
    :root[data-theme="dark"] .library-thumb,
    :root[data-theme="dark"] .library-text-card-thumb,
    :root[data-theme="dark"] .ref-empty-icon,
    :root[data-theme="dark"] .ref-empty-meta span,
    :root[data-theme="dark"] .local-ref-btn {
      background: var(--surface-soft);
      border-color: var(--border);
      color: var(--text);
    }
    :root[data-theme="dark"] .asset-workbench-item:hover,
    :root[data-theme="dark"] .asset-workbench-item.active,
    :root[data-theme="dark"] .ref-item:hover {
      background: var(--surface-hover);
      border-color: rgba(56,189,248,.34);
    }
    :root[data-theme="dark"] .project-folder.active {
      background: transparent;
      border-color: transparent;
    }
    :root[data-theme="dark"] .project-folder.active .project-folder-name {
      color: #7dd3fc;
    }
    :root[data-theme="dark"] .img-modal-overlay {
      background: rgba(2,6,23,.72);
    }
    :root[data-theme="dark"] .img-modal-shell.image-shell,
    :root[data-theme="dark"] .img-modal-shell.video-shell,
    :root[data-theme="dark"] .img-modal-shell.image-shell .img-modal-stage,
    :root[data-theme="dark"] .img-modal-shell.video-shell .img-modal-stage {
      background: transparent;
      border-color: transparent;
      box-shadow: none;
    }
    :root[data-theme="dark"] .img-modal-shell.image-shell .img-modal-close,
    :root[data-theme="dark"] .img-modal-shell.video-shell .img-modal-close,
    :root[data-theme="dark"] .img-modal-btn,
    :root[data-theme="dark"] .img-modal-close {
      background: var(--control-bg);
      border-color: var(--border);
      color: var(--text);
    }
    :root[data-theme="dark"] .img-modal-toolbar {
      background: linear-gradient(180deg, rgba(56,189,248,.12), rgba(17,24,39,.96));
      border-bottom-color: var(--border);
    }
    :root[data-theme="dark"] .img-modal-stage {
      background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(17,24,39,.96));
    }
    :root[data-theme="dark"] .tool-btn:hover,
    :root[data-theme="dark"] .action-btn:hover,
    :root[data-theme="dark"] .card-action:hover,
    :root[data-theme="dark"] .select-opt:hover,
    :root[data-theme="dark"] .dropdown-item:hover,
    :root[data-theme="dark"] .assets-tab:hover,
    :root[data-theme="dark"] .library-nav-back:hover {
      background: var(--control-hover);
      border-color: rgba(56,189,248,.38);
      color: var(--accent);
    }
    :root[data-theme="dark"] .tool-btn.primary,
    :root[data-theme="dark"] .send-btn,
    :root[data-theme="dark"] .action-btn.primary,
    :root[data-theme="dark"] .card-action.primary,
    :root[data-theme="dark"] .cdp-subshot-gen,
    :root[data-theme="dark"] .cdp-subshot-gen-video {
      background: var(--accent);
      border-color: var(--accent);
      color: #06131d;
      box-shadow: 0 12px 28px rgba(56,189,248,.2);
    }
    :root[data-theme="dark"] .home-logo,
    :root[data-theme="dark"] .message.ai .role-badge,
    :root[data-theme="dark"] .asset-empty-icon {
      background: linear-gradient(135deg, #0f172a, #2563eb 58%, #34d399);
      color: #fff;
    }
    :root[data-theme="dark"] .quick-icon,
    :root[data-theme="dark"] .asset-thumb,
    :root[data-theme="dark"] .preview-placeholder,
    :root[data-theme="dark"] .library-item-thumb,
    :root[data-theme="dark"] .project-folder-thumb,
    :root[data-theme="dark"] .cdp-asset-preview,
    :root[data-theme="dark"] .img-modal-preview {
      background: #111827;
      border-color: var(--border);
      color: var(--accent);
    }
    :root[data-theme="dark"] .modal-overlay,
    :root[data-theme="dark"] .cdp-asset-picker-backdrop,
    :root[data-theme="dark"] .img-modal-overlay {
      background: rgba(0,0,0,.78);
    }
    :root[data-theme="dark"] .select-opt.selected,
    :root[data-theme="dark"] .dropdown-item.selected,
    :root[data-theme="dark"] .assets-tab.active,
    :root[data-theme="dark"] .cdp-nav-chapter.active,
    :root[data-theme="dark"] .cdp-nav-shot.active,
    :root[data-theme="dark"] .role-mode.task {
      background: rgba(56,189,248,.14);
      border-color: rgba(56,189,248,.34);
      color: var(--accent);
    }
    :root[data-theme="dark"] .style-card.selected,
    :root[data-theme="dark"] .cdp-subshot-done {
      background: rgba(52,211,153,.1);
      border-color: rgba(52,211,153,.38);
    }
    :root[data-theme="dark"] .switch span::before {
      background: #f8fafc;
    }
    .sidebar .sidebar-item .tooltip {
      position: absolute;
      left: calc(100% + 12px);
      top: 50%;
      transform: translateY(-50%);
      z-index: 700;
    }
    .sidebar {
      overflow: visible;
    }
    .sidebar .sidebar-item .tooltip::before {
      right: 100%;
      top: 50%;
      transform: translateY(-50%);
    }
    @media (max-width: 720px) {
      :root {
        --sidebar-width: 60px;
        --sidebar-page-left: 76px;
        --sidebar-page-right: 16px;
        --sidebar-flyout-left: 72px;
      }
      .sidebar { width: var(--sidebar-width); }
      #page-home,
      #page-assets,
      #page-history {
        padding-left: var(--sidebar-page-left);
        padding-right: var(--sidebar-page-right);
      }
      #page-home.chat-mode .input-card {
        left: var(--sidebar-page-left);
      }
      .quick-enter {
        grid-template-columns: repeat(2, 1fr);
      }
      .home-logo {
        width: 64px;
        height: 64px;
      }
    }

/* ===== 历史记录设计优化（2026-09）===== */
.history-group {
  margin-bottom: 18px;
}
.history-group-title {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  padding-left: 2px;
}
.history-list {
  gap: 10px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.history-item:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}
.history-item:hover .history-item-title { color: var(--accent); }
.history-item-kind {
  flex: 0 0 auto;
  min-width: 46px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(24, 167, 125, 0.12));
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}
.history-item-kind.canvas {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(37, 99, 235, 0.14));
  color: #0284c7;
}
.history-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  opacity: 0.55;
  transition: opacity .2s ease;
}
.history-item:hover .history-item-actions { opacity: 1; }
.history-item-actions .action-btn {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
}

/* 深色模式：用户发送消息气泡用深色（与整体深色主题一致） */
:root[data-theme="dark"] .message.user {
  background: linear-gradient(135deg, #1d2436, #1a2131);
  color: var(--text);
  border-color: rgba(47, 53, 67, 0.9);
}
:root[data-theme="dark"] .message.user .msg-role { color: var(--muted); }

/* 历史记录 hover 与背景再优化（2026-09） */
.history-item {
  position: relative;
  background: var(--soft);
  overflow: hidden;
}
.history-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16%;
  bottom: 16%;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2, #18a77d));
  opacity: 0;
  transition: opacity .2s ease;
}
.history-item:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(24, 167, 125, 0.05)), var(--panel);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  transform: translateY(-2px);
}
.history-item:hover::before { opacity: 1; }
:root[data-theme="dark"] .history-item {
  background: #141a2c;
}
:root[data-theme="dark"] .history-item:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(52, 211, 153, 0.08)), #171e33;
  border-color: var(--accent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
}

/* 输入框背景：纯色不透明（去掉透明度/毛玻璃） */
.input-card,
#page-home.chat-mode .input-card {
  background: var(--panel) !important;
}

/* 历史记录 hover 微调：无移动、无指示条、内容间距正常 */
.history-item::before { display: none !important; }
.history-item:hover {
  transform: none !important;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(24, 167, 125, 0.03)), var(--panel) !important;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
:root[data-theme="dark"] .history-item:hover {
  transform: none !important;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.10), rgba(52, 211, 153, 0.06)), #171e33 !important;
}
.history-item { padding: 14px 16px; }

/* 历史记录：默认无背景色（透明），hover 时才显示高亮背景 */
.history-item {
  background: transparent !important;
}
:root[data-theme="dark"] .history-item {
  background: transparent !important;
}

/* 历史记录 hover 最终版：背景为边缘内衬环（内容区保持透明，四周有间距），无填充背景 */
.history-item:hover {
  background: transparent !important;
  box-shadow:
    inset 0 0 0 5px rgba(37, 99, 235, 0.07),
    inset 0 0 0 1px rgba(37, 99, 235, 0.25),
    0 4px 14px rgba(15, 23, 42, 0.08) !important;
  border-color: var(--accent);
}
:root[data-theme="dark"] .history-item:hover {
  background: transparent !important;
  box-shadow:
    inset 0 0 0 5px rgba(56, 189, 248, 0.10),
    inset 0 0 0 1px rgba(56, 189, 248, 0.35),
    0 6px 18px rgba(0, 0, 0, 0.35) !important;
  border-color: var(--accent);
}

/* 历史记录 hover：去掉环特效，恢复填充背景 + 加大内容左右 padding（内容与背景边缘间距更大） */
.history-item {
  padding: 14px 28px !important;
}
.history-item:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(24, 167, 125, 0.04)), var(--panel) !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08) !important;
  border-color: var(--accent);
}
:root[data-theme="dark"] .history-item:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.10), rgba(52, 211, 153, 0.06)), #171e33 !important;
}

/* 历史记录 hover 再简化：只变背景色，无边框高亮、无阴影 */
.history-item:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(24, 167, 125, 0.05)), var(--panel) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .history-item:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(52, 211, 153, 0.07)), #171e33 !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

/* ===== 用户中心 v2 ===== */
    .user-panel-hero {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 18px 18px 16px;
      margin: 0 0 14px;
      border-radius: 16px;
      background: linear-gradient(135deg, rgba(0,163,255,.10), rgba(167,139,250,.12));
      border: 1px solid rgba(0,163,255,.22);
      position: relative;
      overflow: hidden;
    }
    .user-panel-hero::after {
      content: '';
      position: absolute;
      right: -40px;
      top: -70px;
      width: 190px;
      height: 190px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(0,163,255,.16), transparent 70%);
      pointer-events: none;
    }
    .up-hero-avatar {
      width: 52px;
      height: 52px;
      border-radius: 14px;
      flex-shrink: 0;
      background: linear-gradient(135deg, var(--accent), #a78bfa);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      font-weight: 900;
      box-shadow: 0 6px 16px rgba(0,163,255,.30);
    }
    .up-hero-main { flex: 1; min-width: 0; }
    .up-hero-name {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 16px;
      font-weight: 900;
      color: var(--text);
    }
    .up-badge {
      display: inline-flex;
      align-items: center;
      height: 18px;
      padding: 0 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 800;
      line-height: 1;
      white-space: nowrap;
    }
    .up-badge.admin {
      background: rgba(0,163,255,.13);
      color: var(--accent);
      border: 1px solid rgba(0,163,255,.35);
    }
    .up-badge.vip {
      background: color-mix(in srgb, var(--vip-color) 15%, transparent);
      color: var(--vip-color);
      border: 1px solid color-mix(in srgb, var(--vip-color) 45%, transparent);
    }
    .up-hero-meta {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 5px;
      font-size: 11px;
      color: var(--muted);
      font-weight: 700;
    }
    .up-dot { opacity: .5; }
    .up-email-chip { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
    .up-chip-ico { width: 12px; height: 12px; opacity: .75; flex-shrink: 0; }
    .up-quota-pill {
      flex-shrink: 0;
      min-width: 96px;
      text-align: right;
      padding: 10px 14px;
      border-radius: 14px;
      background: var(--panel);
      border: 1px solid rgba(0,163,255,.25);
      box-shadow: 0 6px 18px rgba(15,23,42,.08);
    }
    .up-quota-value { font-size: 22px; font-weight: 900; color: var(--accent); line-height: 1.1; }
    .up-quota-label { font-size: 10px; color: var(--muted); font-weight: 800; margin-top: 2px; }

    .user-panel-tabs {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
      padding: 5px;
      margin-bottom: 14px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--soft);
    }
    .user-panel-tab {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      border: 0;
      border-radius: 10px;
      background: transparent;
      color: var(--muted);
      font: inherit;
      font-size: 12px;
      font-weight: 900;
      padding: 9px 10px;
      cursor: pointer;
      transition: .18s;
    }
    .user-panel-tab:hover { color: var(--text); }
    .user-panel-tab.active {
      background: var(--panel);
      color: var(--accent);
      box-shadow: 0 4px 14px rgba(15,23,42,.10);
    }
    .up-tab-ico { width: 15px; height: 15px; }

    .user-panel-body { display: flex; flex-direction: column; gap: 12px; }
    .user-panel-card {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--panel);
      padding: 14px 16px;
    }
    .up-card-head {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
      padding-bottom: 10px;
      border-bottom: 1px dashed var(--border);
      font-size: 12px;
      font-weight: 900;
      color: var(--text);
    }
    .up-card-ico { width: 15px; height: 15px; color: var(--accent); }
    .up-status-badge {
      display: inline-flex;
      align-items: center;
      height: 18px;
      padding: 0 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 800;
      line-height: 1;
      white-space: nowrap;
    }
    .up-status-badge.ok { background: rgba(16,185,129,.13); color: #10b981; }
    .up-status-badge.warn { background: rgba(245,158,11,.14); color: #f59e0b; }
    .up-status-badge.none { background: var(--soft); color: var(--muted); }
    .up-email-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
    .up-edit-block { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 4px; }
    .up-field-row { display: flex; gap: 8px; align-items: center; }

    .up-balance-line {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      margin: 2px 0 10px;
      padding: 10px 12px;
      border-radius: 12px;
      background: linear-gradient(135deg, rgba(0,163,255,.10), rgba(167,139,250,.10));
      border: 1px solid rgba(0,163,255,.20);
    }
    .up-balance-line span { font-size: 11px; font-weight: 800; color: var(--muted); }
    .up-balance-line b { font-size: 20px; font-weight: 900; color: var(--accent); }
    .up-redeem-row { display: flex; gap: 8px; margin-top: 6px; }
    .up-package-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .up-recharge-card { position: relative; padding: 16px 12px 14px; text-align: center; overflow: hidden; }
    .up-pkg-icon {
      width: 44px;
      height: 44px;
      margin: 0 auto 8px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(135deg, rgba(0,163,255,.14), rgba(167,139,250,.13));
    }
    .up-pkg-ico { width: 22px; height: 22px; color: var(--accent); }
    .up-pkg-amount { font-size: 16px; font-weight: 900; color: var(--text); }
    .up-pkg-price { font-size: 13px; font-weight: 800; color: var(--muted); margin-top: 2px; }
    .up-pkg-bonus {
      display: inline-flex;
      margin-top: 7px;
      padding: 2px 8px;
      border-radius: 999px;
      background: rgba(245,158,11,.14);
      color: #f59e0b;
      font-size: 10px;
      font-weight: 800;
    }
    .up-admin-card { padding: 10px; }

    :root[data-theme="dark"] .user-panel-hero {
      background: linear-gradient(135deg, rgba(56,189,248,.14), rgba(167,139,250,.12));
      border-color: rgba(56,189,248,.30);
    }
    :root[data-theme="dark"] .user-panel-hero::after {
      background: radial-gradient(circle, rgba(56,189,248,.14), transparent 70%);
    }
    :root[data-theme="dark"] .user-panel-card {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }
    :root[data-theme="dark"] .up-quota-pill {
      background: var(--surface-glass);
      border-color: rgba(56,189,248,.28);
    }
    :root[data-theme="dark"] .up-badge.admin {
      background: rgba(56,189,248,.14);
      color: #7dd3fc;
      border-color: rgba(56,189,248,.4);
    }
    :root[data-theme="dark"] .up-balance-line {
      background: linear-gradient(135deg, rgba(56,189,248,.12), rgba(167,139,250,.10));
      border-color: rgba(56,189,248,.24);
    }
    :root[data-theme="dark"] .up-pkg-icon {
      background: linear-gradient(135deg, rgba(56,189,248,.16), rgba(167,139,250,.15));
    }

    @media (max-width: 560px) {
      .up-quota-pill { display: none; }
      .user-panel-hero { padding: 14px; }
      .up-field-row { flex-wrap: wrap; }
      .up-package-grid { grid-template-columns: 1fr; }
    }

    :root[data-theme="dark"] .up-recharge-card {
      background: linear-gradient(180deg, #20293c 0%, #181f2e 100%);
      border-color: rgba(96,165,250,.30);
    }
    :root[data-theme="dark"] .up-recharge-card:hover {
      border-color: var(--accent);
      background: linear-gradient(180deg, #232d42 0%, #1a2233 100%);
    }
    :root[data-theme="dark"] .up-pkg-amount { color: #f8fafc; }
    :root[data-theme="dark"] .up-pkg-price { color: #a9b6c9; }
    :root[data-theme="dark"] .up-pkg-icon {
      background: linear-gradient(135deg, rgba(56,189,248,.24), rgba(167,139,250,.22));
    }
    :root[data-theme="dark"] .up-pkg-ico { color: #7dd3fc; }
    :root[data-theme="dark"] .up-balance-line {
      background: linear-gradient(135deg, rgba(56,189,248,.16), rgba(167,139,250,.14));
      border-color: rgba(96,165,250,.32);
    }
    :root[data-theme="dark"] .up-balance-line b { color: #7dd3fc; }
    :root[data-theme="dark"] .up-quota-pill {
      background: #1b2231;
      border-color: rgba(96,165,250,.32);
    }
    :root[data-theme="dark"] .up-quota-value { color: #7dd3fc; }
    :root[data-theme="dark"] .user-panel-hero {
      background: linear-gradient(135deg, rgba(56,189,248,.18), rgba(167,139,250,.15));
      border-color: rgba(96,165,250,.34);
    }
    :root[data-theme="dark"] .up-hero-avatar {
      box-shadow: 0 6px 18px rgba(56,189,248,.35);
    }

    /* 用户中心 v2 SVG 图标：描边跟随 currentColor（浅/深色自适应） */
    .up-tab-ico,
    .up-card-ico,
    .up-chip-ico,
    .up-pkg-ico {
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex-shrink: 0;
    }
    :root[data-theme="dark"] .up-tab-ico,
    :root[data-theme="dark"] .up-card-ico,
    :root[data-theme="dark"] .up-chip-ico {
      color: inherit;
    }
    :root[data-theme="dark"] .up-tab-ico { stroke: currentColor; }

/* ===== 用户中心 v3 简洁版 ===== */
    .up-head {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 2px 2px 14px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 2px;
    }
    .up-avatar {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background: var(--accent);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      font-weight: 900;
      flex-shrink: 0;
    }
    .up-head-main { flex: 1; min-width: 0; }
    .up-name {
      font-size: 15px;
      font-weight: 900;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .up-tag {
      font-style: normal;
      font-size: 10px;
      font-weight: 800;
      color: var(--accent);
      background: rgba(0,163,255,.10);
      border-radius: 999px;
      padding: 2px 7px;
      line-height: 1.4;
    }
    .up-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
    .up-credits { font-size: 11px; color: var(--muted); font-weight: 700; flex-shrink: 0; }
    .up-credits b { font-size: 17px; color: var(--accent); font-weight: 900; margin-right: 2px; }

    .up-tabs {
      display: flex;
      gap: 22px;
      border-bottom: 1px solid var(--border);
      margin: 0 2px 2px;
    }
    .up-tab {
      border: 0;
      background: transparent;
      padding: 10px 2px 9px;
      font: inherit;
      font-size: 13px;
      font-weight: 800;
      color: var(--muted);
      cursor: pointer;
      position: relative;
      transition: color .15s;
    }
    .up-tab:hover { color: var(--text); }
    .up-tab.active { color: var(--text); }
    .up-tab.active::after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      bottom: -1px;
      height: 2px;
      background: var(--accent);
      border-radius: 2px;
    }
    .up-body { padding: 8px 2px 4px; }

    .up-group { padding: 4px 0 8px; }
    .up-group + .up-group { border-top: 1px solid var(--border); margin-top: 6px; }
    .up-group-title { font-size: 11px; font-weight: 800; color: var(--muted); margin: 8px 0 4px; }
    .up-row {
      display: flex;
      align-items: center;
      gap: 12px;
      min-height: 42px;
    }
    .up-row-label { width: 64px; flex-shrink: 0; font-size: 12px; color: var(--muted); font-weight: 700; }
    .up-row-value {
      flex: 1;
      min-width: 0;
      font-size: 12px;
      color: var(--text);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .up-ok { font-style: normal; font-size: 10px; font-weight: 800; color: #10b981; }
    .up-warn { font-style: normal; font-size: 10px; font-weight: 800; color: #f59e0b; }

    .up-btn {
      border: 0;
      background: transparent;
      color: var(--accent);
      font: inherit;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      padding: 6px 10px;
      border-radius: 8px;
      transition: .15s;
      flex-shrink: 0;
    }
    .up-btn:hover { background: rgba(0,163,255,.10); }
    .up-btn.primary { background: var(--accent); color: #fff; }
    .up-btn.primary:hover { background: var(--accent-hover); }

    .up-edit { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 6px 76px; }
    .up-edit-line { display: flex; gap: 8px; align-items: center; }
    .up-edit-hint { font-size: 10px; color: var(--muted); }

    .up-balance {
      display: flex;
      align-items: baseline;
      gap: 8px;
      padding: 6px 0 2px;
      font-size: 12px;
      color: var(--muted);
      font-weight: 700;
    }
    .up-balance b { font-size: 22px; font-weight: 900; color: var(--accent); }
    .up-desc { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 2px 0 8px; }
    .up-redeem { display: flex; gap: 8px; margin: 10px 0 2px; }
    .up-pkgs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
    .up-pkg {
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--soft);
      padding: 14px 10px 12px;
      text-align: center;
      cursor: pointer;
      transition: .15s;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      font: inherit;
    }
    .up-pkg:hover { border-color: var(--accent); }
    .up-pkg-ico {
      width: 22px;
      height: 22px;
      fill: none;
      stroke: var(--accent);
      stroke-width: 1.7;
      stroke-linecap: round;
      stroke-linejoin: round;
      margin-bottom: 6px;
    }
    .up-pkg-amt { font-size: 15px; font-weight: 900; color: var(--text); }
    .up-pkg-price { font-size: 12px; font-weight: 700; color: var(--muted); }
    .up-pkg-bonus { font-style: normal; font-size: 10px; font-weight: 800; color: #f59e0b; }
    .up-admin-btn {
      width: 100%;
      margin-top: 12px;
      padding: 10px;
      border: 1px dashed var(--border);
      border-radius: 10px;
      background: transparent;
      color: var(--accent);
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      transition: .15s;
    }
    .up-admin-btn:hover { border-color: var(--accent); background: rgba(0,163,255,.06); }

    :root[data-theme="dark"] .up-tag {
      background: rgba(56,189,248,.14);
      color: #7dd3fc;
    }
    :root[data-theme="dark"] .up-credits b { color: #7dd3fc; }
    :root[data-theme="dark"] .up-btn:hover { background: rgba(56,189,248,.14); }
    :root[data-theme="dark"] .up-pkg {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }
    :root[data-theme="dark"] .up-pkg:hover { border-color: var(--accent); }
    :root[data-theme="dark"] .up-pkg-ico { stroke: #7dd3fc; }
    :root[data-theme="dark"] .up-admin-btn:hover { background: rgba(56,189,248,.08); }

    @media (max-width: 560px) {
      .up-edit { padding-left: 0; }
      .up-edit-line { flex-wrap: wrap; }
      .up-pkgs { grid-template-columns: 1fr; }
    }

/* ===== 积分会员页 ===== */
    #page-credits {
      padding: 28px var(--sidebar-page-right) 40px var(--sidebar-page-left);
      align-items: stretch;
      justify-content: center;
    }
    .credits-shell { width: 100%; max-width: 1080px; margin: 0 auto; }
    .credits-header {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 22px;
    }
    .credits-title { font-size: 24px; font-weight: 900; color: var(--text); }
    .credits-subtitle { font-size: 12px; color: var(--muted); margin-top: 6px; }
    .credits-home-btn {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      padding: 8px 14px;
      cursor: pointer;
      transition: .15s;
      flex-shrink: 0;
    }
    .credits-home-btn:hover { border-color: var(--accent); color: var(--accent); }
    .credits-empty { text-align: center; padding: 60px 0; color: var(--muted); font-size: 13px; }

    .credits-overview {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 24px;
    }
    .co-card.co-primary .co-value { color: var(--accent); }
    .co-card {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--panel);
      padding: 16px;
    }
    .co-label { font-size: 11px; font-weight: 800; color: var(--muted); }
    .co-value { font-size: 24px; font-weight: 900; color: var(--text); margin-top: 6px; line-height: 1.1; }
    .co-sub { font-size: 10px; color: var(--muted); margin-top: 4px; }
    .co-vip.is-vip { border-color: rgba(245,185,66,.45); }
    .co-vip.is-vip .co-value { color: #e5a23d; }
    .co-vip.is-vip .co-label { color: #c98a1e; }

    .credits-columns {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 16px;
      align-items: start;
    }
    .credits-section {
      border: 1px solid var(--border);
      border-radius: 16px;
      background: var(--panel);
      padding: 20px;
    }
    .credits-section-title { font-size: 15px; font-weight: 900; color: var(--text); display: flex; align-items: center; gap: 8px; }
    .credits-section-title::before {
      content: '';
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent);
      display: inline-block;
    }
    .credits-section-desc { font-size: 11px; color: var(--muted); margin: 6px 0 14px; line-height: 1.5; }

    .vip-plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    .vip-plan-card {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--soft);
      padding: 16px 14px;
      text-align: left;
      cursor: pointer;
      transition: .15s;
      font: inherit;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .vip-plan-card:hover { border-color: var(--accent); transform: translateY(-2px); }
    .vpc-top { display: flex; align-items: center; justify-content: space-between; }
    .vpc-icon .up-pkg-ico { width: 24px; height: 24px; stroke: #e5a23d; }
    .vpc-tag {
      font-size: 10px;
      font-weight: 800;
      color: #c98a1e;
      background: rgba(245,185,66,.14);
      border-radius: 999px;
      padding: 3px 8px;
    }
    .vpc-name { font-size: 14px; font-weight: 900; color: var(--text); }
    .vpc-price { font-size: 11px; color: var(--muted); }
    .vpc-price b { font-size: 22px; font-weight: 900; color: #e5a23d; margin-right: 2px; }
    .vpc-benefits { display: flex; flex-direction: column; gap: 4px; border-top: 1px dashed var(--border); padding-top: 8px; }
    .vpc-benefits div { font-size: 10px; color: var(--muted); line-height: 1.5; }
    .vpc-benefits div::before { content: '✓ '; color: #10b981; font-weight: 900; }

    .credits-redeem { display: flex; gap: 8px; margin: 4px 0 14px; }
    .credits-section .pay-channel-group { margin: 0 0 4px; }

    :root[data-theme="dark"] .credits-home-btn,
    :root[data-theme="dark"] .co-card,
    :root[data-theme="dark"] .credits-section {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }
    :root[data-theme="dark"] .vip-plan-card {
      background: #20283a;
      border-color: rgba(47,53,67,.9);
    }
    :root[data-theme="dark"] .vip-plan-card:hover { border-color: var(--accent); }
    :root[data-theme="dark"] .co-vip.is-vip .co-value { color: #f0b34c; }
    :root[data-theme="dark"] .co-card.co-primary .co-value { color: #7dd3fc; }

    @media (max-width: 900px) {
      .credits-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .credits-columns { grid-template-columns: 1fr; }
      .vip-plan-grid { grid-template-columns: 1fr; }
    }

    .vip-plan-card.is-current {
      border-color: rgba(245,185,66,.55);
      background: linear-gradient(180deg, rgba(245,185,66,.08), transparent 60%);
    }
    .vip-plan-card.is-lower {
      opacity: .62;
    }
    .vip-plan-card.is-lower:hover { opacity: 1; transform: none; }
    .vpc-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .vpc-status {
      font-size: 9px;
      font-weight: 800;
      border-radius: 999px;
      padding: 3px 8px;
      line-height: 1;
    }
    .vpc-status.current { background: rgba(245,185,66,.18); color: #c98a1e; }
    .vpc-status.owned { background: var(--soft); color: var(--muted); }
    .vpc-buy-old-removed { display: none; }
    .vip-plan-card.is-current .vpc-buy { background: #d99a2b; }
    :root[data-theme="dark"] .vip-plan-card.is-current {
      border-color: rgba(245,185,66,.5);
      background: linear-gradient(180deg, rgba(245,185,66,.10), transparent 60%);
    }
    @media (max-width: 700px) {
      .vip-plan-grid { grid-template-columns: 1fr; }
    }

    /* ===== 会员积分状态板块 ===== */
    .credits-status-board {
      border: 1px solid var(--border);
      border-radius: 16px;
      background: var(--panel);
      padding: 20px 22px;
      margin-bottom: 24px;
    }
    .csb-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      flex-wrap: wrap;
    }
    .csb-vip { display: flex; align-items: center; gap: 12px; }
    .csb-vip-icon {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--soft);
      border: 1px solid var(--border);
    }
    .csb-vip-icon .up-pkg-ico { width: 22px; height: 22px; stroke: var(--accent); }
    .csb-vip-name { font-size: 16px; font-weight: 900; color: var(--text); }
    .csb-vip-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
    .csb-nums { display: flex; gap: 28px; }
    .csb-num { text-align: right; }
    .csb-num span { display: block; font-size: 10px; color: var(--muted); font-weight: 800; }
    .csb-num b { font-size: 20px; font-weight: 900; color: var(--text); line-height: 1.3; }
    .csb-num:last-child b { color: var(--accent); }
    .csb-bar {
      margin-top: 16px;
      height: 10px;
      border-radius: 999px;
      background: var(--soft);
      border: 1px solid var(--border);
      overflow: hidden;
    }
    .csb-bar-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, #f59e0b, #e5a23d);
      transition: width .3s ease;
    }
    .csb-foot { margin-top: 8px; font-size: 10px; color: var(--muted); font-weight: 700; }

    :root[data-theme="dark"] .credits-status-board {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }
    :root[data-theme="dark"] .csb-vip-icon {
      background: #20283a;
      border-color: rgba(47,53,67,.9);
    }
    :root[data-theme="dark"] .csb-num:last-child b { color: #7dd3fc; }

    /* ===== Token 使用记录 ===== */
    .usage-summary {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 16px;
    }
    .usage-sum-item {
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--panel);
      padding: 12px 16px;
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 8px;
    }
    .usage-sum-item span { font-size: 11px; font-weight: 800; color: var(--muted); }
    .usage-sum-item b { font-size: 18px; font-weight: 900; color: var(--text); }
    .usage-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .usage-row {
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--panel);
      padding: 12px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
    }
    .usage-main { min-width: 0; }
    .usage-line1 { display: flex; align-items: center; gap: 8px; }
    .usage-type {
      font-size: 10px;
      font-weight: 800;
      border-radius: 999px;
      padding: 2px 8px;
      background: rgba(0,163,255,.12);
      color: var(--accent);
      flex-shrink: 0;
    }
    .usage-type.image { background: rgba(167,139,250,.14); color: #a78bfa; }
    .usage-type.video { background: rgba(245,158,11,.14); color: #f59e0b; }
    .usage-model { font-size: 12px; font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .usage-line2 { font-size: 10px; color: var(--muted); margin-top: 4px; }
    .usage-fail { color: #f04438; font-weight: 800; }
    .usage-metrics { display: flex; gap: 20px; flex-shrink: 0; }
    .usage-metric { text-align: right; }
    .usage-metric span { display: block; font-size: 9px; color: var(--muted); font-weight: 800; }
    .usage-metric b { font-size: 14px; font-weight: 900; color: var(--text); line-height: 1.4; }
    .usage-metric:last-child b { color: var(--accent); }
    .usage-empty { text-align: center; padding: 48px 0; color: var(--muted); font-size: 13px; }

    :root[data-theme="dark"] .usage-sum-item,
    :root[data-theme="dark"] .usage-row {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }
    :root[data-theme="dark"] .usage-metric:last-child b { color: #7dd3fc; }

    .vpc-price-div { color: var(--border); font-weight: 700; }
    .vpc-buy-row { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
    .vpc-buy {
      border: 0;
      border-radius: 10px;
      background: var(--accent);
      color: #fff;
      font: inherit;
      font-size: 12px;
      font-weight: 900;
      text-align: center;
      padding: 9px 0;
      cursor: pointer;
      transition: .15s;
    }
    .vpc-buy:hover { background: var(--accent-hover); }
    .vpc-buy.yearly {
      background: linear-gradient(135deg, #e5a23d, #d99a2b);
      color: #fff;
      border: 0;
      padding: 9px 0;
    }
    .vpc-buy.yearly:hover { background: rgba(0,163,255,.10); }
    .vip-plan-card.is-current .vpc-buy { background: #d99a2b; }
    .vip-plan-card.is-current .vpc-buy.yearly {
      background: transparent;
      color: #c98a1e;
      border-color: #c98a1e;
    }
    .vip-enterprise .vpc-icon .up-pkg-ico { stroke: #a78bfa; }
    .vip-enterprise { grid-row: span 2; display: flex; flex-direction: column; }
    .vip-enterprise .vpc-benefits { flex: 1; }
    .vip-enterprise .vpc-buy-row { margin-top: auto; }
    .vip-enterprise { border-style: dashed; }
    .vpc-buy.contact {
      background: linear-gradient(135deg, #a78bfa, #6f8fff);
      width: 100%;
    }
    .vpc-buy.contact:hover { filter: brightness(1.06); }
    :root[data-theme="dark"] .vpc-buy.yearly:hover { background: rgba(56,189,248,.12); }

    /* ===== 会员/充值 Tab 切换 ===== */
    .credits-tabs {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
      padding: 5px;
      margin-bottom: 16px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--soft);
    }
    .credits-tab {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      border: 0;
      border-radius: 10px;
      background: transparent;
      color: var(--muted);
      font: inherit;
      font-size: 13px;
      font-weight: 900;
      padding: 10px;
      cursor: pointer;
      transition: .18s;
    }
    .credits-tab:hover { color: var(--text); }
    .credits-tab.active {
      background: var(--panel);
      color: var(--accent);
      box-shadow: 0 4px 14px rgba(15,23,42,.10);
    }
    .credits-tab-panel { display: block; }
    :root[data-theme="dark"] .credits-tab.active { color: #7dd3fc; }

    .usage-pager {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin-top: 16px;
      flex-wrap: wrap;
    }
    .usage-page-btns { display: flex; gap: 6px; flex-wrap: wrap; }
    .usage-page-btn {
      min-width: 32px;
      height: 32px;
      padding: 0 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel);
      color: var(--muted);
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      transition: .15s;
    }
    .usage-page-btn:hover { border-color: var(--accent); color: var(--accent); }
    .usage-page-btn.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }
    .usage-page-nav {
      height: 32px;
      padding: 0 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--panel);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      transition: .15s;
    }
    .usage-page-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
    .usage-page-nav:disabled { opacity: .4; cursor: not-allowed; }
    :root[data-theme="dark"] .usage-page-btn,
    :root[data-theme="dark"] .usage-page-nav {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }

    .vpc-group-title {
      font-size: 12px;
      font-weight: 900;
      color: var(--text);
      margin: 2px 0 10px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .vpc-group-note {
      font-style: normal;
      font-size: 10px;
      font-weight: 700;
      color: #c98a1e;
      background: rgba(245,185,66,.14);
      border-radius: 999px;
      padding: 2px 8px;
    }
    .vpc-price-note { font-size: 10px; color: var(--muted); font-weight: 700; }

/* ===== 侧边栏「积分会员」醒目按钮 ===== */
    #sidebarCredits {
      background: linear-gradient(135deg, #f7c04b 0%, #e5a23d 100%);
      border: 1px solid rgba(255, 214, 120, .75);
      color: #fff;
      box-shadow: 0 4px 16px rgba(229, 162, 61, .42), inset 0 1px 0 rgba(255, 255, 255, .35);
    }
    #sidebarCredits .icon { color: #fff; }
    #sidebarCredits .ui-icon { stroke: #fff; }
    #sidebarCredits:hover {
      background: linear-gradient(135deg, #ffcb5e 0%, #efad45 100%);
      color: #fff;
      box-shadow: 0 6px 20px rgba(229, 162, 61, .55), inset 0 1px 0 rgba(255, 255, 255, .4);
    }
    #sidebarCredits.active {
      background: linear-gradient(135deg, #e5a23d 0%, #d18f24 100%);
      color: #fff;
      border-color: rgba(255, 214, 120, .9);
      box-shadow: 0 6px 20px rgba(229, 162, 61, .55);
    }
    #sidebarCredits { min-height: 52px; }
    #sidebarCredits .label {
      color: #fff;
      font-size: 8px;
      font-weight: 900;
      letter-spacing: .3px;
      white-space: nowrap;
      line-height: 1.2;
    }
    :root[data-theme="dark"] #sidebarCredits {
      background: linear-gradient(135deg, #f7c04b 0%, #e5a23d 100%);
      border-color: rgba(255, 214, 120, .75);
      color: #fff;
      box-shadow: 0 4px 18px rgba(229, 162, 61, .5), inset 0 1px 0 rgba(255, 255, 255, .35);
    }
    :root[data-theme="dark"] #sidebarCredits:hover {
      background: linear-gradient(135deg, #ffcb5e 0%, #efad45 100%);
      color: #fff;
      box-shadow: 0 6px 22px rgba(229, 162, 61, .6), inset 0 1px 0 rgba(255, 255, 255, .4);
    }
    :root[data-theme="dark"] #sidebarCredits.active {
      background: linear-gradient(135deg, #e5a23d 0%, #d18f24 100%);
      color: #fff;
      border-color: rgba(255, 214, 120, .9);
      box-shadow: 0 6px 22px rgba(229, 162, 61, .6);
    }

    /* ===== 会员等级卡加高 ===== */
    .vip-plan-card {
      padding: 26px 20px;
      gap: 12px;
      min-height: 280px;
    }
    .vip-plan-card .vpc-price b { font-size: 26px; }
    .vip-plan-card .vpc-benefits { gap: 8px; padding-top: 12px; }
    .vip-plan-card .vpc-benefits div { font-size: 11px; }
    .vip-plan-card .vpc-buy { padding: 13px 0; font-size: 13px; }
    .vip-plan-card .vpc-buy.yearly { padding: 12px 0; }
    .vip-enterprise { min-height: 0; }

    /* ===== 五列网格（含钻石会员后收窄卡片） ===== */
    .vip-plan-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
    .vip-plan-card { padding: 22px 16px; min-height: 300px; gap: 10px; }
    .vip-plan-card .vpc-name { font-size: 13px; }
    .vip-plan-card .vpc-price b { font-size: 22px; }
    .vip-plan-card .vpc-benefits div { font-size: 10px; }
    .vip-plan-card .vpc-buy { padding: 11px 0; font-size: 12px; }
    @media (max-width: 1180px) {
      .vip-plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }

    .vip-plan-card .vpc-price-note {
      display: block;
      margin-top: -4px;
      font-size: 10px;
      color: var(--muted);
      font-weight: 700;
    }

    /* ===== 卡片加高 + 按钮贴底 ===== */
    .vip-plan-grid .vip-plan-card {
      min-height: 380px;
    }
    .vip-plan-grid .vip-plan-card .vpc-buy-row {
      margin-top: auto;
    }

    /* 月付/年付胶囊颜色区分 */
    .vpc-tag.vpc-tag-monthly {
      color: var(--accent);
      background: rgba(0,163,255,.12);
    }
    .vpc-tag.vpc-tag-yearly {
      color: #c98a1e;
      background: rgba(245,185,66,.16);
    }
    :root[data-theme="dark"] .vpc-tag.vpc-tag-monthly { color: #7dd3fc; background: rgba(56,189,248,.14); }

    /* ===== 侧边栏积分会员按钮按等级配色 ===== */
    #sidebarCredits[data-vip-level="bronze"] {
      background: linear-gradient(135deg, #cd7f32 0%, #a05c2a 100%);
      border-color: rgba(224, 170, 110, .8);
      box-shadow: 0 4px 16px rgba(160, 92, 42, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
    }
    #sidebarCredits[data-vip-level="silver"] {
      background: linear-gradient(135deg, #e2e8f0 0%, #9aa7b8 100%);
      border-color: rgba(255, 255, 255, .9);
      box-shadow: 0 4px 16px rgba(148, 163, 184, .45), inset 0 1px 0 rgba(255, 255, 255, .6);
    }
    #sidebarCredits[data-vip-level="silver"] .ui-icon { stroke: #334155; }
    #sidebarCredits[data-vip-level="silver"] .label { color: #334155; }
    #sidebarCredits[data-vip-level="gold"] {
      background: linear-gradient(135deg, #f7c04b 0%, #e5a23d 100%);
      border-color: rgba(255, 214, 120, .75);
      box-shadow: 0 4px 16px rgba(229, 162, 61, .42), inset 0 1px 0 rgba(255, 255, 255, .35);
    }
    #sidebarCredits[data-vip-level="diamond"] {
      background: linear-gradient(135deg, #7dd3fc 0%, #a78bfa 100%);
      border-color: rgba(200, 220, 255, .85);
      box-shadow: 0 4px 18px rgba(167, 139, 250, .5), inset 0 1px 0 rgba(255, 255, 255, .45);
    }
    #sidebarCredits:hover { filter: brightness(1.06); }
    :root[data-theme="dark"] #sidebarCredits[data-vip-level="silver"] {
      background: linear-gradient(135deg, #cbd5e1 0%, #7e8b9e 100%);
    }

    /* 深色模式下等级配色覆盖（压制主题金色规则） */
    :root[data-theme="dark"] #sidebarCredits[data-vip-level="none"] {
      background: linear-gradient(135deg, #f7c04b 0%, #e5a23d 100%);
      border-color: rgba(255, 214, 120, .75);
    }
    :root[data-theme="dark"] #sidebarCredits[data-vip-level="bronze"] {
      background: linear-gradient(135deg, #cd7f32 0%, #a05c2a 100%);
      border-color: rgba(224, 170, 110, .8);
      box-shadow: 0 4px 18px rgba(160, 92, 42, .5), inset 0 1px 0 rgba(255, 255, 255, .3);
    }
    :root[data-theme="dark"] #sidebarCredits[data-vip-level="gold"] {
      background: linear-gradient(135deg, #f7c04b 0%, #e5a23d 100%);
      border-color: rgba(255, 214, 120, .75);
      box-shadow: 0 4px 18px rgba(229, 162, 61, .5), inset 0 1px 0 rgba(255, 255, 255, .35);
    }
    :root[data-theme="dark"] #sidebarCredits[data-vip-level="diamond"] {
      background: linear-gradient(135deg, #7dd3fc 0%, #a78bfa 100%);
      border-color: rgba(200, 220, 255, .85);
      box-shadow: 0 4px 20px rgba(167, 139, 250, .55), inset 0 1px 0 rgba(255, 255, 255, .45);
    }
    :root[data-theme="dark"] #sidebarCredits[data-vip-level="diamond"]:hover,
    :root[data-theme="dark"] #sidebarCredits[data-vip-level="diamond"].active {
      background: linear-gradient(135deg, #8de0ff 0%, #b79dff 100%);
    }

/* ===== 推广产品页（分销员） ===== */
    #page-dist {
      padding: 28px var(--sidebar-page-right) 40px var(--sidebar-page-left);
      align-items: stretch;
      justify-content: center;
    }
    .dist-overview {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 20px;
    }
    .dist-stat {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--panel);
      padding: 16px;
    }
    .dist-stat span { display: block; font-size: 11px; font-weight: 800; color: var(--muted); }
    .dist-stat b { font-size: 24px; font-weight: 900; color: var(--text); margin-right: 2px; }
    .dist-stat em { font-style: normal; font-size: 11px; color: var(--muted); }
    .dist-stat:first-child b { color: var(--accent); }
    .dist-invite-row { display: flex; gap: 8px; margin-top: 4px; }
    .dist-table-wrap { overflow-x: auto; }
    .dist-table { width: 100%; border-collapse: collapse; }
    .dist-table th, .dist-table td { padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); font-size: 12px; }
    .dist-table th { color: var(--muted); font-size: 11px; font-weight: 800; }
    .dist-order-status { font-size: 10px; font-weight: 800; border-radius: 999px; padding: 3px 8px; }
    .dist-order-status.ok { background: rgba(16,185,129,.13); color: #10b981; }
    .dist-order-status.warn { background: rgba(245,158,11,.14); color: #f59e0b; }
    .dist-rules { display: flex; flex-wrap: wrap; gap: 10px; }
    .dist-rule {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--soft);
      padding: 10px 14px;
      font-size: 12px;
      color: var(--muted);
      font-weight: 700;
    }
    .dist-rule b { color: var(--accent); font-weight: 900; }
    .dist-agreement { margin-top: 12px; font-size: 11px; color: var(--muted); line-height: 1.7; border-top: 1px dashed var(--border); padding-top: 10px; }
    :root[data-theme="dark"] .dist-stat {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }
    @media (max-width: 900px) {
      .dist-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .dist-invite-row { flex-wrap: wrap; }
    }

/* 推广页板块间距 */
    #distPageBody {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    #distPageBody .dist-overview { margin-bottom: 4px; }

    .credits-section-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }
    .dist-order-status.fail { background: rgba(240,68,56,.12); color: #f04438; }

/* ===== 历史记录：去掉卡片外边框，仅保留底部细分隔线 ===== */
    .history-item {
      border: 0 !important;
      border-bottom: 1px solid var(--border) !important;
      border-radius: 0 !important;
      box-shadow: none !important;
    }
    .history-item:hover {
      border-bottom-color: var(--border) !important;
    }
    :root[data-theme="dark"] .history-item {
      border-bottom-color: rgba(47,53,67,.85) !important;
    }

    .library-nav-title {
      font-size: 22px !important;
      font-weight: 900;
      line-height: 1.2;
    }

    /* ===== 存储空间卡 ===== */
    .storage-card {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--panel);
      padding: 14px 18px;
      margin-bottom: 14px;
    }
    .stor-top {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
    }
    .stor-title { font-size: 12px; font-weight: 900; color: var(--text); }
    .stor-nums { font-size: 11px; color: var(--muted); font-weight: 700; }
    .stor-nums b { color: var(--accent); font-size: 14px; font-weight: 900; }
    .stor-bar {
      margin-top: 10px;
      height: 8px;
      border-radius: 999px;
      background: var(--soft);
      border: 1px solid var(--border);
      overflow: hidden;
    }
    .stor-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, var(--accent), #18a77d);
      transition: width .3s ease;
    }
    .stor-tip { margin-top: 8px; font-size: 10px; color: var(--muted); }
    :root[data-theme="dark"] .storage-card {
      background: #1b2231;
      border-color: rgba(47,53,67,.95);
    }
    :root[data-theme="dark"] .stor-nums b { color: #7dd3fc; }

    /* ===== 资产库右下角存储空间卡 ===== */
    .assets-storage-badge {
      display: none;
      position: fixed;
      right: 24px;
      bottom: 24px;
      z-index: 90;
      width: 216px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--surface-glass, var(--panel));
      box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14);
      padding: 14px 16px;
      backdrop-filter: blur(10px);
    }
    #page-assets.active .assets-storage-badge { display: block; }
    .asb-label { font-size: 10px; font-weight: 800; color: var(--muted); }
    .asb-nums { margin-top: 3px; font-size: 11px; color: var(--muted); font-weight: 700; }
    .asb-nums b { font-size: 15px; font-weight: 900; color: var(--accent); margin-right: 2px; }
    .asb-bar {
      margin-top: 8px;
      height: 6px;
      border-radius: 999px;
      background: var(--soft);
      border: 1px solid var(--border);
      overflow: hidden;
    }
    .asb-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, var(--accent), #18a77d);
      transition: width .3s ease;
    }
    .asb-tip { margin-top: 6px; font-size: 10px; color: var(--muted); }
    :root[data-theme="dark"] .assets-storage-badge {
      background: rgba(27, 34, 49, 0.92);
      border-color: rgba(47, 53, 67, .95);
    }
    :root[data-theme="dark"] .asb-nums b { color: #7dd3fc; }

    /* 资产库存储指示：极简无卡片 */
    .assets-storage-badge {
      width: 208px;
      padding: 0;
      border: 0;
      background: transparent;
      box-shadow: none;
      backdrop-filter: none;
    }
    .asb-line {
      display: flex;
      align-items: baseline;
      gap: 6px;
      font-size: 10px;
      color: var(--muted);
    }
    .asb-label { font-size: 10px; font-weight: 700; color: var(--muted); }
    .asb-nums { font-size: 10px; color: var(--muted); }
    .asb-nums b { font-size: 11px; font-weight: 900; color: var(--text); margin-right: 1px; }
    .asb-bar {
      margin-top: 4px;
      height: 4px;
      border: 0;
      background: var(--soft);
    }
    .asb-tip { display: none; }
    :root[data-theme="dark"] .assets-storage-badge { background: transparent; }

    /* 资产库存储指示：单行不换行 */
    .assets-storage-badge {
      width: auto;
      max-width: 360px;
      white-space: nowrap;
    }
    .asb-line {
      white-space: nowrap;
      flex-wrap: nowrap;
    }
    .asb-line .asb-label,
    .asb-line .asb-nums {
      white-space: nowrap;
    }

    /* 存储行内嵌于状态板块 */
    .stor-inline {
      margin-top: 14px;
      padding-top: 12px;
      border-top: 1px dashed var(--border);
    }
    .stor-inline .stor-top {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
    }
    .stor-inline .stor-title { font-size: 11px; font-weight: 800; color: var(--muted); }
    .stor-inline .stor-nums { font-size: 11px; color: var(--muted); font-weight: 700; }
    .stor-inline .stor-nums b { color: var(--accent); font-size: 13px; font-weight: 900; }
    .stor-inline .stor-bar {
      margin-top: 8px;
      height: 8px;
      border-radius: 999px;
      background: var(--soft);
      border: 1px solid var(--border);
      overflow: hidden;
    }
    .stor-inline .stor-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, var(--accent), #18a77d);
      transition: width .3s ease;
    }
    :root[data-theme="dark"] .stor-inline .stor-nums b { color: #7dd3fc; }

    /* ===== 状态板块统一行：标签 | 进度条 | 总额与余量 ===== */
    .credits-status-board .csb-head {
      display: flex;
      align-items: center;
      margin-bottom: 14px;
    }
    .csb-row {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 6px 0;
    }
    .csb-row + .csb-row {
      border-top: 0;
      margin-top: 0;
    }
    .csb-row-label {
      flex: 0 0 auto;
      width: 76px;
      font-size: 11px;
      font-weight: 800;
      color: var(--muted);
    }
    .csb-row-bar {
      flex: 1;
      height: 8px;
      border-radius: 999px;
      background: var(--soft);
      border: 1px solid var(--border);
      overflow: hidden;
    }
    .csb-row-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, var(--accent), #18a77d);
      transition: width .3s ease;
    }
    .csb-row.storage .csb-row-fill {
      background: linear-gradient(90deg, #f59e0b, #e5a23d);
    }
    .csb-row-value {
      flex: 0 0 150px;
      width: 150px;
      text-align: right;
      font-size: 11px;
      color: var(--muted);
      font-weight: 700;
      white-space: nowrap;
    }
    .csb-row-value b {
      color: var(--accent);
      font-weight: 900;
    }
    .csb-row.storage .csb-row-value b { color: #e5a23d; }
    :root[data-theme="dark"] .csb-row.storage .csb-row-value b { color: #f0b34c; }

    /* ===== 会员卡等级配色 ===== */
    .vip-plan-card.vip-tier-bronze { border-color: rgba(205, 127, 50, .45); }
    .vip-plan-card.vip-tier-bronze .vpc-icon .up-pkg-ico { stroke: #cd7f32; }
    .vip-plan-card.vip-tier-bronze .vpc-tag { color: #a05c2a; background: rgba(205, 127, 50, .14); }
    .vip-plan-card.vip-tier-bronze .vpc-price b { color: #cd7f32; }
    .vip-plan-card.vip-tier-bronze .vpc-buy { background: #cd7f32; }

    .vip-plan-card.vip-tier-silver { border-color: rgba(148, 163, 184, .5); }
    .vip-plan-card.vip-tier-silver .vpc-icon .up-pkg-ico { stroke: #7e8b9e; }
    .vip-plan-card.vip-tier-silver .vpc-tag { color: #64748b; background: rgba(148, 163, 184, .16); }
    .vip-plan-card.vip-tier-silver .vpc-price b { color: #7e8b9e; }
    .vip-plan-card.vip-tier-silver .vpc-buy { background: #64748b; }

    .vip-plan-card.vip-tier-gold { border-color: rgba(229, 162, 61, .45); }
    .vip-plan-card.vip-tier-gold .vpc-icon .up-pkg-ico { stroke: #e5a23d; }
    .vip-plan-card.vip-tier-gold .vpc-price b { color: #e5a23d; }
    .vip-plan-card.vip-tier-gold .vpc-buy { background: #d99a2b; }

    .vip-plan-card.vip-tier-diamond { border-color: rgba(125, 211, 252, .45); }
    .vip-plan-card.vip-tier-diamond .vpc-icon .up-pkg-ico { stroke: #7dd3fc; }
    .vip-plan-card.vip-tier-diamond .vpc-tag { color: #7c9cf0; background: rgba(167, 139, 250, .14); }
    .vip-plan-card.vip-tier-diamond .vpc-price b { color: #7dd3fc; }
    .vip-plan-card.vip-tier-diamond .vpc-buy { background: linear-gradient(135deg, #7dd3fc, #a78bfa); }

    .vip-plan-card.vip-tier-diamond.is-current {
      border-color: rgba(125, 211, 252, .65);
      background: linear-gradient(180deg, rgba(125, 211, 252, .12), transparent 60%);
    }
    .vip-plan-card.vip-tier-diamond.is-current .vpc-buy {
      background: linear-gradient(135deg, #7dd3fc, #a78bfa);
    }
    .vip-plan-card.vip-tier-diamond .vpc-buy.yearly {
      background: transparent;
      color: #7dd3fc;
      border: 1px solid #7dd3fc;
    }
