/* Letzte Cleaning Prüfung: 23.09.2026
   Letztes Cleaning: 24.08.2026 */
[hidden] {
  display: none !important;
}

.factory-workspace.open {
  display: grid;
  place-items: center;
  padding: 60px;
}

.workspace-backdrop {
  background: rgba(2, 3, 7, .82);
  backdrop-filter: blur(12px);
}

.workspace-panel {
  position: relative;
  top: auto;
  right: auto;
  width: min(1120px, calc(100vw - 120px));
  height: calc(100vh - 120px);
  height: calc(100dvh - 120px);
  max-height: none;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid #30323d;
  border-radius: 22px;
  background: #0d0e14;
  box-shadow: 0 36px 120px rgba(0, 0, 0, .72), 0 0 0 1px rgba(255, 255, 255, .025);
  animation: factory-modal-in .25s ease;
}

.workspace-header {
  position: relative;
  padding: 22px 28px;
  border-bottom: 1px solid #292b35;
  background: #111219;
}

.workspace-header h2 {
  font-size: 25px;
}

.workspace-body {
  min-height: 0;
  overflow: auto;
  padding: 26px 30px 0;
  scrollbar-color: #3b3e49 #15161d;
}

.workspace-intro-card {
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 16px;
}

.workspace-intro-card > div {
  display: grid;
  gap: 4px;
}

.workspace-intro-card > div > strong {
  font-size: 13px;
  color: #f0f1f4;
}

.workspace-intro-card .workspace-intro {
  font-size: 12px;
  line-height: 1.5;
}

.workspace-form {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
}

.workspace-body:has(> .workspace-form:not([hidden])) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-body > .workspace-form:not([hidden]) {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.workspace-form > .workspace-group[data-current] {
  align-self: stretch;
  min-height: 0;
  margin-bottom: 0;
  padding: 0 3px 18px 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-color: #3b3e49 transparent;
}

.workspace-wizard-progress {
  display: grid;
  gap: 10px;
  padding: 5px 2px 22px;
}

.wizard-progress-copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wizard-progress-copy span {
  color: #858b99;
  font-size: 11px;
}

.wizard-progress-copy strong {
  color: #ff4b67;
  font-size: 12px;
}

.wizard-progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 10px;
  background: #242630;
}

.wizard-progress-track span {
  display: block;
  width: 14%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d90a32, #ff4562);
  box-shadow: 0 0 16px rgba(255, 35, 71, .45);
  transition: width .25s ease;
}

.workspace-group,
.workspace-group[data-open] {
  display: block;
  align-self: start;
  margin: 0 0 28px;
  overflow: visible;
  border: 0;
  background: transparent;
  animation: wizard-step-in .22s ease;
}

.workspace-group legend {
  float: none;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 14px;
  padding: 2px 0 21px;
  cursor: default;
}

.workspace-group legend > span:last-child {
  display: grid;
  gap: 5px;
  min-width: 0;
  align-items: start;
}

.workspace-group legend b {
  display: block;
  width: auto;
  height: auto;
  place-items: initial;
  border-radius: 0;
  background: transparent;
  color: #f2f3f6;
  font: 600 22px 'Space Grotesk';
  line-height: 1.2;
}

.workspace-group legend small {
  display: block;
  color: #858b99;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.wizard-step-number {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 35, 71, .32);
  border-radius: 11px;
  background: rgba(255, 35, 71, .12);
  color: #ff4b67;
  font-size: 11px;
  font-weight: 800;
  /* Ohne diese Zeile erbt die Zahl die Zeilenhoehe der Legende (1.45) und
     sitzt dadurch sichtbar zu hoch im Kaestchen. */
  line-height: 1;
}

.workspace-group-grid,
.workspace-group[data-open] .workspace-group-grid {
  clear: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  padding: 20px;
  border: 1px solid #292c36;
  border-radius: 15px;
  background: #111219;
}

.workspace-field label:not(.workspace-check) {
  font-size: 13px;
  line-height: 1.4;
}

.workspace-field input,
.workspace-field textarea,
.workspace-field select {
  min-height: 46px;
  background: #181a22;
}

.workspace-field textarea {
  min-height: 118px;
}

.workspace-field .wizard-invalid {
  border-color: #ff4562;
  box-shadow: 0 0 0 3px rgba(255, 35, 71, .12);
}

.workspace-actions {
  position: relative;
  bottom: auto;
  z-index: 4;
  display: grid;
  /* Die dritte Spalte war fest 190px breit. "Produktion starten" plus
     Credit-Anhaenger ist breiter, und weil .workspace-run overflow:visible
     traegt, wurde der Anhaenger neben dem roten Feld gezeichnet statt
     darin. Am 24.08.2026 im YouTube-Publisher gemeldet. Vier Werkzeuge
     hatten dagegen je eine eigene min-width-Regel; die Spalte richtet sich
     jetzt nach ihrem Inhalt, und das gilt fuer alle. */
  grid-template-columns: 150px 1fr auto;
  gap: 16px;
  margin: 0 -30px;
  padding: 17px 30px;
  border-top: 1px solid #292b35;
  background: rgba(13, 14, 20, .97);
  backdrop-filter: blur(14px);
}

.workspace-actions .workspace-note {
  align-self: center;
  justify-self: center;
  text-align: center;
}

.wizard-secondary,
.wizard-primary,
.workspace-run {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.wizard-secondary {
  /* Ohne diese Zentrierung klebte der Text oben am Rand: der Knopf hat eine
     min-height von 46px, aber als Block-Element richtet sich sein Inhalt
     nicht daran aus. .wizard-primary bekam das schon, .wizard-secondary
     nicht - deshalb fiel es nur beim Zurueck-Knopf auf. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #393c47;
  background: #181a21;
  color: #d8dae0;
}

.wizard-primary {
  grid-column: 3;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 190px;
  background: linear-gradient(135deg, #ff2347, #e20d35);
  color: #fff;
  box-shadow: 0 12px 34px rgba(255, 35, 71, .24);
}

.wizard-primary:hover {
  background: #ff3c5b;
  box-shadow: 0 14px 38px rgba(255, 35, 71, .34);
}

.workspace-run {
  grid-column: 3;
  width: auto;
  max-width: none;
  justify-self: end;
}

.factory-processing,
.processing-finished {
  padding: 18px 0 45px;
}

.workspace-form[hidden] + #workspace-result .factory-processing {
  margin-top: 0;
  padding: 4px 0 8px;
}

.workspace-form[hidden] + #workspace-result .processing-footnote {
  margin: 0;
}

.workspace-body:has(.factory-processing) {
  overflow: hidden;
  padding-top: 12px;
}

.workspace-panel:has(.factory-processing) {
  width: min(820px, calc(100vw - 120px));
  height: auto;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
}

.workspace-panel:has(.factory-processing) .workspace-header {
  padding: 18px 24px;
}

.workspace-panel:has(.factory-processing) .workspace-body {
  padding: 12px 28px 8px;
}

.workspace-panel:has(.result-finished:not(.image-result-finished)) {
  width: min(1540px, calc(100vw - 120px));
}

.workspace-panel:has(.image-result-finished),
.workspace-panel:has(.previous-image-choice) {
  width: min(980px, calc(100vw - 120px));
  height: auto;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
}

.workspace-panel:has(.image-result-finished) .workspace-body,
.workspace-panel:has(.previous-image-choice) .workspace-body {
  padding-bottom: 18px;
}

.workspace-panel:has(.image-result-finished) .image-result-finished {
  padding-bottom: 4px;
}

.workspace-body:has(.factory-processing) .processing-orb {
  width: 76px;
  height: 76px;
  margin: 2px auto 12px;
  border-radius: 23px;
  font-size: 33px;
}

.workspace-body:has(.factory-processing) .processing-heading h3 {
  margin: 5px 0;
  font-size: 26px;
}

.workspace-body:has(.factory-processing) .processing-heading p {
  min-height: 19px;
  font-size: 12px;
}

.workspace-body:has(.factory-processing) .processing-progress {
  margin: 16px 0 8px;
}

.workspace-body:has(.factory-processing) .processing-steps {
  gap: 6px;
  margin-top: 14px;
}

.workspace-body:has(.factory-processing) .processing-steps li {
  gap: 11px;
  padding: 9px 12px;
}

.workspace-body:has(.factory-processing) .step-state {
  flex-basis: 28px;
  width: 28px;
  height: 28px;
}

.workspace-body:has(.factory-processing) .processing-steps strong {
  font-size: 12px;
}

.workspace-body:has(.factory-processing) .processing-steps small,
.workspace-body:has(.factory-processing) .processing-footnote {
  font-size: 10px;
}

.workspace-body:has(.factory-processing) .processing-actions {
  margin-top: 10px;
}

@keyframes factory-modal-in {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: none; }
}

@keyframes wizard-step-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .factory-workspace.open { padding: 10px; }
  .workspace-panel { width: 100%; height: calc(100vh - 8px); height: calc(100dvh - 8px); max-height: none; border-radius: 16px; }
  .workspace-panel:has(.factory-processing) { width: 100%; height: auto; max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .workspace-panel:has(.image-result-finished),
  .workspace-panel:has(.previous-image-choice) { width: 100%; height: auto; max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }
  .workspace-header { padding: 18px 20px; }
  .workspace-body { padding: 20px 18px 0; }
  .workspace-body:has(> .workspace-form:not([hidden])) { overflow: hidden; }
  .workspace-form { min-height: 0; }
  .workspace-group-grid,
  .workspace-group[data-open] .workspace-group-grid { grid-template-columns: 1fr; padding: 16px; }
  .workspace-field { grid-column: 1 / -1; }
  .workspace-actions { grid-template-columns: 1fr 1fr; margin: 0 -18px; padding: 13px 18px; }
  .workspace-actions .workspace-note { display: none; }
  .wizard-primary,
  .workspace-run { grid-column: 2; }
}

/* === Mobile Nachbesserungen, 28.08.2026 ==================================
   Nur additive Regeln fuer sehr schmale Telefone (<=480px). Der bestehende
   760px-Block oben bleibt unveraendert; hier werden lediglich Kopf,
   Innenabstaende und die Fussleiste weiter verdichtet, damit nichts ueber
   den Rand laeuft. */
@media (max-width: 480px) {
  .factory-workspace.open { padding: 6px; }

  .workspace-panel {
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    border-radius: 13px;
  }

  .workspace-header { padding: 14px 16px; }
  .workspace-header h2 { font-size: 20px; }
  .workspace-body { padding: 16px 14px 0; }

  .workspace-group legend { gap: 11px; padding-bottom: 16px; }
  .workspace-group legend b { font-size: 18px; }
  .wizard-step-number { flex-basis: 30px; width: 30px; height: 30px; border-radius: 9px; }

  .workspace-actions { gap: 10px; margin: 0 -14px; padding: 12px 14px; }
  .wizard-secondary,
  .wizard-primary,
  .workspace-run { padding: 0 14px; }

  /* Der Startknopf traegt feste Mindestbreiten (190px, mit Credit-Plakette
     225px aus ai-contentfactory-form-v2.css). In der halben Rasterspalte
     eines 360px-Telefons ragte er dadurch aus dem Fenster. */
  .wizard-primary,
  .workspace-run { min-width: 0; }
  .wizard-primary.has-credit { min-width: 0; }

  .workspace-body:has(.factory-processing) .processing-orb {
    width: 64px;
    height: 64px;
    border-radius: 19px;
    font-size: 28px;
  }
  .workspace-body:has(.factory-processing) .processing-heading h3 { font-size: 21px; }
}
