:root {
  color-scheme: light;
  --ink: #172019;
  --muted: #647067;
  --line: #dfe5df;
  --soft: #f4f6f3;
  --paper: #ffffff;
  --green: #18623d;
  --green-2: #0e4b2d;
  --red: #b42318;
  --amber: #a15c00;
  --shadow: 0 14px 38px rgba(27, 39, 31, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: #eef1ed;
  color: var(--ink);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--green);
  color: #fff;
  border-radius: 7px;
}
.secure-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.client-top-actions { display: flex; align-items: center; gap: 20px; }
.query-link { display: inline-flex; align-items: center; gap: 7px; color: var(--green); text-decoration: none; font-size: 13px; font-weight: 700; }
.page {
  width: min(1180px, calc(100% - 40px));
  margin: 32px auto 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.form-panel { padding: 32px; }
.panel-head { margin-bottom: 28px; }
.panel-head h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.25; letter-spacing: 0; }
.panel-head p { margin: 0; color: var(--muted); line-height: 1.7; }
.section { padding: 26px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; padding-top: 0; }
.section-title { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.step {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: #e2eee7; color: var(--green); font-size: 13px; font-weight: 800;
}
.section-title h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.optional-section { padding-top: 20px; }
.optional-section .section-title { gap: 8px; margin-bottom: 12px; color: var(--muted); }
.optional-section .section-title h2 { font-size: 14px; color: var(--ink); }
.optional-mark {
  width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 50%; background: var(--soft); color: var(--muted);
}
.optional-label { font-size: 11px; color: var(--muted); }
.dropzone {
  min-height: 158px;
  border: 1.5px dashed #aab9ad;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: #fafbf9;
  transition: .18s ease;
}
.dropzone.compact {
  min-height: 82px;
  padding: 16px;
  text-align: left;
  place-items: center start;
  background: #fbfcfb;
}
.dropzone.compact strong { font-size: 13px; margin-bottom: 4px; }
.dropzone.compact small { display: block; font-size: 11px; }
.dropzone.dragging { border-color: var(--green); background: #f0f7f3; }
.upload-icon {
  width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 10px;
  color: var(--green); background: #e2eee7; border-radius: 7px;
}
.dropzone strong { display: block; margin-bottom: 7px; }
.dropzone small { color: var(--muted); line-height: 1.5; }
.link-button { border: 0; background: none; color: var(--green); padding: 0; font-weight: 700; }
.file-list { display: grid; gap: 8px; margin-top: 12px; }
.file-summary {
  margin-top: 9px; color: var(--muted); font-size: 12px; text-align: right;
}
.file-item {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
}
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--muted); }
.icon-button {
  border: 0; background: transparent; color: var(--muted);
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px;
}
.icon-button:hover { background: var(--soft); color: var(--red); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 700; }
input, textarea, select {
  width: 100%; border: 1px solid #cbd4cc; border-radius: 6px;
  padding: 11px 12px; background: #fff; color: var(--ink); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24, 98, 61, .1); }
textarea { min-height: 128px; resize: vertical; line-height: 1.6; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--soft); border-radius: 7px; }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.segmented label {
  text-align: center; padding: 10px; border-radius: 5px; color: var(--muted); cursor: pointer;
}
.segmented input:checked + label { background: #fff; color: var(--green); box-shadow: 0 1px 5px rgba(0,0,0,.09); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.template-filters { display: grid; gap: 8px; }
.template-filter-row {
  display: grid; grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px; align-items: start;
}
.template-filter-label { padding-top: 6px; color: var(--muted); font-size: 12px; }
.template-filter-options { display: flex; flex-wrap: wrap; gap: 6px; }
.template-filter {
  border: 0; border-radius: 5px; padding: 6px 10px;
  background: var(--soft); color: var(--muted); font-size: 12px;
}
.template-filter:hover { color: var(--ink); background: #e9ede9; }
.template-filter.selected { color: var(--green); background: #e2eee7; font-weight: 700; }
.template-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; padding: 2px;
}
.template-card {
  min-width: 0; padding: 0; overflow: hidden;
  border: 2px solid transparent; border-radius: 6px;
  background: var(--soft); color: var(--ink); text-align: left;
}
.template-card img,
.template-auto {
  display: grid; place-items: center; width: 100%; aspect-ratio: 246 / 140;
  object-fit: cover; background: #eef1ed;
}
.template-card strong {
  display: block; padding: 8px 9px; overflow: hidden;
  font-size: 12px; text-overflow: ellipsis; white-space: nowrap;
}
.template-card.classic strong { color: var(--muted); font-weight: 600; }
.template-empty {
  grid-column: 1 / -1; padding: 30px; text-align: center;
  border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: 13px;
}
.template-card:hover { border-color: #a8b9ac; }
.template-card.selected { border-color: var(--green); background: #edf5f0; }
.template-pager {
  min-height: 38px; margin-top: 10px; display: flex;
  align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 12px;
}
.template-pager button {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.template-pager button:disabled { opacity: .4; cursor: not-allowed; }
.summary { position: sticky; top: 24px; padding: 24px; }
.summary h2 { margin: 0 0 20px; font-size: 18px; }
.summary-row { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; color: var(--muted); font-size: 13px; }
.summary-row strong { color: var(--ink); text-align: right; }
.summary-row.price-row strong { color: var(--green); font-size: 16px; }
.summary-total {
  margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline;
}
.summary-total span { font-size: 13px; color: var(--muted); }
.summary-total strong { font-size: 24px; color: var(--green); }
.price-guide { margin: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.price-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.price-tiers div { padding: 12px 5px; text-align: center; border-right: 1px solid var(--line); }
.price-tiers div:last-child { border-right: 0; }
.price-tiers span { display: block; color: var(--muted); font-size: 10px; white-space: nowrap; }
.price-tiers strong { display: block; margin-top: 4px; color: var(--ink); font-size: 14px; }
.material-free {
  min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 6px;
  border-top: 1px solid var(--line); color: #725018; background: #fbf8f0; font-size: 11px;
}
.consent-list { display: grid; gap: 9px; margin: 0 0 15px; }
.consent-item {
  display: grid; grid-template-columns: 17px minmax(0, 1fr);
  align-items: start; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.5; cursor: pointer;
}
.consent-item input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.consent-item small { color: #8b5b17; }
.inline-action {
  border: 0; padding: 0; background: transparent; color: var(--green);
  font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px;
}
.submit {
  border: 0; width: 100%; min-height: 46px; border-radius: 6px;
  background: var(--green); color: #fff; font-weight: 750;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.submit:hover { background: var(--green-2); }
.submit:disabled { opacity: .55; cursor: not-allowed; }
.upload-progress { margin-top: 14px; }
.upload-progress-head {
  min-height: 30px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; color: var(--ink); font-size: 12px;
}
.upload-progress-head .icon-button { flex: 0 0 30px; }
.upload-progress-track {
  height: 7px; overflow: hidden; border-radius: 4px; background: #e6ebe7;
}
.upload-progress-track span {
  display: block; width: 0; height: 100%; border-radius: inherit;
  background: var(--green); transition: width .2s ease;
}
.upload-progress.processing .upload-progress-track span {
  width: 100% !important;
  background: linear-gradient(90deg, #d5e7dc 0%, var(--green) 50%, #d5e7dc 100%);
  background-size: 200% 100%;
  animation: upload-processing 1.4s linear infinite;
}
.upload-progress-meta {
  display: block; min-height: 18px; margin-top: 6px;
  color: var(--muted); font-size: 11px; line-height: 1.5;
}
@keyframes upload-processing {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
.agreement { margin-top: 12px; color: var(--muted); font-size: 11px; text-align: center; line-height: 1.5; }
.toast {
  position: fixed; right: 24px; bottom: 24px; width: min(420px, calc(100% - 48px));
  background: #172019; color: #fff; padding: 15px 16px; border-radius: 7px;
  box-shadow: 0 16px 42px rgba(0,0,0,.22); display: none; z-index: 10; line-height: 1.5;
}
.toast.error { background: #8f2119; }
.toast.show { display: block; }
.success-view { padding: 58px 32px; text-align: center; display: none; }
.success-view .success-icon {
  width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 18px;
  background: #e2eee7; color: var(--green); border-radius: 50%;
}
.success-view h1 { margin: 0 0 10px; font-size: 26px; }
.success-view p { margin: 0 auto; color: var(--muted); line-height: 1.7; max-width: 530px; }
.order-id { display: inline-block; margin: 20px 0; padding: 10px 14px; border-radius: 6px; background: var(--soft); font-family: ui-monospace, monospace; }
.task-link-wrap { width: min(680px, 100%); margin: 2px auto 0; text-align: left; }
.task-link-wrap label { display: block; margin-bottom: 7px; }
.task-link-row { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 7px; }
.task-link-row input { min-width: 0; font: 12px ui-monospace, monospace; background: #f8faf8; }
.task-copy { width: 38px; height: 38px; border: 1px solid var(--line); }
.task-link-wrap small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.terms-backdrop {
  position: fixed; inset: 0; z-index: 30; display: none; place-items: center;
  padding: 18px; background: rgba(17, 28, 21, .38);
}
.terms-backdrop.open { display: grid; }
.terms-modal {
  width: min(640px, 100%); max-height: min(720px, calc(100vh - 36px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.2);
}
.terms-head {
  padding: 17px 20px; display: flex; justify-content: space-between;
  align-items: center; border-bottom: 1px solid var(--line);
}
.terms-head h2 { margin: 0; font-size: 17px; }
.terms-body { padding: 6px 20px; overflow-y: auto; color: #3f4942; font-size: 13px; line-height: 1.8; }
.terms-body p { margin: 14px 0; }
.terms-actions { padding: 14px 20px; border-top: 1px solid var(--line); }
.terms-actions .submit { max-width: 180px; margin-left: auto; }

@media (max-width: 840px) {
  .topbar { padding: 0 20px; }
  .secure-note { display: none; }
  .client-top-actions { gap: 12px; }
  .page { grid-template-columns: 1fr; margin-top: 20px; }
  .summary { position: static; }
  .form-panel { padding: 22px; }
  .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .page { width: min(100% - 24px, 1180px); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .panel-head h1 { font-size: 23px; }
  .client-top-actions .query-link { font-size: 0; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-filter-row { grid-template-columns: 1fr; gap: 5px; }
  .template-filter-label { padding-top: 0; }
}
