/* Lead detail slide-over panel */
.lead-panel-backdrop {
  position: fixed; inset: 0; background: rgba(6, 20, 15, 0.5);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease);
  z-index: 200;
}
.lead-panel-backdrop.open { opacity: 1; pointer-events: auto; }

/* Slides in/out via `right`, not `transform` — a transformed ancestor
   (even a no-op translateX(0)) becomes the containing block for any
   position:fixed descendant inside it, so the old transform-based slide
   was quietly hijacking every modal opened from within this panel
   (attachment preview, add-note, tag pickers, ...) once the panel itself
   had been scrolled down even a little: "fixed" to the viewport in name
   only, they'd actually scroll away with the panel's own content. -1200px
   comfortably clears the panel's own 1180px max-width at any viewport
   size, matching translateX(100%)'s old "fully off past its own width"
   behavior without ever setting transform on this element. */
.lead-panel {
  position: fixed; top: 0; right: -1200px; bottom: 0;
  width: 100%; max-width: 1180px;
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(8, 30, 22, 0.22);
  transition: right 0.32s var(--ease);
  z-index: 201;
  overflow-y: auto;
}
.lead-panel.open { right: 0; }

.lead-panel-loading { padding: 40px; text-align: center; color: var(--text-muted); }

.lead-panel-content { position: relative; padding: 0 0 40px; animation: fadeIn 0.3s var(--ease); }

.lead-panel-close-x {
  position: absolute; top: 18px; right: 20px; z-index: 2;
  background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer;
  color: var(--text-muted); transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}
.lead-panel-close-x:hover { color: var(--danger); transform: rotate(90deg); }

/* Leads grid — row/select-all checkboxes + the multi-select action panel
   they open (Update Status / Assign To / Assign Tags / Delete), docked
   to the right the same way the Lead detail slide-over is, just a
   narrower fixed-width sidebar instead of a full record view. */
/* th.select-col/td.select-col and the checkbox styling below apply to
   any table's row-select column, not just the Leads grid — Opportunities
   and Customers reuse them too (see bulk-select.js), each with their own
   [data-row-select] rather than the Leads grid's more specific
   [data-lead-select]. */
th.select-col, td.select-col { width: 36px; padding-right: 0; }
[data-lead-select], [data-row-select], [data-select-all] { width: auto; accent-color: var(--brand); cursor: pointer; }

.bulk-select-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 280px;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -12px 0 30px rgba(8, 30, 22, 0.12);
  transform: translateX(100%); transition: transform 0.28s var(--ease);
  z-index: 220; overflow-y: auto; padding: 20px 18px;
}
.bulk-select-panel.open { transform: translateX(0); }
.bulk-select-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 16px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.bulk-select-count { font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.bulk-select-count-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 4px; }
.bulk-select-close { background: none; border: none; font-size: 1.3rem; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 2px; }
.bulk-select-close:hover { color: var(--danger); }
.bulk-select-section { margin-bottom: 18px; }
.bulk-select-section-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.bulk-danger-label { color: var(--danger); }
.bulk-action-btn {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: #fafcfb; border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 14px; font-size: 0.83rem; font-weight: 600; color: var(--text);
  cursor: pointer; margin-bottom: 8px; transition: border-color 0.14s var(--ease), background 0.14s var(--ease), transform 0.14s var(--ease);
}
.bulk-action-btn:last-child { margin-bottom: 0; }
.bulk-action-btn svg { flex-shrink: 0; color: var(--brand-dark); }
.bulk-action-btn:hover { border-color: var(--brand); background: var(--brand-light); transform: translateX(-2px); }
.bulk-action-danger { color: var(--danger); }
.bulk-action-danger svg { color: var(--danger); }
.bulk-action-danger:hover { border-color: var(--danger); background: var(--danger-light); }
.bulk-tag-checklist { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; margin-bottom: 14px; }
.bulk-tag-check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 500; }
.bulk-tag-check input { width: auto; accent-color: var(--brand); }

.lead-panel-header {
  padding: 24px 24px 16px; margin-bottom: 0;
  background: linear-gradient(180deg, var(--brand-light) 0%, rgba(255,255,255,0) 100%);
}
.lead-panel-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lead-panel-heading h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.02em; }
.lead-panel-subline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.lead-panel-meta { color: var(--text-muted); font-size: 0.85rem; }
.lead-panel-contact { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 0.9rem; color: var(--text-muted); }

.lead-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; background: var(--brand-light); color: var(--brand); border: 1px solid rgba(14, 164, 114, 0.25);
}
.tag-chip-remove { border: none; background: none; cursor: pointer; color: inherit; opacity: 0.6; font-size: 0.9rem; line-height: 1; padding: 0 0 0 2px; }
.tag-chip-remove:hover { opacity: 1; }
.lead-tag-add-form input {
  border: 1px dashed var(--border); border-radius: 999px; padding: 3px 10px; font-size: 0.78rem; width: 110px;
  background: transparent; transition: border-color 0.15s var(--ease), width 0.15s var(--ease);
}
.lead-tag-add-form input:focus { outline: none; border-color: var(--brand); border-style: solid; width: 150px; }

.tags-cell { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tag-chip-sm { padding: 2px 6px 2px 8px; font-size: 0.72rem; }
.tag-add-btn {
  width: 18px; height: 18px; border: 1px dashed var(--border); background: transparent; border-radius: 50%;
  cursor: pointer; color: var(--text-muted); font-size: 0.85rem; line-height: 1; padding: 0; flex-shrink: 0;
  transition: border-color 0.12s var(--ease), color 0.12s var(--ease);
}
.tag-add-btn:hover { border-color: var(--brand); color: var(--brand); border-style: solid; }
.tag-add-input {
  border: 1px solid var(--brand); border-radius: 999px; padding: 2px 8px; font-size: 0.72rem; width: 100px;
  background: var(--surface);
}
.tag-add-input:focus { outline: none; }

.lead-panel-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab-nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin: 0 24px 18px; padding-bottom: 8px;
}
.tab-panels { padding: 0 24px; }
.tab-btn {
  background: none; border: none; padding: 7px 13px; border-radius: 999px;
  font-size: 0.83rem; font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}
.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--brand-gradient); color: #fff; font-weight: 700; box-shadow: 0 2px 6px rgba(6, 95, 70, 0.3); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s var(--ease); }
.tab-subhead { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-dark); font-weight: 700; margin: 22px 0 10px; }
.tab-empty { color: var(--text-muted); font-size: 0.88rem; }
.tab-form { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.tab-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-form-row > * { flex: 1; min-width: 120px; }

.mini-list { margin: 0; padding-left: 18px; font-size: 0.88rem; }
.mini-list li { margin-bottom: 4px; }

.task-item { display: flex; gap: 10px; align-items: flex-start; }
.task-item.task-done { opacity: 0.55; }
.task-item.task-done > div > div:first-child { text-decoration: line-through; }
.task-checkbox { background: none; border: none; cursor: pointer; font-size: 1.15rem; line-height: 1; padding: 0; color: var(--brand); transition: transform 0.15s var(--ease); }
.task-checkbox:hover { transform: scale(1.2); }

@media (max-width: 560px) {
  .lead-panel { max-width: 100%; }
}

/* Status pill row */
.status-pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; padding: 0 24px 4px; }
.status-pill {
  display: inline-block; padding: 5px 13px; border-radius: 999px; font-size: 0.76rem; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; background: #eef2f0; color: var(--text-muted);
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), opacity 0.14s var(--ease);
}
.status-pill.badge-new { background: #dbeafe; color: #1d4ed8; }
.status-pill.badge-converted { background: var(--brand-light); color: var(--brand-dark); }
.status-pill.badge-lost { background: var(--danger-light); color: var(--danger); }
.status-pill:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.status-pill:disabled { cursor: default; opacity: 0.65; }
.status-pill.current { border-color: currentColor; font-weight: 800; opacity: 1; animation: softPulse 2.4s ease infinite; }

/* Notes tab: search + attachments */
.notes-toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.notes-search { flex: 1; padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.88rem; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.notes-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 164, 114, 0.14); }
.note-attachments { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.note-attachment-thumb { display: block; width: 64px; height: 64px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.note-attachment-thumb:hover { transform: scale(1.06); box-shadow: var(--shadow); }
.note-attachment-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.note-attachment-file { display: inline-block; font-size: 0.82rem; padding: 5px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: background 0.15s var(--ease); }
.note-attachment-file:hover { background: var(--brand-light); }

/* Centered modal (Add Note) */
.panel-modal { position: fixed; inset: 0; z-index: 300; display: none; }
.panel-modal.open { display: block; animation: fadeIn 0.2s var(--ease); }
.panel-modal-backdrop { position: fixed; inset: 0; background: rgba(6, 20, 15, 0.55); backdrop-filter: blur(2px); }
.panel-modal-dialog {
  position: relative; z-index: 1; background: var(--surface); border-radius: var(--radius);
  max-width: 480px; width: calc(100% - 40px); margin: 10vh auto 0; padding: 26px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.28s var(--ease);
  /* A fixed 10vh top margin with no cap ever let a tall dialog's own
     content (e.g. Inventory's own "Upload Vendor Inv" bulk modal, once its
     batch checklist grows past a couple of rows) run off the bottom of a
     short/laptop viewport with nothing scrollable to reach the rest —
     .pf-details-dialog-xl/.qrc-dialog already guard against exactly this
     themselves; this base class just never got the same treatment. Purely
     protective: a dialog shorter than the viewport is completely
     unaffected by this cap. */
  max-height: 80vh;
  overflow-y: auto;
}
.panel-modal-dialog h3 { margin-top: 0; }
.panel-modal-dialog .lead-panel-close-x { top: 14px; right: 16px; }

/* PDF preview modal — its own dialog shape (not .panel-modal-dialog):
   near-fullscreen with a colorful gradient header bar instead of a
   plain padded box, since the point of this one is the document filling
   almost the whole thing, not a form. */
.pdf-preview-dialog {
  position: relative; z-index: 1; margin: 4vh auto 0; width: min(920px, calc(100% - 40px));
  height: 90vh; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; animation: fadeInUp 0.28s var(--ease);
}
.pdf-preview-header {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
  background: var(--brand-gradient); background-size: 200% 100%; animation: gradientDrift 8s ease infinite;
  color: #fff; flex-shrink: 0;
}
.pdf-preview-header-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 0.95rem; }
.pdf-preview-header-icon {
  width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,0.18);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pdf-preview-header-actions { display: flex; align-items: center; gap: 8px; }
.pdf-preview-header-actions .toolbar-pill { background: rgba(255,255,255,0.16); color: #fff; box-shadow: none; }
.pdf-preview-header-actions .toolbar-pill:hover { background: rgba(255,255,255,0.3); color: #fff; }
.pdf-preview-close { position: static; color: #fff; }
.pdf-preview-close:hover { color: #fff; opacity: 0.75; transform: rotate(90deg); }
.pdf-preview-body { flex: 1; position: relative; background: #4b5153; }
.pdf-preview-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: none; opacity: 0; transition: opacity 0.25s var(--ease); }
.pdf-preview-frame.loaded { opacity: 1; }
.pdf-preview-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  color: #fff; font-size: 0.85rem; font-weight: 600; transition: opacity 0.2s var(--ease);
}
.pdf-preview-loading.hidden { opacity: 0; pointer-events: none; }
.pdf-preview-spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .pdf-preview-dialog { width: 100%; height: 100%; margin: 0; border-radius: 0; }
}

/* List toolbar — a rounded, colorful "clear bar" holding the module label,
   a Filters toggle (collapses the filter-bar below it), and the existing
   Add/Export/Customize actions restyled as pills, all on one row instead
   of the old plain right-aligned button group. */
.list-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(90deg, var(--brand-light) 0%, #eef9f4 100%);
  border: 1px solid rgba(14, 164, 114, 0.18);
  border-radius: 999px; padding: 8px 10px 8px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.list-toolbar-title {
  display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--brand-dark);
  font-size: 0.92rem; margin-right: 4px; white-space: nowrap;
}
.list-toolbar-title-icon {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand-gradient); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(6, 95, 70, 0.3);
}
.toolbar-divider { width: 1px; align-self: stretch; background: rgba(14, 164, 114, 0.2); margin: 2px 2px; }
.toolbar-pill {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent;
  background: var(--surface); color: var(--text); border-radius: 999px; padding: 8px 14px;
  font-size: 0.82rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), background 0.14s var(--ease), color 0.14s var(--ease);
}
.toolbar-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.toolbar-pill.active-toggle { background: var(--brand-gradient); color: #fff; }
.toolbar-pill-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 800;
}
.toolbar-pill-icon-only { padding: 8px; }
.toolbar-pill-clear {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 999px; background: rgba(220, 38, 38, 0.1); color: #dc2626; cursor: pointer;
  transition: transform 0.14s var(--ease), background 0.14s var(--ease), color 0.14s var(--ease);
  flex-shrink: 0;
}
.toolbar-pill-clear:hover { background: #dc2626; color: #fff; transform: translateY(-1px) scale(1.05); text-decoration: none; }
.list-toolbar-spacer { flex: 1; }

.grid-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.export-menu, .add-menu { position: relative; }
.export-panel, .add-panel {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 8px; min-width: 200px; max-height: 320px; overflow-y: auto;
  animation: fadeInUp 0.18s var(--ease);
}
.export-panel.open, .add-panel.open { display: block; }

/* Customize Table modal — a wider variant of the shared .panel-modal-dialog
   (see Add Lead/Import Leads for the plain version), with a fixed
   top/up/down/bottom control strip that acts on whichever row is
   .selected, rather than a pair of arrow buttons repeated on every row. */
.panel-modal-dialog-wide { max-width: 640px; }

/* Invoice-options modal (Quotations list/view "Invoice" button, a
   multi-option quotation only — see core/views/partials/_invoice_options_modal.php
   and assets/js/quotation-invoice.js) — each option renders as its own
   card with its actual line items inside, since picking one blind (just a
   label and a total) isn't really an informed choice between options. */
.invoice-options-dialog { max-height: 80vh; overflow-y: auto; }
.invoice-options-list { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.invoice-option-card {
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  overflow: hidden; transition: box-shadow 0.14s var(--ease), border-color 0.14s var(--ease);
}
.invoice-option-card:hover { box-shadow: var(--shadow); border-color: #a7d9c3; }
.invoice-option-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--brand-light);
}
.invoice-option-card-label { font-weight: 800; font-size: 0.94rem; overflow-wrap: break-word; }
.invoice-option-card-total { font-weight: 800; color: var(--brand-dark); font-size: 0.98rem; white-space: nowrap; }
.invoice-option-card-items { width: 100%; font-size: 0.84rem; }
.invoice-option-card-items th {
  text-align: left; padding: 6px 16px; color: var(--text-muted); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; border-bottom: 1px solid var(--border);
}
.invoice-option-card-items td { padding: 7px 16px; border-bottom: 1px solid var(--border); }
.invoice-option-card-items tbody tr:last-child td { border-bottom: none; }
.invoice-option-card-items th:not(:first-child), .invoice-option-card-items td:not(:first-child) { text-align: right; white-space: nowrap; }
.invoice-option-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px;
}
.invoice-option-card-meta { font-size: 0.78rem; color: var(--text-muted); }
.invoice-option-card-cta {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.84rem;
  color: var(--brand-dark); text-decoration: none;
}
.invoice-option-card-cta:hover { text-decoration: underline; }

/* Sales Lost reason modal — a colorful pill grid instead of a plain
   dropdown, since this pops up unprompted right after a quick status
   change (grid inline edit, panel status pill, or the edit form) and
   should read as a two-second interaction, not a form to fill in. */
.sales-lost-dialog { max-width: 460px; }
.sales-lost-modal-icon {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--danger-light); color: var(--danger); margin-bottom: 12px;
}
.sales-lost-dialog h3 { margin: 0 0 4px; }
.sales-lost-sub { color: var(--text-muted); font-size: 0.86rem; margin: 0 0 18px; }
.sales-lost-reason-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sales-lost-reason-pill {
  text-align: left; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 0.85rem; font-weight: 600; color: var(--text); cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}
.sales-lost-reason-pill:hover { border-color: var(--danger); background: var(--danger-light); transform: translateY(-1px); }
.sales-lost-reason-pill.selected { border-color: var(--danger); background: var(--danger-light); color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14); }
.sales-lost-note-wrap { margin-top: 14px; animation: fadeInUp 0.2s var(--ease); }
.sales-lost-note-wrap textarea { resize: vertical; }
.sales-lost-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* "Is installation Customer Scope?" modal — same shape/reasoning as
   Sales Lost's own pill grid above (install-scope-modal.js), but a
   binary Yes/No choice reads better as two big colorful cards than a
   pill grid built for many options. */
.install-scope-dialog { max-width: 480px; }
.install-scope-modal-icon {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #fef9c3; color: #854d0e; margin-bottom: 12px;
}
.install-scope-dialog h3 { margin: 0 0 4px; }
.install-scope-sub { color: var(--text-muted); font-size: 0.86rem; margin: 0 0 18px; }
.install-scope-choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.install-scope-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}
.install-scope-choice-icon { font-size: 1.4rem; line-height: 1; }
.install-scope-choice-label { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.install-scope-choice-hint { font-size: 0.78rem; color: var(--text-muted); }
.install-scope-choice-yes:hover { border-color: #854d0e; background: #fef9c3; transform: translateY(-1px); }
.install-scope-choice-no:hover { border-color: var(--brand); background: var(--brand-light); transform: translateY(-1px); }
.install-scope-choice-self:hover { border-color: #4338ca; background: #e0e7ff; transform: translateY(-1px); }
.install-scope-choice-team:hover { border-color: var(--brand); background: var(--brand-light); transform: translateY(-1px); }
.install-scope-back {
  background: none; border: none; padding: 0; margin-bottom: 10px; cursor: pointer;
  font-size: 0.82rem; font-weight: 700; color: var(--text-muted);
}
.install-scope-back:hover { color: var(--text); }

/* Step 3 — the followup-months picker every path ends at (see
   install-scope-modal.js's own docblock). Reuses the same icon-circle/
   heading/sub shape as steps 1-2, indigo instead of amber so the three
   steps read as a sequence, not three unrelated screens; a select +
   confirm button instead of click-to-choose cards since 12 options
   don't read well as a card grid. */
.install-scope-modal-icon-followup { background: #e0e7ff; color: #4338ca; }
.install-scope-followup-select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 0.92rem; font-weight: 600;
  cursor: pointer;
}
.install-scope-followup-select:focus { outline: none; border-color: #4338ca; box-shadow: 0 0 0 3px #e0e7ff; }
.install-scope-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Lightweight top-right toast — used for the "copied to Customers" nudge
   after a lead's status is set to Sales Converted. Not a full toast
   *system*, just this one use, so it stays this small. */
.lead-toast {
  position: fixed; top: 20px; right: 20px; z-index: 500; background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--brand); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 14px 40px 14px 18px; max-width: 340px; font-size: 0.88rem; animation: fadeInUp 0.25s var(--ease);
}
.lead-toast a { font-weight: 700; }
.lead-toast-close { position: absolute; top: 10px; right: 10px; cursor: pointer; color: var(--text-muted); background: none; border: none; font-size: 1.1rem; line-height: 1; }
.customize-columns-hint { font-size: 0.78rem; color: var(--text-muted); margin: 0 0 14px; }
.customize-search-wrap { position: relative; margin-bottom: 14px; }
.customize-search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); opacity: 0.8; pointer-events: none; }
.customize-search-wrap input {
  width: 100%; padding: 9px 12px 9px 32px; border: 1.5px solid var(--border); border-radius: 999px;
  font-size: 0.85rem; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.customize-search-wrap input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 164, 114, 0.14); }

.customize-modal-body { display: flex; gap: 12px; }
.customize-move-strip {
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
  padding: 8px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border);
  align-self: flex-start;
}
.customize-move-strip button {
  width: 34px; height: 34px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--brand-dark); display: flex; align-items: center; justify-content: center;
  transition: background 0.14s var(--ease), color 0.14s var(--ease), transform 0.14s var(--ease);
}
.customize-move-strip button:hover { background: var(--brand-gradient); color: #fff; transform: scale(1.06); }
.customize-move-strip button:active { transform: scale(0.95); }

.customize-col-list {
  flex: 1; min-width: 0; max-height: 340px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.customize-col-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.12s var(--ease);
}
.customize-col-row:last-child { border-bottom: none; }
.customize-col-row:hover { background: var(--brand-light); }
.customize-col-row.selected { background: #dbeafe; }
.customize-col-row.selected:hover { background: #cbe3fd; }
.customize-col-row input[type="checkbox"] { width: auto; accent-color: var(--brand); flex-shrink: 0; }
.customize-col-label { font-size: 0.87rem; font-weight: 600; }

.customize-modal-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 10px; }
.customize-modal-footer-right { display: flex; gap: 8px; }

/* Dashboard's Customize modal reuses everything above (.customize-col-list
   etc.) for three separate lists, switched via these tabs rather than all
   three stacked and scrolled past at once. */
.dash-customize-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.dash-customize-tab {
  border: none; background: none; padding: 9px 14px; font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.dash-customize-tab:hover { color: var(--brand-dark); }
.dash-customize-tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

.date-range-custom { display: flex; align-items: center; gap: 6px; }
.date-range-custom input { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; }
.date-range-custom span { color: var(--text-muted); }

.pagination-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.pagination-per-page { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); }
.pagination-per-page select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; }
.pagination-summary { font-size: 0.85rem; color: var(--text-muted); }
.pagination-controls { display: flex; align-items: center; gap: 10px; }
.pagination-page-indicator { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.btn-disabled { opacity: 0.45; cursor: default; pointer-events: none; }

.export-menu .btn svg, .add-menu .btn svg { vertical-align: -2px; margin-right: 2px; }
.export-panel a, .add-panel a {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap;
  transition: background 0.12s var(--ease), color 0.12s var(--ease), transform 0.12s var(--ease);
}
.export-panel a:hover, .add-panel a:hover { background: var(--brand-gradient); color: #fff; text-decoration: none; transform: translateX(2px); }
.export-panel a::before { content: "⬇"; font-size: 0.9rem; }
.add-panel a::before { content: "+"; font-size: 0.95rem; font-weight: 700; }

.modal-hint { font-size: 0.82rem; color: var(--text-muted); margin: -8px 0 14px; }
.modal-form-errors:empty { display: none; }
.modal-form-errors .alert { margin-bottom: 10px; }

/* Header row — solid brand color, not a color-cycling gradient; the
   "trendy" version (rainbow drift, a different hue per column) read as
   busy/unprofessional rather than lively, so this stays deliberately
   restrained: one brand color, a crisp underline, subtle motion only on
   interaction (hover / active sort), nothing looping on its own. */
.leads-grid thead th {
  background: var(--brand-dark);
  color: #fff;
  border-bottom: 2px solid var(--brand-darker);
  padding: 13px 12px;
  position: relative;
  transition: background 0.15s var(--ease);
}
.leads-grid thead th:hover { background: var(--brand-darker); }

.sortable-th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 3px 8px; border-radius: 999px; transition: background 0.16s var(--ease), color 0.16s var(--ease); margin: -3px -8px; }
.sortable-th a:hover { text-decoration: none; color: #fff; background: rgba(255,255,255,0.14); }
.sort-icon { font-size: 0.62rem; color: rgba(255,255,255,0.45); display: inline-block; transition: color 0.15s var(--ease), transform 0.15s var(--ease); }
.sort-icon.active { color: var(--accent); transform: scale(1.15); }
.sortable-th:has(.sort-icon.active) a { background: rgba(255,255,255,0.16); font-weight: 800; }

/* More visible columns must widen the table and scroll (the .card wrapper
   is overflow-x:auto for exactly this), never squeeze existing columns
   onto multiple lines — a plain `width:100%` table can't tell the
   difference and picks the wrong one once there are enough columns. */
.leads-grid { width: auto; min-width: 100%; }

/* Zebra rows + lively hover + staggered entrance */
.leads-grid tbody tr { animation: fadeInUp 0.35s var(--ease) both; border-left: 3px solid transparent; transition: background 0.15s var(--ease), border-color 0.15s var(--ease); }
.leads-grid tbody tr:nth-child(even) { background: #fafcfb; }
.leads-grid tbody tr:hover { background: var(--brand-light) !important; border-left-color: var(--brand); }
.leads-grid tbody tr:nth-child(1) { animation-delay: 0.02s; }
.leads-grid tbody tr:nth-child(2) { animation-delay: 0.05s; }
.leads-grid tbody tr:nth-child(3) { animation-delay: 0.08s; }
.leads-grid tbody tr:nth-child(4) { animation-delay: 0.11s; }
.leads-grid tbody tr:nth-child(5) { animation-delay: 0.14s; }
.leads-grid tbody tr:nth-child(n+6) { animation-delay: 0.17s; }

/* Inline-editable cells: hover affordance + trendy dropdown/input styling */
.leads-grid .editable-cell { cursor: pointer; border-radius: 6px; transition: background 0.12s var(--ease); position: relative; }
.leads-grid .editable-cell:hover { background: rgba(14, 164, 114, 0.1); }
.leads-grid .editable-cell:hover .cell-display { text-decoration: underline dotted; text-underline-offset: 3px; }
.leads-grid .editable-cell .cell-display { display: inline-flex; align-items: center; gap: 6px; }
.leads-grid .editable-cell .cell-display::after {
  content: "✎"; font-size: 0.7rem; color: var(--brand); opacity: 0; transform: translateX(-3px);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.leads-grid .editable-cell:hover .cell-display::after { opacity: 1; transform: translateX(0); }

/* Assigned-agent initials circle — color comes from an inline
   --avatar-color custom property set per-row (hashed from the agent's own
   name in PHP), not a fixed palette class, so it stays stable for that
   agent everywhere without a lookup table to keep in sync as agents are
   added/removed. */
.assignee-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 999px; margin-right: 7px;
  background: var(--avatar-color, var(--brand)); color: #fff;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.assignee-unassigned {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 999px; margin-right: 7px;
  background: #eef2f0; color: var(--text-muted); font-size: 0.6rem;
}

.leads-grid .editable-cell input,
.leads-grid .editable-cell select {
  /* Fixed, border-box height matching .cell-display's own rendered height
     (a badge or a plain text line, both ~20-22px) as closely as a still
     comfortably-clickable control allows — the old padding-driven height
     (7px top/bottom + border, ~34px total) grew every row it appeared in
     by well over a badge's own height, and since every editable cell in a
     row shares that row's height, clicking to edit even one cell visibly
     stretched (and un-stretched, on blur) the *entire* row — the "shaking"
     grid. Height no longer depends on padding at all, so this can't
     regress the same way again from an unrelated padding tweak. */
  box-sizing: border-box; height: 20px;
  width: 100%; min-width: 110px; padding: 0 10px; font-size: 0.85rem; font-weight: 600;
  border: 1.5px solid var(--brand); border-radius: 999px; color: var(--brand-dark);
  background: linear-gradient(180deg, #ffffff, var(--brand-light));
  box-shadow: 0 0 0 4px rgba(14, 164, 114, 0.16), var(--shadow-sm);
  animation: fadeInUp 0.15s var(--ease);
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.leads-grid .editable-cell input:hover,
.leads-grid .editable-cell select:hover { transform: translateY(-1px); box-shadow: 0 0 0 5px rgba(14, 164, 114, 0.2), var(--shadow); }
.leads-grid .editable-cell input:focus,
.leads-grid .editable-cell select:focus { outline: none; box-shadow: 0 0 0 5px rgba(14, 164, 114, 0.24), var(--shadow); }
.leads-grid .editable-cell select {
  appearance: none; -webkit-appearance: none;
  padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(180deg, #ffffff, var(--brand-light)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23065f46' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0 0, right 9px center;
  background-size: 100% 100%, 14px;
}
.leads-grid .cell-saving { opacity: 0.55; pointer-events: none; }
.leads-grid .cell-flash { animation: cellFlash 0.9s var(--ease); }
@keyframes cellFlash {
  0% { background: var(--accent-gradient); border-radius: 6px; }
  100% { background: transparent; }
}

/* Login page's own "Forgot Password" link + modal (modules/auth/views/
   login.php, assets/js/forgot-password.js) — reuses the shared
   .panel-modal/.panel-modal-dialog shell (this same file, just above)
   rather than a bespoke dialog, with its own .fp-* header/step/error/
   success styling layered on top. Lives here rather than app7.css
   (already near its own ~64KB ceiling) since .panel-modal is already
   this file's own concern and login.php already links it. */
.auth-forgot-link {
  display: block; text-align: center; margin-top: 16px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
}
.auth-forgot-link:hover { color: var(--brand-dark); }

.fp-dialog { max-width: 420px; }
.fp-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.fp-header-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; color: #fff;
  background: var(--brand-gradient); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(6, 95, 70, 0.5);
}
.fp-header h3 { margin: 0; font-size: 1.05rem; }
.fp-header p { margin: 3px 0 0; font-size: 0.82rem; color: var(--text-muted); }
.fp-submit-btn { margin-top: 4px; }
.fp-error {
  background: var(--danger-light); color: var(--danger); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 0.83rem; font-weight: 600; margin-bottom: 12px;
}
.fp-hint { display: block; margin-top: 6px; color: var(--text-muted); }
.fp-status {
  display: flex; align-items: center; gap: 9px;
  background: var(--brand-light); color: var(--brand-dark); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 0.83rem; font-weight: 600; margin-bottom: 12px;
}
.fp-status[hidden] { display: none; }
.fp-status-spinner {
  width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid rgba(6, 95, 70, 0.25); border-top-color: var(--brand-dark);
  animation: fpStatusSpin 0.7s linear infinite;
}
@keyframes fpStatusSpin { to { transform: rotate(360deg); } }
.fp-otp-input {
  font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5em; text-align: center; padding-left: 0.5em;
}
.fp-success { text-align: center; padding: 8px 0 4px; }
.fp-success-icon {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 14px; color: #fff;
  background: var(--brand-gradient); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -6px rgba(6, 95, 70, 0.55); animation: softPulse 1.6s var(--ease) 1;
}
.fp-success p { color: var(--text); font-size: 0.92rem; margin: 0 0 18px; }

