:root {
  --primary: #4361EE;
  --primary-light: #6C7FEF;
  --primary-dark: #3451D1;
  --primary-bg: #EEF0FF;
  --success: #2ECC71;
  --warning: #F39C12;
  --danger: #E74C3C;
  --info: #3498DB;
  --bg: #F5F7FA;
  --bg-card: #FFFFFF;
  --text: #2C3E50;
  --text-secondary: #7F8C9B;
  --border: #E8ECF1;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --sidebar-w: 240px;
  --sidebar-collapsed: 60px;
  --topbar-h: 56px;
  --transition: 0.2s ease;
}

* { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size:14px; color:var(--text); background:var(--bg); }
input, select, textarea, button { font-family:inherit; font-size:inherit; }
a { color:var(--primary); text-decoration:none; }
.hidden { display:none !important; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:#ccc; border-radius:3px; }

/* ===== Button ===== */
.btn { display:inline-flex; align-items:center; gap:6px; padding:8px 16px; border:none; border-radius:var(--radius-sm); font-size:14px; cursor:pointer; transition:var(--transition); white-space:nowrap; font-weight:500; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-success { background:var(--success); color:#fff; }
.btn-warning { background:var(--warning); color:#fff; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-outline { background:transparent; border:1px solid var(--border); color:var(--text); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }
.btn-info { background:var(--info); color:#fff; }
.btn-info:hover { background:#2980B9; }
.btn-sm { padding:4px 10px; font-size:12px; }
.btn-xs { padding:2px 8px; font-size:11px; border-radius:4px; }
.btn:disabled { opacity:0.5; cursor:not-allowed; }

/* ===== Customer Tabs ===== */
.customer-tabs { display:flex; gap:0; margin-bottom:12px; border-bottom:2px solid var(--border); }
.customer-tabs .ctab { padding:8px 20px; border:none; background:none; font-size:14px; font-weight:500; color:var(--text-secondary); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; transition:var(--transition); }
.customer-tabs .ctab:hover { color:var(--text); }
.customer-tabs .ctab.active { color:var(--primary); border-bottom-color:var(--primary); }

/* ===== Customer Search Dropdown ===== */
.customer-search-wrap { position:relative; }
.cs-dropdown { position:absolute; top:100%; left:0; right:0; background:#fff; border:1px solid var(--border); border-radius:var(--radius-sm); max-height:220px; overflow-y:auto; z-index:100; box-shadow:0 4px 12px rgba(0,0,0,0.1); }
.cs-dropdown .cs-item { padding:10px 12px; cursor:pointer; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; font-size:13px; transition:var(--transition); }
.cs-dropdown .cs-item:hover { background:var(--primary-bg); }
.cs-dropdown .cs-item:last-child { border-bottom:none; }
.cs-dropdown .cs-name { font-weight:500; }
.cs-dropdown .cs-phone { color:var(--text-secondary); font-size:12px; }
.cs-dropdown .cs-type { font-size:11px; padding:1px 6px; border-radius:8px; background:var(--bg); color:var(--text-secondary); }

/* ===== Form ===== */
.form-group { margin-bottom:12px; }
.form-group label { display:block; margin-bottom:4px; font-weight:500; color:var(--text-secondary); font-size:13px; }
.form-input, .form-select, .form-textarea { width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:#fff; transition:var(--transition); outline:none; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-bg); }
.form-textarea { resize:vertical; min-height:80px; }
.form-row { display:flex; gap:12px; }
.form-row > * { flex:1; }

/* ===== Status Badge ===== */
.badge { display:inline-flex; align-items:center; gap:4px; padding:2px 10px; border-radius:20px; font-size:12px; font-weight:500; }
.badge-pending { background:#FFF3E0; color:#E65100; }
.badge-processing, .badge-assigned, .badge-accepted { background:#E3F2FD; color:#1565C0; }
.badge-help_needed { background:#F3E5F5; color:#7B1FA2; }
.badge-reprocess { background:#FFF3E0; color:#E65100; }
.badge-completed, .badge-finished { background:#E8F5E9; color:#2E7D32; }
.badge-closed, .badge-settled { background:#ECEFF1; color:#546E7A; }
.badge-paid { background:#E8F5E9; color:#2E7D32; }
.badge-urgent { background:#FFEBEE; color:#C62828; }
.badge-picked_up { background:#E8F5E9; color:#2E7D32; }
.badge-returned { background:#FFF3E0; color:#E65100; }
.badge-cancelled { background:#ECEFF1; color:#78909C; }
.badge-confirmed { background:#E8F5E9; color:#2E7D32; }
.badge-shipped { background:#E3F2FD; color:#1565C0; }
.badge-received { background:#E3F2FD; color:#1565C0; }
.badge-confirmed { background:#E8F5E9; color:#2E7D32; }
.badge-repairing { background:#FFF3E0; color:#E65100; }
.badge-notified { background:#F3E5F5; color:#7B1FA2; }
.badge-high { background:#FFEBEE; color:#C62828; }
.badge-medium { background:#E3F2FD; color:#1565C0; }
.badge-low { background:#F5F5F5; color:#757575; }
.badge-normal { background:#F5F5F5; color:#616161; }

.status-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.status-dot.green { background:var(--success); }
.status-dot.yellow { background:var(--warning); }
.status-dot.red { background:var(--danger); }
.status-dot.blue { background:var(--info); }
.status-dot.gray { background:#b0bec5; }

/* ===== Card ===== */
.card { background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px; }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.card-header h2 { font-size:16px; font-weight:600; }
.card-header h3 { font-size:14px; font-weight:600; }

/* ===== Table ===== */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
.module-table { table-layout:fixed; }
th, td { padding:10px 12px; text-align:left; border-bottom:1px solid var(--border); font-size:13px; }
th { font-weight:600; color:var(--text-secondary); background:var(--bg); white-space:nowrap; position:sticky; top:0; }
th .col-resize-handle:hover { background:var(--primary); opacity:0.5; }
tr:hover td { background:#FAFBFC; }
td .actions { display:flex; gap:4px; }

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

/* ===== Modal ===== */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:1000; display:flex; align-items:center; justify-content:center; animation:fadeIn 0.15s; cursor:pointer; }
.modal-overlay > * { cursor:default; }
.modal-overlay.drawer-overlay { justify-content:flex-end; }
.modal { background:#fff; border-radius:var(--radius); width:90%; max-width:600px; max-height:85vh; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,0.15); animation:slideUp 0.2s; }
.modal.drawer { border-radius:0; max-width:520px; width:90vw; height:100vh; max-height:100vh; animation:slideInRight 0.25s; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); flex-shrink:0; }
.modal-header h3 { font-size:16px; font-weight:600; }
.modal-close { width:32px; height:32px; border:none; background:none; font-size:20px; cursor:pointer; border-radius:50%; display:flex; align-items:center; justify-content:center; color:var(--text-secondary); }
.modal-close:hover { background:var(--bg); }
.modal-body { padding:20px; overflow-y:auto; flex:1; }
.modal-footer { padding:12px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; flex-shrink:0; }

.modal-full { max-width:90vw; max-height:90vh; }
.modal-large { max-width:800px; }
.modal-sm { max-width:400px; }

/* ===== Toast ===== */
.toast-container { position:fixed; top:16px; right:16px; z-index:2000; display:flex; flex-direction:column; gap:8px; }
.toast { padding:12px 20px; border-radius:var(--radius-sm); color:#fff; font-size:14px; box-shadow:0 4px 12px rgba(0,0,0,0.15); animation:slideIn 0.2s; max-width:360px; }
.toast-success { background:var(--success); }
.toast-error { background:var(--danger); }
.toast-info { background:var(--info); }
.toast-warning { background:var(--warning); }

/* ===== Login Page ===== */
.login-page { position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg, #667eea 0%, #764ba2 100%); z-index:500; }
.login-card { background:#fff; border-radius:16px; padding:40px; width:380px; max-width:90vw; box-shadow:0 20px 60px rgba(0,0,0,0.2); }
.login-card h1 { text-align:center; font-size:24px; color:var(--primary); margin-bottom:8px; }
.login-card p { text-align:center; color:var(--text-secondary); margin-bottom:24px; }
.login-card .form-group { margin-bottom:16px; }
.login-card .btn { width:100%; padding:12px; font-size:16px; justify-content:center; }
.login-error { color:var(--danger); text-align:center; font-size:13px; margin-bottom:12px; }

/* ===== PC Layout ===== */
.pc-layout { display:none; height:100vh; }
.pc-layout.active { display:flex; }

.sidebar { width:var(--sidebar-w); background:var(--text); color:#fff; display:flex; flex-direction:column; transition:width var(--transition); overflow:hidden; flex-shrink:0; }
.sidebar.collapsed { width:var(--sidebar-collapsed); }
.sidebar-header { display:flex; align-items:center; gap:10px; padding:14px 16px; border-bottom:1px solid rgba(255,255,255,0.1); flex-shrink:0; }
.sidebar-header .logo { width:32px; height:32px; background:var(--primary); border-radius:8px; display:flex; align-items:center; justify-content:center; font-weight:bold; font-size:16px; flex-shrink:0; }
.sidebar-header .title { font-size:16px; font-weight:600; white-space:nowrap; overflow:hidden; }
.sidebar.collapsed .sidebar-header .title { display:none; }

.sidebar-nav { flex:1; overflow-y:auto; padding:8px 0; }
.sidebar-nav .nav-item { display:flex; align-items:center; gap:12px; padding:10px 16px; cursor:pointer; transition:var(--transition); white-space:nowrap; color:rgba(255,255,255,0.7); border-left:3px solid transparent; }
.sidebar-nav .nav-item:hover { background:rgba(255,255,255,0.08); color:#fff; }
.sidebar-nav .nav-item.active { background:rgba(67,97,238,0.2); color:#fff; border-left-color:var(--primary); }
.sidebar-nav .nav-item .icon { width:22px; text-align:center; font-size:18px; flex-shrink:0; }
.sidebar-nav .nav-item .label { overflow:hidden; }
.sidebar.collapsed .sidebar-nav .nav-item .label { display:none; }
.sidebar.collapsed .sidebar-nav .nav-item { justify-content:center; padding:12px 0; }

.sidebar-footer { padding:12px 16px; border-top:1px solid rgba(255,255,255,0.1); }
.sidebar-footer .user-info { display:flex; align-items:center; gap:10px; cursor:pointer; }
.sidebar-footer .avatar { width:32px; height:32px; border-radius:50%; background:var(--primary); display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:600; flex-shrink:0; }
.sidebar-footer .uname { font-size:13px; font-weight:500; }
.sidebar-footer .urole { font-size:11px; color:rgba(255,255,255,0.5); }
.sidebar.collapsed .sidebar-footer .uname, .sidebar.collapsed .sidebar-footer .urole { display:none; }

.main-area { flex:1; display:flex; flex-direction:column; overflow:hidden; }

.topbar { height:var(--topbar-h); background:#fff; border-bottom:1px solid var(--border); display:flex; align-items:center; padding:0 20px; gap:12px; flex-shrink:0; }
.topbar-toggle { width:36px; height:36px; border:none; background:none; font-size:20px; cursor:pointer; border-radius:var(--radius-sm); color:var(--text); display:flex; align-items:center; justify-content:center; }
.topbar-toggle:hover { background:var(--bg); }
.topbar-actions { display:flex; align-items:center; gap:4px; margin-left:auto; }
.topbar-actions button { width:36px; height:36px; border:none; background:none; font-size:18px; cursor:pointer; border-radius:var(--radius-sm); position:relative; display:flex; align-items:center; justify-content:center; }
.topbar-actions button:hover { background:var(--bg); }
.notif-dot { position:absolute; top:4px; right:4px; width:8px; height:8px; background:var(--danger); border-radius:50%; border:2px solid #fff; }

.content-area { flex:1; overflow-y:auto; padding:20px; }

/* ===== Mobile Layout ===== */
.mobile-layout { display:none; flex-direction:column; height:100vh; }
.mobile-layout.active { display:flex; }

.mobile-header { background:var(--primary); color:#fff; padding:12px 16px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.mobile-header h1 { font-size:16px; font-weight:600; margin:0; line-height:1; }
.mobile-header .m-header-actions { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.mobile-header button { background:rgba(255,255,255,0.15); border:none; color:#fff; min-width:30px; height:30px; border-radius:50%; cursor:pointer; font-size:15px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }

.mobile-content { flex:1; overflow-y:auto; padding:12px; padding-bottom:70px; }

.mobile-nav { background:#fff; border-top:1px solid var(--border); display:flex; flex-shrink:0; position:fixed; bottom:0; left:0; right:0; z-index:100; }
.mobile-nav .tab-item { flex:1; display:flex; flex-direction:column; align-items:center; padding:6px 0 8px; cursor:pointer; color:var(--text-secondary); font-size:11px; transition:var(--transition); border:none; background:none; }
.mobile-nav .tab-item.active { color:var(--primary); }
.mobile-nav .tab-item .tab-icon { font-size:20px; margin-bottom:2px; }
.mobile-nav .tab-item .tab-badge { background:var(--danger); color:#fff; font-size:10px; min-width:16px; height:16px; border-radius:8px; display:flex; align-items:center; justify-content:center; position:absolute; top:2px; right:calc(50% - 18px); }

/* ===== Floating Buttons ===== */
.fab { position:fixed; z-index:200; width:48px; height:48px; border-radius:50%; border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:22px; box-shadow:0 4px 12px rgba(0,0,0,0.2); transition:var(--transition); opacity:0.8; }
.fab:hover { opacity:1; transform:scale(1.05); }
.fab-add { right:16px; bottom:100px; background:var(--primary); color:#fff; }
.fab-back { left:16px; bottom:100px; background:var(--text); color:#fff; }

/* ===== Smart Input Panel ===== */
.smart-input-panel { position:fixed; inset:0; z-index:900; display:flex; align-items:flex-end; animation:fadeIn 0.15s; }
.smart-input-panel .panel-bg { position:absolute; inset:0; background:rgba(0,0,0,0.3); }
.smart-input-panel .panel-content { position:relative; background:#fff; border-radius:var(--radius) var(--radius) 0 0; width:100%; max-height:80vh; display:flex; flex-direction:column; animation:slideUp 0.2s; }
.smart-input-panel .panel-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.smart-input-panel .panel-header h3 { font-size:16px; }
.smart-input-panel .panel-body { padding:16px 20px; overflow-y:auto; flex:1; }
.smart-input-panel .input-area { display:flex; gap:8px; margin-bottom:12px; }
.smart-input-panel .input-area textarea { flex:1; min-height:60px; max-height:120px; padding:10px; border:1px solid var(--border); border-radius:var(--radius-sm); resize:none; outline:none; font-size:15px; }
.smart-input-panel .input-area textarea:focus { border-color:var(--primary); }
.smart-input-panel .voice-btn { width:44px; height:44px; border-radius:50%; border:2px solid var(--border); background:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; transition:var(--transition); }
.smart-input-panel .voice-btn:hover { border-color:var(--primary); color:var(--primary); }
.smart-input-panel .voice-btn.recording { border-color:var(--danger); color:var(--danger); animation:pulse 1s infinite; }

.parse-result { background:var(--primary-bg); border-radius:var(--radius-sm); padding:16px; }
.parse-result .pr-row { display:flex; padding:6px 0; border-bottom:1px solid rgba(67,97,238,0.1); }
.parse-result .pr-row:last-child { border-bottom:none; }
.parse-result .pr-label { width:80px; color:var(--text-secondary); flex-shrink:0; font-size:13px; }
.parse-result .pr-value { flex:1; font-weight:500; font-size:13px; }
.parse-result .pr-value.missing { color:var(--danger); }
.parse-result .pr-value .match { color:var(--success); }

.parse-suggestions { margin-top:8px; }
.parse-suggestions .sug-item { padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius-xs); margin-bottom:4px; cursor:pointer; font-size:13px; }
.parse-suggestions .sug-item:hover { border-color:var(--primary); background:var(--primary-bg); }
.parse-suggestions .sug-item.sug-active { border-color:var(--primary); background:var(--primary-bg); color:var(--primary); font-weight:500; }
.change-cust { color:var(--primary); cursor:pointer; font-size:12px; margin-left:4px; text-decoration:underline; }
.change-cust:hover { color:var(--primary-dark); }
.btn-success:hover { background:#27AE60; }
#cust-picker-list { max-height:300px; overflow-y:auto; }
#cust-picker-list .sug-item { padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-xs); margin-bottom:4px; cursor:pointer; font-size:13px; transition:var(--transition); }
#cust-picker-list .sug-item:hover { border-color:var(--primary); background:var(--primary-bg); }


/* ===== Page Styles ===== */
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; flex-wrap:wrap; gap:8px; }
.page-header h2 { font-size:18px; font-weight:600; }

.filter-bar { display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; }
.filter-bar select, .filter-bar input { padding:6px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); font-size:13px; outline:none; background:#fff; }
.filter-bar select:focus, .filter-bar input:focus { border-color:var(--primary); }

/* Dashboard */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(180px,1fr)); gap:12px; margin-bottom:20px; }
.stat-card { background:#fff; border-radius:var(--radius); padding:16px; box-shadow:var(--shadow); }
.stat-card .stat-num { font-size:28px; font-weight:700; color:var(--primary); }
.stat-card .stat-label { font-size:13px; color:var(--text-secondary); margin-top:4px; }
.stat-card .stat-sub { font-size:12px; color:var(--text-secondary); margin-top:2px; }

/* Detail page */
.detail-header { margin-bottom:16px; }
.detail-header .dh-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.detail-header .dh-title { font-size:18px; font-weight:600; }

/* Repair Status Banner */
.repair-status-banner { display:flex; align-items:center; gap:10px; padding:14px 18px; border-radius:var(--radius); margin-bottom:16px; font-size:16px; font-weight:600; }
.repair-status-banner .rsb-icon { font-size:24px; }
.repair-status-banner .rsb-time { margin-left:auto; font-size:13px; font-weight:400; opacity:0.8; }
.repair-status-banner.status-received { background:#E3F2FD; color:#1565C0; }
.repair-status-banner.status-assigned { background:#E3F2FD; color:#1565C0; }
.repair-status-banner.status-diagnosed { background:#FFF3E0; color:#E65100; }
.repair-status-banner.status-quoted { background:#F3E5F5; color:#7B1FA2; }
.repair-status-banner.status-confirmed { background:#E8F5E9; color:#2E7D32; }
.repair-status-banner.status-repairing { background:#FFF3E0; color:#E65100; }
.repair-status-banner.status-waiting_parts { background:#FFF3E0; color:#E65100; }
.repair-status-banner.status-repaired_sent { background:#E8F5E9; color:#2E7D32; }
.repair-status-banner.status-noticed { background:#F3E5F5; color:#7B1FA2; }
.repair-status-banner.status-picked_up { background:#E8F5E9; color:#2E7D32; }
.repair-status-banner.status-paid { background:#E8F5E9; color:#2E7D32; }
.repair-status-banner.status-closed { background:#ECEFF1; color:#546E7A; }
.detail-grid-3col { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.detail-section { margin-bottom:20px; }
.detail-section h3 { font-size:15px; font-weight:600; margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--border); }
.detail-field { display:flex; padding:6px 0; }
.detail-field .df-label { width:100px; color:var(--text-secondary); flex-shrink:0; font-size:13px; }
.detail-field .df-value { flex:1; font-size:13px; }

/* Mobile overrides for detail */
@media(max-width:767px) {
.detail-grid-3col { grid-template-columns:1fr; }
  .detail-grid { grid-template-columns:1fr; }
}

/* ===== Mobile-specific ===== */
.mobile-page { padding:0; }
.mobile-page .page-header { padding:12px; margin:0; }
.mobile-list-item { background:#fff; border-radius:var(--radius-sm); padding:12px; margin-bottom:8px; border:1px solid var(--border); cursor:pointer; content-visibility:auto; contain:style layout; }
.mobile-list-item .mli-row { display:flex; justify-content:space-between; align-items:flex-start; }
.mobile-list-item .mli-title { font-weight:500; font-size:14px; }
.mobile-list-item .mli-sub { font-size:12px; color:var(--text-secondary); margin-top:4px; }
.mobile-list-item .mli-status { margin-top:6px; }

/* ===== Animations ===== */
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes slideIn { from{transform:translateX(40px);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
@keyframes slideInRight { from{transform:translateX(100%)} to{transform:translateX(0)} }

/* ===== Message Images ===== */
.msg-img { max-width:120px; max-height:120px; border-radius:4px; margin:4px 4px 0 0; cursor:pointer; border:1px solid var(--border); object-fit:cover; }
.msg-img:hover { opacity:0.85; }
.msg-thumbs { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }

/* ===== Responsive ===== */
@media(min-width:768px) {
  .pc-layout.active { display:flex; }
  .mobile-layout.active { display:none; }
  .fab { display:none !important; }
  .page-header .btn { padding:10px 20px; font-size:14px; }
  .page-header .btn-sm { padding:8px 16px; font-size:13px; }
  .page-header .actions { gap:10px; }
  .topbar-actions button { width:40px; height:40px; font-size:20px; }
  .content-area { padding:24px; }
  .card { padding:20px; border-radius:var(--radius); transition:box-shadow 0.2s; }
  .card:hover { box-shadow:0 4px 16px rgba(0,0,0,0.1); }
  .detail-grid { gap:24px; }
  .detail-field { padding:8px 0; }
  .table-wrap td, .table-wrap th { padding:12px 14px; }
  .ph-filter { padding:4px 12px; font-size:12px; }
}

@media(max-width:767px) {
  .pc-layout.active { display:none; }
  .mobile-layout.active { display:flex; }
  .content-area { padding:10px; }
  .filter-bar { overflow-x:auto; flex-wrap:nowrap; }
  .filter-bar::-webkit-scrollbar { display:none; }
  .stats-grid { grid-template-columns:repeat(2,1fr); }
  .modal { width:95%; max-width:95%; margin:auto; max-height:90vh; }
  .table-wrap td, .table-wrap th { padding:8px 10px; font-size:12px; }
  .card { padding:12px; border-radius:var(--radius-sm); }
  .detail-grid { gap:12px; }
  .detail-field { padding:4px 0; }
  .ph-filter { padding:2px 6px; font-size:10px; }
  .page-header h2 { font-size:16px; margin:0; line-height:1.4; }
}
/* ===== Module Color Differentiation ===== */
.module-tickets .card { border-left: 3px solid #4361EE; border-top: none; border-right: none; border-bottom: none; }
.module-tickets .page-header h2 { color: #4361EE; }
.module-tickets .detail-section h3 { color: #4361EE; }

.module-repair .card { border-left: 3px solid #2ECC71; border-top: none; border-right: none; border-bottom: none; }
.module-repair .page-header h2 { color: #2ECC71; }
.module-repair .detail-section h3 { color: #2ECC71; }

.module-requests .card { border-left: 3px solid #F39C12; border-top: none; border-right: none; border-bottom: none; }
.module-requests .page-header h2 { color: #F39C12; }
.module-requests .detail-section h3 { color: #F39C12; }

.module-customers .card { border-left: 3px solid #9B59B6; border-top: none; border-right: none; border-bottom: none; }
.module-customers .page-header h2 { color: #9B59B6; }
.module-customers .detail-section h3 { color: #9B59B6; }




/* ===== Title Filter Buttons ===== */
.ph-title-row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.ph-filters { display:flex; gap:4px; flex-wrap:wrap; }
.ph-filter { padding:2px 8px; border-radius:12px; font-size:11px; cursor:pointer; color:var(--text-secondary); background:var(--bg); border:1px solid var(--border); transition:var(--transition); white-space:nowrap; }
.ph-filter:hover { border-color:var(--primary); color:var(--primary); }
.ph-filter.active { background:var(--primary); color:#fff; border-color:var(--primary); }

/* Module-specific active filter colors */
.module-tickets .ph-filter.active { background:#4361EE; border-color:#4361EE; }
.module-repair .ph-filter.active { background:#2ECC71; border-color:#2ECC71; }
.module-requests .ph-filter.active { background:#F39C12; border-color:#F39C12; }

/* Module-colored table headers */
.module-tickets table thead th { background:#E8ECF8; color:#2C3E50; }
.module-repair table thead th { background:#E8F5E9; color:#2C3E50; }
.module-requests table thead th { background:#FFF8E1; color:#2C3E50; }

/* Enhanced table row hover and alternating rows */
.table-wrap tbody tr:nth-child(even) { background:#FAFBFC; }
.table-wrap tbody tr:hover td { background:#E3F2FD !important; }

/* Module-colored mobile list items */
.module-tickets .mobile-list-item { border-left:4px solid #4361EE; }
.module-repair .mobile-list-item { border-left:4px solid #2ECC71; }
.module-requests .mobile-list-item { border-left:4px solid #F39C12; }

/* Detail section card consistency */
.detail-section-card { background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px; margin-bottom:20px; }
.module-tickets .detail-section-card { border-left:3px solid #4361EE; }
.module-repair .detail-section-card { border-left:3px solid #2ECC71; }
.module-requests .detail-section-card { border-left:3px solid #F39C12; }

/* Detail action bar outside grid */
.detail-action-bar { margin:0 0 20px 0; padding:14px 18px; background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.module-tickets .detail-action-bar { border-left:3px solid #4361EE; }
.module-repair .detail-action-bar { border-left:3px solid #2ECC71; }
.module-requests .detail-action-bar { border-left:3px solid #F39C12; }

/* Filter bar polish */
.filter-bar { background:var(--bg-card); padding:10px 14px; border-radius:var(--radius-sm); box-shadow:var(--shadow); margin-bottom:16px; }
.filter-bar input, .filter-bar select { border-radius:6px; font-size:13px; }
.filter-bar input:focus, .filter-bar select:focus { box-shadow:0 0 0 2px var(--primary-bg); }

/* Responsive detail action bar on mobile */
@media(max-width:767px) {
  .detail-action-bar { padding:10px 12px; gap:6px; }
  .filter-bar { padding:8px 10px; }
  .mobile-list-item { border-left-width:3px !important; }
  .detail-section-card { padding:14px; }
}

/* Status indicator dot for table rows */
.table-status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align:middle; }

/* Photo grid for ticket detail - horizontal on PC, vertical on mobile */
.photo-grid { display:flex; gap:16px; }
.photo-grid .photo-subsection { flex:1; min-width:0; border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px; }
@media(max-width:767px) {
  .photo-grid { flex-direction:column; gap:12px; }
  .photo-grid .photo-subsection { border:1px solid var(--border); }
}

/* Module-colored section headers for detail pages */
.detail-section h3 { font-size:15px; font-weight:600; margin-bottom:12px; padding-bottom:8px; border-bottom:2px solid var(--border); }
.module-tickets .detail-section h3 { border-bottom-color:#4361EE; }
.module-repair .detail-section h3 { border-bottom-color:#2ECC71; }
.module-requests .detail-section h3 { border-bottom-color:#F39C12; }

/* ===== Action Bar ===== */
.action-bar { margin:16px 0; padding:12px 16px; background:#fff; border-radius:var(--radius-sm); box-shadow:var(--shadow); display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.ticket-action-bar { border-left:3px solid #4361EE; }
.repair-action-bar { border-left:3px solid #2ECC71; }


/* ===== Mobile Collapsible Filter Panel ===== */
.mobile-search-bar { display:flex; gap:6px; align-items:center; margin-bottom:8px; }
.mobile-search-bar input { flex:1; height:38px; padding:0 12px; border:1px solid var(--border); border-radius:8px; font-size:15px; outline:none; background:#fff; -webkit-appearance:none; }
.mobile-search-bar input:focus { border-color:var(--primary); box-shadow:0 0 0 2px var(--primary-bg); }
.mobile-search-bar .btn-filter-toggle { height:38px; padding:0 14px; border:1px solid var(--border); border-radius:8px; background:#fff; font-size:14px; cursor:pointer; white-space:nowrap; display:flex; align-items:center; gap:4px; color:var(--text-secondary); transition:all 0.2s; }
.mobile-search-bar .btn-filter-toggle:active { background:var(--bg); }
.mobile-search-bar .btn-filter-toggle.has-active { border-color:var(--primary); color:var(--primary); background:var(--primary-bg); font-weight:600; }
.mobile-filter-panel { max-height:0; overflow:hidden; transition:max-height 0.3s ease; margin-bottom:0; }
.mobile-filter-panel.open { max-height:300px; margin-bottom:10px; }
.mobile-filter-panel-inner { display:flex; gap:6px; flex-wrap:wrap; align-items:center; padding:10px 12px; background:var(--bg); border:1px solid var(--border); border-radius:8px; }
.mobile-filter-panel-inner select, .mobile-filter-panel-inner input[type="date"] { height:34px; padding:0 8px; border:1px solid var(--border); border-radius:6px; font-size:14px; background:#fff; outline:none; }
.mobile-filter-panel-inner select:focus, .mobile-filter-panel-inner input[type="date"]:focus { border-color:var(--primary); }
.mobile-filter-panel-inner input[type="checkbox"] { width:16px; height:16px; }
.mobile-filter-panel-inner label { font-size:13px; display:flex; align-items:center; gap:4px; cursor:pointer; white-space:nowrap; }
.mobile-action-row { display:flex; gap:6px; margin-bottom:6px; flex-wrap:wrap; align-items:center; }
.mobile-action-row .btn { font-size:13px; padding:4px 10px; height:32px; }

/* ===== Enhanced Filter Buttons ===== */
.ph-filters { gap:6px !important; }
.ticket-filters .ph-filter, .repair-filters .ph-filter, .request-filters .ph-filter { font-size:14px !important; padding:4px 12px !important; border-radius:6px !important; transition:all 0.2s; }
#customer-type-filters .ph-filter { font-size:13px !important; display:inline-flex; align-items:center; justify-content:center; }
.ph-label { font-weight:600; }

/* ===== Enhanced Action Buttons ===== */
.action-bar .btn { font-size:14px !important; padding:6px 14px !important; }
.detail-field { font-size:14px !important; }
.detail-field .df-label { font-size:13px !important; }
.detail-field .df-value { font-size:14px !important; }

/* ===== Request Progress Bar (prominent ticket top) ===== */
.request-progress-bar { margin:12px 0; }

/* ===== Bigger btn-sm ===== */
.btn-sm { font-size:14px !important; padding:5px 12px !important; }
.btn-info { background:var(--info); color:#fff; }
.btn-info:hover { background:#2980B9; }

/* ===== Detail grid values ===== */
.dh-title { font-size:16px !important; }

/* ===== Dashboard Module Cards ===== */
.dash-module {
  background:var(--bg-card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  margin-bottom:16px;
  overflow:hidden;
  cursor:pointer;
  transition:transform 0.15s, box-shadow 0.15s;
}
.dash-module:hover { transform:translateY(-1px); box-shadow:0 4px 16px rgba(0,0,0,0.1); }
.dash-module-tickets { border-left:4px solid #4361EE; }
.dash-module-repair { border-left:4px solid #2ECC71; }
.dash-module-requests { border-left:4px solid #F39C12; }
.dash-header {
  display:flex;justify-content:space-between;align-items:center;
  padding:14px 18px 0;
}
.dash-title { font-size:16px;font-weight:700; }
.dash-link { font-size:12px;color:var(--text-secondary); }
.dash-body { padding:12px 18px 16px; }
.dash-metrics {
  display:flex;gap:16px;margin-bottom:10px;
}
.dash-metric { min-width:60px; }
.dm-value { font-size:26px;font-weight:700;color:var(--text);line-height:1.2; }
.dm-value.dm-overdue { color:var(--danger); }
.dm-label { font-size:12px;color:var(--text-secondary);margin-top:2px; }
.dash-tags { display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px; }
.dash-tag {
  font-size:12px;padding:3px 10px;border-radius:12px;
  background:var(--primary-bg);color:var(--text);cursor:pointer;
}
.dash-tag:hover { opacity:0.8; }
.dash-module-repair .dash-tag { background:#E8F8F0; }
.dash-module-requests .dash-tag { background:#FEF5E7; }
.dash-log {
  font-size:12px;color:var(--text-secondary);padding:3px 0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.dash-log:before { content:"· ";color:#ccc; }
.dash-global {
  display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:10px;margin-top:8px;
}
.dash-global .dash-metric {
  background:var(--bg-card);border-radius:var(--radius-sm);
  padding:14px;text-align:center;cursor:pointer;
  box-shadow:var(--shadow);transition:transform 0.15s;
}
.dash-global .dash-metric:hover { transform:translateY(-1px); }

/* ===== Mobile Dashboard ===== */
@media(max-width:767px) {
  .dash-metrics { gap:12px; }
  .dm-value { font-size:22px; }
  .dash-header { padding:12px 14px 0; }
  .dash-body { padding:10px 14px 14px; }
}

/* ===== Dashboard Stat Buttons ===== */
.dash-stat-group { background:#fff; border-radius:var(--radius); padding:20px 24px; box-shadow:var(--shadow); margin-bottom:16px; }
.dash-stat-group-title { font-size:16px; font-weight:600; color:#1a1a1a; margin-bottom:16px; padding-left:12px; border-left:4px solid #1890ff; }
.dash-stat-buttons { display:flex; flex-wrap:wrap; gap:8px; }
.dash-stat-btn {
  padding:8px 20px; border-radius:6px; font-size:13px; font-weight:600;
  border:2px solid; background:transparent; cursor:pointer; transition:all 0.2s;
  text-align:center; user-select:none; display:inline-block; line-height:1.4;
}
.dash-stat-btn:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.15); }
.dash-stat-count { margin-left:4px; font-weight:700; }

@media(max-width:767px) {
  .dash-stat-group { padding:14px 16px; }
  .dash-stat-btn { padding:6px 10px; font-size:12px; min-width:0; }
}

/* PC端 整体文字放大2px */
@media (min-width: 768px) {
  body { font-size: 16px; }
  .btn { font-size: 16px; }
  .btn-sm { font-size: 14px; }
  .btn-xs { font-size: 13px; }
  .customer-tabs .ctab { font-size: 16px; }
  .cs-dropdown .cs-item { font-size: 15px; }
  .cs-dropdown .cs-phone { font-size: 14px; }
  .cs-dropdown .cs-type { font-size: 13px; }
  .form-group label { font-size: 15px; }
  .badge { font-size: 14px; }
  .card-header h2 { font-size: 18px; }
  .card-header h3 { font-size: 16px; }
  th, td { font-size: 15px; }
  .pagination button, .pagination span { font-size: 15px; }
  .modal-header h3 { font-size: 18px; }
  .modal-close { font-size: 22px; }
  .toast { font-size: 16px; }
  .sidebar-footer .uname { font-size: 15px; }
  .sidebar-footer .urole { font-size: 13px; }
  .sidebar-nav .nav-item .icon { font-size: 20px; }
  .topbar-toggle { font-size: 22px; }
  .page-header h2 { font-size: 20px; }
  .filter-bar select, .filter-bar input { font-size: 15px; }
  .login-error { font-size: 15px; }
  .detail-section h3 { font-size: 17px; }
  .detail-field .df-label { font-size: 15px; }
  .detail-field .df-value { font-size: 15px; }
  .stat-card .stat-label { font-size: 15px; }
  .stat-card .stat-sub { font-size: 14px; }
  .mobile-list-item .mli-title { font-size: 16px; }
  .mobile-list-item .mli-sub { font-size: 14px; }
  .parse-result .pr-label, .parse-result .pr-value { font-size: 15px; }
  .parse-suggestions .sug-item { font-size: 15px; }
  .smart-input-panel .panel-header h3 { font-size: 18px; }
  .smart-input-panel .input-area textarea { font-size: 17px; }
  .repair-status-banner { font-size: 18px; }
  .repair-status-banner .rsb-time { font-size: 15px; }
  .ph-filter { font-size: 13px; }
  .dm-label { font-size: 14px; }
  .dm-value { font-size: 28px; }
  .dash-title { font-size: 18px; }
  .dash-link { font-size: 14px; }
  .dash-stat-group-title { font-size: 18px; }
  .ticket-filters .ph-filter, .repair-filters .ph-filter, .request-filters .ph-filter { font-size: 16px !important; }
  #customer-type-filters .ph-filter { font-size: 15px !important; }
  .action-bar .btn { font-size: 16px !important; }
  .detail-field { font-size: 16px !important; }
  .detail-field .df-label { font-size: 15px !important; }
  .detail-field .df-value { font-size: 16px !important; }
  .btn-sm { font-size: 16px !important; }
  .dh-title { font-size: 18px !important; }
}
