/* ═══════════════════════════════════════════════════════════════════════════
   HAMCO CRM - Main CSS Design System
   Arabic RTL, Mobile-First, Professional UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --hamco-primary:        #1a3a5c;
  --hamco-primary-light:  #2563a8;
  --hamco-primary-dark:   #0f2440;
  --hamco-secondary:      #e8a020;
  --hamco-secondary-light:#f5c04a;
  --hamco-accent:         #00b4d8;
  --hamco-success:        #22c55e;
  --hamco-warning:        #f59e0b;
  --hamco-danger:         #ef4444;
  --hamco-info:           #3b82f6;

  --bg-primary:           #f0f4f8;
  --bg-secondary:         #ffffff;
  --bg-sidebar:           #1a3a5c;
  --bg-card:              #ffffff;
  --bg-header:            #ffffff;

  --text-primary:         #1e293b;
  --text-secondary:       #64748b;
  --text-muted:           #94a3b8;
  --text-white:           #ffffff;
  --text-on-primary:      #ffffff;

  --border-color:         #e2e8f0;
  --border-radius:        8px;
  --border-radius-lg:     12px;
  --border-radius-xl:     16px;

  --shadow-sm:            0 1px 3px rgba(0,0,0,.08);
  --shadow-md:            0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:            0 8px 24px rgba(0,0,0,.12);

  --sidebar-width:        260px;
  --header-height:        64px;
  --transition:           all .2s ease;

  --font-arabic:          'Cairo', 'Tajawal', 'Segoe UI', Arial, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { direction: rtl; font-size: 16px; scroll-behavior: smooth; }

body.hamco-crm-app {
  font-family: var(--font-arabic);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Loading Screen ────────────────────────────────────────────────────────── */
.hamco-loading-screen {
  position: fixed; inset: 0;
  background: var(--hamco-primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.hamco-loader { text-align: center; color: white; }
.hamco-logo-text {
  font-size: 2rem; font-weight: 800; letter-spacing: 2px;
  margin-bottom: 1.5rem; color: var(--hamco-secondary);
}
.hamco-spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: var(--hamco-secondary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 1rem;
}
.hamco-loading-text { font-size: .9rem; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── App Layout ────────────────────────────────────────────────────────────── */
#hamco-crm-root { display: flex; min-height: 100vh; }

.crm-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed; top: 0; right: 0; bottom: 0;
  overflow-y: auto; z-index: 100;
  display: flex; flex-direction: column;
  transition: var(--transition);
  box-shadow: -2px 0 12px rgba(0,0,0,.15);
}

.crm-main {
  margin-right: var(--sidebar-width);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

.crm-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.crm-content {
  flex: 1; padding: 1.5rem;
  overflow-y: auto;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-logo-text {
  color: var(--hamco-secondary);
  font-size: 1.25rem; font-weight: 800; letter-spacing: 1px;
}
.sidebar-logo-sub { color: rgba(255,255,255,.6); font-size: .75rem; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-section-title {
  color: rgba(255,255,255,.4);
  font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  padding: .5rem 1.5rem; margin-top: .5rem;
}

.sidebar-nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.5rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: right; font-family: var(--font-arabic);
  font-size: .9rem;
  border-right: 3px solid transparent;
}
.sidebar-nav-item:hover {
  background: rgba(255,255,255,.08);
  color: white;
}
.sidebar-nav-item.active {
  background: rgba(255,255,255,.12);
  color: white;
  border-right-color: var(--hamco-secondary);
}
.sidebar-nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-nav-item .nav-badge {
  margin-right: auto;
  background: var(--hamco-danger);
  color: white; font-size: .7rem;
  padding: .15rem .4rem; border-radius: 10px;
  font-weight: 600;
}

.sidebar-user {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--hamco-secondary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: .9rem;
  flex-shrink: 0;
}
.sidebar-user-name { color: white; font-size: .85rem; font-weight: 600; }
.sidebar-user-role { color: rgba(255,255,255,.5); font-size: .75rem; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.header-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.header-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border-color);
  background: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 1rem;
  transition: var(--transition); position: relative;
}
.header-btn:hover { background: var(--bg-primary); color: var(--hamco-primary); }
.header-btn .badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--hamco-danger); color: white;
  font-size: .65rem; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

/* ── Stat Cards ────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 1rem;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--border-radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: var(--hamco-info); }
.stat-icon.green  { background: #f0fdf4; color: var(--hamco-success); }
.stat-icon.yellow { background: #fffbeb; color: var(--hamco-warning); }
.stat-icon.red    { background: #fef2f2; color: var(--hamco-danger); }
.stat-icon.purple { background: #faf5ff; color: #8b5cf6; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-secondary); margin-top: .25rem; }
.stat-change { font-size: .75rem; margin-top: .5rem; }
.stat-change.up   { color: var(--hamco-success); }
.stat-change.down { color: var(--hamco-danger); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1.25rem;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  font-family: var(--font-arabic);
  font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
  line-height: 1.5;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary   { background: var(--hamco-primary); color: white; }
.btn-primary:hover { background: var(--hamco-primary-light); }
.btn-secondary { background: var(--hamco-secondary); color: white; }
.btn-secondary:hover { background: var(--hamco-secondary-light); }
.btn-success   { background: var(--hamco-success); color: white; }
.btn-danger    { background: var(--hamco-danger); color: white; }
.btn-warning   { background: var(--hamco-warning); color: white; }
.btn-info      { background: var(--hamco-info); color: white; }
.btn-outline   { background: transparent; border-color: var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-primary); }
.btn-ghost     { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-primary); color: var(--text-primary); }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-icon { padding: .5rem; border-radius: var(--border-radius); }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; margin-bottom: .4rem;
  font-size: .875rem; font-weight: 600; color: var(--text-primary);
}
.form-label .required { color: var(--hamco-danger); margin-right: .25rem; }
.form-control {
  width: 100%; padding: .6rem .9rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: var(--font-arabic); font-size: .9rem;
  color: var(--text-primary); background: white;
  transition: var(--transition); outline: none;
  direction: rtl;
}
.form-control:focus { border-color: var(--hamco-primary-light); box-shadow: 0 0 0 3px rgba(37,99,168,.1); }
.form-control::placeholder { color: var(--text-muted); }
.form-control.error { border-color: var(--hamco-danger); }
.form-error { color: var(--hamco-danger); font-size: .8rem; margin-top: .3rem; }
.form-hint  { color: var(--text-muted); font-size: .8rem; margin-top: .3rem; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .75rem center; padding-left: 2rem; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--border-radius-lg); border: 1px solid var(--border-color); }
table.crm-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.crm-table thead { background: var(--bg-primary); }
table.crm-table th {
  padding: .75rem 1rem; text-align: right;
  font-weight: 700; color: var(--text-secondary);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
table.crm-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary); vertical-align: middle;
}
table.crm-table tbody tr:hover { background: #f8fafc; }
table.crm-table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-primary { background: #e0e7ff; color: #3730a3; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Status badges ─────────────────────────────────────────────────────────── */
.status-open     { background: #dbeafe; color: #1e40af; }
.status-closed   { background: #f1f5f9; color: #475569; }
.status-pending  { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-executed { background: #d1fae5; color: #065f46; }
.status-archived { background: #e2e8f0; color: #64748b; }

/* ── Priority badges ───────────────────────────────────────────────────────── */
.priority-critical { background: #fce7f3; color: #9d174d; }
.priority-high     { background: #fee2e2; color: #991b1b; }
.priority-medium   { background: #fef3c7; color: #92400e; }
.priority-low      { background: #f0fdf4; color: #166534; }

/* ── Similarity color coding ───────────────────────────────────────────────── */
.match-green  { background: #dcfce7 !important; }
.match-yellow { background: #fef9c3 !important; }
.match-red    { background: #fee2e2 !important; }
.match-gray   { background: #f8fafc !important; color: var(--text-muted) !important; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: .875rem 1.25rem; border-radius: var(--border-radius);
  border: 1px solid transparent; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .75rem;
  font-size: .875rem;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  animation: fadeIn .2s ease;
}
.modal {
  background: white; border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1200px; }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--bg-primary);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 1.1rem;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border-color); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex; gap: .75rem; justify-content: flex-start;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs { border-bottom: 2px solid var(--border-color); display: flex; gap: 0; margin-bottom: 1.5rem; overflow-x: auto; }
.tab-btn {
  padding: .75rem 1.25rem; border: none; background: none;
  font-family: var(--font-arabic); font-size: .875rem; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: var(--transition); white-space: nowrap;
}
.tab-btn:hover { color: var(--hamco-primary); }
.tab-btn.active { color: var(--hamco-primary); border-bottom-color: var(--hamco-primary); }

/* ── Search & Filters ──────────────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .9rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius);
  background: white; transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--hamco-primary-light); box-shadow: 0 0 0 3px rgba(37,99,168,.1); }
.search-bar input { border: none; outline: none; flex: 1; font-family: var(--font-arabic); font-size: .9rem; direction: rtl; }
.search-bar .search-icon { color: var(--text-muted); font-size: 1rem; }

.filter-bar {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: .5rem;
  justify-content: center; margin-top: 1.5rem;
}
.page-btn {
  width: 36px; height: 36px; border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; color: var(--text-primary);
  transition: var(--transition);
}
.page-btn:hover { background: var(--bg-primary); }
.page-btn.active { background: var(--hamco-primary); color: white; border-color: var(--hamco-primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Customer 360 ──────────────────────────────────────────────────────────── */
.customer-360-header {
  background: linear-gradient(135deg, var(--hamco-primary), var(--hamco-primary-light));
  border-radius: var(--border-radius-xl);
  padding: 1.5rem; color: white; margin-bottom: 1.5rem;
}
.customer-code-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.15);
  padding: .35rem .85rem; border-radius: 20px;
  font-size: .85rem; font-weight: 700; margin-bottom: .75rem;
}
.customer-name-large { font-size: 1.75rem; font-weight: 800; margin-bottom: .5rem; }
.customer-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; opacity: .85; font-size: .875rem; }

/* ── Timeline (Conversations) ──────────────────────────────────────────────── */
.timeline { position: relative; padding-right: 2rem; }
.timeline::before {
  content: ''; position: absolute; right: .75rem; top: 0; bottom: 0;
  width: 2px; background: var(--border-color);
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-dot {
  position: absolute; right: -2rem; top: .35rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--hamco-primary); border: 2px solid white;
  box-shadow: 0 0 0 2px var(--hamco-primary);
}
.timeline-dot.internal { background: var(--text-muted); box-shadow: 0 0 0 2px var(--text-muted); }
.timeline-dot.customer { background: var(--hamco-success); box-shadow: 0 0 0 2px var(--hamco-success); }
.timeline-content {
  background: white; border-radius: var(--border-radius);
  border: 1px solid var(--border-color); padding: .875rem 1rem;
}
.timeline-content.internal { background: #f8fafc; }
.timeline-meta { font-size: .75rem; color: var(--text-muted); margin-bottom: .5rem; }
.timeline-text { font-size: .875rem; line-height: 1.6; }
.timeline-locked {
  display: flex; align-items: center; gap: .4rem;
  font-size: .75rem; color: var(--text-muted); margin-top: .5rem;
}

/* ── Import Wizard ─────────────────────────────────────────────────────────── */
.import-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 2rem; overflow-x: auto;
}
.import-step {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1.25rem;
  font-size: .875rem; font-weight: 600;
  color: var(--text-muted); white-space: nowrap;
}
.import-step.active { color: var(--hamco-primary); }
.import-step.done   { color: var(--hamco-success); }
.import-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--border-color); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.import-step.active .import-step-num { background: var(--hamco-primary); color: white; }
.import-step.done .import-step-num   { background: var(--hamco-success); color: white; }
.import-step-arrow { color: var(--border-color); font-size: 1.2rem; }

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-xl);
  padding: 3rem 2rem; text-align: center;
  cursor: pointer; transition: var(--transition);
  background: var(--bg-primary);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--hamco-primary);
  background: #eff6ff;
}
.drop-zone-icon { font-size: 3rem; margin-bottom: 1rem; }
.drop-zone-text { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: .5rem; }
.drop-zone-sub  { font-size: .85rem; color: var(--text-muted); }

/* ── Duplicate Review ──────────────────────────────────────────────────────── */
.compare-table { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border-color); border-radius: var(--border-radius); overflow: hidden; }
.compare-col   { background: white; }
.compare-header{ padding: 1rem; font-weight: 700; text-align: center; background: var(--bg-primary); }
.compare-row   { display: contents; }
.compare-cell  { padding: .6rem .9rem; font-size: .85rem; border-bottom: 1px solid var(--border-color); }
.compare-cell.green  { background: #dcfce7; }
.compare-cell.yellow { background: #fef9c3; }
.compare-cell.red    { background: #fee2e2; }
.compare-cell.gray   { background: #f8fafc; color: var(--text-muted); }

/* ── Commitment Ledger ─────────────────────────────────────────────────────── */
.ledger-row { display: flex; align-items: center; gap: 1rem; padding: .875rem 1rem; border-bottom: 1px solid var(--border-color); }
.ledger-row:last-child { border-bottom: none; }
.ledger-amount { font-size: 1.1rem; font-weight: 800; color: var(--hamco-primary); white-space: nowrap; }
.ledger-code   { font-size: .75rem; color: var(--text-muted); font-family: monospace; }

/* ── Portal Mode ───────────────────────────────────────────────────────────── */
body.portal-mode {
  background: linear-gradient(135deg, #f0f4f8 0%, #e8f0fe 100%);
}
.portal-header {
  background: var(--hamco-primary);
  padding: 1rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  color: white; box-shadow: var(--shadow-md);
}
.portal-logo { font-size: 1.25rem; font-weight: 800; color: var(--hamco-secondary); }
.portal-content { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.portal-welcome {
  background: linear-gradient(135deg, var(--hamco-primary), var(--hamco-primary-light));
  border-radius: var(--border-radius-xl);
  padding: 2rem; color: white; margin-bottom: 2rem;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .crm-sidebar {
    transform: translateX(100%);
    width: 280px;
    transition: transform .3s ease;
  }
  .crm-sidebar.open { transform: translateX(0); }
  .crm-main { margin-right: 0; }
  .crm-content { padding: 1rem; }
  .stat-card { flex-direction: column; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .compare-table { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0; border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .customer-meta { flex-direction: column; gap: .5rem; }
  .import-steps { gap: 0; }
}

@media (max-width: 480px) {
  .crm-header { padding: 0 1rem; }
  .header-title { font-size: .95rem; }
  .card-body { padding: 1rem; }
  .btn { padding: .45rem 1rem; font-size: .825rem; }
  table.crm-table th, table.crm-table td { padding: .6rem .75rem; }
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--hamco-danger); }
.text-success{ color: var(--hamco-success); }
.text-warning{ color: var(--hamco-warning); }
.text-primary-color { color: var(--hamco-primary); }
.fw-bold  { font-weight: 700; }
.fw-600   { font-weight: 600; }
.fs-sm    { font-size: .8rem; }
.fs-xs    { font-size: .75rem; }
.d-flex   { display: flex; }
.d-grid   { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: .75rem; }
.gap-3 { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: .75rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: .75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.p-0 { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-data {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted); font-size: .9rem;
}
.no-data-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.spinner-sm {
  width: 20px; height: 20px;
  border: 2px solid rgba(0,0,0,.1);
  border-top-color: var(--hamco-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
.overlay-loading {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit; z-index: 10;
}
