@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter+Tight:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ── Core surfaces ── */
  --bg:    #F6F4EF;
  --card:  #FCFBF8;

  /* ── Sidebar (unused here but kept for parity) ── */
  --sidebar-bg:   #2A3022;
  --sidebar-text: #e8e9d8;

  /* ── Primary: Olive Green ── */
  --primary:       #3a4b22;
  --primary-light: #4a5e2c;
  --primary-dark:  #2A3022;

  /* ── Accent gold ── */
  --accent:       #72440c;
  --accent-light: #F5EFE4;
  --accent-line:  #ccab6e;

  /* ── Text hierarchy ── */
  --text:        #1a1a12;
  --text-muted:  #3a3a2e;
  --text-light:  #6c6c5c;
  --text-xlight: #a6a693;

  /* ── Borders ── */
  --border:       #E6E2DA;
  --border-light: #EEEAE4;

  /* ── Danger ── */
  --danger:       #74291a;
  --danger-light: #F3E6E2;
  --danger-line:  #c08878;

  /* ── Success ── */
  --success:       #3a4b22;
  --success-light: #EEF1E4;
  --success-line:  #aec074;

  /* ── Info ── */
  --info:       #2a5f82;
  --info-light: #EDF2F6;
  --info-line:  #b6cedd;

  /* ── Warning ── */
  --warning:       #72440c;
  --warning-light: #F3EAD9;
  --warning-line:  #c4a45a;

  /* ── Shadows ── */
  --shadow-sm:    0 1px 0 rgba(28,36,18,0.04);
  --shadow:       0 1px 3px rgba(28,36,18,0.06);
  --shadow-lg:    0 10px 24px -10px rgba(28,36,18,0.18), 0 3px 6px -3px rgba(28,36,18,0.08);
  --shadow-card:  0 1px 2px rgba(28,36,18,0.04);
  --shadow-modal: 0 0 0 1px rgba(28,36,18,0.07), 0 24px 48px -16px rgba(28,36,18,0.22);

  /* ── Radii ── */
  --radius:    8px;
  --radius-sm: 6px;
  --radius-lg: 10px;

  /* ── Surface layers ── */
  --surface-0:   #F6F4EF;
  --surface-1:   #F2F0EA;
  --surface-2:   #FCFBF8;
  --surface-3:   #FCFBF8;
  --surface-4:   #FCFBF8;
  --surface-hov: #EEECE6;
  --surface-act: #E6E2DC;
  --brand-soft:  #EBF0DC;

  /* ── Hairlines ── */
  --hairline:        rgba(28,36,18,0.05);
  --hairline-strong: rgba(28,36,18,0.09);
  --border-card:     rgba(28,36,18,0.06);

  /* ── Spacing ── */
  --space-1: 4px; --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 24px; --space-6: 32px;

  /* ── Transitions ── */
  --t-instant: 80ms ease-out;
  --t-snap:   120ms ease-out;
  --t-smooth: 160ms ease-out;

  /* ── Focus ring ── */
  --focus-ring: 0 0 0 2px rgba(61,78,36,0.20);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*, *::before, *::after { font-family: 'Inter Tight', system-ui, -apple-system, sans-serif; }
.mono, code { font-family: 'JetBrains Mono', monospace !important; }

body {
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  background: var(--surface-0);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; }
a { text-decoration: none; color: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(45,52,40,0.14); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(45,52,40,0.24); background-clip: padding-box; border: 2px solid transparent; }

/* ════════════════════════════════════════
   HEADER — flat enterprise (matches CRM v4)
   ════════════════════════════════════════ */
.header {
  background: var(--primary-dark);
  border-bottom: 1px solid rgba(0,0,0,0.18);
  color: var(--sidebar-text);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  min-height: 52px;
}
.header-brand { display: flex; flex-direction: column; line-height: 1.2; padding: 8px 0; }
.header-brand .brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.3px; color: #e8e9d8; }
.header-brand .brand-sub  { font-size: 10px; font-weight: 500; color: rgba(232,233,216,0.5); letter-spacing: 0.3px; margin-top: 1px; }
.header-divider { width: 1px; height: 24px; background: rgba(255,255,255,0.12); margin: 0 4px; }
.header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* ════════════════════════════════════════
   TABS — flat underline enterprise
   ════════════════════════════════════════ */
.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 52px;
  z-index: 99;
  gap: 2px;
}
.tab {
  padding: 12px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--t-instant), border-color var(--t-instant);
  user-select: none;
  white-space: nowrap;
}
.tab:hover { color: var(--text-muted); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════ */
.container { max-width: 900px; margin: 0 auto; padding: 20px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ════════════════════════════════════════
   CARDS — matches CRM v4
   ════════════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: -0.1px;
}
.card-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid transparent;
}

/* ════════════════════════════════════════
   SECTION LABELS
   ════════════════════════════════════════ */
.section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.section-label:first-child { margin-top: 0; }

/* ════════════════════════════════════════
   FORM ELEMENTS
   ════════════════════════════════════════ */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 14px; margin-bottom: 14px; }
.form-field  { display: flex; flex-direction: column; gap: 4px; }
.form-field label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.inp {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-3);
  transition: border-color var(--t-snap), box-shadow var(--t-snap);
  outline: none;
  width: 100%;
  line-height: 1.4;
}
.inp:focus {
  border-color: var(--primary-light);
  box-shadow: var(--focus-ring);
  background: var(--card);
}
.inp::placeholder { color: var(--text-xlight); }
textarea.inp { resize: vertical; }
select.inp { cursor: pointer; }

/* ════════════════════════════════════════
   BUTTONS — matches CRM v4
   ════════════════════════════════════════ */
.btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter Tight', system-ui, sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  line-height: 1.4;
  transition: background var(--t-instant), color var(--t-instant), border-color var(--t-instant);
}
.btn-primary   { background: var(--primary); color: white; border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--card); color: var(--text-muted); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hov); }
.btn-accent    { background: var(--accent); color: white; }
.btn-accent:hover { background: #5a3508; }
.btn-danger    { background: var(--danger-light); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: #f0dbd7; }
.btn-sm { padding: 4px 10px; font-size: 11.5px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Nav-style buttons in header */
.btn-nav {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(232,233,216,0.85);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter Tight', system-ui, sans-serif;
  transition: background var(--t-instant);
}
.btn-nav:hover { background: rgba(255,255,255,0.15); color: #e8e9d8; }

/* ════════════════════════════════════════
   ACTION BAR
   ════════════════════════════════════════ */
.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  margin-top: 10px;
  align-items: center;
}

/* ════════════════════════════════════════
   STATUS / SYNC DOT
   ════════════════════════════════════════ */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; flex-shrink: 0; }
.status-dot.online  { background: #4a9e5c; box-shadow: 0 0 5px rgba(74,158,92,0.45); }
.status-dot.cached  { background: #c4891e; }
.status-dot.offline { background: #b84040; }

/* ════════════════════════════════════════
   BADGES
   ════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-active    { background: var(--success-light); color: var(--success); border-color: var(--success-line); }
.badge-converted { background: var(--info-light);    color: var(--info);    border-color: var(--info-line); }
.badge-closed    { background: var(--danger-light);  color: var(--danger);  border-color: var(--danger-line); }
.badge-returning { background: var(--success-light); color: var(--success); border-color: var(--success-line); }
.badge-in-crm    { background: var(--warning-light); color: var(--warning); border-color: var(--warning-line); }

/* ── Duplicate Detection ── */
.badge-duplicate {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-line);
  animation: dupPulse 2s ease-in-out infinite;
}
.badge-returning-cust { background: var(--success-light); color: var(--success); border: 1px solid var(--success-line); }
@keyframes dupPulse { 0%,100% { opacity:1; } 50% { opacity:0.65; } }

/* ════════════════════════════════════════
   DUPLICATE WARNING CARD
   ════════════════════════════════════════ */
#dupWarningCard {
  display: none;
  background: #FBF5EE;
  border: 1.5px solid var(--warning-line);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  animation: slideDown 0.2s ease;
}
#dupWarningCard.show { display: block; }
@keyframes slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.dup-header { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.dup-icon   { font-size: 18px; flex-shrink: 0; }
.dup-title  { font-size: 13px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.dup-subtitle { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.dup-level-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.dup-level-high   { background: var(--danger-light);  color: var(--danger);  border: 1px solid var(--danger-line); }
.dup-level-medium { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-line); }
.dup-level-low    { background: var(--info-light);    color: var(--info);    border: 1px solid var(--info-line); }

.dup-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  font-size: 12px;
}
.dup-info-row  { display: flex; gap: 6px; align-items: baseline; }
.dup-info-label { color: var(--text-light); font-weight: 600; min-width: 56px; flex-shrink: 0; font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; }
.dup-info-value { color: var(--text); font-weight: 500; word-break: break-word; }

.dup-products {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.dup-products strong { color: var(--accent); margin-right: 4px; }

.dup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-dup-open { background: var(--accent); color: white; border-color: var(--accent); }
.btn-dup-open:hover { background: var(--primary-dark); }
.btn-dup-continue { background: var(--card); color: var(--text-muted); border: 1px solid var(--border); font-size: 11.5px; }
.btn-dup-continue:hover { background: var(--surface-hov); }

/* ════════════════════════════════════════
   CUSTOMER HISTORY PANEL
   ════════════════════════════════════════ */
.customer-history {
  margin-top: 12px;
  padding: 12px;
  background: var(--info-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--info-line);
  display: none;
}
.customer-history.show { display: block; }
.history-title { font-size: 11.5px; font-weight: 700; color: var(--info); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.history-item {
  font-size: 12.5px;
  color: var(--text);
  padding: 5px 0;
  border-bottom: 1px dashed var(--info-line);
  display: flex;
  justify-content: space-between;
}
.history-item:last-child { border-bottom: none; }
.history-date { color: var(--text-light); font-family: 'JetBrains Mono', monospace; font-size: 11px; }

/* ════════════════════════════════════════
   PRODUCT CARDS
   ════════════════════════════════════════ */
.pc-list { display: flex; flex-direction: column; gap: 10px; }
.pc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  background: linear-gradient(135deg, #FAFAF8, #F6F5F2);
  position: relative;
  transition: border-color var(--t-snap);
}
.pc-card.pc-filled { border-color: var(--success-line); }
.pc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 6px;
}
.pc-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--brand-soft);
  padding: 2px 8px;
  border-radius: 12px;
  flex-shrink: 0;
}
.pc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  text-align: center;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-snap), color var(--t-snap);
}
.pc-remove:hover { background: var(--danger); color: white; }

.pc-search-wrap { position: relative; margin-bottom: 10px; }
.pc-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  margin-top: 2px;
  display: none;
}
.pc-dropdown .pc-opt {
  padding: 8px 13px;
  cursor: pointer;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--t-instant);
}
.pc-dropdown .pc-opt:last-child { border-bottom: none; }
.pc-dropdown .pc-opt:hover { background: var(--brand-soft); color: var(--primary); }

.pc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; }
.pc-fields .pc-f { display: flex; flex-direction: column; gap: 3px; }
.pc-fields .pc-f label { font-size: 10px; font-weight: 600; color: var(--text-light); letter-spacing: 0.4px; text-transform: uppercase; }
.pc-fields .pc-f .inp { font-size: 12.5px; padding: 6px 9px; }

.pc-add-btn {
  width: 100%;
  padding: 10px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-light);
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--t-snap), color var(--t-snap), background var(--t-snap);
  margin-top: 8px;
}
.pc-add-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--brand-soft); }
@media (max-width: 480px) { .pc-fields { grid-template-columns: 1fr; } }

/* ════════════════════════════════════════
   SEARCH DROPDOWNS (state, customer)
   ════════════════════════════════════════ */
.search-wrapper { position: relative; }
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--primary-light);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  display: none;
}
.search-dropdown.show { display: block; }
.search-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--t-instant);
}
.search-item:hover { background: var(--brand-soft); }
.search-item .si-hindi    { font-weight: 600; font-size: 13px; color: var(--text); }
.search-item .si-botanical { font-size: 11.5px; color: var(--text-light); font-style: italic; }

/* ════════════════════════════════════════
   TABLE (History)
   ════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left;
  padding: 9px 12px;
  background: var(--surface-1);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: top; color: var(--text); }
tr:hover td { background: var(--surface-hov); }
tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; padding: 36px 20px; color: var(--text-xlight); font-size: 13px; }

/* ════════════════════════════════════════
   FILTERS
   ════════════════════════════════════════ */
.filters {
  display: flex;
  gap: 7px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.filters .inp { min-width: 110px; }

/* ════════════════════════════════════════
   MODALS — matches CRM v4
   ════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,18,14,0.42);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface-4);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 500px;
  margin: auto;
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.15s ease;
  position: relative;
}
.modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0.65;
}
@keyframes modalIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title { font-size: 14.5px; font-weight: 600; margin-bottom: 16px; color: var(--text); letter-spacing: -0.2px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ════════════════════════════════════════
   PREVIEW BOX (print/copy slip)
   ════════════════════════════════════════ */
.preview-box {
  background: #1c1a14;
  color: #e8e5de;
  padding: 18px;
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: 14px;
}

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--primary-dark);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; cursor: pointer; }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ════════════════════════════════════════
   SETUP / OFFLINE BANNERS
   ════════════════════════════════════════ */
.setup-banner {
  background: var(--warning-light);
  border: 1px solid var(--warning-line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
#offlineBanner {
  display: none;
  align-items: center;
  gap: 9px;
  background: var(--warning-light);
  border: 1px solid var(--warning-line);
  border-radius: var(--radius);
  padding: 9px 14px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--warning);
}
#offlineBanner.show { display: flex; }
#offlineBanner .ob-icon { font-size: 16px; flex-shrink: 0; }
#offlineBanner strong { font-weight: 700; }
#offlineBanner .ob-detail { font-size: 11px; opacity: 0.8; margin-top: 1px; }
#offlineBanner .ob-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  color: var(--warning);
  opacity: 0.6;
  padding: 0 3px;
}
#offlineBanner .ob-close:hover { opacity: 1; }

/* ════════════════════════════════════════
   GLOBAL LOADER
   ════════════════════════════════════════ */
#globalLoader {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(42,48,34,0.92);
  color: white;
  font-size: 10.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  pointer-events: none;
  letter-spacing: 0.2px;
}
#globalLoader.active { display: flex; }
#globalLoader .loader-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-line);
  animation: loaderPulse 0.9s ease-in-out infinite;
}
@keyframes loaderPulse { 0%,100% { opacity:0.3; transform:scale(0.8); } 50% { opacity:1; transform:scale(1.2); } }

/* Spinner */
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   LANDLINE
   ════════════════════════════════════════ */
.landline-row { display: flex; gap: 0; }
.area-code { width: 68px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; flex-shrink: 0; }
.landline-row .inp:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ════════════════════════════════════════
   DUPLICATE FIND MODAL
   ════════════════════════════════════════ */
#findDupModal .modal {
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.fdup-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.fdup-title  { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.fdup-subtitle { font-size: 11.5px; color: var(--text-light); }
.fdup-body   { flex: 1; overflow-y: auto; padding: 14px 22px; }
.fdup-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.fdup-summary { font-size: 11.5px; color: var(--text-light); }
.fdup-summary strong { color: var(--danger); }

.fdup-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.fdup-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  background: var(--warning-light);
  border-bottom: 1px solid var(--warning-line);
  font-size: 11.5px;
}
.fdup-group-reason { font-weight: 600; color: var(--warning); flex: 1; }
.fdup-group-count  { font-size: 10px; font-weight: 700; background: var(--danger-light); color: var(--danger); padding: 2px 7px; border-radius: var(--radius-sm); }
.fdup-level        { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-sm); text-transform: uppercase; }
.fdup-level-HIGH   { background: var(--danger-light);  color: var(--danger); }
.fdup-level-MEDIUM { background: var(--warning-light); color: var(--warning); }
.fdup-level-LOW    { background: var(--info-light);    color: var(--info); }

.fdup-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 7px 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border-light);
  font-size: 11.5px;
  align-items: center;
}
.fdup-row:last-child { border-bottom: none; }
.fdup-row:hover { background: var(--surface-hov); }
.fdup-row-name     { font-weight: 600; color: var(--text); }
.fdup-row-meta     { color: var(--text-light); font-size: 11px; margin-top: 2px; }
.fdup-row-products { color: var(--text-light); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fdup-row-date     { color: var(--text-xlight); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }
.fdup-row-actions  { display: flex; gap: 5px; flex-shrink: 0; }

.fdup-empty { text-align: center; padding: 36px 20px; color: var(--text-light); }
.fdup-empty .fdup-empty-icon { font-size: 32px; margin-bottom: 9px; opacity: 0.7; }
.fdup-scanning { text-align: center; padding: 28px 20px; color: var(--text-light); font-size: 13px; }

@media (max-width: 640px) {
  .fdup-row { grid-template-columns: 1fr auto; }
  .fdup-row-products, .fdup-row-date { display: none; }
}

/* ════════════════════════════════════════
   DUPLICATE CONFIRM MODAL
   ════════════════════════════════════════ */
#dupConfirmModal .modal { max-width: 420px; }
.dup-modal-icon { font-size: 32px; text-align: center; margin-bottom: 10px; }
.dup-modal-body {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 18px;
}
.dup-modal-body strong { color: var(--text); font-size: 13.5px; display: block; margin-bottom: 5px; }

/* ════════════════════════════════════════
   TEXT UTILITIES
   ════════════════════════════════════════ */
.txt-primary   { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.txt-secondary { font-size: 12px; font-weight: 400; color: var(--text-muted); line-height: 1.4; }
.txt-tertiary  { font-size: 11px; font-weight: 400; color: var(--text-light); line-height: 1.4; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; text-align: right; }
button[title]:hover, a[title]:hover { filter: brightness(0.95); }
[data-empty="true"]::before { content: "—"; color: var(--text-light); }

/* ════════════════════════════════════════
   PRINT
   ════════════════════════════════════════ */
@media print {
  .header, .tabs, .action-bar, .btn, .no-print, .filters { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  body { background: white; }
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 640px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .container { padding: 14px; }
  .card { padding: 14px; }
  .tabs { padding: 0 12px; overflow-x: auto; }
  .tab { padding: 11px 12px; font-size: 12px; }
  .action-bar { flex-direction: column; }
  .action-bar .btn { width: 100%; justify-content: center; }
  body { overflow-x: hidden; }
  table { word-break: break-word; }
}

  /* ── Inline icon wrapper — matches CRM sidebar .ic pattern ── */
  .ic-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: middle;
    opacity: 0.75;
    position: relative;
    top: -1px;
  }
  .ic-inline svg { width: 14px; height: 14px; display: block; }
  .card-title .ic-inline { opacity: 0.55; }
  .section-label .ic-inline { opacity: 0.65; }
  .btn .ic-inline { opacity: 0.85; margin-right: 1px; }
  .btn:hover .ic-inline { opacity: 1; }
  .tab .ic-inline { opacity: 0.65; }
  .tab.active .ic-inline { opacity: 0.9; }
  .history-title .ic-inline { opacity: 0.7; }
  .fdup-title .ic-inline { opacity: 0.6; }
  .modal-title .ic-inline { opacity: 0.55; }
  .btn-nav .ic-inline { opacity: 0.8; }
  /* Note pip — hover tooltip for enquiry list rows */
  .note-pip {
    display: inline-block; flex-shrink: 0;
    width: 7px; height: 7px; border-radius: 50%;
    background: #ccab6e;
    cursor: default; position: relative;
    vertical-align: middle; margin-left: 5px;
  }
  #note-pip-tooltip {
    display: none;
    position: fixed;
    background: #2A3022;
    color: #e8e9d8;
    font-size: 11.5px; font-weight: 400; line-height: 1.55;
    padding: 8px 11px;
    border-radius: 6px;
    white-space: pre-wrap; word-break: break-word;
    max-width: 280px; min-width: 140px;
    z-index: 9999;
    box-shadow: 0 10px 24px -10px rgba(28,36,18,0.18);
    pointer-events: none;
  }
