/* CRM_CUSTOMER_MASTER_UI_V1 */
.customer-page-head{position:relative;overflow:visible}
.customer-filter-grid{
  display:grid;
  grid-template-columns:minmax(260px,1.7fr) repeat(4,minmax(150px,1fr));
  gap:12px;
  align-items:end;
}
.customer-filter-grid .customer-search{grid-column:span 2}
.customer-filter-actions{display:flex;gap:8px;align-items:end}
.customer-table{min-width:1180px}
.customer-table td small,.customer-link+small,.customer-subtable td small{
  display:block;
  margin-top:4px;
  color:var(--muted);
  font-weight:500;
}
.customer-link{
  padding:0;
  background:transparent;
  color:var(--accent);
  text-align:left;
  font-weight:800;
}
.customer-link:hover{text-decoration:underline}
.customer-actions{flex-wrap:nowrap}
.customer-pagination{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:14px;
}
.customer-pagination button:disabled{opacity:.45;cursor:not-allowed}
.customer-empty-state{
  display:grid;
  place-items:center;
  gap:4px;
  min-height:150px;
  text-align:center;
}
.customer-dialog{width:min(980px,calc(100% - 24px))}
.customer-dialog .modal-card{max-height:calc(100vh - 32px);overflow:auto}
.customer-form-heading,.customer-detail-heading{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:18px;
  padding-right:34px;
}
.customer-form-heading h3,.customer-detail-heading h3{margin:0;font-size:24px}
.customer-form-heading p,.customer-detail-heading p{margin:4px 0 0}
.customer-form{display:grid;gap:14px}
.customer-form-section,.customer-detail-section{
  border:1px solid var(--line);
  border-radius:16px;
  padding:15px;
  background:#fff;
}
.customer-detail-section{margin-top:14px}
.customer-section-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  margin-bottom:13px;
}
.customer-section-title>b{font-size:15px}
.customer-section-title>span{color:var(--muted);font-size:12px;text-align:right}
.required-field::after{content:"Bắt buộc với doanh nghiệp";color:var(--bad);font-size:11px;font-weight:600}
.customer-form-footer{
  position:sticky;
  bottom:-23px;
  display:flex;
  justify-content:flex-end;
  gap:9px;
  margin:0 -23px -23px;
  padding:14px 23px;
  border-top:1px solid var(--line);
  background:rgba(255,255,255,.96);
  backdrop-filter:blur(12px);
}
.customer-duplicate-panel{
  display:grid;
  gap:10px;
  padding:13px;
  border:1px solid var(--line);
  border-radius:13px;
  background:#f8fafc;
}
.customer-duplicate-panel>div:first-child{display:grid;gap:3px}
.customer-duplicate-panel.clear{border-color:#bde3d5;background:#eefaf5;color:var(--good)}
.customer-duplicate-panel.warning{border-color:#efd8a7;background:#fffaf0;color:var(--warn)}
.customer-duplicate-panel.hard,.customer-duplicate-panel.error-state{border-color:#f2bcc2;background:#fff2f3;color:var(--bad)}
.customer-duplicate-panel.checking{color:var(--muted)}
.customer-duplicate-list{display:grid;gap:8px}
.customer-duplicate-list article{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:9px;
  border-radius:10px;
  background:rgba(255,255,255,.8);
}
.customer-duplicate-list article div{display:grid;gap:2px}
.customer-duplicate-list small{color:inherit;opacity:.8}
.customer-override{
  display:grid;
  gap:10px;
  margin-top:12px;
  padding:13px;
  border:1px dashed #d8a44d;
  border-radius:13px;
}
.customer-detail-actions{
  display:flex;
  justify-content:flex-end;
  gap:9px;
  margin-bottom:10px;
}
.customer-detail-actions select{width:auto;min-width:190px}
.customer-details-grid>div{min-height:72px}
.customer-subtable{min-width:650px}
.badge.ARCHIVED{background:#f1eafe;color:#6846a5}
.badge.INACTIVE{background:#fdebec;color:var(--bad)}
#customerCodePreview{background:#f7f9fc;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-weight:800}
.mobile-nav.customer-mobile-nav{grid-template-columns:repeat(6,1fr)}

@media(max-width:1200px){
  .customer-filter-grid{grid-template-columns:repeat(3,minmax(160px,1fr))}
  .customer-filter-grid .customer-search{grid-column:span 2}
}
@media(max-width:720px){
  .customer-filter-grid{grid-template-columns:1fr}
  .customer-filter-grid .customer-search{grid-column:auto}
  .customer-filter-actions{grid-column:auto}
  .customer-form-heading,.customer-detail-heading,.customer-section-title{
    align-items:flex-start;
    flex-direction:column;
  }
  .customer-section-title>span{text-align:left}
  .customer-form-footer{bottom:-23px}
  .customer-detail-actions{justify-content:stretch;flex-direction:column}
  .customer-detail-actions select{width:100%}
  .mobile-nav.customer-mobile-nav{grid-template-columns:repeat(6,1fr)}
  .mobile-nav.customer-mobile-nav button{font-size:9px}
}

/* CRM_CUSTOMER_PROFILE_WIDE_SMART_V1 */
.customer-dialog.customer-wide{
  width:min(1380px,calc(100vw - 24px));
  max-width:none;
}
.customer-dialog.customer-wide .modal-card{
  width:100%;
  max-height:calc(100vh - 24px);
  overflow:auto;
  padding-bottom:0;
}
.customer-profile-shell{display:grid;gap:12px}
.customer-profile-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  padding:2px 38px 12px 0;
  border-bottom:1px solid var(--line);
}
.customer-profile-identity{display:flex;align-items:center;gap:14px;min-width:0}
.customer-profile-avatar{
  width:54px;
  height:54px;
  flex:0 0 54px;
  display:grid;
  place-items:center;
  border-radius:17px;
  background:linear-gradient(145deg,var(--ink),var(--accent));
  color:#fff;
  font-size:18px;
  font-weight:900;
  letter-spacing:.04em;
}
.customer-profile-title{min-width:0}
.customer-profile-title h3{
  margin:0;
  font-size:25px;
  line-height:1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.customer-profile-meta{display:flex;gap:7px;flex-wrap:wrap;margin-top:7px}
.customer-profile-meta span{
  padding:4px 8px;
  border-radius:999px;
  background:#f2f5f9;
  color:var(--muted);
  font-size:11px;
  font-weight:800;
}
.customer-profile-status{display:grid;justify-items:end;gap:6px;white-space:nowrap}
.customer-profile-status small{color:var(--muted)}
.customer-profile-kpis{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:9px;
}
.customer-profile-kpis article{
  min-width:0;
  padding:11px 12px;
  border:1px solid var(--line);
  border-radius:13px;
  background:#f8fafc;
}
.customer-profile-kpis small,.customer-profile-kpis span{display:block;color:var(--muted)}
.customer-profile-kpis strong{
  display:block;
  margin-top:3px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:14px;
}
.customer-profile-kpis span{margin-top:2px;font-size:11px}
.customer-profile-kpis .customer-profile-health.good{border-color:#bde3d5;background:#eefaf5}
.customer-profile-kpis .customer-profile-health.warning{border-color:#efd8a7;background:#fffaf0}
.customer-profile-grid{
  display:grid;
  grid-template-columns:minmax(0,1.65fr) minmax(290px,.72fr);
  gap:12px;
  align-items:start;
}
.customer-profile-side{display:grid;gap:12px}
.customer-profile-card{margin-top:0;padding:13px;border-radius:14px}
.customer-profile-card .customer-section-title{margin-bottom:10px}
.customer-smart-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
}
.customer-smart-grid>div,.customer-compact-facts>div{
  min-width:0;
  padding:9px 10px;
  border:1px solid #e7ebf1;
  border-radius:11px;
  background:#fbfcfe;
}
.customer-smart-grid small,.customer-compact-facts small{
  display:block;
  margin-bottom:4px;
  color:var(--muted);
  font-size:11px;
}
.customer-smart-grid b,.customer-compact-facts b{
  display:block;
  overflow-wrap:anywhere;
  font-size:13px;
}
.customer-smart-grid .span-2{grid-column:span 2}
.customer-compact-facts{display:grid;gap:8px}
.customer-note-card p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.customer-profile-columns{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.customer-card-list{display:grid;gap:7px}
.customer-contact-card,.customer-address-card{
  display:grid;
  grid-template-columns:34px minmax(0,1fr) auto;
  gap:9px;
  align-items:center;
  padding:9px 10px;
  border:1px solid #e7ebf1;
  border-radius:11px;
  background:#fbfcfe;
}
.customer-card-icon{
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:var(--soft);
  color:var(--accent);
  font-weight:900;
}
.customer-card-content{min-width:0}
.customer-card-content small,.customer-card-content span{display:block;color:var(--muted);font-size:11px}
.customer-card-content b{display:block;overflow-wrap:anywhere;font-size:13px}
.customer-card-state{display:flex;justify-content:flex-end;gap:5px;flex-wrap:wrap}
.customer-card-state .badge{padding:4px 7px;font-size:10px}
.customer-primary-address{
  display:grid;
  gap:3px;
  margin-bottom:8px;
  padding:9px 10px;
  border-left:3px solid var(--accent);
  border-radius:0 10px 10px 0;
  background:#f7f9ff;
}
.customer-primary-address small{color:var(--muted)}
.customer-primary-address b{font-size:13px;overflow-wrap:anywhere}
.customer-compact-empty{padding:16px;text-align:center;color:var(--muted);border:1px dashed var(--line);border-radius:11px}
.customer-profile-sticky-actions{
  position:sticky;
  bottom:0;
  z-index:9;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin:14px -23px 0;
  padding:12px 23px;
  border-top:1px solid var(--line);
  background:rgba(255,255,255,.97);
  backdrop-filter:blur(12px);
}
.customer-profile-sticky-actions .customer-detail-actions{margin:0}
.customer-profile-action-note{display:grid;min-width:0}
.customer-profile-action-note small{color:var(--muted)}
.customer-profile-action-note b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

@media(max-width:1180px){
  .customer-profile-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
  .customer-profile-grid{grid-template-columns:1fr}
  .customer-profile-side{grid-template-columns:repeat(2,minmax(0,1fr))}
  .customer-smart-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:820px){
  .customer-dialog.customer-wide{width:calc(100vw - 12px)}
  .customer-profile-hero,.customer-profile-sticky-actions{align-items:flex-start;flex-direction:column}
  .customer-profile-status{justify-items:start}
  .customer-profile-kpis,.customer-profile-columns,.customer-profile-side{grid-template-columns:1fr}
  .customer-smart-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .customer-profile-sticky-actions .customer-detail-actions{width:100%;flex-direction:row}
  .customer-profile-sticky-actions .customer-detail-actions>*{flex:1}
}
@media(max-width:520px){
  .customer-profile-title h3{white-space:normal}
  .customer-profile-identity{align-items:flex-start}
  .customer-smart-grid{grid-template-columns:1fr}
  .customer-smart-grid .span-2{grid-column:auto}
  .customer-contact-card,.customer-address-card{grid-template-columns:32px minmax(0,1fr)}
  .customer-card-state{grid-column:2;justify-content:flex-start}
  .customer-profile-sticky-actions .customer-detail-actions{flex-direction:column}
}
