/* ==========================================================================
   OrNsoft theme — Leads pipeline
   admin/leads/manage_leads, kan-ban, _kan_ban_card (pipeline.html pattern)
   Tokens only. Loaded after ornsoft-ui.css and ornsoft-perfex.css.
   ========================================================================== */

body.admin.leads #vueApp {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* --------------------------------------------------------------------------
   1. Status summary — chips with counts
   -------------------------------------------------------------------------- */

body.admin.leads .leads-overview .ons-chip {
  text-decoration: none !important;
}

body.admin.leads .leads-overview .ons-chip > i {
  background: var(--c, var(--fg-faint));
}

body.admin.leads .leads-overview .ons-chip:focus {
  outline: none;
  box-shadow: var(--ring);
}

/* --------------------------------------------------------------------------
   2. Kanban board
   The platform renders `ul.kan-ban-col > li.kan-ban-col-wrapper > .panel_s`
   with the sortable list inside; the drag-and-drop hooks stay, the shell is
   restyled onto the .ons-kcol / .ons-kcard tokens.
   -------------------------------------------------------------------------- */

/* Board toolbar: sort actions on the left, tag search on the right. */
body.admin.leads .ons-toolbar.kanban-leads-sort {
  border-bottom: 1px solid var(--border);
  margin: 0;
}

body.admin.leads .ons-toolbar.kanban-leads-sort .leads-search {
  margin: 0;
  min-width: 180px;
  max-width: 260px;
}

body.admin.leads .ons-toolbar.kanban-leads-sort .leads-search .form-group,
body.admin.leads .ons-toolbar.kanban-leads-sort .leads-search input {
  margin-bottom: 0;
}

/* The board scrolls inside itself; the page never gains a horizontal
   scrollbar. The platform's kanban script stamps an inline
   `min-width: columns x 360px` on any .container-fluid it finds, so the board
   wrapper deliberately does not carry that class, and the width is pinned
   here as well in case the class comes back. */
body.admin.leads .leads-kan-ban,
body.admin.leads .leads-kan-ban.container-fluid {
  min-width: 0 !important;
  max-width: 100%;
  width: 100%;
  padding: var(--card-pad);
  overflow: hidden;
}

body.admin.leads #kan-ban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 280px;
  gap: 14px;
  align-items: start;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  overscroll-behavior-x: contain;
}

/* The column surface lives on the inner .panel_s, so the outer list element
   carries no chrome of its own (the theme's 1.0.0 rules gave it a card look,
   which would double up with the shell below). */
body.admin.leads #kan-ban > .kan-ban-col {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  float: none;
  display: block;
  list-style: none;
  background: transparent;
  border: 0;
  border-radius: 0;
}

body.admin.leads .kan-ban-col-wrapper {
  list-style: none;
}

/* The platform caps the scroll area height inline. */
body.admin.leads .kan-ban-content-wrapper {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* The column shell. */
body.admin.leads .kan-ban-col .panel_s {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  min-height: 320px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: none;
}

/* The column header. The status colour is echoed inline from the database and
   is left alone; everything around it is normalised. */
body.admin.leads .kan-ban-col .panel-heading {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 6px 8px;
  min-width: 0;
  border: 0 !important;
  border-radius: var(--r-md);
  color: var(--ons-paper);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

body.admin.leads .kan-ban-col .panel-heading .heading {
  font-weight: var(--fw-bold);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin.leads .kan-ban-col .panel-heading .ons-kcol__count,
body.admin.leads .kan-ban-col .panel-heading .ons-kcol__amount,
body.admin.leads .kan-ban-col .panel-heading .kanban-color-picker,
body.admin.leads .kan-ban-col .panel-heading > i {
  flex: none;
}

body.admin.leads .kan-ban-col .panel-heading small {
  font-weight: var(--fw-regular);
  opacity: .85;
}

/* Everything in the header sits on the status colour, so nothing inside it
   may fall back to a page text colour. */
body.admin.leads .kan-ban-col .panel-heading,
body.admin.leads .kan-ban-col .panel-heading .ons-muted,
body.admin.leads .kan-ban-col .panel-heading .heading,
body.admin.leads .kan-ban-col .panel-heading small,
body.admin.leads .kan-ban-col .panel-heading a,
body.admin.leads .kan-ban-col .panel-heading i {
  color: var(--ons-paper);
}

body.admin.leads .kan-ban-col .panel-heading .ons-num {
  font-family: var(--ons-font-mono);
  font-variant-numeric: tabular-nums;
  opacity: .85;
}

body.admin.leads .kan-ban-col .panel-heading .kanban-color-picker {
  margin-left: 4px;
  float: none;
}

body.admin.leads .kan-ban-col .panel-heading .ons-kcol__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .22);
  font-family: var(--ons-font-mono);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  line-height: 1;
}

body.admin.leads .kan-ban-col .panel-heading .ons-kcol__amount {
  font-family: var(--ons-font-mono);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  opacity: .9;
}

body.admin.leads .kan-ban-content-wrapper,
body.admin.leads .kan-ban-content {
  min-width: 0;
  background: transparent;
}

/* The core build paints the drop area with a fixed light slate, which stays
   light in dark mode; the column shell above already provides the surface. */
body.admin.leads .kan-ban-content {
  padding: 0;
}

body.admin.leads .kan-ban-content .leads-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 120px;
}

/* --------------------------------------------------------------------------
   3. Lead card
   -------------------------------------------------------------------------- */

body.admin.leads li.lead-kan-ban {
  list-style: none;
  border: 0;
  background: transparent;
}

body.admin.leads #kan-ban li.lead-kan-ban > .panel-body.ons-kcard {
  padding: 12px;
  margin: 0;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

/* The expand handle sits flush in the card corner. */
body.admin.leads .lead-kan-ban .kan-ban-expand-top {
  background: var(--bg-subtle);
  border-top-right-radius: var(--r-md);
}

/* A lead assigned to the signed-in staff member is marked on the border, not
   with a tinted panel. The core build paints it with a raw blue at !important,
   so the token values are declared at the same weight. */
body.admin.leads #kan-ban li.lead-kan-ban.current-user-lead > .panel-body.ons-kcard {
  background: var(--accent-soft) !important;
  border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--border)) !important;
}

body.admin.leads .lead-kan-ban .ons-kcard__company {
  display: block;
  margin-top: -2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin.leads .lead-kan-ban .ons-kcard__line,
body.admin.leads .lead-kan-ban .ons-kcard__meta {
  gap: 8px;
  flex-wrap: wrap;
}

body.admin.leads .lead-kan-ban .ons-kcard__meta {
  padding-top: 2px;
  border-top: 1px solid var(--border);
}

body.admin.leads .lead-kan-ban .ons-kcard__line b {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

body.admin.leads .lead-kan-ban .lead-name a {
  color: var(--fg);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  text-decoration: none;
}

body.admin.leads .lead-kan-ban .lead-name a:hover {
  color: var(--accent-text);
}

body.admin.leads .lead-kan-ban .ons-kcard p,
body.admin.leads .lead-kan-ban .ons-kcard small {
  color: var(--fg-muted);
  font-size: var(--fs-xs);
}

body.admin.leads .lead-kan-ban .ons-kcard .bold,
body.admin.leads .lead-kan-ban .ons-kcard b {
  color: var(--fg-secondary);
  font-weight: var(--fw-semibold);
}

body.admin.leads .lead-kan-ban .staff-profile-image-xs {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

body.admin.leads .lead-kan-ban .kanban-tags .label,
body.admin.leads .lead-kan-ban .kanban-tags a {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  margin: 2px 4px 0 0;
  border-radius: var(--r-sm);
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

/* The expandable detail block. */
body.admin.leads .lead-kan-ban [id^="kan-ban-expand-"] {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding: 10px 0 0 !important;
}

body.admin.leads .lead-kan-ban [id^="kan-ban-expand-"] .ons-dl dt {
  font-size: var(--fs-2xs);
  color: var(--fg-muted);
}

body.admin.leads .lead-kan-ban [id^="kan-ban-expand-"] .ons-dl dd {
  font-size: var(--fs-xs);
  color: var(--fg);
  font-weight: var(--fw-medium);
}

body.admin.leads .lead-kan-ban .kan-ban-expand-top {
  color: var(--fg-faint);
}

body.admin.leads .lead-kan-ban .kan-ban-expand-top:hover {
  color: var(--fg);
}

/* Drag state. */
body.admin.leads .leads-status.sortable .ui-sortable-helper .ons-kcard,
body.admin.leads .lead-kan-ban.ui-sortable-helper .ons-kcard {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

body.admin.leads .leads-status .ui-sortable-placeholder {
  visibility: visible !important;
  height: 64px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-hover);
}

/* --------------------------------------------------------------------------
   4. Column footer — load more / empty
   -------------------------------------------------------------------------- */

body.admin.leads .kanban-load-more {
  list-style: none;
  margin-top: 4px;
}

body.admin.leads .kanban-load-more .btn {
  height: var(--ctl-h-sm);
  padding: 0 10px;
  line-height: calc(var(--ctl-h-sm) - 2px);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--fg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

body.admin.leads .kanban-load-more .btn:hover,
body.admin.leads .kanban-load-more .btn:focus {
  background: var(--bg-hover);
  border-color: var(--fg-faint);
  color: var(--fg);
}

body.admin.leads .kanban-load-more .btn.disabled {
  background: var(--bg-sunken);
  border-color: var(--border);
  color: var(--fg-faint);
}

body.admin.leads .kanban-empty {
  list-style: none;
  margin-top: 8px;
}

body.admin.leads .kanban-empty .ons-empty {
  padding: 28px 12px;
  color: var(--fg-muted);
}

body.admin.leads .kanban-empty .ons-empty__icon {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

body.admin.leads .kanban-empty .ons-empty__title {
  font-size: var(--fs-sm);
  color: var(--fg);
}

/* The core build colours the empty-column heading with a fixed slate. */
body.admin.leads .kan-ban-content .kanban-empty h4,
body.admin.leads .kan-ban-content .kanban-empty .ons-empty__title {
  color: var(--fg);
}

/* --------------------------------------------------------------------------
   5. Sort bar
   -------------------------------------------------------------------------- */

body.admin.leads .kanban-leads-sort {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
  font-size: var(--fs-sm);
  color: var(--fg-muted);
}

body.admin.leads .kanban-leads-sort .bold {
  font-family: var(--ons-font-mono);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--fg-muted);
}

body.admin.leads .kanban-leads-sort a {
  text-decoration: none !important;
}

body.admin.leads .kanban-leads-sort .kanban-sort-icon {
  color: var(--accent-text);
}

/* --------------------------------------------------------------------------
   6. Colour picker popover
   -------------------------------------------------------------------------- */

body.admin.leads .cpicker-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.admin.leads .kanban-cpicker {
  border-radius: var(--r-sm) !important;
  cursor: pointer;
}

body.admin.leads .cpicker-small {
  width: 18px;
  height: 18px;
}

body.admin.leads .cpicker-big {
  width: 24px;
  height: 24px;
  box-shadow: var(--ring);
}

/* --------------------------------------------------------------------------
   7. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  body.admin.leads .kanban-leads-sort {
    font-size: var(--fs-xs);
  }
}

/* --------------------------------------------------------------------------
   8. Lead record modal — record.html on the XL modal width
   -------------------------------------------------------------------------- */

body.admin .lead-modal .modal-dialog {
  width: min(1100px, 96vw);
  max-width: none;
}

body.admin .lead-modal .modal-content {
  border-radius: var(--r-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

body.admin .lead-modal .modal-header,
body.admin .lead-modal .modal-content > .modal-header {
  padding: 20px 24px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

body.admin .lead-modal .modal-body {
  padding: 24px;
  background: var(--bg-page);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

body.admin .lead-modal .ons-record__icon {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
}

/* The lead record body — record.html: details on the left, the activity
   timeline in the middle, the general-information cards on the right.
   #leadViewWrapper has to stay one element (core JS toggles it and the print
   helper clones it), so it becomes a display:contents pass-through and its two
   children are placed directly in the record grid. */
body.admin .lead-modal .ons-ld-record {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: var(--gap);
  align-items: start;
  min-width: 0;
}

body.admin .lead-modal .ons-ld-view {
  display: contents;
}

body.admin .lead-modal .ons-ld-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

/* The three columns are placed explicitly (the middle one is a sibling of the
   display:contents wrapper, so auto-placement would push it to a second row). */
body.admin .lead-modal .ons-ld-col--left {
  grid-column: 1;
  grid-row: 1;
}

body.admin .lead-modal .ons-ld-col--mid {
  grid-column: 2;
  grid-row: 1;
}

body.admin .lead-modal .ons-ld-col--right {
  grid-column: 3;
  grid-row: 1;
}

/* The edit form spans the whole record. */
body.admin .lead-modal .ons-ld-full,
body.admin .lead-modal #lead_form {
  grid-column: 1 / -1;
}

@media (max-width: 1240px) {
  body.admin .lead-modal .ons-ld-record {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  body.admin .lead-modal .ons-ld-col--left {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  body.admin .lead-modal .ons-ld-col--mid {
    grid-column: 1;
    grid-row: 2;
  }

  body.admin .lead-modal .ons-ld-col--right {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 860px) {
  body.admin .lead-modal .ons-ld-record {
    grid-template-columns: minmax(0, 1fr);
  }

  body.admin .lead-modal .ons-ld-col--left,
  body.admin .lead-modal .ons-ld-col--mid,
  body.admin .lead-modal .ons-ld-col--right {
    grid-column: 1;
    grid-row: auto;
  }
}

/* --- activity timeline ------------------------------------------------ */

/* The filter chips are label-driven radios so the column needs no script. */
body.admin .lead-modal .ons-ld-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.admin .lead-modal .ons-ld-f {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

body.admin .lead-modal .ons-ld-filter label.ons-chip {
  margin: 0;
  font-weight: var(--fw-medium);
}

body.admin .lead-modal .ons-ld-f:checked + label.ons-chip {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 45%, transparent);
  color: var(--accent-soft-fg);
  font-weight: var(--fw-semibold);
}

body.admin .lead-modal .ons-ld-f:focus-visible + label.ons-chip {
  box-shadow: var(--ring);
}

/* Scoped to the modal rather than to a sibling chain, so the filter keeps
   working wherever the chips sit relative to the list. */
body.admin .lead-modal:has(#ons_ld_f_note:checked) .ons-ld-timeline > li:not([data-ons-kind="note"]),
body.admin .lead-modal:has(#ons_ld_f_activity:checked) .ons-ld-timeline > li:not([data-ons-kind="activity"]),
body.admin .lead-modal:has(#ons_ld_f_reminder:checked) .ons-ld-timeline > li:not([data-ons-kind="reminder"]) {
  display: none;
}

body.admin .lead-modal .ons-ld-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

body.admin .lead-modal .ons-ld-timeline > li {
  list-style: none;
}

body.admin .lead-modal .ons-ld-timeline .ons-tl__icon img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

body.admin .lead-modal .ons-ld-timeline .ons-tl__time {
  font-family: var(--ons-font-mono);
}

body.admin .lead-modal .ons-ld-timeline .ons-tl__body a {
  color: var(--accent-text);
}

/* The composer sits above the filter row. */
body.admin .lead-modal #lead-notes .form-group,
body.admin .lead-modal #lead-notes textarea {
  margin-bottom: 10px;
}

body.admin .lead-modal #lead-notes .radio {
  margin: 4px 0;
}

/* The notes / activity / reminders panels keep their ids for the platform
   scripts but no longer have a tab of their own. */
body.admin .lead-modal .ons-ld-hidden-panel {
  display: none;
}

body.admin .lead-modal .lead-information-col {
  min-width: 0;
  float: none;
  width: auto;
  padding: 0;
}

body.admin .lead-modal .ons-ld-full {
  grid-column: 1 / -1;
}

body.admin .lead-modal .lead-field-heading {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--fg-muted);
}

body.admin .lead-modal .ons-dl dd {
  color: var(--fg);
}

body.admin .lead-modal .activity-feed .feed-item,
body.admin .lead-modal .lead-note {
  border: 0;
}

/* The theme paints every admin link with the accent colour, which would win
   over the button variants on the anchors used as actions here. */
body.admin .lead-modal a.ons-btn,
body.admin.leads .ons-page-head__actions a.ons-btn,
body.admin.leads .ons-toolbar a.ons-btn {
  color: var(--fg);
}

body.admin .lead-modal a.ons-btn--primary,
body.admin .lead-modal a.ons-btn--primary:hover,
body.admin .lead-modal a.ons-btn--primary:focus,
body.admin.leads .ons-page-head__actions a.ons-btn--primary,
body.admin.leads .ons-page-head__actions a.ons-btn--primary:hover,
body.admin.leads .ons-page-head__actions a.ons-btn--primary:focus {
  color: var(--accent-fg);
}

body.admin .lead-modal a.ons-btn--ghost,
body.admin.leads .ons-toolbar a.ons-btn--ghost {
  color: var(--fg-secondary);
}

body.admin .lead-modal a.ons-btn--ghost:hover,
body.admin.leads .ons-toolbar a.ons-btn--ghost:hover {
  color: var(--fg);
}

body.admin .lead-modal a.ons-btn--danger,
body.admin .lead-modal .ons-menu__item--danger,
body.admin .lead-modal .dropdown-menu .text-danger {
  color: var(--danger);
}

/* Related counts card in the right column. */
body.admin .lead-modal .ons-ld-related-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  color: var(--fg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none !important;
}

body.admin .lead-modal .ons-ld-related li:first-child .ons-ld-related-link {
  border-top: 0;
  padding-top: 0;
}

body.admin .lead-modal .ons-ld-related-link:hover {
  color: var(--accent-text);
}

body.admin .lead-modal .ons-ld-related-link i {
  width: 18px;
  text-align: center;
  color: var(--fg-muted);
}

body.admin .lead-modal .ons-ld-related ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

body.admin .lead-modal .ons-ld-related li {
  list-style: none;
}

body.admin .lead-modal .ons-ld-timeline-empty {
  list-style: none;
}

body.admin .lead-modal .ons-ld-timeline-empty::before,
body.admin .lead-modal .ons-ld-timeline-empty::after {
  content: none;
}

/* --------------------------------------------------------------------------
   9. Lead record — one shared layout for every tab panel
   Panel head (actions, right aligned) · 16px gap · one card holding the
   toolbar and the table. The generic rules already strip the frame from a
   DataTable wrapper inside a modal, so the card is the only frame.
   -------------------------------------------------------------------------- */

body.admin .lead-modal .tab-content {
  min-height: 420px;
}

body.admin .lead-modal .tab-content > .tab-pane.active {
  min-height: 420px;
}

body.admin .lead-modal .ons-ld-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

body.admin .lead-modal .ons-ld-panel__head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-height: var(--ctl-h);
}

body.admin .lead-modal .ons-ld-panel__head:empty {
  display: none;
}

/* The table sits flush in its card; the DataTables toolbar rows bring their
   own 24px inset, so no extra padding is added around them. */
body.admin .lead-modal .ons-ld-panel > .ons-card--flush > .dataTables_wrapper,
body.admin .lead-modal .ons-ld-panel > .ons-card--flush > div > .dataTables_wrapper {
  margin: 0;
}

body.admin .lead-modal .ons-ld-panel .dataTables_wrapper > .row:first-child {
  padding-top: 0;
}

/* --- tasks panel ---------------------------------------------------------
   The platform helper prints the filters, the new-task button, a rule and the
   table as one flat block, so the head row is composed with grid placement
   instead of markup. */
/* The tasks panel uses the shared head/table split; the captured helper output
   keeps its own markup, only the leftover rule and clearfix are dropped. */
body.admin .lead-modal .ons-ld-panel--tasks > .ons-ld-panel__head > #tasksFilters {
  float: none !important;
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
}

body.admin .lead-modal .ons-ld-panel--tasks > .ons-ld-panel__head > .new-task-relation {
  float: none !important;
  margin: 0 !important;
}

body.admin .lead-modal .ons-ld-panel__table {
  min-width: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

body.admin .lead-modal .ons-ld-panel__table > hr,
body.admin .lead-modal .ons-ld-panel__table > .clearfix {
  display: none;
}

/* --- empty state (states.html) ------------------------------------------ */

/* The table primitives left-align every cell at a higher weight, so the empty
   row states its centring at the same weight. */
body.admin .lead-modal .dataTables_wrapper td.dataTables_empty {
  padding: 44px 24px 48px;
  text-align: center !important;
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

body.admin .lead-modal .dataTables_wrapper td.dataTables_empty::before {
  content: "\f07b";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  border-radius: var(--r-lg);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 20px;
}

body.admin .lead-modal .ons-ld-empty {
  padding: 40px 24px;
}

/* --- attachments --------------------------------------------------------- */

body.admin .lead-modal #lead-attachment-upload.ons-dropzone {
  margin: 0;
  min-height: 0;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  padding: 28px;
}

body.admin .lead-modal #lead-attachment-upload .dz-message {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--fs-sm);
}

body.admin .lead-modal .ons-ld-files {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

body.admin .lead-modal .ons-ld-files .lead-attachment-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}

body.admin .lead-modal .ons-ld-files .lead-attachment-wrapper:last-child {
  border-bottom: 0;
}

body.admin .lead-modal #dropbox-chooser-lead:empty {
  display: none;
}

/* --- gdpr ---------------------------------------------------------------- */

body.admin .lead-modal .ons-ld-setting--stack {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

/* ==========================================================================
   1.3.0 lot C — leads setup pages
   admin/leads/manage_sources, manage_statuses, forms, formbuilder, and the
   lead attachments list (leads_attachments_template). The .ons-lset list
   rules are also used by the knowledge base groups page (pages/kb.css).
   ========================================================================== */

/* --- list cards (sources, statuses, web-to-lead forms) -------------------- */

body.admin .ons-lset > .ons-card > .ons-card__head {
  padding-bottom: 14px;
}

body.admin .ons-lset .ons-card__sub a {
  color: var(--accent-text);
  font-weight: var(--fw-medium);
}

body.admin .ons-lset__table th.num,
body.admin .ons-lset__table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

body.admin .ons-lset__table .ons-lset__id {
  width: 64px;
  color: var(--fg-muted);
}

body.admin .ons-lset__table th.options {
  width: 96px;
}

body.admin .ons-lset__status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body.admin .ons-lset__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c, var(--fg-faint));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--c, var(--fg-faint)) 18%, transparent);
}

body.admin .ons-lset__name,
body.admin a.ons-lset__name {
  color: var(--fg);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

body.admin a.ons-lset__name:hover {
  color: var(--accent-text);
}

body.admin .ons-lset__sub {
  display: block;
  max-width: 520px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-muted);
  font-size: var(--fs-xs);
}

/* Row actions: quiet until the row is hovered (settings.html). */
body.admin .ons-lset__actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: .55;
  transition: opacity var(--dur-fast);
}

body.admin .ons-lset__table tbody tr:hover .ons-lset__actions,
body.admin .ons-lset__actions:focus-within {
  opacity: 1;
}

body.admin .ons-lset__actions .ons-btn--icon {
  width: var(--ctl-h-sm);
  padding: 0;
  color: var(--fg-muted);
}

body.admin .ons-lset__actions .ons-btn--icon:hover {
  color: var(--fg);
}

body.admin .ons-lset__actions .ons-lset__del:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

body.admin .ons-lset .ons-empty__title {
  font-size: var(--fs-md);
}

/* --- web-to-lead form builder --------------------------------------------- */

body.admin .ons-lform .ons-page-head__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.admin .ons-lform__narrow {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

body.admin .ons-lform__wide {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

body.admin .ons-lform__tabs {
  margin: 0;
}

body.admin .ons-lform .tab-content > .tab-pane > .ons-card {
  margin: 0;
}

/* The information form keeps a readable measure inside the wide page. */
body.admin .ons-lform__wide .ons-lform__info {
  max-width: 880px;
}

body.admin .ons-lform__subtabs {
  padding: 0 12px;
}

body.admin .ons-lform__subtabs .ons-tabs {
  margin: 0;
}

body.admin .ons-lform__info .tab-content.ons-card__body {
  padding-top: 20px;
}

body.admin .ons-lform__foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The builder mounts its own two-pane editor (field list + canvas). */
body.admin .ons-lform__builder .ons-card__body {
  padding: var(--card-pad);
}

body.admin .ons-lform #build-wrap .form-wrap.form-builder .stage-wrap {
  border-radius: var(--r-lg);
}

/* Field rows on the canvas follow the surface tokens so they stay legible in dark mode. */
body.admin .ons-lform #build-wrap .form-wrap.form-builder .frmb > li.form-field {
  border-radius: var(--r-md);
  background-color: var(--bg-surface);
  color: var(--fg);
}

body.admin .ons-lform #build-wrap .form-wrap.form-builder .frmb .form-elements {
  background-color: var(--bg-subtle);
  border-color: var(--border);
}

body.admin .ons-lform #build-wrap .cb-wrap .frmb-control li {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--fg);
  box-shadow: none;
}

body.admin .ons-lform #build-wrap .cb-wrap .frmb-control li:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

/* The inline script moves the builder's save bar under the canvas. */
body.admin .ons-lform #tab_form_build .btn-bottom-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: var(--gap);
}

body.admin .ons-lform__code {
  min-height: 88px;
  font-family: var(--ons-font-mono);
  font-size: var(--fs-xs);
  background: var(--bg-sunken);
  color: var(--fg);
}

body.admin .ons-lform__h {
  margin: 22px 0 10px;
}

body.admin .ons-lform__links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.admin .ons-lform__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--fg);
  font-family: var(--ons-font-mono);
  font-size: var(--fs-xs);
  text-decoration: none;
}

body.admin .ons-lform__link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin .ons-lform__link i {
  color: var(--fg-muted);
}

body.admin .ons-lform__link:hover {
  border-color: var(--border-strong);
  color: var(--accent-text);
}

body.admin .ons-lform__note {
  display: block;
  margin-top: 20px;
}

body.admin .ons-lform__note p {
  margin: 0 0 6px;
}

body.admin .ons-lform__note p:last-child {
  margin-bottom: 0;
}

/* Select + "+" input groups (source, status): the flex input group leaves the
   bootstrap-select at its intrinsic width, so it takes the free space here. */
body.admin .ons-lform .input-group-select > .bootstrap-select.input-group-btn {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
}

/* --- lead attachments list (lead record, attachments tab) ----------------- */

body.admin .ons-lfiles {
  display: flex;
  flex-direction: column;
}

body.admin .ons-lfiles .ons-lfile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

body.admin .ons-lfiles .ons-lfile:last-child {
  border-bottom: 0;
}

body.admin .ons-lfile__ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
}

body.admin .ons-lfile__text {
  flex: 1 1 auto;
  min-width: 0;
}

body.admin .ons-lfile__text a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

body.admin .ons-lfile__text a:hover {
  color: var(--accent-text);
}

body.admin .ons-lfile__type {
  margin: 2px 0 0;
  color: var(--fg-muted);
  font-family: var(--ons-font-mono);
  font-size: var(--fs-2xs);
}

body.admin .ons-lfile__del {
  flex: none;
  width: var(--ctl-h-sm);
  padding: 0;
  color: var(--fg-muted);
}

body.admin .ons-lfile__del:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

@media (max-width: 720px) {
  body.admin .ons-lset__sub {
    max-width: 200px;
  }
}
/* ===== /1.3.0 lot C leads ===== */
