/* ==========================================================
   大荔冬枣代办台账 · 设计系统
   参考：Modern Mini-App Layout（Design Tokens + 毛玻璃 + 弹性动效）
   适配：PWA / 手机优先 / 中老年可读（字号放大，点击区 ≥44px）
   ========================================================== */

:root {
  /* 品牌色 */
  --primary: #4A6CF7;
  --primary-light: #6B8AFF;
  --primary-dark: #3451DB;
  --primary-bg: #EEF2FF;

  /* 功能色 */
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #06B6D4;

  /* 兼容旧变量名（历史页面内联样式仍在引用） */
  --brand: #4A6CF7;
  --muted: #94A3B8;
  --ok: #22C55E;

  /* 中性色 */
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --subtle: #F1F5F9;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  /* 渐变 */
  --grad-primary: linear-gradient(135deg, #4A6CF7 0%, #7C3AED 100%);
  --grad-warm: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
  --grad-cool: linear-gradient(135deg, #06B6D4 0%, #4A6CF7 100%);
  --grad-success: linear-gradient(135deg, #22C55E 0%, #06B6D4 100%);

  /* 圆角 */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 999px;

  /* 阴影 */
  --shadow-sm: 0 1px 4px rgba(15, 23, 42, .04);
  --shadow-md: 0 2px 10px rgba(15, 23, 42, .06);
  --shadow-lg: 0 6px 20px rgba(15, 23, 42, .08);
  --shadow-xl: 0 12px 36px rgba(15, 23, 42, .12);
  --shadow-glow: 0 6px 16px rgba(74, 108, 247, .28);

  /* 毛玻璃 */
  --glass-bg: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .6);
  --glass-blur: blur(18px);

  /* 动效曲线 */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.25, .46, .45, .94);

  /* 尺寸 */
  --page-pad: 16px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* ============ 顶部：沉浸式渐变 ============ */
.topbar {
  background: var(--grad-primary);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--page-pad) 34px;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  position: relative;
  overflow: hidden;
}
.topbar::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  pointer-events: none;
}
.topbar h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .3px;
}
.topbar .sub {
  margin-top: 3px;
  font-size: 13px;
  opacity: .82;
}
.topbar button {
  background: rgba(255, 255, 255, .18);
  border: none;
  color: #fff;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
}
.topbar button:active { transform: scale(.95); }

/* ============ 主内容：卡片上浮 ============ */
.main {
  padding: 0 var(--page-pad) calc(var(--tab-h) + var(--safe-b) + 24px);
  margin-top: -22px;
  position: relative;
  z-index: 2;
}
.main.no-tab {
  margin-top: 0;
  padding-top: 12px;
  padding-bottom: calc(var(--safe-b) + 24px);
}

/* ============ 二级页导航条 ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) var(--page-pad) 8px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-light);
}
.nav-back {
  width: 36px;
  height: 36px;
  margin-left: -8px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: var(--radius-full);
  transition: background .15s, transform .12s var(--ease-spring);
}
.nav-back:active { background: var(--subtle); transform: scale(.9); }
.nav-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--text);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .2px;
}

/* ============ 卡片 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
  animation: cascade-in .42s var(--ease-out) both;
}
.card h2 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--grad-primary);
}

/* 悬浮强调卡（首页数据概览） */
.card-hero {
  background: var(--grad-primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-glow);
}
.card-hero h2 { color: #fff; }
.card-hero h2::before { background: rgba(255, 255, 255, .85); }

/* ============ 文字与行 ============ */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
}
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .meta {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
  margin-top: 8px;
}
.err {
  color: var(--danger);
  font-size: 14px;
  margin-top: 8px;
  min-height: 18px;
}
.empty {
  text-align: center;
  color: var(--text-3);
  font-size: 15px;
  padding: 36px 12px;
}

/* ============ 大数字 ============ */
.big-num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.big-num .unit {
  font-size: 14px;
  font-weight: 500;
  opacity: .75;
  margin-left: 3px;
}

/* ============ 统计块 ============ */
.stat {
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--subtle);
}
.stat .label {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.stat .value {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ============ 表单 ============ */
.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 6px;
}
.grid3 .field { margin-bottom: 0; }
.grid3 .input { padding: 0 8px; font-size: 15px; }

.input, .select, .textarea {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--subtle);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color .18s, background .18s, box-shadow .18s;
  font-family: inherit;
  appearance: none;
}
.textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  line-height: 1.55;
  resize: vertical;
}
.input:focus, .select:focus, .textarea:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.input::placeholder, .textarea::placeholder { color: #B6C0CE; }

.rowline { display: flex; gap: 10px; align-items: center; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s var(--ease-spring), opacity .12s, background .18s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; transform: none; }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-ghost {
  background: var(--subtle);
  color: var(--text-2);
}
.btn-ghost:active { background: var(--border); }
.btn-danger {
  background: #FEF2F2;
  color: var(--danger);
}
.btn-block { width: 100%; }

/* 兼容旧写法：.acts button */
.acts { display: flex; gap: 10px; margin-top: 12px; }
.acts button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--subtle);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
}
.acts button:active { transform: scale(.96); }
.acts button.primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* ============ 分段控件 ============ */
.seg {
  display: flex;
  gap: 4px;
  background: var(--subtle);
  border-radius: var(--radius-full);
  padding: 4px;
}
.seg button {
  flex: 1;
  min-height: 38px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  transition: all .2s var(--ease-out);
}
.seg button.on {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ============ 筛选条 ============ */
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all .18s var(--ease-out);
}
.filters button.on {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

/* ============ 订单卡片 ============ */
.order-item {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 14px 15px;
  margin-bottom: 11px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  animation: cascade-in .4s var(--ease-out) both;
  transition: transform .12s var(--ease-spring);
}
.order-item:active { transform: scale(.985); }

.order-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.order-no {
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex: 1;
}
.order-addr {
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.order-amt {
  font-size: 19px;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

/* ============ 标签 ============ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--subtle);
  color: var(--text-2);
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.tag-pending { color: var(--warning); background: #FFFBEB; }
.tag-shipped { color: var(--primary); background: var(--primary-bg); }
.tag-done { color: var(--success); background: #F0FDF4; }
.tag-refunded { color: var(--danger); background: #FEF2F2; }
.tag-gift { color: #7C3AED; background: #F5F3FF; }
.tag.warn { color: var(--warning); background: #FFFBEB; }
.tag.ok { color: var(--success); background: #F0FDF4; }
.tag.gray { color: var(--text-2); background: var(--subtle); }
.tag-sf { color: #111; background: #F1F5F9; }
.tag-jd { color: #D71E28; background: #FEF2F2; }

/* ============ 底部导航：毛玻璃 ============ */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, .05);
  z-index: 50;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  transition: color .18s;
}
.tabbar svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .25s var(--ease-spring);
}
.tabbar a.on { color: var(--primary); font-weight: 600; }
.tabbar a.on svg { transform: translateY(-1px) scale(1.06); }

/* ============ 登录页 ============ */
.page-plain { padding: 0; margin: 0; }

/* ============ 登录页：填充式输入框（参考用户给的设计稿） ============ */
.login-wrap .field, .form-fill .field { margin-bottom: 16px; }
.login-wrap .field label, .form-fill .field label {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 8px;
  padding-left: 2px;
  font-weight: 500;
}
.login-wrap .input, .form-fill .input {
  height: 56px;
  padding: 0 16px;
  font-size: 17px;
  background: #F5F6FA;
  border: none;
  border-radius: 12px;
}
.login-wrap .input:focus, .form-fill .input:focus {
  background: #fff;
  box-shadow: 0 0 0 2px var(--primary), 0 0 0 5px var(--primary-bg);
}
.login-wrap .btn, .form-fill .btn {
  min-height: 54px;
  font-size: 17px;
  letter-spacing: 2px;
  margin-top: 8px;
}

/* 密码框眼睛 */
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 50px; }
.pwd-eye {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: var(--radius-full);
  transition: transform .12s var(--ease-spring);
}
.pwd-eye:active { transform: translateY(-50%) scale(.88); }
.pwd-eye svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 勾选框 */
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
  margin: 2px 0 4px;
  padding-left: 2px;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  margin: 0;
}

.login-links {
  text-align: center;
  margin-top: 20px;
  font-size: 15px;
}
.login-links a {
  color: var(--primary);
  text-decoration: none;
  padding: 8px 12px;
  display: inline-block;
}

/* ============ 恢复码弹窗 ============ */
.code-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity .2s var(--ease-out);
}
.code-mask.show { opacity: 1; }
.code-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 24px 20px 20px;
  box-shadow: var(--shadow-xl);
  transform: translateY(16px) scale(.96);
  transition: transform .28s var(--ease-spring);
  text-align: center;
}
.code-mask.show .code-box { transform: translateY(0) scale(1); }
.code-box h3 {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--text);
}
.code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  background: var(--primary-bg);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  user-select: all;
  -webkit-user-select: all;
  word-break: break-all;
}
.code-tip {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  margin: 14px 0 18px;
  text-align: left;
}
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 26px calc(var(--safe-b) + 40px);
  background: linear-gradient(170deg, #EEF2FF 0%, #F8FAFC 42%, #F8FAFC 100%);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .mark {
  width: 78px;
  height: 78px;
  margin: 0 auto 14px;
  border-radius: 24px;
  background: var(--grad-primary);
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 38px;
  font-weight: 700;
  animation: float-in .55s var(--ease-spring) both;
}
.login-logo h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { margin: 6px 0 0; font-size: 14px; color: var(--text-3); }

/* ============ 离线条 / Toast ============ */
#offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--warning);
  color: #fff;
  font-size: 13px;
  text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 26px);
  transform: translateX(-50%) translateY(10px);
  background: rgba(15, 23, 42, .92);
  color: #fff;
  font-size: 15px;
  padding: 11px 20px;
  border-radius: var(--radius-full);
  z-index: 999;
  max-width: 82vw;
  text-align: center;
  opacity: 0;
  transition: opacity .22s var(--ease-out), transform .3s var(--ease-spring);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 动效 ============ */
@keyframes cascade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float-in {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 列表交错进场：前 8 项依次延迟 */
.order-item:nth-child(1) { animation-delay: 0ms; }
.order-item:nth-child(2) { animation-delay: 40ms; }
.order-item:nth-child(3) { animation-delay: 80ms; }
.order-item:nth-child(4) { animation-delay: 120ms; }
.order-item:nth-child(5) { animation-delay: 160ms; }
.order-item:nth-child(6) { animation-delay: 200ms; }
.order-item:nth-child(7) { animation-delay: 240ms; }
.order-item:nth-child(8) { animation-delay: 280ms; }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 300px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  color: transparent;
}
@keyframes shimmer {
  0% { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}

/* 尊重系统「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
