:root {
  --blue: #1e88f5;
  --blue-dark: #1272d6;
  --text: #22293a;
  --muted: #8a94a6;
  --line: #e6ebf2;
  --bg: #f2f4f7;
  --card: #ffffff;
  --req: #e5484d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 84px;
}

/* 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 14px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; text-align: center; font-size: 17px; font-weight: 600; margin: 0; }
.topbar .back {
  width: 34px; height: 34px; border: 0; background: transparent;
  font-size: 26px; line-height: 1; color: #333; cursor: pointer; padding: 0;
}
.topbar .query-link { color: var(--blue); font-size: 14px; text-decoration: none; white-space: nowrap; }

.page { max-width: 640px; margin: 0 auto; padding: 14px 12px 30px; }

/* 卡片区块 */
.block, .section-title + #items .item, .query-block {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(30, 50, 90, .05);
}
.block { padding: 4px 14px; margin-bottom: 12px; }
.field { padding: 12px 0; border-bottom: 1px solid var(--line); }
.block .field:last-child { border-bottom: 0; }
.field label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--req); margin-left: 2px; }
.opt { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }

input[type=text], input[type=tel], textarea, select {
  width: 100%; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 15px; color: var(--text); padding: 4px 0;
}
input::placeholder, textarea::placeholder { color: #b7bfcc; }
select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: #fff; appearance: none;
}
textarea { min-height: 64px; resize: vertical; }
.err { color: var(--req); font-size: 12.5px; margin: 4px 0 0; }

/* 分区标题（蓝色条） */
.section-title {
  background: var(--blue); color: #fff;
  font-size: 15px; font-weight: 600;
  padding: 9px 14px; border-radius: 8px 8px 0 0;
  margin: 18px 0 0;
}
#items .item { border-radius: 0; margin-bottom: 10px; padding: 4px 14px; }
#items .item .item-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0 4px;
}
#items .item .item-head b { color: var(--blue); font-size: 14px; }

.input-with-btn { display: flex; align-items: center; gap: 8px; }
.input-with-btn input { flex: 1; min-width: 0; }
.btn-scan {
  flex: 0 0 auto; border: 1px solid var(--blue); background: #eef6ff;
  color: var(--blue); font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-scan svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint-line { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

/* 图片上传 */
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; }
.photo-tile {
  width: 74px; height: 74px; border: 1px dashed #c9d3e2; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); position: relative; overflow: hidden; background: #fafbfe;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .add { font-size: 30px; line-height: 1; color: #b6c0d0; }
.photo-tile .rm {
  position: absolute; top: -1px; right: -1px; width: 20px; height: 20px;
  background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 0 0 0 6px;
  font-size: 13px; line-height: 20px; cursor: pointer; padding: 0;
}
.photo-input { display: none; }

.honeypot { position: absolute; left: -9999px; }
.form-alert {
  margin: 14px 0 0; padding: 10px 13px; border-radius: 9px;
  background: #fff1f2; border: 1px solid #ffd7da; color: #b42b38; font-size: 13.5px;
}
.form-alert.scan-ok { background: #e7f7ef; border-color: #bfe8d5; color: #0d7a52; }

.progress-wrap { margin-top: 14px; }
.progress-track { height: 7px; background: #e6ebf2; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.progress-text { font-size: 12px; color: var(--muted); margin: 5px 0 0; }

/* 底部按钮 */
.footer-actions { display: flex; gap: 12px; margin-top: 20px; }
.btn {
  border: 0; border-radius: 9px; font: inherit; font-size: 15px; font-weight: 600;
  padding: 11px 18px; cursor: pointer;
}
.btn.primary { flex: 1; background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.primary:disabled { opacity: .6; cursor: not-allowed; }
.btn.cancel { flex: 0 0 28%; background: #fff; color: #555; border: 1px solid var(--line); }
.btn-ghost { width: 100%; background: #f2f5fa; color: #3a465e; padding: 10px; margin-top: 8px; }
.spinner {
  display: inline-block; width: 14px; height: 14px; margin-left: 6px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 成功页 */
.success { text-align: center; padding: 50px 20px; background: #fff; border-radius: 12px; margin-top: 4px; }
.success-icon {
  width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 50%;
  background: #e7f7ef; display: flex; align-items: center; justify-content: center;
}
.success-icon svg { width: 38px; height: 38px; fill: none; stroke: #0d9e63; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.success h2 { font-size: 21px; margin: 0 0 8px; }
.success p { color: #6b7688; margin: 4px 0; }
.success .ticket { color: var(--text); font-weight: 600; margin-top: 16px; }
.success .ticket span { color: var(--blue); }
.success .ticket-sub { font-size: 12px; }
.success .btn { margin-top: 22px; width: 100%; }

/* 查询页 */
.query-block { padding: 16px 14px; }
.query-block label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.empty-state { text-align: center; color: var(--muted); padding: 54px 16px; }
.empty-state svg { width: 46px; height: 46px; fill: none; stroke: #c3ccda; stroke-width: 1.6; }
.empty-state p { font-size: 14px; }

.result-card { background: #fff; border-radius: 12px; padding: 16px; margin-top: 12px; box-shadow: 0 1px 4px rgba(30,50,90,.05); }
.result-card .rc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.result-card .rc-head b { font-size: 16px; }
.tag { display: inline-block; border-radius: 6px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.st-pending { background: #fff4e0; color: #9a6700; }
.st-repairing { background: #e8f0ff; color: #2542ad; }
.st-fixed { background: #e7f7ef; color: #0d7a52; }
.st-rejected { background: #fff1f2; color: #b42b38; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 6px 14px; margin: 0 0 10px; }
.kv div { font-size: 13.5px; }
.kv dt { display: inline; color: var(--muted); }
.kv dd { display: inline; margin: 0 0 0 6px; word-break: break-all; }
.msg { background: #f8fafc; border-radius: 9px; padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; margin: 10px 0; }
.cause-box { background: #eef7ff; border: 1px solid #cfe4ff; border-radius: 9px; padding: 12px; margin: 12px 0; }
.cause-box h4 { margin: 0 0 6px; font-size: 14px; color: #1272d6; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.thumbs figure { margin: 0; }
.thumbs img { width: 82px; height: 82px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumbs figcaption { font-size: 11px; color: var(--muted); text-align: center; }
.group-title { font-size: 13px; font-weight: 600; color: #6b7688; margin: 12px 0 4px; }

/* 扫码弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 16px; width: 100%; max-width: 400px; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 17px; margin: 0; }
.modal-close { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: #666; }
.scan-view { position: relative; margin: 14px 0 8px; aspect-ratio: 1; background: #0f1729; border-radius: 10px; overflow: hidden; }
.scan-view.hidden { display: none; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 2px solid #4ade80; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(15,23,42,.25); }
.scan-status { font-size: 13.5px; color: #3a465e; margin: 6px 0; }
.scan-status.error { color: #b42b38; }
.scan-tip { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.scan-alt { margin-top: 8px; }

@media (max-width: 620px) {
  .page { padding: 10px 10px 24px; }
  .topbar { height: 48px; }
}
