/* ============ 基础样式 H5+PC 自适应 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px; line-height: 1.5; color: #333;
    background: #f5f6f8; min-height: 100vh;
}
a { color: #1976d2; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea {
    font-family: inherit; font-size: inherit; outline: none;
}

/* ============ 布局 ============ */
.container { max-width: 960px; margin: 0 auto; padding: 16px; }
.page-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: #222; }

/* ============ 顶部导航 ============ */
.top-bar {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.top-bar .top-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-bar .brand { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.top-bar .brand .icon { font-size: 20px; }
.top-bar nav a { color: rgba(255,255,255,0.9); padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.top-bar nav a:hover, .top-bar nav a.active { background: rgba(255,255,255,0.15); text-decoration: none; }
.top-bar .user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.top-bar .user-info .role-badge {
    background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 10px; font-size: 11px;
}

/* ============ 卡片 ============ */
.card {
    background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title { font-size: 16px; font-weight: 600; }

/* ============ 表单 ============ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; color: #555; font-weight: 500; font-size: 13px; }
.form-group label .req { color: #e74c3c; margin-left: 2px; }
.form-control {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
    background: #fff; transition: border-color 0.2s;
}
.form-control:focus { border-color: #1976d2; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23999' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

/* ============ 按钮 ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border: none; border-radius: 8px; cursor: pointer;
    font-weight: 500; transition: all 0.2s; text-decoration: none; font-size: 14px;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: #1976d2; color: #fff; }
.btn-success { background: #27ae60; color: #fff; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-danger  { background: #e74c3c; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #ddd; color: #555; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ============ 状态标签 ============ */
.status-tag {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 500; color: #fff;
}

/* ============ 工单列表 ============ */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-item {
    background: #fff; border-radius: 10px; padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; cursor: pointer; transition: transform 0.15s;
}
.ticket-item:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.ticket-item .ticket-main { flex: 1; min-width: 0; }
.ticket-item .ticket-no { font-size: 13px; color: #999; margin-bottom: 4px; font-family: monospace; }
.ticket-item .ticket-well { font-size: 16px; font-weight: 600; color: #222; margin-bottom: 4px; }
.ticket-item .ticket-desc { color: #666; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-item .ticket-meta { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: #999; }
.ticket-item .ticket-right { text-align: right; flex-shrink: 0; }
.ticket-item .ticket-right .time { font-size: 12px; color: #999; margin-top: 4px; }

/* ============ 工单详情 ============ */
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.detail-row:last-child { border-bottom: none; }
.detail-row .label { width: 90px; color: #888; flex-shrink: 0; font-size: 13px; }
.detail-row .value { flex: 1; color: #333; word-break: break-all; }

.timeline { margin-top: 16px; }
.timeline-item {
    position: relative; padding-left: 28px; padding-bottom: 18px;
    border-left: 2px solid #e0e0e0; margin-left: 6px;
}
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item::before {
    content: ''; position: absolute; left: -7px; top: 2px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #1976d2; border: 2px solid #fff; box-shadow: 0 0 0 1px #1976d2;
}
.timeline-item.pending::before    { background: #f39c12; box-shadow: 0 0 0 1px #f39c12; }
.timeline-item.processing::before { background: #3498db; box-shadow: 0 0 0 1px #3498db; }
.timeline-item.completed::before  { background: #9b59b6; box-shadow: 0 0 0 1px #9b59b6; }
.timeline-item.accepted::before   { background: #27ae60; box-shadow: 0 0 0 1px #27ae60; }
.timeline-item.rejected::before   { background: #e74c3c; box-shadow: 0 0 0 1px #e74c3c; }

.timeline-item .t-title { font-weight: 600; color: #333; font-size: 14px; }
.timeline-item .t-time  { color: #999; font-size: 12px; margin-top: 2px; }
.timeline-item .t-body  { color: #666; font-size: 13px; margin-top: 6px; }

/* ============ 图片上传 ============ */
.image-uploader { display: flex; flex-wrap: wrap; gap: 8px; }
.image-uploader .preview-item {
    width: 80px; height: 80px; border-radius: 8px; overflow: hidden; position: relative;
    background: #f0f0f0;
}
.image-uploader .preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-uploader .preview-item .remove {
    position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
    background: rgba(0,0,0,0.6); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; cursor: pointer; border: none;
}
.image-uploader .upload-btn {
    width: 80px; height: 80px; border: 1px dashed #ccc; border-radius: 8px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #999; cursor: pointer; gap: 4px; font-size: 12px; background: #fafafa;
}
.image-uploader .upload-btn:hover { border-color: #1976d2; color: #1976d2; }
.image-uploader .upload-btn .plus { font-size: 24px; line-height: 1; }
.image-uploader input[type=file] { display: none; }

/* 图片预览 */
.thumb-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb-grid .thumb {
    width: 70px; height: 70px; border-radius: 6px; overflow: hidden;
    cursor: pointer; background: #f0f0f0;
}
.thumb-grid .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ============ 登录/注册 ============ */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 16px;
}
.auth-box {
    width: 100%; max-width: 380px; background: #fff; border-radius: 14px;
    padding: 32px 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.auth-box h1 { text-align: center; margin-bottom: 6px; font-size: 22px; color: #333; }
.auth-box .subtitle { text-align: center; color: #999; font-size: 13px; margin-bottom: 24px; }
.auth-box .form-group { margin-bottom: 16px; }
.auth-box .btn-primary { width: 100%; padding: 12px; font-size: 15px; }
.auth-box .switch-link { text-align: center; margin-top: 16px; font-size: 13px; color: #888; }

/* ============ 提示消息 ============ */
.msg {
    padding: 10px 14px; border-radius: 8px; margin-bottom: 12px;
    font-size: 14px;
}
.msg-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.msg-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.msg-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ============ 筛选栏 ============ */
.filter-bar {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
.filter-bar .form-control { padding: 8px 10px; font-size: 13px; width: auto; min-width: 0; flex: 1; }

/* ============ 统计卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
    background: #fff; border-radius: 10px; padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-card .s-label { color: #888; font-size: 13px; margin-bottom: 6px; }
.stat-card .s-value { font-size: 26px; font-weight: 700; color: #222; }
.stat-card .s-sub   { color: #999; font-size: 12px; margin-top: 4px; }

/* ============ 分布条形图 ============ */
.stats-two-col { display: block; }
@media (min-width: 700px) { .stats-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } }
.dist-row { margin-bottom: 14px; }
.dist-head { display: flex; justify-content: space-between; font-size: 13px; color: #444; margin-bottom: 6px; }
.dist-bar { height: 8px; background: #eef0f5; border-radius: 4px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 4px; min-width: 2px; }
.dist-bar.green i { background: linear-gradient(90deg, #10b981, #34d399); }
.dist-link { color: #4f46e5; text-decoration: none; font-weight: 600; }
.dist-link:hover { text-decoration: underline; }
.dist-bar-link { display: block; text-decoration: none; }

/* ============ 状态标签页 ============ */
.tab-bar { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; -webkit-overflow-scrolling: touch; }
.tab-item { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; background: #fff; color: #555; text-decoration: none; font-size: 14px; border: 1px solid #e8eaf0; }
.tab-item.active { background: var(--tab-color, #4f46e5); color: #fff; border-color: transparent; font-weight: 600; }
.tab-count { background: rgba(0,0,0,0.06); border-radius: 9px; padding: 0 7px; font-size: 12px; }
.tab-item.active .tab-count { background: rgba(255,255,255,0.25); color: #fff; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td {
    padding: 10px 8px; text-align: left; border-bottom: 1px solid #eee;
}
table.data-table th { background: #f8f9fa; color: #555; font-weight: 600; }
table.data-table tr:hover td { background: #f8fbff; }

/* ============ 空状态 ============ */
.empty-state { text-align: center; padding: 40px 20px; color: #999; }
.empty-state .icon { font-size: 48px; margin-bottom: 8px; }

/* ============ 模态框 ============ */
.modal-mask {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75); z-index: 999;
    display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal-mask img { max-width: 100%; max-height: 90vh; border-radius: 6px; }

/* ============ 底部操作栏 ============ */
.action-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; padding: 12px 16px; display: flex; gap: 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08); z-index: 90;
    max-width: 960px; margin: 0 auto;
}
.action-bar .btn { flex: 1; }
.has-action-bar { padding-bottom: 70px; }

/* ============ 响应式 ============ */
@media (max-width: 600px) {
    .container { padding: 12px; }
    .top-bar nav { display: none; }
    .top-bar nav.open {
        display: flex; flex-direction: column; position: absolute;
        top: 100%; left: 0; right: 0; background: #1565c0;
        padding: 8px; gap: 2px;
    }
    .top-bar nav.open a { padding: 10px 12px; }
    .detail-row .label { width: 80px; font-size: 12px; }
    .ticket-item { padding: 12px; }
    .stat-card { padding: 12px; }
    .stat-card .s-value { font-size: 22px; }
}
