:root {
  color-scheme: light;
  --bg: #f3f5f2;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #667168;
  --line: #dce2da;
  --accent: #0f7b6c;
  --accent-strong: #095f55;
  --accent-soft: #e3f4f0;
  --warn: #9b5b13;
  --shadow: 0 18px 48px rgba(23, 32, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 22px;
  width: min(1520px, 100%);
  height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.control-panel,
.picture-panel {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 22px;
}

.picture-panel {
  padding: 24px;
}

.brand-row,
.picture-header,
.action-row,
.header-tools,
.job-panel-header,
.picture-topline,
.detail-toolbar {
  display: flex;
  align-items: center;
}

.brand-row,
.picture-header,
.job-panel-header {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

.status-pill,
.metric {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fbfcfa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric {
  display: grid;
  gap: 1px;
  min-width: 74px;
  border-radius: 8px;
  text-align: center;
}

.metric strong {
  color: var(--ink);
  font-size: 21px;
}

.action-row {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
}

textarea {
  resize: vertical;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}

select {
  padding: 10px 12px;
}

.yaml-field textarea {
  min-height: 430px;
}

.message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--warn);
  font-size: 14px;
}

.summary {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.header-tools {
  gap: 12px;
  flex: 0 0 auto;
}

.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.empty-state {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.empty-copy {
  display: grid;
  gap: 8px;
  max-width: 360px;
  color: var(--muted);
  text-align: center;
}

.empty-copy strong {
  color: var(--ink);
  font-size: 20px;
}

.part-card {
  position: relative;
}

.picture-preview {
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

.delete-part,
.job-delete-button {
  position: absolute;
  z-index: 3;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #a33a2a;
  font-size: 20px;
  line-height: 1;
}

.delete-part {
  top: 8px;
  right: 8px;
}

.picture-frame {
  --accent: #0f7b6c;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  padding: 26px 30px;
  background: #f8fbf8;
  color: #17201b;
}

.picture-topline {
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.picture-frame h3 {
  margin: 16px 0 18px;
  font-size: clamp(22px, 2.2vw, 36px);
  line-height: 1.12;
}

.picture-body {
  min-height: 0;
  flex: 1;
}

.dsl-body h4 {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 18px;
}

.picture-bullet-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.picture-bullet-list li {
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.35;
}

.dsl-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dsl-bars {
  display: grid;
  gap: 12px;
}

.dsl-bar-row {
  display: grid;
  grid-template-columns: minmax(74px, 0.25fr) minmax(0, 1fr) minmax(44px, auto);
  gap: 10px;
  align-items: center;
}

.dsl-bar-track {
  height: 28px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 123, 108, 0.14);
}

.dsl-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.dsl-bar-row span,
.dsl-bar-row strong {
  overflow: hidden;
  font-size: 17px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dsl-timeline ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dsl-timeline li {
  display: grid;
  gap: 7px;
  min-width: 0;
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.dsl-timeline li span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.dsl-timeline li strong {
  font-size: 17px;
}

.dsl-timeline li p {
  margin: 0;
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
}

.job-panel {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.job-panel h2 {
  font-size: 16px;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.job-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.job-list-row {
  position: relative;
}

.job-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 40px 10px 12px;
  background: #fbfcfa;
  color: var(--ink);
  text-align: left;
}

.job-list-item span {
  color: var(--muted);
  font-size: 12px;
}

.job-delete-button {
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
}

.detail-modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 14, 12, 0.56);
}

.modal-panel {
  position: fixed;
  inset: 4vh 4vw;
  z-index: 21;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.modal-close {
  width: 38px;
  height: 38px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  font-size: 28px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 20px;
  min-height: 0;
  padding: 20px;
}

.detail-preview-shell,
.detail-editor-shell {
  min-height: 0;
  overflow: auto;
}

.detail-preview .picture-frame {
  max-width: 920px;
  margin: 0 auto;
}

.detail-toolbar {
  gap: 12px;
  margin-bottom: 12px;
}

.compact-field {
  flex: 1;
  margin-top: 0;
}

.part-yaml-input {
  height: calc(100vh - 210px);
  min-height: 420px;
}

.guide-panel {
  inset: 8vh 16vw;
}

.guide-intro {
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  color: var(--muted);
  line-height: 1.6;
}

.guide-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.guide-split section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.guide-split section + section {
  border-left: 1px solid var(--line);
}

.guide-split h3 {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  font-size: 15px;
}

.guide-content {
  overflow: auto;
  flex: 1;
  margin: 0;
  padding: 20px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

@media (max-width: 960px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    height: auto;
    padding: 14px;
  }

  .modal-panel,
  .guide-panel {
    inset: 2vh 2vw;
  }

  .guide-split {
    grid-template-columns: 1fr;
  }

  .guide-split section + section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}
