/* ─────────────────────────────────────────────────────────────
   M7 APP — Bootstrap Theme Layer
   Base UI: Bootstrap 5
   Brand: #F47920 (orange) · #1B2D4F (navy)
───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary:       #F47920;
  --primary-dark:  #d4640f;
  --primary-light: #fff5ef;
  --primary-muted: rgba(244,121,32,0.12);

  --navy:          #1B2D4F;
  --navy-dark:     #14233d;
  --navy-light:    #243b63;

  --sidebar-bg:    #111827;
  --sidebar-w:     214px;

  --bg:            #f5f6f8;
  --surface:       #ffffff;
  --surface-2:     #f9fafb;
  --border:        #e8eaed;
  --border-light:  #f0f2f4;

  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --text-sidebar:   rgba(255,255,255,1);
  --text-sidebar-active: #ffffff;

  --green:        #16a34a;
  --green-bg:     #f0fdf4;
  --amber:        #d97706;
  --amber-bg:     #fffbeb;
  --blue:         #2563eb;
  --blue-bg:      #eff6ff;
  --purple:       #7c3aed;
  --purple-bg:    #f5f3ff;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --topbar-h:     58px;

  /* Design Panel tokens — overridable via head-assets.php injection */
  --font-body:              'DM Sans';
  --font-title:             'Barlow Condensed';
  --font-weight-body:       400;
  --line-height-base:       1.5;
  --heading-weight:         600;
  --text-transform-heading: none;
  --text-transform-btn:     none;
  --text-transform-nav:     none;
  --text-transform-badge:   uppercase;
  --nav-hover-bg:           rgba(27,45,79,0.18);
  --btn-padding-x:          12px;
  --btn-padding-y:          6px;
  --card-padding:           20px;
  --content-padding:        24px;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:       0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.12);

  /* Bootstrap theme tokens */
  --bs-primary: #1B2D4F;
  --bs-primary-rgb: 27,45,79;
  --bs-secondary: #6b7280;
  --bs-secondary-rgb: 107,114,128;
  --bs-warning: #F47920;
  --bs-warning-rgb: 244,121,32;
  --bs-danger: #dc3545;
  --bs-danger-rgb: 220,53,69;
  --bs-success: #16a34a;
  --bs-success-rgb: 22,163,74;
  --bs-light: #f9fafb;
  --bs-light-rgb: 249,250,251;
  --bs-dark: #111827;
  --bs-dark-rgb: 17,24,39;
  --bs-body-bg: #f5f6f8;
  --bs-body-color: #111827;
  --bs-border-color: #e8eaed;
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 14px;
  --bs-font-sans-serif: 'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: var(--font-body), 'DM Sans', sans-serif;
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-base);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
.btn,
button,
.crm-stage__settings,
.crm-stage__add,
.lead-action-btn,
.selected-tag-chip button,
.crm-modal-close { cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* Bootstrap component overrides */
.btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: var(--text-transform-btn);
  padding: var(--btn-padding-y) var(--btn-padding-x);
}

.btn-primary {
  --bs-btn-bg: var(--navy);
  --bs-btn-border-color: var(--navy);
  --bs-btn-hover-bg: var(--navy-dark);
  --bs-btn-hover-border-color: var(--navy-dark);
  --bs-btn-active-bg: #0f1a2f;
  --bs-btn-active-border-color: #0f1a2f;
  --bs-btn-disabled-bg: var(--navy);
  --bs-btn-disabled-border-color: var(--navy);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}

.btn-secondary,
.btn-outline-secondary {
  --bs-btn-color: var(--text-secondary);
  --bs-btn-border-color: var(--border);
  --bs-btn-bg: #fff;
  --bs-btn-hover-bg: var(--navy);
  --bs-btn-hover-border-color: var(--navy);
  --bs-btn-hover-color: #fff;
}

.btn-warning {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}

.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}

.form-control,
.form-select {
  min-height: 46px;
  height: 46px;
  border-color: var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 10px 14px;
  line-height: 1.25;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(244, 121, 32, 0.15);
}

.card {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-light);
}

/* Legacy aliases to keep current pages stable during migration */
.btn-submit {
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
}
.btn-submit:hover {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
  color: #fff;
}
.btn-cancel {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-cancel:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-danger-legacy {
  background: #dc3545;
  color: #fff;
  border: 1px solid #dc3545;
}
.btn-danger-legacy:hover {
  background: #bb2d3b;
  border-color: #bb2d3b;
  color: #fff;
}

.app-wrapper { display: flex; width: 100%; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.logo-brand {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .06em;
  line-height: 1.1;
}
.logo-brand span { color: var(--primary); }
.logo-sub {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: rgba(255,255,255,.38);
  letter-spacing: .14em;
  line-height: 1;
  margin-top: 1px;
}

.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section-label {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  color: rgba(255,255,255,.38);
  padding: 14px 18px 4px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 13px;
  font-weight: 400;
  text-transform: var(--text-transform-nav);
  transition: background .15s, color .15s;
}
.nav-item:hover {
  background: var(--nav-hover-bg) !important;
  color: #fff !important;
}
.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.25); }

.sidebar-footer {
  padding: 8px 0 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 4px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
}
.user-role {
  display: block;
  font-size: 10px;
  color: var(--primary);
  font-weight: 600;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-toggle,
.topbar-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  border: none;
}
.sidebar-toggle:hover,
.topbar-btn:hover {
  background: rgba(27,45,79,.08) !important;
  color: var(--navy) !important;
}
.breadcrumb-app {
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb-page {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.breadcrumb-sep,
.breadcrumb-current {
  font-size: 13px;
  color: var(--text-secondary);
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.search-input {
  border: none;
  background: none;
  outline: none;
  font-size: 12px;
  color: var(--text-primary);
  width: 160px;
}
.search-input::placeholder { color: var(--text-muted); }
.search-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
  overflow: hidden;
}
.search-result-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}
.search-result-link:hover { background: rgba(27,45,79,.05); }
.search-result-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.search-result-section {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: #f3f4f6;
  padding: 2px 7px;
  border-radius: 8px;
}
.search-empty-state {
  padding: 28px 16px;
  text-align: center;
}
.search-empty-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}
.search-empty-sub {
  font-size: 11px;
  color: #9ca3af;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  z-index: 200;
  overflow: hidden;
}
.notif-panel-head,
.notif-tabs-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}
.notif-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.notif-link-btn {
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
  border: none;
  background: none;
}
.notif-close-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
}
.notif-tab {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: none;
  color: #6b7280;
  margin-right: 4px;
}
.active-notif-tab {
  background: var(--primary) !important;
  color: var(--navy) !important;
  font-weight: 700 !important;
}
.notif-list {
  max-height: 360px;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  background: #fff;
}
.notif-item:hover { background: rgba(27,45,79,.04); }
.notif-item-unread { background: #fefaf6; }
.notif-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-item-icon-unread { background: #fff5ef; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.notif-item-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.notif-item-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}
.notif-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 4px;
  flex-shrink: 0;
}
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  border: 1.5px solid #fff;
}
.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-content {
  flex: 1;
  padding: var(--content-padding, 24px);
  overflow-y: auto;
}
.page-title {
  font-family: var(--font-title, 'Barlow Condensed'), sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: .01em;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.kpi-card:hover {
  box-shadow: 0 4px 16px rgba(27,45,79,0.12) !important;
  transform: translateY(-1px);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-bottom: 20px;
}

.text-green  { color: var(--green); }
.text-primary-brand { color: var(--primary); }
.text-amber  { color: var(--amber); }
.text-muted  { color: var(--text-muted); }
.font-mono   { font-variant-numeric: tabular-nums; }
.hidden      { display: none !important; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.visible { display: block !important; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
@media(min-width:901px){
  .sidebar.collapsed { transform:translateX(calc(-1 * var(--sidebar-w))); }
  .main-content.sidebar-collapsed { margin-left:0 !important; transition:margin-left .25s; }
  .main-content { transition:margin-left .25s; }
}

/* CRM */
.crm-page { overflow-x: auto; }
.crm-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; flex-wrap:wrap; }
.crm-toolbar__meta { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.crm-title { font-family:'Barlow Condensed', sans-serif; font-size:26px; font-weight:700; margin:0; color:var(--text-primary); }
.crm-count { font-size:12px; color:var(--text-secondary); background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:6px 14px; }
.crm-pipeline { font-size:13px; color:var(--text-secondary); }
.crm-pipeline strong { color:var(--green); font-weight:700; }
.crm-toolbar__actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.btn-leads-action, .btn-add-lead { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:40px; padding:8px 16px; border-radius:var(--radius-sm); font-size:12px; font-weight:600; transition:all .15s ease; white-space:nowrap; }
.btn-leads-action { background:#fff; color:var(--text-secondary); border:1px solid var(--border); }
.btn-leads-action:hover { background:var(--navy); border-color:var(--navy); color:#fff; }
.btn-add-lead { background:var(--primary); border:1px solid var(--primary); color:#fff; }
.btn-add-lead:hover { background:var(--navy); border-color:var(--navy); color:#fff; }
.crm-filters { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:18px; }
.crm-filter-input { max-width:420px; min-width:280px; }
.crm-filter-select { width:160px; }
.crm-board { display:flex; align-items:flex-start; gap:14px; min-width:max-content; padding-bottom:14px; }
.crm-stage { width:320px; min-width:320px; background:var(--surface-2); border:1px solid var(--border); border-radius:16px; padding:0; display:flex; flex-direction:column; }
.crm-stage__header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 16px 12px; border-bottom:1px solid var(--border-light); }
.crm-stage__heading { display:flex; align-items:center; gap:8px; min-width:0; }
.crm-stage__dot { width:8px; height:8px; border-radius:50%; background:var(--stage-dot, #6b7280); flex:0 0 8px; }
.crm-stage__label { font-size:13px; font-weight:700; color:var(--text-primary); white-space:nowrap; }
.crm-stage__count { font-size:12px; color:var(--text-muted); font-weight:600; }
.crm-stage__meta { display:flex; align-items:center; gap:15px; }
.crm-stage__total { font-size:12px; font-weight:700; color:var(--text-secondary); white-space:nowrap; }
.crm-stage__move, .crm-stage__settings { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; border:none; background:transparent; color:var(--text-muted); border-radius:50%; cursor:pointer; flex:0 0 28px; }
.crm-stage__move:hover, .crm-stage__settings:hover { background:var(--primary-light); color:var(--navy); }
.crm-stage__cards { padding:14px; display:flex; flex-direction:column; gap:12px; min-height:72px; }
.crm-stage__cards.drag-over { background:rgba(244,121,32,0.06); outline:2px dashed var(--primary); border-radius:12px; }
.crm-stage__add { margin:0 14px 14px; min-height:42px; border:1.5px dashed var(--border); border-radius:12px; background:#fff; color:var(--text-muted); font-weight:600; font-size:12px; cursor:pointer; }
.crm-stage__add:hover { border-color:var(--navy); color:var(--navy); background:var(--primary-light); }
.add-card-btn { margin-top:10px; }
.crm-stage--folded { width:82px; min-width:82px; align-items:center; padding:12px 8px; }
.crm-stage--folded .crm-stage__header { width:100%; border-bottom:none; padding:0; flex-direction:column; align-items:center; gap:14px; }
.crm-stage--folded .crm-stage__heading { flex-direction:column; gap:10px; }
.crm-stage--folded .crm-stage__label { writing-mode:vertical-rl; text-orientation:mixed; font-size:14px; }
.crm-stage--folded .crm-stage__meta { flex-direction:column-reverse; align-items:center; gap:12px; width:100%; }
.crm-stage--folded .crm-stage__total { writing-mode:horizontal-tb; font-size:12px; white-space:nowrap; text-align:center; min-width:100%; }
.crm-stage--folded .crm-stage__move, .crm-stage--folded .crm-stage__settings { margin-bottom:2px; }
.lead-card { background-color:#cdcdcd21; border:1px solid var(--border); border-radius:14px; padding:14px; box-shadow:none; }
.lead-card:hover { border-color:#d4d7dd; box-shadow:var(--shadow-sm); }
.lead-card.dragging { opacity:.45; }
.lead-card__body { cursor:pointer; }
.lead-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; margin-bottom:8px; }
.lead-company { font-size:13px; font-weight:700; color:var(--text-primary); }
.lead-avatar { width:28px; height:28px; border-radius:50%; background:#e5e7eb; color:var(--text-secondary); display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; }
.lead-desc { font-size:12px; line-height:1.5; color:var(--text-secondary); margin-bottom:10px; }
.lead-value { font-size:16px; font-weight:800; color:var(--green); margin-bottom:10px; }
.lead-trades, .selected-tags { display:flex; flex-wrap:wrap; gap:6px; }
.lead-trades { margin-bottom:10px; }
.trade-tag, .tag-option-btn, .selected-tag-chip { display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:4px 10px; font-size:11px; font-weight:600; border:1px solid var(--border); background:#fff; color:var(--text-secondary); }
.tag-framing { background:#dbeafe; color:#1e40af; border-color:#bfdbfe; }
.tag-drywall { background:#fee2e2; color:#b91c1c; border-color:#fecaca; }
.tag-taping { background:#e0e7ff; color:#4338ca; border-color:#c7d2fe; }
.tag-spray-foam { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.tag-insulation { background:#dcfce7; color:#15803d; border-color:#bbf7d0; }
.tag-default, .tag-option-btn { background:#fff; color:var(--text-secondary); border-color:var(--border); }
.tag-option-btn.active, .selected-tag-chip { background:var(--primary-light); color:var(--navy); border-color:var(--primary); }
.selected-tag-chip button { border:none; background:transparent; color:inherit; padding:0; line-height:1; font-size:12px; }
.lead-created { display:flex; align-items:center; gap:4px; font-size:10px; color:var(--text-muted); margin-bottom:10px; }
.lead-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:4px; }
.lead-meta { display:flex; flex-wrap:wrap; gap:10px; }
.lead-meta-item { display:flex; align-items:center; gap:4px; font-size:10px; color:var(--text-muted); }
.lead-actions { display:flex; align-items:center; gap:4px; }
.lead-action-btn { width:26px; height:26px; display:inline-flex; align-items:center; justify-content:center; border:none; background:transparent; color:var(--text-muted); border-radius:6px; }
.lead-action-btn:hover { background:var(--bg); color:var(--text-primary); }
.lead-card__move { margin-top:10px; }
.lead-stage-select { width:100%; font-size:11px; }
.crm-modal-overlay { position:fixed; inset:0; display:none; align-items:center; justify-content:center; padding:24px; background:rgba(17,24,39,.45); z-index:300; }
.crm-modal-overlay.open { display:flex; }
.crm-modal-dialog { width:100%; background:#fff; border-radius:18px; box-shadow:0 20px 60px rgba(0,0,0,.18); display:flex; flex-direction:column; }
.crm-modal-dialog--opportunity { max-width:620px; }
.crm-modal-dialog--detail { max-width:640px; }
.crm-modal-dialog--stage { max-width:520px; }
.crm-modal-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 22px; border-bottom:1px solid var(--border); }
.crm-modal-title { margin:0; font-size:16px; font-weight:700; color:var(--text-primary); }
.crm-subtitle { font-size:11px; color:var(--text-secondary); margin-top:4px; }
.crm-modal-close { width:32px; height:32px; border:none; background:transparent; color:var(--text-muted); border-radius:8px; font-size:26px; line-height:1; cursor:pointer; }
.crm-modal-close:hover { background:var(--bg); color:var(--text-primary); }
.crm-modal-body { padding:20px 22px; display:flex; flex-direction:column; gap:16px; }
.crm-modal-body--scroll { max-height:70vh; overflow-y:auto; }
.crm-modal-footer { padding:14px 22px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:10px; }
.crm-modal-footer--split { justify-content:space-between; align-items:center; }
.crm-modal-footer__actions { display:flex; gap:10px; }
.crm-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.crm-form-group { display:flex; flex-direction:column; gap:6px; }
.crm-form-label { font-size:11px; font-weight:700; color:var(--text-secondary); text-transform:uppercase; letter-spacing:.05em; }
.crm-form-textarea { min-height:110px; resize:vertical; }
.crm-form-check { display:flex; align-items:center; gap:8px; font-size:14px; color:var(--text-primary); min-height:46px; margin-left:0; }
.crm-form-check .form-check-input { width:16px; height:16px; margin-top:0; cursor:pointer; }
.crm-form-check .form-check-label { margin:0 0 0 20px; cursor:pointer; font-weight:600; color:var(--text-primary); }
.crm-tag-search-wrap { position:relative; }
.crm-tag-results { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.tag-empty { font-size:11px; color:var(--text-muted); }
.crm-created-note { font-size:10px; color:var(--text-muted); }
.hidden { display:none !important; }
.stage-dragging { opacity:.55; }
.stage-drag-over { outline:2px dashed var(--primary); outline-offset:3px; }
@media (max-width: 992px) {
  .crm-form-grid { grid-template-columns:1fr; }
  .crm-filter-input { max-width:none; min-width:220px; }
}

.crm-form-check .form-check-input { margin-left:0 !important; margin-right:0 !important; }


/* CRM fixes */
.crm-board { overflow-x: auto; max-width: 100%; }
.crm-stage__meta { flex-wrap: nowrap; }
.crm-stage__total { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
.lead-stage-select { min-height: 46px; height: 46px; font-size: 13px; }
.crm-form-check { min-height: auto; margin-left: 0; }
.crm-form-check .form-check-label { margin: 0 0 0 20px; }
.crm-tag-results { display:flex; flex-wrap:wrap; gap:6px; }
.crm-tag-results.hidden { display:none !important; }

/* QBO Imports */
.nav-item.disabled {
  opacity: .55;
  cursor: default;
  pointer-events: none;
}
.qbo-page {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.qbo-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.qbo-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.qbo-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
}
.qbo-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
}
.qbo-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.qbo-kpi-grid--single {
  grid-template-columns: minmax(220px, 340px);
}
.qbo-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qbo-kpi-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.qbo-kpi-value {
  font-size: 28px;
  line-height: 1;
  font-family: 'Barlow Condensed', sans-serif;
  color: var(--navy);
}
.qbo-kpi-meta {
  color: var(--text-muted);
  font-size: 12px;
}
.qbo-overview-card,
.qbo-list-card {
  border: 1px solid var(--border);
}
.qbo-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.qbo-section-title {
  margin: 0;
  font-size: 20px;
  font-family: 'Barlow Condensed', sans-serif;
  color: var(--text-primary);
}
.qbo-section-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
}
.qbo-module-grid,
.qbo-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.qbo-module-tile,
.qbo-note-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qbo-module-tile {
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.qbo-module-tile:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.qbo-module-tile.is-disabled {
  opacity: .65;
  cursor: not-allowed;
}
.qbo-module-tile.is-disabled:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}
.qbo-module-title {
  color: var(--navy);
  font-weight: 700;
}
.qbo-module-text,
.qbo-note-item span {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.qbo-note-item strong {
  color: var(--text-primary);
  font-size: 13px;
}
.qbo-table-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.qbo-search-input {
  min-width: 280px;
  max-width: 360px;
}
.qbo-table-wrap {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.qbo-table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.qbo-table tbody td {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
}
.qbo-alert {
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) {
  .qbo-kpi-grid,
  .qbo-module-grid,
  .qbo-note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .qbo-kpi-grid,
  .qbo-module-grid,
  .qbo-note-grid,
  .qbo-kpi-grid--single {
    grid-template-columns: 1fr;
  }
  .qbo-search-input {
    min-width: 100%;
    max-width: none;
  }
}
@media print {
  .sidebar,
  .topbar,
  .sidebar-overlay,
  .qbo-toolbar-actions,
  #alertBox {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
  }
  .page-content {
    padding: 0;
  }
  .card,
  .qbo-kpi-card,
  .qbo-table-wrap {
    box-shadow: none !important;
  }
}


/* Tags */
.tags-page-shell {
  padding: 24px;
  background: transparent;
}
.tags-card {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.tags-card .card-body {
  background: var(--surface) !important;
  border-radius: inherit;
}
.tags-card .table-responsive,
.tags-card .table,
.tags-card table,
.tags-card thead,
.tags-card tbody,
.tags-card tr,
.tags-card td,
.tags-card th {
  background: transparent;
}
.tags-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tags-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.tags-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tags-inline-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tags-search-wrap {
  min-width: 260px;
  max-width: 320px;
}
.tags-search-wrap .form-control {
  min-width: 260px;
}
.tags-inline-flash {
  display: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tags-inline-flash.show {
  display: inline-flex;
  align-items: center;
}
.tags-inline-flash.is-success {
  color: var(--green);
}
.tags-inline-flash.is-error {
  color: #dc3545;
}
.tags-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .tags-page-shell {
    padding: 16px;
  }
  .tags-toolbar,
  .tags-toolbar-left,
  .tags-inline-tools,
  .tags-toolbar-actions {
    align-items: stretch;
  }
  .tags-search-wrap,
  .tags-search-wrap .form-control {
    min-width: 100%;
    max-width: none;
    width: 100%;
  }
}


/* QBO Overview print fixes */
.qbo-overview-import-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

@media print {
  .qbo-page--overview .qbo-overview-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .qbo-page--overview .qbo-overview-import-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .qbo-page--overview .qbo-module-grid--six {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}


.odoo-page .odoo-row-semi-protected td {
  background-color: #ffe26f !important;
}


.odoo-kpi-grid-six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.odoo-review-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) repeat(4, minmax(160px, 0.8fr));
  gap: 10px;
  width: 100%;
  max-width: 980px;
  margin-left: auto;
  align-items: center;
}

.odoo-review-filters .form-control,
.odoo-review-filters .form-select {
  width: 100%;
}

.odoo-page .odoo-row-approved td {
  background-color: #deffd9 !important;
}

.odoo-page .odoo-row-blocked td {
  background-color: #ffd7d7 !important;
}

.odoo-page .odoo-row-semi-protected td {
  background-color: #ffe26f !important;
}

.odoo-page .odoo-row-pending td {
  background-color: #eee !important;
}

@media (max-width: 1399.98px) {
  .odoo-kpi-grid-six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .odoo-review-filters {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    max-width: none;
  }
}

@media (max-width: 991.98px) {
  .odoo-kpi-grid-six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .odoo-review-filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 575.98px) {
  .odoo-kpi-grid-six,
  .odoo-review-filters {
    grid-template-columns: 1fr;
  }
}
