:root {
  --bg: #f5f1ea;
  --card: #fffdf9;
  --ink: #2a2520;
  --ink-2: #6f655b;
  --line: #e6ded2;
  --accent: #c4552f;
  --accent-soft: #f6e2d8;
  --ok: #3d8b5a;
  --warn: #c48a1d;
  --bad: #b8443a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .06);
  --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916;
    --card: #25221e;
    --ink: #f1ebe3;
    --ink-2: #a89d90;
    --line: #38332d;
    --accent: #e0774f;
    --accent-soft: #3d2a21;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 0; }
h1 { font-size: 26px; margin: 8px 0 14px; letter-spacing: .5px; }
h2 { font-size: 17px; margin: 22px 0 10px; color: var(--ink-2); font-weight: 600; }
.muted { color: var(--ink-2); font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* 顶部 */
.top { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.top h1 { margin: 0; flex: 1; font-size: 22px; }
.back { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 20px; }

/* 搜索 */
.search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 12px 18px; box-shadow: var(--shadow); position: sticky; top: 10px; z-index: 5;
}
.search:focus-within { border-color: var(--accent); }
.search input, .search input:not([type]) { border: 0; outline: 0; background: transparent; flex: 1; font-size: 18px; padding: 0; width: auto; min-width: 0; }
.hello { font-size: 15px; color: var(--ink-2); margin: 6px 4px 4px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; padding: 10px; align-items: center; }
.thumb {
  width: 64px; height: 64px; border-radius: 10px; flex: none; object-fit: cover; background: var(--accent-soft);
  display: grid; place-items: center; font-size: 26px; color: var(--accent); font-weight: 700;
}
.item .name { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place { color: var(--accent); font-weight: 600; font-size: 15px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.chip.gray { background: var(--line); color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* 房间 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.room { padding: 16px; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; }
.room b { font-size: 18px; }

/* 物品详情 */
.hero { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.where { font-size: 22px; font-weight: 700; color: var(--accent); margin: 2px 0 10px; }
.photos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.photos .ph { position: relative; flex: none; scroll-snap-align: start; }
.photos img { width: 220px; height: 220px; object-fit: cover; border-radius: 12px; display: block; }
.photos .del {
  position: absolute; top: 6px; right: 6px; border: 0; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 16px;
}
.nophoto {
  height: 160px; border-radius: 12px; border: 2px dashed var(--line); display: grid; place-items: center;
  color: var(--ink-2); text-align: center; padding: 10px;
}
.kv { padding: 4px 14px; }
.kv > div { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--ink-2); width: 68px; flex: none; }

/* 按钮 */
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line);
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 18px); width: 58px; height: 58px;
  border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 32px; line-height: 1;
  box-shadow: 0 6px 18px rgba(196, 85, 47, .4); z-index: 20;
}

/* 表单 */
form .f { margin-bottom: 14px; }
label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=password], input:not([type]), select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); outline: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preview img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; }

/* 问答记录 */
.qa { padding: 12px 14px; }
.qa .q { font-weight: 600; }
.qa .a { margin-top: 4px; color: var(--ink); }
.qa .meta { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.filters .chip { padding: 6px 12px; font-size: 14px; background: var(--card); border: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.filters .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 设置 */
.sec { padding: 4px 14px; }
.sec > .li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sec > .li:last-child { border-bottom: 0; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--bg); padding: 2px 6px; border-radius: 6px; }
.big-code { font-size: 26px; letter-spacing: 3px; font-weight: 700; color: var(--accent); }

/* 底部导航 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; color: var(--ink-2); gap: 2px; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--accent); font-weight: 600; }

/* 登录 */
.login { max-width: 420px; margin: 8vh auto 0; padding: 0 20px; }
.logo { font-size: 30px; font-weight: 800; margin-bottom: 4px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--line); padding: 4px; border-radius: 12px; margin: 22px 0 18px; }
.seg button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 30px); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 100; max-width: 86vw; text-align: center;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
.empty { text-align: center; color: var(--ink-2); padding: 34px 10px; }
.empty .ic { font-size: 40px; }
.spin { text-align: center; color: var(--ink-2); padding: 30px; }
.answer { padding: 12px 14px; margin-top: 10px; background: var(--accent-soft); border-radius: 12px; }
