/* 四班一件事 - 全局样式 */
:root {
    --primary: #1a5fb4;
    --primary-dark: #14478a;
    --primary-light: #e8f0fe;
    --success: #1a7f37;
    --warning: #b35900;
    --danger: #c62828;
    --info: #006688;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }

/* 顶部栏 */
.topbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 16px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar h1 { font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.topbar .subtitle { font-size: 12px; opacity: .85; margin-top: 2px; }
.topbar .back-btn {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: #fff; font-size: 14px; background: rgba(255,255,255,.15);
    border: none; padding: 6px 14px; border-radius: 6px; cursor: pointer;
}

/* 容器 */
.container { max-width: 640px; margin: 0 auto; padding: 16px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 14px;
}
.card-title {
    font-size: 16px; font-weight: 600; margin-bottom: 14px;
    padding-bottom: 10px; border-bottom: 2px solid var(--primary-light);
    display: flex; align-items: center; gap: 8px;
}
.card-title::before {
    content: ''; display: inline-block; width: 4px; height: 18px;
    background: var(--primary); border-radius: 2px;
}

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 24px; border-radius: 8px; border: none;
    font-size: 15px; font-weight: 500; cursor: pointer;
    transition: all .2s; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: #e67e22; color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-label .required { color: var(--danger); }
.form-control, select, textarea {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 15px; background: #fff;
    transition: border-color .2s; font-family: inherit;
}
.form-control:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,95,180,.1);
}
.form-control[readonly] { background: #f9fafb; color: var(--text-secondary); }
textarea { resize: vertical; min-height: 100px; }

/* 徽章 */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 500;
}
.badge-warning { background: #fef3cd; color: var(--warning); }
.badge-info { background: #cffafe; color: var(--info); }
.badge-success { background: #d1fae5; color: var(--success); }
.badge-danger { background: #fee2e2; color: var(--danger); }

/* 选项卡片（首页两个大按钮） */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.action-card {
    background: #fff; border-radius: var(--radius); padding: 30px 20px;
    text-align: center; cursor: pointer; box-shadow: var(--shadow);
    transition: all .2s; border: 2px solid transparent;
}
.action-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.action-card .icon { font-size: 40px; margin-bottom: 10px; }
.action-card .label { font-size: 17px; font-weight: 600; color: var(--text); }
.action-card .desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* 信息列表 */
.info-list { list-style: none; }
.info-list li {
    display: flex; justify-content: space-between; padding: 10px 0;
    border-bottom: 1px solid var(--border); font-size: 14px;
}
.info-list li:last-child { border-bottom: none; }
.info-list .label { color: var(--text-secondary); }
.info-list .value { font-weight: 500; }

/* 工单列表 */
.ticket-item {
    background: #fff; border-radius: var(--radius); padding: 16px;
    margin-bottom: 12px; box-shadow: var(--shadow); cursor: pointer;
    transition: all .2s; position: relative;
}
.ticket-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.ticket-item .ticket-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; padding-right: 80px; }
.ticket-item .ticket-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.ticket-item .ticket-status { position: absolute; top: 14px; right: 14px; }

/* 聊天区域 */
.chat-container {
    display: flex; flex-direction: column; height: calc(100vh - 200px);
    min-height: 400px;
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    background: var(--bg); border-radius: var(--radius);
    margin-bottom: 12px;
}
.chat-msg { margin-bottom: 14px; display: flex; flex-direction: column; }
.chat-msg.right { align-items: flex-end; }
.chat-msg .msg-bubble {
    max-width: 75%; padding: 10px 14px; border-radius: 12px;
    font-size: 14px; word-break: break-word;
}
.chat-msg.left .msg-bubble { background: #fff; border-bottom-left-radius: 4px; }
.chat-msg.right .msg-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg .msg-name { font-size: 11px; color: var(--text-secondary); margin-bottom: 3px; }
.chat-msg .msg-time { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.chat-msg img.msg-img {
    max-width: 200px; max-height: 200px; border-radius: 8px; display: block;
    cursor: pointer;
}
.chat-input-bar {
    display: flex; gap: 8px; align-items: flex-end;
}
.chat-input-bar input[type=text] {
    flex: 1; padding: 11px 14px; border: 1px solid var(--border);
    border-radius: 24px; font-size: 14px;
}
.chat-input-bar input[type=file] { display: none; }
.chat-input-bar .attach-btn {
    width: 42px; height: 42px; border-radius: 50%;
    background: #fff; border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; flex-shrink: 0;
}

/* 图片上传预览 */
.img-preview-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.img-preview-item { position: relative; width: 80px; height: 80px; }
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.img-preview-item .remove-img {
    position: absolute; top: -6px; right: -6px;
    width: 20px; height: 20px; background: var(--danger); color: #fff;
    border-radius: 50%; font-size: 12px; display: flex;
    align-items: center; justify-content: center; cursor: pointer;
}
.upload-zone {
    border: 2px dashed var(--border); border-radius: 8px;
    padding: 20px; text-align: center; color: var(--text-secondary);
    cursor: pointer; font-size: 14px;
}

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
    background: #fff; border-radius: var(--radius); padding: 18px;
    box-shadow: var(--shadow); text-align: center;
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* 表格（后台） */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td {
    padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
table.data-table th { background: var(--primary-light); font-weight: 600; color: var(--primary-dark); }
table.data-table tr:hover td { background: #f9fafb; }

/* 提示页 */
.error-page {
    text-align: center; padding: 60px 20px;
}
.error-page .icon { font-size: 60px; margin-bottom: 16px; }
.error-page h2 { font-size: 20px; color: var(--danger); margin-bottom: 10px; }
.error-page p { color: var(--text-secondary); font-size: 14px; }

/* 图片展示 */
.ticket-images { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ticket-images img {
    width: 100px; height: 100px; object-fit: cover; border-radius: 8px;
    cursor: pointer; border: 1px solid var(--border);
}

/* 状态时间线 */
.timeline { padding-left: 20px; border-left: 2px solid var(--border); margin: 14px 0; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
    content: ''; position: absolute; left: -26px; top: 4px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}

/* 响应式 - 桌面端后台 */
@media (min-width: 768px) {
    .action-grid { grid-template-columns: 1fr 1fr; max-width: 480px; margin-left: auto; margin-right: auto; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
