/* FlowAI brand-v2.css — v1.2
   色值来自 Tessera General Design Compliance Review v2 第 5、6 页。
   规则只在 /v2/ 写入的 data-color-version="v2" 下生效，根地址 V1 不受影响。 */

html[data-color-version="v2"] {
  --brand-navy: #0c233c;
  --brand-blue-dark: #00338d;
  --brand-blue: #1e49e2;
  --brand-purple-dark: #510dbc;
  --brand-purple: #7213ea;
  --brand-purple-light: #b497ff;
  --brand-cyan: #00b8f5;
  --brand-cyan-light: #76d2ff;
  --brand-cyan-pale: #aceaff;
  --brand-green-dark: #098e7e;
  --brand-green: #00c0ae;
  --brand-green-light: #63ebda;
  --brand-magenta-dark: #ab0d82;
  --brand-magenta: #fd349c;
  --brand-magenta-light: #ffa3da;
  --brand-neutral-1: #333333;
  --brand-neutral-2: #666666;
  --brand-neutral-3: #989898;
  --brand-neutral-4: #b2b2b2;
  --brand-neutral-5: #e5e5e5;
  --brand-gradient: linear-gradient(135deg, #1e49e2 0%, #7213ea 100%);
  --brand-gradient-cyan: linear-gradient(135deg, #1e49e2 0%, #00b8f5 100%);
  --brand-shadow: rgba(30, 73, 226, .26);
  --brand-shadow-strong: rgba(30, 73, 226, .38);
  --success: #098e7e;
  --success-soft: rgba(99, 235, 218, .18);
  --danger: #ab0d82;
  --danger-soft: rgba(255, 163, 218, .20);
  --warning: #fd349c;
  --warning-soft: rgba(255, 163, 218, .20);
  --info: #1e49e2;
  --info-soft: rgba(172, 234, 255, .28);
  --pending-modify: #7213ea;
  --pending-insert: #098e7e;
  --pending-delete: #ab0d82;
  --pending-convert: #00b8f5;
  --pending-convert-label: #00338d;
  --role-bubble-border: #989898;
  --diamond-fill: rgba(172, 234, 255, .20);
}

/* 主应用深色：以深蓝作底，组件仅降低规范色透明度。 */
html[data-color-version="v2"]:not(.light):not([data-page="login"]):not([data-page="admin"]) {
  --bg: #0c233c;
  --surface: rgba(0, 51, 141, .34);
  --surface2: rgba(0, 51, 141, .48);
  --border: rgba(172, 234, 255, .18);
  --border2: rgba(172, 234, 255, .28);
  --text: #ffffff;
  --text-muted: #aceaff;
  --text-dim: rgba(172, 234, 255, .62);
  --accent: #7213ea;
  --accent2: #00b8f5;
  --title: #ffffff;
  --placeholder: rgba(172, 234, 255, .62);
  --charcount: rgba(172, 234, 255, .45);
  --tab-bg: rgba(118, 210, 255, .08);
  --tab-hover: rgba(118, 210, 255, .14);
  --examples-label: rgba(172, 234, 255, .64);
  --card-shadow: rgba(12, 35, 60, .46);
  --bg-glow1: rgba(30, 73, 226, .28);
  --bg-glow2: rgba(114, 19, 234, .18);
  --grid-line: rgba(172, 234, 255, .05);
  --toggle-bg: rgba(118, 210, 255, .10);
  --toggle-border: rgba(172, 234, 255, .22);
  --sb-bg: rgba(0, 51, 141, .30);
  --sb-border: rgba(172, 234, 255, .16);
  --sb-hover: rgba(118, 210, 255, .10);
  --sb-active: rgba(30, 73, 226, .30);
  --sb-muted: rgba(172, 234, 255, .55);
  --sb-icon: rgba(172, 234, 255, .72);
  --tool-btn-hover: rgba(118, 210, 255, .12);
  --canvas-bg: #0c233c;
  --canvas-grid: rgba(172, 234, 255, .06);
  --lane-main-1: rgba(30, 73, 226, .14);
  --lane-main-2: rgba(114, 19, 234, .10);
  --lane-border: rgba(172, 234, 255, .24);
  --sublane-border: rgba(172, 234, 255, .14);
  --node-fill: rgba(0, 51, 141, .72);
  --node-border: rgba(172, 234, 255, .44);
  --node-auto-fill: rgba(30, 73, 226, .28);
  --node-auto-border: #00b8f5;
  --node-manual-fill: rgba(253, 52, 156, .15);
  --node-manual-border: #fd349c;
  --node-text: #ffffff;
  --node-selected-border: #00b8f5;
  --edge-color: rgba(172, 234, 255, .64);
  --edge-auto-color: #b497ff;
  --node-strip-bg: rgba(118, 210, 255, .12);
  --title-bar-bg: rgba(0, 51, 141, .62);
  --frame-stroke: #aceaff;
  --badge-bg: #fd349c;
  --badge-text: #ffffff;
  --table-header-bg: rgba(0, 51, 141, .56);
  --table-row-hover: rgba(118, 210, 255, .08);
  --pending-convert-label: #00b8f5;
  --diamond-fill: rgba(172, 234, 255, .14);
}

/* 主应用浅色。 */
html[data-color-version="v2"].light {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #ffffff;
  --border: #e5e5e5;
  --border2: rgba(51, 51, 51, .16);
  --text: #0c233c;
  --text-muted: #666666;
  --text-dim: rgba(12, 35, 60, .58);
  --accent: #7213ea;
  --accent2: #1e49e2;
  --title: #0c233c;
  --placeholder: rgba(12, 35, 60, .46);
  --charcount: rgba(12, 35, 60, .42);
  --tab-bg: #ffffff;
  --tab-hover: rgba(118, 210, 255, .24);
  --examples-label: #666666;
  --card-shadow: rgba(30, 73, 226, .14);
  --bg-glow1: transparent;
  --bg-glow2: transparent;
  --grid-line: transparent;
  --toggle-bg: #ffffff;
  --toggle-border: rgba(0, 51, 141, .18);
  --sb-bg: #ffffff;
  --sb-border: rgba(0, 51, 141, .14);
  --sb-hover: rgba(118, 210, 255, .25);
  --sb-active: rgba(30, 73, 226, .16);
  --sb-muted: rgba(12, 35, 60, .54);
  --sb-icon: rgba(12, 35, 60, .66);
  --tool-btn-hover: rgba(172, 234, 255, .26);
  --canvas-bg: #ffffff;
  --canvas-grid: transparent;
  --lane-main-1: #ffffff;
  --lane-main-2: #ffffff;
  --lane-border: rgba(0, 51, 141, .22);
  --sublane-border: rgba(0, 51, 141, .12);
  --node-fill: #ffffff;
  --node-border: rgba(0, 51, 141, .34);
  --node-auto-fill: #ffffff;
  --node-auto-border: #1e49e2;
  --node-manual-fill: #ffffff;
  --node-manual-border: #fd349c;
  --node-text: #0c233c;
  --node-selected-border: #1e49e2;
  --edge-color: rgba(12, 35, 60, .52);
  --edge-auto-color: #7213ea;
  --node-strip-bg: #ffffff;
  --title-bar-bg: #ffffff;
  --frame-stroke: #333333;
  --badge-bg: #fd349c;
  --badge-text: #ffffff;
  --table-header-bg: #ffffff;
  --table-row-hover: rgba(172, 234, 255, .16);
  --diamond-fill: #ffffff;
}

/* 登录页。 */
html[data-color-version="v2"][data-page="login"] {
  --brand1: #1e49e2;
  --brand2: #7213ea;
  --text: #0c233c;
  --text2: #666666;
  --muted: #989898;
  --surface: #ffffff;
  --bg: #ffffff;
  --border: #e5e5e5;
  --border-strong: #b2b2b2;
  --ok: #098e7e;
  --ok-bg: rgba(99, 235, 218, .18);
  --ok-border: #63ebda;
  --err: #ab0d82;
  --err-bg: rgba(255, 163, 218, .20);
  --err-border: #ffa3da;
  --shadow: 0 1px 2px rgba(12, 35, 60, .06), 0 18px 50px -12px rgba(30, 73, 226, .26);
}
html[data-color-version="v2"][data-page="login"] body {
  background-color: #ffffff;
  background-image: none;
}
html[data-color-version="v2"][data-page="login"] .btn:not(.ghost) { background: var(--brand-gradient); }
html[data-color-version="v2"][data-page="login"] .btn.ghost { background: rgba(172, 234, 255, .20); }
html[data-color-version="v2"][data-page="login"] .btn.ghost:hover:not(:disabled) { background: rgba(118, 210, 255, .24); }
html[data-color-version="v2"][data-page="login"] .alt-btn { background: #ffffff; }
html[data-color-version="v2"][data-page="login"] .alt-btn:hover,
html[data-color-version="v2"][data-page="login"] input:focus { box-shadow: 0 0 0 3px rgba(30, 73, 226, .14); }
html[data-color-version="v2"][data-page="login"] .link:hover { color: #00338d; }
html[data-color-version="v2"][data-page="login"] .error { color: #ab0d82; }
html[data-color-version="v2"][data-page="login"] .ok { color: #098e7e; }

/* 后台页。 */
html[data-color-version="v2"][data-page="admin"] {
  --blue: #1e49e2;
  --blue-d: #00338d;
  --blue-l: #00b8f5;
  --blue-soft: rgba(172, 234, 255, .42);
  --text: #0c233c;
  --text2: #666666;
  --muted: #989898;
  --ok: #098e7e;
  --okbg: rgba(99, 235, 218, .20);
  --err: #ab0d82;
  --errbg: rgba(255, 163, 218, .20);
  --glass: rgba(255, 255, 255, .72);
  --glass2: rgba(255, 255, 255, .84);
  --glass-brd: rgba(172, 234, 255, .72);
  --gshadow: 0 8px 36px -10px rgba(30, 73, 226, .22), 0 2px 8px rgba(12, 35, 60, .08);
}
html[data-color-version="v2"][data-page="admin"] body {
  background: #ffffff;
  background-image: none;
}
html[data-color-version="v2"][data-page="admin"] .pill.active,
html[data-color-version="v2"][data-page="admin"] .who .av,
html[data-color-version="v2"][data-page="admin"] .btn.solid { background: var(--brand-gradient); }
html[data-color-version="v2"][data-page="admin"] .bar .col { background: var(--brand-gradient-cyan); }
html[data-color-version="v2"][data-page="admin"] .b-super { background: linear-gradient(135deg, #510dbc, #7213ea); }
html[data-color-version="v2"][data-page="admin"] .b-lark { background: rgba(172, 234, 255, .42); color: #00338d; }
html[data-color-version="v2"][data-page="admin"] .b-pending { background: rgba(255, 163, 218, .22); color: #ab0d82; }
html[data-color-version="v2"][data-page="admin"] .btn.solid.danger { background: linear-gradient(135deg, #fd349c, #ab0d82); }
html[data-color-version="v2"][data-page="admin"] #chart-tip,
html[data-color-version="v2"][data-page="admin"] #toast { background: #0c233c; }
html[data-color-version="v2"][data-page="admin"] #chart-tip::after { border-top-color: #0c233c; }

/* 品牌主视觉和基础交互。 */
html[data-color-version="v2"] .sb-logo-text,
html[data-color-version="v2"] .brand h1,
html[data-color-version="v2"] .logo .nm,
html[data-color-version="v2"] .login-brand .nm,
html[data-color-version="v2"] .greet h1 { background-image: var(--brand-gradient); }
html[data-color-version="v2"] .sb-logo-mark rect:first-of-type,
html[data-color-version="v2"] .mark rect:first-of-type,
html[data-color-version="v2"] .logo-mark rect:first-of-type { fill: #1e49e2; }
html[data-color-version="v2"] .sb-logo-mark rect:nth-of-type(2),
html[data-color-version="v2"] .mark rect:nth-of-type(2),
html[data-color-version="v2"] .logo-mark rect:nth-of-type(2) { fill: #00b8f5; }
html[data-color-version="v2"] .sb-logo-mark path,
html[data-color-version="v2"] .mark path,
html[data-color-version="v2"] .logo-mark path { stroke: #7213ea; }
html[data-color-version="v2"] .sb-logo-version::after,
html[data-color-version="v2"] .detail-version-badge::after { content: " · V2"; color: var(--accent2, #1e49e2); }
html[data-color-version="v2"] :focus-visible { outline-color: var(--accent2, #1e49e2); }

html[data-color-version="v2"] .btn-primary-v2,
html[data-color-version="v2"] .btn-send,
html[data-color-version="v2"] .header-btn.primary,
html[data-color-version="v2"] .ai-apply-btn,
html[data-color-version="v2"] .ai-chat-send,
html[data-color-version="v2"] .edit-save-btn,
html[data-color-version="v2"] .overlay-btn,
html[data-color-version="v2"] .insights-batch-btn,
html[data-color-version="v2"] .ai-chat-bubble.user,
html[data-color-version="v2"] .ai-chat-send-btn,
html[data-color-version="v2"] .xcd-btn-primary,
html[data-color-version="v2"] .xc-btn-primary,
html[data-color-version="v2"] .xbf-btn-apply,
html[data-color-version="v2"] .xc-btn-fix,
html[data-color-version="v2"] .xap-bar-fill { background: var(--brand-gradient); border-color: transparent; }
html[data-color-version="v2"] .btn-send,
html[data-color-version="v2"] .header-btn.primary,
html[data-color-version="v2"] .ai-apply-btn,
html[data-color-version="v2"] .ai-chat-send,
html[data-color-version="v2"] .edit-save-btn,
html[data-color-version="v2"] .overlay-btn,
html[data-color-version="v2"] .insights-batch-btn,
html[data-color-version="v2"] .ai-chat-send-btn { box-shadow: 0 4px 16px var(--brand-shadow); }

html[data-color-version="v2"] .hero-badge,
html[data-color-version="v2"] .feat-icon,
html[data-color-version="v2"] .tree-l3.active,
html[data-color-version="v2"] .ai-apply-code,
html[data-color-version="v2"] .ai-insight-btn,
html[data-color-version="v2"] .ai-msg-user,
html[data-color-version="v2"] .details-code,
html[data-color-version="v2"] .details-edit-icon:hover,
html[data-color-version="v2"] .tag.auto,
html[data-color-version="v2"] .overlay-icon,
html[data-color-version="v2"] .xl-file-row { background: rgba(30, 73, 226, .12); border-color: rgba(30, 73, 226, .28); }
html[data-color-version="v2"] .hero-deco,
html[data-color-version="v2"] .example-card::before { background-image: linear-gradient(135deg, rgba(30, 73, 226, .10), rgba(114, 19, 234, .04)); }
html[data-color-version="v2"] .feat-card:hover,
html[data-color-version="v2"] .example-card:hover,
html[data-color-version="v2"] .xl-drop.dragover { border-color: rgba(30, 73, 226, .38); box-shadow: 0 8px 28px rgba(30, 73, 226, .14); }
html[data-color-version="v2"] .gemini-wrap:focus-within,
html[data-color-version="v2"] .edit-input:focus,
html[data-color-version="v2"] .edit-textarea:focus,
html[data-color-version="v2"] .ai-chat-input:focus { border-color: rgba(30, 73, 226, .48); box-shadow: 0 0 0 3px rgba(30, 73, 226, .12); }

/* 语义状态：只使用规范中的绿、洋红、蓝紫色族。 */
html[data-color-version="v2"] .insight-card.insight-green,
html[data-color-version="v2"] .xc-summary.all-clean,
html[data-color-version="v2"] .xc-applied-note { background: var(--success-soft); border-color: rgba(9, 142, 126, .32); color: #098e7e; }
html[data-color-version="v2"] .insight-card.insight-green .insight-head,
html[data-color-version="v2"] .insight-card.insight-green .insight-list li::before,
html[data-color-version="v2"] .xl-check-btn:not([disabled]):hover,
html[data-color-version="v2"] .ai-apply-field,
html[data-color-version="v2"] .ai-applied-badge,
html[data-color-version="v2"] .ai-accepted-badge,
html[data-color-version="v2"] .ai-apply-diff-tag.new,
html[data-color-version="v2"] .manual-edit-accept,
html[data-color-version="v2"] .tag.human,
html[data-color-version="v2"] .etp-item.etp-done .etp-status-dot { color: #098e7e; }
html[data-color-version="v2"] .ai-accept-btn { background: linear-gradient(135deg, #00c0ae, #098e7e); }
html[data-color-version="v2"] tr.row-ghost > td,
html[data-color-version="v2"] .cell-ghost .track-new,
html[data-color-version="v2"] .cell-track-change .track-new { background: rgba(99, 235, 218, .16); color: #098e7e; border-color: #098e7e; }

html[data-color-version="v2"] .insight-card.insight-orange,
html[data-color-version="v2"] .fields-info,
html[data-color-version="v2"] .xc-summary.has-warn,
html[data-color-version="v2"] .xfp-failed-banner,
html[data-color-version="v2"] .ai-dep-hint { background: var(--warning-soft); border-color: rgba(171, 13, 130, .30); color: #ab0d82; }
html[data-color-version="v2"] .insight-card.insight-orange .insight-head,
html[data-color-version="v2"] .insight-card.insight-orange .insight-list li::before,
html[data-color-version="v2"] .fields-head svg,
html[data-color-version="v2"] .ai-pending-badge { color: #fd349c; }

html[data-color-version="v2"] .attach-error,
html[data-color-version="v2"] .sidebar-error,
html[data-color-version="v2"] .xc-summary.has-error,
html[data-color-version="v2"] tr.row-deleted > td,
html[data-color-version="v2"] .cell-track-change .track-old { background: var(--danger-soft); border-color: #ab0d82; color: #ab0d82; }
html[data-color-version="v2"] .ai-error,
html[data-color-version="v2"] .ai-topo-delete,
html[data-color-version="v2"] .ai-apply-diff-tag.old,
html[data-color-version="v2"] .sb-hist-menu-item.danger,
html[data-color-version="v2"] .overlay-icon.err,
html[data-color-version="v2"] .etp-item.etp-error .etp-status-dot { color: #ab0d82; }
html[data-color-version="v2"] .xcd-btn-danger,
html[data-color-version="v2"] .x6p-danger { color: #ab0d82; border-color: rgba(171, 13, 130, .42); }

html[data-color-version="v2"] .xc-summary.has-info,
html[data-color-version="v2"] .ai-apply-table.process { background: var(--info-soft); color: #00338d; }
html[data-color-version="v2"] .ai-apply-table.attachments { background: rgba(255, 163, 218, .22); color: #ab0d82; }
html[data-color-version="v2"] .ai-topo-insert,
html[data-color-version="v2"] .ai-topo-insert code { color: #098e7e; }
html[data-color-version="v2"] .ai-topo-convert,
html[data-color-version="v2"] .ai-topo-convert code,
html[data-color-version="v2"] .ai-apply-chart-badge { color: #7213ea; background: rgba(180, 151, 255, .20); }
html[data-color-version="v2"] .ai-topo-branch,
html[data-color-version="v2"] .ai-topo-branch code { color: #ab0d82; }

/* Excel 检查器的多类别标签继续靠色族区分，但全部收敛到合规色板。 */
html[data-color-version="v2"] .xc-kind[data-kind="EMPTY_SHEET"],
html[data-color-version="v2"] .xc-kind[data-kind="NO_HEADER"],
html[data-color-version="v2"] .xc-kind[data-kind="NO_REQUIRED_COL"],
html[data-color-version="v2"] .xc-kind[data-kind="INTERNAL_EXCEPTION"] { color: #ab0d82; }
html[data-color-version="v2"] .xc-kind[data-kind="MISSING_RECOMMENDED_COL"],
html[data-color-version="v2"] .xc-kind[data-kind="CODE_DUPLICATE"] { color: #fd349c; }
html[data-color-version="v2"] .xc-kind[data-kind="HEADER_NOT_FIRST"],
html[data-color-version="v2"] .xc-kind[data-kind="CODE_INTERNAL_WHITESPACE"],
html[data-color-version="v2"] .xc-kind[data-kind="CODE_FORMAT_BAD"],
html[data-color-version="v2"] .xc-kind[data-kind="BRANCH_TARGET_MISSING"] { color: #7213ea; }
html[data-color-version="v2"] .xc-kind[data-kind="DIAMOND_NO_BRANCH"],
html[data-color-version="v2"] .xc-kind[data-kind="DIAMOND_ONE_BRANCH"],
html[data-color-version="v2"] .xc-kind[data-kind="YESNO_NOT_DIAMOND"] { color: #00338d; }
html[data-color-version="v2"] .xc-kind[data-kind="NODE_NO_NAME"],
html[data-color-version="v2"] .xc-kind[data-kind="DESC_WEIRD_WHITESPACE"] { color: #098e7e; }

/* AI 建议 chip 由旧版内联色标识动作；V2 用同语义的合规色覆盖。 */
html[data-color-version="v2"] .ai-action-chip[style*="#5b7fff"] { background: rgba(30, 73, 226, .12) !important; color: #1e49e2 !important; }
html[data-color-version="v2"] .ai-action-chip[style*="#10b981"] { background: rgba(99, 235, 218, .18) !important; color: #098e7e !important; }
html[data-color-version="v2"] .ai-action-chip[style*="#dc2626"] { background: rgba(255, 163, 218, .20) !important; color: #ab0d82 !important; }
html[data-color-version="v2"] .ai-action-chip[style*="#a855f7"] { background: rgba(180, 151, 255, .20) !important; color: #7213ea !important; }
html[data-color-version="v2"] .ai-action-chip[style*="#f59e0b"] { background: rgba(255, 163, 218, .20) !important; color: #fd349c !important; }

/* 动态模板里的旧渐变/状态色是 inline style，必须提高优先级覆盖。 */
html[data-color-version="v2"] [style*="linear-gradient(135deg,#4f7fff,#6b5fff)"],
html[data-color-version="v2"] [style*="linear-gradient(135deg, #4f7fff, #6b5fff)"],
html[data-color-version="v2"] [style*="linear-gradient(135deg,#5b7fff,#a78bfa)"],
html[data-color-version="v2"] [style*="linear-gradient(135deg, #5b7fff, #a78bfa)"] { background: var(--brand-gradient) !important; }
html[data-color-version="v2"] [style*="color:#dc2626"],
html[data-color-version="v2"] [style*="color: #dc2626"] { color: #ab0d82 !important; }
html[data-color-version="v2"] [style*="background:#e05555"],
html[data-color-version="v2"] [style*="background: #e05555"] { background: #ab0d82 !important; }

/* X6 编辑器在 detail 页较晚加载，使用更高特异性保证 V2 仍覆盖。 */
html[data-color-version="v2"] .x6-tool-ai,
html[data-color-version="v2"] #x6-ai-submit { background: var(--brand-gradient); box-shadow: 0 6px 16px var(--brand-shadow); }
html[data-color-version="v2"] #x6-editor-status.dirty { color: #ab0d82; background: rgba(255, 163, 218, .20); }
html[data-color-version="v2"] #x6-ai-result.success { color: #098e7e; }
html[data-color-version="v2"] #x6-ai-result.error { color: #ab0d82; }
html[data-color-version="v2"] .x6p-danger { background: transparent; color: #ab0d82; border-color: rgba(171, 13, 130, .42); }
