:root {
  --paper: #f4efe4;
  --paper-deep: #ebe3d2;
  --card: #fffdf7;
  --card-warm: #fbf6ea;
  --ink: #1d2a21;
  --ink-soft: #5e685d;
  --ink-faint: #8a9185;
  --pine: #174a35;
  --pine-2: #236348;
  --pine-3: #dce8d8;
  --pine-wash: #eef3e9;
  --persimmon: #cf5b34;
  --persimmon-soft: #f7e2d7;
  --gold: #a97827;
  --gold-soft: #f4e8c8;
  --blue: #3f6478;
  --blue-soft: #e1ebef;
  --danger: #b84035;
  --danger-soft: #f8dfdb;
  --line: rgba(29, 42, 33, 0.13);
  --line-strong: rgba(29, 42, 33, 0.26);
  --shadow-sm: 0 1px 0 rgba(29, 42, 33, 0.04), 0 8px 24px rgba(45, 52, 38, 0.05);
  --shadow-md: 0 2px 0 rgba(29, 42, 33, 0.04), 0 18px 50px rgba(45, 52, 38, 0.1);
  --shadow-lift: 0 24px 60px rgba(23, 74, 53, 0.18);
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 28px;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --mono: "DIN Alternate", "SF Mono", "Cascadia Mono", "Roboto Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 74px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.38;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3,
.display {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.02em;
}

::selection {
  background: var(--gold-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--pine-2);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--ink-soft);
}

.faint {
  color: var(--ink-faint);
}

.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.money {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.money .unit {
  font-family: var(--sans);
  font-size: 0.62em;
  font-weight: 600;
  margin-right: 2px;
  opacity: 0.72;
}

.row {
  display: flex;
  align-items: center;
}

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

.stack {
  display: flex;
  flex-direction: column;
}

.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

.grow { flex: 1; min-width: 0; }

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-flat {
  background: var(--card-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.hairline {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

.dotted {
  border: 0;
  border-top: 1px dashed var(--line-strong);
  margin: 0;
}

.btn {
  --btn-bg: var(--card);
  --btn-fg: var(--ink);
  --btn-border: var(--line-strong);
  appearance: none;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: 999px;
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease), opacity 0.18s;
  white-space: nowrap;
  user-select: none;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(23, 74, 53, 0.1); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: 0.42; pointer-events: none; }

.btn-primary {
  --btn-bg: var(--pine);
  --btn-fg: #fbf7ec;
  --btn-border: var(--pine);
  box-shadow: 0 8px 24px rgba(23, 74, 53, 0.2);
}
.btn-primary:hover { background: var(--pine-2); }

.btn-soft {
  --btn-bg: var(--pine-wash);
  --btn-fg: var(--pine);
  --btn-border: transparent;
}

.btn-warm {
  --btn-bg: var(--persimmon-soft);
  --btn-fg: var(--persimmon);
  --btn-border: transparent;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-soft);
  --btn-border: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(29, 42, 33, 0.05); box-shadow: none; }

.btn-danger {
  --btn-bg: var(--danger-soft);
  --btn-fg: var(--danger);
  --btn-border: transparent;
}

.btn-sm {
  min-height: 34px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-lg {
  min-height: 50px;
  padding: 0 24px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-warn { background: var(--persimmon-soft); color: var(--persimmon); }
.badge-info { background: var(--blue-soft); color: var(--blue); }
.badge-success { background: var(--pine-3); color: var(--pine); }
.badge-muted { background: rgba(29, 42, 33, 0.07); color: var(--ink-faint); }

/* 已取消订单：灰卡展示，保留取消原因，不会再从订单列表里凭空消失 */
.order-card.is-cancelled,
.web-order.is-cancelled { opacity: .78; }
.order-card.is-cancelled .order-item,
.web-order.is-cancelled .web-order-item { filter: grayscale(.7); }
.order-card.is-cancelled .order-card-foot,
.web-order.is-cancelled .web-order-foot { color: var(--ink-faint); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-hint {
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.55;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 253, 247, 0.82);
  border-radius: 13px;
  min-height: 46px;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  outline: none;
}

.input::placeholder,
.textarea::placeholder {
  color: #a9ad9f;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--pine-2);
  background: var(--card);
  box-shadow: 0 0 0 4px rgba(35, 99, 72, 0.1);
}

.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.7;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235e685d' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input[readonly],
.input:disabled {
  background: rgba(29, 42, 33, 0.045);
  color: var(--ink-faint);
  cursor: not-allowed;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .input {
  padding-left: 42px;
}

.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-faint);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pine);
  color: #f7f0dd;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.avatar-warm { background: var(--persimmon); }
.avatar-soft { background: var(--gold-soft); color: var(--gold); }

.seal {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--pine);
  color: #f6efdc;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}

.seal::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(246, 239, 220, 0.42);
  border-radius: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.6);
  border-radius: 6px;
  padding: 2px 7px;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
}
.empty .empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: var(--pine-wash);
  color: var(--pine-2);
}
.empty h3 {
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 5px;
}
.empty p { font-size: 13px; line-height: 1.7; }

.skeleton {
  background: linear-gradient(90deg, rgba(29, 42, 33, 0.055), rgba(29, 42, 33, 0.095), rgba(29, 42, 33, 0.055));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reveal {
  animation: fadeUp 0.5s var(--ease) both;
}
.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.1s; }
.reveal-3 { animation-delay: 0.16s; }
.reveal-4 { animation-delay: 0.22s; }
.reveal-5 { animation-delay: 0.28s; }

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-dark {
  border-color: rgba(23, 74, 53, 0.18);
  border-top-color: var(--pine);
}

.toast-root {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(90vw, 420px);
}

.toast {
  background: rgba(24, 35, 27, 0.94);
  color: #faf5e9;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 16px 40px rgba(20, 31, 23, 0.28);
  animation: toastIn 0.3s var(--ease) both;
  backdrop-filter: blur(10px);
  text-align: center;
  max-width: 100%;
}
.toast.toast-error { background: rgba(130, 43, 35, 0.96); }
.toast.toast-success { background: rgba(23, 74, 53, 0.96); }
.toast.is-out { animation: toastOut 0.25s ease both; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.97); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(19, 29, 22, 0.48);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease both;
}

@media (min-width: 720px) {
  .modal-backdrop { align-items: center; }
}

.modal {
  width: min(100%, 460px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lift);
  padding: 22px;
  animation: modalIn 0.3s var(--ease) both;
  max-height: min(86vh, 760px);
  overflow: auto;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: -8px auto 16px;
}

.modal h3 {
  font-size: 21px;
  margin-bottom: 6px;
}

.modal p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.modal-actions .btn { flex: 1; }

.sheet {
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
}

@media (max-width: 719px) {
  .modal-backdrop { padding: 0; }
  .modal {
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  }
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.divider-label::before,
.divider-label::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.no-scroll {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
