:root {
  --bg: #F4F7FB;
  --card: #FFFFFF;
  --ink: #172B4D;
  --muted: #718096;
  --line: #E7EDF5;
  --navy: #17365D;
  --brand: #2878F0;
  --brand-soft: #E8F1FF;
  --warn: #E98B36;
  --warn-soft: #FFF4E5;
  --ok: #16A36A;
  --ok-soft: #E8F7F0;
  --cancel: #94A3B8;
  --cancel-soft: #F1F5F9;
  --danger: #D9485F;
  --shadow: 0 4px 16px rgba(23, 54, 93, 0.06);
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.4;
}
button, input { font-family: inherit; }
#app {
  min-height: 100vh; max-width: 480px; margin: 0 auto;
  background: var(--bg); position: relative;
}

/* ---------- Login ---------- */
.page { min-height: 100vh; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.page.login-page {
  padding: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  /* 与右侧插画取样色一致：#CFE0FE / #D5E3FD / #C1D9FD */
  background:
    radial-gradient(70% 55% at 78% 42%, rgba(255, 255, 255, .55), transparent 62%),
    radial-gradient(85% 60% at 100% 8%, #E3ECFD 0%, transparent 58%),
    radial-gradient(70% 50% at 8% 18%, #CFE0FE 0%, transparent 55%),
    linear-gradient(180deg, #D5E3FD 0%, #CFE0FE 38%, #C8DCFF 68%, #C1D9FD 100%);
  overflow: hidden; position: relative;
}
.login-page .wave {
  position: absolute; left: -12%; right: -12%; bottom: -4%;
  height: 180px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(110% 90% at 30% 100%, rgba(193, 217, 253, .7), transparent 60%),
    radial-gradient(100% 80% at 80% 120%, rgba(204, 223, 253, .55), transparent 58%);
}

.login-head {
  position: relative; z-index: 2;
  flex: none;
  padding: max(48px, env(safe-area-inset-top)) 0 10px 20px;
  min-height: 232px;
  background: transparent;
}
.brand-block { position: relative; z-index: 3; max-width: 48%; }
.brand-text h1 {
  margin: 0; font-size: 30px; line-height: 1.2; color: #15233F;
  font-weight: 750; letter-spacing: .4px;
}
.brand-text p {
  margin: 10px 0 0; font-size: 14px; color: #8A9BB0; letter-spacing: .2px;
}
.slogan {
  margin: 22px 0 0; color: #6AA5F5; font-size: 15px; letter-spacing: 1.6px;
  font-weight: 600;
}
.slogan .mark {
  position: relative; display: inline-block; padding-top: 10px;
}
.slogan .mark::before {
  content: ""; position: absolute; left: 1px; right: 1px; top: 0;
  height: 3px; border-radius: 99px; background: #3B82F6;
}

/* 装饰插画：放大一点，压住右上角视觉重心 */
.login-illust {
  position: absolute; right: -18px; top: 0; z-index: 2;
  width: 248px; height: 228px;
  pointer-events: none; user-select: none;
}
.login-illust img,
.login-illust svg {
  width: 100%; height: 100%; object-fit: contain; object-position: right top;
  display: block;
}

/* 白卡片向下铺满剩余屏幕 */
.login-card {
  position: relative; z-index: 3;
  flex: 1 1 auto;
  margin: 0;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: #fff;
  box-shadow: 0 -10px 40px rgba(37, 99, 235, .08);
}
.field {
  display: flex; align-items: center; gap: 12px; height: 52px; margin-bottom: 16px;
  padding: 0 16px; background: #F3F6FB; border-radius: 14px;
}
.field svg { flex: none; color: #A0AEC0; }
.field input {
  flex: 1; height: 100%; border: 0; background: transparent; outline: none;
  font-size: 15px; color: #1A2B4A; padding: 0;
}
.field input::placeholder { color: #B0BAC7; }
.eye {
  border: 0; background: transparent; padding: 6px; color: #A0AEC0;
  display: grid; place-items: center; flex: none;
}
.captcha-field { padding-right: 8px; }
.captcha-field img {
  width: 102px; height: 38px; border-radius: 8px; background: #EAF2FF;
  object-fit: cover; cursor: pointer; flex: none;
}
.login-ops {
  display: flex; align-items: center;
  margin: 4px 2px 0; font-size: 13px; color: #718096;
}
.remember { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.remember input {
  width: 16px; height: 16px; accent-color: #2F6BFF; margin: 0;
}
.login-btn {
  width: 100%; height: 50px; margin-top: 18px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #4B8DFF 0%, #2F6BFF 100%);
  color: #fff; font-size: 17px; font-weight: 650; letter-spacing: 2px;
  box-shadow: 0 12px 24px rgba(47, 107, 255, .32);
}
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { opacity: .65; }
.login-foot-note {
  margin-top: 14px; text-align: center; font-size: 12px; color: #A8B3C4;
  letter-spacing: .2px;
}
.login-page .err { min-height: 18px; margin-top: 10px; margin-bottom: 0; text-align: center; }

/* 矮屏：略压缩，但仍比原来大 */
@media (max-height: 700px) {
  .login-head { min-height: 200px; padding-top: max(32px, env(safe-area-inset-top)); }
  .brand-text h1 { font-size: 26px; }
  .login-illust { width: 210px; height: 192px; right: -14px; top: 0; }
  .slogan { margin-top: 16px; font-size: 14px; }
  .login-card { padding-top: 22px; }
  .field { height: 48px; margin-bottom: 12px; }
}
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- Home header ---------- */
.home-hero {
  background:
    radial-gradient(70% 55% at 90% 20%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(80% 50% at 10% 0%, #CFE0FE 0%, transparent 55%),
    linear-gradient(160deg, #D5E3FD 0%, #CFE0FE 45%, #C1D9FD 100%);
  padding: 20px 16px 56px;
  color: #15233F;
  position: relative;
}
.home-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.home-hero h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: .3px; color: #15233F; }
.home-hero .sub { margin: 8px 0 0; font-size: 13px; color: #5B7394; line-height: 1.4; opacity: 1; }
.month-pill {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: rgba(255,255,255,.72); border: 0; color: #1A3A6B; font-size: 13px;
  box-shadow: 0 4px 12px rgba(47, 107, 255, .12);
}
.month-pill:active { background: #fff; }
.home-body { margin-top: -38px; position: relative; z-index: 2; padding: 0 12px 8px; }

/* ---------- Month picker sheet ---------- */
.month-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.month-sheet {
  width: 100%; max-width: 480px; max-height: 70vh;
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 0 0 calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 28px rgba(15, 23, 42, .12);
  display: flex; flex-direction: column;
}
.month-sheet-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px; font-size: 16px; font-weight: 700; color: var(--ink);
}
.month-sheet-hd button {
  border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 4px 0;
}
.month-sheet-tip {
  padding: 0 16px 10px; font-size: 12px; color: var(--muted); line-height: 1.4;
}
.month-sheet-list {
  overflow-y: auto; padding: 0 8px 8px;
  -webkit-overflow-scrolling: touch;
}
.month-opt {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  border: 0; background: transparent; text-align: left;
  padding: 14px 12px; border-radius: 12px;
  font-size: 15px; color: var(--ink);
}
.month-opt + .month-opt { border-top: 1px solid #F1F5F9; }
.month-opt.on { color: var(--brand); font-weight: 700; background: #F0F6FF; }
.month-opt .tag {
  font-size: 11px; font-weight: 600; color: var(--brand);
  background: rgba(40, 120, 240, .1); padding: 2px 8px; border-radius: 999px;
}
.month-opt:active { background: #F8FAFC; }

/* ---------- Summary strip ---------- */
.summary-row {
  display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 8px;
}
.summary-card {
  background: var(--card); border-radius: 14px; padding: 14px 10px 12px;
  box-shadow: var(--shadow); min-width: 0;
}
.summary-card .icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 10px;
  overflow: hidden; background: transparent;
}
.summary-card .icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.summary-card .k { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-card .v {
  margin-top: 6px; font-size: 17px; font-weight: 700; color: var(--ink);
  word-break: break-all; line-height: 1.25;
}
.summary-card.mid .v { font-size: 16px; }

/* ---------- Section ---------- */
.sec {
  margin-top: 20px;
}
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding: 0 2px;
}
.sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: var(--ink);
}
.sec-title::before {
  content: ""; width: 3px; height: 15px; border-radius: 2px; background: var(--brand);
}
.sec-link {
  border: 0; background: transparent; color: var(--brand); font-size: 13px; padding: 4px 0;
  font-weight: 600; cursor: pointer;
}
.sec-link:disabled { opacity: .55; cursor: default; }

/* ---------- Metric grid ---------- */
.metric-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.metric-card {
  background: var(--card); border-radius: var(--radius); padding: 15px 13px;
  box-shadow: var(--shadow); min-width: 0;
}
.metric-card .top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.metric-card .mi {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; flex: none; overflow: hidden;
  background: transparent;
}
.metric-card .mi img { width: 100%; height: 100%; object-fit: cover; display: block; }
.metric-card .mk { font-size: 13px; color: var(--muted); }
.metric-card .mv {
  font-size: 18px; font-weight: 700; color: var(--ink);
  word-break: break-all; line-height: 1.3;
}

/* ---------- Chart ---------- */
.chart-card {
  background: var(--card); border-radius: var(--radius); padding: 16px 12px 12px;
  box-shadow: var(--shadow);
}
.chart-legend {
  display: flex; gap: 16px; margin-bottom: 10px; font-size: 12px; color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i {
  width: 14px; height: 3px; border-radius: 2px; display: inline-block;
}
.chart-legend .sales { background: var(--brand); }
.chart-legend .profit { background: #E98B36; }
canvas.trend-canvas { width: 100%; height: 230px; display: block; }

/* ---------- Orders page ---------- */
.page-pad { padding: 0 0 8px; }
.nav-title {
  display: flex; align-items: center; justify-content: center;
  height: 48px; position: relative; background: #fff;
  border-bottom: 1px solid var(--line); font-size: 17px; font-weight: 650; color: var(--ink);
}
.nav-title .back {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--ink);
}
.orders-tools { background: #fff; padding: 12px 14px 10px; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 40px;
  padding: 0 12px; background: #F1F4F9; border-radius: 10px;
}
.search-box svg { flex: none; color: #94A3B8; }
.search-box input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-size: 14px; color: var(--ink); height: 100%; padding: 0;
}
.search-box input::placeholder { color: #A0AEC0; }
.status-tabs {
  display: flex; gap: 8px; padding: 12px 14px 4px; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs button {
  flex: none; height: 30px; padding: 0 14px; border: 0; border-radius: 999px;
  background: #EEF1F6; color: var(--muted); font-size: 13px;
}
.status-tabs button.on { background: var(--brand); color: #fff; font-weight: 600; }

/* ---------- Order card ---------- */
.order-card {
  background: var(--card); margin: 10px 14px; border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.order-card .hd {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.order-card .sn { font-size: 14px; font-weight: 650; color: var(--ink); word-break: break-all; }
.order-card .time { margin-top: 4px; font-size: 12px; color: var(--muted); }
.badge {
  flex: none; font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 550;
}
.badge.paid { background: var(--brand-soft); color: var(--brand); }
.badge.wait { background: var(--warn-soft); color: var(--warn); }
.badge.cancel { background: var(--cancel-soft); color: var(--cancel); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.ship { background: #F3E8FF; color: #7E22CE; }

.goods-row {
  display: flex; gap: 12px; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line);
}
.goods-row img, .goods-thumb {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  background: #F1F4F9; flex: none;
}
.goods-meta { flex: 1; min-width: 0; }
.goods-meta .name {
  font-size: 14px; font-weight: 650; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.goods-meta .line { margin-top: 3px; font-size: 12px; color: var(--muted); }
.order-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}
.order-foot .lab { font-size: 13px; color: var(--muted); }
.order-foot .amt {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 16px; font-weight: 700; color: var(--ink);
}
.order-foot .amt svg { color: #CBD5E1; }

.empty-box, .more-box {
  text-align: center; color: var(--muted); padding: 28px 16px; font-size: 13px;
}
.more-box button {
  border: 0; background: #fff; color: var(--brand); border-radius: 999px;
  padding: 8px 18px; box-shadow: var(--shadow); font-size: 13px;
}

/* ---------- Detail ---------- */
.detail-page { background: var(--bg); }
.detail-body { padding: 12px 14px 20px; }
.d-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 14px 12px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.d-card .hd-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.d-card .sn { font-size: 14px; font-weight: 650; color: var(--navy); word-break: break-all; }
.d-card .time { margin-top: 6px; font-size: 12px; color: var(--muted); }
.d-amount-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.d-amount-row .lab { font-size: 13px; color: var(--muted); }
.d-amount-row .val { font-size: 22px; font-weight: 700; color: var(--navy); }

.d-goods { display: flex; gap: 12px; }
.d-goods img { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: #F1F4F9; flex: none; }
.d-goods .name { font-size: 15px; font-weight: 650; color: var(--ink); }
.d-goods .line { margin-top: 4px; font-size: 12px; color: var(--muted); }
.d-subtotal {
  text-align: right; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line); font-size: 14px; font-weight: 650; color: var(--ink);
}

.d-sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 650; color: var(--navy); margin-bottom: 4px;
}
.d-sec-title svg { color: var(--brand); flex: none; }
.kv-list .kv {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.kv-list .kv:last-child { border-bottom: 0; }
.kv-list .kv span { color: var(--muted); flex: none; }
.kv-list .kv b { font-weight: 500; text-align: right; color: var(--ink); word-break: break-all; }

/* ---------- Mine ---------- */
.mine-page { background: var(--bg); }
.mine-hero {
  background:
    radial-gradient(70% 55% at 90% 20%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(80% 50% at 10% 0%, #CFE0FE 0%, transparent 55%),
    linear-gradient(155deg, #D5E3FD 0%, #CFE0FE 45%, #C1D9FD 100%);
  padding: 36px 20px 48px; color: #15233F;
  position: relative; overflow: hidden;
}
.mine-hero::after {
  content: ""; position: absolute; right: -30px; top: -20px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.35); pointer-events: none;
}
.mine-hero-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 14px;
}
.mine-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #E8F1FF);
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 6px 16px rgba(47, 107, 255, .16);
  display: grid; place-items: center; flex: none; overflow: hidden;
  color: #2F6BFF;
}
.mine-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mine-hero .name { font-size: 20px; font-weight: 700; letter-spacing: .3px; color: #15233F; }
.mine-hero .role { margin-top: 6px; font-size: 13px; color: #5B7394; opacity: 1; }
.mine-body { margin-top: -22px; padding: 0 14px 8px; position: relative; z-index: 2; }
.mine-card {
  background: var(--card); border-radius: 16px; padding: 4px 16px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.mine-menu {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 12px;
}
.mine-menu-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 15px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left;
  font-size: 15px; color: var(--ink); cursor: pointer;
}
.mine-menu-item:last-child { border-bottom: 0; }
.mine-menu-item:active { background: #F8FAFC; }
.mine-menu-item > svg.arrow,
.mine-menu-item > svg { color: #CBD5E1; flex: none; margin-left: auto; }
.mine-menu-item .mi {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; flex: none;
}
.mine-menu-item .mi.blue { background: #E8F1FF; color: var(--brand); }
.mine-menu-item .mi.green { background: var(--ok-soft); color: var(--ok); }
.mine-menu-item .mi.gray { background: #F1F4F9; color: #718096; }
.mine-menu-item .txt { flex: 1; min-width: 0; }
.mine-menu-item .txt small {
  display: block; margin-top: 3px; font-size: 12px; color: var(--muted);
}
.mine-menu-item .arrow { color: #CBD5E1; flex: none; }
.btn-logout {
  width: 100%; height: 48px; margin: 8px 0 0; border: 0;
  border-radius: 14px; background: #fff; color: var(--danger);
  font-size: 16px; font-weight: 600; box-shadow: var(--shadow);
}
.hint { font-size: 12px; color: var(--muted); padding: 12px 0; line-height: 1.5; }
.goods-ph {
  width: 64px; height: 64px; border-radius: 8px; flex: none;
  background: linear-gradient(145deg, #EEF2F7, #E2E8F0);
  display: grid; place-items: center; color: #A0AEC0;
}

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: 480px;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 30;
}
.tabbar button {
  flex: 1; height: 56px; border: 0; background: #fff;
  color: #94A3B8; font-size: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tabbar button.on { color: var(--brand); font-weight: 650; }
.tabbar button svg { display: block; }

.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(23, 43, 77, .88); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 40;
  max-width: 80%; text-align: center;
}

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px 14px; padding: 16px; }
.no-perm { text-align: center; padding: 40px 20px; color: var(--muted); }
