/* ==========================================================================
   粮油价格表 · 相册式界面
   ========================================================================== */

:root {
  --bg: #f3ecdf;
  --surface: #fffdf9;
  --surface-soft: #faf4e9;
  --ink: #2f2418;
  --ink-soft: #4b3a28;
  --muted: #7d6a55;
  --line: #e7d9c4;
  --line-strong: #d9c7ab;
  --brand: #8a4f1f;
  --brand-dark: #6e3c13;
  --brand-light: #b97432;
  --brand-soft: #f2dfc5;
  --green: #2f7048;
  --green-dark: #245a39;
  --green-soft: #e3f2e8;
  --red: #b23e2c;
  --red-soft: #fbe7e2;
  --name: #352417;
  --category: #2f7048;
  --category-soft: #e3f2e8;
  --category-line: #b9d8c6;
  --price: #b23e2c;
  --price-soft: #fbe7e2;
  --price-line: #ecc3b9;
  --spec: #0b5fa5;
  --spec-soft: #e6f3ff;
  --spec-line: #9cc9ef;
  --export: #2f6d8f;
  --export-soft: #e7f1f7;
  --export-line: #bcd5e3;
  --shadow: 0 12px 36px rgba(76, 49, 20, 0.09), 0 2px 8px rgba(76, 49, 20, 0.04);
  --shadow-soft: 0 4px 14px rgba(76, 49, 20, 0.07);
  --radius-lg: 20px;
  --radius: 14px;
  --header-height: 58px;
  --app-vh: 100dvh;
  --keyboard-inset: 0px;
  --font: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1000px 480px at 4% -12%, #fdf7eb 0%, rgba(253, 247, 235, 0) 62%),
    radial-gradient(900px 420px at 100% 0%, #efe1cb 0%, rgba(239, 225, 203, 0) 56%),
    linear-gradient(180deg, var(--bg) 0%, #f8f2e8 100%);
  background-attachment: fixed;
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--brand);
}

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

strong {
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.2em;
  height: 1.2em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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;
}

/* 真正的文件输入盖在照片上，用户点的是 input 本身，手机才会按 capture 调相机。 */
.camera-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.camera-overlay:disabled {
  cursor: wait;
}

.photo-camera,
.sheet-camera {
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   顶部
   -------------------------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 246, 238, 0.96);
  border-bottom: 1px solid rgba(157, 121, 72, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  width: min(100%, 820px);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 0.45rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff8ec;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-light) 100%);
  box-shadow: 0 5px 13px rgba(138, 79, 31, 0.23), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.08;
}

.brand-text strong {
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.brand-text small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
}

.admin-btn {
  min-height: 38px;
  padding: 0 0.78rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 253, 249, 0.9);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.admin-btn:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.admin-btn.is-admin {
  border-color: #ddbd92;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

body:not(.is-admin) .add-card,
body:not(.is-admin) .camera-overlay,
body:not(.is-admin) #sheetSavePrice,
body:not(.is-admin) .sheet-actions,
body:not(.is-admin) #menuBackupBtn,
body:not(.is-admin) #menuCategoryBtn {
  display: none !important;
}

body:not(.is-admin) #sheetPrice {
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  font-weight: 900;
}

.login-hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 253, 249, 0.9);
  color: var(--ink-soft);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn .icon {
  width: 1.16rem;
  height: 1.16rem;
}

.header-icon[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: #ddbd92;
  color: var(--brand-dark);
}

.add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  height: 38px;
  padding: 0 0.72rem;
  border: 1px solid rgba(94, 47, 9, 0.2);
  border-radius: 11px;
  background: linear-gradient(180deg, #a9642b 0%, var(--brand) 100%);
  color: #fffaf2;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(122, 67, 22, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  white-space: nowrap;
}

.add-btn .icon {
  width: 1.08rem;
  height: 1.08rem;
  stroke-width: 2.4;
}

.add-btn:active {
  transform: scale(0.97);
}

/* 分类横向滑动 */
.category-bar {
  position: sticky;
  top: calc(var(--header-height) - 1px);
  z-index: 45;
  background: #f7f1e6;
  border-bottom: 1px solid rgba(190, 158, 114, 0.18);
  box-shadow: 0 5px 12px rgba(76, 49, 20, 0.05);
}

.category-scroll {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 0.48rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-chip {
  height: 38px;
  padding: 0 0.9rem;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.category-chip:hover {
  border-color: var(--line-strong);
}

.category-chip.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fffaf2;
  box-shadow: 0 3px 8px rgba(122, 67, 22, 0.18);
}

.category-chip.category-add {
  border-style: dashed;
  border-color: #cdb08a;
  background: transparent;
  color: var(--brand);
}

.category-chip.category-add .icon {
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.15rem;
  vertical-align: -0.15em;
}

/* --------------------------------------------------------------------------
   主区域
   -------------------------------------------------------------------------- */

.page {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 0.65rem 0.75rem 2.8rem;
}

.browser-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--spec-line);
  border-radius: 10px;
  background: var(--spec-soft);
  color: #6d4b11;
}

.browser-tip[hidden] {
  display: none;
}

.browser-tip > .icon {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.1rem;
  flex: none;
}

.browser-tip p {
  flex: 1;
  font-size: 0.66rem;
  line-height: 1.55;
}

.browser-tip strong {
  font-weight: 800;
}

.browser-tip-close {
  flex: none;
  min-height: 26px;
  padding: 0 0.4rem;
  border: 1px solid var(--spec-line);
  border-radius: 7px;
  background: #fffaf0;
  color: #6d4b11;
  font-size: 0.62rem;
  font-weight: 700;
}

.search-row {
  margin: 0 0 0.55rem;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  width: 1.18rem;
  height: 1.18rem;
  color: #a08970;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 45px;
  padding: 0 2.7rem 0 2.65rem;
  border: 1.5px solid #e0cfb7;
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
  outline: none;
  box-shadow: 0 3px 9px rgba(76, 49, 20, 0.035);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box input::placeholder {
  color: #a9967e;
  font-weight: 500;
}

.search-box input:focus {
  border-color: #c59a63;
  box-shadow: 0 0 0 4px rgba(185, 116, 50, 0.12);
}

.search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.clear-search {
  position: absolute;
  right: 0.4rem;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: #f5ecdf;
  color: var(--muted);
}

.clear-search .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  min-height: 26px;
  padding: 0 0.15rem 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--green-dark);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3fa066;
  box-shadow: 0 0 0 3px rgba(63, 160, 102, 0.13);
}

.sync-pill.is-connecting {
  color: #8a6425;
}

.sync-pill.is-connecting .sync-dot {
  background: #d59a36;
  box-shadow: 0 0 0 3px rgba(213, 154, 54, 0.15);
  animation: pulse 1.4s ease-in-out infinite;
}

.sync-pill.is-offline {
  color: var(--red);
}

.sync-pill.is-offline .sync-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(178, 62, 44, 0.13);
}

/* --------------------------------------------------------------------------
   两列商品
   -------------------------------------------------------------------------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.alpha-index {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.22rem 0.1rem;
  border: 1px solid rgba(190, 158, 114, 0.45);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: rgba(255, 252, 246, 0.9);
  box-shadow: 0 4px 16px rgba(76, 49, 20, 0.12);
  transform: translateY(-50%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.alpha-index[hidden] {
  display: none;
}

.alpha-index button {
  width: 22px;
  height: 16px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--brand-dark);
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
}

.alpha-index button.is-active {
  background: var(--brand);
  color: #fffaf2;
}

.alpha-index .alpha-help {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 5px 5px;
  color: var(--export);
}

.letter-start {
  scroll-margin-top: calc(var(--header-height) + 62px);
}

.card-letter {
  position: absolute;
  top: 0.38rem;
  left: 0.38rem;
  z-index: 4;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 2px solid #ffd166;
  border-radius: 50%;
  background: linear-gradient(155deg, #3b2412 0%, #1d0f06 100%);
  color: #fff8e8;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  box-shadow:
    0 0 0 2px rgba(255, 250, 240, 0.82),
    0 3px 9px rgba(35, 18, 6, 0.4);
  transition: width 0.18s ease, height 0.18s ease, top 0.18s ease,
    left 0.18s ease, font-size 0.18s ease, box-shadow 0.18s ease;
}

.card-letter.is-hinting {
  top: 0.18rem;
  left: 0.18rem;
  width: 38px;
  height: 38px;
  font-size: 0.9rem;
  background: linear-gradient(155deg, #ffe49a 0%, #ffc23d 100%);
  color: #241307;
  border-color: #fffdf8;
  box-shadow:
    0 0 0 7px rgba(255, 209, 102, 0.42),
    0 5px 14px rgba(35, 18, 6, 0.4);
  animation: letter-hop 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) 4;
}

@keyframes letter-hop {
  0%, 100% { transform: translateY(0) scale(1); }
  38% { transform: translateY(-13px) scale(1.1); }
  58% { transform: translateY(-13px) scale(1.1); }
  82% { transform: translateY(0) scale(0.98); }
}

.product-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1px solid #e1d2bc;
  border-radius: 19px;
  background: linear-gradient(145deg, #f6eddf 0%, #eadbc7 100%);
  color: var(--ink);
  text-align: center;
  overflow: hidden;
  box-shadow: 0 5px 14px rgba(76, 49, 20, 0.08);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.product-card:active {
  transform: scale(0.985);
}

.product-card:hover {
  box-shadow: 0 8px 20px rgba(76, 49, 20, 0.12);
}

.add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1.5px dashed #cfb18a;
  background: linear-gradient(145deg, #fcf6eb 0%, #f2e3ce 100%);
  color: var(--brand-dark);
  box-shadow: none;
}

.add-card:hover {
  background: linear-gradient(145deg, #fffaf1 0%, #f7e9d6 100%);
  box-shadow: 0 4px 12px rgba(76, 49, 20, 0.08);
}

.add-card-plus {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #a9642b 0%, var(--brand) 100%);
  color: #fffaf2;
  box-shadow: 0 6px 14px rgba(122, 67, 22, 0.22);
}

.add-card-plus .icon {
  width: 1.65rem;
  height: 1.65rem;
  stroke-width: 2.4;
}

.add-card-text {
  max-width: 86%;
  padding: 0 0.3rem;
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.add-card-wide {
  grid-column: 1 / -1;
  aspect-ratio: 2.05 / 1;
}

.add-card-wide .add-card-plus {
  width: 58px;
  height: 58px;
}

.add-card-wide .add-card-text {
  font-size: 0.95rem;
}

.card-photo {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 60% at 50% 15%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(145deg, #f7efe2 0%, #e9d8c0 100%);
}

.card-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.card-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding-bottom: 30%;
  color: #b28a5c;
  font-size: 0.7rem;
  font-weight: 700;
}

.card-empty .icon {
  width: 1.8rem;
  height: 1.8rem;
  opacity: 0.8;
}

.product-card.has-image .card-empty {
  display: none;
}

.card-label {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  min-height: 62px;
  padding: 0.75rem 0.35rem 0.52rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.05rem;
  background: linear-gradient(
    to top,
    rgba(24, 15, 8, 0.9) 0%,
    rgba(24, 15, 8, 0.72) 55%,
    rgba(24, 15, 8, 0) 100%
  );
}

.card-name {
  display: block;
  width: 100%;
  padding: 0 0.04rem;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  color: #fffaf2;
  font-size: clamp(1.08rem, 1.32vw, 1.2rem);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  min-width: 0;
}

.spec-tag {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 0.12rem 0.46rem;
  border: 1px solid #7fc4ff;
  border-radius: 6px;
  background: linear-gradient(180deg, #39a0f5 0%, #0d74c7 100%);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 2px 7px rgba(3, 47, 84, 0.35);
}

.spec-tag-lg {
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  font-size: 0.9rem;
  vertical-align: middle;
}

.card-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.05rem;
  max-width: 100%;
  overflow: hidden;
  color: #ffd166;
  font-size: clamp(1.55rem, 2.6vw, 1.95rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.card-price .currency {
  color: #ffd166;
  font-size: 0.78rem;
  font-weight: 700;
}

.card-price strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 空状态 / 加载 */
.empty-state,
.loading-state {
  grid-column: 1 / -1;
}

.empty-state {
  padding: 3rem 1rem 3.3rem;
  text-align: center;
  border: 1px dashed #d8c2a3;
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.65);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.8rem;
  display: grid;
  place-items: center;
  border-radius: 19px;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty-icon .icon {
  width: 1.8rem;
  height: 1.8rem;
}

.empty-state h3 {
  font-size: 1.02rem;
  font-weight: 800;
}

.empty-state p {
  max-width: 28rem;
  margin: 0.4rem auto 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 3.2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e3d2bb;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --------------------------------------------------------------------------
   按钮 / 弹窗
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.btn-primary {
  border-color: rgba(94, 47, 9, 0.2);
  background: linear-gradient(180deg, #a9642b 0%, var(--brand) 100%);
  color: #fffaf2;
  box-shadow: 0 4px 10px rgba(122, 67, 22, 0.18);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
  box-shadow: none;
}

.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}

.btn-load {
  border-color: var(--green-dark);
  background: linear-gradient(180deg, #3b8659 0%, var(--green) 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(36, 90, 57, 0.18);
}

.btn-load:disabled {
  opacity: 0.55;
  cursor: wait;
  box-shadow: none;
}

.btn-export {
  border-color: var(--export-line);
  background: var(--export-soft);
  color: var(--export);
}

.btn-export:hover {
  border-color: var(--export);
}

.btn-continue {
  border-color: #d8a56c;
  background: #fff8ee;
  color: var(--brand-dark);
}

.btn-danger {
  border-color: #a83c2b;
  background: var(--red);
  color: #fff;
}

.icon-btn.export {
  color: var(--export);
  border-color: var(--export-line);
  background: var(--export-soft);
}

.icon-btn.danger {
  color: var(--red);
  border-color: var(--red-soft);
  background: var(--red-soft);
}

.text-danger {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 8px;
}

.text-danger:hover {
  background: var(--red-soft);
}

dialog.modal {
  width: min(520px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

dialog.modal::backdrop {
  background: rgba(43, 30, 16, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

#backupDialog {
  width: min(620px, calc(100vw - 2rem));
}

#phoneDialog {
  width: min(580px, calc(100vw - 2rem));
}

#confirmDialog {
  width: min(440px, calc(100vw - 2rem));
}

#categoryDialog,
#menuDialog {
  width: min(460px, calc(100vw - 2rem));
}

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(33, 20, 7, 0.32);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf9 0%, #fdf8f0 100%);
}

.eyebrow {
  margin-bottom: 0.08rem;
  color: var(--brand-light);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.modal-head h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.close-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  margin: -0.2rem -0.25rem 0 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.close-btn:hover {
  background: #f1e6d6;
  color: var(--ink);
}

.close-btn .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.modal-body {
  padding: 1rem 1.15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1.15rem;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.modal-foot .btn {
  min-width: 5.2rem;
}

/* 表单 */
.field + .field,
.field + .form-grid,
.form-grid + .field {
  margin-top: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.required {
  color: var(--red);
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0.58rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus {
  border-color: #c9a572;
  box-shadow: 0 0 0 3px rgba(185, 116, 50, 0.12);
}

.field input::placeholder {
  color: #ad9b84;
}

.field-hint {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.form-error {
  margin-top: 0.8rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #efc8be;
  border-radius: 9px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 600;
}

.form-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1.2 / 1;
  max-height: 38vh;
  margin-bottom: 0.35rem;
  border-radius: 15px;
  background: linear-gradient(145deg, #f7efe2, #e9d8c0);
  overflow: hidden;
}

.form-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.form-photo .photo-placeholder {
  font-size: 0.9rem;
  gap: 0.4rem;
}

.form-photo .photo-placeholder .icon {
  width: 2.5rem;
  height: 2.5rem;
}

.photo-camera {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 40px;
  padding: 0 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(47, 36, 24, 0.62);
  color: #fff8ec;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  backdrop-filter: blur(5px);
}

.photo-camera.is-disabled,
.sheet-camera.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.photo-camera .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.form-photo-hint {
  margin: 0 auto 0.7rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
  text-align: center;
}

.editor-rows {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.editor-name {
  width: 100%;
  max-width: 360px;
  height: 56px;
  padding: 0 0.8rem;
  border: 1px solid transparent;
  border-bottom: 1px dashed #d8c2a3;
  border-radius: 10px;
  background: transparent;
  color: var(--name);
  font-size: 1.55rem;
  font-weight: 800;
  text-align: center;
  outline: none;
}

.editor-name::placeholder {
  color: #b7a48c;
  font-weight: 700;
}

.editor-name:focus {
  border-color: var(--name);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(53, 36, 23, 0.1);
}

.editor-hint {
  margin-top: -0.15rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
  text-align: center;
}

.editor-category {
  width: 170px;
  max-width: 100%;
  height: 44px;
  padding: 0 0.9rem;
  border: 1px solid var(--category-line);
  border-radius: 999px;
  background: var(--category-soft);
  color: var(--category);
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  text-align-last: center;
  outline: none;
}

.editor-category:focus {
  border-color: var(--category);
  box-shadow: 0 0 0 3px rgba(47, 112, 72, 0.14);
}

.editor-price {
  display: flex;
  align-items: center;
  width: min(260px, 100%);
  margin-top: 0.15rem;
  border: 1px solid var(--price-line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.editor-price > span {
  padding-left: 0.8rem;
  color: var(--price);
  font-size: 1.1rem;
  font-weight: 800;
}

.editor-price input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 0.7rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--price);
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.editor-price:focus-within {
  border-color: var(--price);
  box-shadow: 0 0 0 3px rgba(178, 62, 44, 0.12);
}

.photo-edit {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.95rem;
}

.photo-preview {
  position: relative;
  width: 104px;
  height: 104px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, #f7efe2, #e9d8c0);
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: #b28a5c;
  font-size: 0.62rem;
  font-weight: 700;
}

.photo-placeholder .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.photo-copy {
  min-width: 0;
}

.camera-btn {
  min-height: 44px;
  font-size: 0.8rem;
}

.photo-copy p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.5;
}

.price-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.price-input:focus-within {
  border-color: #c9a572;
  box-shadow: 0 0 0 3px rgba(185, 116, 50, 0.12);
}

.price-input > span {
  padding-left: 0.7rem;
  color: var(--brand-light);
  font-size: 1rem;
  font-weight: 800;
}

.price-input input {
  border: 0;
  border-radius: 0;
  height: 44px;
  min-height: 44px;
  padding: 0 0.7rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand-dark);
  box-shadow: none !important;
  font-variant-numeric: tabular-nums;
}

.form-foot {
  flex-wrap: wrap;
}

.form-foot .btn {
  flex: 1;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   商品操作面板
   -------------------------------------------------------------------------- */

dialog.sheet {
  width: min(520px, calc(100vw - 2rem));
}

.sheet-card {
  max-height: calc(100dvh - 2rem);
}

.sheet-photo {
  position: relative;
  flex: none;
  aspect-ratio: 1.2 / 1;
  max-height: 42vh;
  background: linear-gradient(145deg, #f7efe2, #e9d8c0);
  overflow: hidden;
}

.sheet-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sheet-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: #b28a5c;
  font-size: 0.74rem;
  font-weight: 700;
}

.sheet-placeholder .icon {
  width: 2rem;
  height: 2rem;
}

.sheet-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 5;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(47, 36, 24, 0.55);
  color: #fff;
  backdrop-filter: blur(4px);
}

.sheet-close .icon {
  width: 1rem;
  height: 1rem;
}

.sheet-camera {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 40px;
  padding: 0 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(47, 36, 24, 0.62);
  color: #fff8ec;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  backdrop-filter: blur(5px);
}

.sheet-camera.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.sheet-camera .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.sheet-body {
  padding: 0.9rem 1.1rem 1rem;
  text-align: center;
  overflow-y: auto;
}

.sheet-heading h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--name);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.sheet-category {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.18rem 0.7rem;
  border: 1px solid var(--category-line);
  border-radius: 999px;
  background: var(--category-soft);
  color: var(--category);
  font-size: 0.88rem;
  font-weight: 800;
}

.sheet-price-compact {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: min(280px, 100%);
  margin: 0.9rem auto 0;
}

.sheet-currency {
  color: var(--price);
  font-size: 1.2rem;
  font-weight: 800;
}

.sheet-price-compact input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 0.6rem;
  border: 1px solid var(--price-line);
  border-radius: 11px;
  background: #fff;
  color: var(--price);
  font-size: 1.45rem;
  font-weight: 800;
  text-align: center;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.sheet-price-compact input:focus {
  border-color: var(--price);
  box-shadow: 0 0 0 3px rgba(178, 62, 44, 0.12);
}

.sheet-price-compact .btn {
  min-height: 48px;
  flex: none;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   分类管理
   -------------------------------------------------------------------------- */

.category-form {
  display: flex;
  gap: 0.4rem;
}

.category-form input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}

.category-form input:focus {
  border-color: #c9a572;
  box-shadow: 0 0 0 3px rgba(185, 116, 50, 0.12);
}

.category-form .btn {
  flex: none;
  min-height: 42px;
}

.category-list {
  margin-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.category-row-main {
  min-width: 0;
}

.category-row-main strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 800;
}

.category-row-main small {
  display: block;
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.66rem;
}

.category-row-actions {
  display: flex;
  gap: 0.25rem;
  flex: none;
}

.category-row-actions .icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

/* --------------------------------------------------------------------------
   菜单
   -------------------------------------------------------------------------- */

.menu-body {
  padding: 0.45rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.72rem 0.65rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.menu-item:hover {
  background: var(--surface-soft);
}

.menu-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
}

.menu-icon .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.menu-text {
  flex: 1;
  min-width: 0;
}

.menu-text strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 800;
}

.menu-text small {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.menu-arrow {
  width: 1rem;
  height: 1rem;
  color: #b09a80;
}

.menu-state {
  flex: none;
  min-width: 2rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: #eee1cf;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-align: center;
}

.menu-state.is-on {
  background: var(--green-soft);
  color: var(--green-dark);
}

/* --------------------------------------------------------------------------
   备份 / 手机
   -------------------------------------------------------------------------- */

.save-create {
  display: flex;
  gap: 0.45rem;
}

.save-create input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  outline: none;
}

.save-create input:focus {
  border-color: #c9a572;
  box-shadow: 0 0 0 3px rgba(185, 116, 50, 0.12);
}

.save-create .btn {
  flex: none;
  min-height: 44px;
}

.save-tip {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}

.save-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.85rem 0 0.5rem;
}

.save-list-head strong {
  font-size: 0.82rem;
  font-weight: 800;
}

.save-list-head span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 600;
}

.save-list {
  display: grid;
  gap: 0.48rem;
  max-height: 320px;
  padding-right: 0.1rem;
  overflow-y: auto;
}

.save-slot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.slot-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.slot-main {
  min-width: 0;
}

.slot-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.slot-main small {
  display: block;
  margin-top: 0.12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.62rem;
}

.slot-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.slot-actions .icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.slot-load {
  min-height: 34px;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  font-size: 0.72rem;
}

.save-empty {
  padding: 1.4rem 0.8rem;
  border: 1px dashed var(--line);
  background: var(--surface-soft);
  border-radius: 13px;
}

.save-empty .empty-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 0.55rem;
  border-radius: 13px;
}

.save-empty .empty-icon .icon {
  width: 1.3rem;
  height: 1.3rem;
}

.save-empty h3 {
  font-size: 0.88rem;
}

.save-empty p {
  font-size: 0.7rem;
}

.archive-box {
  margin-top: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}

.archive-box summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 800;
}

.archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.archive-actions .btn {
  min-height: 40px;
  font-size: 0.74rem;
}

.archive-note {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.5;
}

#diffDialog {
  width: min(620px, calc(100vw - 2rem));
}

.diff-target {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
}

.diff-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin-top: 0.55rem;
}

.diff-chip {
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
}

.diff-chip.add {
  background: var(--green-soft);
  color: var(--green-dark);
}

.diff-chip.remove {
  background: var(--red-soft);
  color: var(--red);
}

.diff-chip.price,
.diff-chip.name,
.diff-chip.image {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.diff-chip.category {
  background: #eee8f7;
  color: #6b568f;
}

.diff-chip.spec {
  background: var(--spec-soft);
  color: var(--spec);
}

.diff-list {
  max-height: 40vh;
  margin-top: 0.45rem;
  overflow-y: auto;
}

.diff-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.diff-row:last-child {
  border-bottom: 0;
}

.diff-tag {
  flex: none;
  min-width: 2.6rem;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 800;
}

.diff-tag.add {
  background: var(--green-soft);
  color: var(--green-dark);
}

.diff-tag.remove {
  background: var(--red-soft);
  color: var(--red);
}

.diff-tag.change {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.diff-tag.category {
  background: #eee8f7;
  color: #6b568f;
}

.diff-main {
  min-width: 0;
}

.diff-main strong {
  display: block;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.diff-main p {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.diff-empty {
  padding: 1.3rem 0.8rem;
  border: 1px dashed var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.backup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.action-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

.action-card:hover {
  border-color: #d9bf9b;
  background: #fffaf2;
}

.action-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
}

.action-icon .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.action-text {
  min-width: 0;
}

.action-text strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
}

.action-text small {
  display: block;
  margin-top: 0.14rem;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.5;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1rem 0 0.65rem;
  color: #9d8971;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.excel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.excel-actions .btn {
  min-height: 44px;
  font-size: 0.76rem;
}

.info-box {
  margin-top: 0.8rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e9d5b5;
  border-radius: 10px;
  background: #fdf7ec;
}

.info-box strong {
  display: block;
  color: var(--ink-soft);
  font-size: 0.73rem;
}

.info-box p {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.65;
}

.info-box b {
  color: var(--brand-dark);
}

.auto-backup {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.65rem;
  color: #9a866e;
  font-size: 0.65rem;
  line-height: 1.55;
}

.auto-backup .icon {
  width: 0.9rem;
  height: 0.9rem;
  margin-top: 0.08rem;
  color: var(--green);
}

.phone-hero {
  padding: 0.85rem;
  border: 1px solid #e7d3b5;
  border-radius: 13px;
  background: linear-gradient(160deg, #fffaf1 0%, #f9eedc 100%);
}

.phone-hero-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-bottom: 0.5rem;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}

.phone-hero-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.phone-hero > p {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.url-box {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.6rem 0 0.3rem;
  padding: 0.5rem 0.5rem 0.5rem 0.75rem;
  border-radius: 10px;
  background: #342416;
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.25);
}

.url-box code {
  flex: 1;
  min-width: 0;
  color: #ffe0a8;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  height: 32px;
  padding: 0 0.5rem;
  flex: none;
  border: 1px solid rgba(255, 224, 168, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffe9c4;
  font-size: 0.7rem;
  font-weight: 700;
}

.copy-btn .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.phone-hint {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.steps {
  display: grid;
  gap: 0.65rem;
  margin: 0.9rem 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.steps li > span {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 800;
}

.steps strong {
  display: block;
  color: var(--ink-soft);
  font-size: 0.77rem;
}

.steps p {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.notice-box {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #edd0a5;
  border-radius: 9px;
  background: #fff8e9;
  color: #7e5c27;
}

.notice-box .icon {
  width: 0.95rem;
  height: 0.95rem;
  margin-top: 0.08rem;
}

.notice-box p {
  font-size: 0.68rem;
  line-height: 1.6;
}

.more-addresses {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.more-addresses summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--brand);
}

.more-addresses div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.more-addresses code {
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.confirm-message {
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.7;
  white-space: pre-line;
}

/* Toast */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom));
  z-index: 100;
  width: min(92vw, 430px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 0.62rem 0.9rem;
  border-radius: 10px;
  background: #342416;
  color: #fff6e8;
  box-shadow: 0 8px 26px rgba(35, 22, 9, 0.26);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
  animation: toast-in 0.22s ease-out both;
}

.toast.success {
  background: var(--green-dark);
}

.toast.error {
  background: #8f3020;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease-in both;
}

/* --------------------------------------------------------------------------
   手机
   -------------------------------------------------------------------------- */

@media (max-width: 700px) {
  .header-inner {
    padding: 0.4rem 0.65rem;
  }

  .admin-btn {
    padding: 0 0.55rem;
    font-size: 0.76rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .brand-mark svg {
    width: 24px;
    height: 24px;
  }

  .brand-text strong {
    font-size: 1rem;
  }

  .brand-text small {
    font-size: 0.55rem;
  }

  .header-actions {
    gap: 0.3rem;
  }

  .icon-btn {
    width: 37px;
    height: 37px;
  }

  .category-scroll {
    padding: 0.45rem 0.65rem;
    gap: 0.38rem;
  }

  .category-chip {
    height: 37px;
    padding: 0 0.82rem;
    font-size: 0.88rem;
  }

  .page {
    padding: 0.55rem 0.65rem 2.4rem;
  }

  body.has-alpha .page {
    padding-right: 1.8rem;
  }

  .search-box input {
    height: 44px;
    font-size: 1rem;
  }

  .product-grid {
    gap: 0.55rem;
  }

  .product-card {
    border-radius: 17px;
  }

  .card-label {
    width: 100%;
    height: auto;
    min-height: 60px;
    border-radius: 0;
    padding: 0.7rem 0.35rem 0.48rem;
  }

  .card-price .currency {
    font-size: 0.68rem;
  }

  .card-empty {
    font-size: 0.65rem;
  }

  .card-empty .icon {
    width: 1.6rem;
    height: 1.6rem;
  }

  dialog.modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(var(--app-vh, 100dvh) - 3rem);
    margin: auto 0 var(--keyboard-inset, 0px);
    border-radius: 22px 22px 0 0;
  }

  dialog.sheet {
    width: 100%;
    max-width: 100%;
  }

  #backupDialog,
  #diffDialog,
  #phoneDialog,
  #confirmDialog,
  #categoryDialog,
  #menuDialog {
    width: 100%;
    max-width: 100%;
  }

  .modal-card {
    max-height: calc(var(--app-vh, 100dvh) - 3rem);
    border-radius: 22px 22px 0 0;
  }

  .sheet-card {
    border-radius: 22px 22px 0 0;
  }

  .sheet-photo {
    aspect-ratio: 1 / 1;
    max-height: 38dvh;
  }

  .modal-head {
    padding: 0.9rem 1rem 0.75rem;
  }

  .modal-body {
    padding: 0.9rem 1rem;
    scroll-padding-block: 1rem;
  }

  .modal-foot {
    padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
  }

  .modal-foot .btn {
    flex: 1;
    min-height: 45px;
  }

  .form-grid {
    gap: 0.55rem;
  }

  .field input,
  .field select {
    font-size: 1rem;
  }

  .form-photo {
    aspect-ratio: 1 / 1;
    max-height: 36dvh;
  }

  .photo-preview {
    width: 92px;
    height: 92px;
  }

  .form-foot .btn {
    min-width: 0;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    font-size: 0.78rem;
  }

  .backup-grid,
  .excel-actions {
    grid-template-columns: 1fr;
  }

  .menu-body {
    padding: 0.35rem;
  }

  .save-slot {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .slot-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 0.35rem;
    border-top: 1px solid var(--line);
  }

  .slot-load {
    min-height: 38px;
    padding: 0 0.85rem;
    font-size: 0.76rem;
  }

  .sheet-body {
    padding: 0.85rem 0.95rem calc(0.9rem + env(safe-area-inset-bottom));
  }

  .sheet-heading h2 {
    font-size: 1.45rem;
  }

  .sheet-price-compact {
    width: min(250px, 100%);
    margin-top: 0.75rem;
  }

  /* 手机上只保留老人要用的：看图、品名、分类、改价 */
  .sheet-actions {
    display: none;
  }

  .toast-region {
    bottom: calc(1.1rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .brand-text small {
    display: none;
  }

  .alpha-index button {
    width: 20px;
    height: 15px;
    font-size: 0.54rem;
  }


  .header-inner {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .sheet-price-compact .btn {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}
