:root {
  /* 设计令牌对齐参考站的蓝灰体系 */
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-deep: #1e3a8a;
  --brand-light: #eef4ff;
  --brand-lighter: #f8fafc;
  --brand-line: #c9dcfd;

  --ink: #1a1f28;
  --ink-2: #4b5563;
  --ink-3: #75808f;
  --ink-4: #9aa4b2;

  --line: #e8ebf1;
  --line-2: #eef0f5;
  --bg: #f3f5f9;
  --card: #ffffff;

  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(18, 28, 45, .03);
  --shadow: 0 1px 2px rgba(18, 28, 45, .04), 0 4px 14px rgba(18, 28, 45, .04);
  --shadow-lg: 0 8px 28px rgba(18, 28, 45, .1);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px 64px; }
.wrap.wide { max-width: 1180px; }

/* 全面屏手机：给底部留出安全区，避免内容被系统手势条遮住 */
@supports (padding: max(0px)) {
  .wrap {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
}

/* ============================================================ 顶部标题 */

/* 白底细底线的 appbar，比大色块更清爽，也更省纵向空间 */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px 16px;
  margin-bottom: 22px;
  position: relative;
}

.topbar::after { display: none; }

.topbar-inner { max-width: 720px; margin: 0 auto; position: relative; }
.topbar-inner.wide { max-width: 1180px; }

.tb-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: .2px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h1::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--brand);
  flex-shrink: 0;
}

.topbar p {
  margin: 7px 0 0 36px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.6;
}

.topbar .shop {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 10px 0 0 36px;
}

.tb-link {
  color: var(--brand);
  font-size: 13px;
  text-decoration: none;
  background: var(--brand-light);
  border: 1px solid var(--brand-line);
  padding: 7px 15px;
  border-radius: 7px;
  white-space: nowrap;
  transition: all .15s;
}

.tb-link:hover { background: #e0ecff; border-color: var(--brand); }

/* ================================================================ 卡片 */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.form-card { padding: 26px 26px 28px; }

.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0 13px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.sec-title:first-child { margin-top: 0; }

.sec-title::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--brand);
  border-radius: 2px;
}

.sec-title .tip { font-weight: 400; font-size: 12px; color: var(--ink-4); }

.sec-k {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
  letter-spacing: .3px;
}

.req::after { content: "*"; color: var(--danger); margin-left: 3px; }

/* ================================================================= 表单 */

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; }
.field.full { grid-column: 1 / -1; }

.field label {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

.field textarea { resize: vertical; min-height: 110px; line-height: 1.7; }

.field input::placeholder,
.field textarea::placeholder { color: var(--ink-4); }

/* 聚焦时蓝边 + 极淡蓝晕染，和参考站一致 */
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.err { color: var(--danger); font-size: 12.5px; margin-top: 5px; min-height: 17px; }

/* 交期快捷选择 / 描述模板 */
.quick-dates { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }

.qd {
  font-family: inherit;
  font-size: 13px;
  padding: 0 14px;
  height: 38px;
  min-width: 64px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
  flex: 1 1 auto;
  white-space: nowrap;
}

.qd:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-lighter); }

.qd.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.quick-prompts {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.qp-label { font-size: 12.5px; color: var(--ink-3); }

.qp {
  font-family: inherit;
  font-size: 13px;
  padding: 0 14px;
  height: 38px;
  border: 1px dashed var(--brand);
  border-radius: 19px;
  background: var(--brand-lighter);
  color: var(--brand-dark);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.qp:hover { background: var(--brand-light); }

/* =============================================================== 上传区 */

.upload-box {
  border: 1.5px dashed #d4dae6;
  border-radius: 11px;
  padding: 26px 20px;
  text-align: center;
  background: var(--brand-lighter);
  transition: all .18s;
  cursor: pointer;
  display: block;
}

.upload-box:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: translateY(-1px);
}

/* 粘贴到图片时的反馈：短暂高亮，让客户确认「收到了」 */
.upload-box.pasted {
  border-color: var(--brand);
  border-style: solid;
  background: var(--brand-light);
  animation: pasteFlash .9s ease;
}

.upload-box.pasted .t1::after {
  content: " · 已粘贴";
  color: var(--brand);
  font-weight: 600;
}

@keyframes pasteFlash {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .25); }
  35% { box-shadow: 0 0 0 6px rgba(37, 99, 235, .12); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* 粘贴提示条 */
.paste-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 13px;
  background: var(--brand-lighter);
  border: 1px dashed var(--brand-line);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--brand-dark);
}

.paste-tip kbd {
  font-family: inherit;
  font-size: 11.5px;
  background: #fff;
  border: 1px solid var(--brand-line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--brand-dark);
  white-space: nowrap;
}

.upload-box .ic { font-size: 24px; display: block; margin-bottom: 9px; opacity: .45; }
.upload-box .t1 { font-size: 14px; color: var(--ink-2); font-weight: 500; display: block; }
.upload-box .t2 { font-size: 12px; color: var(--ink-3); margin-top: 4px; display: block; }
.upload-box .t3 { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; display: block; }
/* 用 clip 彻底隐藏，保证页面上不出现浏览器默认的「选择文件」按钮 */
#attachInput[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-light);
  border: 1px solid var(--brand-line);
  border-radius: 20px;
  padding: 6px 8px 6px 13px;
  font-size: 12.5px;
  max-width: 100%;
}

.chip-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 210px;
}

/* 图片附件显示小缩略图，文档显示类型图标 */
.chip-thumb {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, .06);
}

.chip-ic { font-size: 14px; flex-shrink: 0; line-height: 1; }

.chip.is-img { padding-left: 6px; }

.chip-size { color: var(--ink-3); font-size: 11.5px; flex-shrink: 0; }

.chip-x {
  border: none;
  background: var(--line-2);
  color: var(--brand-dark);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.chip-x:hover { background: var(--brand); color: #fff; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 11px;
  margin-top: 12px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef0f5;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb-x {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.thumb-x:hover { background: var(--danger); }

/* ================================================================ 按钮 */

.btn {
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 500;
  padding: 12px 24px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}

.btn:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { background: #a8bdf5; border-color: #a8bdf5; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 22px; }

.btn-mini {
  display: inline-block;
  font-size: 12px;
  padding: 6px 13px;
  border-radius: 6px;
  background: var(--brand-light);
  border: 1px solid var(--brand-line);
  color: var(--brand-dark);
  text-decoration: none;
  white-space: nowrap;
}

.btn-mini:hover { background: #e0ecff; border-color: var(--brand); }

.btn-sm {
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}

.btn-sm:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-lighter); }
.btn-sm.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-sm.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* ========================================================== 提交成功 */

.success { display: none; text-align: center; padding: 60px 28px; }
.success.show { display: block; }

.success .mark {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 22px;
}

.success h2 { margin: 0 0 10px; font-size: 21px; font-weight: 600; }
.success p { margin: 0 0 8px; color: var(--ink-2); font-size: 14.5px; }

.order-no-box {
  display: inline-block;
  background: var(--brand-light);
  border: 1px solid var(--brand-line);
  border-radius: 10px;
  padding: 13px 30px;
  margin: 18px 0 20px;
  font-size: 21px;
  font-weight: 600;
  color: var(--brand-dark);
  letter-spacing: 2px;
}

/* ============================================================== 提示条 */

.tipbox {
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  padding: 13px 16px;
  font-size: 13px;
  color: #1e40af;
  margin-top: 24px;
  line-height: 1.75;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(26, 31, 40, .95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 9px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(220, 38, 38, .96); }

/* ============================================================== 订单查询 */

.query-card {
  margin-top: 20px;
  padding: 22px 24px 24px;
}

.query-head { margin-bottom: 18px; }

.query-head h2 {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.query-head h2::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--brand);
  flex-shrink: 0;
}

.query-head p { margin: 0; font-size: 13px; color: var(--ink-3); }

#queryForm .btn-block { margin-top: 4px; }

/* -------------------------------------------------------- 查询结果 */

.query-result {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.qr-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.qr-no {
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: .4px;
}

.qr-time { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.qr-badge {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 6px;
  white-space: nowrap;
}

.qr-badge.pending { background: #fffbeb; color: #b45309; }
.qr-badge.confirmed { background: #eff6ff; color: #1d4ed8; }
.qr-badge.producing { background: #f5f3ff; color: #6d28d9; }
.qr-badge.done { background: #ecfdf5; color: #047857; }
.qr-badge.canceled { background: #f8fafc; color: #64748b; }

/* ---------------------------------------------------- 进度时间线 */

.timeline {
  display: flex;
  align-items: flex-start;
  margin-bottom: 22px;
  position: relative;
}

.tl-step {
  flex: 1;
  text-align: center;
  position: relative;
  min-width: 0;
}

/* 连接线由 JS 按像素精确插入（.tl-seg），
   不用伪元素—— 伪元素无法跨元素定位到「上一个圆点中心」，
   之前就是因此把线多画了半格、在第一步左侧溢出一截。 */
.tl-seg {
  position: absolute;
  height: 2px;
  top: 14px;
  z-index: 0;
  pointer-events: none;
}

.tl-seg.gray { background: var(--line); }
.tl-seg.blue { background: var(--brand); }

/* 订单被取消时的末端节点 */
.tl-dot.tl-cancel { background: var(--danger); border-color: var(--danger); color: #fff; }
.tl-label.tl-cancel-k { color: var(--danger); font-weight: 600; }

.tl-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  position: relative;
  z-index: 1;
  font-size: 13px;
  color: var(--ink-4);
  transition: all .25s;
}

.tl-step.reached .tl-dot {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.tl-step.current .tl-dot {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .16);
}

.tl-label {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.4;
}

.tl-step.reached .tl-label { color: var(--ink-2); font-weight: 500; }
.tl-step.current .tl-label { color: var(--brand); font-weight: 600; }

/* ------------------------------------------------------ 信息网格 */

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 18px;
}

.qr-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.qr-item .k {
  font-size: 11.5px;
  color: var(--ink-3);
  display: block;
  margin-bottom: 3px;
}

.qr-item .v {
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-item .v.money { color: #b45309; font-weight: 600; }

.qr-demand p,
.qr-note p {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
}

.qr-note {
  margin-top: 16px;
  padding: 13px 15px;
  background: var(--brand-light);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-sm);
}

/* 提交成功页两个按钮并排 */
.success-acts {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.success-acts .btn { flex: 1; min-width: 140px; }

.btn-ghost {
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--brand-lighter);
  border-color: var(--brand);
  color: var(--brand);
}

/* ============================================================ 管理页 */

.login-card { max-width: 400px; margin: 44px auto; padding: 38px 32px; text-align: center; }
.login-ic { font-size: 34px; margin-bottom: 14px; }
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-card .sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 22px; }
.login-card .row { display: flex; }

.login-tip {
  font-size: 12px;
  color: var(--ink-3);
  margin: 16px 0 0;
  line-height: 1.6;
}

/* ---------------------------------------------------------- 统计卡片 */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px;
  margin-bottom: 18px;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all .18s;
  position: relative;
  overflow: hidden;
}

/* 顶部 2px 细色条，比左侧粗条更清爽 */
.stat-tile::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: #cbd5e1;
}

.stat-tile.blue::before { background: #2563eb; }
.stat-tile.orange::before { background: #f59e0b; }
.stat-tile.green::before { background: #10b981; }
.stat-tile.red::before { background: #ef4444; }
.stat-tile.gray::before { background: #94a3b8; }

.stat-tile:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: #d4dae6;
}

.stat-top { display: flex; align-items: baseline; gap: 7px; }
.stat-icon { font-size: 14px; opacity: .6; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.5px;
}

.stat-tile.blue .stat-value { color: #2563eb; }
.stat-tile.orange .stat-value { color: #d97706; }
.stat-tile.green .stat-value { color: #059669; }
.stat-tile.red .stat-value { color: #dc2626; }
.stat-tile.gray .stat-value { color: #64748b; }

.stat-label { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

/* ------------------------------------------------------------ 图表 */

.charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.chart-card { padding: 18px 20px 20px; }

.chart-title {
  margin: 0 0 16px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.chart-body { min-height: 120px; }
.chart-empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 40px 0; }

/* 状态分布横向条 */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }

.bar-label { font-size: 12.5px; color: var(--ink-2); width: 52px; flex-shrink: 0; }

.bar-track {
  flex: 1;
  height: 9px;
  background: var(--line-2);
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
.bar-fill.pending { background: #f59e0b; }
.bar-fill.confirmed { background: #2563eb; }
.bar-fill.producing { background: #8b5cf6; }
.bar-fill.done { background: #10b981; }
.bar-fill.canceled { background: #cbd5e1; }

.bar-num {
  font-size: 12.5px;
  font-weight: 600;
  width: 52px;
  text-align: right;
  flex-shrink: 0;
}

.bar-num em {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-3);
  font-size: 11px;
  margin-left: 3px;
}

/* 趋势柱状图 */
.cols {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 132px;
  padding-top: 6px;
}

.col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 5px;
}

.col-num { font-size: 11px; color: var(--ink-2); font-weight: 600; height: 14px; }

.col-bar {
  width: 100%;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 5px 5px 2px 2px;
  transition: height .4s ease;
  min-height: 2px;
}

.col:hover .col-bar { background: linear-gradient(180deg, #f0b429, #d98324); }

.col-label { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }

/* 类型排行 */
.tag-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tag-row:last-child { margin-bottom: 0; }

.tag-name {
  font-size: 12.5px;
  color: var(--ink-2);
  width: 78px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-track { flex: 1; height: 9px; background: var(--line-2); border-radius: 5px; overflow: hidden; }

.tag-fill {
  height: 100%;
  background: linear-gradient(90deg, #93c5fd, #2563eb);
  border-radius: 5px;
  transition: width .4s ease;
}

.tag-num { font-size: 12.5px; font-weight: 600; width: 22px; text-align: right; flex-shrink: 0; }

/* ------------------------------------------------------------ 工具栏 */

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.search-wrap { position: relative; flex: 1; min-width: 220px; }

.search-ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: .5;
  pointer-events: none;
}

.admin-bar input[type="search"] {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 13px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.admin-bar select {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.admin-bar .spacer { flex: 1; }
.count { font-size: 13px; color: var(--ink-3); white-space: nowrap; }

/* ------------------------------------------------------------ 订单卡 */

.oc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s;
  position: relative;
}

.oc:hover { box-shadow: var(--shadow); }

.oc::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; }

.oc.status-pending::before { background: #f59e0b; }
.oc.status-confirmed::before { background: #3b82f6; }
.oc.status-producing::before { background: #8b5cf6; }
.oc.status-done::before { background: #10b981; }
.oc.status-canceled::before { background: #cbd5e1; }

.oc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 14px;
  padding: 13px 18px 13px 20px;
  background: #fbfcfc;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.oc-id { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.oc-id .no { font-weight: 600; color: var(--brand-dark); letter-spacing: .4px; font-size: 14.5px; }
.oc-id .time { color: var(--ink-3); font-size: 12.5px; }

.head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.head-right .type {
  font-size: 11.5px;
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: 6px;
  padding: 3px 9px;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------- 分段选择器（状态切换） */

.seg {
  display: flex;
  background: #eef0f5;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar { display: none; }

.seg-opt {
  flex: 1;
  min-width: max-content;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  font-weight: 500;
}

.seg-opt:hover:not(.on) { color: var(--brand); }

.seg-opt.on {
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ------------------------------------------------- 状态徽章 */

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.badge.pending { background: #fffbeb; color: #b45309; }
.badge.confirmed { background: #eff6ff; color: #1d4ed8; }
.badge.producing { background: #f5f3ff; color: #6d28d9; }
.badge.done { background: #ecfdf5; color: #047857; }
.badge.canceled { background: #f8fafc; color: #64748b; }



.oc-body { padding: 16px 18px 16px 20px; }

.oc-contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 9px 18px;
  margin-bottom: 15px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.contact-item { display: flex; align-items: baseline; gap: 7px; min-width: 0; }

.ck { font-size: 12px; color: var(--ink-3); flex-shrink: 0; width: 30px; }

.contact-item .nm { font-weight: 600; font-size: 14.5px; }
.contact-item .phone { font-size: 14px; color: var(--ink-2); letter-spacing: .3px; }
.contact-item .cv { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-item .cv.money { color: #b45309; font-weight: 600; }
.contact-item .cv.urgent { color: var(--danger); font-weight: 600; }
.contact-item .cv.overdue { color: var(--danger); font-weight: 600; }

.copy-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-3);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}

.copy-btn:hover { border-color: var(--brand); color: var(--brand); }

.oc-demand .demand {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
}

.note {
  margin-top: 13px;
  padding: 11px 14px;
  background: #f8fafc;
  border-left: 3px solid #93c5fd;
  border-radius: 0 7px 7px 0;
  font-size: 13px;
  color: #374151;
  white-space: pre-wrap;
  line-height: 1.7;
}

.note-k {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  background: rgba(232, 201, 106, .28);
  border-radius: 4px;
  padding: 1px 7px;
  margin-right: 8px;
  vertical-align: 1px;
}

.oc-status {
  padding: 12px 18px;
  background: var(--brand-lighter);
  border-top: 1px solid var(--line);
}

.oc-status-k {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-bottom: 7px;
  font-weight: 500;
}

.oc-foot {
  display: flex;
  gap: 8px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
  flex-wrap: wrap;
}

.oc-foot button {
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
}

.oc-foot button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-lighter); }
.oc-foot .danger:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

.empty { text-align: center; padding: 66px 20px; }
.empty-ic { font-size: 40px; margin-bottom: 14px; opacity: .5; }
.empty-t { font-size: 15.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.empty-s { font-size: 13px; color: var(--ink-3); }

/* ============================================================== 弹窗 */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 31, 40, .58);
  z-index: 200;
  overflow-y: auto;
  padding: 30px 16px;
}

.modal.show { display: flex; align-items: flex-start; justify-content: center; }

.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 800px;
  width: 100%;
  padding: 26px 28px 30px;
  margin: auto;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-head h3 { margin: 0; font-size: 17px; }

.modal-head button {
  border: none;
  background: var(--line-2);
  width: 31px;
  height: 31px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-2);
}

.modal-head button:hover { background: var(--line); }

.modal-h { margin: 22px 0 12px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.modal-h:first-child { margin-top: 0; }

.modal-imgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 13px;
}

.modal-imgs figure { margin: 0; }

.modal-imgs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
  display: block;
  transition: transform .15s;
}

.modal-imgs img:hover { transform: scale(1.03); }

.modal-imgs figcaption {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-files { list-style: none; margin: 0; padding: 0; }

.modal-files li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-2);
}

.modal-files li:last-child { border-bottom: none; }

.modal-files .fname {
  flex: 1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-files .fsize { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ============================================================ 口令区 */

.pwd-card { max-width: 560px; margin: 26px auto 0; padding: 22px 24px; }
.pwd-card h3 { margin: 0 0 15px; font-size: 15px; }
.pwd-card .row { display: flex; gap: 10px; flex-wrap: wrap; }

.pwd-card input {
  flex: 1;
  min-width: 150px;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pwd-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

/* ============================================================ 响应式 */

/* 平板：看板三列、图表单列 */
@media (max-width: 900px) {
  .stat-tiles { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: 1fr; }
}

/* 手机：核心断点。所有可点元素放大到 44px，手指才点得准 */
@media (max-width: 640px) {
  .wrap { padding: 0 14px 48px; }
  @supports (padding: max(0px)) {
    .wrap { padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }
  }
  .grid { grid-template-columns: 1fr; gap: 14px; }

  .topbar { padding: 28px 16px 24px; margin-bottom: 18px; }
  .topbar h1 { font-size: 21px; }
  .topbar p { font-size: 13.5px; }
  .topbar .shop { margin-top: 13px; padding-top: 12px; }
  .tb-row { gap: 14px; }
  .tb-link { padding: 10px 16px; font-size: 13px; display: inline-block; }

  .form-card { padding: 22px 16px; }
  .sec-title { margin: 26px 0 13px; font-size: 14.5px; }

  /* 表单控件放大 */
  .field input,
  .field select,
  .field textarea {
    font-size: 16px; /* 16px 可避免 iOS 聚焦时自动放大页面 */
    padding: 13px 14px;
    border-radius: 10px;
  }

  .field textarea { min-height: 130px; }

  .upload-box { padding: 30px 18px; }
  .upload-box .t1 { font-size: 14.5px; }

  .btn { height: 50px; font-size: 16px; padding: 0 26px; }
  .btn-block { width: 100%; margin-top: 22px; }

  /* 附件条目加大便于点按删除 */
  .chip { padding: 8px 9px 8px 14px; }
  .chip-thumb { width: 28px; height: 28px; }
  .chip-x { width: 26px; height: 26px; font-size: 15px; }

  .paste-tip { font-size: 12px; padding: 10px 12px; line-height: 1.6; }
  .paste-tip kbd { font-size: 12px; padding: 3px 8px; }

  .success { padding: 44px 20px; }
  .order-no-box { font-size: 19px; padding: 12px 22px; }

  .toast { bottom: 24px; padding: 13px 20px; font-size: 14.5px; width: max-content; max-width: 88vw; }

  /* ---------------- 后台 ---------------- */
  .stat-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-tile { padding: 14px 14px 13px; }
  .stat-value { font-size: 25px; }
  .stat-label { font-size: 12px; }

  .charts { grid-template-columns: 1fr; gap: 12px; }
  .chart-card { padding: 16px 16px 18px; }
  .chart-title { margin-bottom: 14px; }

  /* 工具栏：手机上改成上下两行铺开 */
  .admin-bar { padding: 12px; gap: 10px; }
  .search-wrap { flex: 1 0 100%; min-width: 0; }
  .admin-bar input[type="search"] { height: 44px; padding: 0 13px 0 36px; font-size: 16px; }
  .admin-bar select { flex: 1; height: 46px; font-size: 16px; }
  #filterStatus { font-size: 16px; }
  .admin-bar .spacer { display: none; }
  .admin-bar .count { order: 5; flex: 1 0 100%; text-align: center; padding-top: 2px; }
  .btn-sm { height: 46px; padding: 0 16px; font-size: 15px; }

  /* 订单卡：全部元素放大到手指可点 */
  .oc { border-radius: 10px; }
  .oc-head { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .oc-id { gap: 8px; }
  .oc-id .no { font-size: 14px; }
  .head-right { width: 100%; gap: 7px; flex-wrap: nowrap; }

  .head-right .type { max-width: none; flex: 1; overflow: hidden; text-overflow: ellipsis; }

  .oc-status { padding: 12px 14px; }

  /* 查询区手机端 */
  .query-card { padding: 18px 16px 20px; margin-top: 16px; }
  .tl-dot { width: 24px; height: 24px; font-size: 12px; margin-bottom: 6px; }
  .tl-label { font-size: 11px; }
  .qr-no { font-size: 15px; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); gap: 11px 14px; }
  .qr-item .v { font-size: 13.5px; }
  .success-acts .btn { flex: 1 0 100%; }
  .seg-opt { height: 44px; padding: 0 16px; font-size: 14px; display: flex; align-items: center; justify-content: center; }
  .badge { padding: 4px 9px; font-size: 11.5px; }

  .oc-body { padding: 14px; }
  .oc-contact { grid-template-columns: 1fr; gap: 9px; padding-bottom: 13px; }
  .contact-item { min-height: 26px; }
  .ck { width: 34px; font-size: 12.5px; }

  .copy-btn { height: 40px; min-width: 56px; padding: 0 14px; font-size: 13px; border-radius: 8px; }

    .admin-bar select, 
  .demand { font-size: 15px; line-height: 1.75; }

  .oc-foot { padding: 11px 14px; gap: 8px; }
  .oc-foot button {
    flex: 1;
    height: 42px;
    font-size: 13.5px;
    padding: 0 10px;
    white-space: nowrap;
  }
  /* 删除按钮在手机上占据整行，避免误触 */
  .oc-foot .danger { flex: 0 0 100%; color: var(--danger); border-color: #f0d5d2; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-box {
    border-radius: 16px 16px 0 0;
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
    max-height: 88vh;
    overflow-y: auto;
    margin: 0;
  }
  .modal-head { margin-bottom: 16px; }
  .modal-head button { width: 38px; height: 38px; font-size: 20px; }
  .modal-imgs { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
  .modal-files li { padding: 13px 0; gap: 10px; }
  .modal-files .fname { font-size: 13.5px; }
  .btn-mini { padding: 8px 15px; font-size: 13px; }

  .pwd-card { padding: 18px 16px; }
  .pwd-card .row { flex-direction: column; }
  .pwd-card input { width: 100%; min-width: 0; height: 46px; font-size: 16px; }
  .pwd-card .btn-sm { width: 100%; }

  .login-card { margin: 28px auto; padding: 30px 22px; }
  .login-card input { height: 46px; font-size: 16px; }
}

/* 超窄屏（iPhone SE 等） */
@media (max-width: 360px) {
  .wrap { padding: 0 10px 40px; }
  .topbar { padding: 24px 12px 20px; }
  .topbar h1 { font-size: 19px; }
  .stat-tiles { gap: 8px; }
  .stat-tile { padding: 12px 11px; }
  .stat-value { font-size: 23px; }
  .form-card { padding: 18px 13px; }
  .qd, .qp { height: 36px; font-size: 12.5px; padding: 0 11px; }
  .oc-foot button { font-size: 12.5px; padding: 0 6px; }
  .head-right { flex-wrap: wrap; }
}

/* 避免横屏时统计卡被压扁 */
@media (max-height: 480px) and (orientation: landscape) {
  .stat-tiles { grid-template-columns: repeat(5, 1fr); }
}
