/* AI失物小管家 · 设计系统
   红领巾红做主色，奶油纸做底；大字、大按钮、一屏只做一件事。 */
:root {
  --bg: #f6efe3;
  --paper: #fffdf8;
  --ink: #1d2433;
  --ink-2: #4b5367;
  --muted: #8a8f9e;
  --line: #eadfcc;
  --line-2: #f1e8d8;
  --red: #d23f31;
  --red-deep: #a8291d;
  --red-soft: #fdecea;
  --gold: #f2b134;
  --gold-soft: #fff5dc;
  --green: #1f8a5b;
  --green-soft: #e3f4ea;
  --blue: #2d6cdf;
  --blue-soft: #e8f0fd;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 0 rgba(29, 36, 51, .04), 0 10px 30px -12px rgba(29, 36, 51, .18);
  --shadow-sm: 0 1px 0 rgba(29, 36, 51, .05), 0 4px 14px -8px rgba(29, 36, 51, .2);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: var(--bg) radial-gradient(rgba(168, 41, 29, .07) 1px, transparent 1px) 0 0 / 22px 22px;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.shell { max-width: 600px; margin: 0 auto; padding: 0 16px 48px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px; height: 60px;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: .5px; }
.logo svg { flex: none; }
.topbar .spacer { flex: 1; }
.back {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--paper);
  box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.ai-dot { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ai-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ai-dot.on { color: var(--green); }
.ai-dot.on i { background: var(--green); box-shadow: 0 0 0 4px rgba(31, 138, 91, .15); }

/* ---------- 首页主视觉 ---------- */
.hero { padding: 18px 2px 8px; }
.hero h1 { margin: 0; font-size: 32px; line-height: 1.22; font-weight: 800; letter-spacing: .5px; }
.hero h1 em { font-style: normal; color: var(--red); }
.hero p { margin: 10px 0 0; color: var(--ink-2); font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 6px; }
.stat { background: var(--paper); border-radius: var(--r-md); padding: 12px 12px 10px; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-size: 26px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* ---------- 三个入口 ---------- */
.entries { display: grid; gap: 12px; margin-top: 18px; }
.entry {
  display: grid; grid-template-columns: 56px 1fr 20px; align-items: center; gap: 14px;
  width: 100%; text-align: left; border: 0; cursor: pointer; text-decoration: none;
  background: var(--paper); border-radius: var(--r-lg); padding: 16px 16px; box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.entry:active { transform: scale(.985); }
.entry .ico { width: 56px; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center; }
.entry b { display: block; font-size: 19px; line-height: 1.3; }
.entry small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.entry.primary { background: linear-gradient(135deg, #db4a3b, #b7301f); color: #fff; padding: 22px 18px; }
.entry.primary small { color: rgba(255, 255, 255, .82); }
.entry.primary .ico { background: rgba(255, 255, 255, .16); }
.entry.primary b { font-size: 22px; }
.ico.gold { background: var(--gold-soft); color: #b67c00; }
.ico.blue { background: var(--blue-soft); color: var(--blue); }
.ico.green { background: var(--green-soft); color: var(--green); }

/* ---------- 区块 ---------- */
.section { margin-top: 30px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.section-h h2 { margin: 0; font-size: 19px; }
.section-h span { color: var(--muted); font-size: 13px; }
.panel { background: var(--paper); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.pill {
  flex: none; border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 6px 14px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shelf-item { background: var(--paper); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.shelf-item .ph { position: relative; aspect-ratio: 1; background: #efe6d6; }
.shelf-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shelf-item .t { padding: 8px 10px 10px; font-size: 13.5px; line-height: 1.35; font-weight: 600; }
.shelf-item .t small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 14.5px; }
.empty svg { display: block; margin: 0 auto 8px; opacity: .5; }

.howto { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; counter-reset: s; }
.howto div { text-align: center; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.howto div::before {
  counter-increment: s; content: counter(s); display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin: 0 auto 6px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-weight: 800;
}
.promise { list-style: none; margin: 14px 0 0; padding: 14px 0 0; border-top: 1.5px dashed var(--line); display: grid; gap: 6px; }
.promise li { font-size: 14px; color: var(--ink-2); padding-left: 24px; position: relative; }
.promise li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 10px; height: 6px; border-left: 2.5px solid var(--green); border-bottom: 2.5px solid var(--green); transform: rotate(-45deg); }

/* ---------- 流程页 ---------- */
.view-title { margin: 8px 2px 4px; font-size: 26px; line-height: 1.25; font-weight: 800; }
.view-sub { margin: 0 2px 16px; color: var(--ink-2); }
.stepper { display: flex; gap: 6px; margin: 4px 2px 18px; }
.stepper span { flex: 1; font-size: 12.5px; color: var(--muted); padding-top: 8px; border-top: 4px solid var(--line); }
.stepper span.on { color: var(--ink); border-color: var(--red); font-weight: 700; }
.stepper span.done { color: var(--ink-2); border-color: #eaa59d; }

textarea, input[type=text], input[type=password], input[type=date], select {
  width: 100%; background: #fff; border: 2px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px; outline: none; font-size: 17px; transition: border-color .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
textarea:focus, input:focus, select:focus { border-color: var(--ink); }
.label { display: block; font-size: 14px; font-weight: 700; margin: 16px 2px 8px; }
.tips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.tip { font-size: 13px; color: var(--ink-2); background: var(--line-2); border-radius: 8px; padding: 3px 9px; }
.examples { margin-top: 14px; }
.examples p { margin: 0 2px 8px; font-size: 13px; color: var(--muted); }
.chip {
  display: inline-block; border: 1.5px dashed #d9cbb2; background: transparent; border-radius: 999px;
  padding: 6px 13px; font-size: 14px; cursor: pointer; margin: 0 6px 8px 0; color: var(--ink-2);
}
.chip.on { border-style: solid; border-color: var(--ink); background: var(--ink); color: #fff; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; text-decoration: none;
  min-height: 56px; border: 0; border-radius: var(--r-md); cursor: pointer;
  background: var(--red); color: #fff; font-size: 18px; font-weight: 700; margin-top: 16px;
  box-shadow: 0 8px 18px -10px rgba(168, 41, 29, .8); transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.dark { background: var(--ink); box-shadow: 0 8px 18px -10px rgba(29, 36, 51, .8); }
.btn.green { background: var(--green); box-shadow: 0 8px 18px -10px rgba(31, 138, 91, .8); }
.btn.ghost { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.sm { min-height: 42px; font-size: 15px; margin-top: 0; width: auto; padding: 0 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }

/* 候选卡片 */
.results-h { margin: 22px 2px 10px; font-size: 16px; font-weight: 700; }
.match {
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px;
  display: grid; grid-template-columns: 92px 1fr; gap: 14px;
}
.match .ph { position: relative; width: 92px; height: 92px; border-radius: 14px; overflow: hidden; background: #efe6d6; }
.match .ph img { width: 100%; height: 100%; object-fit: cover; }
.lock {
  position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; color: #fff; background: rgba(29, 36, 51, .6);
  border-radius: 6px; padding: 1px 6px; backdrop-filter: blur(2px);
}
.match h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.match .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.meter { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; }
.meter .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter .bar b { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.meter .lv { font-size: 13px; font-weight: 700; color: var(--green); white-space: nowrap; }
.meter.mid .bar b { background: var(--gold); } .meter.mid .lv { color: #a87200; }
.match .why { font-size: 13px; color: var(--ink-2); }
.match .go { grid-column: 1 / -1; }
.claim-form { grid-column: 1 / -1; border-top: 1.5px dashed var(--line); padding-top: 12px; }
.claim-form p { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); }

/* 提示框 */
.note { border-radius: var(--r-lg); padding: 18px; margin-top: 18px; background: var(--paper); box-shadow: var(--shadow); }
.note h3 { margin: 0 0 6px; font-size: 18px; }
.note p { margin: 0; color: var(--ink-2); }
.note.yellow { background: var(--gold-soft); box-shadow: none; }
.note.green { background: var(--green-soft); box-shadow: none; }
.note.red { background: var(--red-soft); box-shadow: none; }
.note .big { font-size: 34px; font-weight: 800; color: var(--red); line-height: 1.1; }

/* 码票 */
.ticket {
  position: relative; margin-top: 18px; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.ticket .top { background: var(--red); color: #fff; padding: 16px 18px 14px; }
.ticket .top small { opacity: .85; font-size: 13px; }
.ticket .top .code { font: 800 38px/1.15 var(--mono); letter-spacing: 8px; margin-top: 4px; }
.ticket .cut { height: 0; border-top: 2px dashed var(--line); margin: 0 14px; position: relative; }
.ticket .cut::before, .ticket .cut::after { content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); }
.ticket .cut::before { left: -26px; } .ticket .cut::after { right: -26px; }
.ticket ol { margin: 0; padding: 14px 18px 18px 38px; display: grid; gap: 6px; color: var(--ink-2); }
.ticket ol b { color: var(--ink); }

.loading { text-align: center; padding: 28px 0 10px; color: var(--ink-2); }
.dots { display: inline-flex; gap: 5px; margin-bottom: 8px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: hop 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-6px); opacity: 1; } }

/* 码输入 */
.code-input { font: 700 26px/1 var(--mono) !important; letter-spacing: 10px; text-align: center; text-transform: uppercase; }

/* ---------- 登记页 ---------- */
.camera {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 220px; border: 2.5px dashed #d9cbb2; border-radius: var(--r-lg); background: var(--paper);
  cursor: pointer; text-align: center; color: var(--ink-2); overflow: hidden; position: relative;
}
.camera b { font-size: 19px; color: var(--ink); }
.camera img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #efe6d6; }
.camera .redo { position: absolute; right: 10px; bottom: 10px; background: rgba(255,255,255,.92); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.ai-card { display: flex; gap: 12px; align-items: flex-start; }
.ai-card .badge { flex: none; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 3px 8px; background: var(--green-soft); color: var(--green); }
.ai-card .badge.low { background: var(--gold-soft); color: #a87200; }
.feat-row { display: flex; gap: 8px; margin-bottom: 8px; }
.feat-row input { flex: 1; font-size: 16px; padding: 11px 14px; }
.icon-btn { flex: none; width: 46px; border: 0; border-radius: var(--r-sm); background: var(--line-2); cursor: pointer; font-size: 20px; color: var(--ink-2); }
.add-link { border: 0; background: none; color: var(--blue); font-weight: 700; padding: 4px 2px; cursor: pointer; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.counter .n { text-align: center; }
.counter .n b { display: block; font-size: 40px; line-height: 1; font-weight: 800; }
.counter .n span { font-size: 12px; color: var(--muted); }
.counter .btn { flex: 1; margin: 0; }

/* 列表（登记员/老师） */
.row-item { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.row-item:first-child { border-top: 0; padding-top: 0; }
.row-item img, .row-item .ph0 { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: #efe6d6; }
.row-item h4 { margin: 0; font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-item .meta { font-size: 13px; color: var(--muted); }
.row-item .acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.row-item .acts .btn { flex: 1 1 130px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.tags span { font-size: 12.5px; background: var(--blue-soft); color: var(--blue); border-radius: 7px; padding: 2px 8px; }
.st { font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; }
.st.waiting { background: var(--gold-soft); color: #a87200; }
.st.returned { background: var(--green-soft); color: var(--green); }
.st.removed { background: #eee; color: var(--muted); }
.said { margin-top: 8px; background: var(--gold-soft); border-radius: 12px; padding: 10px 12px; font-size: 14.5px; }
.said b { font-family: var(--mono); letter-spacing: 2px; }

.tabs { display: flex; background: var(--line-2); border-radius: 14px; padding: 4px; gap: 4px; margin: 6px 0 16px; }
.tab { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 9px 6px; font-size: 14.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.tab.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab em { font-style: normal; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; margin-left: 4px; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--paper); border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow-sm); }
.kpi b { display: block; font-size: 32px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13.5px; color: var(--ink-2); }
.kpi small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.gate { margin-top: 12vh; }
.gate .panel { text-align: center; }
.gate h1 { font-size: 24px; margin: 6px 0 4px; }
.gate p { color: var(--ink-2); margin: 0 0 14px; }

footer.foot { margin-top: 36px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
footer.foot a { color: var(--muted); }
.helper { background: var(--gold-soft); color: #8a6200; padding: 1px 8px; border-radius: 99px; }

#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 16px); opacity: 0; z-index: 20;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 15px;
  transition: all .2s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (min-width: 720px) {
  .shell { max-width: 640px; }
  .hero h1 { font-size: 38px; }
  .shelf { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .hero h1 { font-size: 28px; }
  .stat b { font-size: 22px; }
  .howto { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
}
