:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --card: #fffdf8;
  --line: #e7dcc9;
  --text: #2d2418;
  --muted: #7a6b57;
  --accent: #cc6f3c;
  --accent-strong: #a95024;
  --soft: #f4e3d6;
  --success-bg: #eef7ee;
  --success-line: #b8d8b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at top left, #fff6e8, transparent 28%),
    linear-gradient(180deg, #f7f2e9 0%, #efe6d8 100%);
  color: var(--text);
}

.floating-toolbar {
  position: fixed;
  top: 120px;
  right: 24px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 160px;
}

.toolbar-button {
  min-width: 160px;
  border-radius: 18px;
  border: 1px solid rgba(231, 220, 201, 0.95);
  box-shadow: 0 14px 32px rgba(70, 44, 18, 0.12);
}

.toolbar-primary {
  background: linear-gradient(135deg, #2f6b57 0%, #1f4f41 100%);
  color: #fff;
  border-color: rgba(47, 107, 87, 0.28);
}

.toolbar-secondary {
  background: rgba(255, 253, 248, 0.96);
  color: var(--text);
}

.toolbar-history {
  background: linear-gradient(135deg, #eef3f6 0%, #dde7ec 100%);
  color: #31424a;
  border-color: rgba(146, 167, 178, 0.35);
}

.toolbar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  background: #d84a3a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  padding: 8px 4px 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 14px;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
}

.intro {
  max-width: 640px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: 18px;
}

.hero ::selection {
  background: transparent;
  color: inherit;
}

.draft-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px dashed var(--accent);
  border-radius: 14px;
  background: #fff7ef;
  color: var(--text);
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  cursor: pointer;
}

.card {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid rgba(231, 220, 201, 0.95);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 14px 40px rgba(70, 44, 18, 0.06);
  backdrop-filter: blur(10px);
}

.card.flash-highlight {
  animation: cardFlash 1.2s ease;
}

@keyframes cardFlash {
  0% {
    box-shadow: 0 14px 40px rgba(70, 44, 18, 0.06);
    border-color: rgba(231, 220, 201, 0.95);
  }
  35% {
    box-shadow: 0 0 0 8px rgba(204, 111, 60, 0.14);
    border-color: rgba(204, 111, 60, 0.78);
  }
  100% {
    box-shadow: 0 14px 40px rgba(70, 44, 18, 0.06);
    border-color: rgba(231, 220, 201, 0.95);
  }
}

.card-head h2 {
  margin: 0;
  font-size: 24px;
}

.card-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

#selectedCategoryText,
#selectedServiceText {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff4e8;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
}

#selectedCategoryText strong,
#selectedServiceText strong {
  color: var(--accent-strong);
  font-size: 18px;
}

.card-head-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.order-status {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff4e8;
  border: 1px solid var(--line);
  color: var(--text);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.service-button {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff8ef;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.service-button:hover,
.service-button.active {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(204, 111, 60, 0.14);
  transform: translateY(-2px);
}

.service-title {
  display: block;
  font-weight: 700;
}

.service-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.brief-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  grid-column: span 2;
}

.field.half {
  grid-column: span 1;
}

label {
  font-size: 14px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #fffdfa;
  font: inherit;
  color: inherit;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(204, 111, 60, 0.12);
}

.dynamic-fields {
  display: contents;
}

.actions {
  display: flex;
  gap: 12px;
  grid-column: span 2;
  margin-top: 4px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  cursor: pointer;
}

.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
}

.secondary {
  background: var(--soft);
  color: var(--text);
}

.order-items-list,
.history-orders-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.order-item,
.history-order {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff9f1;
}

.order-item-head,
.history-order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-item-title,
.history-order-title {
  font-weight: 700;
}

.order-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-item-edit,
.order-item-remove {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text);
}

.order-copy-button {
  white-space: nowrap;
}

.order-item-edit {
  background: #f2eadf;
}

.order-item-remove {
  background: #f6e4d8;
}

.order-item-toggle {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.order-item-toggle summary {
  display: block;
  width: fit-content;
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 600;
  list-style: none;
  margin-left: auto;
}

.order-item-toggle summary::-webkit-details-marker {
  display: none;
}

.order-item-toggle summary::after {
  content: "展开";
}

.order-item-toggle[open] summary::after {
  content: "收起";
}

.order-item-lines,
.history-order-lines {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
  width: 100%;
}

.history-order-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.history-order-items {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.history-order-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--success-bg);
  border: 1px solid var(--success-line);
}

.history-order-item-title {
  font-weight: 700;
}

.history-order-summary {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.history-order-copy {
  white-space: nowrap;
}

.history-order-item-toggle {
  margin-top: 12px;
  border-top: 1px solid rgba(184, 216, 184, 0.9);
  padding-top: 12px;
}

.history-order-item-toggle summary {
  display: block;
  width: fit-content;
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 600;
  list-style: none;
  margin-left: auto;
}

.history-order-item-toggle summary::-webkit-details-marker {
  display: none;
}

.history-order-item-toggle summary::after {
  content: "展开";
}

.history-order-item-toggle[open] summary::after {
  content: "收起";
}

.history-empty {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: #fffaf3;
  color: var(--muted);
  line-height: 1.7;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(45, 36, 24, 0.28);
}

.modal-panel {
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(70, 44, 18, 0.18);
}

.modal-head h2 {
  margin: 0;
  font-size: 24px;
}

.modal-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.copy-select-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.copy-select-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff9f1;
}

.copy-select-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.copy-select-title {
  font-weight: 700;
}

.copy-select-preview {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .page {
    width: min(100% - 220px, 920px);
    margin-left: 16px;
    margin-right: auto;
  }
}

@media (max-width: 680px) {
  .floating-toolbar {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    flex-direction: row;
    width: auto;
    flex-wrap: wrap;
  }

  .toolbar-button {
    min-width: 0;
    flex: 1;
  }

  .page {
    width: min(100% - 20px, 920px);
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 110px;
  }

  .card {
    padding: 18px;
    border-radius: 20px;
  }

  .brief-form {
    grid-template-columns: 1fr;
  }

  .field,
  .field.half,
  .actions {
    grid-column: span 1;
  }

  .actions {
    flex-direction: column;
  }

  .order-item-head,
  .history-order-head,
  .card-head-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-item-actions {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column;
  }
}
