/* public/customers.css — tab Khách hàng (worker B, web tender v32).
   Mọi style scope dưới .customers-tab. Dark theme như tab Báo cáo. */
.customers-tab {
  background: #04090f;
  color: #fff;
  padding: 16px;
  border-radius: 12px;
}
.customers-tab h2, .customers-tab h3 { color: #fff; margin: 4px 0 12px; }
.customers-tab h3 { font-size: 17px; }
.customers-tab h4 { color: #ffd23e; margin: 12px 0 6px; font-size: 14px; }
.customers-tab .muted { color: #8fa3b3; font-size: 13px; }
.customers-tab .cust-loading { padding: 24px; color: #8fa3b3; }
.customers-tab .cust-error {
  background: #3a0d0d; border: 1px solid #ff3b30; color: #ffb3ae;
  padding: 10px 12px; border-radius: 12px; margin: 8px 0;
}

/* Bộ lọc */
.customers-tab .cust-filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.customers-tab .cust-filters select,
.customers-tab .cust-filters input[type="search"] {
  background: #0a141f; color: #fff; border: 1px solid #1e3040;
  border-radius: 12px; padding: 8px 10px; font-size: 14px;
}
.customers-tab .cust-filters input[type="search"] { flex: 1 1 200px; }

/* Section */
.customers-tab .cust-section {
  background: #0a141f; border: 1px solid #1e3040; border-radius: 12px;
  padding: 14px; margin-bottom: 14px;
}
.customers-tab .cust-kpis { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.customers-tab .kpi {
  flex: 1 1 120px; background: #04090f; border: 1px solid #1e3040;
  border-radius: 12px; padding: 10px; text-align: center;
}
.customers-tab .kpi-num { display: block; font-size: 20px; font-weight: 700; color: #ffd23e; }
.customers-tab .kpi-label { font-size: 12px; color: #8fa3b3; }

/* Donut */
.customers-tab .cust-donuts { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0; }
.customers-tab .donut-box {
  flex: 1 1 280px; background: #04090f; border: 1px solid #1e3040;
  border-radius: 12px; padding: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.customers-tab .donut-box h4 { width: 100%; margin: 2px 0; }
.customers-tab .donut { width: 140px; height: 140px; flex: 0 0 auto; }
.customers-tab .donut-center-top { fill: #fff; font-size: 15px; font-weight: 700; text-anchor: middle; }
.customers-tab .donut-center-bottom { fill: #8fa3b3; font-size: 11px; text-anchor: middle; }
.customers-tab .donut-empty { color: #8fa3b3; padding: 20px; }
.customers-tab .donut-legend { flex: 1 1 160px; }
.customers-tab .legend-row { display: flex; gap: 6px; align-items: center; font-size: 13px; padding: 2px 0; }
.customers-tab .legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.customers-tab .legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customers-tab .legend-val { color: #ffd23e; white-space: nowrap; }

/* Bảng */
.customers-tab .table-wrap { overflow-x: auto; }
.customers-tab .cust-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.customers-tab .cust-table th, .customers-tab .cust-table td {
  border-bottom: 1px solid #1e3040; padding: 8px 10px; text-align: left;
}
.customers-tab .cust-table th { color: #8fa3b3; font-weight: 600; white-space: nowrap; }
.customers-tab .cust-table td.num, .customers-tab .cust-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.customers-tab .cust-table td.num { white-space: nowrap; }
.customers-tab .cust-table tr.clickable { cursor: pointer; }
.customers-tab .cust-table tr.clickable:hover td { background: #122334; }
.customers-tab .cust-table tr.row-unnamed td { color: #ff6b64; }
.customers-tab .group-chip {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.customers-tab .suggest { font-size: 12px; color: #ffd23e; }
.customers-tab .unnamed { color: #ff3b30; font-weight: 700; }
.customers-tab .status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-left: 4px; }

/* Thẻ mobile */
.customers-tab .mobile-only { display: none; }
.customers-tab .cust-card {
  background: #04090f; border: 1px solid #1e3040; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.customers-tab .cust-card-title { font-weight: 700; }
.customers-tab .cust-card-code { color: #8fa3b3; font-weight: 400; font-size: 13px; }
.customers-tab .cust-card-sub { color: #8fa3b3; font-size: 13px; margin: 4px 0; }
.customers-tab .cust-card-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }

/* Phân trang / nút */
.customers-tab .cust-pager { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.customers-tab .cust-pager button, .customers-tab .ghost-btn, .customers-tab .primary-btn,
.customers-tab .mini-btn, .customers-tab .sort-btn {
  background: #0a141f; color: #fff; border: 1px solid #1e3040;
  border-radius: 12px; padding: 7px 12px; cursor: pointer; font-size: 14px;
}
.customers-tab .cust-pager button:disabled, .customers-tab button:disabled { opacity: .45; cursor: not-allowed; }
.customers-tab .primary-btn { background: #25e2a0; color: #04090f; border-color: #25e2a0; font-weight: 700; }
.customers-tab .ghost-btn { background: transparent; }
.customers-tab .mini-btn { padding: 3px 8px; font-size: 12px; border-radius: 8px; }
.customers-tab .mini-btn.danger { border-color: #ff3b30; color: #ff6b64; }
.customers-tab .sort-bar { margin-bottom: 8px; font-size: 13px; color: #8fa3b3; }
.customers-tab .sort-btn { padding: 4px 10px; font-size: 13px; margin-left: 4px; }
.customers-tab .sort-btn.active { border-color: #25e2a0; color: #25e2a0; }
.customers-tab .company-title { color: #ffd23e; font-size: 20px; }
.customers-tab .info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 16px; margin: 8px 0 12px; font-size: 14px;
}
.customers-tab .contact-row {
  border-bottom: 1px solid #1e3040; padding: 8px 0; font-size: 14px;
}
.customers-tab .row-company-line { margin-bottom: 8px; font-size: 14px; }

/* Gợi ý trùng */
.customers-tab .dup-card {
  background: #04090f; border: 1px solid #1e3040; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
}
.customers-tab .dup-reason { color: #ffd23e; font-size: 13px; margin-bottom: 6px; }
.customers-tab .dup-name {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
  font-size: 14px; padding: 3px 0;
}
.customers-tab .dup-actions { margin-top: 8px; display: flex; gap: 8px; }
.customers-tab .dup-actions button {
  background: #0a141f; color: #fff; border: 1px solid #1e3040;
  border-radius: 12px; padding: 6px 12px; cursor: pointer;
}
.customers-tab .dup-actions button.ghost { background: transparent; }

/* Modal */
.cust-modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .65);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; z-index: 1000; padding: 24px 12px;
}
.cust-modal {
  background: #0a141f; color: #fff; border: 1px solid #1e3040;
  border-radius: 12px; padding: 18px; width: min(860px, 96vw);
  max-height: 88vh; overflow-y: auto;
}
.cust-modal h3 { color: #ffd23e; margin-top: 0; }
.cust-modal h4 { color: #ffd23e; }
.cust-modal .row-view { display: grid; grid-template-columns: 180px 1fr; gap: 4px 12px; margin: 0 0 10px; }
.cust-modal .row-view dt { color: #8fa3b3; font-size: 13px; }
.cust-modal .row-view dd { margin: 0; font-size: 14px; }
.cust-modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.cust-modal .modal-actions button {
  border: 1px solid #1e3040; border-radius: 12px; padding: 8px 14px;
  cursor: pointer; font-size: 14px; background: #04090f; color: #fff;
}
.cust-modal .modal-actions .primary-btn { background: #25e2a0; color: #04090f; border-color: #25e2a0; font-weight: 700; }
.cust-modal .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.cust-modal .form-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cust-modal .form-field span { color: #8fa3b3; }
.cust-modal .form-field input, .cust-modal .form-field select {
  background: #04090f; color: #fff; border: 1px solid #1e3040;
  border-radius: 12px; padding: 8px 10px; font-size: 14px; width: 100%;
}
.cust-modal .derived-box {
  background: #04090f; border: 1px solid #1e3040; border-radius: 12px;
  padding: 10px; margin-top: 12px; font-size: 13px;
}
.cust-modal .contact-edit {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px; margin-bottom: 6px;
}
.cust-modal .contact-edit input {
  background: #04090f; color: #fff; border: 1px solid #1e3040;
  border-radius: 12px; padding: 7px 9px; font-size: 13px;
}

/* Mobile: thẻ gọn, không cuộn ngang */
@media (max-width: 760px) {
  .customers-tab { padding: 10px; }
  .customers-tab .desktop-only { display: none; }
  .customers-tab .mobile-only { display: block; }
  .customers-tab .cust-filters select, .customers-tab .cust-filters input[type="search"] { flex: 1 1 100%; }
  .cust-modal .row-view { grid-template-columns: 1fr; }
  .cust-modal .row-view dt { margin-top: 6px; }
}
