.workbench { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; background: #f5f2ec; color: #181512; }
.workbench-nav { background: #171411; color: #f8f2e8; padding: 18px 12px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100vh; }
.workbench-nav a, .workbench-nav button { border: 0; border-radius: 10px; background: transparent; color: rgba(255,255,255,.72); padding: 10px 12px; text-align: left; cursor: pointer; }
.workbench-nav a.active, .workbench-nav a:hover, .workbench-nav button:hover { background: rgba(255,255,255,.12); color: #fff; }
.workbench-main { min-width: 0; padding: 22px; }
.workbench-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.workbench-top h1 { margin: 4px 0 0; font-size: 26px; letter-spacing: 0; }
.top-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.top-stats span { border-radius: 999px; background: #181512; color: #fff; padding: 7px 12px; font-size: 13px; font-weight: 700; }
.project-strip, .template-row { border: 1px solid #ddd4c7; background: #fff; border-radius: 18px; padding: 16px; margin-bottom: 16px; }
.strip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.strip-head h2, .brief-panel h2, .asset-panel h2, .canvas-toolbar h2 { margin: 0; }
.project-list { display: grid; grid-auto-flow: column; grid-auto-columns: 220px; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.project-card, .template-card { border: 1px solid #e2d8c9; background: #fbf8f2; border-radius: 14px; padding: 12px; text-align: left; cursor: pointer; min-height: 112px; }
.project-card.active { border-color: #181512; box-shadow: inset 0 0 0 1px #181512; }
.project-card img, .cover-placeholder { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background: #181512; color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.project-card strong, .template-card strong { display: block; font-size: 14px; margin-bottom: 5px; }
.project-card small, .template-card small { color: #756958; line-height: 1.5; }
.template-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.template-card span { display: inline-flex; border-radius: 999px; background: #181512; color: #fff; padding: 4px 9px; font-size: 12px; margin-bottom: 10px; }
.studio-grid { display: grid; grid-template-columns: 330px minmax(420px, 1fr) 320px; gap: 16px; align-items: start; }
.brief-panel, .canvas-panel, .asset-panel { border: 1px solid #ddd4c7; background: #fff; border-radius: 18px; padding: 18px; min-width: 0; }
.brief-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.generate-btn { width: 100%; margin-top: 16px; }
.canvas-panel { min-height: 650px; background: #ebe4d8; }
.canvas-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.hero-canvas { min-height: 560px; border: 1px solid #cfc2b0; border-radius: 24px; background: #f8f5ee; display: flex; align-items: center; justify-content: center; overflow: hidden; text-align: center; color: #756958; }
.hero-canvas img { max-width: 100%; max-height: 560px; object-fit: contain; }
.upload-zone { min-height: 118px; border: 1px dashed #c9bba8; border-radius: 16px; background: #fbf8f2; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; color: #756958; padding: 14px; }
.upload-zone input { display: none; }
.reference-preview { margin: 10px 0 14px; display: grid; gap: 8px; color: #2f6f45; font-size: 13px; }
.reference-preview img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 14px; border: 1px solid #ddd4c7; }
.option-stack { display: grid; gap: 8px; }
.option-stack label { border: 1px solid #e2d8c9; border-radius: 12px; padding: 10px; margin: 0; font-weight: 500; }
.resolution-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.resolution-grid label { margin: 0; border: 1px solid #e2d8c9; border-radius: 12px; padding: 10px; cursor: pointer; }
.resolution-grid input { width: auto; margin-right: 4px; }
.history-panel { margin-top: 18px; }
.history-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.history-item { border: 1px solid #e2d8c9; background: #fbf8f2; border-radius: 12px; padding: 6px; text-align: left; cursor: pointer; overflow: hidden; }
.history-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; }
.history-item small { display: block; color: #756958; margin-top: 5px; line-height: 1.4; }
.studio-grid-clean { grid-template-columns: 330px minmax(480px, 1fr) 320px; }
.page-panel { border: 1px solid #ddd4c7; background: #fff; border-radius: 18px; padding: 18px; }
.template-library { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.template-card-large { border: 1px solid #e2d8c9; background: #fbf8f2; border-radius: 16px; padding: 18px; display: grid; gap: 12px; align-content: start; min-height: 260px; }
.template-card-large span { width: fit-content; border-radius: 999px; background: #181512; color: #fff; padding: 5px 10px; font-size: 12px; font-weight: 700; }
.template-card-large h2 { margin: 0; font-size: 18px; }
.template-card-large p { margin: 0; color: #4f463c; line-height: 1.8; }
.template-card-large small { color: #756958; line-height: 1.6; }
.template-card-large .primary { display: inline-flex; align-items: center; justify-content: center; width: fit-content; margin-top: auto; }
.history-page-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.history-card { border: 1px solid #e2d8c9; background: #fbf8f2; border-radius: 16px; padding: 12px; display: grid; gap: 12px; }
.history-card img, .empty-image { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #ebe4d8; display: flex; align-items: center; justify-content: center; color: #756958; }
.history-card h2 { margin: 0; font-size: 15px; }
.history-card p { margin: 0; color: #4f463c; line-height: 1.6; font-size: 13px; }
.history-card small { color: #756958; line-height: 1.5; }
@media (max-width: 1180px) {
  .workbench { grid-template-columns: 1fr; }
  .workbench-nav { position: static; height: auto; flex-direction: row; overflow-x: auto; }
  .studio-grid, .studio-grid-clean, .template-library, .history-page-grid { grid-template-columns: 1fr; }
  .brief-panel { position: static; max-height: none; }
}

/* Workbench SaaS polish */
.workbench {
  grid-template-columns: 240px 1fr;
  background:
    radial-gradient(circle at 28% -12%, rgba(47, 107, 255, .08), transparent 30%),
    #f4f6f8;
  color: var(--app-ink, #14171f);
}

.workbench-nav {
  background: #0f172a;
  border-right: 1px solid rgba(255,255,255,.08);
  gap: 4px;
  padding: 20px 14px;
}

.workbench-nav a, .workbench-nav button {
  border-radius: var(--app-radius, 8px);
  color: rgba(226,232,240,.72);
  font-weight: 650;
}

.workbench-nav a.active, .workbench-nav a:hover, .workbench-nav button:hover {
  background: rgba(255,255,255,.10);
  color: #fff;
}

.workbench-main {
  padding: 28px 32px 40px;
}

.workbench-top {
  min-height: 64px;
  align-items: flex-start;
  border-bottom: 1px solid var(--app-line, #dfe5ec);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.workbench-top h1 {
  max-width: 920px;
  font-size: 28px;
  line-height: 1.2;
  color: var(--app-ink, #14171f);
}

.top-stats {
  align-items: center;
}

.top-stats span {
  background: var(--app-accent-soft, #eaf0ff);
  color: #1d4ed8;
  border: 1px solid #c7d7fe;
  box-shadow: none;
}

.top-stats .secondary {
  height: 36px;
  min-height: 36px;
  font-size: 13px;
}

.project-strip, .template-row, .brief-panel, .canvas-panel, .asset-panel, .page-panel {
  border-color: var(--app-line, #dfe5ec);
  border-radius: var(--app-radius, 8px);
  background: rgba(255,255,255,.96);
  box-shadow: var(--app-shadow, 0 18px 48px rgba(15, 23, 42, .08));
}

.project-strip {
  padding: 18px;
}

.strip-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--app-line, #dfe5ec);
}

.strip-head h2, .brief-panel h2, .asset-panel h2, .canvas-toolbar h2 {
  color: var(--app-ink, #14171f);
  line-height: 1.25;
}

.project-list {
  padding-top: 2px;
  scrollbar-color: #cbd5e1 transparent;
}

.project-card, .template-card, .template-card-large, .history-card {
  border-color: var(--app-line, #dfe5ec);
  border-radius: var(--app-radius, 8px);
  background: var(--app-surface-soft, #f8fafc);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.project-card:hover, .template-card:hover, .template-card-large:hover, .history-card:hover {
  transform: translateY(-2px);
  border-color: var(--app-line-strong, #cbd5e1);
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .08);
}

.project-card.active {
  border-color: var(--app-accent, #2f6bff);
  box-shadow: inset 0 0 0 1px var(--app-accent, #2f6bff), 0 14px 28px rgba(47, 107, 255, .12);
  background: #fff;
}

.project-card img, .cover-placeholder {
  border-radius: var(--app-radius, 8px);
  background: linear-gradient(135deg, #0f172a, #334155);
}

.template-card span, .template-card-large span {
  background: var(--app-accent-soft, #eaf0ff);
  color: #1d4ed8;
  border: 1px solid #c7d7fe;
}

.studio-grid, .studio-grid-clean {
  gap: 18px;
}

.brief-panel, .asset-panel {
  padding: 20px;
}

.brief-panel {
  top: 18px;
}

.canvas-panel {
  min-height: 650px;
  background: #eef2f7;
  padding: 18px;
}

.canvas-toolbar {
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--app-line, #dfe5ec);
}

.hero-canvas {
  border-color: var(--app-line-strong, #cbd5e1);
  border-radius: var(--app-radius, 8px);
  background:
    linear-gradient(45deg, rgba(148, 163, 184, .10) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, .10) 25%, transparent 25%),
    #fff;
  background-size: 22px 22px;
  color: var(--app-muted, #697386);
}

.hero-canvas img {
  border-radius: 6px;
}

.upload-zone {
  border-color: var(--app-line-strong, #cbd5e1);
  border-radius: var(--app-radius, 8px);
  background: #fff;
}

.upload-zone:hover {
  border-color: var(--app-accent, #2f6bff);
  background: #fbfdff;
}

.reference-preview img {
  border-color: var(--app-line, #dfe5ec);
  border-radius: var(--app-radius, 8px);
}

.option-stack label, .resolution-grid label {
  border-color: var(--app-line, #dfe5ec);
  border-radius: var(--app-radius, 8px);
  background: #fff;
}

.option-stack label:hover, .resolution-grid label:hover {
  border-color: var(--app-accent, #2f6bff);
}

.page-panel {
  padding: 20px;
}

.library-panel, .history-library-panel {
  min-height: 420px;
}

.template-library {
  gap: 16px;
}

.template-card-large {
  min-height: 280px;
  padding: 18px;
}

.template-card-large p, .history-card p {
  color: #334155;
}

.template-card-large .primary {
  min-height: 38px;
}

.history-page-grid {
  gap: 16px;
}

.history-card {
  padding: 10px;
  align-content: start;
}

.history-card img, .history-card .empty-image {
  border: 1px solid var(--app-line, #dfe5ec);
  border-radius: 7px;
  background: #eef2f7;
}

.history-card h2 {
  color: var(--app-ink, #14171f);
}

.primary:disabled,
.generate-btn:disabled {
  cursor: not-allowed;
  opacity: .68;
  transform: none;
  box-shadow: none;
}

.generating-state {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 32px;
}

.generate-spinner {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 4px solid rgba(47, 107, 255, .16);
  border-top-color: var(--app-accent, #2f6bff);
  animation: generate-spin .9s linear infinite;
}

@keyframes generate-spin {
  to { transform: rotate(360deg); }
}

.project-history-panel {
  margin-top: 18px;
  border-top: 1px solid var(--app-line, #dfe5ec);
  padding-top: 14px;
}

.strip-head.compact {
  border-bottom: 0;
  padding-bottom: 8px;
  margin-bottom: 0;
}

.project-history-list {
  max-height: 360px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
  scrollbar-color: #cbd5e1 transparent;
}

.project-history-item {
  border: 1px solid var(--app-line, #dfe5ec);
  border-radius: var(--app-radius, 8px);
  background: #fff;
  padding: 8px;
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.project-history-item:hover {
  border-color: var(--app-accent, #2f6bff);
  background: #fbfdff;
}

.project-history-item img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 6px;
}

.project-history-item small {
  color: var(--app-muted, #697386);
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .workbench {
    grid-template-columns: 1fr;
  }
  .workbench-nav {
    padding: 12px;
  }
  .workbench-nav .brand {
    min-width: max-content;
  }
  .workbench-nav a, .workbench-nav button {
    white-space: nowrap;
  }
  .workbench-main {
    padding: 18px;
  }
  .workbench-top {
    flex-wrap: wrap;
  }
}
