:root {
  --dark: #1a1f2e;
  --dark-2: #252b3b;
  --gold: #c8a052;
  --gold-dark: #a8832e;
  --paper: #f2f0ec;
  --card: #fff;
  --text: #1a1f2e;
  --muted: #7a756c;
  --line: rgba(26, 31, 46, 0.08);
  --pending: #d97706;
  --confirmed: #b45309;
  --preparing: #b45309;
  --shipped: #7c3aed;
  --completed: #059669;
  --cancelled: #9ca3af;
  --danger: #e74c3c;
  --sans: "PingFang SC", "HarmonyOS Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

#view-list { padding-bottom: var(--safe-bottom); }

.hidden { display: none !important; }

.view {
  min-height: 100vh;
  min-height: 100dvh;
}

button, input { font-family: inherit; }

.logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--dark-2);
  border: 1px solid rgba(200, 160, 82, 0.45);
  color: var(--gold);
  font-family: "Noto Serif CJK SC", "Songti SC", "STSong", serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  /* 「贵」字面相对 em 盒偏上偏左，略向下向右拉回视觉中心 */
  padding: 0.08em 0 0 0.06em;
}

.logo-icon.sm {
  width: 36px;
  height: 36px;
  font-size: 18px;
  border-radius: 8px;
}

.btn {
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn:focus-visible,
.tab:focus-visible,
.icon-btn:focus-visible,
.icon-text-btn:focus-visible,
.link-copy:focus-visible,
.field input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, #c8a052 0%, #a8832e 100%);
  color: #fff;
}

.btn-primary:disabled,
.btn.is-loading {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-block { width: 100%; }

.btn.is-loading {
  position: relative;
  color: transparent;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-ghost.is-loading::after {
  border-color: rgba(26, 31, 46, 0.15);
  border-top-color: var(--text);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
}

.icon-btn svg,
.icon-text-btn svg,
.call-btn svg,
.link-copy svg,
.link-row svg,
.address-line svg {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  line-height: 0;
}

.icon-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--gold);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}

.icon-text-btn:active,
.icon-btn:active,
.link-copy:active,
.call-btn:active {
  opacity: 0.7;
}

.login-view {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100svh;
  min-height: 100dvh;
  padding: calc(8vh + var(--safe-top)) 20px 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(200, 160, 82, 0.16), transparent 55%),
    var(--dark);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px 28px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand .logo-icon { margin: 0 auto 14px; }

.login-brand h1 {
  font-size: 26px;
  font-weight: 700;
}

.login-brand p {
  color: var(--muted);
  margin-top: 4px;
}

.field { display: block; margin-bottom: 16px; }

.field > span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #e5e1d8;
  border-radius: 10px;
  font-size: 16px;
  background: #faf9f6;
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}

.field.is-error input {
  border-color: var(--danger);
  background: #fff8f7;
}

.field-error {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  font-style: normal;
  color: var(--danger);
}

.field.is-error .field-error { display: block; }

.password-wrap {
  position: relative;
}

.password-wrap input { padding-right: 48px; }

.password-wrap .icon-btn {
  position: absolute;
  right: 2px;
  top: 0;
  width: 44px;
  height: 48px;
}

.login-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.list-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: linear-gradient(135deg, #1a1f2e 0%, #252b3b 100%);
  color: #fff;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: opacity 0.15s ease;
}

.topbar-brand.is-holding { opacity: 0.65; }

.icon-text-btn:disabled { opacity: 0.45; }

#refresh-btn {
  min-width: 76px;
  padding: 0 8px 0 10px;
  gap: 6px;
}

#refresh-btn .btn-icon,
#refresh-btn svg {
  width: 18px;
  height: 18px;
}

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

.topbar-brand em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.topbar-spacer { width: 52px; }

#view-detail .topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr);
}

#view-detail .topbar strong {
  text-align: center;
}

#view-detail .topbar-spacer { width: auto; }

.tabs {
  display: flex;
  padding: 0 8px;
  background: #fff;
  border-bottom: 1px solid rgba(200, 160, 82, 0.15);
}

.tab {
  flex: 1;
  min-height: 46px;
  padding: 10px 4px;
  border: none;
  background: none;
  color: #666;
  font-size: 14px;
  position: relative;
}

.tab.active {
  color: var(--text);
  font-weight: 600;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #c8a052 0%, #a8832e 100%);
}

.tab-label {
  position: relative;
  display: inline-block;
}

.tab-badge {
  position: absolute;
  top: -10px;
  right: -16px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}

.tab-badge-hot { background: var(--danger); }
.tab-badge-gold { background: var(--gold-dark); }

.order-list { padding: 12px 16px 24px; }

.order-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(26, 31, 46, 0.05);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.order-card:active { transform: scale(0.99); }

.order-card.is-pending {
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.1);
}

.order-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #faf8f4;
  border-bottom: 1px solid var(--line);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending { background: #fff7ed; color: var(--pending); }
.badge-confirmed { background: #fffbeb; color: var(--confirmed); }
.badge-preparing { background: #fffbeb; color: var(--preparing); }
.badge-shipped { background: #f5f3ff; color: var(--shipped); }
.badge-completed { background: #ecfdf5; color: var(--completed); }
.badge-cancelled { background: #f3f4f6; color: var(--cancelled); }

.time { font-size: 12px; color: var(--muted); }

.order-card-body { padding: 14px 16px 16px; }

.order-id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.link-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.order-card-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.contact-name {
  font-size: 17px;
  font-weight: 600;
}

.contact-phone {
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.call-btn {
  flex: 0 0 auto;
  min-width: 68px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #f8f6f2;
  color: var(--gold-dark);
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.address-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.address-line svg {
  margin-top: 3px;
  color: var(--gold-dark);
}

.remark-bar {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  line-height: 1.5;
}

.goods-rows { margin-top: 12px; }

.goods-row,
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.goods-row:first-child,
.item-row:first-of-type { border-top: none; }

.goods-row img,
.item-row img,
.sk-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: #f2f0ec;
  flex: 0 0 auto;
}

.item-row img {
  width: 64px;
  height: 64px;
}

.goods-row-info,
.item-info {
  min-width: 0;
  flex: 1;
}

.goods-row-info strong,
.item-info strong {
  display: block;
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.goods-row-info span,
.item-info em,
.goods-row em,
.item-qty {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-style: normal;
  color: var(--muted);
}

.goods-row em,
.item-qty {
  flex: 0 0 auto;
  margin-top: 0;
}

.goods-more,
.goods-empty {
  padding-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.card-action {
  margin-top: 12px;
  min-height: 42px;
  font-size: 15px;
}

.empty, .more-wrap {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

.empty-art {
  width: 120px;
  height: 96px;
  margin: 0 auto 16px;
}

.empty-art svg { width: 100%; height: 100%; }

.detail { padding: 12px 16px 120px; }

.status-hero {
  border-radius: 14px;
  padding: 22px 18px;
  margin-bottom: 12px;
  color: #fff;
}

.status-hero strong {
  display: block;
  font-size: 22px;
}

.status-hero p {
  margin-top: 6px;
  font-size: 14px;
  opacity: 0.9;
}

.status-hero-pending { background: linear-gradient(135deg, #f5a623 0%, #f7931e 100%); }
.status-hero-confirmed { background: linear-gradient(135deg, #3a4558 0%, #252b3b 100%); }
.status-hero-shipped { background: linear-gradient(135deg, #c8a052 0%, #a8832e 100%); }
.status-hero-completed { background: linear-gradient(135deg, #78909c 0%, #546e7a 100%); }
.status-hero-cancelled { background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%); }

.panel {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4px;
  position: relative;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.panel-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, #c8a052 0%, rgba(200, 160, 82, 0) 100%);
}

.stepper {
  display: flex;
  position: relative;
}

.stepper::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  right: 6px;
  height: 2px;
  background: #e8e4dc;
}

.step {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step:first-child { align-items: flex-start; }

.step:last-child { align-items: flex-end; }

.step.done:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 5px;
  height: 2px;
  background: var(--gold);
}

.step:first-child.done::after {
  left: 6px;
  width: calc(150% - 6px);
}

.step:not(:first-child):not(:last-child).done::after {
  left: 50%;
  width: calc(150% - 6px);
}

.step i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  position: relative;
  z-index: 1;
}

.step em {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-style: normal;
  text-align: center;
  color: var(--muted);
}

.step:first-child em { text-align: left; }

.step:last-child em { text-align: right; }

.step.done i,
.step.active i { background: var(--gold); }

.step.active em {
  color: var(--gold-dark);
  font-weight: 600;
}

.step.done em { color: var(--text); }

.stepper.is-cancelled .step.done:not(:last-child)::after { background: #e8e4dc; }

.stepper-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.remark-panel { background: #fff7ed; }

.remark-text {
  font-size: 15px;
  color: #9a3412;
  line-height: 1.6;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.info-row:last-of-type { border-bottom: none; }

.info-label {
  flex: 0 0 72px;
  color: var(--muted);
}

.info-value {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  text-align: right;
  word-break: break-all;
}

.info-link {
  color: var(--gold-dark);
  text-decoration: none;
  font-weight: 600;
}

.link-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.link-row a,
.link-row button {
  flex: 1;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  background: #f8f6f2;
  color: var(--gold-dark);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
  z-index: 20;
}

.action-bar .btn { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(26, 31, 46, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 40;
  max-width: 80%;
}

.toast-raised,
body.has-action-bar .toast {
  bottom: calc(88px + var(--safe-bottom));
}

.toast-center {
  bottom: auto;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 128px;
  padding: 22px 28px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.04em;
}

.toast-center .toast-icon,
.toast-center svg {
  display: block;
  width: 28px;
  height: 28px;
}

.dialog {
  position: fixed;
  inset: 0;
  background: rgba(26, 31, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.dialog-card {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 14px;
  padding: 22px 18px 16px;
}

.dialog-card h3 {
  font-size: 17px;
  text-align: center;
  margin-bottom: 8px;
}

.dialog-card p {
  font-size: 15px;
  margin-bottom: 14px;
  text-align: center;
  color: var(--muted);
}

.dialog-meta {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 10px;
  background: #faf8f4;
  font-size: 13px;
}

.dialog-meta div {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}

.dialog-meta div:last-child { margin-bottom: 0; }

.dialog-meta span {
  flex: 0 0 48px;
  color: var(--muted);
}

.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }

.skeleton-card { cursor: default; }
.skeleton-card:active { transform: none; }

.skeleton-hero { background: linear-gradient(135deg, #d8d3cb 0%, #c8c2b8 100%); }

.sk-line {
  display: block;
  height: 12px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #efece6 0%, #f7f5f1 50%, #efece6 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.sk-line.light {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.28) 100%);
  background-size: 200% 100%;
}

.sk-thumb {
  display: block;
  animation: shimmer 1.2s ease-in-out infinite;
  background: #efece6;
}

.sk-thumb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.sk-lines { flex: 1; }

.w-16 { width: 16%; }
.w-24 { width: 24%; }
.w-32 { width: 32%; }
.w-40 { width: 40%; }
.w-56 { width: 56%; }
.w-64 { width: 64%; }
.w-80 { width: 80%; }

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

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