*{box-sizing:border-box;margin:0;padding:0}
:root{
  --navy:#071b34;--bg:#f4f7fc;--card:#fff;--text:#0f172a;--muted:#667693;
  --line:#e4eaf3;--blue:#316de8;--orange:#ff7a1a;--green:#22b36a;--red:#f04438;--purple:#7c4dff;
  --shadow:0 12px 32px rgba(15,23,42,.08);
}
body{font-family:Inter,Arial,system-ui,-apple-system,"Segoe UI",sans-serif;background:var(--bg);color:var(--text);min-height:100vh}
button,input,select,textarea{font:inherit}
button{border:0;cursor:pointer}
input,select,textarea{width:100%;border:1px solid var(--line);border-radius:14px;padding:13px 14px;outline:none;background:#fff;color:var(--text)}
textarea{resize:vertical;min-height:110px}
.hidden{display:none!important}
.login-screen{min-height:100vh;display:grid;place-items:center;padding:24px;background:#0a1628}
.login-card{width:100%;max-width:430px;background:#111f35;border:1px solid rgba(124,157,205,.25);box-shadow:0 24px 60px rgba(0,0,0,.28);border-radius:22px;padding:34px 28px 22px;text-align:center}
.login-logo{width:88px;height:88px;border-radius:20px;display:grid;place-items:center;background:#fff;color:var(--orange);font-weight:950;font-size:30px;margin:0 auto 14px}
.login-card h1{font-size:22px;color:#fff}
.login-card p{color:#a9b7cc;font-size:14px;margin-top:8px}
.login-fields{display:grid;gap:14px;margin-top:34px}
.login-fields input{background:#e8f0ff;border-color:#b9c8e6}
.login-btn{width:100%;margin-top:14px;background:linear-gradient(135deg,var(--orange),#ff921f);color:#fff;border-radius:14px;padding:15px;font-weight:900}
.login-foot{color:#9cadaf;font-size:12px;margin-top:20px}
.crm-layout{min-height:100vh;display:grid;grid-template-columns:255px minmax(0,1fr)}
.sidebar{position:sticky;top:0;height:100vh;overflow:auto;background:var(--navy);color:#fff;padding:12px}
.side-brand{display:flex;gap:11px;align-items:center;padding-bottom:18px}
.logo-ball,.avatar{width:54px;height:54px;border-radius:16px;display:grid;place-items:center;background:#fff;color:var(--orange);font-weight:950;flex:0 0 auto}
.side-brand h2{font-size:18px;line-height:1.1}
.side-brand p{font-size:12px;color:#c3d0e3;margin-top:6px}
.admin-box{display:flex;align-items:center;gap:12px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.09);border-radius:18px;padding:14px;margin-bottom:16px}
.avatar{width:46px;height:46px;border-radius:50%;font-size:15px}
.admin-box b{display:block;font-size:16px}
.admin-box span{display:flex;align-items:center;gap:6px;color:#9ff2b4;font-size:12px;margin-top:4px}
.admin-box i{width:7px;height:7px;background:#6ee7b7;border-radius:50%}
.side-menu{display:grid;gap:7px}
.menu-item{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;background:transparent;color:#d4e1f5;padding:13px 14px;border-radius:14px;text-align:left;font-size:15px;font-weight:750}
.menu-item:hover,.menu-item.active{background:var(--blue);color:#fff}
.menu-item span{min-width:28px;height:24px;padding:0 8px;border-radius:999px;background:rgba(255,255,255,.14);display:grid;place-items:center;font-size:12px}
.main-content{padding:10px 18px 28px;min-width:0}
.topbar{display:grid;grid-template-columns:minmax(0,1fr) 48px 130px 96px;gap:14px;align-items:center;margin-bottom:16px}
.search-box{background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);display:flex;align-items:center;gap:12px;padding:0 16px;height:62px}
.search-box input{border:0;box-shadow:none;padding:0;background:transparent;font-weight:650}
.icon-btn,.date-btn,.filter-btn{height:52px;border-radius:14px;background:#fff;color:#172033;border:1px solid var(--line);box-shadow:var(--shadow);font-weight:800}
.stat-row{display:grid;grid-template-columns:repeat(6,minmax(150px,1fr));gap:16px;margin-bottom:16px}
.stat-card{background:#fff;border:1px solid var(--line);border-radius:18px;min-height:112px;padding:17px 18px;box-shadow:var(--shadow);display:flex;align-items:center;justify-content:space-between;gap:12px}
.stat-card span{font-size:13px;color:#71809c;font-weight:850}
.stat-card b{display:block;font-size:26px;color:var(--blue);margin-top:6px}
.stat-card p{font-size:12px;color:var(--muted);margin-top:7px}
.stat-card i{width:56px;height:56px;border-radius:50%;display:grid;place-items:center;background:#eef5ff;font-style:normal;font-size:25px}
.stat-card.hot b{color:#ff4d5f}.stat-card.hot i{background:#fff0f2}.stat-card.revenue b{color:#e97900}.stat-card.revenue i{background:#fff5e8}
.content-grid{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;margin-bottom:16px}
.panel{background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow)}
.panel-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px 10px}
.panel h3,.panel-head h3{font-size:18px;letter-spacing:-.35px}
.panel-head button{background:transparent;color:#2869ef;font-weight:850}
.table-wrap{overflow:auto;padding:0 16px 16px}
table{width:100%;border-collapse:separate;border-spacing:0;min-width:1080px;font-size:13px}
th{background:#f3f6fb;color:#70809d;font-size:12px;text-align:left;padding:13px 10px;font-weight:900}
td{padding:14px 10px;border-bottom:1px solid #edf1f7;vertical-align:middle}
.customer-name{font-weight:900;font-size:14px}.customer-address{font-size:12px;color:#71809c;margin-top:4px;max-width:150px}.product-name{font-weight:850}
.status-pill{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;padding:7px 10px;font-size:11px;font-weight:950;white-space:nowrap}
.status-new{background:#fff2e8;color:#c05600}.status-confirmed{background:#eef4ff;color:#316de8}.status-call{background:#eef8ff;color:#0b74d1}.status-done{background:#ecfdf3;color:#067647}.status-shipping{background:#f4f3ff;color:#5925dc}.status-completed{background:#e8fff3;color:#027a48}.status-cancel{background:#fff0f1;color:#b42318}
.table-actions{display:flex;gap:8px}
.table-actions button,.table-actions a{width:36px;height:36px;border-radius:10px;border:1px solid #dce5f3;background:#fff;display:grid;place-items:center;color:#172033}
.right-col{display:grid;gap:16px}.mini-panel{padding:16px}.simple-list{display:grid;gap:12px;margin-top:14px}
.simple-item{display:flex;align-items:center;justify-content:space-between;gap:12px;border-radius:15px;background:#f8faff;border:1px solid #edf1f7;padding:12px}
.simple-item b{font-size:14px}.simple-item small{display:block;color:#71809c;margin-top:4px}.simple-item span{font-size:12px;color:#71809c}
.empty{color:#71809c;font-size:13px;line-height:1.5;padding:8px 0}
.charts-grid{display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:16px}
.chart-card{padding:16px;min-height:300px}
.bar-chart{margin-top:16px;height:220px;display:flex;align-items:end;gap:14px;border-left:1px solid #dfe6f2;border-bottom:1px solid #dfe6f2;padding:10px 10px 0}
.bar{flex:1;min-width:24px;border-radius:8px 8px 0 0;background:var(--blue);position:relative}
.bar::after{content:attr(data-label);position:absolute;left:50%;bottom:-28px;transform:translateX(-50%);font-size:11px;color:#71809c;white-space:nowrap}
.bar::before{content:attr(data-value);position:absolute;left:50%;top:-22px;transform:translateX(-50%);font-size:11px;font-weight:900;color:#172033}
.donut-wrap{display:flex;align-items:center;justify-content:center;gap:20px;margin-top:28px}
.donut{width:190px;height:190px;border-radius:50%;position:relative;flex:0 0 auto;background:#e5e7eb}
.donut::after{content:"";position:absolute;inset:52px;background:#fff;border-radius:50%}
.legend{display:grid;gap:8px;font-size:12px;color:#71809c}.legend-item{display:flex;align-items:center;gap:7px}.legend-dot{width:12px;height:12px;border-radius:3px}
.chat-page-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.chat-page-head h2{font-size:24px}.chat-page-head p{color:#71809c;margin-top:6px;font-size:13px}
.chat-layout{display:grid;grid-template-columns:340px minmax(0,1fr);gap:16px;height:calc(100vh - 130px)}
.chat-thread-list,.chat-conversation{display:grid;grid-template-rows:auto 1fr}
.chat-thread-head{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:1px solid var(--line)}
#chatThreads{overflow:auto;padding:10px;display:grid;gap:10px}
.thread-item{padding:12px;border:1px solid #e9eef7;border-radius:16px;background:#f8faff;cursor:pointer}
.thread-item.active{border-color:#a8c1ff;background:#eef4ff}
.thread-item b{display:block;font-size:14px}.thread-item small{display:block;color:#71809c;margin-top:4px;line-height:1.4}.thread-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.thread-badge{min-width:22px;height:22px;border-radius:999px;background:var(--red);color:#fff;font-size:11px;font-weight:900;display:grid;place-items:center;padding:0 6px}
.conversation-head{padding:16px;border-bottom:1px solid var(--line);font-size:14px}.conversation-head b{display:block}.conversation-head span{display:block;color:#71809c;margin-top:4px}
.crm-messages{overflow:auto;padding:16px;display:grid;gap:12px;background:#fafcff}
.crm-reply-form{border-top:1px solid var(--line);padding:12px;display:grid;grid-template-columns:1fr 90px;gap:10px;background:#fff}
.crm-reply-form button{border-radius:14px;background:var(--blue);color:#fff;font-weight:900}
.msg{max-width:74%;padding:10px 12px;border-radius:16px;font-size:14px;line-height:1.45}
.msg.customer{background:#fff;border:1px solid #e7ecf4;border-bottom-left-radius:6px}
.msg.admin{margin-left:auto;background:#316de8;color:#fff;border-bottom-right-radius:6px}
.msg small{display:block;font-size:11px;opacity:.72;margin-top:5px}
.modal{position:fixed;inset:0;background:rgba(15,23,42,.42);display:none;align-items:center;justify-content:center;padding:20px;z-index:90}
.modal.show{display:flex}
.modal-card,.detail-card{background:#fff;border-radius:20px;width:100%;max-width:460px;box-shadow:0 24px 70px rgba(15,23,42,.26);overflow:hidden}
.modal-card.wide,.detail-card{max-width:720px}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--line)}
.modal-head button{width:38px;height:38px;border-radius:50%;background:#f1f5fb;font-size:23px}
.modal-body{display:grid;gap:14px;padding:18px 20px}
.modal-body label span{display:block;font-size:12px;font-weight:900;color:#61708d;margin-bottom:7px}
.modal-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.modal-actions.single{grid-template-columns:1fr}
.modal-actions button{border-radius:14px;padding:13px;font-weight:900}.secondary,#clearFilterBtn{background:#f1f5fb;color:#172033}#applyFilterBtn,#saveOrderEditBtn,#saveProfileBtn,#savePasswordBtn{background:var(--blue);color:#fff}
.detail-body{padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:12px}
.detail-line{border:1px solid var(--line);background:#f8faff;border-radius:14px;padding:13px}.detail-line.full{grid-column:1/-1}.detail-line span{display:block;color:#71809c;font-size:12px;font-weight:900;margin-bottom:5px}.detail-line b{font-size:15px}
.detail-status-actions{grid-column:1/-1;display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-top:6px}
.detail-status-actions button{padding:11px 6px;border-radius:12px;background:#f1f5fb;font-size:12px;font-weight:900}
.empty-state{color:#71809c}
.toast{position:fixed;right:22px;bottom:22px;background:#101828;color:#fff;border-radius:14px;padding:13px 16px;font-size:14px;font-weight:800;box-shadow:0 18px 36px rgba(15,23,42,.28);opacity:0;transform:translateY(15px);transition:.25s;z-index:120}
.toast.show{opacity:1;transform:translateY(0)}
@media(max-width:1200px){.crm-layout{grid-template-columns:88px minmax(0,1fr)}.side-brand div:not(.logo-ball),.admin-box div,.menu-item span{display:none}.side-brand{justify-content:center}.menu-item{justify-content:center;font-size:0}.menu-item::first-letter{font-size:18px}.admin-box{justify-content:center}.stat-row{grid-template-columns:repeat(2,1fr)}.content-grid{grid-template-columns:1fr}.right-col{grid-template-columns:1fr 1fr}.charts-grid{grid-template-columns:1fr 1fr}.chat-layout{grid-template-columns:1fr}}
@media(max-width:760px){.crm-layout{display:block}.sidebar{position:relative;height:auto;border-radius:0 0 24px 24px}.side-menu{grid-template-columns:repeat(2,1fr)}.menu-item{font-size:13px;justify-content:space-between}.side-brand div:not(.logo-ball),.admin-box div,.menu-item span{display:block}.main-content{padding:12px}.topbar{grid-template-columns:1fr 48px;gap:10px}.date-btn,.filter-btn{display:none}.stat-row,.charts-grid,.right-col,.detail-body{grid-template-columns:1fr}.detail-status-actions{grid-template-columns:1fr 1fr}.chat-layout,.content-grid{grid-template-columns:1fr}.chat-page-head{display:grid;gap:12px}.crm-reply-form{grid-template-columns:1fr}}

/* v2.7 pagination */
.pagination{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:12px 16px 16px;
  border-top:1px solid #edf1f7;
}
.pagination.compact{
  padding:10px;
}
.pagination button{
  min-width:36px;
  height:34px;
  border-radius:10px;
  background:#f1f5fb;
  color:#172033;
  font-weight:900;
}
.pagination button.active{
  background:#316de8;
  color:#fff;
}
.pagination button:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.pagination span{
  color:#71809c;
  font-size:12px;
  font-weight:800;
}


/* v3.3 CRM sound notification */
.notify-banner{
  margin-bottom:16px;
  background:linear-gradient(135deg,#fff7ed,#fff);
  border:1px solid #fed7aa;
  border-radius:18px;
  padding:13px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  box-shadow:0 10px 24px rgba(249,115,22,.10);
}
.notify-banner.hidden{display:none}
.notify-banner b{display:block;color:#9a3412;font-size:15px}
.notify-banner span{display:block;margin-top:3px;color:#7c2d12;font-size:13px}
.notify-banner button{
  background:#fb923c;color:#fff;border-radius:12px;padding:10px 13px;
  font-weight:900;white-space:nowrap;
}
.sound-on{background:#fff7ed!important;border-color:#fed7aa!important}
.sound-muted{opacity:.62}
@keyframes notifyPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}
.sound-alert{animation:notifyPulse .65s ease-in-out infinite}


/* v3.8 - cấu hình phí ship & mã ưu đãi */
.crm-check-row{
  display:flex!important;
  align-items:center;
  gap:10px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#f8faff;
  padding:12px;
}
.crm-check-row input{
  width:18px;
  height:18px;
  flex:0 0 auto;
}
.crm-check-row span{
  margin:0!important;
  font-size:13px!important;
  color:#172033!important;
}
.settings-preview{
  border-radius:14px;
  background:#fff7ed;
  border:1px solid #fed7aa;
  padding:12px;
  color:#9a3412;
  font-size:13px;
  line-height:1.45;
}
#savePricingSettingsBtn{
  background:var(--blue);
  color:#fff;
}


/* v3.9 - Quản lý AFF / Affiliate */
.stat-card.commission b{color:#7c4dff}.stat-card.commission i{background:#f4f3ff}
.affiliate-panel{padding-top:16px}
.affiliate-panel table{min-width:1080px}
.aff-link{color:var(--blue);font-weight:900;text-decoration:none}
.aff-link:hover{text-decoration:underline}
.affiliate-form-grid{grid-template-columns:1fr 1fr}
.affiliate-form-grid .full-row{grid-column:1/-1}
.muted{color:#71809c}
#saveAffiliateBtn{background:var(--blue);color:#fff}
@media(max-width:760px){
  .affiliate-form-grid{grid-template-columns:1fr}
  .affiliate-form-grid .full-row{grid-column:auto}
}

/* v4.1 logo brand */
.login-logo img,.logo-ball img{width:100%;height:100%;object-fit:contain;display:block}
.login-logo,.logo-ball{overflow:hidden;background:transparent!important}

/* v5.0 đa sản phẩm + hoa hồng AFF theo sản phẩm */
.affiliate-products-box{border:1px solid #e5e7eb;border-radius:16px;padding:14px;background:#fafafa}
.affiliate-products-box h4{margin:0 0 10px;font-size:15px}
#affiliateProductsBox{display:grid;gap:8px}
.aff-product-row{display:grid;grid-template-columns:1fr 120px;gap:10px;align-items:center;padding:10px;border-radius:12px;background:#fff;border:1px solid #eef0f3}
.aff-product-row label{display:flex;align-items:center;gap:8px;margin:0}
.aff-product-row small{color:#667085}
.aff-product-row input[type="number"]{width:100%}
@media(max-width:720px){.aff-product-row{grid-template-columns:1fr}.aff-product-row input[type="number"]{width:100%}}


/* v5.1 - nút xem/copy link rõ ràng */
.link-preview-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.mini-link-btn{border:0;border-radius:999px;background:#111827;color:#fff;padding:9px 12px;font-weight:800;cursor:pointer;white-space:nowrap}
.table-actions.text-actions{display:flex;gap:6px;flex-wrap:wrap}
.table-actions.text-actions button{width:auto;min-width:0;padding:8px 10px;border-radius:999px;font-size:12px;font-weight:800}
.aff-product-row{grid-template-columns:1fr 120px auto!important}
.aff-product-copy{justify-self:end}
@media(max-width:720px){
  .link-preview-row{align-items:flex-start}
  .aff-product-row{grid-template-columns:1fr!important}
  .aff-product-copy{justify-self:start}
}

/* v5.4: form quản lý sản phẩm dài, cho cuộn mượt */
.modal-card.wide{max-height:min(92vh,900px);display:flex;flex-direction:column}
.modal-card.wide .modal-head{flex:0 0 auto}
.modal-card.wide .modal-body{overflow:auto;-webkit-overflow-scrolling:touch}


/* =========================================================
   v5.5 - Popup quản lý sản phẩm dài: cuộn chuẩn, nút lưu luôn thao tác được
========================================================= */
#productModal{
  padding:18px!important;
}
#productModal .modal-card.wide{
  width:min(860px,100%)!important;
  height:min(92dvh,900px)!important;
  max-height:min(92dvh,900px)!important;
  display:flex!important;
  flex-direction:column!important;
}
#productModal .modal-head{
  flex:0 0 auto!important;
  background:#fff!important;
  position:relative;
  z-index:3;
}
#productModal .modal-body{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow:auto!important;
  -webkit-overflow-scrolling:touch!important;
  align-content:start!important;
  padding-bottom:18px!important;
}
#productModal .modal-actions{
  position:sticky!important;
  bottom:-18px!important;
  z-index:4!important;
  margin:6px -20px -18px!important;
  padding:14px 20px calc(14px + env(safe-area-inset-bottom))!important;
  background:#fff!important;
  border-top:1px solid var(--line)!important;
  box-shadow:0 -10px 18px rgba(15,23,42,.06)!important;
}
#productModal #saveProductBtn{
  background:var(--blue)!important;
  color:#fff!important;
}
@media(max-width:720px){
  #productModal{
    align-items:flex-end!important;
    padding:0!important;
  }
  #productModal .modal-card.wide{
    width:100%!important;
    height:min(94dvh,900px)!important;
    max-height:min(94dvh,900px)!important;
    border-radius:22px 22px 0 0!important;
  }
  #productModal .modal-head{
    padding:14px 16px!important;
  }
  #productModal .modal-body{
    padding:14px 16px 16px!important;
    gap:12px!important;
  }
  #productModal .modal-actions{
    bottom:-16px!important;
    margin:6px -16px -16px!important;
    padding:12px 16px calc(12px + env(safe-area-inset-bottom))!important;
  }
}

/* v5.6 - Form sản phẩm nhập liệu trực quan, không nhập code */
.structured-box{
  border:1px solid var(--line);
  background:#f8faff;
  border-radius:16px;
  padding:14px;
  display:grid;
  gap:12px;
}
.structured-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size:13px;
  font-weight:900;
  color:#172033;
}
.structured-rows{display:grid;gap:10px}
.structured-row{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr)) 34px;
  gap:8px;
  align-items:end;
  border:1px solid #dbe5f3;
  background:#fff;
  border-radius:14px;
  padding:10px;
}
.structured-row.video-row{grid-template-columns:1fr 1fr 1fr 1fr 34px}
.structured-row.review-row{grid-template-columns:1fr .62fr 1fr 1.5fr 1fr .65fr 34px}
.structured-row.suggestion-row{grid-template-columns:1fr 1fr .8fr 1fr 34px}
.structured-row.size-row{grid-template-columns:1fr 1fr 34px}
.structured-row label,.structured-grid label,.inline-label{display:grid;gap:6px}
.structured-row label span,.structured-grid label span,.inline-label span{font-size:11px!important;font-weight:850;color:#71809c!important}
.remove-structured-row{
  height:42px;
  width:34px;
  border-radius:11px;
  background:#fee2e2;
  color:#b91c1c;
  font-size:20px;
  font-weight:900;
}
.structured-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}
.inline-label{max-width:320px}
.structured-hint{color:#71809c;font-size:12px}
.editor-toolbar{display:flex;flex-wrap:wrap;gap:8px}
.editor-toolbar button{
  border:1px solid #dbe5f3;
  background:#fff;
  border-radius:10px;
  padding:8px 10px;
  font-weight:850;
  color:#172033;
}
.rich-editor{
  min-height:170px;
  border:1px solid #dbe5f3;
  border-radius:14px;
  background:#fff;
  padding:14px;
  line-height:1.55;
  outline:none;
  overflow:auto;
}
.rich-editor:empty::before{content:attr(data-placeholder);color:#94a3b8}
.rich-editor h2{font-size:20px;margin:0 0 10px}
.rich-editor h3{font-size:16px;margin:12px 0 8px}
.rich-editor p{margin:8px 0}
@media(max-width:900px){
  .structured-row,.structured-row.video-row,.structured-row.review-row,.structured-row.suggestion-row,.structured-row.size-row,.structured-grid{grid-template-columns:1fr}
  .remove-structured-row{width:100%}
}


/* =========================================================
   v5.8 - CRM mobile app layout
========================================================= */
.order-mobile-cards{display:none}
@media(max-width:760px){
  body{background:#f3f7fd}
  .crm-layout{display:block;min-height:100dvh}
  .sidebar{
    position:relative!important;
    height:auto!important;
    padding:14px 14px 16px!important;
    border-radius:0 0 28px 28px!important;
    overflow:visible!important;
  }
  .side-brand{gap:12px;margin-bottom:14px;padding:2px 2px 10px}
  .logo-ball{width:46px!important;height:46px!important;flex:0 0 46px}
  .side-brand h2{font-size:20px!important;line-height:1.1}
  .side-brand p{font-size:12px!important;margin-top:4px}
  .admin-box{
    margin:0 0 14px!important;
    padding:12px 14px!important;
    border-radius:20px!important;
    min-height:auto!important;
  }
  .avatar{width:48px!important;height:48px!important;flex:0 0 48px;font-size:14px!important}
  .admin-box b{font-size:16px!important}
  .admin-box span{font-size:12px!important}
  .side-menu{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  .menu-item{
    min-height:54px!important;
    height:auto!important;
    border-radius:16px!important;
    padding:11px 12px!important;
    font-size:13px!important;
    line-height:1.2!important;
    gap:8px!important;
    background:rgba(255,255,255,.05)!important;
  }
  .menu-item.active{background:linear-gradient(135deg,#2f6be8,#3b82f6)!important;box-shadow:0 10px 22px rgba(49,109,232,.28)}
  .menu-item span{
    min-width:25px!important;
    height:25px!important;
    padding:0 7px!important;
    display:grid!important;
    place-items:center!important;
    border-radius:999px!important;
    background:rgba(255,255,255,.12)!important;
    font-size:12px!important;
  }
  .main-content{padding:14px 12px 28px!important;overflow:hidden}
  .topbar{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 48px 48px!important;
    gap:8px!important;
    align-items:center!important;
    margin-bottom:12px!important;
  }
  .search-box{height:52px!important;border-radius:18px!important}
  .search-box input{font-size:14px!important}
  .icon-btn{width:48px!important;height:48px!important;border-radius:16px!important}
  #refreshBtn{display:grid!important}
  .date-btn,.topbar .filter-btn{display:none!important}
  .notify-banner{border-radius:18px!important;margin-bottom:12px!important}
  .stat-row{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
    margin-bottom:12px!important;
  }
  .stat-card{
    min-height:112px!important;
    border-radius:22px!important;
    padding:14px!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  .stat-card i{
    order:-1;
    width:42px!important;
    height:42px!important;
    border-radius:14px!important;
    font-size:20px!important;
  }
  .stat-card span{font-size:12px!important}
  .stat-card b{font-size:22px!important}
  .stat-card p{display:none!important}
  .content-grid{display:grid!important;grid-template-columns:1fr!important;gap:12px!important;margin-bottom:12px!important}
  .panel{border-radius:22px!important;box-shadow:0 10px 26px rgba(15,23,42,.06)!important}
  .panel-head{padding:14px 14px 8px!important}
  .panel-head h3{font-size:16px!important}
  #dashboardView .content-grid .table-wrap{display:none!important}
  .order-mobile-cards{display:grid!important;gap:10px;padding:0 12px 12px}
  .order-mobile-card{
    border:1px solid #e7edf7;
    background:#fff;
    border-radius:18px;
    padding:13px;
    display:grid;
    gap:11px;
  }
  .order-mobile-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
  .order-mobile-top small{display:block;color:#71809c;font-size:11px;margin-bottom:4px}
  .order-mobile-top h4{font-size:14px;line-height:1.3}
  .order-mobile-top .status-pill{white-space:nowrap}
  .order-mobile-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .order-mobile-grid div{min-width:0}
  .order-mobile-grid span{display:block;color:#71809c;font-size:11px;font-weight:800;margin-bottom:3px}
  .order-mobile-grid b{display:block;font-size:13px;line-height:1.35;word-break:break-word}
  .order-mobile-actions{display:flex;gap:8px;flex-wrap:wrap}
  .order-mobile-actions a,.order-mobile-actions button{
    display:inline-flex;align-items:center;justify-content:center;
    min-height:38px;border-radius:999px;padding:0 13px;
    background:#f1f5fb;color:#172033;text-decoration:none;font-size:13px;font-weight:900;
  }
  .mobile-empty{padding:14px!important}
  .pagination{padding:10px 12px 14px!important;flex-wrap:wrap}
  .right-col{display:grid!important;grid-template-columns:1fr!important;gap:12px!important}
  .mini-panel{padding:14px!important}
  .charts-grid{display:grid!important;grid-template-columns:1fr!important;gap:12px!important}
  .chart-card{min-height:auto!important;padding:14px!important;overflow:hidden}
  .bar-chart{height:180px!important;gap:8px!important;margin-top:14px!important}
  .donut-wrap{display:grid!important;justify-items:center!important;gap:14px!important;margin-top:16px!important}
  .donut{width:160px!important;height:160px!important}
  .donut::after{inset:44px!important}
  .legend{width:100%!important;grid-template-columns:1fr 1fr!important;gap:10px!important}
  .chat-page-head{display:grid!important;gap:10px!important;margin-bottom:12px!important}
  .chat-page-head h2{font-size:20px!important}
  .chat-page-head .filter-btn{display:block!important;width:100%!important;min-height:46px!important}
  #productView .table-wrap,#affiliateView .table-wrap{padding:0 10px 12px!important}
  #productView table,#affiliateView table{
    min-width:0!important;
    display:block!important;
    width:100%!important;
  }
  #productView thead,#affiliateView thead{display:none!important}
  #productView tbody,#affiliateView tbody{display:grid!important;gap:10px!important}
  #productView tr,#affiliateView tr{
    display:grid!important;
    gap:8px!important;
    border:1px solid #e7edf7!important;
    background:#fff!important;
    border-radius:18px!important;
    padding:13px!important;
  }
  #productView td,#affiliateView td{
    display:flex!important;
    justify-content:space-between!important;
    gap:12px!important;
    border:0!important;
    padding:0!important;
    text-align:right!important;
    align-items:flex-start!important;
  }
  #productView td::before,#affiliateView td::before{color:#71809c;font-weight:850;font-size:12px;text-align:left;flex:0 0 92px}
  #productView td:nth-child(1)::before{content:'Sản phẩm'}
  #productView td:nth-child(2)::before{content:'Link'}
  #productView td:nth-child(3)::before{content:'Giá'}
  #productView td:nth-child(4)::before{content:'Giá gốc'}
  #productView td:nth-child(5)::before{content:'Màu'}
  #productView td:nth-child(6)::before{content:'Size'}
  #productView td:nth-child(7)::before{content:'Trạng thái'}
  #productView td:nth-child(8)::before{content:'Thao tác'}
  #affiliateView td:nth-child(1)::before{content:'Tên AFF'}
  #affiliateView td:nth-child(2)::before{content:'Link AFF'}
  #affiliateView td:nth-child(3)::before{content:'Tài khoản'}
  #affiliateView td:nth-child(4)::before{content:'Hoa hồng'}
  #affiliateView td:nth-child(5)::before{content:'Đơn'}
  #affiliateView td:nth-child(6)::before{content:'Doanh thu'}
  #affiliateView td:nth-child(7)::before{content:'HH chốt'}
  #affiliateView td:nth-child(8)::before{content:'Trạng thái'}
  #affiliateView td:nth-child(9)::before{content:'Thao tác'}
  #productView .table-actions,#affiliateView .table-actions{justify-content:flex-end!important}
  .chat-layout{height:auto!important;display:grid!important;grid-template-columns:1fr!important;gap:12px!important}
  .chat-thread-list{min-height:280px!important}
  .chat-conversation{min-height:420px!important}
  .modal{padding:10px!important}
  .modal-card,.detail-card{border-radius:22px!important}
  .detail-body{grid-template-columns:1fr!important;padding:14px!important}
}
@media(max-width:390px){
  .side-menu{grid-template-columns:1fr!important}
  .stat-row{grid-template-columns:1fr!important}
  .order-mobile-grid{grid-template-columns:1fr!important}
  .legend{grid-template-columns:1fr!important}
}


/* =========================================================
   v5.9 - CRM mobile compact kiểu app
========================================================= */
.mobile-status-strip,.mobile-bottom-nav,.mobile-more-sheet,.mobile-section-title{display:none}
@media(max-width:760px){
  body{background:#f5f7fb!important}
  .crm-layout{padding-bottom:78px!important}
  .sidebar{
    padding:14px 14px 16px!important;
    border-radius:0 0 26px 26px!important;
  }
  .side-brand{margin-bottom:10px!important}
  .side-brand h2{font-size:18px!important}
  .admin-box{
    padding:10px 12px!important;
    margin-bottom:0!important;
    border-radius:18px!important;
  }
  .avatar{width:42px!important;height:42px!important;flex-basis:42px!important}
  .side-menu{display:none!important}
  .main-content{padding:12px 12px 18px!important;overflow:visible!important}
  .topbar{
    position:sticky;
    top:8px;
    z-index:30;
    margin-bottom:10px!important;
    grid-template-columns:minmax(0,1fr) 42px 42px!important;
    gap:8px!important;
  }
  .search-box{height:46px!important;border-radius:16px!important}
  .search-box input{font-size:13px!important}
  .icon-btn{width:42px!important;height:42px!important;border-radius:14px!important}
  .mobile-status-strip{
    display:flex;
    gap:8px;
    overflow:auto;
    padding:0 0 10px;
    scrollbar-width:none;
  }
  .mobile-status-strip::-webkit-scrollbar{display:none}
  .mobile-status-chip{
    white-space:nowrap;
    min-height:34px;
    padding:0 12px;
    border-radius:999px;
    background:#fff;
    border:1px solid #e6ebf3;
    color:#64748b;
    font-size:12px;
    font-weight:850;
  }
  .mobile-status-chip.active{background:#316de8;color:#fff;border-color:#316de8;box-shadow:0 8px 18px rgba(49,109,232,.22)}
  .notify-banner{padding:11px 12px!important}
  .mobile-section-title{
    display:block;
    margin:4px 2px 10px;
    color:#172033;
    font-size:15px;
    font-weight:950;
  }
  .stat-row{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    margin-bottom:12px!important;
  }
  .stat-card{
    min-height:78px!important;
    border-radius:18px!important;
    padding:11px 12px!important;
    grid-template-columns:1fr auto!important;
    align-items:center!important;
    gap:6px!important;
  }
  .stat-card i{
    order:0!important;
    width:34px!important;
    height:34px!important;
    border-radius:12px!important;
    font-size:17px!important;
  }
  .stat-card span{font-size:11px!important;line-height:1.15!important}
  .stat-card b{font-size:20px!important;line-height:1.1!important;margin-top:3px!important}
  .content-grid{gap:10px!important}
  .panel{border-radius:20px!important}
  .panel-head{padding:12px 12px 8px!important}
  .panel-head h3{font-size:15px!important}
  .panel-head button{font-size:12px!important}
  .order-mobile-cards{gap:8px!important;padding:0 10px 10px!important}
  .order-mobile-card.compact-card{
    border-radius:16px!important;
    padding:11px!important;
    gap:9px!important;
  }
  .order-mobile-top h4{
    font-size:13px!important;
    line-height:1.25!important;
    margin:0;
  }
  .order-mobile-top small{font-size:10px!important}
  .status-pill{font-size:11px!important;padding:6px 9px!important}
  .order-compact-main{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    padding:9px;
    border-radius:14px;
    background:#f7f9fd;
  }
  .order-compact-main span{display:block;color:#71809c;font-size:10px;font-weight:850;margin-bottom:2px}
  .order-compact-main b{display:block;font-size:13px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .order-compact-main small{display:block;color:#71809c;font-size:10px;line-height:1.25;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .order-compact-foot{display:flex;align-items:center;justify-content:space-between;gap:8px}
  .order-compact-foot>span{min-width:0;color:#64748b;font-size:11px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .order-mobile-actions{gap:6px!important;flex-wrap:nowrap!important}
  .order-mobile-actions a,.order-mobile-actions button{
    min-height:30px!important;
    padding:0 10px!important;
    font-size:12px!important;
  }
  .right-col{gap:10px!important}
  .mini-panel{padding:12px!important}
  .mini-panel h3{font-size:14px!important;margin-bottom:8px!important}
  .simple-item{padding:9px 0!important}
  .simple-item b{font-size:12px!important}
  .simple-item small,.simple-item span{font-size:11px!important}
  .charts-grid{gap:10px!important}
  .chart-card{padding:12px!important}
  .chart-card h3{font-size:14px!important}
  .bar-chart{height:128px!important;margin-top:10px!important}
  .donut{width:128px!important;height:128px!important}
  .donut::after{inset:36px!important}
  .legend{gap:7px!important;font-size:11px!important}
  .mobile-bottom-nav{
    position:fixed;
    left:10px;
    right:10px;
    bottom:10px;
    z-index:70;
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:4px;
    padding:7px;
    border:1px solid rgba(226,232,240,.9);
    border-radius:24px;
    background:rgba(255,255,255,.94);
    backdrop-filter:blur(18px);
    box-shadow:0 18px 42px rgba(15,23,42,.16);
  }
  .mobile-nav-btn{
    min-height:52px;
    display:grid;
    place-items:center;
    gap:2px;
    border-radius:18px;
    background:transparent;
    color:#64748b;
  }
  .mobile-nav-btn i{font-style:normal;font-size:18px;line-height:1}
  .mobile-nav-btn span{font-size:10px;font-weight:900}
  .mobile-nav-btn.active{background:#eef4ff;color:#316de8}
  .mobile-more-sheet{position:fixed;inset:0;z-index:85;display:none}
  .mobile-more-sheet.show{display:block}
  .mobile-more-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.36)}
  .mobile-more-card{
    position:absolute;left:10px;right:10px;bottom:82px;
    background:#fff;border-radius:24px;padding:14px;
    box-shadow:0 20px 48px rgba(15,23,42,.22);
  }
  .mobile-more-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
  .mobile-more-head b{font-size:16px}
  .mobile-more-head button{width:32px;height:32px;border-radius:50%;background:#f1f5fb;font-size:22px}
  .mobile-more-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
  .mobile-more-grid button{
    min-height:72px;border-radius:18px;background:#f7f9fd;
    display:grid;place-items:center;gap:4px;font-size:20px;
  }
  .mobile-more-grid button span{font-size:11px;font-weight:900;color:#172033}
  .toast{left:50%!important;right:auto!important;bottom:88px!important;transform:translateX(-50%) translateY(15px)!important}
  .toast.show{transform:translateX(-50%) translateY(0)!important}
}
@media(max-width:390px){
  .stat-row{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .order-compact-main{grid-template-columns:1fr!important}
  .order-compact-foot{display:grid!important;gap:8px!important}
  .mobile-more-grid{grid-template-columns:repeat(2,1fr)!important}
}


/* =========================================================
   v6.0 - Mobile header compact: brand trái, tài khoản icon phải
========================================================= */
@media(max-width:760px){
  .sidebar{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:10px!important;
    min-height:auto!important;
    padding:14px!important;
  }
  .side-brand{
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    justify-content:flex-start!important;
  }
  .side-brand .logo-ball{
    width:42px!important;
    height:42px!important;
    flex:0 0 42px!important;
  }
  .side-brand h2{
    font-size:17px!important;
    line-height:1.1!important;
    white-space:nowrap!important;
  }
  .side-brand p{
    font-size:11px!important;
    margin-top:3px!important;
    white-space:nowrap!important;
  }
  .admin-box{
    width:44px!important;
    height:44px!important;
    min-height:44px!important;
    margin:0!important;
    padding:0!important;
    border-radius:16px!important;
    display:grid!important;
    place-items:center!important;
    gap:0!important;
    cursor:pointer!important;
  }
  .admin-box > div:not(.avatar){display:none!important;}
  .admin-box .avatar{
    width:38px!important;
    height:38px!important;
    flex:0 0 38px!important;
    border-radius:14px!important;
    font-size:0!important;
    background:rgba(255,255,255,.96)!important;
    color:#172033!important;
  }
  .admin-box .avatar::before{
    content:'👤';
    font-size:20px;
    line-height:1;
  }
}


/* =========================================================
   v6.1 mobile polish: icon tài khoản cân giữa + biểu đồ không đè tiêu đề
========================================================= */
@media(max-width:760px){
  .admin-box{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
  }
  .admin-box .avatar{
    position:relative!important;
    display:block!important;
    overflow:hidden!important;
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    min-height:38px!important;
    margin:0!important;
    padding:0!important;
    line-height:1!important;
  }
  .admin-box .avatar::before{
    content:''!important;
    position:absolute!important;
    left:50%!important;
    top:8px!important;
    width:13px!important;
    height:13px!important;
    border-radius:50%!important;
    background:#1677d2!important;
    transform:translateX(-50%)!important;
  }
  .admin-box .avatar::after{
    content:''!important;
    position:absolute!important;
    left:50%!important;
    bottom:7px!important;
    width:23px!important;
    height:13px!important;
    border-radius:14px 14px 7px 7px!important;
    background:#1677d2!important;
    transform:translateX(-50%)!important;
  }
  .chart-card{
    display:flex!important;
    flex-direction:column!important;
  }
  .chart-card h3{
    position:relative!important;
    z-index:2!important;
    margin:0 0 8px!important;
    line-height:1.25!important;
  }
  .bar-chart{
    height:148px!important;
    margin-top:0!important;
    padding-top:28px!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }
  .bar-chart .bar{
    max-height:calc(100% - 28px)!important;
  }
}
@media(max-width:430px){
  .bar-chart{
    height:140px!important;
  }
}


/* =========================================================
   v6.3 - Sửa popup xem đơn mobile: cuộn nội dung, nút thao tác cố định
========================================================= */
.detail-card{
  display:flex;
  flex-direction:column;
  max-height:min(88vh,760px);
}
#detailBody{
  min-height:0;
  flex:1 1 auto;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.detail-footer{
  display:none;
}
@media(max-width:760px){
  #detailModal{
    align-items:flex-end!important;
    padding:10px!important;
  }
  #detailModal .detail-card{
    width:100%!important;
    max-width:100%!important;
    max-height:calc(100dvh - 20px)!important;
    border-radius:24px!important;
  }
  #detailModal .modal-head{
    flex:0 0 auto;
    position:sticky;
    top:0;
    z-index:3;
    background:#fff;
    padding:14px 16px!important;
  }
  #detailModal #detailBody{
    flex:1 1 auto;
    min-height:0;
    overflow:auto!important;
    overscroll-behavior:contain;
  }
  #detailModal .detail-body{
    gap:10px!important;
    padding:12px 12px 14px!important;
  }
  #detailModal .detail-line{
    padding:11px 12px!important;
  }
  #detailModal .detail-line b{
    font-size:14px!important;
    line-height:1.35;
  }
  #detailModal .detail-footer{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    flex:0 0 auto;
    padding:12px 12px calc(12px + env(safe-area-inset-bottom));
    border-top:1px solid var(--line);
    background:#fff;
    box-shadow:0 -10px 24px rgba(15,23,42,.08);
  }
  #detailModal .detail-footer:has(button:only-child){
    grid-template-columns:1fr;
  }
  #detailModal .detail-footer button{
    min-height:46px;
    border-radius:14px;
    padding:12px;
    font-weight:900;
    background:var(--blue);
    color:#fff;
  }
  #detailModal .detail-footer .secondary{
    background:#f1f5fb;
    color:#172033;
  }
}


/* =========================================================
   v6.4 - Thông báo riêng cho AFF
========================================================= */
.aff-notice-bell{position:relative}
.aff-notice-bell b{
  position:absolute;right:-5px;top:-6px;min-width:18px;height:18px;padding:0 5px;
  border-radius:999px;background:#f04438;color:#fff;font-size:10px;line-height:18px;font-weight:900;
}
.aff-notice-bell.zero b{display:none}
.notice-modal-card{max-width:640px!important}
.notice-recipient-box{border:1px solid var(--line);background:#f8faff;border-radius:16px;padding:14px}
.notice-recipient-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.notice-recipient-head label{display:flex;align-items:center;gap:7px;font-size:13px;font-weight:900;color:#172033}
.notice-recipient-head input{width:16px;height:16px}
.notice-recipient-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.notice-recipient-item{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid #e7ecf4;border-radius:12px;padding:10px;font-size:13px;font-weight:800}
.notice-recipient-item input{width:16px;height:16px}
#saveAffNoticeBtn{background:var(--blue);color:#fff}
.notice-inbox-card{max-width:520px}
.notice-inbox-list{display:grid;gap:10px;padding:16px;max-height:min(68vh,620px);overflow:auto;background:#f8faff}
.notice-inbox-item{border:1px solid #e7ecf4;background:#fff;border-radius:16px;padding:14px;display:grid;gap:7px}
.notice-inbox-item.unread{border-color:#93c5fd;background:#eff6ff}
.notice-inbox-item-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.notice-inbox-item h4{font-size:15px;line-height:1.35}
.notice-inbox-item p{font-size:14px;line-height:1.45;color:#334155;white-space:pre-wrap}
.notice-inbox-item small{color:#71809c}
.notice-read-pill{background:#dbeafe;color:#1d4ed8;border-radius:999px;padding:5px 8px;font-size:11px;font-weight:900;white-space:nowrap}
.notice-admin-message{max-width:340px;white-space:pre-wrap;line-height:1.4}
@media(max-width:760px){
  .notice-recipient-grid{grid-template-columns:1fr}
  #affNoticeInboxModal{align-items:flex-end!important;padding:10px!important}
  #affNoticeInboxModal .notice-inbox-card{width:100%!important;max-width:100%!important;border-radius:24px!important;max-height:calc(100dvh - 20px);display:flex;flex-direction:column}
  #affNoticeInboxModal .notice-inbox-list{flex:1 1 auto;min-height:0;max-height:none}
}


/* =========================================================
   v6.5 - Phản hồi hai chiều cho thông báo AFF
========================================================= */
.aff-reply-bell{position:relative}
.aff-reply-bell b{position:absolute;right:-5px;top:-6px;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:#f04438;color:#fff;font-size:10px;line-height:18px;font-weight:900}
.aff-reply-bell.zero b{display:none}
.notice-reply-btn{background:#eef4ff!important;color:#2563eb!important;border-radius:999px!important;padding:7px 10px!important;font-weight:900!important;white-space:nowrap}
.notice-reply-count{display:inline-flex;align-items:center;gap:5px}
.notice-thread-card{width:min(620px,100%);max-height:min(82vh,760px);display:flex;flex-direction:column;overflow:hidden}
.notice-thread-meta{padding:0 16px 12px;color:#64748b;font-size:13px;border-bottom:1px solid #eef2f7}
.notice-thread-messages{flex:1 1 auto;min-height:0;overflow:auto;display:grid;gap:10px;padding:16px;background:#f8faff}
.notice-thread-root,.notice-thread-msg{max-width:88%;border-radius:16px;padding:12px 14px;display:grid;gap:5px;line-height:1.45}
.notice-thread-root{background:#fff;border:1px solid #dbeafe}
.notice-thread-msg.admin{margin-left:auto;background:#2563eb;color:#fff}
.notice-thread-msg.affiliate{background:#fff;border:1px solid #e7ecf4}
.notice-thread-msg small,.notice-thread-root small{opacity:.75;font-size:11px}
.notice-thread-form{display:grid;grid-template-columns:1fr auto;gap:10px;padding:14px 16px;border-top:1px solid #eef2f7;background:#fff}
.notice-thread-form textarea{resize:none;min-height:48px;max-height:120px;border:1px solid #dbe3f0;border-radius:14px;padding:12px;font:inherit}
.notice-thread-form button{background:var(--blue);color:#fff;border-radius:14px;padding:0 16px;font-weight:900}
.notice-inbox-item .notice-action-row{display:flex;gap:8px;align-items:center;justify-content:space-between;margin-top:4px}
.notice-inbox-item .notice-open-thread{background:#eef4ff;color:#2563eb;border-radius:999px;padding:8px 11px;font-size:12px;font-weight:900}
.notice-reply-alert-item{cursor:pointer}
.notice-reply-alert-item b{display:block}
@media(max-width:760px){
  #affReplyInboxModal{align-items:flex-end!important;padding:10px!important}
  #affReplyInboxModal .notice-inbox-card{width:100%!important;max-width:100%!important;border-radius:24px!important;max-height:calc(100dvh - 20px);display:flex;flex-direction:column}
  #affReplyInboxModal .notice-inbox-list{flex:1 1 auto;min-height:0;max-height:none}
  #affNoticeThreadModal{align-items:flex-end!important;padding:10px!important}
  #affNoticeThreadModal .notice-thread-card{width:100%!important;max-width:100%!important;height:min(76dvh,680px);max-height:min(76dvh,680px);border-radius:24px!important}
  .notice-thread-root,.notice-thread-msg{max-width:94%}
  .notice-thread-form{grid-template-columns:1fr;gap:8px;padding-bottom:calc(14px + env(safe-area-inset-bottom))}
  .notice-thread-form button{min-height:44px}
}

/* v6.16: màu sắc có giá riêng */
.helper-note{display:block;color:#71809c;font-size:12px;line-height:1.45;margin-top:8px}


/* v6.17: module bảo hành */
.warranty-search{max-width:420px;margin:0 0 16px}
.warranty-mobile-cards{display:none}
@media(max-width:700px){.warranty-search{max-width:none;margin-bottom:12px}.warranty-mobile-cards{display:grid;gap:10px}.warranty-mobile-cards article{background:#fff;border:1px solid #e8edf3;border-radius:18px;padding:14px;display:grid;gap:8px}.warranty-mobile-cards b{font-size:16px}.warranty-mobile-cards span{color:#667085;font-size:13px}.warranty-mobile-cards strong{font-size:14px}.warrantyView .table-wrap{display:none}}


/* v6.18: bộ lọc danh sách bảo hành */
.warranty-filter-card{display:grid;grid-template-columns:minmax(220px,1.4fr) minmax(150px,.8fr) minmax(145px,.7fr) minmax(145px,.7fr) auto;gap:10px;align-items:end;margin:0 0 16px;padding:14px;border:1px solid #e8edf3;border-radius:18px;background:#f8fafc}
.warranty-filter-card .warranty-search{max-width:none;margin:0}
.warranty-filter-card label{display:grid;gap:6px}
.warranty-filter-card label span{font-size:12px;font-weight:800;color:#667085}
.warranty-filter-card input{min-height:44px}
.warranty-filter-actions{display:flex;gap:8px}
.warranty-filter-actions button{min-height:44px;border-radius:12px;padding:0 14px;font-weight:900;background:#111827;color:#fff}
.warranty-filter-actions button:last-child{background:#eef2f6;color:#111827}
@media(max-width:900px){.warranty-filter-card{grid-template-columns:1fr 1fr}.warranty-filter-actions{grid-column:1/-1}}
@media(max-width:700px){.warranty-filter-card{grid-template-columns:1fr;padding:12px;margin-bottom:12px}.warranty-filter-actions{grid-column:auto}.warranty-filter-actions button{flex:1}.warranty-search{margin-bottom:0!important}}


/* v6.19: đăng ký AFF */
.aff-register-filter-card{display:grid;grid-template-columns:minmax(260px,1.4fr) minmax(150px,.55fr) auto;gap:10px;align-items:end;margin:0 0 16px;padding:14px;border:1px solid #e8edf3;border-radius:18px;background:#f8fafc}
.aff-register-filter-card .aff-register-search{max-width:none;margin:0}
.aff-register-filter-card label{display:grid;gap:6px}
.aff-register-filter-card label span{font-size:12px;font-weight:800;color:#667085}
.aff-register-filter-card select{min-height:44px}
.aff-register-filter-actions{display:flex;gap:8px}
.aff-register-filter-actions button{min-height:44px;border-radius:12px;padding:0 14px;font-weight:900;background:#111827;color:#fff}
.aff-register-filter-actions button:last-child{background:#eef2f6;color:#111827}
.aff-register-mobile-cards{display:none}
.app-status{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:900}
.app-status.pending{background:#fff4e5;color:#b54708}.app-status.approved{background:#ecfdf3;color:#027a48}.app-status.rejected{background:#fef3f2;color:#b42318}
.aff-app-actions{display:flex;gap:6px;flex-wrap:wrap}.aff-app-actions button{min-height:34px;border-radius:10px;padding:0 10px;font-weight:900;background:#111827;color:#fff}.aff-app-actions button.reject{background:#fff1f3;color:#d92d20}
@media(max-width:900px){.aff-register-filter-card{grid-template-columns:1fr 1fr}.aff-register-filter-actions{grid-column:1/-1}}
@media(max-width:700px){.aff-register-filter-card{grid-template-columns:1fr;padding:12px;margin-bottom:12px}.aff-register-filter-actions{grid-column:auto}.aff-register-filter-actions button{flex:1}.aff-register-mobile-cards{display:grid;gap:10px}.aff-register-mobile-cards article{background:#fff;border:1px solid #e8edf3;border-radius:18px;padding:14px;display:grid;gap:8px}.aff-register-mobile-cards b{font-size:16px}.aff-register-mobile-cards span{color:#667085;font-size:13px}.aff-registerView .table-wrap{display:none}}


/* v6.20: gom đăng ký AFF vào Quản lý AFF */
.aff-applications-inline{margin-bottom:18px}
.panel-head-inline{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}
.panel-head-inline h3{margin:0 0 4px;font-size:20px}
.panel-head-inline p{margin:0;color:#6b7280;font-size:13px}
@media(max-width:720px){
  .aff-applications-inline{margin-bottom:14px}
  .panel-head-inline h3{font-size:17px}
  .panel-head-inline p{font-size:12px}
}


.aff-permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:10px}.aff-permission-row{border:1px solid #e5e7eb;border-radius:12px;padding:10px;display:flex;gap:8px;align-items:center;background:#fff}.aff-permission-row input{width:18px;height:18px}.sidebar-link{border:0;text-decoration:none}@media(max-width:760px){.aff-permission-grid{grid-template-columns:1fr}}


/* =========================================================
   v6.24 - Cây menu module/phân hệ admin
========================================================= */
.side-menu.admin-module-tree{
  display:block!important;
  gap:0!important;
  overflow:auto;
  padding-right:2px;
  max-height:calc(100vh - 174px);
}
.module-group{
  margin:0 0 8px;
  border:1px solid rgba(255,255,255,.09);
  border-radius:18px;
  background:rgba(255,255,255,.045);
  overflow:hidden;
}
.module-group.hidden{display:none!important}
.module-group summary{
  cursor:pointer;
  list-style:none;
  color:#fff;
  font-weight:950;
  font-size:13px;
  letter-spacing:.01em;
  padding:12px 13px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  user-select:none;
}
.module-group summary::-webkit-details-marker{display:none}
.module-group summary::after{content:'⌄';font-size:13px;opacity:.7;transition:.18s}
.module-group:not([open]) summary::after{transform:rotate(-90deg)}
.module-submenu{display:grid;gap:6px;padding:0 8px 9px}
.module-submenu .menu-item{
  min-height:39px;
  padding:9px 10px!important;
  border-radius:13px!important;
  font-size:13px!important;
  line-height:1.22;
  background:rgba(15,23,42,.16);
}
.module-submenu .menu-item:hover,.module-submenu .menu-item.active{background:var(--blue)!important;color:#fff!important}
.module-submenu .sidebar-link{display:flex;text-decoration:none;color:#d4e1f5}
.module-submenu .menu-item span{min-width:24px;height:22px;font-size:11px}
@media(max-width:1200px) and (min-width:761px){
  .side-menu.admin-module-tree{max-height:calc(100vh - 150px);padding-right:0}
  .module-group{border-radius:15px;margin-bottom:7px}
  .module-group summary{justify-content:center;font-size:0;padding:11px 6px}
  .module-group summary::first-letter{font-size:18px}
  .module-group summary::after{display:none}
  .module-submenu{padding:0 5px 7px;gap:5px}
  .module-submenu .menu-item{justify-content:center;font-size:0!important;min-height:38px;padding:8px 6px!important}
  .module-submenu .menu-item::first-letter{font-size:17px}
}

/* HTSPORT_ORDER_CHECKOUT_ADMIN_V4 */
.order-edit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:8px 0 12px}.discount-cell{font-size:12px;line-height:1.45}.table-actions .danger-icon,.danger,.danger-text{background:#fff1f2!important;color:#e11d48!important;border-color:#fecdd3!important}.danger:hover,.danger-icon:hover,.danger-text:hover{background:#ffe4e6!important}.order-compact-extra{display:grid;grid-template-columns:1fr;gap:4px;margin:10px 0;color:#64748b;font-size:12px}.order-compact-extra span{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:6px 8px}@media(max-width:780px){.order-edit-grid{grid-template-columns:1fr}.discount-cell{font-size:11px}}
/* END HTSPORT_ORDER_CHECKOUT_ADMIN_V4 */


/* HTSPORT_ORDER_TABLE_V624 - bảng đơn hàng đủ cột checkout */
.table-wrap table{min-width:1180px;}
.discount-cell{font-size:12px;line-height:1.35;white-space:nowrap;}
.table-actions{display:flex;gap:6px;align-items:center;flex-wrap:nowrap;}
.table-actions .danger-icon{border-color:#fecaca;background:#fff5f5;color:#dc2626;}
@media (max-width: 768px){.table-wrap{display:none;} .order-mobile-cards{display:block;}}


/* =========================================================
   v6.27 - Mobile admin tối ưu + ẩn footer khi chưa đăng nhập
========================================================= */
@media(max-width:900px){
  /* Trang đăng nhập: không hiện thanh footer mobile */
  body.crm-login-mode .mobile-bottom-nav,
  body:not(.crm-authenticated) .mobile-bottom-nav,
  #loginScreen:not(.hidden) ~ .mobile-bottom-nav,
  #crmScreen.hidden ~ .mobile-bottom-nav,
  #loginScreen:not(.hidden) ~ .mobile-more-sheet{
    display:none!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }

  body.crm-authenticated{
    background:#f4f7fb!important;
  }

  .login-screen{
    min-height:100dvh!important;
    padding:18px 14px!important;
    box-sizing:border-box!important;
  }
  .login-card{
    width:min(100%,430px)!important;
    border-radius:26px!important;
    padding:28px 24px 22px!important;
    transform:none!important;
  }
  .login-logo{
    width:76px!important;
    height:76px!important;
    margin-bottom:12px!important;
  }
  .login-card h1{
    font-size:25px!important;
    line-height:1.18!important;
    margin-bottom:10px!important;
  }
  .login-card p{
    font-size:16px!important;
    line-height:1.35!important;
  }
  .login-fields input{
    height:58px!important;
    border-radius:18px!important;
    font-size:18px!important;
  }
  .login-btn{
    height:58px!important;
    border-radius:18px!important;
    font-size:18px!important;
  }

  /* Layout mobile: sidebar thành header gọn, không xổ menu dài */
  .crm-layout{
    display:block!important;
    width:100%!important;
    min-height:100dvh!important;
    padding:0 0 112px!important;
    overflow-x:hidden!important;
    background:#f4f7fb!important;
  }
  .crm-layout.hidden{
    display:none!important;
  }
  .sidebar{
    position:relative!important;
    top:auto!important;
    width:100%!important;
    min-height:auto!important;
    height:auto!important;
    max-height:none!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:10px!important;
    padding:18px 16px!important;
    border-radius:0 0 24px 24px!important;
    overflow:visible!important;
    box-sizing:border-box!important;
  }
  .side-brand{
    display:flex!important;
    align-items:center!important;
    min-width:0!important;
    gap:12px!important;
    margin:0!important;
    padding:0!important;
  }
  .side-brand .logo-ball{
    width:46px!important;
    height:46px!important;
    min-width:46px!important;
    flex:0 0 46px!important;
    border-radius:16px!important;
  }
  .side-brand h2{
    font-size:20px!important;
    line-height:1.1!important;
    max-width:calc(100vw - 132px)!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  .side-brand p{
    font-size:12px!important;
    line-height:1.2!important;
    max-width:calc(100vw - 132px)!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  .admin-box{
    width:52px!important;
    height:52px!important;
    min-width:52px!important;
    min-height:52px!important;
    display:grid!important;
    place-items:center!important;
    margin:0!important;
    padding:0!important;
    border-radius:18px!important;
  }
  .admin-box > div:not(.avatar){
    display:none!important;
  }
  .admin-box .avatar{
    width:44px!important;
    height:44px!important;
    min-width:44px!important;
    min-height:44px!important;
    border-radius:16px!important;
  }
  .side-menu{
    display:none!important;
    visibility:hidden!important;
    height:0!important;
    overflow:hidden!important;
  }

  .main-content{
    width:100%!important;
    padding:14px 14px 126px!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }

  /* Thanh tìm kiếm + nút trên mobile không bị tràn */
  .topbar{
    position:sticky!important;
    top:8px!important;
    z-index:40!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 44px 44px 44px 44px!important;
    align-items:center!important;
    gap:8px!important;
    margin:0 0 12px!important;
    overflow:visible!important;
  }
  .search-box{
    min-width:0!important;
    width:100%!important;
    height:48px!important;
    border-radius:18px!important;
    padding:0 12px!important;
    box-sizing:border-box!important;
  }
  .search-box span{
    flex:0 0 auto!important;
  }
  .search-box input{
    min-width:0!important;
    width:100%!important;
    font-size:13px!important;
    text-overflow:ellipsis!important;
  }
  .icon-btn,
  .filter-btn{
    width:44px!important;
    min-width:44px!important;
    height:44px!important;
    border-radius:16px!important;
    padding:0!important;
    display:grid!important;
    place-items:center!important;
    font-size:20px!important;
  }
  .filter-btn{
    font-size:0!important;
  }
  .filter-btn::before{
    content:'☰';
    font-size:20px!important;
    line-height:1!important;
  }
  .date-btn{
    display:none!important;
  }

  .mobile-status-strip{
    padding:0 0 12px!important;
    margin:0 0 4px!important;
    gap:9px!important;
  }
  .mobile-status-chip{
    min-height:38px!important;
    padding:0 15px!important;
    font-size:13px!important;
  }

  .mobile-section-title{
    display:block!important;
    font-size:22px!important;
    line-height:1.2!important;
    margin:8px 2px 14px!important;
    color:#101828!important;
  }

  .stat-row{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:12px!important;
  }
  .stat-card{
    min-height:110px!important;
    border-radius:22px!important;
    padding:16px!important;
  }
  .stat-card b{
    font-size:25px!important;
  }
  .stat-card span{
    font-size:13px!important;
  }

  .content-grid,
  .charts-grid{
    grid-template-columns:1fr!important;
  }
  .panel,
  .chart-card,
  .mini-panel,
  .marketing-dashboard-card,
  .marketing-dashboard,
  [class*="marketing"] .panel{
    max-width:100%!important;
    border-radius:22px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  .table-wrap{
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }

  /* Footer mobile: chỉ hiện khi đã đăng nhập, gọn 1 hàng */
  body.crm-authenticated .mobile-bottom-nav{
    display:grid!important;
    position:fixed!important;
    left:12px!important;
    right:12px!important;
    bottom:10px!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:4px!important;
    padding:8px!important;
    border-radius:24px!important;
    z-index:90!important;
    max-height:86px!important;
    overflow:hidden!important;
  }
  .mobile-nav-btn{
    min-width:0!important;
    min-height:58px!important;
    border-radius:18px!important;
  }
  .mobile-nav-btn i{
    font-size:20px!important;
  }
  .mobile-nav-btn span{
    font-size:11px!important;
    white-space:nowrap!important;
  }
  .mobile-more-sheet{
    z-index:110!important;
  }
  .mobile-more-card{
    bottom:104px!important;
    max-height:calc(100dvh - 132px)!important;
    overflow:auto!important;
  }

  .toast{
    bottom:106px!important;
  }
}

@media(max-width:430px){
  .topbar{
    grid-template-columns:minmax(0,1fr) 42px 42px 42px!important;
  }
  #adminAffReplyBellBtn,
  #affNoticeBellBtn{
    display:none!important;
  }
  .side-brand h2{
    font-size:19px!important;
  }
  .stat-card{
    min-height:104px!important;
    padding:14px!important;
  }
  .stat-card b{
    font-size:23px!important;
  }
}


/* =========================================================
   v28 - Mobile footer có nút Thêm + sheet tất cả menu
========================================================= */
@media(max-width:760px){
  body.crm-authenticated .mobile-bottom-nav{
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    gap:3px!important;
    padding:7px!important;
    max-height:88px!important;
    overflow:visible!important;
  }
  body:not(.crm-authenticated) .mobile-bottom-nav,
  body:not(.crm-authenticated) .mobile-more-sheet{
    display:none!important;
  }
  .mobile-nav-btn{
    min-width:0!important;
    min-height:56px!important;
    padding:4px 0!important;
  }
  .mobile-nav-btn i{
    font-size:18px!important;
  }
  .mobile-nav-btn span{
    font-size:9.5px!important;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .mobile-nav-btn[data-mobile-nav="more"]{
    display:grid!important;
  }
  .mobile-more-sheet{
    position:fixed!important;
    inset:0!important;
    z-index:160!important;
    display:none!important;
  }
  .mobile-more-sheet.show{
    display:block!important;
  }
  .mobile-more-backdrop{
    position:absolute!important;
    inset:0!important;
    background:rgba(15,23,42,.48)!important;
    backdrop-filter:blur(3px)!important;
  }
  .mobile-more-card{
    position:absolute!important;
    left:10px!important;
    right:10px!important;
    bottom:102px!important;
    max-height:calc(100dvh - 126px)!important;
    overflow:auto!important;
    background:#fff!important;
    border-radius:24px!important;
    padding:14px!important;
    box-shadow:0 24px 60px rgba(15,23,42,.28)!important;
    -webkit-overflow-scrolling:touch!important;
  }
  .mobile-more-head{
    position:sticky!important;
    top:-14px!important;
    z-index:3!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:10px!important;
    background:#fff!important;
    padding:8px 0 12px!important;
    margin-bottom:4px!important;
    border-bottom:1px solid #eef2f7!important;
  }
  .mobile-more-head b{
    display:block!important;
    font-size:17px!important;
    color:#0f172a!important;
    line-height:1.15!important;
  }
  .mobile-more-head small{
    display:block!important;
    color:#64748b!important;
    font-size:11px!important;
    margin-top:3px!important;
  }
  .mobile-more-head button{
    width:36px!important;
    height:36px!important;
    min-width:36px!important;
    border-radius:50%!important;
    background:#f1f5fb!important;
    font-size:24px!important;
    color:#0f172a!important;
  }
  .mobile-more-section-title{
    margin:14px 2px 8px!important;
    font-size:12px!important;
    font-weight:950!important;
    color:#64748b!important;
    text-transform:uppercase!important;
    letter-spacing:.03em!important;
  }
  .mobile-more-grid{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:8px!important;
  }
  .mobile-more-grid button{
    min-width:0!important;
    min-height:74px!important;
    border-radius:18px!important;
    background:#f7f9fd!important;
    border:1px solid #e8edf5!important;
    display:grid!important;
    place-items:center!important;
    gap:5px!important;
    font-size:22px!important;
    color:#0f172a!important;
    padding:8px 5px!important;
  }
  .mobile-more-grid button span{
    display:block!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:11px!important;
    font-weight:900!important;
    color:#172033!important;
    line-height:1.15!important;
  }
  .mobile-more-account-grid button{
    background:#eef4ff!important;
    border-color:#d9e7ff!important;
  }
  .mobile-more-account-grid .mobile-more-logout{
    background:#fff1f2!important;
    border-color:#fecdd3!important;
    color:#e11d48!important;
  }
}
@media(max-width:390px){
  body.crm-authenticated .mobile-bottom-nav{
    left:8px!important;
    right:8px!important;
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
  }
  .mobile-nav-btn span{
    font-size:8.8px!important;
  }
  .mobile-more-grid{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:7px!important;
  }
  .mobile-more-grid button{
    min-height:68px!important;
  }
  .mobile-more-grid button span{
    font-size:10px!important;
  }
}


/* =========================================================
   v29 - Mobile menu theo phân quyền + tài khoản/đăng xuất
========================================================= */
@media(max-width:760px){
  .mobile-permission-hidden-v29,
  .mobile-more-section-title.mobile-empty-section-v29{
    display:none!important;
  }
  body.crm-authenticated .mobile-bottom-nav{
    display:grid!important;
  }
  body.crm-authenticated .mobile-bottom-nav .mobile-nav-btn[data-mobile-nav="more"]{
    display:grid!important;
  }
  .mobile-more-sheet .mobile-more-grid button.mobile-permission-hidden-v29,
  .mobile-status-strip .mobile-status-chip.mobile-permission-hidden-v29,
  .mobile-bottom-nav .mobile-nav-btn.mobile-permission-hidden-v29{
    display:none!important;
  }
  .mobile-more-section-title{
    display:block!important;
  }
  .mobile-more-card{
    padding-bottom:18px!important;
  }
  .mobile-more-account-grid{
    margin-bottom:4px!important;
  }
  .mobile-more-account-grid button{
    min-height:70px!important;
  }
  .mobile-more-account-grid .mobile-more-logout{
    background:#fff1f2!important;
    border-color:#fecdd3!important;
    color:#e11d48!important;
  }
}


/* =========================================================
   v30 - Ẩn AI CSKH khỏi Tổng quan mobile nếu không vào đúng menu AI
========================================================= */
.ai-mobile-hidden-v30{
  display:none!important;
}
@media(max-width:760px){
  [data-ai-mobile-hidden-v30="1"]{
    display:none!important;
  }
}


/* =========================================================
   v31 - Không cho AI iframe tự hiện ở Tổng quan + chống 2 footer
========================================================= */
#aiCskhRestoreView.hidden,
#aiCskhView.hidden,
#aiCskhRestoreView[data-ai-hidden-v31="1"],
#aiCskhView[data-ai-hidden-v31="1"]{
  display:none!important;
}
@media(max-width:760px){
  body.crm-authenticated .mobile-bottom-nav:not(:first-of-type){
    display:none!important;
  }
  .mobile-bottom-nav.mobile-duplicate-hidden-v31{
    display:none!important;
  }
}


/* =========================================================
   v37 - Cài đặt tổng hợp Mall dạng bảng trong admin
========================================================= */
.mall-admin-v37{display:grid;gap:12px;color:#1f2937}
.mall-crumb-v37{height:38px;border:1px solid #cfcfcf;background:#f7f7f7;display:flex;align-items:center;gap:10px;padding:0 14px;font-size:13px;color:#555}
.mall-crumb-v37 strong{color:#111827}
.mall-toolbar-v37{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.mall-btn-v37{height:32px;border:0;background:linear-gradient(#3c8dbc,#2e6f9e);color:#fff;font-weight:900;font-size:12px;padding:0 18px;cursor:pointer;border-radius:0;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.mall-btn-v37.primary{background:linear-gradient(#3c8dbc,#2676ad)}
.mall-btn-v37.dark{background:linear-gradient(#64748b,#334155)}
.mall-table-card-v37{border:1px solid #d7d7d7;background:#fff}
.mall-table-tools-v37{min-height:38px;border-bottom:1px solid #d7d7d7;display:grid;grid-template-columns:120px 1fr 90px;gap:0;align-items:center}
.mall-table-tools-v37 label{display:flex;align-items:center;gap:8px;height:38px;border-right:1px solid #d7d7d7;padding:0 12px;font-size:12px;font-weight:900;color:#555}
.mall-table-tools-v37 input[type="text"],.mall-table-tools-v37 input:not([type]){height:38px;border:0;border-right:1px solid #d7d7d7;border-radius:0;padding:0 12px;font-size:12px}
.mall-table-scroll-v37{overflow:auto;max-height:calc(100vh - 260px)}
.mall-settings-table-v37{width:100%;border-collapse:collapse;min-width:1040px;font-size:12px;color:#555}
.mall-settings-table-v37 th{height:44px;background:#f3f3f3;border:1px solid #d7d7d7;text-align:center;font-weight:500;color:#777}
.mall-settings-table-v37 td{border:1px solid #e1e1e1;padding:8px 10px;text-align:center;vertical-align:middle;height:72px}
.mall-settings-table-v37 td:nth-child(5){text-align:left;color:#0f172a}
.mall-settings-table-v37 td b{display:block;color:#0b5f98;font-size:13px;margin-bottom:4px}
.mall-settings-table-v37 td small{display:block;color:#64748b;font-size:11px;line-height:1.35}
.mall-order-v37{width:34px;height:28px;border:1px solid #ddd;text-align:center;background:#fff}
.mall-ok-v37,.mall-lock-v37{display:inline-flex;min-width:26px;height:26px;border:1px solid #d1d5db;background:#fff;align-items:center;justify-content:center;padding:0 8px;color:#0b5f98;font-weight:900}
.mall-settings-table-v37 td button{width:30px;height:28px;border:1px solid #cbd5e1;background:#f8fafc;margin:0 2px;cursor:pointer;color:#555;font-weight:900}
.mall-settings-table-v37 tr.hide-v37{display:none}
.mall-frame-box-v37{border:1px solid #d7d7d7;background:#fff;margin-top:12px}
.mall-frame-box-v37.hidden{display:none!important}
.mall-frame-head-v37{height:42px;background:#f3f4f6;border-bottom:1px solid #d7d7d7;display:flex;align-items:center;justify-content:space-between;padding:0 10px}
.mall-frame-box-v37 iframe{width:100%;height:72vh;border:0;background:#fff;display:block}
@media(max-width:760px){
  .mall-crumb-v37{height:auto;min-height:38px;overflow:auto;white-space:nowrap}
  .mall-toolbar-v37{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .mall-btn-v37{height:40px;border-radius:10px}
  .mall-table-tools-v37{grid-template-columns:1fr;gap:0}
  .mall-table-tools-v37 label,.mall-table-tools-v37 input{border-right:0;border-bottom:1px solid #d7d7d7}
  .mall-table-scroll-v37{max-height:none}
  .mall-frame-box-v37 iframe{height:76vh}
}


/* =========================================================
   v38 - Chỉ còn 1 trang cài đặt tổng hợp, ẩn menu cấu hình thừa
========================================================= */
.settings-redundant-v38,
details[data-module-group="checkout"],
.mobile-more-grid .settings-redundant-v38{
  display:none!important;
}
.mall-onepage-v38{display:grid;gap:12px;color:#0f172a}
.mall-one-head-v38{
  display:flex;align-items:flex-start;justify-content:space-between;gap:16px;
  background:#fff;border:1px solid #e5e7eb;border-radius:18px;padding:16px;
  box-shadow:0 8px 24px rgba(15,23,42,.05)
}
.mall-one-crumb-v38{font-size:13px;color:#64748b;margin-bottom:6px}
.mall-one-head-v38 h2{font-size:22px;margin:0 0 5px}
.mall-one-head-v38 p{margin:0;color:#64748b;line-height:1.45;max-width:780px}
.mall-one-actions-v38{display:flex;gap:8px;flex-wrap:wrap}
.mall-one-actions-v38 button{
  border:0;background:#ee4d2d;color:#fff;border-radius:12px;
  min-height:38px;padding:0 14px;font-weight:900;cursor:pointer
}
.mall-one-actions-v38 button+button{background:#0f172a}
#mallAllSettingsFrameV38{
  width:100%;height:calc(100vh - 230px);min-height:720px;border:1px solid #e5e7eb;
  border-radius:18px;background:#fff;box-shadow:0 8px 24px rgba(15,23,42,.05)
}
@media(max-width:760px){
  .mall-one-head-v38{display:block;border-radius:22px}
  .mall-one-actions-v38{margin-top:12px;display:grid;grid-template-columns:1fr 1fr}
  .mall-one-actions-v38 button{min-height:42px}
  #mallAllSettingsFrameV38{height:calc(100dvh - 190px);min-height:620px;border-radius:18px}
}


/* =========================================================
   v42 - Bảo mật đăng nhập xác thực 2 lớp
========================================================= */
.login-step-v42.hidden{display:none!important}
.twofa-box-v42{text-align:left;color:#e5eefc}
.twofa-box-v42 h2{margin:0 0 8px;text-align:center;color:#fff;font-size:22px}
.twofa-box-v42 p{margin:0 0 14px;text-align:center;color:#b9c6d8;line-height:1.45}
.twofa-setup-v42{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.14);border-radius:18px;padding:14px;margin:12px 0}
.twofa-setup-v42 b{display:block;margin-bottom:8px;color:#fff}
.twofa-setup-v42 ol{margin:0 0 12px 18px;padding:0;color:#dbeafe;line-height:1.5;font-size:13px}
.twofa-secret-v42{background:#fff;color:#0f172a;border-radius:14px;padding:12px;text-align:center;font-size:18px;font-weight:950;letter-spacing:2px;word-break:break-all;margin-bottom:10px}
.twofa-mini-btn-v42{height:34px;border:0;border-radius:10px;background:#eaf1ff;color:#1454cf;font-weight:900;padding:0 10px;margin:3px;cursor:pointer}
.twofa-code-v42{width:100%;height:58px;border-radius:16px;border:1px solid rgba(255,255,255,.18);padding:0 16px;text-align:center;font-size:26px;font-weight:900;letter-spacing:7px;background:#eef4ff;color:#0f172a;margin:12px 0}
.twofa-back-v42{width:100%;border:0;background:transparent;color:#cbd5e1;font-weight:800;margin-top:12px;cursor:pointer}
@media(max-width:760px){
  .twofa-box-v42 h2{font-size:20px}
  .twofa-secret-v42{font-size:15px;letter-spacing:1px}
  .twofa-code-v42{font-size:24px;height:56px}
}


/* =========================================================
   v43 - Quét QR cài Authenticator lần đầu
========================================================= */
.twofa-qr-v43{
  width:240px;min-height:240px;margin:12px auto 8px;background:#fff;border-radius:18px;
  display:flex;align-items:center;justify-content:center;padding:8px;box-shadow:0 10px 28px rgba(0,0,0,.18)
}
.twofa-qr-v43 canvas{display:block}
.twofa-qr-loading-v43{color:#0f172a;font-weight:900;text-align:center;padding:18px}
.twofa-qr-note-v43{text-align:center;color:#dbeafe;font-size:13px;line-height:1.45;margin:6px 0 10px}
.twofa-setup-v42 ol li:first-child::after{content:' hoặc quét mã QR bên dưới';font-weight:900;color:#fff}
@media(max-width:760px){
  .twofa-qr-v43{width:220px;min-height:220px}
}


/* v45 upload ảnh/video sản phẩm */
.media-upload-wrap-v45{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;width:100%}
.media-upload-btn-v45{height:38px;border:0;border-radius:10px;background:#2563eb;color:#fff;font-weight:900;padding:0 10px;cursor:pointer;white-space:nowrap}
.media-upload-btn-v45:disabled{opacity:.65;cursor:wait}
@media(max-width:760px){.media-upload-wrap-v45{grid-template-columns:1fr}.media-upload-btn-v45{width:100%}}


/* v97 - hiển thị chi tiết đơn hàng dễ nhìn */
.order-items-admin-wrap{min-width:280px;display:grid;gap:8px}
.order-items-summary{font-size:12px;font-weight:900;color:#64748b}
.order-items-group,.detail-order-group{display:grid;gap:7px}
.order-items-group-title,.detail-order-group-title{font-size:11px;font-weight:900;letter-spacing:.35px;text-transform:uppercase;color:#94a3b8}
.order-item-admin{padding:9px 10px;border:1px solid #e5edf7;border-radius:12px;background:#f8fbff}
.order-item-admin.gift{background:#fff7ed;border-color:#fed7aa}
.order-item-admin__top{display:flex;gap:8px;align-items:flex-start}
.order-item-admin__main{min-width:0;display:grid;gap:4px}
.order-item-badge{display:inline-flex;align-items:center;justify-content:center;padding:3px 8px;border-radius:999px;font-size:11px;font-weight:900;white-space:nowrap}
.order-item-badge.product{background:#dbeafe;color:#1d4ed8}
.order-item-badge.gift{background:#ffedd5;color:#c2410c}
.order-item-name{display:block;color:#0f172a;line-height:1.45}
.order-item-meta{font-size:12px;color:#64748b;line-height:1.45}
.order-total-note{margin-top:8px}
.order-variant-stack small{display:block;margin-top:4px;color:#64748b;line-height:1.5}
.order-compact-items{display:grid;gap:7px;margin-top:10px}
.order-compact-item{padding:8px 10px;border-radius:12px;background:#f8fbff;border:1px solid #e6edf7;display:grid;gap:3px}
.order-compact-item.gift{background:#fff7ed;border-color:#fed7aa}
.order-compact-item b{font-size:13px;line-height:1.4;color:#0f172a}
.order-compact-item small{color:#64748b;line-height:1.45}
.order-compact-more{font-size:12px;font-weight:800;color:#64748b}
.detail-order-items{display:grid;gap:10px;width:100%}
.detail-order-items .order-item-admin{background:#fff}
.detail-order-items .order-item-admin.gift{background:#fff7ed}
@media(max-width:760px){
  .order-items-admin-wrap{min-width:0}
  .order-item-admin__top{display:grid;gap:6px}
  .order-item-badge{justify-self:flex-start}
}


/* v98 - danh sách đơn hàng gom gọn 1 hàng, chi tiết vẫn tách rõ */
.order-items-compact-v98{
  max-width:360px;
  min-width:220px;
}
.order-items-one-line-v98{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:32px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.order-items-one-line-v98 b{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#e0f2fe;
  color:#0369a1;
  border-radius:999px;
  padding:4px 8px;
  font-size:12px;
  font-weight:950;
}
.order-items-one-line-v98 span{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  font-weight:900;
  color:#0f172a;
}
.order-items-one-line-v98 em{
  flex:0 0 auto;
  font-style:normal;
  background:#fff7ed;
  color:#c2410c;
  border-radius:999px;
  padding:4px 8px;
  font-size:12px;
  font-weight:950;
}
#orderTableBody td{
  vertical-align:middle!important;
}
.order-compact-items.one-line-v98 .order-compact-item{
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
@media(max-width:760px){
  .order-items-compact-v98{max-width:100%;min-width:0}
  .order-items-one-line-v98{width:100%}
}


/* v99 - cột sản phẩm trong danh sách đơn chỉ 1 ô, 1 dòng text */
.order-items-inline-v99{
  max-width:560px;
  min-width:360px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-weight:850;
  color:#0f172a;
  line-height:1.4;
}
.order-variant-inline-v99{
  max-width:150px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:1.35;
}
.order-variant-inline-v99 b{
  display:block;
  font-weight:950;
  color:#0f172a;
}
.order-variant-inline-v99 span{
  color:#64748b;
  font-size:12px;
}
#orderTableBody td{
  vertical-align:middle!important;
}
#orderTableBody tr{
  height:auto!important;
}
@media(max-width:760px){
  .order-items-inline-v99{
    max-width:100%;
    min-width:0;
  }
}


/* v104 - mở các phân hệ link trực tiếp trong khung admin, không nhảy trang */
.admin-inline-module-host-v104{display:block;min-height:calc(100vh - 36px);background:#f3f6fb}
.admin-inline-module-host-v104.hidden{display:none!important}
.admin-inline-module-top-v104{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px 12px}
.admin-inline-module-top-v104 h1{margin:0;font-size:24px;font-weight:950;color:#172033}
.admin-inline-module-top-v104 p{margin:5px 0 0;color:#64748b;font-weight:700}
#adminInlineCloseV104{border:1px solid #cbd5e1;background:#fff;color:#0f172a;border-radius:12px;padding:10px 14px;font-weight:900;cursor:pointer}
#adminInlineFrameV104{display:block;width:100%;min-height:calc(100vh - 112px);border:0;background:#fff;border-radius:18px}
body.admin-inline-module-open-v104 .v104-hidden-while-inline{display:none!important}
@media(max-width:760px){.admin-inline-module-top-v104{padding:12px;display:grid}.admin-inline-module-top-v104 h1{font-size:20px}#adminInlineFrameV104{min-height:calc(100vh - 120px);border-radius:12px}}


/* v105 - force inline module visible */
body.admin-inline-module-open-v104 #dashboardView,
body.admin-inline-module-open-v104 .v104-hidden-while-inline{display:none!important}
body.admin-inline-module-open-v104 #adminInlineModuleHostV104{display:block!important;position:relative!important;z-index:5!important}
#adminInlineModuleHostV104{width:100%!important;background:#f3f6fb!important}
#adminInlineFrameV104{width:100%!important;min-height:760px!important;border:0!important;background:#fff!important}


/* v107 - trạng thái menu đơn hàng click hoạt động rõ ràng */
.filter-btn-menu{cursor:pointer}
.filter-btn-menu.active{
  background:#2f6df6!important;
  color:#fff!important;
  box-shadow:0 8px 18px rgba(47,109,246,.25)!important;
}
.filter-btn-menu.active span{
  background:rgba(255,255,255,.22)!important;
  color:#fff!important;
}


/* v109 - danh sách đơn: khách hàng/sản phẩm hiển thị đủ, xuống dòng gọn */
#orderTableBody td{
  vertical-align:middle;
}
#orderTableBody .order-customer-cell-v109{
  min-width:150px;
  max-width:210px;
  white-space:normal!important;
  word-break:break-word;
  line-height:1.25;
}
#orderTableBody .order-customer-cell-v109 .customer-name.full-v109{
  white-space:normal!important;
  word-break:break-word;
  overflow:visible!important;
  text-overflow:clip!important;
  display:block;
  font-size:13px;
  font-weight:950;
  color:#101827;
}
#orderTableBody .order-customer-cell-v109 .customer-address.full-v109{
  white-space:normal!important;
  word-break:break-word;
  overflow:visible!important;
  text-overflow:clip!important;
  display:block;
  margin-top:3px;
  color:#64748b;
  font-size:12px;
  line-height:1.25;
}
#orderTableBody .order-phone-cell-v109{
  min-width:94px;
  white-space:nowrap!important;
}
#orderTableBody .order-product-cell-v109{
  min-width:360px;
  max-width:520px;
  white-space:normal!important;
}
.order-items-wrap-v109{
  display:flex;
  flex-direction:column;
  gap:5px;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  line-height:1.28;
}
.order-item-line-v109{
  display:block;
  white-space:normal!important;
  word-break:break-word;
  overflow:visible!important;
  text-overflow:clip!important;
  color:#111827;
  font-size:13px;
  font-weight:800;
}
.order-item-line-v109 b{
  font-weight:950;
}
.order-item-line-v109 span{
  color:#334155;
  font-weight:850;
}
.order-item-line-v109.gift{
  color:#c2410c;
}
.order-item-line-v109.gift span{
  color:#9a3412;
}
.order-items-inline-v99{
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
}
@media(max-width:900px){
  #orderTableBody .order-product-cell-v109{min-width:280px;max-width:360px}
  #orderTableBody .order-customer-cell-v109{min-width:130px;max-width:170px}
}


/* v113 - đánh giá nhanh đơn hàng trong admin */
.order-review-mini-v113{
  margin-top:6px;
  display:inline-flex;
  align-items:center;
  gap:4px;
  background:#fff7ed;
  color:#c2410c;
  border-radius:999px;
  padding:4px 7px;
  font-size:11px;
  font-weight:950;
}
.order-review-detail-v113{
  display:grid;
  gap:4px;
}
.order-review-detail-v113 span{
  color:#cbd5e1;
  font-size:18px;
}
.order-review-detail-v113 span.on{
  color:#facc15;
}
.order-review-detail-v113 b{
  color:#0f172a;
}
.order-review-detail-v113 small{
  color:#64748b;
}
.review-note-v113{
  color:#475569;
  font-size:12px;
  font-weight:700;
}


/* v117 - danh mục sản phẩm */
.product-cat-pill-v117{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:5px 9px;
  background:#eef2ff;
  color:#1d4ed8;
  font-weight:950;
  font-size:12px;
  white-space:nowrap;
}

/* HTSPORT_V118_CATEGORY_TABS_FIX: frontend mall tab layout fixed in mall.php */


/* v122 - Zalo OA notification status */
.zalo-notify-mini-v122{
  margin-top:6px;
  display:inline-flex;
  align-items:center;
  gap:4px;
  background:#e0f2fe;
  color:#0369a1;
  border-radius:999px;
  padding:4px 7px;
  font-size:11px;
  font-weight:950;
  white-space:nowrap;
}
.zalo-notify-mini-v122.muted{
  background:#f1f5f9;
  color:#64748b;
}

/* HTSPORT_V125_PRODUCT_IMAGE_FIX */
