:root{
--bg:#f4f7fb;--card:#fff;--text:#142033;--muted:#758197;--line:#e6ebf2;
--blue:#2864f0;--blue2:#eaf0ff;--green:#158647;--green2:#eaf8ef;
--orange:#bd6b00;--orange2:#fff3df;--red:#d43b3b;--red2:#fff0f0;
--purple:#7c3aed;--purple2:#f1eafe;--shadow:0 12px 32px rgba(25,45,80,.07)}
*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,-apple-system,"Segoe UI","Microsoft YaHei",sans-serif;background:var(--bg);color:var(--text)}.hidden{display:none!important}
.login-shell{min-height:100vh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at top left,#eef3ff,#f7f9fc 45%,#f4f7fb)}.login-card{width:min(430px,100%);background:#fff;border:1px solid var(--line);border-radius:24px;padding:30px;box-shadow:var(--shadow)}
.login-card h1{margin:10px 0 6px}.login-card p{color:var(--muted);margin:0 0 22px}.logo-dot{width:46px;height:46px;border-radius:14px;background:linear-gradient(135deg,#2864f0,#6d8fff)}
label{display:block;font-size:12px;color:var(--muted);margin:12px 0 6px}input,select,button,textarea{font:inherit}input,select,textarea{width:100%;border:1px solid var(--line);background:#fff;border-radius:11px;padding:11px 12px;outline:none}
button{border:0;border-radius:11px;padding:10px 14px;cursor:pointer}.primary{background:var(--blue);color:white;font-weight:700}.ghost{background:#fff;border:1px solid var(--line);color:var(--text)}.full{width:100%;margin-top:16px}.error{color:var(--red);font-size:13px;margin-top:10px;min-height:18px}
.topbar{height:76px;background:#fff;border-bottom:1px solid var(--line);padding:0 28px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:10}.topbar h1{font-size:21px;margin:2px 0 0}.eyebrow{font-size:10px;letter-spacing:1.3px;color:var(--muted);font-weight:800}.top-actions{display:flex;align-items:center;gap:10px}.user-badge{background:var(--blue2);color:var(--blue);padding:7px 10px;border-radius:999px;font-size:12px;font-weight:800}.container{max-width:1600px;margin:0 auto;padding:22px}
.stats-grid{display:grid;gap:12px;margin-bottom:14px}.stats-grid.six{grid-template-columns:repeat(6,1fr)}.stats-grid.four{grid-template-columns:repeat(4,1fr)}.stat-card,.panel,.employee-card{background:var(--card);border:1px solid var(--line);border-radius:17px;box-shadow:var(--shadow)}.stat-card{padding:16px}.stat-card span{font-size:12px;color:var(--muted)}.stat-card strong{display:block;font-size:29px;margin-top:6px}.stat-card.callback strong{color:var(--purple)}
.employee-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin-bottom:14px}.employee-card{padding:14px}.employee-card div{font-size:12px;color:var(--muted);margin-top:6px}
.panel{margin-bottom:14px;overflow:hidden}.panel-head{padding:16px 18px;border-bottom:1px solid var(--line)}.panel-head h2{font-size:17px;margin:0}.panel-head p{font-size:12px;color:var(--muted);margin:5px 0 0}.panel-head.responsive{display:flex;justify-content:space-between;gap:12px;align-items:center}
.customer-form{display:grid;grid-template-columns:repeat(5,1fr);gap:9px;padding:0 18px 10px}.wide2{grid-column:span 2}.upload-hint{padding:0 18px 12px;color:var(--muted);font-size:12px}.form-actions{display:flex;justify-content:flex-end;padding:0 18px 18px}
.filters{display:flex;gap:8px;flex-wrap:wrap}.filters input{min-width:230px}.filters select{width:auto}.calendar-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.calendar-tools input{width:auto}.quick-date{background:#fff;border:1px solid var(--line)}.quick-date.active{background:var(--blue);color:#fff}
.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;min-width:1700px}th,td{padding:11px 12px;border-bottom:1px solid #edf0f4;text-align:left;font-size:12px;vertical-align:middle}th{font-size:10px;text-transform:uppercase;letter-spacing:.4px;color:var(--muted);background:#fafbfd}
.pill{display:inline-flex;padding:5px 8px;border-radius:999px;font-size:10px;font-weight:800;white-space:nowrap}.pill.pending{background:var(--orange2);color:var(--orange)}.pill.chatted{background:var(--green2);color:var(--green)}.pill.callback{background:var(--purple2);color:var(--purple)}
.row-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.row-actions button{padding:7px 9px;font-size:11px}.danger{background:var(--red2);color:var(--red)}.small-select{min-width:100px;padding:7px}.note-input{min-width:170px;padding:8px}.chat-btn,.image-btn{background:var(--purple2);color:var(--purple);font-weight:700}
.toast{position:fixed;right:20px;bottom:20px;background:#172033;color:white;padding:11px 14px;border-radius:11px;z-index:100;box-shadow:var(--shadow)}.muted{color:var(--muted)}
.modal{position:fixed;inset:0;background:rgba(15,23,42,.45);display:grid;place-items:center;padding:18px;z-index:1000}.modal-card{width:min(760px,100%);height:min(700px,90vh);background:#fff;border-radius:20px;box-shadow:0 30px 90px rgba(0,0,0,.25);display:flex;flex-direction:column;overflow:hidden}.modal-head{padding:16px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}
.chat-messages{flex:1;overflow:auto;padding:16px;background:#f8faff}.msg{max-width:76%;margin-bottom:10px}.msg.mine{margin-left:auto}.bubble{padding:10px 12px;border-radius:13px;background:#fff;border:1px solid var(--line);white-space:pre-wrap}.msg.mine .bubble{background:#eaf0ff;border-color:#cad8ff}.msg-meta{font-size:10px;color:var(--muted);margin:4px 3px}.chat-img{display:block;max-width:280px;max-height:280px;border-radius:10px;margin-top:8px;cursor:pointer}.chat-compose{padding:12px;border-top:1px solid var(--line);display:flex;gap:8px}.chat-input-wrap{flex:1}.chat-input-wrap input{margin-top:7px}.chat-compose textarea{resize:none}.chat-compose button{width:100px}
.gallery-card{height:min(760px,90vh)}.gallery-grid{padding:16px;display:grid;grid-template-columns:repeat(3,1fr);gap:12px;overflow:auto}.gallery-grid img{width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:12px;border:1px solid var(--line);cursor:pointer}
@media(max-width:1200px){.stats-grid.six{grid-template-columns:repeat(3,1fr)}.employee-grid{grid-template-columns:repeat(3,1fr)}.customer-form{grid-template-columns:repeat(3,1fr)}}@media(max-width:760px){.container{padding:12px}.topbar{padding:0 14px}.stats-grid.six,.stats-grid.four{grid-template-columns:1fr 1fr}.employee-grid{grid-template-columns:1fr 1fr}.customer-form{grid-template-columns:1fr 1fr}.panel-head.responsive{align-items:flex-start;flex-direction:column}.filters{width:100%}.filters input,.filters select{width:100%;min-width:0}.gallery-grid{grid-template-columns:1fr 1fr}}

.notify-btn{position:relative;background:#fff;border:1px solid var(--line);font-size:18px;padding:8px 11px}
.notify-count{position:absolute;right:-5px;top:-6px;background:var(--red);color:#fff;min-width:20px;height:20px;border-radius:999px;font-size:10px;font-weight:800;display:grid;place-items:center;padding:0 5px;border:2px solid #fff}
.paste-hint{font-size:11px;color:var(--muted);margin-top:6px}
.paste-preview{margin-top:8px;display:flex;align-items:center;gap:8px;padding:8px;border:1px dashed #b9c7e4;border-radius:10px;background:#f8faff}
.paste-preview img{width:72px;height:72px;object-fit:cover;border-radius:9px}
.paste-preview button{padding:6px 8px;font-size:11px;background:var(--red2);color:var(--red)}

.customer-paste-preview{margin-top:8px;display:flex;gap:8px;flex-wrap:wrap;padding:8px;border:1px dashed #b9c7e4;border-radius:10px;background:#f8faff}
.customer-paste-item{position:relative}
.customer-paste-item img{width:76px;height:76px;object-fit:cover;border-radius:9px;border:1px solid var(--line)}
.customer-paste-item button{position:absolute;right:-5px;top:-5px;width:20px;height:20px;border-radius:50%;padding:0;background:#fff;color:var(--red);border:1px solid #e3a5a5;font-size:11px}

.language-select{width:auto;min-width:92px;padding:8px 10px;font-size:12px;font-weight:700;background:#fff}

.availability-head{margin:8px 2px 10px}.availability-head h2{margin:0;font-size:16px}.availability-head p{margin:4px 0 0;font-size:12px;color:var(--muted)}
.employee-card.offday{opacity:.6;background:#f6f7f9}
.employee-card .staff-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.offday-btn{padding:6px 9px;font-size:11px;border:1px solid var(--line);background:#fff}
.offday-btn.active{background:var(--red2);color:var(--red);border-color:#f1c4c4}
.assignment-order{font-size:10px;color:var(--muted);margin-top:5px}

.brand-logo-login{display:block;width:112px;height:112px;object-fit:contain;margin:0 auto 12px;border-radius:22px}
.brand-wrap{display:flex;align-items:center;gap:12px}
.brand-logo-top{width:44px;height:44px;object-fit:contain;border-radius:10px}
@media(max-width:760px){.brand-logo-top{width:38px;height:38px}.brand-wrap{gap:8px}}

.password-card{width:min(470px,100%);height:auto;max-height:none}
.password-form{padding:18px}
.password-form label{margin-top:10px}
.password-form .full{margin-top:8px}

/* ============================================================
   V5.3 Professional CRM visual refresh
   ============================================================ */
:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#182230;
  --muted:#667085;
  --line:#e4e7ec;
  --blue:#155eef;
  --blue2:#eff4ff;
  --green:#067647;
  --green2:#ecfdf3;
  --orange:#b54708;
  --orange2:#fff6ed;
  --red:#b42318;
  --red2:#fef3f2;
  --purple:#6941c6;
  --purple2:#f4f3ff;
  --shadow:0 1px 2px rgba(16,24,40,.03),0 8px 24px rgba(16,24,40,.06);
}
body{background:var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI","Microsoft YaHei",sans-serif}
.topbar{height:72px;padding:0 24px;border-bottom:1px solid #eaecf0;box-shadow:none;background:rgba(255,255,255,.96);backdrop-filter:blur(10px)}
.brand-logo-top{width:38px;height:38px;border-radius:8px}
.brand-wrap{gap:10px}.eyebrow{color:#475467;font-size:9px;letter-spacing:1.5px}.topbar h1{font-size:20px;font-weight:700;letter-spacing:-.02em}
.container{max-width:1540px;padding:20px 22px 34px}
.stat-card,.panel,.employee-card{border:1px solid #eaecf0;border-radius:12px;box-shadow:var(--shadow)}
.stat-card{padding:17px 18px;min-height:96px}.stat-card span{font-size:12px;font-weight:500;color:#667085}.stat-card strong{font-size:28px;font-weight:700;letter-spacing:-.03em;color:#101828}
.employee-card{padding:14px 14px 13px}.employee-card b{font-weight:700;color:#344054}.employee-card div{color:#667085;line-height:1.5}
.employee-card.offday{background:#f9fafb;opacity:.72}
.availability-head h2,.panel-head h2{font-size:16px;font-weight:700;color:#101828}.availability-head p,.panel-head p{color:#667085}
.panel{overflow:hidden;margin-bottom:16px}.panel-head{padding:18px 18px 15px;background:#fff}
.customer-form{gap:12px;padding:3px 18px 12px}
label{font-size:11px;font-weight:600;color:#475467;margin:8px 0 6px}
input,select,textarea{border:1px solid #d0d5dd;border-radius:8px;padding:10px 12px;color:#101828;background:#fff;box-shadow:0 1px 2px rgba(16,24,40,.03)}
input:focus,select:focus,textarea:focus{border-color:#84adff;box-shadow:0 0 0 3px #eff4ff}
button{border-radius:8px;font-weight:600;transition:.15s ease}
button:hover{transform:none;filter:brightness(.985)}
.primary{background:#155eef}.ghost{border:1px solid #d0d5dd;background:#fff;color:#344054}
.offday-btn{border-radius:7px}.offday-btn.active{background:#fef3f2;border-color:#fecdca;color:#b42318}
.language-select{border-radius:8px}
.user-badge{background:#f2f4f7;color:#344054;border-radius:999px}
.notify-btn{border-radius:8px}
.form-actions{padding:0 18px 18px}.form-actions .primary{min-width:138px}
.upload-hint,.paste-hint{color:#667085}
.table-wrap{border-top:1px solid #eaecf0}
table{min-width:1640px}
th{background:#f9fafb;color:#667085;font-size:10px;font-weight:700;letter-spacing:.05em;padding:11px 12px}
td{font-size:12px;color:#344054;padding:12px;border-bottom:1px solid #f0f1f3}
tbody tr:hover{background:#fcfcfd}
.pill{font-size:10px;border-radius:999px;font-weight:600;padding:5px 8px}
.chat-btn,.image-btn{background:#f4f3ff;color:#5925dc}
.callback-panel{border-color:#eaecf0}
.quick-date{border:1px solid #d0d5dd;background:#fff;color:#344054}
.quick-date.active{background:#155eef;color:#fff;border-color:#155eef}
.login-shell{background:#f5f7fb}
.login-card{border-radius:16px;border:1px solid #eaecf0;box-shadow:0 20px 45px rgba(16,24,40,.09);padding:32px}
.brand-logo-login{width:92px;height:92px;border-radius:18px}
.login-card h1{font-size:25px;letter-spacing:-.03em}
.modal-card{border-radius:14px;border:1px solid #eaecf0;box-shadow:0 32px 80px rgba(16,24,40,.22)}
.modal-head{background:#fff}
.chat-messages{background:#f8fafc}
.bubble{border-radius:10px}.msg.mine .bubble{background:#eff4ff;border-color:#d1e0ff}
.toast{border-radius:8px;background:#101828}

/* ============================================================
   V5.4 Modern dashboard shell
   ============================================================ */
body{background:#f4f6f8}
#appView{min-height:100vh}
.app-main{margin-left:220px;min-height:100vh}
.sidebar{
  position:fixed;left:0;top:0;bottom:0;width:220px;background:#fff;border-right:1px solid #e8ebef;
  display:flex;flex-direction:column;z-index:50;box-shadow:2px 0 12px rgba(16,24,40,.03)
}
.sidebar-brand{height:78px;display:flex;align-items:center;gap:11px;padding:0 18px;border-bottom:1px solid #eef0f3}
.sidebar-brand img{width:42px;height:42px;object-fit:contain;border-radius:10px}
.sidebar-brand b{font-size:16px;letter-spacing:.02em}.sidebar-brand span{display:block;font-size:9px;letter-spacing:.16em;color:#98a2b3;margin-top:2px}
.sidebar-nav{padding:16px 10px;display:flex;flex-direction:column;gap:6px}
.nav-item{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border-radius:8px;background:transparent;color:#475467;text-align:left;border:0;font-size:13px}
.nav-item:hover{background:#f8fafc}.nav-item.active{background:#eef4ff;color:#175cd3}
.sidebar-foot{margin-top:auto;padding:18px;color:#98a2b3;border-top:1px solid #eef0f3}
.topbar{left:220px;width:calc(100% - 220px);height:70px;position:sticky;top:0;padding:0 20px;border-bottom:1px solid #e8ebef;box-shadow:none}
.mobile-menu{display:none}
.container{padding:18px 20px 32px;max-width:none}
.stats-grid{gap:14px}
.stat-card{border-radius:10px;box-shadow:0 1px 2px rgba(16,24,40,.03);border:1px solid #e7ebef;min-height:100px}
.stat-card strong{font-size:30px}
.panel,.employee-card{border-radius:10px;box-shadow:0 1px 2px rgba(16,24,40,.025)}
.panel-head{padding:16px 18px;background:#fff}
.employee-grid{gap:12px}
.employee-card{background:#fff}
.table-wrap{background:#fff}
th{background:#f8fafc}
.section-anchor{scroll-margin-top:84px}
.login-card{border-radius:14px}
@media(max-width:900px){
  .sidebar{transform:translateX(-100%);transition:.2s}.sidebar.open{transform:translateX(0)}
  .app-main{margin-left:0}.topbar{left:0;width:100%}.mobile-menu{display:block;margin-right:10px;cursor:pointer}
}

/* V5.5 real SPA-like section switching */
.crm-view-hidden{display:none!important}
.nav-item span{pointer-events:none}
.view-title-note{font-size:12px;color:var(--muted);margin-top:4px}
.deposit-pill{background:#ecfdf3;color:#067647}

.stats-grid.seven{grid-template-columns:repeat(7,1fr)}
.stats-grid.five{grid-template-columns:repeat(5,1fr)}
@media(max-width:1350px){.stats-grid.seven{grid-template-columns:repeat(4,1fr)}.stats-grid.five{grid-template-columns:repeat(3,1fr)}}
@media(max-width:760px){.stats-grid.seven,.stats-grid.five{grid-template-columns:1fr 1fr}}

.batch-import-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:22px;padding:18px 20px}
.batch-import-grid label{display:block;font-weight:700;margin-bottom:8px}
.bulk-textarea{width:100%;min-height:160px;resize:vertical;border:1px solid var(--border);border-radius:10px;padding:12px;font:inherit;background:#fff}
.csv-help{font-size:12px;color:var(--muted);line-height:1.55;margin-bottom:14px}
.batch-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.batch-preview,.batch-result{margin:0 20px 18px;padding:14px;border:1px solid var(--border);border-radius:10px;background:#fafcff;max-height:300px;overflow:auto}
.batch-result{background:#f7fdf9}
.batch-preview table{width:100%;border-collapse:collapse;font-size:12px}
.batch-preview th,.batch-preview td{padding:7px 8px;border-bottom:1px solid var(--border);text-align:left}
@media(max-width:900px){.batch-import-grid{grid-template-columns:1fr}}

.admin-only-nav.hidden{display:none!important}

.dashboard-report-filter{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  background:#fff;border:1px solid #e7ebef;border-radius:10px;
  padding:14px 16px;margin-bottom:14px;box-shadow:0 1px 2px rgba(16,24,40,.025)
}
.dashboard-report-filter b{display:block;font-size:13px;color:#101828}
.dashboard-report-filter span{display:block;margin-top:3px;font-size:11px;color:#667085}
.dashboard-report-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.dashboard-report-actions input{width:auto;min-width:145px}
@media(max-width:760px){
  .dashboard-report-filter{align-items:flex-start;flex-direction:column}
  .dashboard-report-actions{width:100%}
  .dashboard-report-actions input{flex:1}
}

.edit-customer-card{width:min(860px,96vw);height:auto;max-height:92vh;overflow:auto}
.edit-customer-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px 14px;padding:18px}
.edit-customer-grid .wide2{grid-column:span 2}
@media(max-width:700px){.edit-customer-grid{grid-template-columns:1fr}.edit-customer-grid .wide2{grid-column:span 1}}

.bulk-action-bar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:10px 14px;border-top:1px solid #eaecf0;background:#fbfcfe
}
.bulk-action-buttons{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.select-col{width:42px;text-align:center}
.select-col input,.row-select{width:16px;height:16px;cursor:pointer}
.bulk-edit-card{width:min(760px,96vw);height:auto;max-height:92vh;overflow:auto}
.bulk-edit-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px 14px;padding:18px}
.bulk-edit-grid .wide2{grid-column:span 2}
@media(max-width:700px){.bulk-edit-grid{grid-template-columns:1fr}.bulk-edit-grid .wide2{grid-column:span 1}}

/* V5.11.1 guaranteed-visible bulk toolbar */
.bulk-action-toolbar{
  display:flex!important;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 14px;
  background:#f8fafc;
  border-top:1px solid #e7ebef;
  border-bottom:1px solid #e7ebef;
  min-height:54px;
  position:relative;
  z-index:3;
}
.bulk-left{display:flex;align-items:center;gap:14px}
.bulk-master-check{display:flex;align-items:center;gap:7px;margin:0;font-size:12px;font-weight:700;color:#344054;cursor:pointer}
.bulk-master-check input{width:16px;height:16px;margin:0}
.bulk-selected-text{font-size:12px;color:#667085}
.bulk-action-buttons{display:flex!important;align-items:center;gap:8px;flex-wrap:wrap}
#bulkEditBtn:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:780px){
  .bulk-action-toolbar{align-items:flex-start;flex-direction:column}
  .bulk-action-buttons{width:100%}
}
