:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --line: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

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

/* 关键：自定义 display 会覆盖 UA 的 [hidden]{display:none}，必须显式声明 */
[hidden] { display: none !important; }

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

button, input, select, textarea { font-family: inherit; font-size: 15px; color: inherit; }

/* ---------- 登录页 ---------- */
.login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background: radial-gradient(120% 120% at 15% 10%, #1e3a8a 0%, #0f172a 55%, #020617 100%);
}
.orbs { position: absolute; inset: 0; pointer-events: none; }
.orbs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
}
.orbs .o1 { width: 380px; height: 380px; background: #2563eb; top: -110px; left: -80px; animation: float1 14s ease-in-out infinite; }
.orbs .o2 { width: 320px; height: 320px; background: #7c3aed; bottom: -100px; right: -60px; animation: float2 17s ease-in-out infinite; }
.orbs .o3 { width: 260px; height: 260px; background: #06b6d4; top: 45%; right: 15%; animation: float1 21s ease-in-out infinite reverse; }
@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 32px) scale(1.12); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-46px, -28px) scale(1.08); }
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 22px;
  padding: 34px 30px 26px;
  box-shadow: 0 26px 60px rgba(2, 6, 23, .5), 0 2px 8px rgba(2, 6, 23, .2);
  animation: cardIn .45s cubic-bezier(.2, .8, .3, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.lc-head { text-align: center; margin-bottom: 24px; }
.lc-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  box-shadow: 0 10px 24px rgba(79, 70, 229, .38);
}
.lc-logo svg { width: 30px; height: 30px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: .5px; }
.lc-sub { margin: 0; color: var(--text-3); font-size: 13px; }

.lc-err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 13px;
  margin-bottom: 14px;
}

.lc-inp { position: relative; margin-bottom: 13px; }
.lc-inp .ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  color: var(--text-3);
  pointer-events: none;
  transition: .18s;
}
.lc-inp input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 43px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #f8fafc;
  outline: none;
  transition: .18s;
}
.lc-inp input::placeholder { color: #a5b0c0; }
.lc-inp input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, .14);
}
.lc-inp:focus-within .ico { color: var(--primary); }
.lc-eye {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lc-eye:hover { background: #eef2f7; color: var(--text-2); }
.lc-eye svg { width: 18px; height: 18px; }

.lc-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  margin: 2px 0 18px;
  cursor: pointer;
  user-select: none;
}
.lc-remember input { width: 16px; height: 16px; accent-color: var(--primary); }

.lc-btn {
  position: relative;
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 60%, #7c3aed 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(79, 70, 229, .32);
  transition: .18s;
}
.lc-btn:hover:not(:disabled) { transform: translateY(-1.5px); box-shadow: 0 14px 28px rgba(79, 70, 229, .42); }
.lc-btn:active:not(:disabled) { transform: translateY(0) scale(.99); }
.lc-btn:disabled { opacity: .8; cursor: progress; }
.lc-btn .txt { transition: .18s; }
.lc-btn.loading .txt { opacity: 0; }
.lc-btn.loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 19px;
  height: 19px;
  margin: -9.5px 0 0 -9.5px;
  border: 2.2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lc-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.lc-foot b { color: var(--text-2); font-weight: 600; }

@media (max-width: 480px) {
  .login-page { padding: 16px; align-items: flex-start; padding-top: 8vh; }
  .login-card { padding: 28px 20px 22px; border-radius: 18px; }
  .lc-logo { width: 54px; height: 54px; border-radius: 15px; }
  .lc-logo svg { width: 26px; height: 26px; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 18px; font-size: 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; margin-right: auto; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); }
.conn { display: flex; gap: 6px; }
.pill {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.on { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.pill.off { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* ---------- 步骤条 ---------- */
.steps {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.step {
  flex: 1 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.step.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.step.done { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.step .s { display: none; }

main { padding: 14px 16px 100px; max-width: 1180px; margin: 0 auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { margin: 16px 0 8px; font-size: 14px; }
.hint { color: var(--text-3); font-size: 12.5px; margin: 4px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .lbl { font-size: 13px; color: var(--text-2); margin-right: 2px; align-self: center; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.filters { display: grid; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-row input[type="search"], .filter-row input[type="date"], .filter-row input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  outline: none;
}

/* ---------- 订单列表 ---------- */
.order-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  cursor: pointer;
  transition: .15s;
}
.order-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37, 99, 235, .12); }
.order-card.done { background: #f0fdf4; border-color: #bbf7d0; }
.order-card .r1 { display: flex; align-items: center; gap: 8px; }
.order-card .who { font-weight: 600; }
.order-card .phone { color: var(--text-3); font-size: 13px; font-weight: 400; margin-left: 6px; }
.order-card .r2 { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.order-card .r3 { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: var(--text-2); }
.tag.st-待统计 { background: #fff7ed; color: #c2410c; }
.tag.st-已统计 { background: #eff6ff; color: #1d4ed8; }
.tag.st-已审核 { background: #ecfdf5; color: #047857; }
.tag.st-不统计 { background: #f3f4f6; color: #6b7280; }
.tag.s-已完结 { background: #ecfdf5; color: #047857; }
.tag.s-维修完成 { background: #eff6ff; color: #1d4ed8; }
.tag.s-排队等候 { background: #fefce8; color: #a16207; }
.tag.s-维修中, .tag.s-等待配件 { background: #fff7ed; color: #c2410c; }
.tag.s-待付款, .tag.s-待取货 { background: #fdf2f8; color: #be185d; }
.empty { text-align: center; color: var(--text-3); padding: 28px 0; font-size: 14px; }

/* ---------- 详情挑选 ---------- */
.detail-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.detail-head .no { font-weight: 700; font-size: 16px; }
.detail-head .meta { color: var(--text-3); font-size: 12.5px; }
.edit-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 12px; }
.edit-grid .full { grid-column: 1 / -1; }
.edit-grid label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.edit-grid input, .edit-grid textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  outline: none;
}
.edit-grid input:focus, .edit-grid textarea:focus { border-color: var(--primary); background: #fff; }

.photo-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); margin-top: 10px; }
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: linear-gradient(100deg, #e8edf5 30%, #f6f9fc 50%, #e8edf5 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
  cursor: pointer;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .28s; }
.photo-item img.on { opacity: 1; }
@keyframes shimmer { to { background-position: -120% 0; } }
.photo-item.sel { border-color: var(--primary); }
.photo-item .num {
  position: absolute;
  left: 4px;
  top: 4px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.photo-item .check {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .45);
  color: #fff;
  font-size: 13px;
  display: none;
  align-items: center;
  justify-content: center;
}
.photo-item.sel .check { display: flex; background: var(--primary); }
.photo-item .zoom {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(15, 23, 42, .5);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox .lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .5);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
}

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}

/* ---------- 队列 ---------- */
.queue-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: #fff;
  align-items: flex-start;
}
.queue-item .info { flex: 1; min-width: 0; }
.queue-item .t1 { font-weight: 600; }
.queue-item .t2 { color: var(--text-2); font-size: 13px; margin-top: 3px; word-break: break-all; }
.queue-item .t3 { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.thumbs { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.thumbs img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumbs .more { width: 46px; height: 46px; border-radius: 8px; background: #f1f5f9; color: var(--text-2); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.status-tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: var(--text-2); }
.status-tag.已推送 { background: #dcfce7; color: #15803d; }
.status-tag.失败 { background: #fee2e2; color: #b91c1c; }
.status-tag.待推送 { background: #fff7ed; color: #c2410c; }

/* ---------- 抽屉 ---------- */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100%);
  background: #fff;
  z-index: 41;
  overflow-y: auto;
  padding: 16px 16px 80px;
  box-shadow: -8px 0 24px rgba(15, 23, 42, .12);
}
.drawer h2 { margin: 0 0 4px; font-size: 17px; }
.drawer .grp { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
.drawer .grp legend, .drawer .grp .gt { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.drawer .row { display: grid; gap: 4px; margin-bottom: 9px; }
.drawer .row label { font-size: 12.5px; color: var(--text-2); }
.drawer .row input, .drawer .row select {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  outline: none;
  width: 100%;
}
.drawer .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.drawer-actions { display: flex; gap: 8px; margin-top: 16px; position: sticky; bottom: 0; background: #fff; padding: 12px 0 20px; border-top: 1px solid var(--line); }

details.fold { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #f8fafc; }
details.fold summary { cursor: pointer; font-size: 14px; font-weight: 600; }
details.fold[open] summary { margin-bottom: 8px; }
details.fold .grp { border: 0; padding: 0; margin-top: 8px; background: transparent; }

pre.code {
  margin: 0;
  padding: 11px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 320px;
  overflow-y: auto;
}

/* 推送预览：人读形式的字段列表 */
dl.summary { margin: 0; }
dl.summary .sum-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
dl.summary .sum-row:last-child { border-bottom: 0; padding-bottom: 0; }
dl.summary .sum-row:first-child { padding-top: 0; }
dl.summary dt { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
dl.summary dd {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}
.thumbs-lg { margin-top: 10px; }
.thumbs-lg img { width: 78px; height: 78px; }

/* 推送前与平台A 的核对结果 */
.ok-line { color: #15803d; font-size: 13.5px; font-weight: 600; padding: 4px 0; }
.warn-line { color: #b45309; font-size: 13.5px; font-weight: 600; padding: 4px 0; }
.diffbox { margin-top: 10px; }
.diff-list { margin-top: 8px; }
.diff-row {
  display: grid;
  grid-template-columns: 88px 1fr 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.diff-row:last-child { border-bottom: 0; }
.diff-row .dl { color: var(--text-2); }
.diff-row .dv { word-break: break-all; }
.diff-row .old { color: #b91c1c; text-decoration: line-through; }
.diff-row .new { color: #15803d; }
label.pick {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 0;
  font-size: 13.5px;
  cursor: pointer;
}
/* 编辑队列项抽屉：输入框沿用详情挑选区的观感，选中态复用 .photo-item.sel */
.drawer input[type="text"],
.drawer textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  outline: none;
  margin-top: 8px;
}
.drawer textarea { resize: vertical; }
.drawer input[type="text"]:focus,
.drawer textarea:focus { border-color: var(--primary); background: #fff; }
.drawer .photo-item.sel .check { display: flex; }

.res-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  padding: 5px 0;
  font-size: 13.5px;
}
.res-row span { color: var(--text-2); font-size: 12.5px; }
@media (max-width: 480px) {
  .diff-row { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 480px) {
  dl.summary .sum-row { grid-template-columns: 1fr; gap: 2px; }
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  max-width: 86vw;
  text-align: center;
}
#toast.show { opacity: 1; bottom: 100px; }

@media (max-width: 768px) {
  main { padding: 12px 12px 110px; }
  .topbar { padding: 9px 12px; }
  .brand { font-size: 15px; }
  .steps { padding: 8px 12px; gap: 5px; overflow-x: visible; }
  .step { flex: 1 1 0; min-width: 0; font-size: 12px; padding: 7px 3px; text-align: center; }
  .step .f { display: none; }
  .step .s { display: inline; }
  .order-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
  /* 搜索 / 日期 / 查询 各占一行，避免控件被压变形 */
  .filter-row input[type="search"] { flex: 1 1 100%; }
  .filter-row input[type="date"] { flex: 1 1 0; min-width: 118px; }
  .filter-row .date-sep { flex: 0 0 auto; color: var(--text-3); }
  .filter-row #loadBtn { flex: 1 1 100%; }
  .conn { display: none; }
  .conn-mobile { display: flex !important; gap: 6px; padding: 8px 12px 0; background: #fff; }
}
.conn-mobile { display: none; }
