:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --blue: #1d4ed8;
  --green: #047857;
  --amber: #b45309;
  --red: #b42318;
  --soft-blue: #e8f0ff;
  --soft-green: #e7f6ee;
  --soft-amber: #fff3dd;
  --soft-red: #fde9e7;
  --shadow: 0 18px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #102a43;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.topnav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.topnav a:hover {
  border-color: var(--line);
  color: var(--ink);
  background: #f8fafc;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.handoff-strip,
.quote-layout,
.supplier-section,
.data-section {
  margin-bottom: 22px;
}

.handoff-strip {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.3fr) minmax(220px, 0.6fr);
  gap: 18px;
  align-items: start;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
}

.section-head {
  margin-bottom: 16px;
}

.handoff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.handoff-item {
  max-width: 100%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
}

.handoff-item strong {
  max-width: 260px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handoff-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.quote-form,
.quote-output,
.supplier-section,
.data-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quote-form,
.quote-output,
.supplier-section,
.data-section {
  padding: 20px;
}

.upload-zone {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px dashed #9aa9bd;
  border-radius: 8px;
  background: #f8fafc;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-zone strong,
.upload-zone small {
  display: block;
}

.upload-zone small {
  margin-top: 4px;
  color: var(--muted);
}

.upload-icon {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
}

.file-list {
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.file-pill strong {
  max-width: 180px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

fieldset {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-grid label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  font-size: 13px;
}

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

.field-grid label,
.wide-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.wide-field {
  margin-top: 14px;
}

input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 112px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8cb2ff;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary-action,
.secondary-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-action {
  border: 1px solid #173ea8;
  background: var(--blue);
  color: #ffffff;
}

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

.full-width {
  width: 100%;
  margin-top: 12px;
}

.estimate-meter {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid #b8d9cb;
  border-radius: 8px;
  background: var(--soft-green);
}

.estimate-meter span,
.estimate-meter small {
  color: #416255;
  font-size: 12px;
}

.estimate-meter strong {
  font-size: 28px;
  color: var(--green);
  letter-spacing: 0;
}

.process-visual {
  width: 100%;
  height: auto;
  margin: 18px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.process-visual rect {
  fill: #ffffff;
  stroke: #8ea4c2;
  stroke-width: 2;
}

.process-visual path {
  fill: none;
  stroke: #8092aa;
  stroke-width: 3;
  stroke-linecap: round;
}

.process-visual circle {
  fill: var(--green);
}

.process-visual text {
  fill: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.status-machine,
.state-list {
  display: grid;
  gap: 8px;
}

.status-step,
.state-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.status-step.active {
  border-color: #8fc7aa;
  background: var(--soft-green);
}

.status-step.done {
  border-color: #c6d4e7;
  background: #f3f6fb;
}

.step-dot {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8edf5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-step.active .step-dot {
  background: var(--green);
  color: #ffffff;
}

.step-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.step-code {
  color: var(--muted);
  font-size: 11px;
}

.operation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.operation-card {
  min-height: 156px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.operation-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.stage-index {
  width: 32px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 6px;
  background: var(--soft-amber);
  color: var(--amber);
  font-weight: 800;
  font-size: 12px;
}

.supplier-board {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
  margin-top: 16px;
}

.queue-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.queue-list,
.production-list {
  display: grid;
  gap: 10px;
}

.queue-item,
.production-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.queue-meta,
.production-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #41506a;
  font-size: 12px;
  font-weight: 700;
}

.tag.green {
  background: var(--soft-green);
  color: var(--green);
}

.tag.amber {
  background: var(--soft-amber);
  color: var(--amber);
}

.tag.red {
  background: var(--soft-red);
  color: var(--red);
}

.data-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.22fr);
  gap: 14px;
  align-items: start;
}

.state-row {
  grid-template-columns: 36px minmax(0, 1fr);
}

.json-panel {
  max-height: 620px;
  min-height: 420px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  border: 1px solid #223049;
  border-radius: 8px;
  background: #111827;
  color: #d1fae5;
  line-height: 1.55;
  font-size: 13px;
}

@media (max-width: 1080px) {
  .handoff-strip,
  .quote-layout,
  .supplier-board,
  .data-grid {
    grid-template-columns: 1fr;
  }

  .operation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    align-items: flex-start;
    padding: 12px 16px;
  }

  .topbar,
  .topnav {
    flex-direction: column;
  }

  main {
    padding: 12px;
  }

  h1 {
    font-size: 21px;
  }

  .quote-form,
  .quote-output,
  .supplier-section,
  .data-section,
  .handoff-strip {
    padding: 14px;
  }

  .field-grid,
  .option-grid,
  .operation-grid {
    grid-template-columns: 1fr;
  }

  .status-step {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .step-code {
    grid-column: 2;
  }
}
