:root { --primary: #409eff; --success: #67c23a; --warning: #e6a23c; --danger: #f56c6c; --info: #909399; --light: #f4f4f5; --dark: #303133; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; }
.hidden { display: none !important; }
.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; transition: all 0.3s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn-blue { background: var(--primary); color: white; }
.btn-green { background: var(--success); color: white; }
.btn-red { background: var(--danger); color: white; }
.btn-yellow { background: var(--warning); color: white; }
.container { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: rgba(255,255,255,0.95); padding: 20px; display: flex; flex-direction: column; }
.sidebar h2 { color: var(--dark); margin-bottom: 20px; font-size: 20px; text-align:center;}
.menu-item { padding: 12px 16px; margin: 8px 0; border-radius: 8px; cursor: pointer; transition: all 0.3s; color: var(--dark); font-weight: 500; }
.menu-item:hover, .menu-item.active { background: var(--primary); color: white; }
.main-content { flex: 1; padding: 20px; overflow-y: auto; }
.card { background: rgba(255,255,255,0.95); border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }
.stat-card { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 12px; padding: 20px; color: white; }
.stat-card .number { font-size: 32px; font-weight: bold; margin-bottom: 8px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 15px; align-items: center; flex-wrap: wrap;}
.toolbar select, .toolbar input { padding: 8px; border: 1px solid #ddd; border-radius: 4px; outline: none;}
table { width: 100%; border-collapse: collapse; background: white; border-radius: 10px;}
th { background: var(--light); color: var(--dark); padding: 12px; text-align: left; }
td { padding: 12px; border-bottom: 1px solid #eee; color: var(--dark); }
tr:hover { background: rgba(64,158,255,0.05); }
.toast { position: fixed; top: 20px; right: 20px; background: var(--success); color: white; padding: 12px 24px; border-radius: 6px; z-index: 10000; }
.timeline-item-modern { display: flex; margin-bottom: 20px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.timeline-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 12px; }
.pswp-image img { cursor: zoom-in; transition: transform 0.2s; }
.pswp-image img:hover { transform: scale(1.05); }
.locked-tag { background: #f56c6c; color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; }

/* 👁️ 悬浮查看的专属魔法样式 (支持内部滚动 + 向左展开) */
.tooltip-container { 
    position: relative; 
    display: inline-block; 
    cursor: pointer; 
    color: #409eff; 
    font-size: 13px; 
}

.tooltip-container .tooltip-text {
    visibility: hidden; 
    width: max-content; 
    max-width: 500px; 
    background-color: #303133; 
    color: #fff; 
    text-align: left; 
    border-radius: 6px; 
    padding: 12px 14px; 
    position: absolute; 
    z-index: 99999; 
    
    /* 核心改动 1：彻底改为靠左侧显示，不再往上 */
    right: calc(100% + 10px); /* 悬浮框右侧贴着触发文字的左侧，并留出 10px 间距 */
    top: 50%; /* 垂直居中对齐 */
    transform: translateY(-50%); /* 配合 top: 50% 实现完美的水平对齐 */
    bottom: auto; 
    left: auto; 
    
    opacity: 0; 
    transition: opacity 0.3s; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); 
    white-space: pre-wrap; 
    word-break: break-all;
    
    /* 核心改动 2：内部滚动条（你写得很完美，保持不变） */
    pointer-events: auto; 
    max-height: 600px; 
    overflow-y: auto;
}

/* 核心改动 3：隐形桥梁调整。因为气泡现在在左边，桥梁应该建在气泡的右侧，连接到文字 */
.tooltip-container .tooltip-text::before {
    content: ""; 
    position: absolute; 
    top: 0; 
    right: -10px; /* 填补 right: calc(100% + 10px) 留下的间隙 */
    width: 10px; 
    height: 100%; 
    background: transparent;
}

/* 核心改动 4：小三角箭头调整。气泡在左，箭头要在气泡最右侧，并指向右边的触发文字 */
.tooltip-container .tooltip-text::after {
    content: ""; 
    position: absolute; 
    top: 50%; /* 箭头垂直居中 */
    left: 100%; /* 箭头放在气泡的最右侧边缘 */
    transform: translateY(-50%); /* 箭头自身居中微调 */
    border-width: 6px; 
    border-style: solid; 
    /* 箭头颜色：左边实色，其他透明，这样箭头才会乖乖指向右边 */
    border-color: transparent transparent transparent #303133;
}

/* 美化气泡内部的滚动条保持不变 */
.tooltip-container .tooltip-text::-webkit-scrollbar { width: 6px; }
.tooltip-container .tooltip-text::-webkit-scrollbar-thumb { background: #606266; border-radius: 3px; }
.tooltip-container .tooltip-text::-webkit-scrollbar-track { background: transparent; }

.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }
.modern-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    font-size: 14px;
    color: #606266;
    background-color: #fff;
    transition: all 0.3s cubic-bezier(.645,.045,.355,1);
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}
.modern-input:focus {
    border-color: #409eff;
    box-shadow: 0 0 0 2px rgba(64,158,255,0.2);
}
.modern-input:disabled, .modern-input[readonly] {
    background-color: #f5f7fa !important;
    color: #909399;
    cursor: not-allowed;
    border-color: #e4e7ed;
}
textarea.modern-input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}
.input-label {
    display: block;
    color: #606266;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

@media (max-width: 768px) {
    .container { flex-direction: column; min-height: auto; }
    .sidebar { width: 100%; padding: 10px 15px; position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
    .sidebar h2 { display: none; }
    .sidebar > div:first-of-type { padding: 10px; margin-bottom: 5px; }
    .sidebar > div:first-of-type > div:last-child { margin-top: 8px; border-top: 1px dashed #dcdfe6; padding-top: 8px; }
    .menu-label { display: none; }
    .sidebar .menu-item { display: inline-block; width: auto; margin: 0 5px 0 0; padding: 6px 12px; border-radius: 20px; font-size: 13px; }
    #admin-menu-area { margin-top: 5px; border-top: none; padding-top: 0; white-space: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .sidebar > .menu-item { display: inline-block; }
    .sidebar { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-card .number { font-size: 20px; }
    .main-content { padding: 10px; }
    .card { padding: 15px 10px; overflow: hidden; }
    .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
    .toolbar > * { width: 100% !important; margin: 0; }
    .toolbar select, .toolbar input { padding: 12px; font-size: 15px; }
    table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; width: 100%; border: none; }
    th, td { padding: 12px 10px; font-size: 13px; }
    #unifiedCustomerModal { padding: 0; }
    #u-modal-container { width: 100% !important; max-width: 100vw; height: 100vh !important; border-radius: 0; display: flex; flex-direction: column; }
    #u-modal-container > div:nth-child(2) { display: block !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
    #u-modal-container > div:nth-child(2) > div:first-child { width: 100% !important; height: auto !important; display: block !important; border-right: none; padding: 15px; }
    #u-modal-container > div:nth-child(2) > div:first-child > div:nth-child(2) { overflow: visible !important; height: auto !important; }
    div:has(> #u-remark) { display: none !important; }
    #u-remark { display: none !important; }
    #u-right-panel { width: 100% !important; height: auto !important; display: block !important; flex: none !important; border-top: 8px solid #f0f2f5; }
    #u-timeline { max-height: 250px !important; padding: 15px; border-bottom: 1px solid #eee; }
    #u-right-panel > div:last-child { padding: 15px !important; }
    #u-right-panel > div:last-child > div:nth-child(3) { flex-direction: column; align-items: stretch !important; gap: 12px; margin-top: 15px; }
    #u-right-panel > div:last-child > div:nth-child(3) > div { width: 100%; }
    #u-right-panel > div:last-child > div:nth-child(3) .btn { width: 100%; margin: 0; display: block; text-align: center; }
    #u-modal-container > div:nth-child(2) > div:first-child { width: 100% !important; border-right: none; border-bottom: 5px solid #f4f4f5; padding: 15px; }
    #u-right-panel { width: 100%; flex: none; }
    #u-timeline { max-height: 400px; padding: 15px; }
    .tooltip-container .tooltip-text { 
        position: fixed; top: auto; bottom: 20px; left: 5%; right: 5%; width: 90%; 
        transform: none; z-index: 10000; box-shadow: 0 -5px 20px rgba(0,0,0,0.2); 
        max-height: 60vh; border-radius: 12px; font-size: 14px;
    }
    .tooltip-container .tooltip-text::after, .tooltip-container .tooltip-text::before { display: none; }
    #changePwdModal > div, #transferModal > div { width: 90% !important; padding: 20px; }
}

.mobile-fab { 
    display: none; 
    position: fixed; 
    top: 50%;             
    left: 0;              
    transform: translateY(-50%); 
    width: 48px; 
    height: 56px; 
    background: var(--primary); 
    color: white; 
    border-radius: 0 28px 28px 0; 
    text-align: center; 
    line-height: 56px; 
    font-size: 24px; 
    box-shadow: 4px 0 15px rgba(64,158,255,0.4); 
    z-index: 9000; 
    cursor: pointer; 
    padding-left: 4px; 
}
.mobile-menu-drawer { position: fixed; bottom: -100%; left: 0; width: 100%; background: #fff; border-top-left-radius: 20px; border-top-right-radius: 20px; box-shadow: 0 -5px 20px rgba(0,0,0,0.1); transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 8999; padding: 20px; display: flex; flex-wrap: wrap; gap: 15px; }
.mobile-menu-drawer.active { bottom: 0; }
.mobile-drawer-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 8998; display: none; }
.mobile-drawer-overlay.active { display: block; }

@media (max-width: 768px) { 
    .sidebar { display: none !important; } 
    .mobile-fab { display: block; } 
    .main-content { padding-bottom: 100px; }
    .stats-grid { display: none !important; } 
}

#customConfirmModal { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:10000; display:flex; align-items:center; justify-content:center; } 
#customConfirmModal > div { background:#fff; width:320px; padding:25px; border-radius:12px; text-align:center; box-shadow: 0 10px 30px rgba(0,0,0,0.2); } 
#customConfirmModal .warning-icon { font-size:40px; margin-bottom:15px; } 
#customConfirmModal h3 { color:#f56c6c; margin-bottom:10px; } 
#customConfirmModal p { color:#666; font-size:14px; margin-bottom:20px; } 
#customConfirmModal .modal-buttons { display:flex; justify-content:space-between; gap:15px; } 
#customConfirmModal .modal-buttons .btn { flex:1; }

#unifiedCustomerModal { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); z-index:9000; display:flex; align-items:center; justify-content:center; }
#u-modal-container { background:#fff; width:1000px; max-width:95vw; height:750px; border-radius:12px; display:flex; flex-direction:column; overflow:hidden; }
#u-modal-container .modal-header { background:#409eff; color:#fff; padding:15px 25px; display:flex; justify-content:space-between; align-items:center; }
#u-modal-container .modal-header h3 { margin:0; }
#u-modal-container .modal-header .close-btn { cursor:pointer; font-size:28px; }
#u-modal-container .modal-body { display:flex; flex:1; overflow:hidden; }
#u-modal-container .modal-left { width:340px; background:#fcfcfc; border-right:1px solid #eee; padding:25px; display:flex; flex-direction:column; }
#u-modal-container .modal-left .scroll-area { flex:1; overflow-y:auto; padding-right:5px; }
#u-modal-container .modal-right { flex:1; display:flex; flex-direction:column; background:#fff; }
#u-modal-container .modal-right .timeline { flex:1; padding:25px; overflow-y:auto; }
#u-modal-container .modal-right .actions { padding:20px; border-top:1px solid #eee; background:#fafafa; }

#changePwdModal { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:9999; display:flex; align-items:center; justify-content:center; }
#changePwdModal > div { background:#fff; width:400px; padding:25px; border-radius:12px; }
#changePwdModal h3 { margin-bottom:15px; }
#changePwdModal p { font-size:12px; color:#f56c6c; margin-bottom:15px; }
#changePwdModal input { width:100%; padding:10px; margin-bottom:15px; }
#changePwdModal .modal-buttons { display:flex; justify-content:flex-end; gap:10px; }

#transferModal { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:9999; display:flex; align-items:center; justify-content:center; }
#transferModal > div { background:#fff; width:400px; padding:25px; border-radius:12px; }
#transferModal h3 { margin-bottom:15px; }
#transferModal select { width:100%; padding:10px; margin-bottom:20px; }
#transferModal .modal-buttons { display:flex; justify-content:flex-end; gap:10px; }

#alarm-banner { display: none; background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%); border-left: 5px solid #ffb300; padding: 15px 20px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(255, 179, 0, 0.15); display:flex; align-items:center; justify-content:space-between; }
#alarm-banner .alarm-content { display:flex; align-items:center; }
#alarm-banner .alarm-icon { font-size:24px; margin-right:15px; }
#alarm-banner h4 { color:#d84315; margin:0 0 5px 0; font-size:16px; font-weight:bold; }
#alarm-banner p { color:#5d4037; margin:0; font-size:14px; }
#alarm-banner .close-btn { background: none; border: none; font-size:20px; color:#ffb300; cursor:pointer; }

#pagination { text-align:center; margin-top:20px; color:#666; }
