/* 小熊儿饭堂 · 样式表
 * 配色：奶油杏底 + 蜜橘橙主色 + 嫩绿点缀
 */

:root {
  --bg: #FFF8F1;
  --bg-2: #FFF1E4;
  --card: #FFFFFF;
  --primary: #E96F3C;
  --primary-deep: #C9542A;
  --primary-soft: #FFE7D6;
  --accent: #7FA37F;
  --accent-soft: #E8F0E5;
  --ink: #4A3728;
  --ink-2: #6B5544;
  --muted: #9C8878;
  --line: #F2E3D6;
  --shadow: 0 8px 20px rgba(233, 111, 60, .10);
  --shadow-lg: 0 14px 40px rgba(120, 70, 40, .18);
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

button { font-family: inherit; font-size: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* ---------- 外壳 ---------- */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 520px) {
  body { background: #F7EDE3; padding: 24px 0; }
  #app {
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
}

/* ---------- 顶栏 ---------- */
.topbar {
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-name {
  font-size: 19px; font-weight: 700; letter-spacing: .5px;
  color: var(--ink); white-space: nowrap;
}
.brand-name .paw { color: var(--primary); margin-right: 3px; }
.brand-sub {
  font-size: 11.5px; color: var(--muted); letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip-sync {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  background: var(--accent-soft); color: #4F6B4F;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.chip-sync.local { background: #F3EDE6; color: #8B7663; }
.chip-sync .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 页面容器 ---------- */
.page {
  flex: 1;
  display: flex;
  min-height: 0;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
}

/* ---------- 菜单页：左栏 ---------- */
.rail {
  width: 88px; flex: 0 0 88px;
  background: var(--bg-2);
  padding: 6px 0 20px;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
}
.rail-item {
  position: relative;
  padding: 13px 8px;
  text-align: center;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  border-radius: 0 14px 14px 0;
  transition: background .18s, color .18s;
  line-height: 1.3;
}
.rail-item .rail-count {
  display: block; font-size: 10.5px; font-weight: 500;
  color: var(--muted); margin-top: 2px;
}
.rail-item.on {
  background: var(--card); color: var(--primary-deep);
  box-shadow: 0 2px 8px rgba(233,111,60,.10);
}
.rail-item.on::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--primary);
}
.rail-item.on .rail-count { color: var(--primary); }

/* ---------- 菜单页：右栏 ---------- */
.panel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.panel-head {
  padding: 10px 14px 8px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.panel-title { font-size: 15px; font-weight: 700; }
.panel-title small { font-weight: 500; color: var(--muted); font-size: 11.5px; margin-left: 5px; }
.panel-body { flex: 1; overflow-y: auto; padding: 0 14px 120px; -webkit-overflow-scrolling: touch; }
/* 排序说明：点完排序按钮这里会变，让人确认「真的重排了」 */
.sort-hint {
  flex: 1 0 100%; font-size: 11px; color: var(--muted); padding-left: 1px;
}
.sort-hint b { color: var(--primary-deep); font-weight: 700; }

.seg {
  display: inline-flex; background: #F6EEE5; border-radius: 10px; padding: 2px; gap: 2px;
}
.seg button {
  padding: 5px 9px; font-size: 11.5px; border-radius: 8px; color: var(--muted); white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.06); }

/* 筛选条：换成「自动换行」，7 个分类永远全部露出来，
   不再需要横向滑动（原来一行放不下、超出部分被裁掉，手机上很难滑） */
.catbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 2px 0 8px;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.cat-chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; white-space: nowrap;
  background: #F6EEE5; color: var(--ink-2); font-weight: 500;
}
.cat-chip.on { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(233,111,60,.28); }

/* ---------- 待学卡片 ---------- */
/* 序号：排序变了，序号也跟着变，一眼能看出顺序换了 */
.learn-ord {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 6px;
  background: #F6EEE5; color: var(--muted);
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
  font-variant-numeric: tabular-nums; margin-top: 2px;
}
.learn-card:nth-child(1) .learn-ord { background: var(--primary); color: #fff; }
.learn-card {
  background: var(--card); border-radius: var(--r);
  padding: 13px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(242, 227, 214, .9);
}
.learn-top { display: flex; align-items: flex-start; gap: 8px; }
.learn-name { font-size: 15.5px; font-weight: 700; flex: 1; min-width: 0; line-height: 1.35; }
.tag-cat {
  font-size: 10.5px; padding: 2px 7px; border-radius: 6px;
  background: var(--primary-soft); color: var(--primary-deep); flex: 0 0 auto;
}
.learn-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.learn-meta .m { display: inline-flex; align-items: center; gap: 3px; }
.learn-meta .due-soon { color: var(--primary-deep); font-weight: 600; }
.learn-steps {
  margin-top: 9px; padding: 9px 10px; background: #FFFBF6; border-radius: 10px;
  font-size: 12.5px; color: var(--ink-2); line-height: 1.65;
  border-left: 3px solid var(--primary-soft);
}
.learn-steps .si { color: var(--muted); margin-right: 4px; font-variant-numeric: tabular-nums; }
.learn-link {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
  font-size: 12px; color: #3C7C9C; text-decoration: none;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.learn-actions { display: flex; gap: 8px; margin-top: 11px; }
.btn {
  padding: 7px 13px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  background: #F6EEE5; color: var(--ink-2); white-space: nowrap;
}
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(233,111,60,.26); }
.btn.ghost { background: #fff; border: 1px solid var(--line); }
.btn.learned { background: var(--accent-soft); color: #4F6B4F; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; }

.urg { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; flex: 0 0 auto; }
.urg.high { background: #FFE1D4; color: #B4441A; }
.urg.normal { background: #FFF3D9; color: #9A6B12; }
.urg.low { background: #EFEFEA; color: #7A8570; }

.empty {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 48px 20px; line-height: 1.9;
}
.empty .big { font-size: 34px; display: block; margin-bottom: 6px; opacity: .55; }

/* ---------- 可点单卡片 ---------- */
.dish-grid { display: flex; flex-direction: column; gap: 9px; }
.dish-row {
  background: var(--card); border-radius: 15px; padding: 12px 12px 12px 13px;
  display: flex; align-items: center; gap: 11px;
  box-shadow: 0 4px 14px rgba(233,111,60,.07);
  border: 1px solid rgba(242,227,214,.9);
  transition: transform .12s, border-color .15s;
}
.dish-row:active { transform: scale(.985); }
.dish-row.picked { border-color: var(--primary); background: #FFFCF8; }
/* 左边（表情 + 菜名 + 明细摘要）是「看明细 / 改明细」的可点击区；
   右边圆圈是独立的「选中点单」按钮，两者互不干扰 */
.dish-tap {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 11px;
}
.dish-tap:active { opacity: .75; }
.dish-emoji {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px;
  background: var(--bg-2); display: grid; place-items: center; font-size: 21px;
}
.dish-info { flex: 1; min-width: 0; }
.dish-name { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.badge-new {
  font-size: 9.5px; padding: 1px 5px; border-radius: 5px;
  background: var(--accent-soft); color: #4F6B4F; font-weight: 600; flex: 0 0 auto;
}
.dish-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.dish-more {
  font-size: 11px; color: var(--ink-2); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dish-more .dots { color: var(--muted); }
.check {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  border: 1.8px solid #E2D2C2; display: grid; place-items: center;
  color: transparent; font-size: 13px; font-weight: 700;
  padding: 0; background: none; line-height: 1;
}
.check:active { transform: scale(.9); }
.dish-row.picked .check { background: var(--primary); border-color: var(--primary); color: #fff; }
/* 说明这一栏怎么点：左边看明细，右边选点单 */
.tap-hint {
  font-size: 10.5px; color: var(--muted);
  padding: 1px 2px 8px; line-height: 1.5;
}

/* 底部合并点单条 */
.pickbar {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(140%);
  bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
  width: min(456px, calc(100% - 28px));
  background: var(--ink); color: #fff; border-radius: 16px;
  padding: 11px 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 10px 30px rgba(74,55,40,.35); z-index: 40;
  transition: transform .26s cubic-bezier(.2,.9,.2,1);
}
.pickbar.show { transform: translateX(-50%) translateY(0); }
.pickbar .pb-txt { font-size: 13px; flex: 1; }
.pickbar .pb-txt b { color: #FFC8A8; font-size: 15px; }
.pickbar .pb-go {
  background: var(--primary); color: #fff; padding: 9px 16px; border-radius: 11px;
  font-size: 13.5px; font-weight: 700; white-space: nowrap;
}
.pickbar .pb-clear { font-size: 12px; color: #C8B6A6; padding: 4px; }

/* ---------- 已点页 ---------- */
.day-group { margin-bottom: 14px; }
.day-head {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 2px 8px;
  position: sticky; top: 0; background: var(--bg); z-index: 4;
}
.day-head .d1 { font-size: 14px; font-weight: 700; }
.day-head .d2 { font-size: 11.5px; color: var(--muted); }
.meal-block {
  background: var(--card); border-radius: var(--r); margin-bottom: 9px;
  box-shadow: var(--shadow); overflow: hidden;
  border: 1px solid rgba(242,227,214,.9);
}
.meal-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px 9px; background: #FFFCF8;
  border-bottom: 1px dashed var(--line);
}
.meal-name { font-size: 13.5px; font-weight: 700; }
.meal-name .mi { margin-right: 4px; }
.meal-who { margin-left: auto; display: flex; align-items: center; padding-left: 6px; }
.meal-who .av:first-child { margin-left: 0; }
.av {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; background: var(--primary-soft);
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  color: var(--primary-deep); margin-left: -6px; vertical-align: middle;
  flex: 0 0 auto;
}
.av.sm { width: 19px; height: 19px; font-size: 9px; border-width: 1.5px; }
.meal-body { padding: 4px 13px 11px; }
.oitem {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 0; border-bottom: 1px solid #FBF3EA;
}
.oitem:last-child { border-bottom: 0; }
.oitem .on1 { font-size: 14px; font-weight: 600; }
.oitem .owho { font-size: 11px; color: var(--muted); margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.oitem .onote { font-size: 11px; color: var(--muted); }
.meal-foot { padding: 0 13px 12px; display: flex; gap: 8px; align-items: center; }
.meal-foot .hint { font-size: 11px; color: var(--muted); flex: 1; }

.done-card {
  background: var(--card); border-radius: 15px; padding: 10px 12px;
  display: flex; gap: 10px; align-items: center; margin-bottom: 8px;
  border: 1px solid rgba(242,227,214,.9);
}
.done-photo {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 12px; object-fit: cover;
  background: var(--bg-2); display: grid; place-items: center; font-size: 11px; color: var(--muted);
  text-align: center; line-height: 1.2;
}
.done-photo.add { border: 1.5px dashed #DCC9B8; color: var(--primary); font-size: 19px; }
.done-sub { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.done-sub .av { margin-left: 0; }
.done-sub .dn { white-space: nowrap; }
.done-sub .dnote { color: var(--ink-2); }

/* ---------- 我的页 ---------- */
.profile {
  background: linear-gradient(135deg, #FFE9D8 0%, #FFF6EC 60%, #F3F7EE 100%);
  border-radius: 22px; padding: 16px; margin: 6px 0 14px;
  display: flex; align-items: center; gap: 13px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.profile::after {
  content: ""; position: absolute; right: -26px; top: -26px;
  width: 92px; height: 92px; border-radius: 50%; background: rgba(255,255,255,.5);
}
.profile .pav {
  width: 58px; height: 58px; border-radius: 50%; flex: 0 0 58px;
  background: #fff; display: grid; place-items: center;
  font-size: 21px; font-weight: 700; color: var(--primary-deep);
  box-shadow: 0 4px 12px rgba(233,111,60,.20); overflow: hidden;
  object-fit: cover; position: relative; z-index: 1;
}
.profile .pinfo { flex: 1; min-width: 0; position: relative; z-index: 1; }
.profile .pname { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.profile .pdesc { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; opacity: .85; }
.profile .pedit {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  background: rgba(255,255,255,.85); color: var(--primary-deep);
  font-weight: 600; flex: 0 0 auto; position: relative; z-index: 2;
}

.stat2 { display: flex; gap: 10px; margin-bottom: 14px; }
.stat-card {
  flex: 1; background: var(--card); border-radius: var(--r); padding: 14px;
  box-shadow: var(--shadow); border: 1px solid rgba(242,227,214,.9);
  position: relative;
}
.stat-card.tapable:active { transform: scale(.98); }
.stat-num {
  font-size: 30px; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--primary);
}
.stat-card.eaten .stat-num { color: var(--accent); }
.stat-lab { font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.stat-hint { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.stat-arrow { position: absolute; right: 12px; top: 12px; font-size: 11px; color: var(--muted); }

.section { margin-bottom: 16px; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; padding: 0 2px; }
.sec-title { font-size: 14px; font-weight: 700; }
.sec-sub { font-size: 11px; color: var(--muted); margin-left: auto; }

.mstat {
  background: var(--card); border-radius: var(--r); padding: 13px;
  box-shadow: var(--shadow); border: 1px solid rgba(242,227,214,.9);
}
.mstat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mstat-cell { text-align: center; background: #FFFDFA; border-radius: 11px; padding: 9px 4px; }
.mstat-cell .n { font-size: 20px; font-weight: 800; color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.mstat-cell .l { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.mstat-note { margin-top: 10px; font-size: 12px; color: var(--ink-2); background: #FFFBF6; padding: 8px 10px; border-radius: 10px; }
.mstat-note b { color: var(--primary-deep); }

.top5 { display: flex; flex-direction: column; gap: 9px; }
.t5row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.t5rank {
  width: 19px; height: 19px; flex: 0 0 19px; border-radius: 6px;
  background: #F6EEE5; color: var(--muted); font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
}
.t5row:nth-child(1) .t5rank { background: var(--primary); color: #fff; }
.t5name { flex: 0 0 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.t5barwrap { flex: 1; height: 7px; background: #F6EEE5; border-radius: 4px; overflow: hidden; }
.t5bar { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #FFB98E, var(--primary)); }
.t5n { flex: 0 0 30px; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 「已经吃了」明细 ---------- */
.eaten-sum {
  font-size: 12px; color: var(--ink-2); margin-bottom: 10px;
  background: #FFFBF6; padding: 8px 10px; border-radius: 10px;
}
.eaten-sum b { color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.eaten-list { display: flex; flex-direction: column; gap: 8px; }
.eaten-item {
  background: var(--card); border-radius: 13px;
  border: 1px solid rgba(242,227,214,.9); overflow: hidden;
}
.eaten-row {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px; width: 100%; text-align: left;
}
.eaten-row:active { background: #FFFCF8; }
.eaten-name {
  flex: 0 1 auto; min-width: 0; font-size: 13px; font-weight: 650;
  display: inline-flex; align-items: center; gap: 4px;
  overflow: hidden; white-space: nowrap;
}
.eaten-name .nm { overflow: hidden; text-overflow: ellipsis; }
.eaten-cat {
  font-size: 9.5px; padding: 1px 5px; border-radius: 5px;
  background: var(--primary-soft); color: var(--primary-deep); font-weight: 500;
  flex: 0 0 auto;
}
.eaten-barwrap { flex: 1 1 40px; min-width: 40px; height: 7px; background: #F6EEE5; border-radius: 4px; overflow: hidden; }
.eaten-bar { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #A7C4A2, var(--accent)); }
.eaten-n {
  flex: 0 0 38px; text-align: right; font-size: 11.5px; font-weight: 700;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.eaten-arrow { flex: 0 0 14px; font-size: 10px; color: var(--muted); text-align: right; }
.eaten-detail { display: none; padding: 0 12px 12px; }
.eaten-item.open .eaten-detail { display: block; }
.eaten-item.open .eaten-row { padding-bottom: 8px; }
.eaten-detail .learn-steps { margin-top: 0; }
.eaten-detail .learn-link { margin: 0 0 7px; }
.eaten-none { font-size: 11.5px; color: var(--muted); padding: 2px 0 4px; }
.eaten-times { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.et-line {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-2);
  padding: 5px 8px; background: #FFFBF6; border-radius: 8px;
}
.et-date { font-weight: 650; font-variant-numeric: tabular-nums; }
.et-meal { color: var(--muted); }
.et-who { color: var(--muted); }
.et-note { color: var(--primary-deep); flex: 1 0 100%; font-size: 10.5px; }

/* ---------- 底栏 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(480px, 100%);
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 252, 248, .94);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  display: flex; z-index: 50;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; color: var(--muted); font-weight: 600;
}
.tab .tiwrap { position: relative; display: inline-flex; }
.tab .ti { font-size: 19px; line-height: 1; filter: grayscale(.6); opacity: .7; }
.tab.on { color: var(--primary-deep); }
.tab.on .ti { filter: none; opacity: 1; transform: translateY(-1px); }
.tab .tdot {
  position: absolute; top: -4px; left: 12px;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 9.5px;
  display: grid; place-items: center; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 1.5px #FFFCF8;
}

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(60, 40, 28, .38);
  z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(2px);
}
.mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%) translateY(102%);
  width: min(480px, 100%); max-height: 90vh;
  background: var(--bg); border-radius: 24px 24px 0 0;
  z-index: 90; display: flex; flex-direction: column;
  transition: transform .3s cubic-bezier(.2,.9,.2,1);
  box-shadow: 0 -8px 40px rgba(90,60,40,.18);
}
.sheet.show { transform: translateX(-50%) translateY(0); }
.sheet-head {
  padding: 14px 18px 10px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.sheet-head .st { font-size: 16px; font-weight: 700; }
.sheet-head .sx { margin-left: auto; font-size: 20px; color: var(--muted); padding: 0 4px; line-height: 1; }
.sheet-body { padding: 14px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  padding: 12px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--line);
  display: flex; gap: 10px; flex: 0 0 auto; background: var(--bg);
}
.sheet-foot .btn { flex: 1; padding: 12px; text-align: center; font-size: 14px; border-radius: 13px; }
.grab { width: 38px; height: 4px; border-radius: 3px; background: #E9D8C8; margin: 8px auto 0; }

.field { margin-bottom: 13px; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field > label .req { color: var(--primary); }
.inp, .ta, .sel {
  width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-size: 16px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.inp:focus, .ta:focus, .sel:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(233,111,60,.10); }
.ta { min-height: 92px; resize: vertical; line-height: 1.6; }
.sel { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%239C8878' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.hintline { font-size: 11px; color: var(--muted); margin-top: 5px; }
/* 从「可点单」点开明细时的一句说明 */
.from-note {
  font-size: 11.5px; color: var(--ink-2); line-height: 1.6;
  background: #FFFBF6; border-left: 3px solid var(--primary-soft);
  padding: 8px 10px; border-radius: 9px; margin-bottom: 12px;
}
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

.opt-row { display: flex; gap: 7px; flex-wrap: wrap; }
.opt {
  padding: 8px 12px; border-radius: 10px; background: #fff;
  border: 1px solid var(--line); font-size: 13px; color: var(--ink-2);
}
.opt.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }

.steps-edit .step-line { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.steps-edit .si-n { font-size: 11px; color: var(--muted); flex: 0 0 14px; }
.steps-edit .si-del { color: #C99; font-size: 16px; flex: 0 0 auto; padding: 0 2px; }
.add-step { font-size: 12.5px; color: var(--primary-deep); font-weight: 600; padding: 4px 0; }

.avatar-pick { display: flex; align-items: center; gap: 13px; }
.avatar-pick .pa {
  width: 68px; height: 68px; border-radius: 50%; background: #fff; flex: 0 0 68px;
  display: grid; place-items: center; font-size: 24px; font-weight: 700; color: var(--primary-deep);
  border: 2px dashed #E4D2C0; overflow: hidden; object-fit: cover;
}

/* 选择器 / 单点列表 */
.pick-list { display: flex; flex-direction: column; gap: 7px; }
.pick-line {
  display: flex; align-items: center; gap: 9px; background: #fff;
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; font-size: 13.5px;
}
.pick-line .emo { font-size: 16px; }
.pick-line .rm { margin-left: auto; color: var(--muted); font-size: 12px; padding: 2px 4px; }
.meal-pick, .date-pick { display: flex; gap: 7px; flex-wrap: wrap; }

.photo-drop {
  border: 1.5px dashed #E4D2C0; border-radius: 13px; padding: 18px;
  text-align: center; color: var(--muted); font-size: 12.5px; background: #FFFCF8;
}
.photo-drop img { max-height: 190px; border-radius: 10px; margin: 0 auto 8px; }
.photo-drop.has { border-style: solid; border-color: var(--line); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--tab-h) + var(--safe-b) + 26px);
  background: rgba(74,55,40,.94); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 13px; z-index: 120; opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none; white-space: nowrap;
  max-width: 86vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 首次绑定页 */
.welcome { padding: 34px 22px; display: flex; flex-direction: column; gap: 16px; }
.welcome .wlogo {
  width: 84px; height: 84px; border-radius: 24px; margin: 0 auto;
  box-shadow: 0 10px 26px rgba(233,111,60,.22);
}
.welcome h1 { font-size: 22px; text-align: center; margin: 4px 0 0; }
.welcome .wsub { text-align: center; font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0; }
.wcard { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.wfoot { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.8; }

.footer-note {
  text-align: center; font-size: 10.5px; color: #C3B3A4;
  padding: 6px 0 10px; letter-spacing: .4px;
}

/* 顶部版本 / 设置 */
.appfoot { padding: 4px 14px 0; }
.settings-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 0;
  border-bottom: 1px solid #FBF3EA; font-size: 13.5px;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row .sr-l { flex: 1; }
.settings-row .sr-r { color: var(--muted); font-size: 12.5px; }
