.document-template-page {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.84), rgba(246, 243, 236, 0) 360px),
    var(--paper);
}

.document-template-main {
  margin: 0 auto;
  max-width: 1500px;
  min-height: calc(100svh - 142px);
  padding: 44px clamp(20px, 4vw, 58px) 72px;
}

.workshop-intro {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-bottom: 28px;
}

.workshop-intro h1 {
  font-size: 3.8rem;
  line-height: 1;
  margin: 0;
}

.workshop-intro > div > p:last-child {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.78;
  margin: 18px 0 0;
  max-width: 860px;
}

.local-service-status {
  align-items: center;
  background: rgba(255, 253, 248, 0.84);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-top: 24px;
  min-height: 92px;
  padding: 18px 20px;
}

.local-service-status[data-state="ready"] {
  border-left-color: #2f7b62;
}

.local-service-status[data-state="offline"] {
  border-left-color: var(--brick);
}

.service-state-mark {
  background: var(--gold);
  border: 5px solid rgba(195, 155, 75, 0.16);
  border-radius: 50%;
  height: 18px;
  width: 18px;
}

.local-service-status[data-state="ready"] .service-state-mark {
  background: #2f7b62;
  border-color: rgba(47, 123, 98, 0.16);
}

.local-service-status[data-state="offline"] .service-state-mark {
  background: var(--brick);
  border-color: rgba(155, 61, 46, 0.14);
}

.service-state-copy strong,
.output-location strong,
.workshop-result strong {
  font-family: "Segoe UI", sans-serif;
}

.service-state-copy p {
  color: var(--muted);
  line-height: 1.55;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.service-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.workshop-shell {
  margin-top: 24px;
}

.workshop-mode-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
}

.workshop-mode-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  min-height: 50px;
  padding: 0 22px;
}

.workshop-mode-tabs button[aria-selected="true"] {
  border-bottom-color: var(--brick);
  color: var(--ink);
}

.workshop-mode-tabs button:focus-visible,
.saved-template-item:focus-visible,
.workshop-form-panel input:focus,
.workshop-form-panel select:focus,
.button:focus-visible {
  outline: 3px solid rgba(36, 93, 166, 0.24);
  outline-offset: 2px;
}

.workshop-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 350px;
  padding-top: 24px;
}

.workshop-form-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 490px;
  padding: 30px;
}

[hidden] {
  display: none !important;
}

.form-panel-heading {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr);
  padding-bottom: 22px;
}

.form-panel-heading > span {
  color: var(--brick);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  padding-top: 5px;
}

.form-panel-heading h2,
.saved-templates h2 {
  font-size: 1.75rem;
  line-height: 1.18;
  margin: 0;
}

.form-panel-heading p {
  color: var(--muted);
  line-height: 1.7;
  margin: 9px 0 0;
}

.workshop-form-panel form {
  margin-top: 24px;
}

.workshop-form-panel fieldset {
  border: 0;
  display: grid;
  gap: 12px;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.workshop-form-panel fieldset:disabled {
  opacity: 0.58;
}

.field-label {
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
  margin-top: 8px;
}

.workshop-form-panel input,
.workshop-form-panel select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 52px;
  padding: 0 15px;
  width: 100%;
}

.workshop-form-panel select {
  cursor: pointer;
}

.workshop-form-panel .file-input {
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  padding: 8px 10px;
}

.file-input::file-selector-button {
  background: rgba(36, 93, 166, 0.1);
  border: 0;
  border-radius: 6px;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  margin-right: 12px;
  min-height: 34px;
  padding: 0 14px;
}

.field-note {
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.6;
  margin: 0;
}

.workshop-submit {
  border: 0;
  cursor: pointer;
  justify-self: start;
  margin-top: 12px;
  min-width: 190px;
}

.saved-templates {
  border-left: 1px solid var(--line);
  min-height: 490px;
  padding-left: 24px;
}

.saved-templates-heading {
  border-bottom: 1px solid var(--line);
  padding: 6px 0 20px;
}

.saved-template-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 4px;
}

.saved-template-item {
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 6px;
  min-height: 70px;
  padding: 13px 14px;
  text-align: left;
  width: 100%;
}

.saved-template-item:hover {
  border-color: rgba(155, 61, 46, 0.45);
}

.saved-template-name {
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.saved-template-meta,
.template-list-empty {
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.84rem;
}

.template-list-empty {
  line-height: 1.7;
  margin: 0;
  padding: 10px 2px;
}

.output-location {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
}

.output-location code {
  color: var(--muted);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.workshop-progress {
  align-items: center;
  background: rgba(36, 93, 166, 0.06);
  border: 1px solid rgba(36, 93, 166, 0.28);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 0.7fr) minmax(260px, 1fr) auto;
  margin-top: 24px;
  padding: 18px 20px;
}

.workshop-progress[data-state="complete"] {
  background: rgba(47, 123, 98, 0.08);
  border-color: rgba(47, 123, 98, 0.34);
}

.workshop-progress[data-state="failed"],
.workshop-progress[data-state="cancelled"],
.workshop-progress[data-state="interrupted"] {
  background: rgba(155, 61, 46, 0.06);
  border-color: rgba(155, 61, 46, 0.3);
}

.workshop-progress-copy {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  min-width: 0;
}

.workshop-progress-copy .section-kicker {
  flex-basis: 100%;
  margin: 0;
}

.workshop-progress-copy strong {
  font-family: "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
}

#workshopProgressCount {
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.86rem;
  white-space: nowrap;
}

#workshopProgressBar {
  accent-color: var(--blue);
  height: 12px;
  width: 100%;
}

.workshop-result {
  align-items: center;
  background: rgba(47, 123, 98, 0.08);
  border: 1px solid rgba(47, 123, 98, 0.36);
  border-radius: 8px;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-top: 24px;
  padding: 20px;
}

.workshop-result[data-state="error"] {
  background: rgba(155, 61, 46, 0.07);
  border-color: rgba(155, 61, 46, 0.36);
}

.workshop-result p {
  color: var(--muted);
  line-height: 1.6;
  margin: 5px 0 0;
}

.workshop-quality-warnings {
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
  margin-top: 12px;
}

.workshop-quality-warnings summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.workshop-quality-warnings ul {
  line-height: 1.6;
  margin: 8px 0 0;
  padding-left: 20px;
}

@media (max-width: 900px) {
  .workshop-intro,
  .workshop-layout {
    grid-template-columns: 1fr;
  }

  .workshop-intro {
    align-items: start;
  }

  .workshop-intro .button {
    justify-self: start;
  }

  .local-service-status {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .service-state-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .saved-templates {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: auto;
    padding: 24px 0 0;
  }

  .workshop-progress {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #workshopProgressBar {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 620px) {
  .document-template-main {
    padding: 30px 16px 52px;
  }

  .workshop-intro h1 {
    font-size: 2.55rem;
  }

  .workshop-intro > div > p:last-child {
    font-size: 1rem;
  }

  .local-service-status {
    align-items: start;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 16px;
  }

  .service-state-actions,
  .service-state-actions .button {
    width: 100%;
  }

  .workshop-mode-tabs button {
    flex: 1;
    padding-inline: 10px;
  }

  .workshop-form-panel {
    min-height: 0;
    padding: 20px 16px;
  }

  .form-panel-heading {
    gap: 12px;
  }

  .form-panel-heading h2,
  .saved-templates h2 {
    font-size: 1.45rem;
  }

  .workshop-submit,
  .workshop-progress .button,
  .workshop-result .button {
    width: 100%;
  }

  .workshop-progress {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  #workshopProgressBar {
    grid-column: auto;
    grid-row: auto;
  }

  .workshop-result {
    align-items: stretch;
    flex-direction: column;
  }
}
