/* Light SaaS UI styling for customers module */
.customers-container {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  font-family: 'Inter', system-ui, sans-serif;
  color: #1f2937;
}

.customers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.customers-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
}

.customers-header p {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

.customers-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.customers-input, .customers-select, .customers-textarea {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  background-color: #fff;
  transition: border-color 0.2s;
  box-sizing: border-box;
  width: 100%;
}

.customers-input:focus, .customers-select:focus, .customers-textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.customers-input:read-only, .customers-textarea:read-only {
  background-color: #f3f4f6;
  color: #6b7280;
}

#customers-search {
  flex: 1;
  min-width: 250px;
}

.customers-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
}

.customers-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.customers-btn-primary {
  background-color: #8b5cf6;
  color: #fff;
}

.customers-btn-primary:hover:not(:disabled) {
  background-color: #7c3aed;
}

.customers-btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.customers-btn-secondary:hover:not(:disabled) {
  background-color: #e5e7eb;
}

.customers-alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 14px;
}

.customers-alert-error {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.customers-alert-success {
  background-color: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.customers-table-wrapper {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow-x: auto;
}

.customers-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: 14px;
}

.customers-table th {
  padding: 12px 16px;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
  font-weight: 600;
  text-align: start;
}

.customers-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
  text-align: start;
}

.customers-table tr:last-child td {
  border-bottom: none;
}

.customers-table tr:hover {
  background-color: #f9fafb;
}

/* Badges */
.customers-badge {
  padding: 4px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}

.customers-badge-ai-allowed { background-color: #d1fae5; color: #047857; }
.customers-badge-ai-blocked { background-color: #fee2e2; color: #b91c1c; }

.customers-tag-badge {
  background-color: #f3f4f6;
  color: #4b5563;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  margin-right: 4px;
  margin-bottom: 4px;
  display: inline-block;
}

.customers-empty-state {
  text-align: center;
  padding: 48px 24px;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.customers-empty-state h3 {
  margin: 0 0 8px 0;
  color: #111827;
}

.customers-empty-state p {
  color: #6b7280;
  margin: 0 0 16px 0;
}

.customers-actions {
  display: flex;
  gap: 8px;
}

.customers-btn-text {
  background: none;
  border: none;
  color: #8b5cf6;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.customers-btn-text:hover {
  text-decoration: underline;
  color: #7c3aed;
}

/* ==========================================
   Modal — Premium CRM Management Panel
   ========================================== */

.customers-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.customers-hidden {
  display: none !important;
}

/* --- Overlay --- */
.customers-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(23, 19, 38, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: customers-fadeIn 0.2s ease-out;
}

/* --- Modal Content Shell --- */
.customers-modal-content {
  position: relative;
  background-color: var(--surface, #fff);
  border-radius: var(--radius-lg, 16px);
  width: min(1100px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal, 0 20px 25px -5px rgba(32, 24, 64, 0.1), 0 10px 10px -5px rgba(32, 24, 64, 0.04));
  animation: customers-scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* ==========================================
   Header — Customer Identity Bar
   ========================================== */
.customers-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px;
  border-bottom: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  background-color: var(--surface, #fff);
  flex-shrink: 0;
}

.customers-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.customers-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  background-color: hsl(260, 60%, 92%);
  color: hsl(260, 55%, 40%);
  user-select: none;
}

.customers-profile-header h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #171326);
}

.customers-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted, #9B96AA);
}

.customers-ai-badge {
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.customers-badge-enabled {
  background-color: var(--success-soft, rgba(22, 199, 154, 0.12));
  color: var(--success, #16C79A);
}
.customers-badge-disabled {
  background-color: var(--danger-soft, rgba(239, 106, 122, 0.12));
  color: var(--danger, #EF6A7A);
}

.customers-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted, #9B96AA);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.customers-modal-close:hover {
  background-color: var(--surface-muted, #F1F0FA);
  color: var(--text-primary, #171326);
}

/* ==========================================
   Form Shell
   ========================================== */
.customers-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ==========================================
   Metadata Info Cards Grid
   ========================================== */
.customers-metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 24px 24px 0 24px;
}

.customers-meta-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background-color: var(--surface-soft, #F8F7FF);
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  border-radius: 8px;
}
.customers-meta-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #9B96AA);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.customers-meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #171326);
  word-break: break-all;
}
.customers-meta-subvalue {
  font-size: 11px;
  color: var(--text-muted, #9B96AA);
  margin-top: 2px;
}

/* ==========================================
   Main Grid Layout
   ========================================== */
.customers-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  padding: 24px;
  flex: 1;
}

.customers-card {
  background-color: var(--surface, #fff);
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-subtle, 0 1px 3px 0 rgba(32, 24, 64, 0.04));
}
.customers-main-card {
  grid-column: 1 / 2;
}
.customers-side-column {
  grid-column: 2 / 3;
}
.customers-field-full {
  grid-column: 1 / -1;
}

.customers-card-header {
  margin-bottom: 16px;
}
.customers-card-header h4 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #171326);
}
.customers-card-header p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary, #6F6A80);
}

/* ==========================================
   Form Fields
   ========================================== */
.customers-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.customers-field {
  display: flex;
  flex-direction: column;
}
.customers-field.customers-field-full {
  grid-column: 1 / -1;
}

.customers-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #6F6A80);
  margin-bottom: 6px;
}

.customers-field input,
.customers-card textarea {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  background-color: #fff;
  transition: border-color 0.2s;
  box-sizing: border-box;
  width: 100%;
}
.customers-field input:focus,
.customers-card textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}
.customers-card textarea {
  resize: vertical;
  min-height: 80px;
}
#customers-form-summary {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  background-color: var(--surface-muted, #F1F0FA);
  resize: none;
  color: var(--text-secondary, #6F6A80);
}

/* ==========================================
   AI Toggle Row
   ========================================== */
.customers-ai-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px;
  background-color: var(--surface-soft, #F8F7FF);
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  border-radius: 8px;
}
.customers-ai-toggle-row input {
  display: none;
}
.customers-toggle-ui {
  position: relative;
  width: 40px;
  height: 22px;
  background-color: #cbd5e1;
  border-radius: 22px;
  transition: background-color 0.3s;
}
.customers-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}
.customers-ai-toggle-row input:checked + .customers-toggle-ui {
  background-color: var(--success, #16C79A);
}
.customers-ai-toggle-row input:checked + .customers-toggle-ui::after {
  transform: translateX(18px);
}
.customers-toggle-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #171326);
}

/* ==========================================
   Tags Preview
   ========================================== */
.customers-tags-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.customers-tag-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

/* ==========================================
   Sticky Footer
   ========================================== */
.customers-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  background-color: var(--surface, #fff);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.customers-modal-footer button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
}
.customers-btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}
.customers-btn-primary {
  background-color: #8b5cf6;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.customers-save-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: customers-spin 0.6s linear infinite;
}

/* ==========================================
   Animations & Responsive Breakpoints
   ========================================== */
@keyframes customers-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes customers-scaleIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@keyframes customers-spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .customers-modal-grid { grid-template-columns: 1fr; }
  .customers-main-card, .customers-side-column, .customers-field-full { grid-column: 1 / -1; }
  .customers-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .customers-modal-content {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    height: 100vh;
  }
}

/* ==========================================
   UX Additions: Copy buttons & header context
   ========================================== */
.customers-input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.customers-input-with-action input {
  flex: 1;
  min-width: 0;
}
.customers-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  height: 42px; /* Matches the input height closely */
  background-color: var(--surface-soft, #F8F7FF);
  border: 1px solid var(--border-medium, rgba(32, 24, 64, 0.12));
  color: var(--primary, #7C6DF2);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease-in-out;
  flex-shrink: 0;
  box-sizing: border-box;
}
.customers-copy-btn:hover {
  background-color: var(--primary-soft, rgba(124, 109, 242, 0.12));
  border-color: var(--primary, #7C6DF2);
}
.customers-copy-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-soft, rgba(124, 109, 242, 0.12));
}

.customers-copy-btn-mini {
  height: 22px !important;
  padding: 0 6px !important;
  font-size: 10px !important;
  border-radius: 4px !important;
  margin: 0 !important;
}

.customers-header-context {
  margin-top: 16px;
  padding: 14px;
  background-color: var(--surface-soft, #F8F7FF);
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}

.customers-header-context-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #171326);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.customers-header-context-text {
  font-size: 12px;
  color: var(--text-secondary, #6F6A80);
  margin-bottom: 10px;
  line-height: 1.4;
}

.customers-header-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.customers-header-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background-color: var(--surface, #ffffff);
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  color: var(--text-secondary, #6F6A80);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* ==========================================
   AI Summary Preview & Secondary Memory Modal
   ========================================== */
.customers-summary-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.customers-memory-preview-actions {
  display: flex;
  gap: 8px;
}

.customers-summary-preview-container {
  position: relative;
  max-height: 160px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

.customers-summary-preview-container textarea {
  border: none !important;
  border-radius: 0 !important;
  height: 160px !important;
  resize: none !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding-bottom: 30px !important; /* Space for the fade overlay */
  background-color: var(--surface-soft, #F8F7FF) !important;
}

.customers-summary-preview-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to top, var(--surface-soft, #F8F7FF), transparent);
  pointer-events: none; /* Let clicks pass through to textarea */
}

/* Secondary Modal overlay above customer modal (z-index needs to be > 1000) */
.customers-memory-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000; /* Higher than main modal */
  display: flex;
  align-items: center;
  justify-content: center;
}

.customers-memory-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(23, 19, 38, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: customers-fadeIn 0.2s ease-out;
}

.customers-memory-dialog {
  position: relative;
  background-color: var(--surface, #fff);
  border-radius: 20px;
  width: min(900px, calc(100vw - 48px));
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(32, 24, 64, 0.25);
  animation: customers-scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  z-index: 2001;
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
}

.customers-memory-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px;
  border-bottom: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  background-color: var(--surface, #fff);
  flex-shrink: 0;
}

.customers-memory-header h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #171326);
}

.customers-memory-header p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary, #6F6A80);
}

.customers-memory-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.customers-memory-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted, #9B96AA);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.customers-memory-close:hover {
  background-color: var(--surface-muted, #F1F0FA);
  color: var(--text-primary, #171326);
}

.customers-memory-content {
  padding: 20px;
  margin: 24px;
  background-color: var(--surface-soft, #F8F7FF);
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  border-radius: 14px;
  max-height: 60vh;
  overflow-y: auto;
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: start;
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 15px;
  color: var(--text-primary, #171326);
  box-sizing: border-box;
}

/* Light styling adjustments for RTL text */
.customers-memory-content:dir(ltr) {
  direction: ltr;
  text-align: start;
}

/* ==========================================
   Professional Tag Input Component
   ========================================== */
.customers-tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  min-height: 48px;
  box-sizing: border-box;
  width: 100%;
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.customers-tag-input:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
  outline: none;
}

.customers-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.customers-tags-entry {
  flex: 1;
  min-width: 120px;
  border: none !important;
  outline: none !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  font-size: 14px !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

.customers-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: rgba(124, 109, 242, 0.1);
  border: 1px solid rgba(124, 109, 242, 0.2);
  color: #7C6DF2;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  animation: customers-fadeIn 0.15s ease-out;
}

.customers-tag-text {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customers-tag-remove {
  background: none;
  border: none;
  color: #7C6DF2;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.customers-tag-remove:hover {
  opacity: 1;
}

.customers-field-helper {
  font-size: 11px;
  color: #6b7280;
  margin-top: 6px;
  display: block;
}

/* Visually hide Customer DB ID card */
.customers-internal-only {
  display: none !important;
}

/* ==========================================
   Statistics Grid
   ========================================== */
.customers-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.customers-stat-card {
  background-color: var(--surface-primary, #ffffff);
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.customers-stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transform: translateY(-2px);
}

.customers-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.customers-stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.customers-stat-label {
  font-size: 13px;
  color: var(--text-secondary, #524B6B);
  font-weight: 500;
}

.customers-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary, #171326);
}

/* ==========================================
   Customers Table Enhancements
   ========================================== */
.customers-table-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 550;
  margin: 2px;
  white-space: nowrap;
}

.customers-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-light, rgba(32, 24, 64, 0.08));
  background-color: var(--surface-primary, #ffffff);
  color: var(--text-secondary, #524B6B);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.customers-action-icon-btn:hover {
  background-color: var(--primary-soft, rgba(124, 109, 242, 0.1));
  border-color: var(--primary, #7C6DF2);
  color: var(--primary, #7C6DF2);
}

.customers-action-icon-btn.customers-copy-success {
  background-color: #ECFDF5 !important;
  border-color: #A7F3D0 !important;
  color: #047857 !important;
}

/* ==========================================
   Arabic / RTL & Mobile UX Master Enhancements
   ========================================== */
.customers-container {
  font-family: var(--font-family, 'Inter', system-ui, sans-serif);
  text-align: start;
}

[dir="rtl"] .customers-header h2,
[dir="rtl"] .customers-header p,
[dir="rtl"] .customers-card-header,
[dir="rtl"] .customers-field label,
[dir="rtl"] .customers-modal-content,
[dir="rtl"] .customers-empty-state {
  text-align: start;
}

/* Bidi Isolation for Alphanumeric & Phone Data */
.customers-avatar,
.customers-meta-value,
.customers-meta-subvalue,
#customers-header-customer-id,
#customers-form-customer-id,
#customers-form-phone,
#customers-form-email,
.customers-table td:nth-child(2) {
  unicode-bidi: isolate;
}

/* Logical Pills Alignment */
.customers-header-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.customers-header-pill {
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: center;
}

.customers-tag-badge {
  margin-inline-end: 6px;
  margin-inline-start: 0;
}

/* Mobile Responsiveness (<= 768px) */
@media (max-width: 768px) {
  .customers-container {
    padding: 16px 8px;
  }

  .customers-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .customers-header h2 {
    font-size: 20px;
  }

  .customers-btn {
    min-height: 44px;
  }

  .customers-btn-primary {
    width: 100%;
  }

  .customers-filters {
    flex-direction: column;
    gap: 10px;
  }

  #customers-search {
    min-width: 0;
    width: 100%;
  }

  /* Table Smooth Scroll on Mobile */
  .customers-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    margin-bottom: 20px;
  }

  .customers-table th,
  .customers-table td {
    padding: 12px 10px;
    white-space: nowrap;
  }

  /* Actions Touch Targets */
  .customers-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .customers-action-icon-btn {
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
  }

  /* Near-Fullscreen Mobile CRM Modal Sheet */
  .customers-modal {
    padding: 0;
  }

  .customers-modal-content {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .customers-modal-header {
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .customers-modal-grid {
    grid-template-columns: 1fr;
    padding: 16px 14px;
    gap: 14px;
  }

  .customers-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .customers-metadata-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 14px;
    gap: 8px;
  }

  .customers-modal-footer {
    padding: 14px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    flex-direction: column-reverse;
    gap: 10px;
  }

  .customers-modal-footer button {
    width: 100%;
    min-height: 46px;
  }

  .customers-modal-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
  }

  /* Memory Dialog */
  .customers-memory-modal {
    padding: 0;
  }

  .customers-memory-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

