:root {
  --bg: #f4f4f2;
  --paper: #ffffff;
  --paper-soft: #fafaf8;
  --panel: #ffffff;
  --ink: #18181b;
  --muted: #71717a;
  --subtle: #a1a1aa;
  --line: #e8e8e5;
  --line-strong: #d8d8d3;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eef4ff;
  --green: #15803d;
  --rose: #dc2626;
  --shadow: 0 20px 50px rgba(24, 24, 27, 0.12);
  --shadow-soft: 0 8px 24px rgba(24, 24, 27, 0.06);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  letter-spacing: -0.01em;
}

button {
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.app-shell {
  --control-width: 356px;
  --inspector-width: 310px;
  --saved-height: 280px;
  --log-height: 180px;
  grid-template-columns: 58px minmax(0, var(--control-width)) 6px minmax(420px, 1fr) 6px minmax(0, var(--inspector-width));
  background: var(--bg);
}

.rail,
.control-panel,
.main-stage,
.iteration-panel {
  border-color: var(--line);
  background: var(--paper);
}

.rail {
  gap: 8px;
  padding: 12px 8px;
}

.rail-logo,
.rail-button {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.rail-logo svg,
.rail-button svg,
.usage-refresh svg,
.drop-icon svg,
.button-icon svg,
.search-box svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-logo svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
  stroke: none;
}

.rail-logo {
  margin-bottom: 8px;
  background: #18181b;
  box-shadow: none;
  font-size: 19px;
}

.rail-button {
  border: 0;
  color: #71717a;
  font-size: 17px;
}

.rail-button:hover {
  background: #f4f4f2;
  color: #27272a;
}

.rail-button.active {
  border: 0;
  background: #18181b;
  color: #fff;
}

.rail-avatar {
  width: 38px;
  height: 38px;
  border-color: var(--line);
  background: #f4f4f2;
  color: #3f3f46;
  box-shadow: none;
}

.rail-avatar:hover {
  border-color: #c8c8c2;
  background: #eaeae7;
  color: #18181b;
}

.control-panel,
.iteration-panel {
  gap: 0;
  padding: 0 18px 24px;
  scrollbar-gutter: stable;
}

.control-panel::-webkit-scrollbar,
.iteration-panel::-webkit-scrollbar,
.gallery-grid::-webkit-scrollbar,
.saved-grid::-webkit-scrollbar,
.activity-log-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.control-panel::-webkit-scrollbar-thumb,
.iteration-panel::-webkit-scrollbar-thumb,
.gallery-grid::-webkit-scrollbar-thumb,
.saved-grid::-webkit-scrollbar-thumb,
.activity-log-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #d4d4cf;
  background-clip: padding-box;
}

.brand-row,
.inspector-header {
  min-height: 72px;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin-bottom: 5px;
  color: #a1a1aa;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

h1 {
  font-size: 24px;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 19px;
  letter-spacing: -0.035em;
}

.status-dot {
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.status-dot.ready {
  box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.1);
}

.control-panel > .usage-card,
.control-panel > .project-panel,
.control-panel > .field,
.control-panel > .prompt-assist-panel,
.control-panel > .reference-slot,
.control-panel > .settings-row {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.usage-card {
  gap: 10px;
  padding: 16px 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.usage-card-header h2 {
  font-size: 14px;
}

.usage-refresh {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: #f4f4f2;
  color: #52525b;
  box-shadow: none;
}

.usage-refresh:hover {
  background: #eaeae7;
  color: #18181b;
}

.usage-refresh svg {
  width: 16px;
  height: 16px;
}

.usage-amount-row {
  align-items: center;
  padding: 5px 0 1px;
  border: 0;
  color: #71717a;
}

.usage-amount-row strong {
  color: #18181b;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.usage-metrics {
  gap: 12px;
  padding-top: 6px;
}

.usage-metrics div {
  gap: 2px;
}

.usage-metrics strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.usage-metrics span,
.usage-billing-note {
  color: #8a8a93;
  font-size: 14px;
}

.project-panel {
  gap: 12px;
  padding: 20px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.project-panel-header {
  align-items: center;
  gap: 8px;
}

.project-panel-header h2 {
  font-size: 18px;
}

.project-header-actions {
  gap: 5px;
  min-width: 0;
}

.smart-project-trigger,
.project-panel-header .ghost-button {
  min-height: 40px;
  border-radius: 10px;
  font-size: 14px;
  white-space: nowrap;
}

.smart-project-trigger {
  gap: 5px;
  padding: 0 10px;
  border-color: #cbd9f4;
  background: #f4f7ff;
  color: #2457a7;
  box-shadow: none;
}

.smart-project-trigger:hover,
.smart-project-trigger[aria-expanded="true"] {
  border-color: #9db8ea;
  background: #eaf1ff;
  box-shadow: none;
}

.project-panel-header .ghost-button {
  min-width: 46px;
  padding: 0 10px;
}

.smart-project-form,
.project-create-form,
.workflow-editor {
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafaf8;
  box-shadow: none;
}

.smart-project-form textarea {
  min-height: 88px;
}

.field {
  gap: 7px;
}

.control-panel > .field {
  padding: 18px 0;
}

.control-panel > .field + .prompt-assist-panel {
  padding-top: 0;
}

.field > span,
.field-label,
.saved-library-header span {
  color: #3f3f46;
  font-size: 14px;
  font-weight: 700;
}

.field-label strong {
  color: #a1a1aa;
  font-size: 14px;
  font-weight: 700;
}

textarea,
input,
select {
  border-color: var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: #18181b;
  box-shadow: none;
}

textarea:hover,
input:hover,
select:hover {
  border-color: #bdbdb7;
}

textarea:focus,
input:focus,
select:focus {
  border-color: #7da2ec;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  padding: 13px;
}

textarea#promptInput {
  min-height: 156px;
  max-height: 280px;
  font-size: 14px;
  line-height: 1.65;
}

textarea#iterationPrompt {
  min-height: 116px;
  max-height: 240px;
}

.project-pipeline {
  display: flex;
  gap: 5px;
  max-width: 100%;
  overflow: visible;
  padding: 0;
  scrollbar-width: none;
}

.project-stage {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  gap: 4px;
  padding: 6px 2px;
  border: 0;
  border-radius: 9px;
  background: #f5f5f3;
  color: #71717a;
  box-shadow: none;
}

.project-stage span {
  width: 18px;
  height: 18px;
  background: #e7e7e3;
  color: #71717a;
  font-size: 14px;
}

.project-stage strong {
  width: 100%;
  font-size: 14px;
  font-weight: 700;
}

.project-stage small {
  display: none;
}

.project-stage.done {
  border: 0;
  background: #f1f6f2;
  color: #397452;
}

.project-stage.active {
  border: 0;
  background: #eaf1ff;
  color: #1d4ed8;
  box-shadow: none;
}

.project-stage.active span {
  background: #2563eb;
}

.project-summary {
  min-height: 46px;
  padding: 9px 11px;
  border: 0;
  border-left: 2px solid #d4d4cf;
  border-radius: 0 8px 8px 0;
  background: #fafaf8;
}

.project-summary strong {
  font-size: 14px;
}

.project-summary span {
  color: #8a8a93;
  font-size: 14px;
  font-weight: 650;
}

.prompt-assist-panel,
.prompt-assist-panel.compact-assist.expanded {
  gap: 9px;
  padding: 14px 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.prompt-assist-panel.compact-assist.expanded {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafaf8;
}

.prompt-assist-toggle {
  min-height: 42px;
  border: 0;
  background: #f4f4f2;
  color: #3f3f46;
}

.prompt-assist-toggle:hover {
  background: #eaeae7;
}

.prompt-assist-header {
  gap: 8px;
}

.prompt-assist-header strong {
  font-size: 14px;
}

.prompt-assist-header span {
  color: #a1a1aa;
  font-size: 14px;
  font-weight: 650;
}

.prompt-assist-header select {
  flex-basis: 112px;
  height: 38px;
  font-size: 14px;
}

.prompt-assist-controls {
  gap: 8px;
}

.prompt-assist-controls select,
.prompt-assist-controls .secondary-button {
  height: 42px;
  min-height: 42px;
}

.prompt-assist-result {
  min-height: 42px;
  max-height: 116px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #52525b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

.prompt-assist-panel > .ghost-button {
  min-height: 38px;
}

.reference-dropzone {
  min-height: 72px;
  gap: 11px;
  padding: 12px;
  border-color: #cfcfc9;
  border-radius: 11px;
  background: #fafaf8;
  box-shadow: none;
}

.reference-dropzone:hover,
.reference-dropzone:focus,
.reference-dropzone.dragging {
  border-color: #7da2ec;
  background: #f7f9ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.09);
}

.drop-icon {
  flex-basis: 36px;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #18181b;
  font-size: 21px;
}

.drop-icon svg {
  width: 18px;
  height: 18px;
}

.drop-copy strong {
  font-size: 14px;
}

.drop-copy small {
  color: #8a8a93;
  font-size: 14px;
}

.reference-slot {
  min-height: 54px;
  padding: 12px 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.reference-slot.empty {
  min-height: 54px;
}

.reference-slot .ghost-button {
  min-height: 36px;
}

.model-note,
.reference-hint {
  margin: 1px 0 0;
  color: #8a8a93;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.segmented button,
.segmented button:nth-child(4n),
.segmented button:nth-last-child(-n + 4) {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf8;
  color: #52525b;
  font-size: 14px;
  font-weight: 700;
}

.segmented button:hover {
  border-color: #c6c6c0;
  background: #f1f1ee;
}

.segmented button.active {
  border-color: #a9c2f5;
  background: #eaf1ff;
  color: #1d4ed8;
  box-shadow: none;
}

.settings-row {
  grid-template-columns: minmax(0, 1fr) minmax(142px, 1.2fr);
  gap: 10px;
  padding: 18px 0;
}

.stepper {
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  height: 44px;
  border-color: var(--line-strong);
  border-radius: 10px;
}

.stepper button,
.stepper input {
  height: 42px;
}

.stepper button {
  color: #52525b;
  font-size: 19px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.primary-button {
  background: #2563eb;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.primary-button:hover {
  background: #1d4ed8;
}

.secondary-button {
  background: #18181b;
}

.secondary-button:hover {
  background: #27272a;
}

.ghost-button {
  border-color: var(--line);
  background: #fff;
  color: #52525b;
}

.ghost-button:hover,
.toolbar-button:hover {
  border-color: #d0d0cb;
  background: #f4f4f2;
  color: #18181b;
}

.control-panel > #generateButton {
  min-height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 11px;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.2);
}

.button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: none;
}

.button-count {
  min-width: 26px;
  height: 26px;
  font-variant-numeric: tabular-nums;
}

.generation-path-guide,
.iteration-path-hint {
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafaf8;
}

.generation-path-options {
  gap: 6px;
}

.generation-path-card {
  min-height: 58px;
  padding: 9px;
  border-color: var(--line);
  border-radius: 9px;
  box-shadow: none;
}

.generation-path-card:hover {
  border-color: #c9c9c3;
  box-shadow: none;
  transform: none;
}

.generation-path-card.active {
  border-color: #b6caf2;
  background: #eef4ff;
}

.panel-resizer {
  min-width: 6px;
  border-color: var(--line);
  background: #f4f4f2;
}

.panel-resizer::before {
  width: 1px;
  height: 46px;
  background: #d2d2cc;
}

.panel-toggle {
  top: 16px;
  width: 24px;
  height: 32px;
  border-color: var(--line);
  border-radius: 8px;
  color: #71717a;
  box-shadow: 0 6px 16px rgba(24, 24, 27, 0.08);
}

.main-stage {
  background: #f7f7f5;
}

.workspace-topbar {
  min-height: 72px;
  padding: 14px 20px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.search-box {
  width: min(300px, 27vw);
  height: 42px;
  border-color: var(--line);
  border-radius: 10px;
  background: #f7f7f5;
}

.search-box:focus-within {
  border-color: #9ab6ee;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.search-box > span {
  display: inline-flex;
  color: #8a8a93;
}

.search-box svg {
  width: 15px;
  height: 15px;
}

.toolbar-button {
  width: 38px;
  height: 38px;
  border-color: var(--line);
  border-radius: 9px;
  background: #fff;
  color: #71717a;
  font-size: 16px;
}

.toolbar-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-button.active {
  border-color: #c4d4f4;
  background: #eef4ff;
  color: #1d4ed8;
}

.section-toggle-button {
  width: 32px;
  height: 32px;
  border-color: var(--line);
  background: #fff;
  color: #71717a;
}

.status-strip {
  gap: 0;
  padding: 0 8px;
  border-color: var(--line);
  background: #fff;
}

.status-strip div {
  min-height: 58px;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
  background: transparent;
}

.status-strip div:last-child {
  border-right: 0;
}

.status-strip span {
  color: #a1a1aa;
  font-size: 14px;
  font-weight: 700;
}

.status-strip strong {
  color: #27272a;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  padding: 20px;
}

.empty-state {
  min-height: 48vh;
  border: 0;
  border-radius: 14px;
  background: #f1f1ee;
  color: #8a8a93;
  font-size: 14px;
}

.empty-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.image-tile,
.loading-card {
  min-height: 260px;
  border-color: var(--line);
  border-radius: 11px;
  box-shadow: none;
}

.image-tile:hover {
  border-color: #d0d0cb;
  box-shadow: 0 10px 28px rgba(24, 24, 27, 0.07);
}

.image-tile.selected {
  border-color: #7da2ec;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
}

.tile-info {
  padding: 10px 11px;
  border-color: var(--line);
}

.tile-info strong {
  font-size: 14px;
}

.section-resizer {
  flex-basis: 6px;
  min-height: 6px;
  border-color: var(--line);
  background: #f1f1ee;
}

.section-resizer::before {
  width: 50px;
  height: 1px;
  background: #cecec8;
}

.stage-folder-bar {
  margin: 14px 20px 0;
  padding: 11px 12px;
  border-color: var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: none;
}

.stage-folder-chip,
.stage-filter-toggle {
  border-color: var(--line);
  background: #fafaf8;
}

.stage-folder-chip.active {
  border-color: #bfd0f1;
  background: #eef4ff;
}

.saved-library,
.activity-log {
  border-color: var(--line);
  background: #fff;
}

.saved-library {
  gap: 10px;
  padding: 14px 18px 16px;
}

.saved-library h2,
.activity-log h2 {
  font-size: 16px;
}

.saved-grid {
  gap: 9px;
}

.saved-tile,
.saved-empty,
.log-item,
.log-empty {
  border-color: var(--line);
  border-radius: 9px;
  box-shadow: none;
}

.activity-log {
  gap: 9px;
  padding: 13px 18px 16px;
  background: #fafaf8;
}

.iteration-panel {
  padding: 0 18px 24px;
}

.selected-preview {
  margin-top: 18px;
  border-color: var(--line);
  border-radius: 12px;
  background: #f4f4f2;
}

.iteration-panel > .field {
  padding-top: 18px;
}

.iteration-panel > .primary-button {
  margin-top: 16px;
}

.meta-list {
  gap: 7px;
  color: #8a8a93;
  font-size: 14px;
}

.meta-list div {
  border-color: var(--line);
}

.meta-list strong {
  color: #3f3f46;
}

.image-modal {
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(10px);
}

.toast {
  border: 0;
  border-radius: 10px;
  background: #18181b;
  font-size: 14px;
  box-shadow: 0 14px 34px rgba(24, 24, 27, 0.22);
}

@media (max-width: 1120px) {
  .app-shell {
    --inspector-width: 280px;
    grid-template-columns: 54px minmax(0, var(--control-width)) 6px minmax(360px, 1fr) 6px minmax(0, var(--inspector-width));
  }

  .workspace-topbar {
    flex-wrap: wrap;
  }

  .search-box {
    order: 3;
    width: 100%;
  }
}

@media (max-width: 920px) {
  .app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 20;
    max-height: none;
    flex-direction: row;
    justify-content: center;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-logo {
    margin: 0 8px 0 0;
  }

  .rail-spacer {
    display: block;
  }

  .panel-resizer,
  .section-resizer {
    display: none;
  }

  .control-panel,
  .iteration-panel {
    position: static;
    max-height: none;
    border-right: 0;
  }

  .main-stage {
    min-height: 70vh;
    border-top: 1px solid var(--line);
  }

  .saved-library,
  .activity-log {
    flex-basis: auto;
    min-height: 180px;
    max-height: none;
  }

  .iteration-panel {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 600px) {
  .control-panel,
  .iteration-panel {
    padding-right: 14px;
    padding-left: 14px;
  }

  .rail {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .rail-spacer {
    flex: 1 0 16px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .project-panel-header {
    align-items: flex-start;
  }

  .project-header-actions {
    flex-wrap: wrap;
  }

  .project-stage strong {
    font-size: 14px;
  }

  .settings-row {
    grid-template-columns: minmax(0, 1fr) minmax(126px, 1fr);
  }

  .workspace-topbar,
  .saved-library,
  .activity-log,
  .gallery-grid {
    padding-right: 14px;
    padding-left: 14px;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-strip div:nth-child(2) {
    border-right: 0;
  }

  .gallery-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Focused workspace architecture — progressive disclosure and single-view content. */
.rail-contextual {
  display: none;
}

.cowart-fab {
  top: auto !important;
  right: auto !important;
  bottom: 66px !important;
  left: 9px !important;
  width: 40px !important;
  height: 40px !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 11px !important;
  background: #f4f4f2 !important;
  color: #52525b !important;
  box-shadow: none !important;
}

.cowart-fab:hover {
  background: #eaeae7 !important;
  color: #18181b !important;
}

.cowart-fab span {
  display: none !important;
}

.cowart-fab svg {
  width: 18px !important;
  height: 18px !important;
}

.control-panel > .usage-card,
.control-panel > .project-panel,
.control-panel > .field,
.control-panel > .prompt-assist-panel,
.control-panel > .control-disclosure {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.control-disclosure {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
}

.control-disclosure > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 10px 0;
  color: #3f3f46;
  cursor: pointer;
  list-style: none;
}

.control-disclosure > summary::-webkit-details-marker {
  display: none;
}

.control-disclosure > summary:hover .disclosure-label {
  color: #18181b;
}

.disclosure-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 14px;
  font-weight: 760;
}

.disclosure-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: #f1f1ee;
  color: #52525b;
  font-size: 14px;
  font-weight: 700;
}

.disclosure-icon svg,
.project-tool-button svg,
.prompt-assist-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-disclosure > summary > strong {
  overflow: hidden;
  max-width: 172px;
  color: #8a8a93;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disclosure-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a1a1aa;
  font-size: 15px;
  transition: transform 0.18s ease;
}

.control-disclosure[open] > summary .disclosure-chevron,
.prompt-assist-panel.expanded .disclosure-chevron {
  transform: rotate(180deg);
}

.disclosure-body {
  padding: 2px 0 16px;
}

.usage-card {
  display: block;
  padding: 0;
}

.usage-card > summary > strong {
  max-width: none;
  color: #27272a;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.usage-details {
  position: relative;
  padding-top: 4px;
}

.usage-refresh {
  display: none;
}

.usage-metrics {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafaf8;
}

.usage-billing-note {
  margin: 8px 2px 0;
  line-height: 1.5;
}

.project-panel {
  padding: 18px 0;
}

.project-panel-header {
  gap: 12px;
}

.project-header-actions {
  flex: 0 0 auto;
}

.smart-project-trigger {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
}

.project-tool-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px !important;
  height: 36px;
  min-height: 36px !important;
  padding: 0 !important;
  border-radius: 9px !important;
}

.project-pipeline:not(.has-project),
.project-summary:not(.has-project) {
  display: none;
}

.project-pipeline.has-project {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.project-stage {
  min-height: 46px;
  padding: 6px 4px;
}

.project-stage strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-summary.has-project {
  min-height: 0;
  padding: 9px 10px;
}

.control-panel > .field {
  padding: 18px 0 10px;
  border-bottom: 0;
}

textarea#promptInput {
  height: 150px;
  min-height: 148px;
  max-height: 250px;
}

.prompt-assist-panel.compact-assist {
  display: grid;
  gap: 9px;
  padding: 0 0 14px;
  border-radius: 0;
  background: transparent;
}

.prompt-assist-panel.compact-assist:not(.expanded) > :not(.prompt-assist-toggle) {
  display: none !important;
}

.prompt-assist-panel.compact-assist.expanded {
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.prompt-assist-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafaf8;
  color: #3f3f46;
  text-align: left;
}

.prompt-assist-toggle:hover {
  border-color: #d0d0cb;
  background: #f4f4f2;
}

.prompt-assist-toggle > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 760;
}

.prompt-assist-toggle small {
  color: #a1a1aa;
  font-size: 14px;
  font-weight: 700;
}

.reference-dropzone {
  min-height: 80px;
}

.reference-slot.empty {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.reference-slot.empty > span,
.reference-slot.empty .ghost-button {
  display: none;
}

.output-settings-body {
  display: grid;
  gap: 12px;
}

.output-settings-body .field,
.output-settings-body .settings-row {
  margin: 0;
  padding: 0;
  border: 0;
}

.output-settings-body .model-note {
  max-height: 48px;
  overflow: auto;
}

.is-hidden-control {
  display: none !important;
}

.control-panel > #generateButton {
  position: sticky;
  bottom: 10px;
  z-index: 5;
  flex: 0 0 auto;
  min-height: 50px;
  margin-top: 14px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2), 0 0 0 8px rgba(255, 255, 255, 0.94);
}

.panel-resizer {
  border-color: var(--line);
  background: transparent;
}

.panel-resizer::before,
.section-resizer {
  display: none;
}

.app-shell.inspector-collapsed .inspector-resizer {
  visibility: hidden;
  overflow: hidden;
}

.app-shell.control-collapsed {
  --control-width: 0px !important;
}

.app-shell.inspector-collapsed {
  --inspector-width: 0px !important;
}

.app-shell.control-collapsed .control-panel,
.app-shell.inspector-collapsed .iteration-panel {
  display: none;
}

.workspace-topbar {
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) auto;
  gap: 16px;
  min-height: 76px;
}

.workspace-heading {
  min-width: 112px;
}

.workspace-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f4f4f2;
}

.workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #71717a;
  font-size: 14px;
  font-weight: 760;
  white-space: nowrap;
}

.workspace-tab:hover {
  color: #27272a;
}

.workspace-tab.active {
  background: #fff;
  color: #18181b;
  box-shadow: 0 1px 3px rgba(24, 24, 27, 0.08);
}

.workspace-tab strong {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eaeae7;
  color: #52525b;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.workspace-tab.active strong {
  background: #eaf1ff;
  color: #1d4ed8;
}

.workspace-topbar .search-box {
  justify-self: end;
  width: min(320px, 100%);
}

.workspace-topbar .gallery-actions {
  gap: 6px;
}

.workspace-topbar #toggleResultsSectionButton,
.utility-actions,
.system-status {
  display: none !important;
}

.main-stage:not(.has-results) .workspace-topbar .gallery-actions,
.main-stage:not(.has-results):not(.has-saved) .workspace-topbar .search-box,
.workspace-view-saved .workspace-topbar .gallery-actions,
.workspace-view-log .workspace-topbar .gallery-actions,
.workspace-view-log .workspace-topbar .search-box {
  display: none;
}

.main-stage > .saved-library,
.main-stage > .activity-log,
.main-stage > #savedResizeHandle,
.main-stage > #logResizeHandle {
  display: none;
}

.main-stage.workspace-view-results > #galleryGrid {
  display: grid !important;
  flex: 1 1 0;
}

.main-stage.workspace-view-saved > #galleryGrid,
.main-stage.workspace-view-log > #galleryGrid {
  display: none !important;
}

.main-stage.workspace-view-saved > .saved-library {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  padding: 20px;
  border-top: 0;
  background: #f7f7f5;
}

.main-stage.workspace-view-saved .saved-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: minmax(190px, auto);
  gap: 14px;
}

.main-stage.workspace-view-log > .activity-log {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  padding: 20px;
  border-top: 0;
  background: #f7f7f5;
}

.main-stage.workspace-view-log .activity-log-list {
  display: grid !important;
}

.saved-library-header,
.activity-log-header {
  min-height: 46px;
  padding-bottom: 10px;
}

@media (max-width: 1280px) {
  .workspace-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .workspace-heading {
    display: none;
  }

  .workspace-topbar .search-box {
    order: 0;
  }
}

@media (max-width: 760px) {
  .cowart-fab {
    top: 10px !important;
    right: 58px !important;
    bottom: auto !important;
    left: auto !important;
  }

  .workspace-topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .workspace-tabs {
    width: 100%;
  }

  .workspace-tab {
    flex: 1 1 0;
    justify-content: center;
  }

  .workspace-topbar .search-box,
  .workspace-topbar .gallery-actions {
    width: 100%;
    justify-self: stretch;
  }

  .project-pipeline.has-project {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-panel > #generateButton {
    bottom: 8px;
  }
}

/* Guided workspace — explicit navigation, one project entry and recoverable errors. */
@media (min-width: 921px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, var(--control-width)) 6px minmax(420px, 1fr) 6px minmax(0, var(--inspector-width));
  }

  .rail {
    gap: 6px;
    padding: 12px 9px;
  }

  .rail-logo {
    align-self: center;
    width: 42px;
    height: 42px;
    margin-bottom: 10px;
  }

  .rail-button,
  .rail-avatar {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 68px;
    height: 56px;
    padding: 6px 4px;
    border-radius: 12px;
  }

  .rail-button svg {
    width: 19px;
    height: 19px;
  }

  .rail-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
  }

  .rail-avatar-mark {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e4e4e1;
    font-size: 14px;
    font-weight: 700;
  }

  .cowart-fab {
    z-index: 30 !important;
    bottom: 80px !important;
    left: 9px !important;
    width: 68px !important;
    height: 56px !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 6px 4px !important;
    border-radius: 12px !important;
  }

  .cowart-fab span {
    display: block !important;
    max-width: 62px;
    overflow: hidden;
    color: inherit;
    font-size: 0 !important;
    font-weight: 700 !important;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cowart-fab span::after {
    content: "画布";
    font-size: 14px;
  }
}

.project-panel-header {
  align-items: center;
}

.project-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.smart-project-trigger {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

.project-tool-button {
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: 38px;
  padding: 0 10px !important;
  gap: 6px;
  font-size: 14px !important;
}

.project-tool-button.hidden {
  display: none !important;
}

.smart-project-heading strong,
.manual-project-heading strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.smart-project-heading span,
.manual-project-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.smart-project-form label[for="smartProjectModel"],
#smartProjectModel {
  display: none;
}

.smart-project-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.smart-project-actions #createSmartProjectButton {
  grid-column: 1 / -1;
}

.manual-project-switch {
  justify-self: start;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.manual-project-heading {
  margin-bottom: 2px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 12px 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.toast.show {
  pointer-events: auto;
}

.toast #toastMessage {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-action {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: #ffffff;
  color: #18181b;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.toast-action:hover {
  background: #f4f4f2;
}

.toast-action.hidden,
.rail-contextual {
  display: none !important;
}

@media (max-width: 920px) {
  .cowart-fab {
    display: none !important;
  }

  .rail-button,
  .rail-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: auto;
    min-width: 58px;
    height: 44px;
    padding: 5px 9px;
  }

  .rail-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
  }

  .rail-avatar-mark {
    display: none;
  }

  .smart-project-actions {
    grid-template-columns: 1fr;
  }

  .smart-project-actions > * {
    width: 100%;
  }

  .manual-project-switch {
    justify-self: stretch;
  }

  .toast {
    align-items: stretch;
    flex-direction: column;
  }

  .toast-action {
    width: 100%;
  }
}
