/* ===== 家庭系统样式（移动端优先） ===== */
:root {
  --primary: #52B99C;
  --primary-dark: #3E9C81;
  --primary-soft: #E8F5F0;
  --bg: #F6F8F7;
  --card: #FFFFFF;
  --text: #2C3E50;
  --muted: #8E9EAB;
  --danger: #E36C5B;
  --warn: #E8A23D;
  --ok: #52B99C;
  --border: #E3EBE7;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(44, 62, 80, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 侧边栏（桌面常驻 / 手机抽屉） ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 224px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 120;
}
.side-brand {
  display: block;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  padding: 18px 18px 14px;
}
.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.side-link:hover { background: var(--primary-soft); color: var(--primary-dark); }
.side-link.active { background: var(--primary); color: #fff; font-weight: 600; }
.side-ico { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.side-foot {
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .grow { flex: 1; min-width: 0; }
.side-user-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-sub { font-size: 11px; color: var(--muted); }
.avatar-sm { width: 32px !important; height: 32px !important; font-size: 13px !important; }
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.4);
  z-index: 110;
  display: none;
}

/* ===== 顶栏（手机端） ===== */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hamburger {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  padding: 2px 6px;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; white-space: nowrap; }
.topbar-family { margin-left: auto; }
.family-badge {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.family-switcher {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--card);
}
.btn-link {
  background: none; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 4px 6px;
}
.btn-link:hover { color: var(--danger); }

/* ===== 手机底部 Tab ===== */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(44, 62, 80, 0.08);
  padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.tab-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 4px 2px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}
.tab-ico { font-size: 21px; line-height: 1; }
.tab-link.active { color: var(--primary-dark); font-weight: 600; }
.tab-link.active .tab-ico { transform: scale(1.12); }

/* 容器 */
.container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
}
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 16px;
}

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* 统计网格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--primary-dark); }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(82, 185, 156, 0.15);
}
textarea { resize: vertical; min-height: 90px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, background .15s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--card); color: var(--primary-dark); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 4px; font-family: inherit; }
.btn-link-danger:hover { text-decoration: underline; }

/* 提示 */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: #FDECEA; color: #B3432F; }
.alert-ok { background: var(--primary-soft); color: var(--primary-dark); }
.alert-warn { background: #FDF3E3; color: #9C6B14; }
.muted { color: var(--muted); font-size: 13px; }

/* Tab 切换 */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  font-size: 15px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* 列表 */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-size: 15px; font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 邀请码展示 */
.invite-code {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 32px;
  letter-spacing: 8px;
  text-align: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 12px;
  padding: 16px;
  font-weight: 700;
  user-select: all;
}

/* 成员头像 */
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.role-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.role-tag.owner { background: #FDF3E3; color: #9C6B14; }

/* ===== 响应式 ===== */
/* 手机/平板（≤900px）：侧边栏变抽屉，底部 Tab 出现 */
@media (max-width: 900px) {
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .sidebar {
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  body.sidebar-open .sidebar {
    transform: none;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
  }
  body.sidebar-open .sidebar-mask { display: block; }
  .tabbar { display: flex; }
  .topbar { position: static; }
  .footer { padding-bottom: 8px; }
  /* 手机端统计卡片紧凑化 */
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 10px 4px; }
  .stat-card .num { font-size: 20px; }
  .stat-card .label { font-size: 11px; }
}
/* 桌面（>900px）：侧边栏常驻，顶栏隐藏 */
@media (min-width: 901px) {
  body { padding-left: 224px; }
  .topbar, .sidebar-mask { display: none; }
}

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(44, 62, 80, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 999;
  display: none;
  max-width: 86vw;
}
#toast.show { display: block; animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.45);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card);
  width: 100%;
  max-width: 520px;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh;
  overflow-y: auto;
  animation: modalUp .2s ease;
}
@keyframes modalUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 17px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal .modal-close { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; padding: 2px 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
@media (min-width: 901px) {
  .modal-mask { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; }
}

/* ===== 树形（收纳空间） ===== */
.tree-node { border-radius: 12px; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
}
.tree-row:hover { background: var(--primary-soft); }
.tree-row .tree-ico { font-size: 20px; width: 26px; text-align: center; flex-shrink: 0; }
.tree-row .tree-name { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .tree-count {
  font-size: 12px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px 10px;
  flex-shrink: 0;
}
.tree-row .tree-count.empty { color: var(--muted); background: var(--bg); }
.tree-row .tree-actions { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 8px;
  color: var(--muted);
}
.icon-btn:hover { background: var(--bg); }
.icon-btn.danger:hover { color: var(--danger); }
.tree-children { margin-left: 26px; padding-left: 12px; border-left: 2px dashed var(--border); }

/* ===== 筛选条 ===== */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ===== 库存条目 ===== */
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.item-row .item-ico { font-size: 22px; width: 34px; text-align: center; flex-shrink: 0; }
.item-row .grow { flex: 1; min-width: 0; }
.item-row .item-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row .item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.qty-badge {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 5px 12px;
  flex-shrink: 0;
  white-space: nowrap;
}
.qty-badge.low { background: #FDECEA; color: var(--danger); }
.empty-tip { text-align: center; color: var(--muted); padding: 36px 0; font-size: 14px; }
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(82, 185, 156, 0.45);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fab:active { transform: scale(0.95); }
@media (min-width: 901px) { .fab { display: none; } }

/* ===== 菜单页（美团外卖式：左分类右条目） ===== */
.mt-layout { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.mt-cats {
  width: 92px;
  flex-shrink: 0;
  background: var(--bg);
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.mt-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 13px 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  font-size: 13px;
  border-left: 3px solid transparent;
}
.mt-cat.active { background: var(--card); color: var(--primary-dark); font-weight: 700; border-left-color: var(--primary); }
.mt-cat-n { font-size: 11px; color: var(--muted); font-weight: 400; }
.mt-list { flex: 1; background: var(--card); padding: 4px 10px; max-height: 60vh; overflow-y: auto; min-width: 0; }
.mt-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px dashed var(--border);
}
.mt-entry:last-child { border-bottom: none; }
.mt-entry.gone { opacity: .55; }
.mt-entry .grow { flex: 1; min-width: 0; }
.mt-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-status { font-size: 12px; margin-top: 2px; }
.mt-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.tag-recipe, .tag-item {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  vertical-align: 1px;
  font-weight: 400;
}
.tag-recipe { background: var(--primary-soft); color: var(--primary-dark); }
.tag-item { background: #FDF3E3; color: #9C6B14; }
.dot-ok { color: var(--ok); }
.dot-bad { color: var(--danger); }
.btn-add {
  border: none;
  background: var(--primary);
  color: #fff;
  min-width: 34px;
  height: 30px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 10px;
  font-family: inherit;
}
.btn-add.added { background: var(--primary-dark); }
.btn-add:active { transform: scale(.94); }

/* 分段选择（食谱/物品切换） */
.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  font-family: inherit;
}
.seg-btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 700; }
.seg-btn:disabled { opacity: .7; cursor: not-allowed; }

/* 购物车条 */
.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(62px + env(safe-area-inset-bottom));
  z-index: 95;
  display: flex;
  gap: 10px;
  padding: 8px 14px;
  background: transparent;
  pointer-events: none;
}
.cart-bar > * { pointer-events: auto; }
@media (min-width: 901px) {
  .cart-bar { bottom: 24px; max-width: 1032px; margin: 0 0 0 24px; }
}
.cart-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.cart-row .grow { flex: 1; font-size: 14px; font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  background: var(--card);
  color: var(--primary-dark);
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
}
.stepper b { min-width: 18px; text-align: center; font-size: 15px; }
.radio-row { display: flex; align-items: center; gap: 8px; padding: 8px 4px; font-size: 14px; border-bottom: 1px dashed var(--border); }
.radio-row:last-child { border-bottom: none; }

/* ===== 点餐单卡片 ===== */
.order-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--card);
}
.order-card.done { opacity: .65; }
.order-head { display: flex; align-items: flex-start; gap: 8px; }
.order-route { font-size: 14px; }
.order-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.order-badge { font-size: 11px; padding: 2px 10px; border-radius: 999px; flex-shrink: 0; }
.order-badge.pending { background: #FDF3E3; color: #9C6B14; }
.order-badge.done { background: var(--primary-soft); color: var(--primary-dark); }
.order-items { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 6px; }
.order-item-line { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.order-item-line b { color: var(--primary-dark); }
.order-note { font-size: 12px; color: var(--muted); margin-top: 6px; background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.order-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

/* ===== 菜单/点餐页：店铺列表（先选菜单） ===== */
.shop-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.shop-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.shop-card:active { background: var(--bg); }
.shop-ico { font-size: 26px; flex-shrink: 0; }
.shop-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-name { font-size: 15px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-meta { font-size: 12px; color: var(--muted); }
.shop-go { color: var(--muted); font-size: 13px; flex-shrink: 0; }

/* ===== 通用确认/输入弹窗（hhConfirm / hhPrompt） ===== */
.hh-dialog { max-width: 420px; }
.hh-dialog .hh-dialog-msg { font-size: 14px; color: var(--text); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.hh-dialog .form-group { margin-top: 4px; }
.hh-dialog .hh-dialog-input { width: 100%; }

/* ===== 通知 / 未读红点 ===== */
.notify-dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  border-radius: 999px;
}
.side-notify { position: relative; }
.side-notify .notify-dot { margin-left: auto; }
.topbar-bell {
  position: relative; flex-shrink: 0;
  text-decoration: none; font-size: 20px; line-height: 1;
  padding: 4px 6px; border-radius: 8px; margin-left: 8px;
}
.topbar-bell .notify-dot { position: absolute; top: -3px; right: -3px; }
.notify-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 8px; border-bottom: 1px solid var(--border);
  cursor: pointer; border-radius: 10px;
  transition: background .15s;
}
.notify-row:last-child { border-bottom: none; }
.notify-row:hover { background: var(--primary-soft); }
.notify-row.read { opacity: .62; }
.notify-ico { font-size: 20px; flex-shrink: 0; line-height: 1.3; }
.notify-title { font-size: 14px; font-weight: 700; color: var(--text); }
.notify-new {
  display: inline-block; font-size: 10px; font-weight: 700;
  background: var(--danger); color: #fff; border-radius: 999px;
  padding: 1px 6px; vertical-align: middle; margin-left: 4px;
}
.notify-body { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.5; word-break: break-word; }
.notify-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notify-go { color: var(--muted); font-size: 18px; flex-shrink: 0; align-self: center; }

/* ===== 库存行内加减 / 盘点 ===== */
.qty-stepper { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
.qty-btn {
  width: 27px; height: 27px; padding: 0; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--card); color: var(--primary-dark);
  font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s;
}
.qty-btn:active { background: var(--primary-soft); }
.qty-btn:disabled { opacity: .4; }
.stocktake-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.stocktake-row:last-child { border-bottom: none; }
.stocktake-row .st-name { flex: 1; min-width: 110px; font-size: 14px; font-weight: 600; }
.stocktake-row .st-book { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stocktake-row input.st-actual {
  width: 84px; padding: 7px 8px; text-align: right;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.stocktake-row .st-diff { font-size: 12px; width: 62px; text-align: right; white-space: nowrap; }
.st-diff.up { color: var(--primary-dark); }
.st-diff.down { color: var(--danger); }

/* ===== 深色模式 ===== */
:root[data-theme="dark"] {
  --primary: #5FCBA9;
  --primary-dark: #8FE0C6;
  --primary-soft: #1C3A33;
  --bg: #101617;
  --card: #1A2325;
  --text: #E7EFEC;
  --muted: #92A5A0;
  --danger: #E88474;
  --warn: #E0A94F;
  --ok: #5FCBA9;
  --border: #2A3638;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #5FCBA9;
    --primary-dark: #8FE0C6;
    --primary-soft: #1C3A33;
    --bg: #101617;
    --card: #1A2325;
    --text: #E7EFEC;
    --muted: #92A5A0;
    --danger: #E88474;
    --warn: #E0A94F;
    --ok: #5FCBA9;
    --border: #2A3638;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea { color-scheme: dark; }
:root[data-theme="dark"] .side-link.active,
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .tab-btn.active,
:root[data-theme="dark"] .chip.active { color: #0E1A17; }
:root[data-theme="dark"] .item-row:hover,
:root[data-theme="dark"] .list-item:hover { background: rgba(255, 255, 255, 0.03); }

/* 深色模式切换按钮 */
.theme-toggle {
  width: 100%; text-align: left;
  padding: 8px 10px; margin-bottom: 8px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 10px; color: var(--muted);
  font-size: 13px; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary-dark); }

/* ===== 账本：账户 / 收支 / 分类 ===== */
.stat-card .num.is-expense { color: var(--danger); }
.stat-card .num.is-income { color: var(--primary-dark); }
.stat-card .num { font-variant-numeric: tabular-nums; }

/* 账户横向卡片 */
.acc-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch; }
.acc-card {
  flex: 0 0 148px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.acc-card:hover { border-color: var(--primary); }
.acc-card.active { border-color: var(--primary); background: var(--primary-soft); }
.acc-card .acc-top { display: flex; align-items: center; gap: 6px; }
.acc-card .acc-ico { font-size: 16px; }
.acc-card .acc-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card .acc-bal { font-size: 18px; font-weight: 700; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.acc-card .acc-type { font-size: 11px; color: var(--muted); }
.acc-card.acc-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-style: dashed; color: var(--muted); }
.acc-card.acc-add .acc-plus { font-size: 22px; line-height: 1; }

/* 小号分段切换 */
.mini-seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg); border-radius: 9px; border: 1px solid var(--border); }
.mini-seg button {
  border: none; background: transparent; color: var(--muted);
  font-size: 12px; padding: 4px 10px; border-radius: 7px; cursor: pointer; font-family: inherit;
}
.mini-seg button.active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* 大号收支切换 */
.seg { display: flex; gap: 10px; margin-bottom: 16px; }
.seg button {
  flex: 1; padding: 11px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--card);
  font-size: 15px; font-weight: 600; color: var(--muted);
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.seg button.active[data-type="expense"] { background: var(--danger); border-color: var(--danger); color: #fff; }
.seg button.active[data-type="income"] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 金额输入 */
.amount-row {
  display: flex; align-items: baseline; gap: 8px;
  border-bottom: 1px solid var(--border); margin-bottom: 16px; padding-bottom: 6px;
}
.amount-row .cur { font-size: 22px; color: var(--muted); font-weight: 600; }
.amount-row input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 32px; font-weight: 700; color: var(--text); padding: 2px 0;
  font-variant-numeric: tabular-nums;
}
.amount-row input::placeholder { color: var(--border); }

/* 分类按钮组 */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.cat-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1px solid var(--border); background: var(--card);
  border-radius: 10px; padding: 8px 2px;
  font-size: 12px; color: var(--text); cursor: pointer; font-family: inherit;
  transition: all .12s;
}
.cat-chip .ico { font-size: 17px; line-height: 1.2; }
.cat-chip:hover { border-color: var(--primary); }
.cat-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.cat-grid.is-expense .cat-chip.active { border-color: var(--danger); background: #FDECEA; color: #B3432F; }

/* 明细金额与分类角标 */
.cat-badge {
  font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
  margin-left: 6px; vertical-align: middle; font-weight: 400;
}
.badge-muted {
  font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
  margin-left: 6px; vertical-align: middle; font-weight: 400;
}
.list-item .amt { font-size: 15px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-item .amt.is-expense { color: var(--danger); }
.list-item .amt.is-income { color: var(--primary-dark); }

/* 深色模式适配 */
:root[data-theme="dark"] .seg button.active[data-type="expense"],
:root[data-theme="dark"] .seg button.active[data-type="income"] { color: #0E1A17; }
:root[data-theme="dark"] .cat-grid.is-expense .cat-chip.active { background: rgba(232, 132, 116, 0.16); color: #F0A698; }
:root[data-theme="dark"] .mini-seg button.active { box-shadow: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg button.active[data-type="expense"],
  :root:not([data-theme="light"]) .seg button.active[data-type="income"] { color: #0E1A17; }
  :root:not([data-theme="light"]) .cat-grid.is-expense .cat-chip.active { background: rgba(232, 132, 116, 0.16); color: #F0A698; }
  :root:not([data-theme="light"]) .mini-seg button.active { box-shadow: none; }
}

/* 分类占比（HTML 条，自适应不溢出） */
.cat-list { display: flex; flex-direction: column; gap: 11px; }
.cat-row { display: grid; grid-template-columns: 88px 1fr 100px; align-items: center; gap: 10px; }
.cat-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-track { display: block; height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.cat-fill { display: block; height: 100%; border-radius: 6px; background: var(--danger); transition: width .3s; }
.cat-list.is-income .cat-fill { background: var(--primary); }
.cat-val { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-val em { font-style: normal; display: inline-block; min-width: 30px; margin-left: 4px; opacity: .8; }
@media (max-width: 420px) {
  .cat-row { grid-template-columns: 74px 1fr 92px; gap: 8px; }
  .cat-name { font-size: 12px; }
  .cat-val { font-size: 11px; }
  .cat-val em { display: none; }
}

/* 金额输入去掉原生上下箭头 */
.amount-row input::-webkit-outer-spin-button,
.amount-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-row input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ===== 日历 / 日程 ===== */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 2px 0 12px; }
.cal-month { font-size: 15px; font-weight: 600; min-width: 104px; text-align: center; font-variant-numeric: tabular-nums; }

.cal-stats { display: flex; gap: 8px; margin: 0 auto 12px; max-width: 560px; }
.cal-stat {
  flex: 1; text-align: center; padding: 8px 4px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.cal-stat b { display: block; font-size: 17px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.cal-stat span { font-size: 11px; color: var(--muted); }

.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; max-width: 560px; margin: 0 auto; }
.cal-week div { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0 6px; }

.cal-day {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 54px; padding: 5px 2px 3px;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text);
  font-family: inherit; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.cal-day:hover { background: var(--bg); }
.cal-day .dnum {
  font-size: 13px; line-height: 24px; width: 24px; height: 24px;
  text-align: center; border-radius: 50%; font-variant-numeric: tabular-nums;
}
.cal-day.other { color: var(--muted); opacity: .45; }
.cal-day.today .dnum { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.sel { border-color: var(--primary); background: var(--primary-soft); }
.cal-day.sel .dnum { color: var(--primary-dark); font-weight: 700; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; align-items: center; min-height: 5px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; display: block; }
.cal-more { font-size: 9px; line-height: 1; color: var(--muted); }

/* 当天日程列表 */
.ev-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.ev-item:last-child { border-bottom: none; padding-bottom: 0; }
.ev-time {
  flex: 0 0 50px; font-size: 12px; color: var(--muted); padding-top: 2px;
  font-variant-numeric: tabular-nums; line-height: 1.5;
}
.ev-time i { display: block; font-style: normal; opacity: .7; }
.ev-time.all-day { color: var(--primary-dark); font-weight: 600; }
.ev-main { flex: 1; min-width: 0; }
.ev-title { font-size: 14px; font-weight: 600; word-break: break-word; line-height: 1.45; }
.ev-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; font-size: 11px; color: var(--muted); }
.ev-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 11px; white-space: nowrap;
}
.ev-people { font-size: 11px; color: var(--muted); }
.ev-note { margin-top: 6px; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.ev-acts { display: flex; align-items: flex-start; gap: 2px; flex: 0 0 auto; }
.ev-act {
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 4px 5px; border-radius: 7px;
  cursor: pointer; font-family: inherit;
}
.ev-act:hover { background: var(--bg); }
.ev-act[data-act="del"]:hover { color: var(--danger); }

/* 日程弹窗 */
.ev-date-row { display: flex; align-items: center; gap: 8px; }
.ev-date-row input { flex: 1; min-width: 0; }
.ev-tip { font-size: 12px; color: var(--muted); margin-top: 5px; }
.ev-check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin-bottom: 0; }
.ev-check-row input { width: auto; }

.member-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text);
  font-size: 12px; font-family: inherit; cursor: pointer;
  transition: all .12s;
}
.member-chip:hover { border-color: var(--primary); }
.member-chip .avatar { width: 20px; height: 20px; font-size: 11px; flex: 0 0 20px; }
.member-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

/* 深色模式：浅色底上的强调色 */
:root[data-theme="dark"] .cal-day.today .dnum { color: #0E1A17; }
:root[data-theme="dark"] .member-chip.active { color: var(--primary-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cal-day.today .dnum { color: #0E1A17; }
}
@media (max-width: 400px) {
  .cal-day { min-height: 50px; }
  .cal-dots { gap: 1.5px; }
  .ev-time { flex-basis: 44px; font-size: 11px; }
}
