/* ═══════════════════════════════════════════════════════════
   TBM — Trianze Business Manager
   Premium Corporate Design System
   ═══════════════════════════════════════════════════════════ */

:root {
  --primary:    #1B4D8C;
  --primary-dk: #143a6b;
  --secondary:  #5B89C8;
  --accent:     #F4F8FC;
  --bg:         #FFFFFF;
  --border:     #EAEAEA;
  --border-dk:  #D4D9E0;
  --text:       #1A1A1A;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --success:    #059669;
  --warning:    #D97706;
  --danger:     #DC2626;
  --sidebar-w:  240px;
  --topbar-h:   60px;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.10);
  --font:       'Inter', 'Segoe UI', system-ui, sans-serif;
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────── */
.tbm-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  /* Mobile browsers report 100vh as the height with the address bar
     hidden, so when the bar is showing (the normal state), a 100vh
     sidebar is actually taller than what's visible — pushing the
     logout button in the footer off-screen with no way to reach it.
     100dvh tracks the *real* visible height and updates live as the
     browser chrome shows/hides. Older browsers that don't understand
     dvh simply ignore the line and keep the 100vh above. */
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1000;
  transition: transform var(--transition);
}

.tbm-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* Manual collapse (laptop/tablet) — separate from the mobile off-canvas
   drawer above. Sidebar shrinks to nothing and content takes the full
   width, for a bigger working area on wide tables like Quotations. */
body.sidebar-collapsed .tbm-sidebar {
  width: 0;
  overflow: hidden;
  border-right: none;
}
body.sidebar-collapsed .tbm-main {
  margin-left: 0;
}
.btn-sidebar-collapse {
  background: #F3F4F6;
  border: 1px solid var(--border);
  font-size: 17px; color: var(--text-muted);
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: 6px;
}
.btn-sidebar-collapse:hover { background: var(--accent); color: var(--primary); border-color: var(--secondary); }

.tbm-topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.tbm-content {
  flex: 1;
  padding: 28px 28px 40px;
  background: #F7F9FC;
}

/* ── Sidebar brand ─────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white;
}

.brand-name {
  font-size: 16px; font-weight: 700;
  color: white; letter-spacing: .5px;
}

.brand-sub {
  font-size: 10px; color: rgba(255,255,255,.55);
  font-weight: 400; letter-spacing: .3px;
  margin-top: 1px;
}

.brand-version {
  font-size: 9px; color: rgba(255,255,255,.35);
  font-weight: 400; letter-spacing: .3px;
  margin-top: 3px;
}

/* ── Sidebar nav ───────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  margin-bottom: 2px;
  transition: all var(--transition);
}

.nav-item i { font-size: 16px; width: 20px; flex-shrink: 0; }

.nav-item:hover {
  background: rgba(255,255,255,.12);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,.18);
  color: white;
  font-weight: 600;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 8px 0;
}

/* ── Sidebar footer ────────────────────────────────────────── */
.sidebar-footer {
  padding: 14px 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: white;
  text-transform: uppercase;
  flex-shrink: 0;
}

.user-name { font-size: 12.5px; font-weight: 500; color: white; }
.user-role {
  font-size: 10px; font-weight: 500;
  padding: 1px 6px; border-radius: 10px;
  display: inline-block; margin-top: 2px;
}
.badge-role-admin    { background: rgba(255,255,255,.2); color: rgba(255,255,255,.9); }
.badge-role-sales    { background: rgba(91,137,200,.4);  color: rgba(255,255,255,.9); }
.badge-role-procurement { background: rgba(5,150,105,.3); color: rgba(255,255,255,.9); }

.btn-logout {
  color: rgba(255,255,255,.5); font-size: 16px;
  text-decoration: none; padding: 4px;
  transition: color var(--transition);
}
.btn-logout:hover { color: white; }

/* ── Topbar ───────────────────────────────────────────────── */
.btn-sidebar-toggle {
  background: none; border: none;
  font-size: 20px; color: var(--text-muted);
  padding: 4px 6px; cursor: pointer;
  display: none;
}

.topbar-search { flex: 1; max-width: 420px; }

.search-form {
  position: relative; display: flex; align-items: center;
}

.search-icon {
  position: absolute; left: 12px;
  color: var(--text-muted); font-size: 14px; pointer-events: none;
}

.search-input {
  width: 100%; padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px;
  background: var(--accent);
  transition: all var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--secondary);
  background: white;
  box-shadow: 0 0 0 3px rgba(91,137,200,.15);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.topbar-bell-wrap { position: relative; display: inline-block; flex-shrink: 0; }
.topbar-bell-wrap a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  color: var(--text-muted); text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.topbar-bell-wrap a:hover { background: var(--accent); color: var(--primary); }
.topbar-bell-wrap i { font-size: 18px; }
.topbar-bell-wrap #notifBadge {
  display: none; position: absolute; top: 2px; right: 2px;
  background: #ef4444; color: white; font-size: 10px; font-weight: 700;
  border-radius: 10px; min-width: 16px; height: 16px; line-height: 16px;
  text-align: center; padding: 0 3px;
}

.topbar-quick-actions { display: flex; gap: 8px; }
.topbar-quick-actions .btn { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

/* ── Flash messages ────────────────────────────────────────── */
.flash-container {
  padding: 0 28px;
  margin-top: 12px;
}

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 22px; font-weight: 700;
  color: var(--text); margin: 0;
}

.page-subtitle {
  font-size: 13px; color: var(--text-muted);
  margin-top: 3px;
}

.breadcrumb {
  font-size: 12.5px; margin: 0;
  --bs-breadcrumb-divider: '›';
}

/* ── Cards ─────────────────────────────────────────────────── */
.tbm-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tbm-card .card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: white;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Cards with p-0 bodies mostly wrap wide tables (.tbm-table th has
   white-space:nowrap). .tbm-card itself keeps overflow:hidden so its
   rounded corners still clip correctly, but that same overflow:hidden
   was silently CLIPPING any table wider than the card instead of letting
   it scroll — the "cut off on the right, can't scroll" bug. Giving the
   body its own scroll container fixes it everywhere at once. */
.tbm-card .card-body.p-0 {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tbm-card .card-body { padding: 20px; }

/* ── Stat widgets ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(27,77,140,.1);  color: var(--primary); }
.stat-icon.green  { background: rgba(5,150,105,.1);  color: var(--success); }
.stat-icon.orange { background: rgba(217,119,6,.1);  color: var(--warning); }
.stat-icon.purple { background: rgba(124,58,237,.1); color: #7c3aed; }
.stat-icon.teal   { background: rgba(6,182,212,.1);  color: #0891b2; }

.stat-value {
  font-size: 28px; font-weight: 700;
  color: var(--text); line-height: 1;
}

.stat-label {
  font-size: 12px; color: var(--text-muted);
  margin-top: 4px; font-weight: 500;
}

/* ── Tables ─────────────────────────────────────────────────── */
.tbm-table { width: 100%; border-collapse: collapse; }

.tbm-table th {
  padding: 11px 14px;
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--accent);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tbm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

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

.tbm-table tr:hover td { background: var(--accent); }

.tbm-table .actions { white-space: nowrap; text-align: right; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary); border-color: var(--primary);
  font-weight: 500;
}
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); }

.btn-outline-primary {
  color: var(--primary); border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}
.btn-icon:hover { background: var(--accent); color: var(--primary); border-color: var(--secondary); }
.btn-icon.danger:hover { background: #FEF2F2; color: var(--danger); border-color: var(--danger); }

/* ── Badges / status ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px;
}

.status-draft    { background: #F3F4F6; color: #6B7280; }
.status-issued   { background: #ECFDF5; color: #059669; }
.status-revised  { background: #EFF6FF; color: #2563EB; }
.status-archived { background: #F9FAFB; color: #9CA3AF; }
.status-cancelled{ background: #FEF2F2; color: #DC2626; }
.status-active   { background: #ECFDF5; color: #059669; }
.status-inactive { background: #F3F4F6; color: #6B7280; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.form-control, .form-select {
  font-size: 13.5px;
  border-color: var(--border-dk);
  border-radius: 7px;
  padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(91,137,200,.15);
}

.form-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.form-section-title {
  font-size: 13px; font-weight: 600;
  color: var(--primary);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Line items table (quotation/LPO editor) ─────────────────── */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.line-items-table th {
  padding: 8px 8px;
  background: var(--primary);
  color: white; font-weight: 600;
  font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .4px; white-space: nowrap;
}

.line-items-table td {
  padding: 4px 4px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.line-items-table tr:nth-child(even) td { background: var(--accent); }

.line-items-table .form-control {
  border: 1px solid transparent;
  background: transparent;
  padding: 5px 6px;
  font-size: 13px;
  border-radius: 4px;
}

.line-items-table .form-control:focus {
  background: white;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(91,137,200,.2);
}

/* Column width classes for line items */
.col-no    { width: 3.5%; }
.col-sku   { width: 9%; }
.col-desc  { width: 47%; }
.col-qty   { width: 6%; }
.col-unit  { width: 6%; }
.col-price { width: 9%; }
.col-disc  { width: 6%; }
.col-vat   { width: 6%; }
.col-total { width: 10%; }
.col-act   { width: 3.5%; }

/* LPO col widths (no SKU/Disc) */
.col-lpo-no   { width: 4%; }
.col-lpo-desc { width: 53%; }
.col-lpo-qty  { width: 7%; }
.col-lpo-unit { width: 7%; }
.col-lpo-price{ width: 11%; }
.col-lpo-vat  { width: 7%; }
.col-lpo-total{ width: 10%; }
.col-lpo-act  { width: 4%; }

/* ── Totals summary ─────────────────────────────────────────── */
.totals-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 300px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.totals-row:last-child {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 15px;
  border-bottom: none;
}

/* ── Quick actions ─────────────────────────────────────────── */
.quick-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
}

.quick-action-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.quick-action-btn i { font-size: 16px; color: var(--primary); }

/* ── Entity info view ───────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.info-field { }
.info-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px;
  margin-bottom: 3px;
}
.info-value { font-size: 14px; color: var(--text); }

/* ── Product picker modal ───────────────────────────────────── */
.product-picker-item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 6px;
}

.product-picker-item:hover {
  border-color: var(--primary);
  background: var(--accent);
}

.product-sku  { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.product-name { font-size: 13px; font-weight: 500; }
.product-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.product-price{ font-size: 13px; font-weight: 600; color: var(--primary); float: right; }

/* ── Auth page ──────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #2563EB 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center; margin-bottom: 28px;
}

.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: white;
  margin: 0 auto 14px;
}

.auth-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); margin: 0; }
.auth-logo p  { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }

/* ── Settings logo preview ──────────────────────────────────── */
.logo-preview-box {
  width: 200px; height: 80px;
  border: 2px dashed var(--border-dk);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--accent);
}
.logo-preview-box img { max-height: 72px; max-width: 188px; object-fit: contain; }
.logo-preview-box .no-logo { font-size: 12px; color: var(--text-light); }

/* ── Utilities ──────────────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.bg-accent    { background: var(--accent) !important; }
.fw-600       { font-weight: 600; }
.mono         { font-family: 'SF Mono', Consolas, monospace; }
.doc-number   { font-family: monospace; font-weight: 600; color: var(--primary); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tbm-sidebar { transform: translateX(-100%); }
  .tbm-sidebar.open { transform: translateX(0); }
  .tbm-main { margin-left: 0; }
  .btn-sidebar-toggle {
    display: flex;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-size: 20px;
  }
  .btn-sidebar-collapse { display: none; }
  .tbm-content { padding: 16px; }
  .tbm-topbar {
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    padding: 10px 14px;
    row-gap: 10px;
    align-items: center;
    position: sticky;
  }
  .topbar-search { order: 2; flex: 1 1 auto; max-width: none; padding-right: 44px; }
  .topbar-actions {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 8px;
  }
  .topbar-bell-wrap {
    position: absolute;
    top: 12px; right: 14px;
    align-self: auto;
    z-index: 5;
  }
  .topbar-quick-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .topbar-quick-actions .btn {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 7px 4px;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 10px;
  }
  .topbar-quick-actions .btn i { font-size: 15px; }
  .topbar-quick-actions .btn span { white-space: normal; }

  /* Slightly tighter nav rows so the whole menu + footer fits more
     often without needing to scroll, and a bigger, clearer logout tap
     target now that it's reliably visible. */
  .sidebar-nav { padding: 8px 8px; }
  .nav-item { padding: 8px 12px; font-size: 13px; }
  .btn-logout { font-size: 20px; padding: 8px 10px; }

  /* Dashboard Quick Actions: was flex-wrap with content-sized chips, so
     rows never lined up into a clean grid. Equal-width 2-column grid
     looks tidy and consistent instead. */
  .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .quick-action-btn {
    justify-content: center;
    text-align: center;
    padding: 12px 8px;
  }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dk); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── Search dropdowns ────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border-dk);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 4px 0;
}
.dropdown-menu .dropdown-item {
  padding: 8px 14px;
  font-size: 13.5px;
  color: var(--text);
  border-radius: 0;
  transition: background var(--transition);
}
.dropdown-menu .dropdown-item:hover {
  background: var(--accent);
  color: var(--primary);
}
/* ── APPEND THIS BLOCK TO THE END OF static/css/main.css ── */

/* Lead status badges */
.status-lead-new       { background: #EFF6FF; color: #2563EB; }
.status-lead-contacted { background: #FFF7ED; color: #C2410C; }
.status-lead-qualified { background: #F0FDF4; color: #15803D; }
.status-lead-quotation_sent { background: #EEF2FF; color: #4338CA; }
.status-lead-converted { background: #ECFDF5; color: #059669; }
.status-lead-lost      { background: #FEF2F2; color: #DC2626; }

/* Lead source badges */
.source-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  background: #F3F4F6; color: #374151;
}
.source-call            { background: #EFF6FF; color: #1D4ED8; }
.source-whatsapp        { background: #F0FDF4; color: #16A34A; }
.source-email           { background: #FFF7ED; color: #C2410C; }
.source-facebook        { background: #EFF6FF; color: #1D4ED8; }
.source-instagram       { background: #FDF4FF; color: #9333EA; }
.source-trianze_web     { background: #F0F9FF; color: #0369A1; }
.source-corporateav_web { background: #FFF1F2; color: #BE123C; }
.source-vsysav_web      { background: #FFFBEB; color: #B45309; }

/* Info field helpers (used in view templates) */
.info-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.info-value { font-size: 13.5px; color: var(--text); }

/* ── New lead source badges ── */
.source-corporateav_whatsapp { background:#F0FDF4; color:#16A34A; }
.source-corporateav_email    { background:#FFF7ED; color:#C2410C; }
.source-corporateav_call     { background:#EFF6FF; color:#1D4ED8; }
.source-trianze_whatsapp     { background:#F0FDF4; color:#16A34A; }
.source-trianze_email        { background:#FFF7ED; color:#C2410C; }
.source-trianze_call         { background:#EFF6FF; color:#1D4ED8; }
.source-vsysav_whatsapp      { background:#F0FDF4; color:#16A34A; }
.source-vsysav_email         { background:#FFF7ED; color:#C2410C; }
.source-vsysav_call          { background:#EFF6FF; color:#1D4ED8; }
.source-referral             { background:#FDF4FF; color:#9333EA; }
.source-walk_in              { background:#FFFBEB; color:#B45309; }

/* ── Mobile Quotation Form ── */
@media (max-width: 768px) {
  .line-items-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 8px;
  }
  .line-items-table {
    min-width: 680px;
    font-size: 12px;
  }
  .line-items-table input.form-control {
    font-size: 12px;
    padding: 5px 6px;
    min-width: unset;
  }
  .totals-box {
    width: 100%;
    margin-top: 12px;
  }
  /* Sticky scroll hint */
  .line-items-wrap::after {
    content: '← scroll →';
    display: block;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    padding: 4px;
  }
}

/* ── Mobile document cards (Quotations / PI / LPO lists) ──────────
   Same underlying data as the table, reflowed so nothing needs
   horizontal scrolling on a phone. Hidden above the md breakpoint,
   where the full table takes over instead. */
.quote-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}
.quote-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.quote-card:active { background: #FAFBFC; }
.qc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}
.qc-number {
  font-family: monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary-dark, var(--primary));
  display: flex;
  align-items: center;
  gap: 6px;
}
.qc-rev {
  font-size: 10px;
  font-weight: 700;
  background: #DBEAFE;
  color: #1D4ED8;
  padding: 1px 6px;
  border-radius: 4px;
}
.qc-customer {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.qc-project {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qc-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.qc-meta-left { display: flex; flex-direction: column; gap: 3px; }
.qc-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.qc-meta-row i { font-size: 12px; width: 13px; }
.qc-value { text-align: right; }
.qc-currency { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.qc-amount { font-size: 17px; font-weight: 800; color: var(--primary); }
.qc-followup {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  margin-top: 10px;
}
.qc-followup i { font-size: 11px; }
.qc-followup-overdue { background: #FEF2F2; color: #DC2626; }
.qc-followup-today { background: #FFFBEB; color: #B45309; }


/* ── Customer Search Field ─────────────────────────────────── */
.customer-search-wrap {
  position: relative;
}
.customer-search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 14px;
  pointer-events: none;
}
.customer-search-wrap input {
  padding-left: 36px !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 8px !important;
  background: #f9fafb !important;
  transition: all .15s;
  cursor: pointer;
}
.customer-search-wrap input:focus {
  border-color: var(--primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(27,77,140,.1) !important;
  cursor: text;
}
.customer-search-wrap input::placeholder {
  color: #9ca3af;
  font-style: italic;
}
.customer-dropdown {
  display: none;
  position: absolute;
  z-index: 9999;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  top: calc(100% + 4px);
  left: 0;
}
.customer-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background .1s;
}
.customer-dropdown-item:last-child { border-bottom: none; }
.customer-dropdown-item:hover { background: #EFF6FF; }
.customer-dropdown-item .cname { font-weight: 600; font-size: 13.5px; color: #111; }
.customer-dropdown-item .cdetail { font-size: 11.5px; color: #6b7280; margin-top: 1px; }
.customer-dropdown-empty { padding: 12px 14px; color: #9ca3af; font-size: 13px; text-align: center; }
