/* 家庭资产 · 深绿主题（区分账本蓝/花园绿） */
:root {
  --pri: #1D9E75;
  --pri-d: #0F6E56;
  --pri-l: #E1F5EE;
  --ink: #1F2A26;
  --sub: #6B7A72;
  --line: #DDE6E0;
  --bg: #F1EFE8;
  --card: #FFFFFF;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --red: #A32D2D; --red-l: #FCEBEB;
  --amber: #854F0B; --amber-l: #FAEEDA;
  --green: #3B6D11; --green-l: #EAF3DE;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
.hidden { display: none !important; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.brand img { width: 24px; height: 24px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); }

.view { max-width: 520px; margin: 0 auto; padding: 0 14px 90px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; border: 0; background: none; padding: 10px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--sub); cursor: pointer; }
.tab.active { color: var(--pri); }
.tab-icon { font-size: 20px; }
.tab-label { font-size: 11px; }

.card { background: var(--card); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 12px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-title-row h3 { margin-bottom: 0; }
.s { font-size: 12px; color: var(--sub); }
.hint { font-size: 12px; color: var(--sub); margin-top: 8px; line-height: 1.6; }
.empty { color: var(--sub); font-size: 13px; padding: 18px 0; text-align: center; }
.loading { color: var(--sub); text-align: center; padding: 24px 0; font-size: 13px; }
.error { color: var(--red); text-align: center; padding: 24px 0; }
.error p { margin-bottom: 10px; }

.item-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-row .name { flex: 1; min-width: 0; }
.item-row .name > div:first-child { font-weight: 600; }
.item-row .ops { display: flex; gap: 6px; flex-shrink: 0; }

.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--r-sm); padding: 8px 14px; font-size: 14px; cursor: pointer; }
.btn:active { opacity: .85; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--red-l); border-color: transparent; color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { display: block; width: 100%; margin-top: 10px; }

/* 物资/资产条目 */
.asset-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 8px; }
.ai-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.ai-body { flex: 1; min-width: 0; }
.ai-title { font-weight: 600; font-size: 14px; }
.ai-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }
.ai-ops { display: flex; gap: 6px; flex-shrink: 0; }
.ai-ops .qty-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 15px; cursor: pointer; }

/* 状态徽章 */
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.badge.expired { background: var(--red-l); color: var(--red); }
.badge.expiring { background: var(--amber-l); color: var(--amber); }
.badge.low { background: var(--red-l); color: var(--red); }
.badge.ok { background: var(--green-l); color: var(--green); }
.badge.long { background: #EEEDFE; color: #534AB7; }

/* 汇总条 */
.stat-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stat-chip { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; text-align: center; }
.stat-chip .n { font-size: 17px; font-weight: 700; }
.stat-chip .l { font-size: 11px; color: var(--sub); }
.stat-chip.danger .n { color: var(--red); }
.stat-chip.warn .n { color: var(--amber); }
.stat-chip.ok .n { color: var(--green); }

/* 表单 */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--sub); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; font-size: 14px; background: var(--card); color: var(--ink); }
.field textarea { resize: vertical; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field-row .field { flex-wrap: wrap; }

/* 弹层 */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-end; justify-content: center; background: rgba(20, 30, 26, .45); }
.modal.show { display: flex; }
.modal-card { background: var(--card); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px 18px 24px; }
.modal-card h3 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* toast */
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 88vw; }
.toast.show { opacity: 1; }
.toast.success { background: var(--pri-d); }
.toast.error { background: var(--red); }
