/* ============================================================
   三端明暗主题 · 明亮主题覆盖层
   深色为默认（app.css），本文件只负责 [data-theme="light"] 取值。
   加载顺序：app.css / foundation.css 之后。
   ============================================================ */

/* ---------- 主题开关按钮 ---------- */
.theme-toggle { position: relative; }
.theme-toggle svg { grid-area: 1 / 1; }
.theme-toggle .ic-sun { display: block; }
.theme-toggle .ic-moon { display: none; }
html[data-theme="light"] .theme-toggle .ic-sun { display: none; }
html[data-theme="light"] .theme-toggle .ic-moon { display: block; }
.login-theme-toggle {
  position: fixed; top: 18px; right: 18px; z-index: 50;
  background: var(--bg-panel); border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 14px rgba(20, 30, 45, .08);
}

/* ---------- 变量 ---------- */
html[data-theme="light"] {
  --bg-base: #F4F6FA;
  --bg-panel: #FFFFFF;
  --bg-elevated: #EFF3F9;
  --bg-hover: #E7EDF7;
  --border-subtle: #E1E6EF;
  --border-strong: #C6CFDD;
  --text-primary: #151B24;
  --text-secondary: #46536A;
  --text-dim: #68758A;
  --brand: #0A7F66;
  --brand-soft: rgba(10, 127, 102, .10);
  --brand-line: rgba(10, 127, 102, .32);
  --accent: #A65A00;
  --accent-soft: rgba(166, 90, 0, .10);
  --danger: #BF2A22;
  --danger-soft: rgba(191, 42, 34, .10);
  --info: #1B5FC4;
  --info-soft: rgba(27, 95, 196, .10);
  color-scheme: light;
}

html[data-theme="light"] ::selection { background: rgba(10, 127, 102, .22); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #C7D0DD; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #AEBACA; }

/* ---------- 外壳 ---------- */
html[data-theme="light"] .topbar { background: rgba(255, 255, 255, .88); }
html[data-theme="light"] .app-foot { background: rgba(255, 255, 255, .72); }
html[data-theme="light"] .crumb .sep { color: #AEB8C8; }
html[data-theme="light"] .avatar-sm {
  background: linear-gradient(140deg, #DDE7F0, #C9D6E4);
  color: #33415A;
}

/* ---------- 按钮 / 表单 ---------- */
html[data-theme="light"] .btn:hover { border-color: #9CA8BC; }
html[data-theme="light"] .btn.danger { border-color: rgba(191, 42, 34, .38); }
html[data-theme="light"] .btn.primary { color: #FFFFFF; }
html[data-theme="light"] .btn.primary:hover { background: #086B56; border-color: #086B56; }
html[data-theme="light"] .btn .spinner { border-color: rgba(21, 27, 36, .18); }
html[data-theme="light"] .btn.primary .spinner { border-color: rgba(255, 255, 255, .35); border-top-color: #FFFFFF; }
html[data-theme="light"] .input::placeholder,
html[data-theme="light"] .textarea::placeholder { color: #7E899B; }
html[data-theme="light"] .switch { background: #D7DEE9; }
html[data-theme="light"] .switch::after { background: #FFFFFF; box-shadow: 0 1px 2px rgba(20, 30, 45, .22); }
html[data-theme="light"] .switch-row { border-bottom-color: #E6EBF3; }

/* ---------- 表格 / 进度 / 骨架 ---------- */
html[data-theme="light"] .tbl th { background: rgba(246, 248, 252, .85); }
html[data-theme="light"] .tbl td { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .tbl tbody tr:hover { background: #F5F8FC; }
html[data-theme="light"] .tbl tbody tr.selected { background: rgba(10, 127, 102, .07); }
html[data-theme="light"] .progress { background: #E3E9F1; }
html[data-theme="light"] .skeleton { background: linear-gradient(90deg, #E7ECF4 25%, #F1F5FA 37%, #E7ECF4 63%); }
html[data-theme="light"] .thumb { background: #E8EDF4; }
html[data-theme="light"] .project-card .pc-foot .bar-wrap,
html[data-theme="light"] .diff-meter .dm-bar,
html[data-theme="light"] .rank-row .r-bar,
html[data-theme="light"] .tr-bar { background: #E3E9F1; }

/* ---------- 通用列表 / 分隔线 ---------- */
html[data-theme="light"] .list-row,
html[data-theme="light"] .ep-row,
html[data-theme="light"] .task-line,
html[data-theme="light"] .voice-row,
html[data-theme="light"] .rank-row,
html[data-theme="light"] .sg-saved { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .list-row:hover,
html[data-theme="light"] .ep-row:hover,
html[data-theme="light"] .task-line:hover,
html[data-theme="light"] .sg-saved:hover { background: #F5F8FC; }
html[data-theme="light"] .kv,
html[data-theme="light"] .chat-bill-row { border-bottom-color: #E7ECF3; }

/* ---------- 工作台 ---------- */
html[data-theme="light"] .hero {
  background: radial-gradient(120% 140% at 100% 0%, rgba(10, 127, 102, .08), transparent 55%),
              linear-gradient(180deg, #FFFFFF, #F6F9FF);
}
html[data-theme="light"] .hero-stat { border-left-color: rgba(21, 27, 36, .08); }

/* ---------- 剧本 / 分镜 ---------- */
html[data-theme="light"] .script-outline { background: #F2F5FA; }
html[data-theme="light"] .script-page { color: #2A3444; }
html[data-theme="light"] .script-page .char,
html[data-theme="light"] .sg-out p .char,
html[data-theme="light"] .sg-shot-line .sid { color: #1B5FC4; }
html[data-theme="light"] .script-page mark.flag { background: rgba(191, 42, 34, .10); color: #9C201A; }
html[data-theme="light"] .issue-item { background: #F6F8FB; }
html[data-theme="light"] .char-card .cc-photo { background: #E8EDF4; }
html[data-theme="light"] .story-canvas {
  background: #F4F7FB;
  background-image: radial-gradient(#D8E0EA 1px, transparent 1px);
}
html[data-theme="light"] .flow-node { box-shadow: 0 8px 24px rgba(20, 30, 45, .12); }
html[data-theme="light"] .flow-node:hover { border-color: #9DAABE; }
html[data-theme="light"] .flow-node.selected { box-shadow: 0 0 0 1px var(--brand), 0 8px 24px rgba(20, 30, 45, .16); }
html[data-theme="light"] .inspector { box-shadow: -18px 0 40px rgba(20, 30, 45, .12); }
html[data-theme="light"] .dsl { color: #45536A; }

/* ---------- 状态提示 ---------- */
html[data-theme="light"] .badge.draft { background: #F1F4F9; color: #4A5567; border-color: #E2E7EF; }
html[data-theme="light"] .badge.canceled { background: #F1F4F9; color: #68758A; border-color: #E2E7EF; }
html[data-theme="light"] .badge.need_human { color: #8A5200; }
html[data-theme="light"] .alert.warn { color: #8A5200; }
html[data-theme="light"] .alert.danger { color: #9C201A; }
html[data-theme="light"] .alert.info { color: #12459E; }
html[data-theme="light"] .alert.brand { color: #086B56; }
html[data-theme="light"] .step.active .dot { color: #FFFFFF; }

/* ---------- 时间线 ---------- */
html[data-theme="light"] .tl-body { background: #F4F7FB; }
html[data-theme="light"] .tl-label { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .tl-ruler { background: #F7F9FC; }
html[data-theme="light"] .tl-ruler i { background: #E1E6EF; }
html[data-theme="light"] .tl-track { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .tl-track:nth-child(odd) { background: rgba(21, 27, 36, .015); }
html[data-theme="light"] .tl-clip { background: #DCF3EC; border-color: rgba(10, 127, 102, .35); color: #075A48; }
html[data-theme="light"] .tl-clip.audio { background: #E4ECFB; border-color: rgba(27, 95, 196, .30); color: #12459E; }
html[data-theme="light"] .tl-clip.sub { background: #EEEAFB; border-color: rgba(110, 80, 200, .30); color: #5233A8; }
html[data-theme="light"] .tl-clip.bgm { background: #FCF0DC; border-color: rgba(166, 90, 0, .30); color: #8A5200; }
html[data-theme="light"] .tl-clip.sfx { background: #FCE5E3; border-color: rgba(191, 42, 34, .30); color: #9C201A; }
html[data-theme="light"] .tl-clip .clip-handle { background: rgba(21, 27, 36, .10); }
html[data-theme="light"] .preview-mini { background: #F4F7FB; }
html[data-theme="light"] .tl-wave i { background: #7C93BE; }

/* ---------- 小说 / 关系图 ---------- */
html[data-theme="light"] .char-mini .cm-photo { background: #E8EDF4; }
html[data-theme="light"] .char-mini .cm-photo .ph {
  color: #8C99AC;
  background: repeating-linear-gradient(45deg, #E9EEF5, #E9EEF5 6px, #F2F5FA 6px, #F2F5FA 12px);
}
html[data-theme="light"] .rel-canvas {
  background: #F4F7FB;
  background-image: radial-gradient(#D8E0EA 1px, transparent 1px);
}
html[data-theme="light"] .rel-node { box-shadow: 0 6px 18px rgba(20, 30, 45, .12); }
html[data-theme="light"] .rel-label { background: #FFFFFF; }
html[data-theme="light"] .bottom-bar { background: rgba(255, 255, 255, .95); }

/* ---------- 带货 / 平台页 ---------- */
html[data-theme="light"] .prod-card .p-img { background: #E8EDF4; }
html[data-theme="light"] .size-frame { background: #EDF1F7; }
html[data-theme="light"] .wz.active .n { color: #FFFFFF; }
html[data-theme="light"] .asset-tile .at-photo { background: #E8EDF4; }
html[data-theme="light"] .matrix .no { color: #9AA6B8; }
html[data-theme="light"] .chart-svg line { stroke: #E1E6EF; }
html[data-theme="light"] .chart-svg circle { fill: #FFFFFF; }

/* ---------- 弹窗 / 浮层 ---------- */
html[data-theme="light"] .overlay { background: rgba(20, 29, 43, .45); }
html[data-theme="light"] .modal { background: #FFFFFF; box-shadow: 0 24px 70px rgba(20, 30, 45, .22); }
html[data-theme="light"] .modal-foot { background: #F7F9FC; }
html[data-theme="light"] .persona-photo { background: #E8EDF4; }
html[data-theme="light"] .toast { background: #FFFFFF; box-shadow: 0 12px 36px rgba(20, 30, 45, .18); }
html[data-theme="light"] .dropdown { background: #FFFFFF; box-shadow: 0 16px 44px rgba(20, 30, 45, .18); }
html[data-theme="light"] .cmdk { background: rgba(20, 29, 43, .40); }
html[data-theme="light"] .cmdk-card { background: #FFFFFF; box-shadow: 0 24px 70px rgba(20, 30, 45, .22); }

/* ---------- 剧本生成 ---------- */
html[data-theme="light"] .sg-stage .dot { background: #C3CCD9; }
html[data-theme="light"] .sg-out { background: #F8FAFC; }
html[data-theme="light"] .sg-out h2 { border-top-color: #E7ECF3; }
html[data-theme="light"] .sg-out p { color: #33415A; }
html[data-theme="light"] .sg-shot-line .vis { color: #33415A; }
html[data-theme="light"] .sg-plain { background: #F8FAFC; color: #33415A; }
html[data-theme="light"] .diff-view { background: #F7F9FC; }
html[data-theme="light"] .diff-row.add { background: rgba(10, 127, 102, .10); color: #075A48; }
html[data-theme="light"] .diff-row.del { background: rgba(191, 42, 34, .10); color: #9C201A; }

/* ---------- 造片向导 ---------- */
html[data-theme="light"] .pick-box { background: rgba(255, 255, 255, .90); border-color: #C3CCD9; color: #FFFFFF; }
html[data-theme="light"] .prod-card.pick.on .pick-box { color: #FFFFFF; }
html[data-theme="light"] .p-gen.done { color: #68758A; }
html[data-theme="light"] .guide-card { border-color: #D6DEE9; background: #F8FAFC; }
html[data-theme="light"] .wz-banner.warn { color: #8A5200; }
html[data-theme="light"] .wz-banner.info { color: #12459E; }
html[data-theme="light"] .dim-sw { background: #D7DEE9; }
html[data-theme="light"] .dim-sw::after { background: #FFFFFF; }
html[data-theme="light"] .dim-sw.on::after { background: #FFFFFF; }
html[data-theme="light"] .avatar-pick .ap-img { background: #EFF3F9; }
html[data-theme="light"] .avatar-pick .ap-check { border-color: #C3CCD9; color: #FFFFFF; }

/* ---------- 总后台 ---------- */
html[data-theme="light"] .admin-mode .brand-sub { color: #8A6A2E; }
html[data-theme="light"] .admin-mode .sidebar,
html[data-theme="light"] .admin-mode .topbar { border-color: #E7ECF3; }
html[data-theme="light"] .admin-mode .topbar { border-bottom-color: #EADFC8; }
html[data-theme="light"] .adm-eyebrow { color: #68758A; }
html[data-theme="light"] .adm-eyebrow::after { background: linear-gradient(90deg, #DDE4EE, transparent); }
html[data-theme="light"] .adm-kpis .kpi { background: linear-gradient(180deg, #FFFFFF, #FAFBFD); }
html[data-theme="light"] .adm-card-head { background: rgba(246, 248, 252, .70); }
html[data-theme="light"] .adm-card-title svg { color: #68758A; }
html[data-theme="light"] .adm-count { background: #EDF1F7; color: #46536A; }
html[data-theme="light"] .adm-page .table-wrap thead th { background: #F6F8FB; color: #5A6779; border-bottom-color: #E1E6EF; }
html[data-theme="light"] .adm-page .table-wrap tbody td { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .adm-page .table-wrap tbody tr:hover { background: #F5F8FC; }
html[data-theme="light"] .adm-note { border-left-color: #C6CFDD; background: #F7F9FC; color: #46536A; }
html[data-theme="light"] .adm-flag { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .adm-ava { background: #EDF1F7; color: #33415A; }
html[data-theme="light"] .adm-node { border-bottom-color: #E7ECF3; }

/* ---------- 发布中心 ---------- */
html[data-theme="light"] .pb-bar { background: rgba(246, 248, 252, .70); }
html[data-theme="light"] .pb-table th,
html[data-theme="light"] .pb-queue th { background: #F6F8FB; color: #5A6779; }
html[data-theme="light"] .pb-table td,
html[data-theme="light"] .pb-queue td { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .pb-table tbody tr:hover,
html[data-theme="light"] .pb-queue tbody tr:hover { background: #F5F8FC; }
html[data-theme="light"] .pb-off { background: rgba(166, 90, 0, .07); color: #8A5200; }

/* ---------- 租户后台 ---------- */
html[data-theme="light"] .tenant-console .brand-sub { color: #4E5FA8; }
html[data-theme="light"] .tenant-console .sidebar,
html[data-theme="light"] .tenant-console .topbar { border-color: #E4E9F2; }
html[data-theme="light"] .tn-logo { background: #EDF1F7; color: #33415A; }
html[data-theme="light"] .tn-logo-txt { background: linear-gradient(145deg, #E2EFF8, #D5E4F2); color: #0A5A6B; }
html[data-theme="light"] .tn-note { background: #F7F9FC; }
html[data-theme="light"] .tn-banner { color: #075A48; }
html[data-theme="light"] .tn-banner b { color: #064E3E; }
html[data-theme="light"] .tn-q { background: #FFFFFF; }
html[data-theme="light"] .tn-q:hover { background: #F2F8F6; }
html[data-theme="light"] .tn-feat { background: #FFFFFF; }
html[data-theme="light"] .tn-feat.on { background: rgba(10, 127, 102, .06); }
html[data-theme="light"] .tn-logo-lg { background: #F7F9FC; }
html[data-theme="light"] .tn-preview { background: #F4F7FB; }
html[data-theme="light"] .tn-prev-bar { background: #FFFFFF; }
html[data-theme="light"] .tn-prev-tip { background: rgba(10, 127, 102, .05); }
html[data-theme="light"] .tn-domain { background: #FFFFFF; }
html[data-theme="light"] .tn-table thead th { background: #F6F8FB; color: #5A6779; border-bottom-color: #E1E6EF; }
html[data-theme="light"] .tn-table tbody td { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .tn-table tbody tr:hover { background: #F5F8FC; }
html[data-theme="light"] .bc-kv { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .adm-mode-box { background: #F7F9FC; }

/* ---------- 用户端 AI 对话 / 绘画 ---------- */
html[data-theme="light"] .chat-top { background: #F7F9FC; }
html[data-theme="light"] .chat-modebar.platform { color: #8A5200; }
html[data-theme="light"] .chat-modebar.self { color: #075A48; }
html[data-theme="light"] .chat-ava { background: #EDF1F7; color: #33415A; }
html[data-theme="light"] .chat-msg.ai .chat-ava {
  background: linear-gradient(145deg, #E1F3EC, #CFEBE2);
  color: #086B56; border-color: rgba(10, 127, 102, .30);
}
html[data-theme="light"] .chat-bubble { background: #F4F7FB; }
html[data-theme="light"] .chat-msg.user .chat-bubble { color: #075247; }
html[data-theme="light"] .chat-sugg button { background: #FFFFFF; }
html[data-theme="light"] .chat-composer { background: #F7F9FC; }
html[data-theme="light"] .chat-composer textarea { background: #FFFFFF; }
html[data-theme="light"] .chat-tip { background: #F7F9FC; }
html[data-theme="light"] .draw-form textarea { background: #FFFFFF; }
html[data-theme="light"] .draw-chips button { background: #FFFFFF; }
html[data-theme="light"] .draw-item { background: #F7F9FC; }
html[data-theme="light"] .draw-item .di-state { background: rgba(255, 255, 255, .82); color: #46536A; }
html[data-theme="light"] .spin { border-color: rgba(21, 27, 36, .14); }

/* ---------- 登录页 / 地基页（foundation.css） ---------- */
html[data-theme="light"] .login-body {
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(10, 127, 102, .10), transparent 62%),
    radial-gradient(700px 500px at 88% 92%, rgba(27, 95, 196, .08), transparent 60%),
    var(--bg-base);
}
html[data-theme="light"] .login-body::before {
  background-image: linear-gradient(rgba(21, 27, 36, .035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(21, 27, 36, .035) 1px, transparent 1px);
}
html[data-theme="light"] .login-shell { background: rgba(255, 255, 255, .94); box-shadow: 0 32px 90px rgba(20, 30, 45, .16); }
html[data-theme="light"] .login-aside {
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(10, 127, 102, .14), transparent 70%),
    linear-gradient(160deg, rgba(10, 127, 102, .05), rgba(255, 255, 255, .40) 55%, rgba(27, 95, 196, .05));
}
html[data-theme="light"] .login-blocked { color: #9C201A; }
html[data-theme="light"] .login-point i { background: rgba(10, 127, 102, .10); border-color: rgba(10, 127, 102, .18); }
html[data-theme="light"] .login-entry-tag { border-color: rgba(10, 127, 102, .28); }
html[data-theme="light"] .login-tenant .dot { box-shadow: 0 0 0 3px rgba(10, 127, 102, .12); }
html[data-theme="light"] .f-hero {
  background:
    radial-gradient(520px 220px at 88% 0%, rgba(10, 127, 102, .12), transparent 65%),
    linear-gradient(145deg, #FFFFFF, #F5F9FE);
}
html[data-theme="light"] .f-list-item { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .f-list-item:hover { background: #F5F8FC; }
html[data-theme="light"] .f-avatar {
  background: linear-gradient(140deg, rgba(10, 127, 102, .16), rgba(27, 95, 196, .12));
  color: #075A48; border-color: rgba(10, 127, 102, .18);
}
html[data-theme="light"] .f-project-cover { background: linear-gradient(150deg, #DCE8F0, #E9F0F7 60%, #DDE9F2); }
html[data-theme="light"] .f-placeholder { background: rgba(255, 255, 255, .65); }
html[data-theme="light"] .f-blocked-card { box-shadow: 0 20px 60px rgba(20, 30, 45, .14); }
html[data-theme="light"] .f-toast { background: #FFFFFF; box-shadow: 0 14px 36px rgba(20, 30, 45, .18); }
html[data-theme="light"] .f-toast.err { color: #9C201A; }

/* ============================================================
   布局与密度（统一扩展，三端共用）
   仅补充间距 / 字号 / 圆角 / 表格密度，不引入新主题体系。
   ============================================================ */
:root {
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px;
  --radius-sm: 8px; --radius-lg: 14px;
  --control-h: 30px; --cell-pad-y: 9px; --cell-pad-x: 12px;
}

/* 筛选区：自动换行，按钮不挤压字段 */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); }
.filter-bar .input,
.filter-bar .select { width: auto; height: 32px; min-width: 150px; flex: 0 0 auto; }
.filter-bar > .input { flex: 1 1 220px; max-width: 320px; }
.filter-bar .filter-actions { margin-left: auto; }
.filter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); }
.filter-grid .field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-grid .field > span { font-size: var(--fs-11); color: var(--text-dim); }
.filter-grid .field .input,
.filter-grid .field .select { width: 100%; height: 32px; }
.filter-grid .field-check .check-line {
  display: flex; align-items: center; gap: 6px; height: 32px;
  font-size: var(--fs-12); color: var(--text-secondary);
}

/* 统计栅格：任务类型 / KPI 复用 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-2); }
.stat-tile {
  min-width: 0; padding: 10px 12px;
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.stat-tile .st-label { font-size: var(--fs-11); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile .st-val { margin-top: 2px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-tile .st-sub { margin-top: 2px; font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile-total { background: var(--brand-soft); border-color: var(--brand-line); }

/* 表格密度与长文案 */
.cell-nowrap { white-space: nowrap; }
.cell-ellipsis { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-col { white-space: nowrap; text-align: right; }
.actions-col .btn { margin-left: 4px; }
.head-actions { flex-wrap: wrap; }
.tn-note { line-height: 1.7; overflow-wrap: anywhere; }
.table-wrap table { min-width: 640px; }

html[data-theme="light"] .stat-tile { background: #F6F8FC; }
html[data-theme="light"] .stat-tile-total { background: rgba(10, 127, 102, .07); }

@media (max-width: 720px) {
  .filter-bar .filter-actions { margin-left: 0; }
  .filter-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   视觉体系 v2 · 三端统一设计语言
   令牌 → 外壳 → 组件 → 页面密度 → 响应式。
   深色为默认取值，明亮主题在段落末尾统一覆盖。
   仅改视觉，不改变任何布局结构与交互语义。
   ============================================================ */
:root {
  /* 表面层级（由深到浅：底 → 面板 → 悬浮） */
  --surface-1: #0E1116;
  --surface-2: #151A23;
  --surface-3: #1B2130;
  /* 阴影与描边 */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, .38);
  --shadow-brand: 0 6px 18px rgba(24, 199, 160, .16);
  --line-soft: #1E2431;
  /* 尺寸刻度 */
  --radius-xs: 6px;
  --radius-md: 10px;
  --radius-xl: 16px;
  --fs-10: 10px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-22: 22px;
  --gutter: 16px;
}

/* ---------- 外壳：侧栏 / 顶栏 ---------- */
.sidebar { background: var(--bg-panel); border-right-color: var(--border-subtle); }
.brand { height: 58px; padding: 0 20px; }
.nav-scroll { padding: 14px 12px 10px; }
.nav-group { margin-bottom: 16px; }
.nav-label { padding: 0 12px 6px; font-size: var(--fs-10); letter-spacing: 1.2px; color: var(--text-dim); }
.nav-item { height: 36px; padding: 0 12px; border-radius: 9px; font-size: 13px; color: var(--text-secondary); }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 550; }
.nav-item.active::before { top: 10px; bottom: 10px; width: 3px; border-radius: 3px; }
.sidebar-foot { padding: 12px; }
.collapse-btn { height: 32px; border-radius: 8px; }

.topbar { height: 58px; flex: 0 0 58px; padding: 0 24px; gap: 16px; }
.crumb { font-size: 12.5px; }
.search { height: 32px; min-width: 240px; border-radius: 9px; }
.search:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.credits-chip { height: 32px; border-radius: 9px; }
.icon-btn { width: 32px; height: 32px; border-radius: 9px; }
.user-chip { padding: 3px 10px 3px 3px; border-radius: 999px; }

/* ---------- 页面骨架：页头 / 分节 ---------- */
.page { max-width: 1480px; padding: 24px 28px 64px; }
.page-head {
  align-items: center; gap: 20px;
  padding-bottom: 16px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.h1 { font-size: var(--fs-22); line-height: 1.25; letter-spacing: -.4px; font-weight: 600; }
.page-sub { margin-top: 5px; font-size: 12.5px; line-height: 1.65; color: var(--text-secondary); max-width: 860px; }
.head-actions { gap: 10px; }
.section { margin-top: 26px; }
.section-head { margin-bottom: 12px; gap: 12px; }
.section-title { font-size: 13.5px; font-weight: 600; }
.section-title .dim { font-size: 11px; }
.grid { gap: var(--gutter); }
.split { gap: var(--gutter); }

/* ---------- 按钮：主次 / 尺寸 / 焦点 ---------- */
.btn {
  height: 32px; padding: 0 13px; border-radius: 9px;
  font-size: 12.5px; font-weight: 550; border-color: var(--border-strong);
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, transform .1s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary {
  background: linear-gradient(180deg, #1FD3AA, #14AE8C);
  border-color: #17B795; color: #04231B; font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, var(--shadow-brand);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #28DDB3, #16BA96);
  border-color: #1CC29D;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 8px 22px rgba(24, 199, 160, .22);
}
.btn.ghost { border-color: transparent; color: var(--text-secondary); }
.btn.ghost:hover { color: var(--text-primary); }
.btn.danger { border-color: rgba(240, 82, 77, .38); }
.btn.danger:hover { background: var(--danger-soft); border-color: rgba(240, 82, 77, .55); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: 7px; }
.btn.lg { height: 38px; padding: 0 18px; font-size: 13px; border-radius: 10px; }

/* ---------- 容器：面板 / KPI ---------- */
.panel {
  background: var(--bg-panel); border-color: var(--border-subtle);
  border-radius: 14px; box-shadow: var(--shadow-1);
}
.panel-head {
  padding: 13px 18px; min-height: 50px; gap: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .018), transparent);
}
.panel-title { font-size: 13px; }
.panel-title .dim { font-size: 11px; }
.panel-body { padding: 18px; }
.panel-foot { padding: 12px 18px; gap: 10px; }
.kpi {
  padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-2), var(--bg-panel));
  border-color: var(--border-subtle); box-shadow: var(--shadow-1);
}
.kpi .k-label { font-size: 11.5px; }
.kpi .k-val { font-size: 26px; letter-spacing: -.6px; }
.kpi .k-foot { font-size: 11px; }
.kpi.clickable:hover { background: linear-gradient(180deg, var(--surface-3), var(--bg-panel)); }

/* ---------- 表格：表头 / 行高 / 操作列 ---------- */
.table-wrap { overflow-x: auto; scrollbar-gutter: stable; }
.tbl { font-size: 12.5px; }
.tbl th {
  padding: 10px 14px; font-size: 11px; font-weight: 600; letter-spacing: .5px;
  color: var(--text-dim); background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.tbl td { padding: 12px 14px; border-bottom-color: var(--border-subtle); }
.tbl tbody tr { transition: background .14s; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr.selected { background: var(--brand-soft); }
.tbl .actions { opacity: .72; gap: 6px; }
.tbl tr:hover .actions { opacity: 1; }
/* 紧凑面板内的表格首末列与容器对齐 */
.panel-body.tight .tbl th:first-child,
.panel-body.tight .tbl td:first-child { padding-left: 18px; }
.panel-body.tight .tbl th:last-child,
.panel-body.tight .tbl td:last-child { padding-right: 18px; }

/* ---------- 表单 ---------- */
.input, .select, .textarea { border-radius: 9px; border-color: var(--border-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-line);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.label { font-size: 12px; }
.hint { font-size: 11.5px; line-height: 1.6; }
.switch-row { padding: 10px 0; border-bottom-color: var(--line-soft); }

/* ---------- 标签 / 徽标 / 分段 ---------- */
.tag { height: 22px; padding: 0 7px; border-radius: var(--radius-xs); font-size: 11px; }
.tag.lg { height: 25px; font-size: 11.5px; }
.badge { height: 22px; padding: 0 8px; border-radius: var(--radius-xs); font-size: 11px; }
.badge.draft, .badge.canceled { background: var(--surface-2); border-color: var(--border-subtle); }
.tabs { gap: 4px; margin-bottom: 18px; }
.tab { height: 36px; padding: 0 14px; font-size: 13px; }
.tab:hover { background: var(--bg-hover); border-radius: 8px 8px 0 0; }
.tab.active { font-weight: 600; }
.seg { background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { height: 28px; padding: 0 12px; border-radius: 8px; font-size: 12px; }
.seg button.active { background: var(--bg-panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .28); }

/* ---------- 空态 / 加载态 ---------- */
.empty { padding: 48px 24px; gap: 10px; }
.empty > svg {
  width: 44px; height: 44px; padding: 10px; box-sizing: border-box;
  border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--border-subtle); color: var(--text-secondary); opacity: .9;
}
.empty .e-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.empty .e-desc { font-size: 12px; line-height: 1.7; max-width: 380px; color: var(--text-dim); }
.empty .btn { margin-top: 4px; }
.skeleton { border-radius: 8px; }
.progress { height: 6px; }

/* ---------- 列表 / 卡片 ---------- */
.list-row { padding: 11px 6px; border-bottom-color: var(--border-subtle); }
.list-row:hover { background: var(--bg-hover); }
.list-row .li-title { font-size: 12.5px; }
.list-row .li-sub { font-size: 11px; }
.project-card, .prod-card, .asset-tile { border-radius: 12px; box-shadow: var(--shadow-1); }
.project-card:hover, .prod-card:hover, .asset-tile:hover { box-shadow: var(--shadow-2); }

/* ---------- 弹窗 / 提示 ---------- */
.modal {
  border-radius: var(--radius-xl); background: var(--bg-panel);
  border-color: var(--border-strong);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}
.modal-head { padding: 18px 20px 14px; }
.modal-title { font-size: 15px; letter-spacing: -.2px; }
.modal-sub { font-size: 12px; margin-top: 3px; line-height: 1.6; }
.modal-body { padding: 2px 20px 18px; }
.modal-foot { padding: 14px 20px; background: var(--surface-1); }
.toast { border-radius: 12px; }
.dropdown { border-radius: 12px; }

/* ---------- 明亮主题取值 ---------- */
html[data-theme="light"] {
  --surface-1: #F7F9FC;
  --surface-2: #F2F5FA;
  --surface-3: #E9EEF6;
  --shadow-1: 0 1px 2px rgba(20, 30, 45, .06);
  --shadow-2: 0 12px 32px rgba(20, 30, 45, .12);
  --shadow-brand: 0 6px 18px rgba(10, 127, 102, .16);
  --line-soft: #E7ECF3;
}
html[data-theme="light"] .btn.primary {
  background: linear-gradient(180deg, #0E9878, #08705B);
  border-color: #0A7F66; color: #FFFFFF;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 4px 14px rgba(10, 127, 102, .16);
}
html[data-theme="light"] .btn.primary:hover {
  background: linear-gradient(180deg, #10A583, #087A62);
  border-color: #0A7F66;
}
html[data-theme="light"] .panel { box-shadow: 0 1px 2px rgba(20, 30, 45, .05); }
html[data-theme="light"] .panel-head { background: linear-gradient(180deg, rgba(20, 30, 45, .012), transparent); }
html[data-theme="light"] .kpi { background: linear-gradient(180deg, #FFFFFF, #FAFCFF); }
html[data-theme="light"] .kpi.clickable:hover { background: linear-gradient(180deg, #FFFFFF, #F4F8FD); }
html[data-theme="light"] .tbl th { background: #F5F8FC; color: #5A6779; border-bottom-color: #E1E6EF; }
html[data-theme="light"] .tbl tbody tr:hover { background: #F6F9FD; }
html[data-theme="light"] .tag { background: #F4F7FB; border-color: #E1E6EF; }
html[data-theme="light"] .badge.draft,
html[data-theme="light"] .badge.canceled { background: #F2F5FA; border-color: #E1E6EF; }
html[data-theme="light"] .seg { background: #F1F4F9; }
html[data-theme="light"] .seg button.active { background: #FFFFFF; box-shadow: 0 1px 2px rgba(20, 30, 45, .12); }
html[data-theme="light"] .empty > svg { background: #F4F7FB; border-color: #E1E6EF; }
html[data-theme="light"] .switch-row { border-bottom-color: #E7ECF3; }
html[data-theme="light"] .search:hover { background: #FFFFFF; }
html[data-theme="light"] .modal-foot { background: #F7F9FC; }

/* ---------- 响应式密度 ---------- */
@media (max-width: 1360px) {
  .page { padding: 20px 22px 56px; }
  .topbar { padding: 0 20px; }
}
@media (max-width: 1080px) {
  .page { padding: 18px 16px 52px; }
  .page-head { gap: 12px; }
  .h1 { font-size: 20px; }
}
@media (max-width: 720px) {
  .page { padding: 16px 12px 44px; }
  .page-head { align-items: flex-start; }
  .head-actions { margin-left: 0; width: 100%; }
}

/* ---------- 工作台 hero：收敛高度，右侧放主操作 ---------- */
.hero { flex-direction: row; padding: 22px 26px; border-radius: var(--radius-xl); align-items: center; }
.hero-copy { max-width: 640px; }
.hero h1 { font-size: 23px; margin: 6px 0 5px; }
.hero p { max-width: 560px; }
.hero-side { display: flex; align-items: center; justify-content: flex-end; margin-left: auto; padding-left: 24px; }
.hero .hero-actions { margin-top: 0; }
.hero .hero-actions .btn { height: 36px; padding: 0 16px; border-radius: 10px; }
@media (max-width: 900px) {
  .hero { flex-direction: column; align-items: flex-start; padding: 18px 20px; }
  .hero h1 { font-size: 21px; }
  .hero-side { width: 100%; margin-left: 0; padding-left: 0; justify-content: flex-start; }
  .hero .hero-actions { margin-top: 14px; }
}

/* ---------- 顶栏：中等宽度不挤压 ---------- */
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumb { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { flex: 1 1 220px; min-width: 170px; justify-content: flex-start; }
.tenant-chip { min-width: 0; max-width: 230px; }
.tenant-chip #tenantName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credits-chip { flex: 0 0 auto; white-space: nowrap; }
.user-chip { max-width: 220px; overflow: hidden; white-space: nowrap; }
.user-chip .fs11 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
@media (max-width: 1200px) {
  .topbar-right > .tag { display: none; }
  .tenant-chip #tenantSlug { display: none; }
  .search kbd { display: none; }
}
@media (max-width: 960px) {
  .search { flex: 0 0 34px; min-width: 34px; padding: 0; justify-content: center; }
  .search span { display: none; }
  .tenant-chip { max-width: 150px; }
}

/* ---------- 类型统计：8 项均分两行 ---------- */
.stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   任务中心记录表：7 列信息层级（类型 / 标题 + 次级行 / 发起人 / 状态 / 花费 / 时间 / 操作）
   ========================================================================== */
.tcr-table { table-layout: fixed; font-size: 12.5px; }
.tcr-table thead th {
  padding: 12px 16px; font-size: 11px; letter-spacing: .04em;
  color: var(--text-dim); background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.tcr-table tbody td {
  padding: 14px 16px; line-height: 1.5; vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}
.tcr-table tbody tr:last-child td { border-bottom: 0; }
.tcr-table tbody tr:hover { background: var(--bg-hover); }

/* 列宽：标题列吃掉剩余空间，其余定宽 */
.tcr-table .tcr-col-type { width: 104px; }
.tcr-table .tcr-col-user { width: 132px; }
.tcr-table .tcr-col-status { width: 104px; }
.tcr-table .tcr-col-cost { width: 108px; }
.tcr-table .tcr-col-time { width: 148px; }
.tcr-table .tcr-col-ops { width: 132px; }

.tcr-type {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border-subtle);
  color: var(--text-secondary); font-size: 11.5px; white-space: nowrap;
}
.tcr-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tcr-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 5px;
  font-size: 11px; color: var(--text-dim); min-width: 0;
}
.tcr-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcr-dot {
  flex: 0 0 auto; width: 3px; height: 3px; border-radius: 50%;
  background: var(--text-dim); opacity: .6;
}
.tcr-user { overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); }
.tcr-status .tag { height: 24px; padding: 0 9px; }
.tcr-cost { text-align: right; font-variant-numeric: tabular-nums; }
.tcr-time { font-variant-numeric: tabular-nums; }

/* 操作列：主操作 + 更多（下拉收口） */
.tcr-ops { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.tcr-ops .btn { margin-left: 0; }
.tcr-more { position: relative; }
.tcr-more > .btn { padding: 0 7px; letter-spacing: .5px; }
.tcr-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 136px; padding: 5px; display: none;
  background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-radius: 10px; box-shadow: var(--shadow-2);
}
.tcr-more.open .tcr-menu { display: block; }
.tcr-menu button {
  display: block; width: 100%; padding: 7px 10px; text-align: left;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--text-secondary); font-size: 11.5px; cursor: pointer; white-space: nowrap;
}
.tcr-menu button:hover { background: var(--bg-hover); color: var(--text-primary); }

@media (max-width: 1080px) {
  .tcr-table .tcr-col-user { width: 100px; }
  .tcr-table .tcr-col-time { width: 124px; }
}

