:root {
  --paper: #f2ede2;
  --paper-2: #eae2d3;
  --card: #fffdf8;
  --ink: #201d18;
  --ink-soft: #453e34;
  --muted: #8a7f6f;
  --line: #e5dccd;
  --line-strong: #d4c7b2;
  --accent: #b2563a;
  --accent-deep: #8b3f28;
  --accent-soft: #f5e2d6;
  --sage: #5b7a62;
  --sage-soft: #e7efe8;
  --warn: #ad701c;
  --warn-soft: #fbf0d8;
  --danger: #ab4135;
  --danger-soft: #f8e3de;
  --blue: #4d6f8d;
  --blue-soft: #e7eef5;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 1px 2px rgba(72, 54, 35, 0.04), 0 14px 34px -26px rgba(72, 54, 35, 0.45);
  --shadow-soft: 0 1px 0 rgba(255, 255, 255, 0.65) inset, 0 10px 24px -22px rgba(72, 54, 35, 0.5);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 520px at 82% -12%, rgba(178, 86, 58, 0.10), transparent 62%),
    radial-gradient(900px 480px at -8% 8%, rgba(91, 122, 98, 0.07), transparent 60%),
    linear-gradient(180deg, #f5f0e6 0%, #f2ede2 46%, #efe8db 100%);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
img { display: block; }

/* 线条图标 */
.ic {
  width: 1em;
  height: 1em;
  display: inline-block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.12em;
}

/* ------------------------------------------------------------- 顶栏 */
body.sheet-open { overflow: hidden; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: max(12px, var(--safe-top)) max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  background: rgba(244, 239, 229, 0.78);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid rgba(212, 199, 178, 0.45);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(155deg, #c26a4c 0%, #ab4f34 100%);
  box-shadow: 0 8px 16px -10px rgba(139, 63, 40, 0.9), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}
.brand-mark svg { width: 25px; height: 25px; }
.brand-name {
  font-weight: 680;
  font-size: 15px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.2;
}
.brand-name small {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 620;
  color: var(--muted);
  letter-spacing: 0.2em;
}

.search {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 1px 2px rgba(72, 54, 35, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within {
  border-color: rgba(178, 86, 58, 0.55);
  box-shadow: 0 0 0 3px rgba(178, 86, 58, 0.09);
}
.search-icon { flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); }
.search-icon svg { width: 16px; height: 16px; }
.search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  letter-spacing: 0.01em;
}
.search input::placeholder { color: #b1a795; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  display: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.search.has-value .search-clear { display: grid; place-items: center; }

.add-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(150deg, #c06446 0%, #a94d32 100%);
  color: #fff8ef;
  box-shadow: 0 10px 18px -10px rgba(139, 63, 40, 0.9);
  transition: transform 0.12s ease, filter 0.15s;
}
.add-btn svg { width: 19px; height: 19px; stroke-width: 2; }
.add-btn:active { transform: scale(0.94); filter: brightness(0.96); }

main {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 18px max(16px, env(safe-area-inset-left)) calc(108px + var(--safe-bottom)) max(16px, env(safe-area-inset-right));
}

/* ------------------------------------------------------------- 通用 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.section { margin-top: 26px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 12px;
}
.section-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: 0.02em;
}
.section-head h2::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--accent);
  transform: rotate(45deg);
  flex: 0 0 auto;
}
.section-head .hint {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.empty {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.55);
}
.empty .empty-art { width: 58px; height: 58px; opacity: 0.75; }
.empty p { margin: 0; font-size: 13px; line-height: 1.6; }
.empty strong { color: var(--ink-soft); font-weight: 660; }

/* ------------------------------------------------------------- 首页 */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 16px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(148deg, rgba(255, 253, 248, 0.96) 0%, rgba(251, 244, 233, 0.95) 58%, rgba(247, 233, 221, 0.94) 100%);
  box-shadow: var(--shadow);
}
.hero::before {
  content: "";
  position: absolute;
  right: -70px;
  top: -90px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 42%, rgba(178, 86, 58, 0.18), rgba(178, 86, 58, 0.04) 52%, transparent 68%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -46px;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(178, 86, 58, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(178, 86, 58, 0.045), 0 0 0 38px rgba(178, 86, 58, 0.025);
  pointer-events: none;
}
.hero h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.28;
  font-weight: 720;
  letter-spacing: -0.015em;
}
.hero-sub {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.stat-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(212, 199, 178, 0.65);
}
.stat { padding: 0 10px; border-left: 1px solid rgba(212, 199, 178, 0.55); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat b {
  display: block;
  font-size: clamp(18px, 5.2vw, 23px);
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat span { display: block; margin-top: 3px; font-size: 10.5px; letter-spacing: 0.03em; color: var(--muted); }
.stat.alert b { color: var(--warn); }
.stat.danger b { color: var(--danger); }

/* 需要留意 */
.warn-card { overflow: hidden; }
.warn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 15px;
  text-align: left;
  border-top: 1px solid var(--line);
  transition: background 0.15s;
}
.warn-row:first-child { border-top: 0; }
.warn-row:active { background: var(--paper); }
.warn-emoji {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 19px;
  overflow: hidden;
}
.warn-emoji img { width: 100%; height: 100%; object-fit: cover; }
.warn-main { flex: 1 1 auto; min-width: 0; }
.warn-main b { display: block; font-size: 14.5px; font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-main span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-row .badge { flex: 0 0 auto; }

/* 房间 */
.room-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .room-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.room-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 13px 12px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, border-color 0.15s;
  min-width: 0;
}
.room-card:active { transform: scale(0.975); border-color: var(--line-strong); }
.room-card .r-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 20px;
  border-radius: 12px;
  background: linear-gradient(145deg, #fbf4e8, #f1e7d8);
  border: 1px solid rgba(212, 199, 178, 0.6);
  overflow: hidden;
}
.room-card .r-body { min-width: 0; flex: 1 1 auto; }
.room-card .r-name { display: block; font-size: 14.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-card .r-count { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); }

/* 时间线 */
.timeline { padding: 4px 16px; }
.tl-item { display: flex; gap: 12px; padding: 11px 0; border-top: 1px dashed var(--line); }
.tl-item:first-child { border-top: 0; }
.tl-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tl-body { min-width: 0; }
.tl-body p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.tl-body p b { font-weight: 650; }
.tl-body .delta { font-variant-numeric: tabular-nums; font-weight: 650; margin-left: 2px; }
.tl-body .delta.plus { color: var(--sage); }
.tl-body .delta.minus { color: var(--accent-deep); }
.tl-time { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------- 空间 */
.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0 12px;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumb {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.7);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.crumb.current { background: var(--ink); color: #fdfbf6; border-color: var(--ink); }
.crumb-sep { color: var(--muted); font-size: 10px; flex: 0 0 auto; }
.crumb .ic { width: 12px; height: 12px; margin-right: 3px; vertical-align: -1px; }

.node-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.node-hero .n-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 15px;
  background: linear-gradient(145deg, #fbf4e8, #efe4d3);
  border: 1px solid rgba(212, 199, 178, 0.6);
  overflow: hidden;
}
.node-hero .n-main { flex: 1 1 auto; min-width: 0; }
.node-actions { flex: 0 0 100%; display: flex; flex-wrap: nowrap; gap: 6px; margin-top: 12px; }
.node-actions .mini-btn { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 3px; padding: 7px 6px; }
.node-hero h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-hero p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.mini-btn {
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  white-space: nowrap;
  transition: background 0.15s;
}
.mini-btn:active { background: var(--paper-2); }
.mini-btn.danger { color: var(--danger); border-color: #eed2cc; background: var(--danger-soft); }
.mini-btn .ic { width: 12px; height: 12px; margin-right: 2px; vertical-align: -1px; }

/* 位置卡片 */
.loc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .loc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.loc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  transition: transform 0.12s ease;
}
.loc-card:active { transform: scale(0.98); background: #fdfaf4; }
.loc-card .l-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 18px;
  border-radius: 10px;
  background: var(--paper);
  overflow: hidden;
}
.loc-card .l-body { min-width: 0; flex: 1 1 auto; }
.loc-card b { display: block; font-size: 13.5px; font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-card span { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); }
.loc-card .chev { color: var(--muted); font-size: 11px; }

/* 物品列表 */
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 1px 2px rgba(72, 54, 35, 0.035);
  min-width: 0;
  transition: transform 0.1s ease, border-color 0.15s;
}
.item-row:active { transform: scale(0.99); border-color: var(--line-strong); }
.thumb {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--paper);
  font-size: 20px;
  overflow: hidden;
  border: 1px solid rgba(212, 199, 178, 0.55);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-main .i-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 640;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-main .i-path {
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-main .i-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.i-qty {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  min-width: 42px;
}
.i-qty b { font-size: 15px; font-weight: 670; }
.i-qty span { margin-left: 1px; font-size: 10.5px; color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  line-height: 1.6;
  font-weight: 580;
  white-space: nowrap;
  flex: 0 0 auto;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.sage { background: var(--sage-soft); color: var(--sage); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.plain { background: var(--paper-2); color: var(--muted); }

/* 筛选 */
.filters { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 9px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  background: rgba(255, 253, 248, 0.8);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.chip.on { background: var(--ink); color: #fdfbf6; border-color: var(--ink); }
.chip .c-ic { margin-right: 3px; }

.sort-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 2px 10px; }
.sort-row .result { font-size: 11.5px; color: var(--muted); }
.select-mini {
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
  color: var(--ink-soft);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 3px 2px 12px;
  font-size: 12px;
  color: var(--muted);
}
.switch {
  position: relative;
  width: 42px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.18s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s;
}
.switch.on { background: var(--sage); }
.switch.on::after { transform: translateX(17px); }

/* ------------------------------------------------------------- 底部导航 */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  width: min(560px, calc(100vw - 28px));
  padding: 6px;
  gap: 2px;
  border-radius: 22px;
  background: rgba(255, 252, 246, 0.84);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid rgba(212, 199, 178, 0.7);
  box-shadow: 0 16px 36px -22px rgba(58, 43, 29, 0.55), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}
.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 5px;
  border-radius: 17px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: background 0.18s, color 0.18s;
}
.tab .t-ic { display: grid; place-items: center; height: 20px; opacity: 0.85; }
.tab .t-ic svg { width: 19px; height: 19px; }
.tab.on { color: var(--accent-deep); background: var(--accent-soft); font-weight: 650; }
.tab.on .t-ic { opacity: 1; }

/* ------------------------------------------------------------- 弹层 */
.sheet-root { position: fixed; inset: 0; z-index: 60; display: block; }
.sheet-root[hidden] { display: none !important; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38, 31, 24, 0.44);
  opacity: 0;
  transition: opacity 0.22s ease;
  backdrop-filter: blur(2px);
}
.sheet-root.show .sheet-backdrop { opacity: 1; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(90dvh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -18px 44px rgba(38, 31, 24, 0.22);
  transform: translateY(14px);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.2s;
  overflow: hidden;
}
.sheet-root.show .sheet { transform: none; opacity: 1; }
@media (min-width: 620px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: 540px;
    transform: translate(-50%, 16px);
    border-radius: 24px;
    max-height: min(86dvh, 800px);
  }
  .sheet-root.show .sheet { transform: translate(-50%, 0); }
}
.sheet-grab {
  width: 38px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 99px;
  background: var(--line-strong);
  flex: 0 0 auto;
}
@media (min-width: 620px) { .sheet-grab { display: none; } }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  flex: 0 0 auto;
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.icon-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
}
.sheet-body {
  padding: 2px 20px calc(22px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------- 详情 */
.detail-hero {
  position: relative;
  display: grid;
  place-items: center;
  height: 142px;
  border-radius: 20px;
  background: linear-gradient(145deg, #fbf4e8, #efe3d1);
  border: 1px solid var(--line);
  overflow: hidden;
  font-size: 44px;
}
.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: 0 8px 24px -18px rgba(60, 42, 27, 0.6) inset;
  pointer-events: none;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-tax { display: flex; justify-content: center; gap: 6px; margin-top: 13px; flex-wrap: wrap; }
.detail-name { margin: 9px 0 0; text-align: center; font-size: 23px; font-weight: 720; letter-spacing: -0.015em; }
.path-link {
  display: block;
  max-width: 100%;
  margin: 8px auto 0;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--sage);
  background: var(--sage-soft);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(91, 122, 98, 0.16);
}

.qty-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.qty-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 21px;
  font-weight: 600;
  color: var(--accent-deep);
  box-shadow: 0 1px 2px rgba(72, 54, 35, 0.06);
}
.qty-btn:active { background: var(--accent-soft); }
.qty-num { min-width: 96px; text-align: center; }
.qty-num b { display: block; font-size: 30px; font-weight: 720; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.qty-num span { font-size: 11px; color: var(--muted); }

.detail-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.detail-actions.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sheet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 9px;
  border-radius: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-soft);
  transition: background 0.15s;
}
.sheet-btn .sb-ic { display: grid; place-items: center; width: 20px; height: 20px; color: var(--ink-soft); }
.sheet-btn .sb-ic svg { width: 18px; height: 18px; }
.sheet-btn:active { background: var(--paper-2); }
.sheet-btn.danger { color: var(--danger); background: var(--danger-soft); border-color: #f0d4cf; }
.sheet-btn.danger .sb-ic { color: var(--danger); }

.kv {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.kv-row { display: flex; gap: 12px; padding: 10px 15px; border-top: 1px solid var(--line); font-size: 13.5px; }
.kv-row:first-child { border-top: 0; }
.kv-row:nth-child(odd) { background: rgba(242, 237, 226, 0.35); }
.kv-row .k { flex: 0 0 76px; padding-top: 1px; font-size: 12px; color: var(--muted); }
.kv-row .v { flex: 1 1 auto; min-width: 0; word-break: break-word; }

.photo-strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 14px; scrollbar-width: none; }
.photo-strip::-webkit-scrollbar { display: none; }
.photo-thumb { position: relative; flex: 0 0 auto; width: 88px; height: 88px; border-radius: 13px; overflow: hidden; border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
}
.photo-add {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  gap: 3px;
  border-radius: 13px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 10.5px;
  background: var(--paper);
}
.photo-add .ic { width: 20px; height: 20px; opacity: 0.75; }

.log-list { margin-top: 8px; }
.log-item { display: flex; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line); font-size: 12.5px; }
.log-item:first-child { border-top: 0; }
.log-act {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 10.5px;
  color: var(--ink-soft);
}
.log-text { flex: 1 1 auto; min-width: 0; color: var(--ink-soft); }
.log-text small { display: block; color: var(--muted); font-size: 10.5px; }

/* ------------------------------------------------------------- 表单 */
.form { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { padding-left: 2px; font-size: 12px; font-weight: 580; color: var(--muted); letter-spacing: 0.02em; }
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: #fffefa;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(178, 86, 58, 0.55);
  box-shadow: 0 0 0 3px rgba(178, 86, 58, 0.09);
}
.textarea { min-height: 78px; resize: vertical; font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-qty { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.hint { padding-left: 2px; font-size: 11px; color: var(--muted); }
.form-actions {
  display: flex;
  gap: 10px;
  padding: 12px 0 6px;
  position: sticky;
  bottom: -6px;
  background: linear-gradient(to top, var(--card) 72%, rgba(255, 253, 248, 0.92) 100%);
  z-index: 2;
}
.btn {
  flex: 1 1 auto;
  min-height: 46px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary {
  background: linear-gradient(150deg, #c06446, #a94d32);
  color: #fff8ef;
  box-shadow: 0 10px 20px -12px rgba(139, 63, 40, 0.8);
}
.btn-primary:active { filter: brightness(0.96); }
.btn-ghost { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); flex: 0 0 auto; padding: 0 18px; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #f0d4cf; }
.btn:disabled { opacity: 0.55; }

.emoji-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 18px;
}
.emoji-pick:active { background: var(--accent-soft); }

/* ------------------------------------------------------------- 设置 */
.setting-card { padding: 17px 16px; margin-bottom: 10px; }
.setting-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 5px; font-size: 14.5px; font-weight: 680; }
.setting-card h3::before { content: ""; width: 5px; height: 5px; border-radius: 1px; background: var(--accent); transform: rotate(45deg); }
.setting-card p { margin: 0 0 12px; font-size: 12px; line-height: 1.65; color: var(--muted); }
.setting-card p code { padding: 1px 5px; border-radius: 5px; background: var(--paper); font-size: 11px; color: var(--ink-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.pill-btn .ic { width: 14px; height: 14px; opacity: 0.8; }
.pill-btn:active { background: var(--paper-2); }
.pill-btn.danger { color: var(--danger); background: var(--danger-soft); border-color: #f0d4cf; }
.member-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.member-dot { width: 7px; height: 7px; border-radius: 50%; }
.member-x {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 10px;
  background: var(--card);
  border: 1px solid var(--line);
}
.data-foot { padding: 18px 0 6px; text-align: center; font-size: 11px; line-height: 1.7; color: var(--muted); }

/* ------------------------------------------------------------- 借还 */
.loan-row { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-top: 1px solid var(--line); }
.loan-row:first-child { border-top: 0; }
.loan-open {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  background: none;
  border: 0;
  text-align: left;
}
.loan-name { font-size: 14.5px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loan-sub { margin-top: 1px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loan-row.history { padding: 10px 15px; }
.loan-row .mini-btn { flex: 0 0 auto; }

/* ------------------------------------------------------------- 二维码标签 */
.label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
}
.label-qr { flex: 0 0 auto; line-height: 0; background: #fff; border-radius: 6px; }
.label-qr svg { display: block; }
.label-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.label-text b { font-size: 15px; font-weight: 660; }
.label-text span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-text i { font-style: normal; font-size: 9.5px; color: #a89e90; }
.label-preview { margin: 14px 0 8px; }

.print-sheet { display: none; }

@media print {
  @page { size: A4; margin: 10mm; }
  body.printing { background: #fff; }
  body.printing > *:not(#printSheet) { display: none !important; }
  body.printing #printSheet {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 5mm;
    width: 190mm;
  }
  body.printing .label {
    border: 1px solid #999;
    border-radius: 2mm;
    padding: 3mm;
    gap: 3mm;
    height: 32mm;
    background: #fff;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body.printing .label-qr svg { width: 24mm !important; height: 24mm !important; }
  body.printing .label-text { gap: 1mm; }
  body.printing .label-text b { font-size: 11pt; }
  body.printing .label-text span { font-size: 7pt; }
  body.printing .label-text i { font-size: 6pt; }
}

/* ------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translate(-50%, 10px);
  z-index: 80;
  max-width: min(84vw, 420px);
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(32, 29, 24, 0.92);
  color: #fdfbf6;
  font-size: 12.5px;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: rgba(148, 50, 41, 0.95); }

@media (max-width: 420px) {
  .brand-name { display: none; }
  .hero h1 { font-size: 22px; }
  .stat { padding: 0 8px; }
  .item-row { padding: 10px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------- 登录 */
body.auth-mode .topbar,
body.auth-mode .tabbar { display: none; }
body.auth-mode main { max-width: none; padding: 0; }

.auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 18px 48px;
}
.auth-screen::before {
  content: "";
  position: absolute;
  right: -120px;
  top: -140px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 42%, rgba(178, 86, 58, 0.16), transparent 66%);
  pointer-events: none;
}
.auth-card {
  position: relative;
  width: min(432px, 100%);
  padding: 30px 26px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand b { display: block; font-size: 15px; font-weight: 680; letter-spacing: 0.01em; }
.auth-brand small {
  display: block;
  margin-top: 2px;
  font-family: "Cormorant Garamond", serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--muted);
}
.auth-eyebrow {
  margin: 28px 0 6px;
  font-family: "Cormorant Garamond", serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent);
}
.auth-title { margin: 0; font-size: 27px; font-weight: 730; letter-spacing: -0.015em; }
.auth-sub { margin: 9px 0 22px; font-size: 13px; line-height: 1.65; color: var(--muted); }
.auth-form { gap: 13px; padding-top: 0; }
.auth-form .form-actions { position: static; padding: 8px 0 0; background: none; }
.auth-error {
  margin: 0;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.6;
}
.auth-note {
  margin: 16px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}
