/* ============================================================
 * style.css — 女装店记账 · 手机 App 风格
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #faf7f8; color: #333;
  overscroll-behavior-y: none;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; color: #333; }
input:focus, select:focus, textarea:focus { outline: none; }
a { color: inherit; text-decoration: none; }

/* ---------- 整体布局 ---------- */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; }
#topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: rgba(255, 247, 249, 0.96); backdrop-filter: blur(8px);
  border-bottom: 1px solid #f3e3e8;
}
#topbar-title { font-size: 17px; font-weight: 700; color: #b23a5e; letter-spacing: 1px; }
#topbar-left, #topbar-right { min-width: 64px; font-size: 14px; color: #b23a5e; }
#topbar-right { text-align: right; }
#topbar-left { text-align: left; }

#view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.page { padding: 14px 14px 8px; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 底部标签栏 ---------- */
#tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 60;
  width: 100%; max-width: 560px;
  display: flex; background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(10px);
  border-top: 1px solid #f0e4e8;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(178, 58, 94, 0.06);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; font-size: 11px; color: #9b8a90;
}
.tab-ic { font-size: 21px; line-height: 1; }
.tab.active { color: #d1476f; font-weight: 600; }

/* ---------- 悬浮加号 ---------- */
#fab {
  position: fixed; right: max(18px, calc((100% - 560px)/2 + 18px)); bottom: calc(84px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #e0567a, #c93a61);
  color: #fff; font-size: 26px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(201, 58, 97, 0.4);
  z-index: 55; transition: transform .12s;
}
#fab:active { transform: scale(0.92); }

/* ---------- 通用卡片 ---------- */
.card {
  background: #fff; border-radius: 14px; padding: 14px;
  margin-bottom: 12px; box-shadow: 0 1px 6px rgba(178, 58, 94, 0.06);
}
.card-title { font-size: 14px; font-weight: 700; color: #555; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title .link { font-size: 12px; color: #d1476f; font-weight: 500; }

/* 首页摘要 */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-card { background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 6px rgba(178,58,94,.06); }
.summary-card .lb { font-size: 12px; color: #9b8a90; margin-bottom: 4px; }
.summary-card .val { font-size: 20px; font-weight: 800; }
.summary-card .sub { font-size: 11px; color: #b9a6ac; margin-top: 2px; }
.summary-card.income .val { color: #2fa86b; }
.summary-card.expense .val { color: #e25c3a; }
.summary-card.profit .val { color: #d1476f; }
.summary-card.gross .val { color: #8e5fd0; }
.hero {
  background: linear-gradient(135deg, #f78fae, #e0567a);
  color: #fff; border-radius: 16px; padding: 18px 16px; margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(224, 86, 122, 0.28);
  display: flex; justify-content: space-between; align-items: flex-end;
}
.hero .date { font-size: 13px; opacity: .9; }
.hero .big { font-size: 26px; font-weight: 800; margin-top: 4px; }
.hero .sm { font-size: 12px; opacity: .92; margin-top: 3px; }

/* ---------- 流水列表 ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 12px; padding: 11px 12px; margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(178,58,94,.05);
}
.list-item .ic {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: #fdf0f4;
}
.list-item .mid { flex: 1; min-width: 0; }
.list-item .mid .t1 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .mid .t2 { font-size: 12px; color: #9b8a90; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .amt { text-align: right; flex: none; }
.list-item .amt .money { font-size: 15px; font-weight: 800; }
.list-item .amt .tag { font-size: 11px; color: #b9a6ac; margin-top: 2px; }
.income .money { color: #2fa86b; }
.expense .money { color: #e25c3a; }
.empty { text-align: center; color: #b9a6ac; padding: 40px 0; font-size: 14px; }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* 日期分组标题 */
.day-group { font-size: 12px; color: #9b8a90; margin: 14px 0 8px; padding-left: 4px; font-weight: 600; }

/* ---------- 商品 / 客户 ---------- */
.p-card { display: flex; align-items: center; gap: 12px; }
.p-card .p-ic { width: 44px; height: 44px; border-radius: 12px; background: #fdf0f4; display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.p-card .p-info { flex: 1; min-width: 0; }
.p-card .p-info .n { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-card .p-info .d { font-size: 12px; color: #9b8a90; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-card .p-right { text-align: right; flex: none; }
.p-card .p-right .stock { font-size: 13px; font-weight: 700; color: #2fa86b; }
.p-card .p-right .stock.low { color: #e25c3a; }
.p-card .p-right .price { font-size: 12px; color: #d1476f; margin-top: 2px; }
.badge { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 8px; margin-left: 6px; vertical-align: 1px; }
.badge.low { background: #fdeaea; color: #e25c3a; }
.badge.ok { background: #e8f8ef; color: #2fa86b; }
.tag-chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px; margin: 2px 4px 0 0; }

/* ---------- 筛选标签 ---------- */
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
.chip { flex: none; font-size: 13px; padding: 6px 14px; border-radius: 16px; background: #fff; color: #8a757c; box-shadow: 0 1px 3px rgba(178,58,94,.08); }
.chip.active { background: #d1476f; color: #fff; font-weight: 600; }

/* ---------- 表单 ---------- */
.form { padding: 4px 0; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #9b8a90; margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid #f0e2e7; border-radius: 12px;
  padding: 12px 14px; background: #fff; -webkit-appearance: none; appearance: none;
}
.field textarea { resize: vertical; min-height: 64px; }
.field .hint { font-size: 12px; color: #b9a6ac; margin-top: 4px; }
.seg { display: flex; background: #f3e7eb; border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 9px 0; border-radius: 10px; font-size: 14px; font-weight: 600; color: #9b8a90; }
.seg button.on { background: #fff; color: #d1476f; box-shadow: 0 1px 4px rgba(178,58,94,.15); }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-item { border: 1.5px solid #f0e2e7; border-radius: 12px; padding: 9px 4px; text-align: center; font-size: 12px; background: #fff; }
.cat-item .ci-ic { font-size: 20px; display: block; margin-bottom: 3px; }
.cat-item.on { border-color: #d1476f; background: #fdf0f4; color: #d1476f; font-weight: 600; }
.size-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.size-item { width: 48px; border: 1.5px solid #f0e2e7; border-radius: 10px; padding: 7px 2px; text-align: center; font-size: 13px; background: #fff; }
.size-item.on { border-color: #d1476f; background: #fdf0f4; color: #d1476f; font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.btn { display: block; width: 100%; padding: 13px 0; border-radius: 13px; font-size: 15px; font-weight: 700; text-align: center; }
.btn.primary { background: linear-gradient(135deg, #e0567a, #c93a61); color: #fff; box-shadow: 0 4px 12px rgba(201,58,97,.3); }
.btn.ghost { background: #fff; color: #d1476f; border: 1.5px solid #f0d5de; }
.btn.danger { background: #fdeaea; color: #e25c3a; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- 弹窗 ---------- */
#modal-root .mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40, 20, 26, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadein .15s ease;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  background: #faf7f8; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; color: #333; }
.modal-close { font-size: 22px; color: #9b8a90; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
/* 居中弹窗（确认框） */
.mask.center { align-items: center; }
.modal.center { border-radius: 16px; padding: 20px; max-width: 320px; margin: 0 24px; }
.modal.center h3 { font-size: 16px; text-align: center; margin-bottom: 10px; }
.modal.center p { font-size: 14px; color: #666; text-align: center; line-height: 1.6; }

/* 金额大字输入 */
.amount-input {
  font-size: 34px !important; font-weight: 800; text-align: center;
  color: #d1476f !important; padding: 16px !important;
  background: #fff !important; border-radius: 14px !important;
  border: 1.5px solid #f3dbe4 !important;
}
.amount-input::placeholder { color: #e8c9d4; font-weight: 500; }

/* ---------- 详情页 ---------- */
.detail-hero { text-align: center; padding: 18px 0 12px; }
.detail-hero .dh-ic { font-size: 40px; }
.detail-hero .dh-name { font-size: 18px; font-weight: 800; margin-top: 6px; }
.detail-hero .dh-sub { font-size: 13px; color: #9b8a90; margin-top: 4px; }
.kv { display: flex; justify-content: space-between; padding: 9px 2px; font-size: 14px; border-bottom: 1px dashed #f3e7eb; }
.kv:last-child { border-bottom: none; }
.kv .k { color: #9b8a90; }
.kv .v { font-weight: 600; }
.kv .v.green { color: #2fa86b; }
.kv .v.red { color: #e25c3a; }

/* ---------- 报表 ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(178,58,94,.06); }
.month-nav .mn-btn { font-size: 18px; color: #d1476f; padding: 4px 10px; }
.month-nav .mn-txt { font-size: 15px; font-weight: 700; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.report-card { background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 6px rgba(178,58,94,.06); }
.report-card .lb { font-size: 12px; color: #9b8a90; }
.report-card .val { font-size: 19px; font-weight: 800; margin-top: 3px; }
.report-card .val.green { color: #2fa86b; } .report-card .val.red { color: #e25c3a; }
.report-card .val.pink { color: #d1476f; } .report-card .val.purple { color: #8e5fd0; }

/* 柱状图 */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 10px; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .bar { width: 70%; max-width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .bar.income { background: linear-gradient(180deg, #53c98c, #2fa86b); }
.chart .bar.expense { background: linear-gradient(180deg, #f08a6d, #e25c3a); }
.chart .bar-label { font-size: 9px; color: #b9a6ac; margin-top: 4px; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: #777; margin-bottom: 8px; }
.chart-legend .lg { display: flex; align-items: center; gap: 5px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; }

/* 横向条形（分类占比） */
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.hbar-row .hb-name { width: 64px; font-size: 12px; color: #777; flex: none; }
.hbar-row .hb-track { flex: 1; background: #f3e7eb; height: 10px; border-radius: 6px; overflow: hidden; }
.hbar-row .hb-fill { height: 100%; border-radius: 6px; }
.hbar-row .hb-val { width: 70px; text-align: right; font-size: 12px; font-weight: 700; flex: none; }

/* 排行 */
.rank-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed #f3e7eb; }
.rank-item:last-child { border-bottom: none; }
.rank-no { width: 22px; height: 22px; border-radius: 7px; background: #f3e7eb; color: #9b8a90; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.rank-no.top { background: #d1476f; color: #fff; }
.rank-item .rk-name { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-item .rk-val { font-size: 13px; font-weight: 700; color: #d1476f; flex: none; }
.rank-item .rk-sub { font-size: 11px; color: #b9a6ac; }

/* 进度条（库存占比） */
.stock-bar { background: #f3e7eb; border-radius: 6px; height: 8px; overflow: hidden; margin-top: 6px; }
.stock-bar .fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #e0567a, #f78fae); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 200; pointer-events: none; }
.toast {
  background: rgba(30, 20, 24, 0.88); color: #fff; font-size: 14px;
  padding: 12px 20px; border-radius: 12px; max-width: 280px; text-align: center;
  animation: fadein .2s ease;
}
.loading { text-align: center; color: #b9a6ac; padding: 60px 0; font-size: 14px; }
.link-btn { color: #d1476f; font-size: 13px; font-weight: 600; }
