/* Shared product UI. Tokens are the common contract; page layouts keep their owners. */
:root {
  --ui-font:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei UI","Microsoft YaHei","PingFang SC","Noto Sans CJK SC",sans-serif;
  --ui-canvas:#f7f6f2;--ui-surface:#fff;--ui-rail:#f0efea;--ui-ink:#272923;
  --ui-muted:#62675d;--ui-placeholder:#6c7166;--ui-line:#dadcd4;--ui-control-line:#a5ab9d;
  --ui-soft:#edeee7;--ui-selected:#e4e7dc;--ui-focus:#4d5943;
  --ui-success:#376045;--ui-success-bg:#edf4ed;--ui-warning:#795211;--ui-warning-bg:#fcf4e5;
  --ui-danger:#963c35;--ui-danger-bg:#fcf0ed;--ui-radius:12px;--ui-field-radius:8px;
  --ui-space-1:4px;--ui-space-2:8px;--ui-space-3:12px;--ui-space-4:16px;--ui-space-6:24px;--ui-space-8:32px;
  --ui-press:120ms;--ui-dialog:160ms;--ui-ease:cubic-bezier(.16,1,.3,1);
  --bg:var(--ui-canvas);--side:var(--ui-rail);--paper:var(--ui-surface);--ink:var(--ui-ink);--muted:var(--ui-muted);--line:var(--ui-line);--soft:var(--ui-soft);
  --ctl-line:var(--ui-control-line);--ctl-line-hover:#7d8674;--ctl-soft:var(--ui-soft);--ctl-soft-hover:#e3e6da;--ctl-focus:var(--ui-focus);
  font-family:var(--ui-font);color:var(--ui-ink);background:var(--ui-canvas);color-scheme:light;
}
html body {font-family:var(--ui-font);background:var(--ui-canvas);color:var(--ui-ink);line-height:1.65}
html body :is(button,input,select,textarea) {font-family:var(--ui-font);letter-spacing:0}
html body :is(h1,h2,h3) {color:var(--ui-ink);font-weight:600;line-height:1.4;letter-spacing:-.02em;text-wrap:balance}
html body :is(input,textarea) {caret-color:var(--ui-ink)}
::selection {background:#dfe5d6;color:#20271a}
html {scrollbar-color:#b9bfb0 var(--ui-canvas);scrollbar-width:thin}
html body :is(button,a,input,select,textarea,summary,[role="button"],[role="separator"]):focus-visible {outline:2px solid var(--ui-focus);outline-offset:3px}
html body :is(.hint,.muted,.demo-note,.scene-help,.upload-hint,.composer-foot,.draft-status,.conversation-hint,.conversation-input-heading small,.entry-expand,.entry-negative,.entry-id-details,.entry-downloads>span,.saved-time,.channel-meta,.pool-secondary,.table-note,.task-id,.library-heading p,.hero-description,.auth-footnote,.workspace-foot) {color:var(--ui-muted);line-height:1.7}

/* Native field affordances, consistent line-height and padding at every text size. */
html body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]),select,textarea) {
  max-width:100%;min-width:0;background:var(--ui-surface);color:var(--ui-ink);border:1px solid var(--ui-line);border-radius:var(--ui-field-radius);
  font-size:calc(13px * var(--ui-text-scale,1));line-height:1.7;padding:9px 12px;box-shadow:none;
}
html body :is(input,textarea)::placeholder {color:var(--ui-placeholder);opacity:1;font-size:inherit}
html body select {min-height:40px;color-scheme:light}
html body textarea {resize:vertical;overflow-y:auto;min-height:calc(4em * 1.7 + 20px)}
html body :is(input,select,textarea):focus {border-color:var(--ui-focus)}
html body :is(input,select,textarea):is(:disabled,[readonly]) {background:var(--ui-soft);color:var(--ui-muted);cursor:default}
html body input:is([type="checkbox"],[type="radio"]) {accent-color:var(--ui-ink);width:17px;height:17px;flex-shrink:0}
html body :is(.form-grid label>span,.field-label,.pool-fields label,.prompt-settings-grid label) {font-size:calc(12px * var(--ui-text-scale,1));font-weight:500;line-height:1.65;color:var(--ui-ink)}
html body .form-grid {gap:20px 24px}
html body .form-grid label>span {display:block;margin-bottom:8px}
html body .form-grid label>span.batch-asset-row {display:flex;margin-bottom:0}
html body .form-grid .detail-modules span {display:inline}

/* Primary is scarce. Everyday controls and selections stay light. */
html body :is(.primary-button,.secondary-button,.text-button,.primary,.row-button) {min-height:40px;border-radius:8px;line-height:1.5;font-weight:500}
html body :is(.primary-button,.primary,.new-project) {background:var(--ui-ink);border:1px solid var(--ui-ink);color:var(--on-silver);box-shadow:none;padding:10px 17px}
html body :is(.primary-button,.primary,.new-project):hover:not(:disabled) {background:var(--ui-ink);border-color:var(--ui-ink);color:var(--on-silver);transform:none}
html body :is(.secondary-button,.row-button) {border:1px solid var(--ui-line);background:var(--ui-surface);color:var(--ui-ink);padding:9px 13px;box-shadow:none}
html body :is(.secondary-button,.row-button):hover:not(:disabled) {background:var(--ui-soft);border-color:var(--ui-control-line);transform:none}
html body .text-button {background:transparent;border-color:transparent;color:var(--ui-muted);padding:7px 9px;text-decoration:none;box-shadow:none}
html body .text-button:hover:not(:disabled) {background:var(--ui-soft);color:var(--ui-ink);text-decoration:none;transform:none}
html body .work-actions>button {border:1px solid var(--ui-line);background:var(--ui-surface);color:var(--ui-ink);border-radius:8px;min-height:36px;padding:8px 11px}
html body :is(button,[role="button"]):is(:disabled,[aria-disabled="true"]) {background:var(--ui-soft);border-color:var(--ui-line);color:var(--ui-muted);box-shadow:none;opacity:1;cursor:not-allowed;transform:none;text-decoration:none}
html body :is(.danger-button,button[data-delete-draft],button[data-delete-work],button[data-delete-asset],button[data-delete-profile],button[data-delete-job]) {color:var(--ui-danger);border-color:#d9bbb5;background:var(--ui-surface)}
html body :is(.danger-button,button[data-delete-draft],button[data-delete-work],button[data-delete-asset],button[data-delete-profile],button[data-delete-job]):hover:not(:disabled) {background:var(--ui-danger-bg);color:var(--ui-danger);border-color:var(--ui-danger)}
html body :is(.entry-downloads a,.task-downloads a,.task-actions a,.work-actions a) {display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:4px 2px;color:var(--ui-ink);font-size:calc(12px * var(--ui-text-scale,1));text-decoration:underline;text-underline-offset:4px}
html body :is(.icon-button,.favorite-button,[data-detach]) {width:36px;height:36px;min-height:36px;padding:8px;flex-shrink:0;border-radius:8px}
html body :is(.nav-item.active,.filters button.active,.composer-tab.active,.human-method.selected,.scene-options>button[aria-pressed="true"]) {background:var(--ui-selected);border-color:var(--ui-control-line);color:var(--ui-ink);box-shadow:none}
html body :is(.task-nav-item.selected,.task-nav-item.selected small,.task-nav-item.selected time) {color:var(--ui-ink)}
html body .task-nav-item.selected {background:var(--ui-selected);border-color:var(--ui-control-line)}

/* Creator: a readable work surface, with materials separate from parameters. */
html body #sidebar {background:var(--ui-rail)}
html body .topbar {background:var(--ui-canvas);border-bottom:1px solid var(--ui-line)}
html body .hero {max-width:1080px;margin-inline:auto;text-align:left;padding:28px 0 24px}
html body .hero h1 {font-size:calc(30px * var(--ui-text-scale,1));margin:0 0 10px}
html body .hero-description {max-width:70ch;font-size:calc(14px * var(--ui-text-scale,1));margin:0}
html body .composer-wrap {max-width:1080px}
html body .composer-tabs {justify-content:flex-start;gap:8px;margin-bottom:18px}
html body .composer-tab {border-radius:8px;padding:9px 14px;min-height:42px;color:var(--ui-muted);border:1px solid transparent}
html body .composer-tab svg {width:18px;height:18px}
html body :is(.composer,.conversation-composer) {background:var(--ui-surface);border:1px solid var(--ui-control-line);border-radius:14px;box-shadow:none;padding:18px}
html body :is(.composer,.conversation-composer):focus-within {border-color:var(--ui-control-line);outline:none}
html body :is(.composer,.conversation-composer).drag-over {border-color:var(--ui-focus);outline:2px dashed var(--ui-focus);background:var(--ui-soft)}
html body :is(.composer,.conversation-composer) label.field-label {display:block;margin:0 0 7px;font-size:calc(12px * var(--ui-text-scale,1));font-weight:500}
html body :is(#ideaInput,#conversationPrompt) {border:0;background:transparent;padding:9px 2px 14px;font-size:calc(14px * var(--ui-text-scale,1));line-height:1.75;min-height:calc(8.75em + 23px);height:calc(8.75em + 23px);max-height:36dvh;outline-offset:0;box-shadow:none}
html body .composer-tools {border-top:1px solid var(--ui-line);padding:14px 0 0;gap:14px;align-items:center}
html body .settings {gap:8px;flex-wrap:wrap}
html body .tool-divider {background:var(--ui-line);margin:0 2px}
html body .select-wrap select {border-color:var(--ui-line);background:var(--ui-canvas);min-height:38px;padding:7px 28px 7px 10px}
html body .select-wrap>svg {color:var(--ui-muted)}
html body .attach-button {border:1px solid var(--ui-line);background:var(--ui-surface);border-radius:8px;padding:8px 10px;min-height:38px;color:var(--ui-ink)}
html body .attachment-list {margin:6px 0 12px}
html body .draft-toolbar {margin-top:12px;padding-top:3px;align-items:center}
html body .composer-foot {gap:12px;border-top:0;padding-top:8px;font-size:calc(11px * var(--ui-text-scale,1))}
html body .quick-actions {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;justify-content:initial;margin-top:24px}
html body .quick-actions>button {display:flex;align-items:center;gap:10px;min-width:0;border:0;border-radius:0;border-top:1px solid var(--ui-line);background:transparent;padding:15px 0;text-align:left;white-space:normal}
html body .quick-actions>button>span:nth-child(2) {min-width:0;flex:1}
html body .quick-actions small {display:block;color:var(--ui-muted);font-size:calc(10px * var(--ui-text-scale,1));margin-top:4px}
html body .quick-icon {background:var(--ui-soft);border:0;width:30px;height:30px;border-radius:7px;flex-shrink:0}
html body .quick-arrow {width:15px}
html body .featured-section {margin-top:28px}
html body :is(.featured-heading>span,.section-heading h2>span,.gallery-empty p,.library-card p,.library-card small) {color:var(--ui-muted)}
html body :is(.library-card,.batch-panel,.batch-item,.channel-card,.pool-group-card,.panel) {border-color:var(--ui-line);border-radius:var(--ui-radius);box-shadow:none;background:var(--ui-surface)}
html body :is(.library-heading,.batch-heading) {gap:20px;margin-bottom:24px}
html body :is(.gallery,.library-grid) {gap:20px}
html body :is(.gallery-search input,.gallery-search) {background:var(--ui-surface)}
html body .gallery-search input {border:0;outline-offset:-2px;padding:7px}

/* Batch follows the actual work sequence; no new required fields or limits. */
html body .batch-workspace {max-width:1080px;padding-top:28px}
html body .batch-panel {padding:24px}
html body #batchSellingPoints {min-height:calc(8.5em + 20px);height:calc(8.5em + 20px);max-height:380px}
html body .batch-form-actions {border-top:1px solid var(--ui-line);padding-top:20px;margin-top:24px;gap:16px;flex-wrap:wrap}
html body .batch-purpose {gap:12px}
html body .batch-item {padding:20px}
html body .batch-foot-note {max-width:75ch;line-height:1.8}

/* Conversation keeps its own scrolling record region and a real bottom input. */
html body.conversation-open main {padding-top:0}
html body .conversation-heading {padding:20px 0 14px;border-bottom:1px solid var(--ui-line)}
html body .conversation-heading h1 {font-size:calc(18px * var(--ui-text-scale,1));max-width:75ch}
html body .conversation-timeline {padding:22px 8px 28px 0;scroll-padding-block:20px;scrollbar-color:#b9bfb0 var(--ui-canvas)}
html body .entry-meta {gap:12px;flex-wrap:wrap;color:var(--ui-muted)}
html body .entry-meta>span {color:var(--ui-ink);background:var(--ui-soft);border-radius:5px}
html body .entry-prompt-details summary {color:var(--ui-ink)}
html body .entry-prompt-details .task-prompt {background:var(--ui-soft);color:var(--ui-ink);border-radius:8px;line-height:1.8}
html body .conversation-composer {margin-bottom:18px;padding:14px 16px;max-height:45dvh;overflow-y:auto}
html body #conversationPrompt {min-height:calc(8.75em + 18px);height:calc(8.75em + 18px);max-height:24dvh;font-size:calc(13px * var(--ui-text-scale,1))}
html body .conversation-tools {padding-top:12px;border-top:1px solid var(--ui-line);gap:8px}
html body .conversation-tools select {max-width:155px;background:var(--ui-canvas);border-color:var(--ui-line);padding:8px;min-height:38px}
html body .conversation-reference {background:var(--ui-soft);color:var(--ui-ink);padding:10px;border-radius:8px}
html body .conversation-hint {margin-top:10px}
html body .task-status-panel {background:var(--ui-soft);border-color:var(--ui-line);color:var(--ui-ink)}
html body .task-status-panel.success {background:var(--ui-success-bg);color:var(--ui-success)}
html body .task-status-panel.failed {background:var(--ui-danger-bg);color:var(--ui-danger)}
html body .task-status-symbol {animation:none;border-color:currentColor}

/* Admin and migration use the same field system, not a separate visual theme. */
html body .workspace {background:var(--ui-canvas)}
html body .workspace .sidebar {background:var(--ui-rail);border-color:var(--ui-line)}
html body .workspace :is(.content,.page) {color:var(--ui-ink)}
html body .workspace :is(.stats article,.channel-card,.panel) {padding:24px}
html body .workspace .table-panel {padding:0}
html body .workspace .page-heading {margin-bottom:24px;gap:18px}
html body .workspace .page-heading h1 {font-size:calc(27px * var(--ui-text-scale,1))}
html body :is(.prompt-panel textarea,.task-prompt) {font-family:var(--ui-font);font-size:calc(13px * var(--ui-text-scale,1));line-height:1.8}
html body :is(.table-scroll,.table-panel) {border-radius:10px}
html body :is(th,td,.stats strong,.task-parameters,.batch-counts,.entry-meta) {font-variant-numeric:tabular-nums}
html body th {color:var(--ui-muted);background:var(--ui-canvas)}
html body :is(td,th) {padding-top:15px;padding-bottom:15px;border-color:var(--ui-line)}
html body .runninghub-pool {padding:24px}
html body .pool-fields {gap:20px}
html body .pool-group-card {padding:16px}
html body .pool-fields label {color:var(--ui-ink)}
html body .pool-routing {padding-bottom:20px;margin:20px 0}
html body .pool-reserved {padding-top:20px}
html body :is(.pill,.draft-badge) {background:var(--ui-soft);border-color:var(--ui-line);color:var(--ui-muted);border-radius:5px}
html body .pill.ready {color:var(--ui-success);background:var(--ui-success-bg);border-color:#ceddce}
html body :is(.form-error,.inline-notice.error) {color:var(--ui-danger)}
html body .inline-notice {border-color:var(--ui-line);background:var(--ui-soft);color:var(--ui-muted);border-radius:8px;line-height:1.8}
html body dialog {border:1px solid var(--ui-line);border-radius:16px;padding:28px;background:var(--ui-surface);color:var(--ui-ink);box-shadow:none;max-height:90dvh;overflow-y:auto}
html body dialog::backdrop {background:rgb(30 34 26 / .38);backdrop-filter:none}
html body :is(.dialog-description,.dialog-eyebrow,.authDescription) {color:var(--ui-muted)}
html body :is(.dialog-actions,.modal-toolbar,.task-actions) {gap:12px;flex-wrap:wrap}
html body dialog textarea {min-height:calc(8.5em + 20px);line-height:1.8}
html body #promptOutput {height:270px;max-height:45dvh;min-height:160px}
html body .auth-panel {max-width:410px}
html body .auth-story {background:var(--ui-rail)}
html body .auth-panel input {margin-top:8px;min-height:44px}
html body .auth-gate {background:var(--ui-canvas)}
html body .migration-page {max-width:820px;margin:48px auto;padding:28px;background:var(--ui-surface);border:1px solid var(--ui-line);border-radius:14px}
html body .migration-page :is(h1,h2) {margin:0 0 16px}
html body .migration-page h2 {margin-top:28px}
html body .migration-page p {line-height:1.85;margin-bottom:18px}
html body .migration-page input[type="file"] {display:block;max-width:100%;margin:16px 0}

/* Pointer feedback only; everyday input and refresh states remain immediate. */
html[data-ui-input="pointer"] body :is(.primary-button,.primary,.secondary-button,.row-button) {transition:transform var(--ui-press) var(--ui-ease)}
html[data-ui-input="pointer"] body :is(.primary-button,.primary,.secondary-button,.row-button):active:not(:disabled) {transform:scale(.985)}
html[data-ui-input="keyboard"] body :is(button,dialog,.sidebar,.sidebar-resize) {transition:none;animation:none}
@media(max-width:1000px) {html body .quick-actions {grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px) {
  html body .hero {padding-top:24px}html body .hero h1 {font-size:calc(25px * var(--ui-text-scale,1))}
  html body :is(.composer,.conversation-composer) {padding:14px;border-radius:12px}
  html body .composer-tools {align-items:stretch}html body .composer-tools>.primary-button {width:100%}
  html body .settings {width:100%}html body .settings .select-wrap {flex:1 1 110px}
  html body .settings select {width:100%}html body .attach-button {min-height:42px}
  html body .quick-actions {gap:12px}html body .quick-actions>button {gap:8px;padding-block:12px}
  html body .quick-actions .quick-arrow {display:none}
  html body :is(.batch-panel,.batch-item,.runninghub-pool,.workspace .channel-card,.workspace .prompt-panel) {padding:18px}
  html body .conversation-composer {max-height:44dvh;margin-bottom:10px}
  html body .conversation-tools select {flex:1 1 110px;max-width:100%}
  html body .conversation-tools .primary-button {margin-left:0;flex:1 1 100%}
  html body .conversation-heading {padding-top:12px}
  html body dialog {padding:22px;max-width:calc(100% - 24px)}
  html body .migration-page {margin:16px 12px;padding:20px}
}
@media(prefers-reduced-motion:reduce) {
  html body *,html body *::before,html body *::after {animation:none!important;transition:none!important;scroll-behavior:auto!important}
  html body button:active {transform:none!important}
}

/* Facts remain visible without competing with the writing surface. */
html body .composer-notes {display:grid;gap:7px;padding-top:6px}
html body .composer-notes #memberQuota {background:transparent;border:0;margin:0;padding:0;font-size:calc(11px * var(--ui-text-scale,1));color:var(--ui-muted)}
html body .composer-notes .upload-hint {margin:0;font-size:calc(11px * var(--ui-text-scale,1))}
html body .composer-notes .composer-foot {margin:0;padding-top:0;justify-content:flex-start;gap:8px 20px}
html body .workspace .nav-item {display:flex;align-items:center;gap:10px}
html body .admin-nav-icon {width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}

/* Round-one findings: avoid doubled field rings; preserve photo-overlay contrast. */
html body :is(#ideaInput,#conversationPrompt):focus-visible {outline:none}
html body :is(#taskSearch,#gallerySearch) {border:0;background:transparent;box-shadow:none}
html body .featured-content h3,html body .art-overlay :is(h2,h3) {color:#fff}
html body .composer-tabs {margin:0 0 18px}
html body .toast {left:auto;right:24px;bottom:22px;max-width:min(400px,calc(100vw - 32px));transform:none;pointer-events:none}
@media(max-width:700px){html body .toast {right:16px;bottom:16px}}

/* Preserve the primary sidebar action at 150% text and the 184px minimum rail. */
html body #sidebar .new-project {height:auto;min-height:48px;flex-shrink:0;white-space:normal;line-height:1.5;gap:8px;overflow-wrap:anywhere}
html body #sidebar .new-project svg {width:18px;height:18px;flex-shrink:0}

/* One clear state per control: no field ring stacked on a wrapper ring. */
html body :is(input,select,textarea):hover:not(:disabled):not(:focus):not([readonly]) {border-color:var(--ui-control-line)}
html body :is(input,select,textarea):focus-visible {outline:none;border-color:var(--ui-focus)}
html[data-ui-input="keyboard"] body :is(input,select,textarea):focus-visible {outline:2px solid var(--ui-focus);outline-offset:3px}
html body :is(input,select,textarea):is(:disabled,[readonly]) {border-color:var(--ui-line);background:var(--ui-soft);color:var(--ui-muted);opacity:1;cursor:not-allowed}
html body :is(input,select,textarea)[aria-invalid="true"],
html body .field-error :is(input,select,textarea),
html body .form-error :is(input,select,textarea) {border-color:var(--ui-danger);background:var(--ui-danger-bg);color:var(--ui-ink)}
html body :is(.composer,.conversation-composer):has([aria-invalid="true"]) {border-color:var(--ui-danger)}
html body :is(#ideaInput,#conversationPrompt)[aria-invalid="true"] {background:var(--ui-danger-bg)}
html body select option:checked {background:var(--ui-selected);color:var(--ui-ink)}
html body .inline-notice.error {color:var(--ui-danger);background:var(--ui-danger-bg);border-color:#d9bbb5}
html body :is(#studioLoginError,#studioPasswordError,.form-error):not(:empty) {color:var(--ui-danger);font-size:calc(12px * var(--ui-text-scale,1));line-height:1.7}
html body :is(.primary-button,.secondary-button,.text-button,.row-button):focus-visible {outline:2px solid var(--ui-focus);outline-offset:2px}
html body :is(.secondary-button,.row-button):active:not(:disabled) {background:var(--ui-selected);border-color:var(--ui-control-line)}
/* Search fields show the focus once, on the labelled wrapper, not on both layers. */
html body :is(.task-search,.gallery-search) {border:1px solid transparent;border-radius:8px;background:color-mix(in srgb,var(--ui-ink) 3%,var(--ui-surface));padding:0 10px;min-height:40px;transition:border-color 160ms cubic-bezier(.2,.65,.3,1),background-color 160ms cubic-bezier(.2,.65,.3,1)}
html body :is(.task-search,.gallery-search):hover {border-color:var(--ui-line)}
html body :is(.task-search,.gallery-search):focus-within {border-color:var(--ui-control-line);background:var(--ui-surface);outline:none}
html body :is(.task-search,.gallery-search) :is(input,[type="search"]) {border:0;background:transparent;box-shadow:none;outline:none!important;padding:8px 0;min-height:38px}
html body :is(.task-search,.gallery-search)>svg {color:var(--ui-muted);flex-shrink:0}
html[data-ui-input="keyboard"] body :is(.task-search,.gallery-search,.composer,.conversation-composer):has(input:focus-visible,textarea:focus-visible) {outline:2px solid var(--ui-focus);outline-offset:3px}
/* Long copy and enlarged text must wrap rather than widen their containers. */
html body :is(.settings-copy,.settings-note,.batch-legacy-draft,.batch-total-hint) {overflow-wrap:anywhere}
html body :is(.settings-field,.batch-legacy-actions) {min-width:0}
