/* ==========================================================================
   工单登记 / 查询系统样式
   版式对齐企业微信收集表：浅蓝底 + 顶部插画 + 白色圆角卡片
   ========================================================================== */

:root {
  --bg-top: #cfe4fa;
  --bg: #c9dff7;
  --card: #ffffff;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #9aa0a6;
  --line: #e8eaed;
  --border: #e0e2e6;
  --primary: #2b7ce5;
  --primary-hover: #1f6bd0;
  --danger: #f54a45;
  --radius: 4px;
  --radius-card: 10px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 420px, var(--bg) 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ 顶部 */

.banner {
  position: relative;
  height: 178px;
  overflow: hidden;
}

/* 卡片上移，压住插画底部，还原收集表视觉 */
.banner:not(.banner-sm) + .wrap {
  margin-top: -34px;
  position: relative;
  z-index: 2;
}

.banner-art {
  position: absolute;
  left: 50%;
  top: 14px;
  width: 640px;
  height: 148px;
  transform: translateX(-50%);
  pointer-events: none;
}

/* 查询页 / 成功页使用的矮版顶部 */
.banner-sm {
  height: 84px;
}

.banner-sm .top-nav {
  right: 50%;
  transform: translateX(50%);
  top: 22px;
}

.top-nav {
  position: absolute;
  right: 24px;
  top: 16px;
  z-index: 3;
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.top-nav a {
  color: #2c5f96;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.72);
  padding: 5px 12px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}

.top-nav a:hover {
  background: #fff;
}

/* ------------------------------------------------------------------ 卡片 */

.wrap {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 0 12px 40px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 28px 24px 26px;
  box-shadow: 0 2px 12px rgba(31, 45, 61, 0.04);
}

.card h1 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.notice {
  margin: 0;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-3);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0 22px;
}

/* ------------------------------------------------------------------ 表单 */

.field {
  margin-bottom: 22px;
}

.label {
  display: block;
  font-size: 13px;
  line-height: 20px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 400;
}

.label.required::before {
  content: '*';
  color: var(--danger);
  margin-right: 2px;
}

.input,
.textarea {
  width: 100%;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 7px 10px;
  line-height: 20px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input {
  height: 34px;
}

.input::placeholder,
.textarea::placeholder {
  color: #c1c5cb;
}

.input:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(43, 124, 229, 0.1);
}

.input.error,
.textarea.error {
  border-color: var(--danger);
}

.textarea {
  resize: none;
  min-height: 34px;
  max-height: 200px;
  overflow-y: auto;
}

.field-error {
  display: none;
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
}

.field-error.show {
  display: block;
}

/* ------------------------------------------------------------------ 单选 */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-top: 2px;
}

.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 20px;
  color: var(--text);
  user-select: none;
}

.radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio .dot {
  width: 16px;
  height: 16px;
  border: 1px solid #c9ccd1;
  border-radius: 50%;
  flex: 0 0 16px;
  position: relative;
  transition: border-color 0.15s;
  background: #fff;
}

.radio input:checked + .dot {
  border-color: var(--primary);
  border-width: 5px;
}

.radio:hover .dot {
  border-color: var(--primary);
}

/* -------------------------------------------------------------- 上传区域 */

.upload {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f7f8f9;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  padding: 10px;
}

.upload:hover,
.upload.dragover {
  border-color: var(--primary);
  background: #f2f7fe;
}

.upload-hint {
  font-size: 13px;
  color: var(--text-3);
  pointer-events: none;
}

/* 手机端拍照 / 相册两个入口 */
.upload-acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.upload-act {
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 9px 14px;
  border-radius: 18px;
  border: 1px solid var(--primary);
  color: var(--primary);
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.upload-act:active {
  background: #e9f2fe;
}

.upload-pick {
  border-color: var(--border);
  color: var(--text-2);
}

/* 已经有图片时，入口收进缩略图网格（+ 与 📷 两个格子） */
.upload.has-items .upload-acts {
  display: none;
}

.upload-add-cam {
  font-size: 20px;
}

.upload input[type='file'] {
  display: none;
}

.upload.has-items {
  display: block;
  padding: 12px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
  width: 100%;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  background: #eef0f2;
  border: 1px solid var(--line);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb .del {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.upload-add {
  aspect-ratio: 1;
  border: 1px dashed #c9ccd1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #b9bec5;
  background: #fff;
  cursor: pointer;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
}

.file-item .fi-icon {
  flex: 0 0 16px;
  color: var(--primary);
}

.file-item .fi-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.file-item .fi-size {
  color: var(--text-3);
  font-size: 12px;
}

.file-item .del {
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px;
  line-height: 1;
}

.file-item .del:hover {
  color: var(--danger);
}

.upload-loading {
  font-size: 12px;
  color: var(--primary);
  margin-top: 6px;
}

/* ------------------------------------------------------------------ 按钮 */

.submit-bar {
  margin-top: 28px;
}

.btn {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-ghost:hover {
  background: #f2f7fe;
}

.foot-link {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-2);
}

.foot-link a {
  color: var(--primary);
  text-decoration: none;
}

/* ------------------------------------------------------------------ 查询 */

.query-box {
  display: flex;
  gap: 8px;
}

.query-box .input {
  flex: 1;
}

.query-box .btn {
  width: 96px;
  flex: 0 0 96px;
  height: 34px;
  font-size: 14px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 14px;
  font-size: 13px;
  color: var(--text-2);
}

/* 读表通道未接通时的说明条，避免客户把初始状态当成最新进度 */
.result-warn {
  margin: -6px 0 14px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff8e6;
  color: #a8730a;
  font-size: 12px;
  line-height: 1.6;
}

.ticket {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
}

.ticket-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.ticket-no {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* 系统上线前登记的历史工单没有工单号 */
.ticket-no.is-history {
  font-size: 12px;
  font-weight: 400;
  color: #9aa1a9;
}

.ticket-unit {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 6px;
}

.badge {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  line-height: 16px;
}

.badge.s-pending {
  background: #fff4e5;
  color: #d97706;
}
.badge.s-doing {
  background: #e8f2ff;
  color: #2b7ce5;
}
.badge.s-done {
  background: #e7f7ee;
  color: #16a34a;
}
.badge.s-closed {
  background: #f0f1f2;
  color: #8b9096;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.ticket-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-remark {
  margin-top: 10px;
  background: #f7f8f9;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
}

.ticket-remark b {
  color: var(--text);
  font-weight: 500;
}

/* 客服填写的解决方案，视觉上比普通备注更突出 */
.ticket-solution {
  margin-top: 10px;
  background: #f1f8f3;
  border-left: 3px solid #57b77a;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-solution b {
  color: #2f7a4d;
  font-weight: 500;
}

.ticket-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ticket-files a {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  background: #f2f7fe;
  padding: 4px 10px;
  border-radius: 4px;
}

.ticket-files a:hover {
  background: #e6f0fd;
}

/* 附件在企微里存在、但没有可下载链接时，只展示文件名 */
.ticket-files .file-locked {
  font-size: 12px;
  color: var(--text-2);
  background: #f5f6f7;
  padding: 4px 10px;
  border-radius: 4px;
}

.ticket-files .file-locked em {
  font-style: normal;
  color: var(--text-3);
  margin-left: 4px;
}

/* 客户上传的图片：小缩略图，与文件附件同一量级，点击看原图 */
.ticket-images {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ticket-images-label {
  font-size: 12px;
  color: var(--text-3);
  margin: 0;
  flex: none;
}

.shot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 查询页的图片缩略图：尺寸与文件附件标签同一量级，点击看原图
   类名与登记页的 .thumb 区分开，避免覆盖上传框的布局 */
.shot {
  display: block;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #f7f8f9;
  flex: none;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.empty {
  text-align: center;
  padding: 44px 0;
  color: var(--text-3);
  font-size: 13px;
}

.empty-icon {
  font-size: 30px;
  display: block;
  margin-bottom: 10px;
  opacity: 0.5;
}

.loading-text {
  text-align: center;
  padding: 30px 0;
  color: var(--text-3);
  font-size: 13px;
}

/* ------------------------------------------------------------------ 成功 */

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e7f7ee;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 8px auto 18px;
}

.success-title {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}

.success-desc {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 22px;
  line-height: 1.7;
}

.no-box {
  background: #f7f8f9;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  margin-bottom: 22px;
}

.no-box .k {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.no-box .v {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 6px;
  z-index: 999;
  max-width: 80vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.show {
  opacity: 1;
}

/* ------------------------------------------------------------------ 移动端 */

@media (max-width: 640px) {
  .banner {
    height: 132px;
  }
  .banner:not(.banner-sm) + .wrap {
    margin-top: -26px;
  }
  .banner-sm {
    height: 66px;
  }
  .banner-sm .top-nav {
    top: 14px;
  }
  .banner-art {
    top: 6px;
    width: 400px;
    height: 116px;
  }
  .top-nav {
    right: 10px;
    top: 10px;
    font-size: 12px;
  }
  .top-nav a {
    padding: 4px 10px;
  }
  .wrap {
    padding: 0 10px 30px;
  }
  .card {
    padding: 22px 16px 22px;
    border-radius: 8px;
  }
  .card h1 {
    font-size: 16px;
  }
  .upload {
    min-height: 120px;
  }
}
