/* ============================================================
 * DCC 客服跟单系统 — 全局样式
 * 所有页面共用，禁止在各页面重复定义
 * ============================================================ */

:root {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --primary-light: #E3F2FD;
    --bg: #F5F7FA;
    --white: #fff;
    --border: #E8E8E8;
    --text: #333;
    --text-secondary: #777;
    --text-muted: #aaa;
    --success: #4CAF50;
    --success-light: #E8F5E9;
    --danger: #F44336;
    --danger-light: #FFEBEE;
    --warning: #FF9800;
    --warning-light: #FFF3E0;
    --purple: #7C3AED;
    --purple-light: #EDE9FE;
    --radius: 8px;
    --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

/* ====== Topbar (客服工作台用) ====== */
.topbar { background: linear-gradient(135deg, #1565C0 0%, #2196F3 100%); color: white; height: 56px; display: flex; align-items: center; padding: 0 24px; gap: 16px; }
.topbar .logo { font-size: 18px; font-weight: 500; }
.topbar .nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar .nav a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 14px; }
.topbar .nav a:hover, .topbar .nav a.active { color: #fff; }
.topbar-link { background: rgba(255,255,255,0.15); padding: 3px 12px; border-radius: 6px; color: #fff !important; font-size: 13px; font-weight: 500; line-height: 1; display: inline-flex; align-items: center; }
.topbar-link:hover { background: rgba(255,255,255,0.25) !important; }

/* ====== Layout ====== */
.layout-h { display: flex; height: 100vh; }
.sidebar { width: 220px; min-width: 220px; background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.main-content { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; }
.content-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; margin-top: 14px; }

/* ====== Nav Item ====== */
.nav-item { text-decoration: none; }
.nav-item:hover { background: #F8FAFC !important; color: var(--text) !important; }
.nav-item.active { background: var(--primary-light) !important; color: var(--primary-dark) !important; border-left-color: var(--primary) !important; font-weight: 500; }

/* ====== Cards ====== */
.card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px 24px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.card-header { font-size: 15px; font-weight: 500; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; color: var(--text); }

/* ====== KPI Cards ====== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px 24px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.kpi-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.kpi-value { font-size: 32px; font-weight: 600; }
.kpi-change { font-size: 12px; margin-top: 6px; }
.kpi-change.up { color: var(--success); }

/* ====== Tables ====== */
.data-table { width: 100%; font-size: 14px; border-collapse: collapse; table-layout: fixed; }
.data-table th { text-align: left; color: var(--text); font-weight: 600; padding: 12px 10px; background: #DBEAFE; border-bottom: 2px solid var(--border); font-size: 13px; white-space: nowrap; }
.data-table td { padding: 12px 10px; border-bottom: 1px solid #F0F0F0; font-size: 14px; }
.data-table tr:hover td { background: #F0F5FF; }
.data-table .link { color: var(--primary); cursor: pointer; text-decoration: none; }
.data-table .link:hover { text-decoration: underline; }

/* ====== Form ====== */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.form-input, .form-select { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; outline: none; color: var(--text); background: var(--white); transition: border-color .2s; }
.form-input:focus, .form-select:focus { border-color: var(--primary); }
textarea.form-input { min-height: 80px; resize: vertical; }

/* ====== Buttons ====== */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 18px; border-radius: var(--radius); font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--white); color: var(--text); transition: all .2s; text-decoration: none; font-weight: 500; }
.btn:hover { border-color: var(--primary-dark); color: var(--primary-dark); }
.btn-primary { background: var(--primary); color: #fff; border: none; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.data-table .btn-sm { margin-right: 4px; }
.data-table .btn-sm:last-child { margin-right: 0; }
.data-table td:last-child { white-space: nowrap; }
.btn-link { border: none; background: none; color: var(--primary); padding: 0; }

/* ====== Badges ====== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-processing { background: var(--primary-light); color: var(--primary-dark); }
.badge-resolved { background: var(--success-light); color: #2E7D32; }
.badge-archived { background: #F5F5F5; color: #999; }
.badge-presale { background: var(--primary-light); color: var(--primary-dark); }
.badge-order { background: var(--success-light); color: #2E7D32; }
.badge-followup { background: #EDE9FE; color: #5B21B6; }
.badge-complaint { background: var(--danger-light); color: #C62828; }
.badge-paid { background: var(--primary-light); color: var(--primary-dark); }
.badge-unpaid { background: #F5F5F5; color: #999; }

/* ====== Chat ====== */
.chat-area { display: flex; flex-direction: column; background: #F8FAFC; flex: 1; min-width: 0; }
.chat-header { background: var(--white); padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; }
.chat-area .chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #F8FAFC; }
.msg { display: flex; flex-direction: column; max-width: 75%; }
/* 消息名称+时间头部 */
.msg-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; padding: 0 4px; }
.msg-sender { font-size: 11px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.msg-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
/* 消息气泡体 */
.msg-body { padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6; word-break: break-all; }
/* 客服工作台 - 客户消息 */
.msg-customer { align-self: flex-start; }
.msg-customer .msg-body { background: var(--white); border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--text); }
.msg-customer .msg-header { justify-content: flex-start; }
/* 客服工作台 - 客服消息 */
.msg-agent { align-self: flex-end; }
.msg-agent .msg-body { background: var(--primary-light); color: #1565C0; border-bottom-right-radius: 4px; }
.msg-agent .msg-header { justify-content: flex-end; }
/* 系统消息 */
.msg-system { background: var(--warning-light); border: 1px solid #FFCC80; align-self: center; font-size: 12px; color: #E65100; text-align: center; max-width: 90%; padding: 6px 12px; border-radius: var(--radius); }
.chat-input-area { background: var(--white); padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.chat-input-area input { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; outline: none; }
.chat-input-area input:focus { border-color: var(--primary); }

/* ====== Workspace Layout ====== */
.workspace { display: flex; flex: 1; overflow: hidden; }
.workspace-left { width: 200px; background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.workspace-center { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.workspace-right { width: 280px; background: var(--white); border-left: 1px solid var(--border); overflow-y: auto; flex-shrink: 0; }
.panel-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; }

/* ====== Filter Bar ====== */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; background: var(--white); padding: 12px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 140px; padding: 8px 12px; font-size: 14px; }
.filter-bar .form-input { min-width: 220px; }

/* ====== Pagination ====== */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 14px; font-size: 13px; }
.pagination span { color: var(--text-secondary); }
.pagination button { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--white); cursor: pointer; font-size: 13px; color: var(--text); }
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ====== Modal ====== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--white); border-radius: var(--radius-lg); padding: 24px; min-width: 400px; max-width: 600px; box-shadow: 0 8px 30px rgba(0,0,0,0.15); }
.modal-title { font-size: 16px; font-weight: 500; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ====== Toast ====== */
.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 20px; border-radius: var(--radius); font-size: 13px; color: #fff; animation: fadeIn .3s; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ====== Utility ====== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-14 { margin-top: 14px; }
.mb-14 { margin-bottom: 14px; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ====== Info Row ====== */
.info-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.info-row .label { color: var(--text-secondary); }

/* ====== Home page ====== */
.page-home { max-width: 800px; margin: 0 auto; padding: 60px 24px; text-align: center; }
.page-home h1 { font-size: 28px; color: var(--primary-dark); margin-bottom: 8px; }
.page-home .subtitle { color: var(--text-secondary); margin-bottom: 40px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.home-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 28px 20px; text-decoration: none; color: var(--text); transition: all .2s; display: block; }
.home-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(33,150,243,.1); }
.home-card h3 { font-size: 16px; margin: 12px 0 8px; }
.home-card p { font-size: 13px; color: var(--text-secondary); }
.home-card-icon { font-size: 32px; }

/* ====== Empty State ====== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* ====== Detail Panel ====== */
.detail-panel { position: fixed; top: 0; right: 0; width: 480px; height: 100%; background: var(--white); border-left: 1px solid var(--border); z-index: 500; transform: translateX(100%); transition: transform .3s; }
.detail-panel.show { transform: translateX(0); }

/* ====== customer-chat 官网浮窗 ====== */
.site-page { background: #fff; }
.site-header { background: linear-gradient(135deg, #1565C0 0%, #2196F3 100%); color: #fff; padding: 0 48px; height: 64px; display: flex; align-items: center; gap: 16px; }
.site-header .slogo { width: 40px; height: 40px; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; color: var(--primary); }
.site-header .sname { font-size: 20px; font-weight: 500; }
.site-header .snav { margin-left: auto; display: flex; gap: 32px; }
.site-header .snav a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 14px; }
.site-header .snav a:hover, .site-header .snav a.active { color: #fff; }
.hero { padding: 80px 48px 60px; background: linear-gradient(180deg, #E3F2FD 0%, #fff 100%); }
.hero h1 { font-size: 36px; color: #1565C0; margin-bottom: 12px; }
.hero p { font-size: 18px; color: #666; line-height: 1.8; }
.scontent { padding: 48px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.svc { background: #fff; border-radius: 12px; border: 1px solid var(--border); padding: 32px 24px; }
.svc h3 { font-size: 18px; margin-bottom: 8px; }
.svc p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.svc-icon { font-size: 32px; margin-bottom: 12px; }
.fbtn { position: fixed; bottom: 24px; right: 24px; width: 60px; height: 60px; border-radius: 50%; background: var(--primary); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: 0 4px 16px rgba(33,150,243,0.4); z-index: 999; }
.fbtn:hover { transform: scale(1.05); }
.fbtn .badge-dot { position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; background: var(--danger); color: #fff; font-size: 10px; font-weight: bold; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.cpopup { position: fixed; bottom: 96px; right: 24px; width: 400px; height: 520px; background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,0.15); display: none; flex-direction: column; overflow: hidden; z-index: 999; }
.cpopup.open { display: flex; }
.ctop { background: linear-gradient(135deg, #1565C0 0%, #2196F3 100%); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.ctop .cav { width: 36px; height: 36px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--primary); font-weight: bold; }
.ctop .cinfo { flex: 1; }
.ctop .cname { font-size: 14px; font-weight: 500; }
.ctop .ctag { font-size: 11px; opacity: 0.8; }
.ctop .cclose { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.2); border: none; cursor: pointer; color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.cmsgs { flex: 1; overflow-y: auto; padding: 12px; background: #F8FAFC; display: flex; flex-direction: column; gap: 8px; }
.cinput { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 6px; align-items: center; background: #fff; }
.cinput input { flex: 1; border: none; outline: none; font-size: 13px; padding: 6px 0; }
.cinput .cfile { width: 30px; height: 30px; border-radius: 6px; background: #F5F5F5; border: none; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; color: #999; }
.cinput .csend { width: 36px; height: 36px; border-radius: 8px; background: var(--primary); border: none; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; color: #fff; }
.typing { display: flex; gap: 4px; padding: 8px 12px; background: #fff; border-radius: 12px; border: 1px solid var(--border); align-self: flex-start; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #BBB; animation: tp 1.4s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tp { 0%,60%,100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
.qa { display: flex; gap: 6px; flex-wrap: wrap; }
.qa button { padding: 4px 12px; border-radius: 14px; border: 1px solid var(--border); background: #fff; font-size: 11px; cursor: pointer; color: var(--text); }
.qa button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.qa button.transfer { color: var(--danger); border-color: var(--danger); }
.fpreview { display: flex; align-items: center; gap: 6px; background: var(--primary-light); border-radius: 6px; padding: 6px 8px; font-size: 11px; }
.fpreview .ficon { width: 28px; height: 28px; border-radius: 4px; background: #1565C0; color: #fff; font-size: 9px; font-weight: bold; display: flex; align-items: center; justify-content: center; }

/* ====== agent-workspace ====== */
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4CAF50; }
.badge-count { background: rgba(255,255,255,0.2); padding: 2px 10px; border-radius: 10px; font-size: 12px; line-height: 1; }
.t-item { padding: 10px 12px; border-radius: 6px; cursor: pointer; margin-bottom: 2px; border: 1px solid transparent; transition: all .2s; font-size: 12px; }
.t-item:hover { background: #F8FAFC; border-color: var(--border); }
.t-item.active { background: var(--primary-light); border-color: var(--primary); }
/* 会话未读角标 */
.sidebar-count { background: var(--danger); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 8px; margin-left: 6px; font-weight: 500; }
.t-code { font-size: 11px; color: var(--primary-dark); font-weight: bold; }
.t-company { font-weight: 500; }
.t-meta { color: var(--text-secondary); font-size: 11px; display: flex; gap: 6px; }
/* 会话tab切换 */
.session-tab { flex: 1; padding: 8px 0; border: none; background: none; font-size: 13px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: all .2s; }
.session-tab:hover { color: var(--text); }
.session-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.date-divider { text-align: center; color: var(--text-secondary); font-size: 12px; padding: 8px 0; }
.preview-card { background: #FFF8E1; border: 1px solid #FFCC80; border-radius: 8px; padding: 12px; }
.pr { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 0; color: #5D4037; }

/* ====== History & Detail ====== */
#historyPanel.open { display: flex !important; }
.timeline { border-left: 2px solid var(--border); padding-left: 16px; margin-left: 8px; }
.timeline-item { position: relative; padding: 8px 0 16px 12px; }
.timeline-item::before { content: ""; position: absolute; left: -21px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline-item .t-time { font-size: 11px; color: var(--text-muted); }
.timeline-item .t-content { font-size: 13px; margin-top: 2px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }

/* ====== Login ====== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #E3F2FD 0%, #F5F7FA 100%); }
.login-box { background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); padding: 40px; width: 380px; }
.login-box h2 { font-size: 22px; font-weight: 500; color: var(--primary-dark); margin-bottom: 4px; text-align: center; }
.login-box .sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; text-align: center; }
.login-tab { flex:1;text-align:center;padding:10px 0;text-decoration:none;color:var(--text-secondary);font-size:14px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .2s; }
.login-tab:hover { color:var(--text); }
.login-tab.active { color:var(--primary);border-bottom-color:var(--primary);font-weight:500; }
.login-box .form-group { margin-bottom: 18px; }
.login-box .form-input { padding: 10px 14px; font-size: 15px; }
.login-box .btn { width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; }
.login-box .hint { font-size: 12px; color: var(--text-muted); margin-top: 14px; text-align: center; line-height: 1.8; }

/* ====== Ticket Detail ====== */
.detail-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.detail-header .back { text-decoration: none; color: var(--text-secondary); font-size: 18px; }
.detail-body { padding: 20px; display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.detail-main { min-width: 0; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.timeline { border-left: 2px solid var(--border); padding-left: 16px; margin-left: 8px; }
.timeline-item { position: relative; padding: 8px 0 16px 12px; }
.timeline-item::before { content: ''; position: absolute; left: -21px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline-item .t-time { font-size: 11px; color: var(--text-muted); }
.timeline-item .t-content { font-size: 13px; margin-top: 2px; }
.attachment-list { display: flex; flex-direction: column; gap: 6px; }
.attachment-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.attachment-item .a-icon { width: 28px; height: 28px; border-radius: 4px; background: var(--primary); color: #fff; font-size: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.attachment-item .a-info { flex: 1; }
.attachment-item .a-name { font-weight: 500; }
.attachment-item .a-meta { color: var(--text-muted); font-size: 11px; }
.chat-preview { background: #F8FAFC; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; max-height: 300px; overflow-y: auto; font-size: 13px; }

/* ====== Admin Topbar ====== */
.admin-topbar { height: 50px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 16px; flex-shrink: 0; }
.admin-topbar .t-logo { font-size: 16px; font-weight: 500; color: var(--primary-dark); }
.admin-topbar .t-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.admin-topbar .t-role { padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--primary-light); color: var(--primary-dark); }
.admin-topbar .t-logout { color: var(--danger); text-decoration: none; font-size: 12px; cursor: pointer; }

/* ====== Sidebar Submenu ====== */
.sidebar { display: flex; flex-direction: column; overflow-y: auto; }
.nav-group { border-bottom: 1px solid #F0F0F0; }
.nav-group-title { padding: 10px 18px 6px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.nav-sub .nav-item { padding-left: 32px; font-size: 13px; }




/* ====== Sidebar Width ====== */
.layout-h { display: flex; height: 100vh; }

/* ====== Chat Messages ====== */
.chat-wrap { display: flex; flex-direction: column; height: 100vh; }
.chat-topbar { background: linear-gradient(135deg, #1565C0 0%, #2196F3 100%); color: #fff; padding: 12px 20px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.chat-topbar .av { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 500; }
.chat-topbar .btns { margin-left: auto; display: flex; gap: 8px; }
.chat-topbar .btns button { border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.15); color: #fff; padding: 5px 14px; border-radius: 16px; font-size: 12px; cursor: pointer; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-input-bar { padding: 10px 16px; border-top: 1px solid var(--border); background: #fff; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.chat-input-bar input { flex: 1; border: 1px solid var(--border); border-radius: 20px; padding: 10px 16px; font-size: 14px; outline: none; }
.chat-input-bar input:focus { border-color: var(--primary); }
.chat-input-bar button { background: var(--primary); color: #fff; border: none; border-radius: 20px; padding: 10px 20px; font-size: 14px; cursor: pointer; }

/* ====== Workspace Layout ====== */
.workspace { display: flex; flex: 1; overflow: hidden; }
.workspace-left { width: 240px; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.workspace-right { width: 420px; background: #fff; border-left: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; padding: 14px; }
.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.chat-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; flex-shrink: 0; }
.chat-input-area { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; background: #fff; }
.chat-input-area input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; outline: none; }
.chat-input-area input:focus { border-color: var(--primary); }

.session-item { padding: 12px; border-bottom: 1px solid #F5F5F5; cursor: pointer; transition: background .15s; }
.session-item:hover { background: #F8FAFC; }
.session-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); padding-left: 9px; }
.session-unread { display: inline-block; background: var(--danger); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 8px; min-width: 18px; text-align: center; }

.panel-section { margin-bottom: 16px; }
.panel-section:last-child { margin-bottom: 0; }
.panel-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.info-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.info-row .label { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.flex-gap-8 { display: flex; gap: 8px; }

/* ====== IM 浮窗 ====== */
.chat-widget { position: fixed; bottom: 20px; right: 20px; z-index: 1000; }
.chat-toggle { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 24px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(33,150,243,.3); transition: transform .2s; position: relative; }
.chat-toggle:hover { transform: scale(1.05); }
.chat-toggle .badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 11px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.chat-popup { position: fixed; bottom: 90px; right: 20px; width: 380px; height: 540px; background: #fff; border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.12); flex-direction: column; overflow: hidden; display: none; }
.chat-popup.open { display: flex; }
.chat-top { background: var(--primary); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.chat-top .avatar { width: 38px; height: 38px; border-radius: 8px; background: #fff; color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 16px; }
.chat-top .name { font-weight: 500; font-size: 15px; }
.chat-top .tag { font-size: 11px; opacity: .8; }
.chat-top .close { margin-left: auto; background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #F8FAFC; }
/* 浮窗消息 — 复用 .msg / .msg-header / .msg-body 框架，仅覆盖气泡样式 */
/* 客户消息（右侧蓝色） */
.chat-messages .msg.user { align-self: flex-end; max-width: 80%; }
.chat-messages .msg.user .msg-body { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-messages .msg.user .msg-header { justify-content: flex-end; }
/* 客服/bot 消息（左侧白色） */
.chat-messages .msg.bot { align-self: flex-start; max-width: 80%; }
.chat-messages .msg.bot .msg-body { background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-messages .msg.bot .msg-header { justify-content: flex-start; }
/* 浮窗系统消息 */
.chat-messages .msg.system { background: #F0F0F0; color: var(--gray); font-size: 12px; padding: 6px 12px; border-radius: 10px; align-self: center; }
/* 会话关闭分隔线 */
.chat-divider { text-align: center; padding: 12px 8px; color: var(--text-muted); font-size: 12px; position: relative; margin: 8px 0; }
.chat-divider::before, .chat-divider::after { content: ''; display: block; border-top: 1px dashed var(--border); margin: 6px 0; }
.typing-indicator { display: flex; gap: 4px; padding: 8px 0; }
.typing-indicator span { width: 8px; height: 8px; border-radius: 50%; background: #ccc; animation: bounce 1.4s infinite both; }
.typing-indicator span:nth-child(2) { animation-delay: .2s; }
.typing-indicator span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,80%,100% { transform: scale(0); } 40% { transform: scale(1); } }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.quick-btn { padding: 6px 14px; border-radius: 16px; border: 1px solid var(--primary); background: #fff; color: var(--primary); font-size: 13px; cursor: pointer; }
.quick-btn.transfer { background: var(--primary); color: #fff; }
.quick-btn:hover { opacity: .85; }
.chat-input-area { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.chat-input-area input { flex: 1; border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; font-size: 14px; outline: none; }
.chat-input-area input:focus { border-color: var(--primary); }
.chat-input-area .btn-send { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 16px; }
.chat-input-area .btn-attach { width: 32px; height: 32px; border-radius: 50%; background: transparent; color: var(--text-secondary); border: 1px solid var(--border); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.chat-input-area .btn-attach:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ===== request_upload 卡片样式 ===== */
.upload-request-card { background: #F0F7FF; border: 1px solid #BBDEFB; border-radius: 10px; padding: 14px 16px; margin: 4px 0; font-size: 13px; }
.upload-request-card .ur-title { font-weight: 600; color: #1565C0; margin-bottom: 10px; font-size: 14px; }
.upload-request-card .ur-checklist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.upload-request-card .ur-item { padding: 6px 0; border-bottom: 1px dashed #DDE8F0; }
.upload-request-card .ur-item:last-child { border-bottom: none; }
.upload-request-card .ur-item-row { display: flex; align-items: center; gap: 6px; }
.upload-request-card .ur-check { color: #1976D2; font-size: 14px; flex-shrink: 0; }
.upload-request-card .ur-required { font-size: 11px; color: #e74c3c; background: #FDEAEA; padding: 1px 6px; border-radius: 3px; flex-shrink: 0; }
.upload-request-card .ur-file-link { display: block; margin-top: 4px; padding-left: 22px; font-size: 12px; }
.upload-request-card .ur-notes { color: var(--text-secondary); font-size: 12px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed #BBDEFB; }

/* 状态选择 radio 选项（工单详情+工单管理共用） */
.status-opt { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; font-size: 13px; }
.status-opt:hover { background: #f5f7fa; }
.status-opt-current { border-color: var(--primary); background: #e8f0fe; }

/* 客户侧上传卡片 */
.upload-card { background: #F0F7FF; border: 1px solid #BBDEFB; border-radius: 10px; padding: 14px 16px; margin: 4px 0; font-size: 13px; }
.upload-card .uc-title { font-weight: 600; color: #1565C0; margin-bottom: 10px; font-size: 14px; }
.upload-card .uc-item { padding: 8px 0; border-bottom: 1px dashed #DDE8F0; }
.upload-card .uc-item:last-child { border-bottom: none; }
.upload-card .uc-item-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.upload-card .uc-label { font-size: 13px; }
.upload-card .uc-status { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.upload-card .uc-status.done { color: var(--success); }
.upload-card .uc-upload-btn { padding: 4px 12px; background: var(--primary); color: #fff; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; }
.upload-card .uc-upload-btn:disabled { background: #ccc; cursor: not-allowed; }
.upload-card .uc-upload-btn:hover:not(:disabled) { background: var(--primary-dark); }
.upload-card .uc-notes { color: var(--text-secondary); font-size: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #BBDEFB; }
.upload-card .uc-file { font-size: 12px; color: var(--primary-dark); word-break: break-all; margin-top: 2px; }
.upload-card .uc-progress { width: 100%; height: 4px; background: #E3F2FD; border-radius: 2px; margin-top: 4px; overflow: hidden; }
.upload-card .uc-progress-bar { height: 100%; background: var(--primary); border-radius: 2px; transition: width .3s; }

/* ===== 工单预填表单 ===== */
.form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.form-row label { width: 56px; font-size: 12px; color: var(--text-secondary); flex-shrink: 0; text-align: right; }
.form-row input, .form-row select, .form-row textarea { flex: 1; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; outline: none; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }

/* ===== 顶栏用户下拉菜单 ===== */
.user-dropdown.show { display: block !important; }
.dropdown-item { padding: 10px 16px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; transition: background .15s; }
.dropdown-item:hover { background: var(--primary-light); color: var(--primary-dark); }

/* ===== 修改密码弹窗 ===== */
.pwd-modal-body { padding: 16px 20px; }
.pwd-modal-body .form-group { margin-bottom: 12px; }
.pwd-modal-body .form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.pwd-modal-body .form-group input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; }
.pwd-modal-body .form-group input:focus { border-color: var(--primary); }

/* ===== 超时工单弹窗 ===== */
.timeout-modal { max-width: 800px; max-height: 80vh; overflow-y: auto; }
.timeout-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.timeout-table th { background: #F5F7FA; padding: 10px 12px; text-align: left; font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid var(--border); position: sticky; top: 0; }
.timeout-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.timeout-table tr:hover td { background: var(--primary-light); }
.timeout-duration { color: var(--danger); font-weight: 500; }
.timeout-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; }

/* ===== 我的工单弹窗 ===== */
.myorders-tab { padding: 8px 20px; border: none; background: none; font-size: 14px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.myorders-tab:hover { color: var(--text); }
.myorders-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.op-btn { display: inline-flex; align-items: center; font-size: 12px; padding: 4px 10px; margin: 0 2px; border-radius: 3px; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text); line-height: 1; }
.op-btn:hover { border-color: var(--primary); color: var(--primary); }
.op-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.op-btn.danger { color: var(--danger); border-color: var(--danger); }
.op-btn.danger:hover { background: var(--danger); color: #fff; }
.op-dropdown { position: relative; display: inline-block; }
.op-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 1000; min-width: 120px; max-height: 200px; overflow-y: auto; }
.op-dropdown-menu.show { display: block; }
.op-dropdown-item { padding: 6px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.op-dropdown-item:hover { background: var(--primary-light); }
.status-opt { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 0; font-size: 13px; }

/* ===== 生成工单弹窗 ===== */
.form-row-label { font-size: 12px; color: var(--text-secondary); line-height: 2; }
.form-row-input { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; width: 100%; }
