/* 工单系统 H5 - 全局样式 (移动端优先) */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #f5f6f8; color: #1f2937; font-size: 14px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; cursor: pointer; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }
img { display: block; }

/* ===== 顶部导航 ===== */
.gd-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 48px; display: flex; align-items: center; justify-content: center;
  background: #fff; border-bottom: 1px solid #eee; font-size: 16px; font-weight: 600;
}
.gd-nav .back {
  position: absolute; left: 8px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #333;
}
.gd-nav .right {
  position: absolute; right: 8px; display: flex; align-items: center;
}
.gd-nav .right .link { padding: 6px 10px; font-size: 13px; color: #2563eb; font-weight: 400; }
.gd-nav .right .link.danger { color: #dc2626; }
.gd-nav .badge {
  position: absolute; top: 6px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  background: #ef4444; color: #fff; border-radius: 8px; font-size: 10px; line-height: 16px; text-align: center;
}

/* ===== 页面容器 ===== */
.gd-page { padding: 56px 12px 24px; max-width: 480px; margin: 0 auto; min-height: 100vh; }
.gd-page.no-nav { padding-top: 16px; }

/* ===== 卡片 ===== */
.gd-card {
  background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

/* ===== 表单 ===== */
.gd-field { margin-bottom: 14px; }
.gd-field label { display: block; font-size: 13px; color: #6b7280; margin-bottom: 6px; }
.gd-field label .req { color: #ef4444; margin-left: 2px; }
.gd-input, .gd-textarea, .gd-select {
  width: 100%; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px;
  background: #fff; color: #1f2937;
}
.gd-input:focus, .gd-textarea:focus, .gd-select:focus { border-color: #2563eb; }
.gd-textarea { resize: none; min-height: 110px; }

/* 验证码行 */
.gd-captcha-row { display: flex; gap: 8px; }
.gd-captcha-row .gd-input { flex: 1; }
.gd-captcha-row img { width: 100px; height: 40px; border-radius: 8px; border: 1px solid #e5e7eb; cursor: pointer; }

/* 优先级单选 */
.gd-priority { display: flex; gap: 10px; }
.gd-priority label {
  flex: 1; text-align: center; padding: 9px 0; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 13px; cursor: pointer;
}
.gd-priority input { display: none; }
.gd-priority label.on { border-color: #2563eb; color: #2563eb; background: #eff6ff; font-weight: 600; }
.gd-priority label.on[data-p="3"] { border-color: #ef4444; color: #ef4444; background: #fef2f2; }
.gd-priority label.on[data-p="1"] { border-color: #10b981; color: #10b981; background: #ecfdf5; }

/* 图片上传 */
.gd-uploader { display: flex; flex-wrap: wrap; gap: 10px; }
.gd-uploader .item { position: relative; width: 74px; height: 74px; border-radius: 8px; overflow: hidden; }
.gd-uploader .item img { width: 100%; height: 100%; object-fit: cover; }
.gd-uploader .item .del {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; line-height: 20px; text-align: center;
}
.gd-uploader .add {
  width: 74px; height: 74px; border: 1px dashed #cbd5e1; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #94a3b8; font-size: 24px;
}
.gd-uploader .add span { font-size: 11px; }

/* ===== 按钮 ===== */
.gd-btn {
  display: block; width: 100%; padding: 12px; border-radius: 8px; font-size: 15px; font-weight: 600;
  background: #2563eb; color: #fff; text-align: center;
}
.gd-btn:active { opacity: .85; }
.gd-btn.ghost { background: #fff; color: #2563eb; border: 1px solid #2563eb; }
.gd-btn.gray { background: #e5e7eb; color: #4b5563; }
.gd-btn[disabled] { opacity: .55; }
.gd-btn-danger { background: #ef4444; }
.gd-btn-sm { display: inline-block; width: auto; padding: 7px 16px; font-size: 13px; border-radius: 6px; }

/* ===== 首页 ===== */
.gd-hero {
  background: linear-gradient(135deg, #2563eb, #1d4ed8); border-radius: 12px; padding: 22px 18px; color: #fff; margin-bottom: 14px;
}
.gd-hero h1 { font-size: 20px; margin-bottom: 4px; }
.gd-hero p { font-size: 13px; opacity: .85; }
.gd-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.gd-stats .s {
  flex: 1; background: #fff; border-radius: 10px; padding: 12px 10px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.gd-stats .s b { display: block; font-size: 20px; }
.gd-stats .s span { font-size: 11px; color: #9ca3af; }

.gd-menu { display: flex; gap: 10px; }
.gd-menu .m {
  flex: 1; background: #fff; border-radius: 10px; padding: 16px 10px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.gd-menu .m .ico { font-size: 26px; margin-bottom: 6px; }
.gd-menu .m span { font-size: 13px; color: #4b5563; }

/* ===== 工单列表 ===== */
.gd-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.gd-tabs .tab {
  flex-shrink: 0; padding: 6px 14px; border-radius: 16px; background: #fff; font-size: 13px; color: #6b7280;
  border: 1px solid #e5e7eb;
}
.gd-tabs .tab.on { background: #2563eb; color: #fff; border-color: #2563eb; }

.gd-ticket {
  background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.gd-ticket .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gd-ticket .head .no { font-size: 12px; color: #9ca3af; flex: 1; }
.gd-ticket .head .st { font-size: 12px; padding: 2px 8px; border-radius: 10px; color: #fff; }
.gd-ticket .head .st.timeout { background: #7f1d1d !important; }
.gd-ticket .title { font-size: 15px; font-weight: 600; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gd-ticket .meta { display: flex; gap: 12px; font-size: 12px; color: #9ca3af; }
.gd-ticket .meta .tag { color: #2563eb; }

/* ===== 详情页 ===== */
.gd-detail-top { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.gd-detail-top .no { font-size: 12px; color: #9ca3af; margin-bottom: 4px; }
.gd-detail-top h2 { font-size: 17px; margin-bottom: 8px; }
.gd-detail-top .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.gd-detail-top .tags .t { font-size: 12px; padding: 2px 10px; border-radius: 10px; background: #f3f4f6; color: #4b5563; }
.gd-detail-top .tags .t.st { color: #fff; }
.gd-detail-top .timeout-bar { margin-top: 10px; font-size: 12px; color: #b91c1c; background: #fef2f2; padding: 6px 10px; border-radius: 6px; }

/* 时间线 */
.gd-timeline { background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.gd-timeline h3 { font-size: 14px; margin-bottom: 10px; color: #374151; }
.gd-timeline .tl-item { position: relative; padding-left: 16px; padding-bottom: 12px; }
.gd-timeline .tl-item:before { content: ''; position: absolute; left: 3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #2563eb; }
.gd-timeline .tl-item:after { content: ''; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: #e5e7eb; }
.gd-timeline .tl-item:last-child:after { display: none; }
.gd-timeline .tl-item .t { font-size: 13px; color: #374151; }
.gd-timeline .tl-item .d { font-size: 11px; color: #9ca3af; }

/* 对话 */
.gd-chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 70px; }
.gd-bubble { display: flex; gap: 8px; }
.gd-bubble.mine { flex-direction: row-reverse; }
.gd-bubble .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; background: #94a3b8;
}
.gd-bubble.mine .avatar { background: #2563eb; }
.gd-bubble .body { max-width: 75%; }
.gd-bubble .name { font-size: 11px; color: #9ca3af; margin-bottom: 3px; text-align: left; }
.gd-bubble.mine .name { text-align: right; }
.gd-bubble .box {
  background: #fff; border-radius: 10px; padding: 9px 12px; font-size: 14px; word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.gd-bubble.mine .box { background: #2563eb; color: #fff; }
.gd-bubble.mine .box img {}
.gd-bubble .box .img-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gd-bubble .box .img-list img { width: 90px; height: 90px; object-fit: cover; border-radius: 6px; }
.gd-bubble .time { font-size: 11px; color: #cbd5e1; text-align: center; margin-top: 2px; }
.gd-bubble.sys .box { background: #f3f4f6; color: #6b7280; font-size: 12px; margin: 0 auto; text-align: center; }

/* 底部输入栏 */
.gd-chatbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; border-top: 1px solid #eee; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 8px;
}
.gd-chatbar textarea {
  flex: 1; border: 1px solid #e5e7eb; border-radius: 18px; padding: 8px 14px; max-height: 90px; min-height: 38px;
  resize: none; line-height: 20px;
}
.gd-chatbar .ico-btn { width: 38px; height: 38px; border-radius: 50%; background: #f3f4f6; font-size: 18px; display: flex; align-items: center; justify-content: center; color: #4b5563; }
.gd-chatbar .send { background: #2563eb; color: #fff; border-radius: 18px; padding: 8px 18px; font-size: 14px; font-weight: 600; }

/* 图片预览遮罩 */
.gd-viewer {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.9); display: none;
  align-items: center; justify-content: center;
}
.gd-viewer.show { display: flex; }
.gd-viewer img { max-width: 96%; max-height: 90%; border-radius: 6px; }
.gd-viewer .x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; font-size: 20px; }

/* 连接状态条 */
.gd-ws-bar {
  display: none; text-align: center; font-size: 11px; color: #d97706; background: #fffbeb;
  padding: 4px; border-radius: 6px; margin-bottom: 8px;
}
.gd-ws-bar.show { display: block; }

/* ===== 消息页 ===== */
.gd-msg {
  background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
  display: flex; gap: 10px; align-items: flex-start;
}
.gd-msg .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; margin-top: 6px; flex-shrink: 0; }
.gd-msg .dot.read { background: transparent; }
.gd-msg .cnt { flex: 1; }
.gd-msg .cnt .t { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.gd-msg .cnt .c { font-size: 13px; color: #6b7280; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gd-msg .cnt .d { font-size: 11px; color: #9ca3af; margin-top: 4px; }

/* ===== 通用 ===== */
.gd-empty { text-align: center; color: #9ca3af; padding: 60px 0; font-size: 13px; }
.gd-empty .ico { font-size: 40px; margin-bottom: 10px; }
.gd-loading { text-align: center; color: #9ca3af; padding: 14px; font-size: 12px; }
.gd-toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-8px); z-index: 300;
  background: rgba(17,24,39,.85); color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13px;
  opacity: 0; transition: all .25s; pointer-events: none; max-width: 80%;
}
.gd-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.gd-toast.err { background: rgba(220,38,38,.92); }
.gd-footer { text-align: center; color: #cbd5e1; font-size: 11px; padding: 20px 0 8px; }
