:root {
  color-scheme: light;
  --ink: #162217;
  --muted: #687268;
  --line: #dfe6dc;
  --surface: rgba(255, 255, 252, 0.94);
  --green: #1f6a3b;
  --green-dark: #15542d;
  --green-soft: #eaf5ec;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 24px 80px rgba(30, 59, 37, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(164, 204, 159, 0.34), transparent 31rem),
    radial-gradient(circle at 92% 88%, rgba(220, 195, 139, 0.24), transparent 27rem),
    #f2f5ed;
}

button, textarea, input { font: inherit; }
a { color: inherit; }

.page-shell {
  width: min(100% - 32px, 680px);
  margin: 0 auto;
  padding: 64px 0 28px;
}

.top-nav {
  display: flex;
  width: fit-content;
  gap: 4px;
  margin: 0 0 14px auto;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  background: rgba(255, 255, 252, 0.72);
  box-shadow: 0 8px 26px rgba(30, 59, 37, 0.08);
}

.top-nav a, .top-nav span {
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.top-nav a { color: var(--muted); }
.top-nav a:hover { color: var(--green); background: var(--green-soft); }
.top-nav .nav-current { color: white; background: var(--green); }

.order-card {
  position: relative;
  overflow: hidden;
  padding: 46px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.order-card::after {
  content: "";
  position: absolute;
  top: -90px;
  right: -80px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: rgba(217, 234, 207, 0.48);
  pointer-events: none;
}

.brand-mark {
  position: relative;
  z-index: 1;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: white;
  font-size: 22px;
  font-weight: 700;
  background: var(--green);
  box-shadow: 0 10px 28px rgba(31, 106, 59, 0.26);
}

.eyebrow {
  margin: 28px 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(34px, 7vw, 48px);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.intro {
  max-width: 510px;
  margin: 16px 0 34px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
}

textarea {
  display: block;
  width: 100%;
  min-height: 190px;
  resize: vertical;
  padding: 18px 19px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.8;
  background: #fbfcf8;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea::placeholder { color: #98a196; }

textarea:focus {
  border-color: #6aa57b;
  background: white;
  box-shadow: 0 0 0 4px rgba(64, 130, 82, 0.12);
}

.format-tip, .privacy-note {
  color: var(--muted);
  font-size: 13px;
}

.format-tip { margin: 10px 2px 0; }

.quantity-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcf8;
}

.quantity-field label { margin: 0 0 4px; }
.quantity-field p { margin: 0; color: var(--muted); font-size: 12px; }

.quantity-control {
  display: grid;
  grid-template-columns: 36px 58px 36px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #ccd8ca;
  border-radius: 10px;
  background: white;
}

.quantity-control button {
  height: 38px;
  border: 0;
  color: var(--green);
  cursor: pointer;
  font-size: 19px;
  font-weight: 700;
  background: white;
}

.quantity-control button:hover { background: var(--green-soft); }

.quantity-control input {
  width: 100%;
  height: 30px;
  border: 0;
  border-right: 1px solid #e1e7df;
  border-left: 1px solid #e1e7df;
  outline: 0;
  color: var(--ink);
  font-weight: 700;
  text-align: center;
  appearance: textfield;
}

.quantity-control input::-webkit-inner-spin-button,
.quantity-control input::-webkit-outer-spin-button { margin: 0; appearance: none; }

.message {
  min-height: 22px;
  margin: 12px 0 4px;
  color: var(--danger);
  font-size: 14px;
}

.message:not(:empty) {
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--danger-soft);
}

#submit-button, .secondary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
}

#submit-button {
  color: white;
  background: var(--green);
  box-shadow: 0 12px 28px rgba(31, 106, 59, 0.2);
  transition: transform 140ms ease, background 140ms ease;
}

#submit-button:hover { background: var(--green-dark); transform: translateY(-1px); }
#submit-button:active { transform: translateY(0); }
#submit-button:disabled { cursor: wait; opacity: 0.72; transform: none; }
.button-loading { display: none; }
.is-loading .button-label { display: none; }
.is-loading .button-loading { display: inline; }

.success-panel {
  padding-top: 8px;
  text-align: center;
}

.success-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  font-size: 30px;
  font-weight: 700;
  background: var(--green-soft);
}

.success-panel h2 { margin: 0; font-size: 26px; }
.success-panel > p { margin: 10px 0 22px; color: var(--muted); font-size: 14px; }

.order-number-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 8px 8px 16px;
  border: 1px dashed #9db7a0;
  border-radius: 13px;
  background: #f5faf4;
}

.order-number-row code {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
  color: var(--green-dark);
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.copy-button {
  padding: 8px 13px;
  border: 0;
  border-radius: 9px;
  color: var(--green);
  cursor: pointer;
  font-weight: 700;
  background: white;
}

.order-preview {
  margin: 24px 0;
  padding: 6px 18px;
  border-radius: 15px;
  text-align: left;
  background: #f7f8f4;
}

.order-preview div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e7ebe4;
}

.order-preview div:last-child { border-bottom: 0; }
.order-preview dt { color: var(--muted); font-size: 13px; }
.order-preview dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; }

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

.privacy-note { margin: 18px 0 0; text-align: center; }

.orders-shell { width: min(100% - 32px, 1020px); }

.orders-card {
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.orders-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.orders-header .eyebrow { margin-top: 0; }
.orders-header .intro { margin: 10px 0 0; }

.refresh-button, .primary-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  background: white;
}

.orders-list { display: grid; gap: 14px; }

.order-item {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fbfcf8;
}

.order-item-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e7ebe4;
}

.order-item-heading > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.created-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.order-item-heading code { overflow-wrap: anywhere; color: var(--green-dark); font-size: 14px; font-weight: 700; }

.status-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: #84510f;
  font-size: 12px;
  font-weight: 700;
  background: #fff3d8;
}

.status-created, .status-shipped { color: var(--green-dark); background: var(--green-soft); }
.status-creating { color: #315a92; background: #e9f1ff; }
.status-exception { color: var(--danger); background: var(--danger-soft); }

.order-details {
  display: grid;
  grid-template-columns: minmax(100px, 0.65fr) minmax(160px, 1fr) minmax(90px, 0.55fr) minmax(280px, 2.2fr);
  gap: 12px 24px;
  margin: 18px 0;
}

.order-details div { min-width: 0; }
.order-details dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.order-details dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }

.order-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.copy-order-button, .delete-order-button {
  padding: 8px 12px;
  border: 1px solid #d5dfd4;
  border-radius: 9px;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  background: white;
}

.delete-order-button { border-color: #ebc7c4; color: var(--danger); }
.delete-order-button:disabled { cursor: wait; opacity: 0.55; }

.empty-state { padding: 58px 20px 42px; text-align: center; }
.empty-state > div { display: grid; width: 58px; height: 58px; margin: 0 auto 18px; place-items: center; border-radius: 17px; color: var(--green); font-size: 22px; font-weight: 700; background: var(--green-soft); }
.empty-state h2 { margin: 0; font-size: 22px; }
.empty-state p { margin: 9px 0 20px; color: var(--muted); }
.empty-state a { color: var(--green); font-weight: 700; }

.forbidden-card h1 { margin-top: 28px; font-size: clamp(28px, 6vw, 42px); }

button:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(45, 112, 66, 0.24);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 20px, 680px); padding-top: 20px; }
  .order-card { padding: 28px 20px; border-radius: 22px; }
  .intro { margin-bottom: 26px; }
  textarea { min-height: 220px; font-size: 15px; }
  .orders-shell { width: min(100% - 20px, 1020px); }
  .orders-card { padding: 24px 18px; border-radius: 22px; }
  .orders-header { align-items: flex-end; }
  .orders-header h1 { font-size: 34px; }
  .refresh-button { min-height: 38px; padding: 0 12px; }
  .order-item { padding: 16px; }
  .order-item-heading > div { display: block; }
  .created-time { display: block; margin-bottom: 4px; }
  .order-details { grid-template-columns: 1fr 1.4fr; }
  .order-details .address-row { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
