/* ============================================================
   SP Backend — Modern Dashboard Styles
   Only loaded for authenticated service-provider pages.
   ============================================================ */

/* ---------- Design tokens (CSS custom properties) ---------- */
:root {
  --sp-primary: #37b34a;
  --sp-primary-dark: #2e9a3f;
  --sp-primary-light: #e8f5ea;

  --sp-bg: #f4f6f9;
  --sp-surface: #ffffff;
  --sp-border: #e2e6ed;
  --sp-border-light: #f0f2f5;

  --sp-text: #1e2a3a;
  --sp-text-muted: #6b7a8d;
  --sp-text-light: #9aa5b4;

  --sp-success: #22c55e;
  --sp-warning: #f59e0b;
  --sp-danger: #ef4444;
  --sp-info: #3b82f6;

  --sp-radius: 12px;
  --sp-radius-sm: 8px;
  --sp-radius-lg: 16px;
  --sp-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sp-shadow-md: 0 4px 12px rgba(0,0,0,.07);
  --sp-shadow-lg: 0 8px 24px rgba(0,0,0,.09);

  --sp-font: "Rubik", system-ui, -apple-system, sans-serif;
  --sp-nav-width: 260px;
  --sp-topbar-height: 60px;
}

/* ---------- Global resets for SP pages --------------------- */
body.sp-backend {
  background-color: var(--sp-bg);
  font-family: var(--sp-font);
  color: var(--sp-text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar --------------------------------------- */
.sp-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--sp-topbar-height);
  background: var(--sp-surface);
  border-bottom: 1px solid var(--sp-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  box-shadow: var(--sp-shadow);
}

.sp-topbar .sp-brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--sp-text);
  text-transform: uppercase;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sp-topbar .sp-brand img {
  height: 28px;
  width: auto;
}

.sp-topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.sp-menu-toggle {
  background: none;
  border: none;
  font-size: 1.35rem;
  color: var(--sp-text);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: var(--sp-radius-sm);
  transition: background .15s;
}
.sp-menu-toggle:hover { background: var(--sp-border-light); }

/* ---------- Sidebar / offcanvas nav ---------------------- */
.sp-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sp-nav-width);
  background: var(--sp-surface);
  border-right: 1px solid var(--sp-border);
  z-index: 1040;
  transform: translateX(-100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sp-sidebar.open {
  transform: translateX(0);
}
.sp-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1039;
}
.sp-sidebar-backdrop.show { display: block; }

.sp-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sp-border);
}
.sp-sidebar-header .sp-brand {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--sp-text);
  text-transform: uppercase;
}
.sp-sidebar-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--sp-text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.sp-nav {
  list-style: none;
  padding: .75rem 0;
  margin: 0;
  flex: 1;
}
.sp-nav li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.25rem;
  color: var(--sp-text-muted);
  text-decoration: none;
  font-size: .925rem;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sp-nav li a:hover {
  background: var(--sp-bg);
  color: var(--sp-text);
}
.sp-nav li a.active {
  color: var(--sp-primary);
  background: var(--sp-primary-light);
  font-weight: 600;
}
.sp-nav li a i {
  width: 20px;
  text-align: center;
  font-size: .95rem;
}
.sp-nav-divider {
  height: 1px;
  background: var(--sp-border);
  margin: .5rem 1.25rem;
}

/* Username / footer inside sidebar */
.sp-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sp-border);
  font-size: .85rem;
  color: var(--sp-text-muted);
}

/* ---------- Desktop: show sidebar, hide topbar ------------ */
@media (min-width: 992px) {
  .sp-sidebar {
    transform: translateX(0);
    top: 0;
  }
  .sp-sidebar-backdrop { display: none !important; }
  .sp-sidebar-close { display: none; }

  .sp-topbar {
    display: none;
  }
  .sp-main {
    margin-left: var(--sp-nav-width);
  }
}

/* ---------- Main content area ----------------------------- */
.sp-main {
  padding: 1.25rem 1rem 2rem;
  max-width: 1200px;
}
@media (min-width: 992px) {
  .sp-main {
    padding: 1.5rem 2rem 3rem;
  }
}

/* ---------- Page header ----------------------------------- */
.sp-page-header {
  margin-bottom: 1.25rem;
}
.sp-page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--sp-text);
}
@media (min-width: 768px) {
  .sp-page-header h1 { font-size: 1.65rem; }
}
.sp-page-header p {
  color: var(--sp-text-muted);
  margin: .25rem 0 0;
  font-size: .9rem;
}

/* ---------- Cards ----------------------------------------- */
.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
  overflow: hidden;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.sp-card-lg {
  padding: 1.5rem;
}
.sp-card-flush {
  padding: 0;
}
.sp-card-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--sp-text);
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sp-card-header i { color: var(--sp-text-muted); }

/* ---------- Bid bar (dashboard top) ----------------------- */
.sp-bid-bar {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--sp-shadow);
  margin-bottom: 1rem;
}
.sp-bid-bar p {
  margin: 0;
  font-size: .925rem;
  color: var(--sp-text);
}
.sp-bid-bar select {
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  padding: .4rem 1.5rem .4rem .6rem;
  font-size: .9rem;
  font-weight: 500;
  background: var(--sp-bg);
  color: var(--sp-text);
  cursor: pointer;
  transition: border-color .15s;
  max-width: none;
}
.sp-bid-bar select:focus {
  border-color: var(--sp-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(55,179,74,.15);
}
.sp-bid-bar select.border-danger {
  border-color: var(--sp-danger);
}

/* ---------- Custom bid dropdown -------------------------- */
.bid-dropdown {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}
.bid-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  padding: .4rem 1rem .4rem .6rem;
  background: var(--sp-bg, #fff);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  color: var(--sp-text);
  transition: border-color .15s;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}
.bid-dropdown-trigger:hover,
.bid-dropdown.open .bid-dropdown-trigger {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px rgba(55,179,74,.15);
}
.bid-dropdown-caret {
  margin-left: 6px;
  font-size: .65em;
  opacity: .6;
}
.bid-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1050;
  min-width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  box-shadow: 0 4px 14px rgba(0,0,0,.13);
  margin-top: 3px;
  padding: 4px 0;
  display: none;
  -webkit-overflow-scrolling: touch;
}
.bid-dropdown.open .bid-dropdown-menu {
  display: block;
}
.bid-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  cursor: pointer;
  font-size: .85rem;
  white-space: nowrap;
  gap: 16px;
  color: var(--sp-text);
}
.bid-dropdown-item:hover {
  background: #f0f7f1;
}
.bid-dropdown-item.bdi-selected {
  background: #e6f4ea;
  font-weight: 600;
}
.bid-dropdown-item .bdi-price {
  flex-shrink: 0;
}
.bid-dropdown-item .bdi-delta {
  font-size: .8rem;
  font-weight: 500;
}
.bdi-delta-pos  { color: #1a8c3a; }
.bdi-delta-neg  { color: #c0392b; }
.bdi-delta-zero { color: #999; }

/* ---------- Credit indicator ------------------------------ */
.sp-credit {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .95rem;
  font-weight: 600;
}
.sp-credit-ok { color: var(--sp-success); }
.sp-credit-low { color: var(--sp-warning); }
.sp-credit-danger { color: var(--sp-danger); }

/* ---------- Tables ---------------------------------------- */
.sp-table-wrap {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  overflow: hidden;
  box-shadow: var(--sp-shadow);
}
.sp-table-wrap .table,
.sp-card-flush .table { margin-bottom: 0; }

.sp-table-wrap .table thead th,
.sp-card-flush .table thead th,
body.sp-backend .table thead th {
  background: var(--sp-bg);
  border-bottom: 2px solid var(--sp-border);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sp-text-muted);
  padding: .65rem .75rem;
  white-space: nowrap;
}
.sp-table-wrap .table tbody td,
.sp-card-flush .table tbody td,
body.sp-backend .table tbody td {
  padding: .65rem .75rem;
  vertical-align: middle;
  font-size: .9rem;
  border-color: var(--sp-border-light);
}
body.sp-backend .table-clickable tbody tr {
  cursor: pointer;
  transition: background .12s;
}
body.sp-backend .table-clickable tbody tr:hover {
  background: var(--sp-primary-light);
}

/* Scrollable table body */
.sp-table-scroll tbody {
  display: block;
  max-height: 500px;
  overflow-y: auto;
}
.sp-table-scroll thead,
.sp-table-scroll tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}
.sp-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ---------- Forms ----------------------------------------- */
.sp-form label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--sp-text);
  display: block;
  margin-bottom: .35rem;
}
.sp-form input[type="text"],
.sp-form input[type="tel"],
.sp-form input[type="email"],
.sp-form input[type="password"],
.sp-form input[type="number"],
.sp-form select,
.sp-form textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  font-size: .9rem;
  font-family: var(--sp-font);
  color: var(--sp-text);
  background: var(--sp-surface);
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: .75rem;
}
.sp-form input:focus,
.sp-form select:focus,
.sp-form textarea:focus {
  border-color: var(--sp-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(55,179,74,.12);
}
.sp-form textarea {
  resize: vertical;
  min-height: 80px;
}
.sp-form .form-hint {
  font-size: .8rem;
  color: var(--sp-text-muted);
  margin-top: -.5rem;
  margin-bottom: .75rem;
}

/* ---------- Buttons --------------------------------------- */
body.sp-backend .btn {
  font-weight: 500;
  font-size: .9rem;
  border-radius: var(--sp-radius-sm);
  padding: .5rem 1.1rem;
  transition: all .15s ease;
}
body.sp-backend .btn-primary {
  background: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
}
body.sp-backend .btn-primary:hover,
body.sp-backend .btn-primary:focus {
  background: var(--sp-primary-dark);
  border-color: var(--sp-primary-dark);
  box-shadow: 0 2px 8px rgba(55,179,74,.25);
}
body.sp-backend .btn-primary:active,
body.sp-backend .btn-primary.active,
body.sp-backend .show > .btn-primary.dropdown-toggle,
body.sp-backend .btn-check:checked + .btn-primary,
body.sp-backend .btn-check:active + .btn-primary,
body.sp-backend .btn-primary:not(:disabled):not(.disabled):active {
  background: var(--sp-primary-dark);
  border-color: var(--sp-primary-dark);
  color: #fff;
}
body.sp-backend .btn-outline-dark {
  border-color: var(--sp-border);
  color: var(--sp-text);
}
body.sp-backend .btn-outline-dark:hover {
  background: var(--sp-bg);
  border-color: var(--sp-text-muted);
}
body.sp-backend .btn-back {
  color: var(--sp-text-muted);
  text-decoration: none;
  font-size: .875rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem 0;
  transition: color .15s;
}
body.sp-backend .btn-back:hover { color: var(--sp-text); }

/* ---------- Search bar ------------------------------------ */
.sp-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
}
.sp-search input {
  flex: 1;
  max-width: 280px;
  min-width: 0;
  padding: .45rem .75rem;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  font-size: 1rem; /* 16px: anything smaller makes iOS Safari zoom the page on focus */
  transition: border-color .15s;
}
/* The magnifying glass is the submit button, stretched to the input's height. */
.sp-search__submit {
  flex: none;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  padding: 0;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  background: var(--sp-surface);
  color: var(--sp-text-light);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.sp-search__submit:hover { color: var(--sp-text); border-color: var(--sp-text-light); }
.sp-search input:focus,
.sp-search__submit:focus-visible {
  border-color: var(--sp-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(55,179,74,.12);
}

/* ---------- Period filter pills --------------------------- */
.sp-period-filter {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.sp-period-filter label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--sp-text-muted);
  white-space: nowrap;
}
.sp-period-filter select {
  padding: .35rem .6rem;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  font-size: .82rem;
  background: var(--sp-surface);
  color: var(--sp-text);
  cursor: pointer;
}
.sp-period-filter select:focus {
  border-color: var(--sp-primary);
  outline: none;
}

/* ---------- Date range filter ----------------------------- */
.sp-range-filter {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.sp-range-filter label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--sp-text-muted);
  white-space: nowrap;
  margin-bottom: 0;
}
.sp-range-filter select,
.sp-range-filter input[type="date"] {
  padding: .35rem .6rem;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  font-size: .82rem;
  background: var(--sp-surface);
  color: var(--sp-text);
  width: auto;
  cursor: pointer;
}
.sp-range-filter select:focus,
.sp-range-filter input[type="date"]:focus {
  border-color: var(--sp-primary);
  outline: none;
}
.sp-range-custom {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  font-size: .82rem;
}
.sp-range-custom.d-none {
  display: none;
}
@media (max-width: 575.98px) {
  .sp-range-filter,
  .sp-range-custom {
    width: 100%;
  }
  .sp-range-custom input[type="date"] {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* ---------- Lead status buttons (lead page) --------------- */
.sp-status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .55rem 1rem;
  border-radius: var(--sp-radius-sm);
  font-size: .875rem;
  font-weight: 500;
  border: 2px solid var(--sp-border);
  background: var(--sp-surface);
  color: var(--sp-text-muted);
  cursor: pointer;
  transition: all .2s ease;
  text-decoration: none;
}
.sp-status-btn:hover { border-color: var(--sp-text-light); }

.sp-status-btn-success:hover,
.sp-status-btn-success.selected {
  background: var(--sp-success);
  border-color: var(--sp-success);
  color: #fff;
}
.sp-status-btn-warning:hover,
.sp-status-btn-warning.selected {
  background: var(--sp-warning);
  border-color: var(--sp-warning);
  color: #fff;
}
.sp-status-btn-danger:hover,
.sp-status-btn-danger.selected {
  background: var(--sp-danger);
  border-color: var(--sp-danger);
  color: #fff;
}

/* ---------- Competition table ----------------------------- */
.sp-competition-table {
  font-size: .875rem;
}
.sp-competition-table th {
  font-weight: 600;
  color: var(--sp-text-muted);
  font-size: .78rem;
  text-transform: uppercase;
}

/* ---------- Invoice --------------------------------------- */
.sp-invoice-wrap {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 1.5rem;
  box-shadow: var(--sp-shadow);
}

/* ---------- Pagination ------------------------------------ */
body.sp-backend .pagination .page-link {
  border-radius: var(--sp-radius-sm);
  border: 1px solid var(--sp-border);
  color: var(--sp-text);
  margin: 0 2px;
  font-size: .85rem;
  padding: .35rem .65rem;
}
body.sp-backend .pagination .page-item.active .page-link {
  background: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
}

/* ---------- Prediction widget ----------------------------- */
.pw-pulse-dot {
  font-size: 0.5em;
  margin-right: 0.3rem;
  vertical-align: middle;
  --fa-beat-fade-scale: 1.1;
  --fa-animation-duration: 2.5s;
}
.pw-pulse-dot--green { color: #22c55e; }
.pw-pulse-dot--yellow { color: #d4a017; }
.pw-pulse-dot--red { color: var(--sp-danger); }

/* ---------- Prediction gauge ------------------------------- */
.pw-gauge-heading {
  margin-top: .5rem;
  font-size: .95rem;
  font-weight: 600;
}
.pw-gauge {
  position: relative;
  max-width: 420px;
  margin: .5rem 0;
  padding-bottom: 4px;  /* room for the thumb's overhang below the pill */
  font-size: .74rem;
}
/* The gap keeps the label row's solid backgrounds clear of the thumb's
   overhang, which otherwise flat-cuts the circle at the pill edge. */
.pw-gauge__top {
  position: relative;
  height: 1.2rem;
  margin-bottom: 5px;
}
.pw-gauge__top > span {
  position: absolute;
  white-space: nowrap;
  color: var(--sp-text-muted);
  transform: translateX(-50%);
  line-height: 1.2rem;
}
.pw-gauge__stable {
  left: 50%;
  font-weight: 600;
}
/* One trend color drives the fill, the thumb and both trend-colored labels. */
.pw-gauge--increase { --pw-trend: var(--sp-success); }
.pw-gauge--decrease { --pw-trend: var(--sp-danger); }
.pw-gauge__track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--sp-border-light);
  border: 1px solid var(--sp-border);
}
/* Required price under the bid floor: the stretch of track covering bids
   nobody can set is hatched out, from the left edge to the floor. */
.pw-gauge__unreachable {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px 0 0 999px;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 3px,
    var(--sp-border) 3px 5px
  );
  opacity: .7;
  z-index: 0;
}
.pw-gauge__center-line {
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  border-left: 2px dashed var(--sp-text-light);
  transform: translateX(-1px);
}
/* Soft fill from the stable line to the thumb; on tiny deltas the thumb
   simply covers it, so it never degenerates into a sliver. */
.pw-gauge__arrow {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: var(--pw-trend);
  border-radius: 999px;
  opacity: .35;
  z-index: 1;
}
/* Round slider thumb, trend-colored; dark when stable. */
.pw-gauge__marker {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pw-trend, var(--sp-text));
  border: 2px solid var(--sp-surface);
  box-shadow: var(--sp-shadow);
  transform: translate(-50%, -50%);
  z-index: 4;  /* above the label backgrounds, so it is never flat-cut */
}
.pw-gauge__change {
  font-weight: 600;
  color: var(--pw-trend);
  background: var(--sp-surface);
  padding: 0 4px;
  z-index: 3;
}
/* Bid-price ruler under the pill, on the exact same scale as the thumb.
   Tick marks hang from the pill; the required price sits dead center and
   the provider's own bid is the dark tick. */
.pw-gauge__ruler {
  position: relative;
  height: 1.5rem;
  margin-top: 4px;
}
.pw-gauge__tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  padding-top: 7px;
  font-size: .72rem;
  line-height: 1;
  white-space: nowrap;
  color: var(--sp-text-light);
}
.pw-gauge__tick::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 5px;
  background: var(--sp-border);
  transform: translateX(-50%);
}
.pw-gauge__tick--center {
  color: var(--sp-text-muted);
  font-weight: 600;
}
.pw-gauge__tick--center::before { background: var(--sp-text-light); }
.pw-gauge__tick--bid {
  color: var(--sp-text);
  font-weight: 600;
}
.pw-gauge__tick--bid::before { background: var(--sp-text); }
/* The bid floor, when the bid itself sits above it. */
.pw-gauge__tick--floor {
  color: var(--sp-text-muted);
  font-weight: 600;
}
.pw-gauge__tick--floor::before { background: var(--sp-text-light); }
.pw-gauge__tick--edge-min {
  transform: none;
  left: 0 !important;
}
.pw-gauge__tick--edge-min::before { left: 1px; transform: none; }
.pw-gauge__tick--edge-max {
  transform: none;
  left: auto !important;
  right: 0;
}
.pw-gauge__tick--edge-max::before { left: auto; right: 1px; transform: none; }

/* With a trend, the change label owns the top row, so "Stable" only shows
   when the gauge actually is stable and would otherwise sit under it. */
.pw-gauge--increase .pw-gauge__stable,
.pw-gauge--decrease .pw-gauge__stable { display: none; }
/* At the pill ends the change label switches from centered to edge-anchored
   so it never overflows the card. !important beats the inline left:X%. */
.pw-gauge--at-min .pw-gauge__change {
  transform: none;
  left: 0 !important;
}
.pw-gauge--at-max .pw-gauge__change {
  transform: none;
  left: auto !important;
  right: 0;
}

/* ---------- WhatsApp preview (account settings) ----------- */
/* The status bar is a real row, not an absolute overlay, so a tall bubble
   (long company name, wrapped lines) pushes the box taller instead of
   climbing over it. margin-top: auto keeps a short bubble at the bottom. */
.sp-wa-preview {
  background: #efeae2;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: .5rem .9rem 1rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.sp-wa-preview .statusbar {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--sp-text-muted);
}
.sp-wa-preview .bubble {
  align-self: flex-start;
  margin-top: auto;
  background: #dcf8c6;
  color: #111b21;
  border-radius: 12px 12px 4px 12px;
  padding: .65rem .8rem;
  max-width: 320px;
  font-size: .85rem;
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
  word-wrap: break-word;
}
.sp-wa-preview .timestamp {
  display: block;
  margin-top: .35rem;
  font-size: .7rem;
  color: #667781;
  text-align: right;
}

/* ---------- Stripe card form (payment) -------------------- */
.sp-stripe-card {
  max-width: 420px;
  padding: 1.25rem;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
}
#card-element {
  padding: .65rem .85rem;
  background: var(--sp-bg);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  transition: border-color .2s, box-shadow .2s;
}
#card-element.StripeElement--focus {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px rgba(55,179,74,.15);
}
#card-element.StripeElement--invalid {
  border-color: var(--sp-danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}

/* ---------- Amount buttons (payment) ---------------------- */
.sp-amount-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: .5rem 1rem;
  border: 2px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  background: var(--sp-surface);
  color: var(--sp-text);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.sp-amount-btn:hover {
  border-color: var(--sp-primary);
  color: var(--sp-primary);
}
.sp-amount-btn.disabled,
.sp-amount-btn.active {
  background: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
}

/* ---------- Onboarding progress bar ----------------------- */
.sp-progress-bar {
  height: 6px;
  background: var(--sp-border);
  border-radius: 3px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.sp-progress-bar-fill {
  height: 100%;
  background: var(--sp-primary);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ---------- Badge ----------------------------------------- */
.sp-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.sp-badge-success { background: var(--sp-primary-light); color: var(--sp-primary-dark); }
.sp-badge-warning { background: #fef3c7; color: #92400e; }
.sp-badge-danger { background: #fee2e2; color: #991b1b; }
.sp-badge-muted { background: var(--sp-bg); color: var(--sp-text-muted); }

/* ---------- Empty state ----------------------------------- */
.sp-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--sp-text-muted);
}
.sp-empty i {
  font-size: 2rem;
  margin-bottom: .75rem;
  display: block;
  opacity: .4;
}

/* ---------- Amount due panel (setup fee / one-time charges) ---- */
.sp-amount-due {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .6rem;
  background: var(--sp-primary-light);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
}
.sp-amount-due-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--sp-text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.sp-amount-due-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sp-primary-dark);
  line-height: 1.2;
}
.sp-amount-due-sub {
  flex-basis: 100%;
  font-size: .75rem;
  color: var(--sp-text-light);
}

/* ---------- Inline currency input -------------------------------
   .sp-currency-field works anywhere; the .sp-bid-bar selectors keep
   working for markup that predates the class. The [type="number"]
   selector is needed to outrank .sp-form input[type="number"] above. */
.sp-bid-bar .currency-container,
.sp-currency-field {
  position: relative;
  display: inline-block;
}
.sp-bid-bar .currency-symbol,
.sp-currency-field .currency-symbol {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .85rem;
  color: var(--sp-text-muted);
  pointer-events: none;
}
.sp-bid-bar .currency-container input,
.sp-currency-field input[type="number"] {
  border: 1px solid var(--sp-border);
  background: var(--sp-bg);
  border-radius: var(--sp-radius-sm);
  padding: .35rem .5rem .35rem 1.3rem;
  max-width: 80px;
  font-size: .9rem;
  font-weight: 500;
}
.sp-currency-field input[type="number"] {
  width: auto;
  max-width: 130px;
  margin-bottom: 0;
}

/* ---------- Loader animation (bid form) ------------------- */
.sp-loader {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 2px solid var(--sp-info);
  display: inline-block;
  vertical-align: middle;
}
.sp-loader .wave {
  position: absolute;
  width: 400%;
  height: 100%;
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg"><path fill="%233b82f6" d="M0 30 Q 25 10, 50 30 T 100 30 V50 H0 Z"/></svg>') repeat-x;
  background-size: 50% 100%;
  animation: sp-wave 4s linear infinite;
  bottom: 0;
}
@keyframes sp-wave {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------- Learning ring (bid settling) ------------------- */
.sp-learning-ring {
  position: relative;
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-right: .35rem;
  vertical-align: -.2em;
  border: 2px solid #d4a017;
  border-radius: 50%;
  overflow: hidden;
}
/* 200% wide with a 50% tile: sp-wave's translateX(-50%) is exactly one period, so the loop is seamless. */
.sp-learning-ring__wave {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="%23d4a017" stroke-width="8" d="M0 25 C 12.5 5, 37.5 5, 50 25 S 87.5 45, 100 25"/></svg>') repeat-x;
  background-size: 50% 100%;
  animation: sp-wave 2s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .sp-learning-ring__wave { animation: none; }
}

/* ---------- Mobile overrides ------------------------------ */
@media (max-width: 767.98px) {
  .sp-main { padding: 1rem .75rem 2rem; }

  .sp-card:not(.sp-card-flush) { padding: 1rem; }  /* flush cards keep their own padding: 0 */

  .sp-bid-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .sp-search input { max-width: 100%; }

  /* Ensure touch targets are large enough */
  body.sp-backend .btn { min-height: 44px; }
  .sp-nav li a { padding: .85rem 1.25rem; }
}

/* ---------- Pulse animation for lead price column --------- */
@keyframes sp-pulse-font {
  0%, 100% { color: #0094b9; }
  50% { color: #de9e00; }
}
.sp-pulse-font {
  animation: sp-pulse-font 7s infinite;
}

/* ---------- Transcript (lead page) ------------------------ */
.sp-transcript { line-height: 1.6; }
.sp-transcript .turn.agent {
  background: #f0f8ff;
  padding: .35rem .5rem;
  border-left: 3px solid #007acc;
  margin-bottom: .35rem;
}
.sp-transcript .turn.user {
  background: #fff8f0;
  padding: .35rem .5rem;
  border-left: 3px solid #e67300;
  margin-bottom: .35rem;
}

/* ---------- Auto-refill form (payment page) --------------- */
.sp-refill-form .form-hint {
  font-size: .8rem;
  color: var(--sp-text-muted);
  margin-top: -.5rem;
  margin-bottom: .75rem;
}
.sp-refill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}
.sp-refill-field {
  min-width: 0;
}
.sp-refill-label {
  font-size: .85rem;
  color: var(--sp-text);
  margin-bottom: .35rem;
  display: block;
  font-weight: 600;
}
.sp-refill-form .sp-refill-select {
  width: 100%;
}
.sp-custom-wrap {
  position: relative;
  margin-top: .45rem;
}
.sp-custom-currency {
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sp-text-muted);
  font-size: .85rem;
  pointer-events: none;
}
.sp-custom-input {
  width: 100%;
  padding: .55rem .75rem .55rem 1.45rem;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  font-size: .9rem;
  font-family: var(--sp-font);
  color: var(--sp-text);
  background: var(--sp-surface);
}
.sp-custom-input:focus {
  border-color: var(--sp-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(55,179,74,.12);
}

/* Backward compatibility if older markup is still present */
.sp-refill-form .inline-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 500;
}
@media (max-width: 991.98px) {
  .sp-refill-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 767.98px) {
  .sp-refill-form .inline-group {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Account switcher: a POST button that has to read as a sidebar link.
   Switching changes session state, so it cannot be an anchor. */
.sp-nav-heading {
  padding: .35rem 1.25rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--sp-text-muted);
  opacity: .75;
}
.sp-nav-switch {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .7rem 1.25rem;
  background: none;
  border: 0;
  text-align: left;
  color: var(--sp-text-muted);
  font-size: .925rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sp-nav-switch:hover {
  background: var(--sp-bg);
  color: var(--sp-text);
}
.sp-nav-switch i {
  width: 20px;
  text-align: center;
  font-size: .95rem;
}

/* ============================================================
   Dashboard components (mobile-first). Reusable building blocks
   for every backend page: page header with filters, flash
   alerts, status card, KPI tiles, filter chips, lead rows,
   pager and the collapsible card.
   ============================================================ */

/* ---------- Page header with filters ----------------------- */
.sp-page-header--filters { display: flex; flex-direction: column; gap: .75rem; }
.sp-filters { display: flex; flex-wrap: wrap; gap: .5rem .75rem; }
@media (min-width: 768px) {
  .sp-page-header--filters { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}

/* ---------- Period chips ---------------------------------- */
.sp-period { margin: -.25rem 0 1rem; }
/* .sp-chips (defined later) pads the row for the lead card; here the row sits on the page. */
.sp-chips.sp-period__chips { padding: .15rem 0; gap: .35rem; }
.sp-period__chips .sp-chip { min-height: 30px; padding: 0 .65rem; font-size: .78rem; }
.sp-period__chips .sp-chip i { font-size: .7rem; }
.sp-period__custom { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; font-size: .85rem; }
.sp-period__custom .form-control { width: auto; }
@media (max-width: 575.98px) {
  .sp-period__custom .form-control { flex: 1 1 0; min-width: 0; }
}

/* ---------- Flash messages / alerts ----------------------- */
body.sp-backend .alert {
  border-radius: var(--sp-radius-sm);
  font-size: .9rem;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
body.sp-backend .alert a { font-weight: 600; color: inherit; }

/* ---------- Cards: a title inside a card ------------------- */
.sp-card__title { font-size: 1.1rem; font-weight: 700; margin-bottom: .35rem; }
.sp-accent { color: var(--sp-primary); }

/* ---------- Status card ----------------------------------- */
.sp-strip { padding: 0; }
.sp-cell { padding: 1rem 1.25rem; min-width: 0; }
.sp-cell__label {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--sp-text-muted);
}
.sp-cell__label a, .sp-toggle {
  font-size: .82rem; font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--sp-primary-dark); text-decoration: none;
}
.sp-toggle {
  background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35rem;
}
.sp-toggle i { font-size: .7rem; transition: transform .15s; }
.sp-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.sp-cell__value {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .25rem;
  font-size: 1.3rem; font-weight: 700; line-height: 1.2; color: var(--sp-text);
}
.sp-cell__value-note, .sp-cell__unit { font-size: .9rem; font-weight: 500; color: var(--sp-text-muted); }
.sp-cell__sub { margin-top: .25rem; font-size: .85rem; color: var(--sp-text-muted); }
.sp-cell__summary {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .5rem;
  font-size: .85rem; color: var(--sp-text-muted);
}
.sp-cell__summary strong { color: var(--sp-text); font-weight: 600; }
.sp-cell__cta { margin-top: .75rem; }
.sp-cell--ads .pw-gauge { margin: .75rem 0 0; }
.sp-state-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.sp-state-dot--on { background: var(--sp-success); box-shadow: 0 0 0 4px var(--sp-primary-light); }
.sp-state-dot--off { background: var(--sp-danger); box-shadow: 0 0 0 4px #fee2e2; }
.sp-strip__details { border-top: 1px solid var(--sp-border-light); }
.sp-strip__details .sp-cell + .sp-cell { border-top: 1px solid var(--sp-border-light); }
@media (min-width: 768px) {
  .sp-strip__details.show, .sp-strip__details.collapsing {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sp-strip__details .sp-cell + .sp-cell { border-top: 0; border-left: 1px solid var(--sp-border-light); }
  /* Text left, gauge right; the gauge wraps under the text when the cell is narrow. */
  .sp-cell--ads { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 2rem; }
  .sp-cell--ads > .sp-cell__main { flex: 1 1 260px; min-width: 0; }
  .sp-cell--ads > .pw-gauge { flex: 1 1 260px; max-width: 460px; margin: 0; }
}

/* ---------- KPI tiles ------------------------------------- */
.sp-kpi-caption { font-size: .8rem; color: var(--sp-text-muted); margin: 0 0 .5rem; }
.sp-kpi-caption a { color: var(--sp-primary-dark); font-weight: 500; text-decoration: none; white-space: nowrap; }
.sp-kpi-caption a:hover { text-decoration: underline; }
.sp-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.sp-kpi {
  background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow); padding: .65rem .7rem; min-width: 0;
}
.sp-kpi--hero { border-top: 3px solid var(--sp-primary); }
.sp-kpi__label {
  font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--sp-text-muted); line-height: 1.25;
}
.sp-kpi__value { font-size: 1.2rem; font-weight: 700; line-height: 1.2; margin-top: .25rem; white-space: nowrap; color: var(--sp-text); }
.sp-kpi--hero .sp-kpi__value { color: var(--sp-primary-dark); }
.sp-kpi__note { font-size: .72rem; color: var(--sp-text-muted); margin-top: .3rem; line-height: 1.3; }
@media (min-width: 768px) {
  .sp-kpi-grid { gap: .75rem; }
  .sp-kpi { padding: .85rem .9rem; }
  .sp-kpi__label { font-size: .72rem; }
  .sp-kpi__value { font-size: 1.4rem; }
  .sp-kpi__note { font-size: .75rem; }
}
@media (min-width: 992px) {
  .sp-kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- Filter chips ---------------------------------- */
.sp-chips { display: flex; gap: .5rem; overflow-x: auto; padding: .15rem 1.25rem; scrollbar-width: none; }
.sp-chips::-webkit-scrollbar { display: none; }
.sp-chip {
  flex: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: 0 .8rem;
  border-radius: 999px; border: 1px solid var(--sp-border); background: var(--sp-surface);
  color: var(--sp-text); font-size: .82rem; font-weight: 500; text-decoration: none;
}
.sp-chip:hover { color: var(--sp-text); border-color: var(--sp-text-light); }
.sp-chip__count { font-size: .75rem; color: var(--sp-text-muted); }
.sp-chip--active, .sp-chip--active:hover { background: var(--sp-text); border-color: var(--sp-text); color: #fff; }
.sp-chip--active .sp-chip__count { color: rgba(255,255,255,.7); }

/* ---------- Lead list ------------------------------------- */
.sp-leads__head { padding: 1rem 1.25rem .5rem; }
.sp-leads__head h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.sp-leads__count { font-size: .85rem; font-weight: 500; color: var(--sp-text-muted); margin-left: .4rem; }
.sp-leads__toolbar { display: flex; flex-direction: column; gap: .65rem; padding: 0 0 .75rem; }
.sp-leads .sp-search { margin: 0 1.25rem; }
.sp-svg-defs { position: absolute; }
.sp-lead-head { display: none; }
.sp-lead-day {
  padding: .5rem 1.25rem .35rem; font-size: .72rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: var(--sp-text-muted); background: var(--sp-bg);
  border-top: 1px solid var(--sp-border-light);
}
.sp-lead-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 18px;
  grid-template-areas: "num who right chev" "num extra right chev";
  align-items: center; column-gap: .5rem; row-gap: .1rem;
  padding: .6rem .6rem .6rem 0; min-height: 60px;
  border-top: 1px solid var(--sp-border-light); border-left: 3px solid transparent;
  color: inherit; text-decoration: none;
}
a.sp-lead-row:hover { background: var(--sp-primary-light); color: inherit; }
.sp-lead-row--info { border-left-color: var(--sp-info); }
.sp-lead-row--warning { border-left-color: var(--sp-warning); }
.sp-lead-row--success { border-left-color: var(--sp-success); }
.sp-lead-row--danger { border-left-color: var(--sp-danger); }
.sp-lead-row__num {
  grid-area: num; text-align: center; font-size: .75rem; font-weight: 600;
  color: var(--sp-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.sp-lead-row__img { display: block; margin-top: .2rem; font-size: .8rem; color: var(--sp-text-light); }
.sp-lead-row__who { grid-area: who; min-width: 0; }
.sp-lead-row__name { display: block; font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-lead-row__name s { color: var(--sp-text-muted); font-weight: 500; }
.sp-lead-row__meta { display: block; font-size: .78rem; color: var(--sp-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-lead-row__car, .sp-lead-row__where { display: none; }
.sp-lead-row__extra { grid-area: extra; font-size: .78rem; color: var(--sp-text-muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-lead-row__reg { color: var(--sp-text-muted); font-variant-numeric: tabular-nums; }
.sp-lead-row__source { display: inline-flex; align-items: center; gap: .3rem; color: var(--sp-text); }
.sp-lead-row__source .fa-meta { color: #0866FF; }
.sp-lead-row__right { grid-area: right; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.sp-lead-row__profit { font-weight: 600; color: var(--sp-primary-dark); font-variant-numeric: tabular-nums; }
.sp-lead-row__status { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; }
.sp-lead-row__opened { font-size: .72rem; color: var(--sp-text-muted); white-space: nowrap; }
.sp-lead-row__chev { grid-area: chev; color: var(--sp-text-light); font-size: .8rem; }
.sp-lead-row--locked { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: none; background: #fffaf0; padding-left: .85rem; gap: .75rem; }
.sp-lead-row--locked .sp-lead-row__text { font-size: .8rem; color: var(--sp-text-muted); }
.sp-badge-info { background: #dbeafe; color: #1d4ed8; }
.sp-badge-opened {
  background: none; padding: 0; text-transform: none; letter-spacing: 0;
  font-weight: 500; font-size: .78rem; color: var(--sp-text-muted); gap: .3rem;
}
@media (min-width: 992px) {
  .sp-leads__toolbar { flex-direction: row; align-items: center; justify-content: space-between; padding: 0 1.25rem .75rem; }
  .sp-chips { padding: .15rem 0; flex: 1; min-width: 0; }
  .sp-leads .sp-search { margin: 0; flex: none; }
  .sp-lead-head, .sp-lead-row {
    grid-template-columns: 56px minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(0, .9fr) 110px 90px 150px 28px;
    grid-template-areas: none; column-gap: .75rem; padding-right: .5rem;
  }
  .sp-lead-head {
    display: grid; padding: .55rem .5rem .55rem 0; border-left: 3px solid var(--sp-text);
    background: var(--sp-text); color: #fff; font-size: .7rem; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
  }
  .sp-lead-head > span:first-child { text-align: center; }
  .sp-lead-head__right { text-align: right; }
  .sp-lead-row { min-height: 56px; padding-top: .5rem; padding-bottom: .5rem; }
  .sp-lead-row__num, .sp-lead-row__who, .sp-lead-row__extra, .sp-lead-row__right, .sp-lead-row__chev { grid-area: auto; }
  .sp-lead-row__car, .sp-lead-row__where { display: block; font-size: .9rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sp-lead-row__where { color: var(--sp-text-muted); }
  .sp-lead-row__extra { font-size: .9rem; }
  .sp-lead-row__m-only { display: none; }
  .sp-lead-row__right { display: contents; }
  .sp-lead-row__profit, .sp-lead-row__status { text-align: right; }
  .sp-lead-row--locked { grid-template-columns: auto minmax(0, 1fr); }
}

/* Below the sidebar layout the list runs edge to edge: it is the page, not a card
   on it. The negative margins undo .sp-main's side padding at each width. */
@media (max-width: 991.98px) {
  .sp-leads { margin-left: -1rem; margin-right: -1rem; border-left: 0; border-right: 0; border-radius: 0; }
}
@media (max-width: 767.98px) {
  .sp-leads { margin-left: -.75rem; margin-right: -.75rem; }
}

/* ---------- Pager ----------------------------------------- */
.sp-pager {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 1.25rem; border-top: 1px solid var(--sp-border-light);
  font-size: .82rem; color: var(--sp-text-muted);
}
.sp-pager__btns { display: flex; gap: .4rem; }

/* ---------- Collapsible card ------------------------------ */
.sp-collapse { margin-bottom: 1rem; }
.sp-collapse__toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .85rem 1.25rem; background: none; border: 0; font: inherit; font-size: .9rem;
  font-weight: 600; color: var(--sp-text); cursor: pointer; text-align: left;
}
.sp-collapse__toggle i { font-size: .75rem; color: var(--sp-text-muted); transition: transform .15s; }
.sp-collapse__toggle[aria-expanded="true"] i { transform: rotate(180deg); }
/* Spacing lives on the body, not on `.collapse`: Bootstrap swaps that class for
   `collapsing` during the animation, so anything keyed on it would snap in afterwards. */
.sp-collapse__body { padding: 0; }
.sp-collapse__body .table { width: 100%; margin-bottom: 0; }
.sp-collapse__body .table th:first-child, .sp-collapse__body .table td:first-child { padding-left: 1.25rem; }
.sp-collapse__body .table th:last-child, .sp-collapse__body .table td:last-child { padding-right: 1.25rem; }
.sp-collapse__note { font-size: .75rem; color: var(--sp-text-muted); margin: 0; padding: .6rem 1.25rem .9rem; }
.sp-competition-table__you td { font-weight: 600; color: var(--sp-primary-dark); }
