:root {
  color-scheme: light;
  --page: #f6f8fb;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #5e6875;
  --line: #cad3df;
  --deep: #315c4b;
  --deep-soft: rgba(49, 92, 75, 0.09);
  --accent: #e07a5f;
  --shadow: 0 18px 44px rgba(39, 49, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

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

.chart-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.chart-workbench,
.result-panel {
  border: 1px solid rgba(202, 211, 223, 0.9);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chart-workbench {
  padding: 24px;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 18px;
}

h2 {
  font-size: 14px;
}

.chart-summary,
.run-status,
.template-actions span,
.result-head span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.chart-summary {
  max-width: 420px;
  margin: 4px 0 0;
  text-align: right;
}

.chart-form {
  display: grid;
  gap: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

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

input,
select {
  padding: 0 12px;
}

textarea {
  min-height: 240px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
  tab-size: 4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--deep);
  outline: 3px solid rgba(49, 92, 75, 0.12);
}

.template-preview {
  overflow: auto;
  border: 1px solid rgba(202, 211, 223, 0.95);
  border-radius: 8px;
  background: #fbfcfe;
}

.template-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(202, 211, 223, 0.8);
}

.template-preview-head strong {
  font-size: 14px;
}

.template-preview-head span {
  color: var(--muted);
  font-size: 12px;
}

.template-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.template-preview th,
.template-preview td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(202, 211, 223, 0.65);
  text-align: left;
  white-space: nowrap;
}

.template-preview th {
  background: rgba(49, 92, 75, 0.06);
  color: var(--deep);
}

.template-actions,
.runner-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.template-actions button,
.primary-button,
.figure-preview-head a,
.figure-preview-head button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 5px;
  border: 1px solid rgba(49, 92, 75, 0.24);
  border-radius: 8px;
  background: var(--deep-soft);
  color: var(--deep);
  cursor: pointer;
  font-size:12px;
  /* font-weight: 800; */
  text-decoration: none;
}

.primary-button {
  min-height: 42px;
  padding: 0 20px;
  background: var(--deep);
  color: #fff;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.result-panel {
  margin-top: 20px;
  padding: 20px;
}

.result-panel.hidden {
  display: none;
}

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.result-body > p {
  margin: 0;
  color: #8a2f24;
  font-weight: 700;
}

.figure-result-card {
  display: grid;
  gap: 16px;
}

.figure-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.figure-preview-head strong {
  font-size: 14px;
  line-height: 1.35;
}

.figure-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.figure-next-button {
  border-color: rgba(224, 122, 95, 0.45) !important;
  background: rgba(224, 122, 95, 0.14) !important;
  color: #7c3b2c !important;
}

.figure-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(32, 61, 52, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(32, 61, 52, 0.035) 1px, transparent 1px),
    #fdfdfb;
  background-size: 22px 22px;
}

.figure-preview-frame img {
  display: block;
  max-width: 100%;
  height: auto;
}

.figure-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.figure-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(49, 92, 75, 0.16);
  border-radius: 8px;
  background: rgba(49, 92, 75, 0.06);
  color: var(--deep);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .chart-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .chart-workbench,
  .result-panel {
    padding: 16px;
  }

  .chart-head,
  .result-head {
    display: grid;
  }

  .chart-summary {
    max-width: none;
    text-align: left;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .figure-preview-frame {
    min-height: 280px;
  }
}
