/* Scoped to the two creator panels; inherits the portal's light/dark tokens. */
.cs-root {
  --cs-line: var(--sa-line, #dce4e0);
  --cs-muted: var(--sa-muted, #66736e);
  --cs-soft: var(--sa-soft, #f2f5f4);
  --cs-brand: var(--sa-brand, #087f64);
  color: var(--sa-ink, #202927);
  font: 13px/1.6 var(--sa-font, "Segoe UI"), "Microsoft YaHei", system-ui, sans-serif;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.cs-root *, .cs-root *::before, .cs-root *::after { box-sizing: border-box; }
.cs-root [hidden] { display: none !important; }
.cs-root h2, .cs-root h3, .cs-root p { margin: 0; }
.cs-root h2 { font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.cs-root h3 { font-size: 16px; font-weight: 650; }
.cs-root button, .cs-root input, .cs-root textarea, .cs-root select { font: inherit; }
.cs-root button, .cs-root select { cursor: pointer; }
.cs-root :focus-visible { outline: 2px solid var(--cs-brand); outline-offset: 3px; }
.cs-root button:disabled { opacity: .5; cursor: default; }
.cs-root .ti { flex: 0 0 auto; font-size: 18px; line-height: 1; }
.cs-root .cs-icon { width:1em; height:1em; display:inline-block; vertical-align:middle; }
.cs-workspace { border: 1px solid var(--cs-line); border-radius: 14px; background: var(--sa-card, #fff); overflow: hidden; box-shadow: var(--sa-sh-sm, none); }
.cs-top { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--cs-line); }
.cs-heading { display: flex; align-items: center; gap: 9px; }
.cs-heading > .ti { color: var(--cs-brand); font-size: 22px; }
.cs-project-tools { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.cs-project-tools > select { width: clamp(130px, 18vw, 240px); }
.cs-save { color: var(--cs-muted); font-size: 11px; white-space: nowrap; padding: 5px 8px; border-radius: 6px; background: var(--cs-soft); }
.cs-save[data-state="saved"]::before { content: ""; display: inline-block; width: 6px; height: 6px; background: var(--cs-brand); border-radius: 50%; margin-right: 6px; }
.cs-save[data-state="error"] { color: var(--sa-err, #b42342); }
.cs-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--cs-line); background: var(--cs-soft); }
.cs-toolbar [aria-pressed="true"] { background: var(--sa-brand-soft, #e5f3ed); border-color: var(--cs-brand); color: var(--cs-brand); }
.cs-flow-bar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; padding:10px 20px; border-bottom:1px solid var(--cs-line); background:var(--sa-card, #fff); }
.cs-flow-status { flex:1; min-width:180px; overflow-wrap:anywhere; color:var(--cs-muted); }
.cs-import-status { padding:10px 20px; background:var(--cs-soft); overflow-wrap:anywhere; }
.cs-drop-ready { box-shadow:inset 0 0 0 3px var(--cs-brand); }
.cs-template-card { padding:16px; border:1px solid var(--cs-line); border-radius:10px; display:grid; gap:12px; }
.cs-template-card > .cs-btn { justify-self:start; }
.cs-flow-plan { display:grid; gap:8px; margin:0; padding-left:22px; }
.cs-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; border: 1px solid var(--cs-line); border-radius: 8px; padding: 8px 11px; background: var(--sa-card, #fff); color: inherit; line-height: 1.25; white-space: nowrap; text-decoration: none; }
.cs-btn:hover:not(:disabled) { background: var(--cs-soft); border-color: var(--sa-brand-line, #b6dacf); }
.cs-btn.cs-primary { background: var(--sa-grad, #087f64); color: #fff; border-color: transparent; font-weight: 650; }
.cs-btn.cs-primary:hover:not(:disabled) { filter: brightness(.94); background: var(--sa-grad, #087f64); }
.cs-btn.cs-danger { color: var(--sa-err, #b42342); }
.cs-icon-only { width: 36px; padding: 7px; flex: 0 0 auto; }
.cs-icon-only > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cs-flex { flex: 1; }
.cs-input { min-width: 0; width: 100%; border: 1px solid var(--cs-line); border-radius: 8px; padding: 9px 10px; background: var(--sa-card, #fff); color: inherit; outline: none; }
.cs-input:focus { border-color: var(--cs-brand); box-shadow: 0 0 0 2px var(--sa-brand-soft, #e5f3ed); }
.cs-input::placeholder { color: var(--cs-muted); opacity: .85; }
.cs-root textarea.cs-input { display: block; resize: vertical; min-height: 78px; line-height: 1.65; }
.cs-field { display: grid; min-width: 0; gap: 5px; margin: 0; }
.cs-label { color: var(--cs-muted); font-size: 11px; font-weight: 600; }
.cs-surface { position: relative; height: clamp(530px, 70vh, 840px); overflow: hidden; outline: none; touch-action: none; background-color: var(--sa-bg, #f5f6f7); background-image: radial-gradient(circle, var(--cs-line) 1.3px, transparent 1.3px); isolation: isolate; }
.cs-world { position: absolute; top: 0; left: 0; width: 0; height: 0; transform-origin: 0 0; }
.cs-edges { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.cs-edge { fill: none; stroke: var(--cs-brand); stroke-width: 2.5px; pointer-events: stroke; cursor: pointer; opacity: .6; }
.cs-edge:hover, .cs-edge-selected, .cs-edge:focus { stroke-width: 5px; opacity: 1; outline: none; }
.cs-node { position: absolute; left: 0; top: 0; width: 276px; border: 1px solid var(--cs-line); border-radius: 11px; background: var(--sa-card, #fff); box-shadow: var(--sa-sh-md, 0 4px 14px #102b2110); overflow: visible; }
.cs-node.cs-selected { outline: 2px solid var(--cs-brand); outline-offset: 3px; z-index: 2; }
.cs-node.cs-connect-source { outline: 2px dashed var(--cs-brand); outline-offset: 3px; }
.cs-node-head { display: flex; gap: 8px; align-items: center; padding: 12px; border-bottom: 1px solid var(--cs-line); cursor: grab; border-radius: 11px 11px 0 0; background: var(--cs-soft); user-select: none; }
.cs-node[data-type="video"] .cs-node-head { background: var(--sa-brand-soft, #e5f3ed); }
.cs-node-head > .ti { color: var(--cs-brand); }
.cs-node-title { padding: 2px 0; border-color: transparent; background: transparent; font-weight: 650 !important; flex: 1; }
.cs-type { font-size: 10px; color: var(--cs-muted); white-space: nowrap; }
.cs-node-body { padding: 12px; display: grid; gap: 12px; }
.cs-node[data-type="text"] textarea { min-height: 144px; }
.cs-settings { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; }
.cs-settings .cs-input { padding: 7px 3px; font-size: 11px; }
.cs-node-preview { min-height: 140px; max-height: 230px; background: var(--cs-soft); border: 1px solid var(--cs-line); border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--cs-muted); overflow: hidden; font-size: 11px; }
.cs-node-preview > .ti { font-size: 30px; }
.cs-node-preview img { width: 100%; max-height: 228px; object-fit: contain; }
.cs-node[data-type="audio"] .cs-node-preview { min-height: 92px; }
.cs-node[data-type="audio"] .cs-node-preview .cs-media-hint { max-width: 100%; overflow-wrap: anywhere; text-align: center; }
.cs-ports { display: flex; padding: 0 8px 8px; justify-content: space-between; gap: 6px; }
.cs-ports .cs-btn { font-size: 10px; min-height: 32px; padding: 5px 7px; border-color: transparent; color: var(--cs-brand); }
.cs-port-out { margin-left: auto; }
.cs-input-summary { font-size: 11px; color: var(--cs-muted); overflow-wrap: anywhere; }
.cs-job-status { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; padding: 10px 12px; border-radius: 7px; background: var(--cs-soft); color: var(--cs-muted); border: 1px solid var(--cs-line); }
.cs-job-status[data-state="working"] { color: var(--cs-brand); background: var(--sa-brand-soft, #e5f3ed); border-color: var(--cs-brand); }
.cs-job-status[data-state="success"] { color: var(--sa-ok, #087f64); border-color: currentColor; }
.cs-job-status[data-state="failed"] { color: var(--sa-err, #b42342); border-color: currentColor; }
.cs-job-status[data-state="pending"] { color: var(--sa-warn, #92400e); border-color: currentColor; }
.cs-inline-video { display: grid; gap: 8px; }
.cs-inline-video video { display: block; width: 100%; max-height: 250px; min-height: 140px; object-fit: contain; border-radius: 7px; background: #101828; }
.cs-media-hint { color: var(--cs-muted); font-size: 12px; overflow-wrap: anywhere; }
.cs-media-hint:empty { display: none; }
.cs-inline-video .cs-btn { justify-self: start; font-size: 12px; }
.cs-run-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cs-price { color: var(--cs-muted); font-size: 11px; }
.cs-run-row .cs-btn { min-width: 104px; }
.cs-result-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-result-actions:empty { display: none; }
.cs-result-actions .cs-btn { font-size: 11px; padding: 6px; }
.cs-history { font-size: 11px; color: var(--cs-muted); border-top: 1px solid var(--cs-line); padding-top: 8px; }
.cs-history summary { cursor: pointer; }
.cs-history-row { display: flex; align-items: center; justify-content: space-between; padding-top: 7px; }
.cs-history-row .cs-btn { font-size: 10px; min-height: 28px; }
.cs-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 28px; text-align: center; }
.cs-empty > .ti { display: grid; place-items: center; width: 76px; height: 76px; font-size: 32px; color: var(--cs-brand); background: var(--sa-card, #fff); border: 1px solid var(--cs-line); border-radius: 20px; box-shadow: var(--sa-sh-sm, none); }
.cs-empty p { max-width: 330px; color: var(--cs-muted); line-height: 1.8; }
.cs-empty small { max-width: 320px; font-size: 11px; color: var(--cs-muted); }
.cs-zoom { position: absolute; bottom: 16px; right: 16px; display: flex; gap: 3px; align-items: center; padding: 4px; background: var(--sa-card, #fff); border: 1px solid var(--cs-line); border-radius: 9px; box-shadow: 0 2px 8px #102b2110; z-index: 4; }
.cs-zoom .cs-btn { border-color: transparent; }
.cs-zoom-value { min-width: 44px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.cs-footer { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 9px 14px; color: var(--cs-muted); font-size: 11px; flex-wrap: wrap; }
.cs-footer .cs-btn { font-size: 11px; min-height: 30px; }
.cs-panning, .cs-panning *, .cs-pan-ready { cursor: grabbing !important; user-select: none; }
.cs-conflict { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: var(--sa-warn-bg, #fef3c7); color: var(--sa-warn, #92400e); border-bottom: 1px solid var(--cs-line); }
.cs-conflict > span { flex: 1; min-width: 160px; }
.cs-gallery { padding: 24px; background: var(--sa-card, #fff); border: 1px solid var(--cs-line); border-radius: 14px; box-shadow: var(--sa-sh-sm, none); }
.cs-gallery-head { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.cs-gallery-head p { color: var(--cs-muted); font-size: 12px; margin-top: 5px; }
.cs-storage { display: flex; flex-direction: column; gap: 7px; min-width: 130px; color: var(--cs-muted); font-size: 11px; margin-left: auto; }
.cs-storage progress { width: 140px; height: 5px; accent-color: var(--cs-brand); }
.cs-gallery-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--cs-line); margin-bottom: 18px; }
.cs-tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: var(--cs-soft); border-radius: 9px; }
.cs-tabs .cs-btn { background: transparent; border-color: transparent; color: var(--cs-muted); }
.cs-tabs .cs-btn[aria-selected="true"] { color: var(--cs-brand); background: var(--sa-card, #fff); box-shadow: var(--sa-sh-sm, none); font-weight: 650; }
.cs-search { width: min(280px, 100%); }
.cs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cs-asset { border: 1px solid var(--cs-line); border-radius: 11px; overflow: hidden; background: var(--sa-card, #fff); min-width: 0; }
.cs-asset:focus-within, .cs-asset:hover { border-color: var(--sa-brand-line, #b6dacf); }
.cs-asset-preview { position: relative; aspect-ratio: 4/3; width: 100%; border: 0; background: var(--cs-soft); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.cs-asset-preview img { width: 100%; height: 100%; object-fit: contain; }
.cs-asset-preview .ti { position: absolute; color: var(--cs-muted); font-size: 26px; }
.cs-asset-body { padding: 12px; display: grid; gap: 9px; }
.cs-asset-name { font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cs-asset-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; font-size: 11px; color: var(--cs-muted); }
.cs-tag { display: inline-flex; padding: 2px 6px; background: var(--cs-soft); border-radius: 4px; }
.cs-asset-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cs-asset-actions .cs-btn { font-size: 11px; padding: 7px 4px; }
.cs-asset-footer { display: flex; justify-content: space-between; gap: 5px; }
.cs-asset-footer .cs-btn { font-size: 11px; border-color: transparent; min-height: 30px; padding: 5px; }
.cs-gallery-empty { padding: 72px 20px; text-align: center; grid-column: 1/-1; color: var(--cs-muted); border: 1px dashed var(--cs-line); border-radius: 12px; background: var(--cs-soft); display: grid; justify-items: center; gap: 12px; }
.cs-gallery-empty h3 { color: var(--sa-ink, #202927); }
.cs-gallery-empty > .ti { display: grid; place-items: center; width: 64px; height: 64px; font-size: 28px; color: var(--cs-brand); background: var(--sa-card, #fff); border: 1px solid var(--cs-line); border-radius: 18px; margin-bottom: 6px; }
.cs-pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 20px; color: var(--cs-muted); }
.cs-dialog { position: fixed; width: min(580px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 22px; border: 1px solid var(--cs-line); border-radius: 12px; background: var(--sa-card, #fff); color: var(--sa-ink, #202927); overflow: auto; box-shadow: 0 24px 80px #0004; }
.cs-dialog::backdrop { background: #10231db3; }
.cs-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.cs-dialog-content { display: grid; gap: 14px; }
.cs-dialog-content > p { color: var(--cs-muted); }
.cs-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.cs-dialog-error { color: var(--sa-err, #b42342); font-size: 12px; overflow-wrap: anywhere; }
.cs-dialog img, .cs-dialog video { display: block; width: 100%; max-height: 60dvh; object-fit: contain; border-radius: 8px; background: var(--cs-soft); }
.cs-dialog .cs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cs-dialog .cs-input[type="file"] { padding: 14px 10px; border-style: dashed; }
.cs-dialog progress { width: 100%; accent-color: var(--cs-brand); }
.cs-caption { font-size: 11px; color: var(--cs-muted); }
.cs-image-tools-trigger { color: var(--cs-brand); border-color: var(--sa-brand-line, #b6dacf); min-height: 44px; }
.cs-result-actions .cs-image-tools-trigger { flex-basis: 100%; min-height: 44px; font-weight: 650; }
.cs-image-tools-dialog .cs-image-reference { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px; border: 1px solid var(--cs-line); border-radius: 9px; background: var(--cs-soft); }
.cs-image-tools-dialog .cs-image-reference img { width: 76px; height: 76px; flex: 0 0 76px; object-fit: contain; background: var(--sa-card, #fff); }
.cs-image-reference-text { min-width: 0; overflow-wrap: anywhere; }
.cs-image-reference-text > strong { display: block; margin-bottom: 5px; }
.cs-image-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cs-image-preset.cs-btn { flex-direction: column; align-items: flex-start; gap: 5px; min-height: 68px; white-space: normal; text-align: left; padding: 11px 12px; }
.cs-image-preset > span { font-weight: 650; }
.cs-image-preset > small { color: var(--cs-muted); font-size: 11px; line-height: 1.5; }
.cs-image-preset[aria-pressed="true"] { border-color: var(--cs-brand); background: var(--sa-brand-soft, #e5f3ed); box-shadow: inset 0 0 0 1px var(--cs-brand); }
.cs-image-cost { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-top: 12px; border-top: 1px solid var(--cs-line); }
.cs-image-cost > strong { white-space: nowrap; color: var(--cs-brand); }
.cs-mention-trigger { justify-self: start; min-height: 28px; padding: 3px 7px; font-size: 11px; color: var(--cs-brand); }
.cs-mention-menu { position: fixed; inset: auto; margin: 0; padding: 0; z-index: 10000; width: 320px; max-width: calc(100vw - 16px); border: 1px solid var(--cs-line); border-radius: 10px; color: var(--sa-ink, #202927); background: var(--sa-card, #fff); box-shadow: 0 12px 36px #102b2130; font: 13px/1.4 system-ui, sans-serif; }
.cs-mention-heading { padding: 10px 12px; font-weight: 650; border-bottom: 1px solid var(--cs-line); }
.cs-mention-list { overflow: auto; overscroll-behavior: contain; padding: 4px; max-height: 220px; }
.cs-mention-option { display: flex; gap: 10px; align-items: center; padding: 7px; border-radius: 6px; cursor: pointer; min-height: 58px; }
.cs-mention-option:hover, .cs-mention-option[aria-selected="true"] { background: var(--cs-soft); outline: 1px solid var(--cs-brand); outline-offset: -1px; }
.cs-mention-option img { flex: 0 0 46px; width: 46px; height: 46px; object-fit: contain; border-radius: 5px; background: var(--cs-soft); }
.cs-mention-text { display: grid; gap: 4px; min-width: 0; }
.cs-mention-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-mention-text span, .cs-mention-help, .cs-mention-empty { color: var(--cs-muted); font-size: 11px; }
.cs-mention-help { padding: 8px 12px; border-top: 1px solid var(--cs-line); }
.cs-mention-empty { padding: 12px; margin: 0; }
@media (max-width: 600px) {
  .cs-top { padding: 12px; gap: 10px; }
  .cs-heading { width: 100%; }
  .cs-project-tools { flex-basis: 100%; }
  .cs-project-tools > select { flex: 1; width: 100px; }
  .cs-top .cs-save { margin-left: 0; }
  .cs-toolbar { gap: 4px; padding: 8px; }
  .cs-toolbar .cs-btn { flex: 1 1 auto; font-size: 11px; padding: 8px 6px; min-height: 44px; }
  .cs-toolbar .cs-icon-only { flex: 0 0 44px; }
  .cs-toolbar .cs-flex { display: none; }
  .cs-surface { height: max(510px, 65dvh); }
  .cs-zoom { right: 8px; bottom: 8px; }
  .cs-zoom .cs-btn { min-width: 44px; min-height: 44px; }
  .cs-footer { gap: 5px; font-size: 10px; padding: 10px; }
  .cs-gallery-head { gap: 12px; }
  .cs-gallery { padding: 16px; }
  .cs-gallery-head > div:first-child { width: 100%; }
  .cs-gallery-head > .cs-heading { width: auto; }
  .cs-gallery-head .cs-storage { flex: 1; margin-left: 0; min-width: 100px; }
  .cs-storage progress { width: 100%; max-width: 140px; }
  .cs-gallery-tools { gap: 10px; }
  .cs-tabs { width: 100%; }
  .cs-tabs .cs-btn { flex: 1; min-height: 44px; font-size: 11px; padding: 6px 5px; }
  .cs-search { width: 100%; }
  .cs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cs-asset-body { padding: 9px; gap: 8px; }
  .cs-asset-actions { grid-template-columns: 1fr; }
  .cs-asset-actions .cs-btn { min-height: 44px; }
  .cs-asset-footer { flex-wrap: wrap; }
  .cs-asset-footer .cs-btn { min-height: 44px; }
  .cs-dialog { padding: 16px; }
  .cs-dialog .cs-row { grid-template-columns: 1fr; }
  .cs-dialog-actions .cs-btn { min-height: 44px; }
  .cs-icon-only { width: 44px; min-height: 44px; }
  .cs-project-tools .cs-btn, .cs-gallery-head .cs-btn, .cs-pagination .cs-btn { min-height: 44px; }
  .cs-search, .cs-dialog .cs-input { font-size: 16px; }
  .cs-gallery-empty { padding: 44px 12px; }
  .cs-pagination { gap: 7px; font-size: 11px; flex-wrap: wrap; }
  .cs-pagination .cs-btn { padding-inline: 8px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .cs-root *, .cs-root *::before, .cs-root *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
