/* ==========================================
 *  客服工单页样式
 *  - 移动端优先，桌面端居中展示
 * ========================================== */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    background: linear-gradient(180deg, #f6f8fb 0%, #eef1f6 100%);
    color: #222;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 40px;
    min-height: 100vh;
}

/* ---- 顶部进度条 ---- */
.topbar {
    padding: 24px 0 16px;
}
.topbar .title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 18px;
    color: #1a1a1a;
}
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    counter-reset: step;
}
.steps .step {
    flex: 1;
    text-align: center;
    position: relative;
    color: #aaa;
    font-size: 12px;
    cursor: default;
}
.steps .step + .step::before {
    content: "";
    position: absolute;
    top: 14px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: #d8dee8;
    z-index: 0;
}
.steps .step .dot {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    background: #d8dee8;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}
.steps .step .label {
    display: block;
    margin-top: 6px;
    font-weight: 500;
}
.steps .step.active .dot {
    background: #2e7cf6;
    box-shadow: 0 0 0 4px rgba(46, 124, 246, .15);
}
.steps .step.active { color: #2e7cf6; }
.steps .step.done .dot { background: #34c759; }
.steps .step.done + .step::before { background: #34c759; }

/* ---- 卡片容器 ---- */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 22px 20px 18px;
    box-shadow: 0 4px 18px rgba(15, 30, 60, .06);
    margin-bottom: 16px;
}
.card h2 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
}
.card .hint {
    margin: 0 0 16px;
    color: #888;
    font-size: 13px;
    line-height: 1.6;
}

/* ---- 步骤切换 ---- */
.step-pane { display: none; }
.step-pane.active { display: block; }

/* ---- 问题类型 ---- */
.problem-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.problem-grid .pt-item {
    border: 1.5px solid #e3e7ee;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    transition: all .15s ease;
    background: #fafbfd;
    user-select: none;
}
.problem-grid .pt-item:hover { border-color: #b9cdf6; }
.problem-grid .pt-item.selected {
    border-color: #2e7cf6;
    background: #eaf2ff;
    color: #2e7cf6;
    font-weight: 600;
}

/* ---- 输入框 ---- */
.text-input, .text-area {
    width: 100%;
    border: 1.5px solid #e3e7ee;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    background: #fafbfd;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}
.text-input:focus, .text-area:focus { border-color: #2e7cf6; background: #fff; }
.text-area { resize: vertical; min-height: 120px; }
.counter {
    text-align: right;
    color: #aaa;
    font-size: 12px;
    margin-top: 6px;
}

/* ---- 上传 ---- */
.upload-zone {
    border: 1.5px dashed #c5cfdc;
    border-radius: 12px;
    background: #fafbfd;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
}
.upload-zone:hover { border-color: #2e7cf6; background: #f1f6ff; }
.upload-zone.dragover { border-color: #2e7cf6; background: #e6f0ff; }
.upload-icon {
    width: 44px;
    height: 44px;
    line-height: 44px;
    border-radius: 50%;
    background: #e6eef9;
    color: #2e7cf6;
    font-size: 26px;
    margin: 0 auto 8px;
    font-weight: 300;
}
.upload-tip { color: #888; font-size: 13px; }

.thumb-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
}
.thumb-list li {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f2f5;
}
.thumb-list img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-list .del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}
.thumb-list .uploading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.6);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: #2e7cf6;
}

/* ---- 操作按钮 ---- */
.actions {
    display: flex;
    margin-top: 18px;
    gap: 10px;
}
.actions.right { justify-content: flex-end; }
.actions.between { justify-content: space-between; }
.btn {
    border: none;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
    transition: all .15s;
    min-width: 100px;
    font-family: inherit;
}
.btn.primary { background: #2e7cf6; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #2469e0; }
.btn.primary:disabled { background: #c5d6f5; cursor: not-allowed; }
.btn.ghost { background: #f0f2f5; color: #555; }
.btn.ghost:hover { background: #e4e7eb; }

/* ---- 确认页 ---- */
.preview {
    margin: 0;
    background: #fafbfd;
    border-radius: 10px;
    padding: 14px 16px;
}
.preview dt {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}
.preview dt:first-child { margin-top: 0; }
.preview dd {
    margin: 4px 0 0;
    font-size: 14px;
    color: #222;
    word-break: break-all;
    line-height: 1.5;
}
.preview .pv-images img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 6px;
    margin-top: 6px;
    border: 1px solid #e3e7ee;
}

/* ---- 提交成功 ---- */
.success { text-align: center; padding: 16px 0 8px; }
.success .check {
    width: 60px; height: 60px;
    line-height: 60px;
    border-radius: 50%;
    background: #34c759;
    color: #fff;
    font-size: 32px;
    margin: 0 auto 12px;
}
.success h2 { margin: 0 0 6px; font-size: 20px; }
.success p { margin: 4px 0; }
.success strong { color: #2e7cf6; font-size: 16px; }

/* ---- 聊天框 ---- */
.chatbox {
    margin-top: 22px;
    border-top: 1px solid #eef1f6;
    padding-top: 16px;
}
.chatbox h3 { font-size: 15px; margin: 0 0 10px; color: #555; }
.chat-list {
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}
.chat-msg {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.chat-msg.customer { align-items: flex-end; }
.chat-msg.agent    { align-items: flex-start; }
.chat-bubble {
    max-width: 75%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}
.chat-msg.customer .chat-bubble {
    background: #2e7cf6;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.agent .chat-bubble {
    background: #f1f3f7;
    color: #222;
    border-bottom-left-radius: 4px;
}
.chat-meta {
    font-size: 11px;
    color: #aaa;
    margin: 4px 6px 0;
}
.chat-msg .chat-images {
    margin-top: 6px;
    display: flex; flex-wrap: wrap; gap: 6px;
}
.chat-msg .chat-images img {
    width: 76px; height: 76px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e3e7ee;
}
.chat-status {
    margin-top: 8px;
    text-align: center;
    color: #aaa;
    font-size: 12px;
}
.chat-status.online { color: #34c759; }
.chat-status.offline { color: #ff6b3d; }

/* ---- 响应式 ---- */
@media (max-width: 480px) {
    .topbar .title { font-size: 18px; }
    .steps .step .label { font-size: 11px; }
    .card { padding: 18px 14px; }
    .problem-grid { grid-template-columns: 1fr; }
    .btn { min-width: 80px; padding: 10px 16px; }
}
