/* ==========================================================
 * Client List — list view
 *
 * Aesthetic: Refined Editorial Dashboard. Matches the My View page —
 * one large white card on a soft grey-blue page bg, generous whitespace,
 * crisp typographic rhythm, restrained orange accents (only on the
 * brand wordmark, primary CTAs, status pills, active filter chips, and
 * the "open dashboard" eye icon). Tables follow the existing
 * proagri-sheet.css convention: 10px uppercase letter-spaced muted-grey
 * column headers, very thin row separators, neutral hover.
 *
 * Token scope: only the global tokens declared in ui/css/styles.css.
 * No new variables, no new fonts.
 * ========================================================== */

/* ===== Page shell — large white card on grey-blue bg ===== */
.cl-list-page {
  background: var(--card-bg);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  width: 100%;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

/* ===== Header row ===== */
.cl-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}

.cl-list-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.cl-list-title {
  margin: 0;
  font-family: var(--font-family);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.1;
}

.cl-list-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 9px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.cl-list-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Search input ===== */
.cl-list-search {
  background: var(--color-secondary);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
  width: 260px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cl-list-search::placeholder { color: var(--text-muted); }
.cl-list-search:focus {
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.12);
}

/* ===== Buttons =====
 * Primary: orange gradient; Secondary: white ghost; Danger: red. */
.cl-list-btn {
  background: var(--color-secondary);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.cl-list-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.22);
}
.cl-list-btn:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}
.cl-list-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cl-list-btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(212, 121, 26, 0.18);
}
.cl-list-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  border-color: transparent;
}

/* Add Client primary CTA — Agri360 orange gradient (the page's single
 * strongest action). Same shape/padding as .cl-list-btn-primary. */
.cl-list-btn-add-client {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(212, 121, 26, 0.22);
}
.cl-list-btn-add-client:hover:not(:disabled) {
  filter: brightness(1.05);
  border-color: transparent;
}

.cl-list-btn-danger {
  background: #c23b3b;
  color: #fff;
  border-color: #c23b3b;
}
.cl-list-btn-danger:hover:not(:disabled) {
  background: #a83333;
  border-color: #a83333;
}

/* ===== Filter panel ===== */
.cl-filter-panel {
  background: rgba(0, 0, 0, 0.015);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 18px 20px;
}

.cl-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.cl-filter-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cl-filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.cl-filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cl-filter-chip {
  background: var(--color-secondary);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cl-filter-chip:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}
.cl-filter-chip.active {
  background: rgba(245, 166, 35, 0.12);
  color: var(--color-accent-dark);
  border-color: rgba(245, 166, 35, 0.4);
}

.cl-filter-empty {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

.cl-filter-select {
  background: var(--color-secondary);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-family);
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cl-filter-select:focus {
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.12);
}

.cl-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ===== Bulk action bar ===== */
.cl-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(245, 166, 35, 0.06);
  border: 1px solid rgba(245, 166, 35, 0.22);
  border-radius: 10px;
  flex-wrap: wrap;
}
.cl-bulk-count {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.cl-bulk-link {
  color: var(--color-accent-dark);
  font-size: 12px;
  margin-left: 4px;
  text-decoration: underline;
  cursor: pointer;
}
.cl-bulk-link:hover { color: var(--color-accent-light); }

/* ===== Sheet — clean white table ===== */
.cl-sheet-wrap {
  width: 100%;
  margin-top: 4px;
}

.cl-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--color-secondary);
  overflow: visible;
}

.cl-sheet-row {
  display: grid;
  grid-template-columns: 36px 36px minmax(220px, 1.6fr) minmax(160px, 1.2fr) minmax(220px, 1.4fr) minmax(140px, 1fr) 150px 36px;
  gap: 12px;
  padding: 16px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  align-items: center;
  position: relative;
}
.cl-sheet-row:last-child {
  border-bottom: none;
}
.cl-sheet-row:not(.cl-sheet-head):hover {
  background: rgba(0, 0, 0, 0.018);
}

/* Hover-only scrape icon: appears when the row is hovered */
.cl-sheet-row:not(.cl-sheet-head):hover .cl-scrape-btn {
  opacity: 1;
  pointer-events: auto;
}

/* Hover-only checkbox in the body rows: appears on row-hover, or when row is selected */
.cl-sheet-row:not(.cl-sheet-head) .cl-cell-select input[type="checkbox"] {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.cl-sheet-row:not(.cl-sheet-head):hover .cl-cell-select input[type="checkbox"],
.cl-sheet-row:not(.cl-sheet-head) .cl-cell-select input[type="checkbox"]:checked,
.cl-sheet-row:not(.cl-sheet-head) .cl-cell-select input[type="checkbox"]:focus-visible {
  opacity: 1;
}

.cl-sheet-head {
  /* Operations-console sheet header: sticky, soft grey-blue strip, muted
     uppercase letter-spaced labels (#6b7280 on #f8f9fb). Matches the
     production/editorial dept sheets. */
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8f9fb;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px 8px 0 0;
  padding: 12px 4px;
  align-items: center;
}
/* Master checkbox in the header is always visible */
.cl-sheet-head .cl-cell-select input[type="checkbox"] {
  opacity: 1 !important;
}
.cl-sheet-head .cl-sheet-cell {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  word-break: normal;
}

.cl-sheet-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  word-break: break-word;
  white-space: normal;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.cl-cell-select,
.cl-cell-eye,
.cl-cell-trash {
  align-items: center;
  justify-content: center;
  flex-direction: row;
}
.cl-cell-select input[type="checkbox"] {
  cursor: pointer;
  width: 15px;
  height: 15px;
  accent-color: var(--color-accent-light);
}

/* Sortable header cell */
.cl-sortable {
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  user-select: none;
  transition: color 0.15s ease;
}
.cl-sort-label { flex: 0 0 auto; }
.cl-sort-arrow {
  font-size: 9px;
  color: rgba(0, 0, 0, 0.25);
  visibility: hidden;
  line-height: 1;
}
.cl-sort-arrow.active {
  visibility: visible;
  color: var(--color-accent-light);
}
.cl-sortable:hover {
  color: var(--text-secondary);
}
.cl-sortable:hover .cl-sort-arrow {
  visibility: visible;
  color: var(--text-muted);
}
.cl-sortable:hover .cl-sort-arrow.active {
  color: var(--color-accent-light);
}

/* Eye icon button — neutral icon button (matches proagri-sheet-row-action-btn pattern) */
.cl-eye-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.cl-eye-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}
.cl-eye-btn:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}

/* Trash icon button — neutral, red on hover */
.cl-trash-btn {
  background: transparent;
  border: none;
  color: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.cl-trash-btn:hover {
  color: #c23b3b;
  background: rgba(194, 59, 59, 0.06);
}

/* Name cell with stacked tag pills */
.cl-cell-name {
  align-items: flex-start;
  word-break: break-word;
  gap: 5px;
}
/* Rating badge stacks ABOVE the client name (small, left-aligned). */
.cl-name-line {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
.cl-name-text {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.35;
}
.cl-name-rating {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.cl-tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cl-tag-pill {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  line-height: 1.5;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cl-tag-pill:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
}

/* Booking-form / regular client tag — pastel green */
.cl-tag-pill.cl-tag-booking-form-client,
.cl-tag-pill.cl-tag-client {
  background: rgba(39, 174, 96, 0.1);
  color: #1e7a48;
  border-color: rgba(39, 174, 96, 0.22);
}
.cl-tag-pill.cl-tag-booking-form-client:hover,
.cl-tag-pill.cl-tag-client:hover {
  background: rgba(39, 174, 96, 0.16);
}

/* Agri4all-only tag — pastel purple */
.cl-tag-pill.cl-tag-agri4all-product-upload-client,
.cl-tag-pill.cl-tag-agri4all-upload-only {
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.22);
}
.cl-tag-pill.cl-tag-agri4all-product-upload-client:hover,
.cl-tag-pill.cl-tag-agri4all-upload-only:hover {
  background: rgba(124, 58, 237, 0.16);
}

/* Industry pill in row */
.cl-cell-industry {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  cursor: pointer;
}
.cl-industry-chip {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  line-height: 1.5;
}

/* Website cell */
.cl-cell-website {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
/* Coloured rounded "View Website" button — colour carries scrape status */
.cl-website-view {
  background: var(--color-accent-light); /* default: orange = awaiting scrape */
  border: 1px solid transparent;
  color: #fff;
  border-radius: 14px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s ease, background 0.15s ease;
}
.cl-website-view:hover {
  filter: brightness(1.05);
}
.cl-website-view.scraped {
  background: #27ae60; /* green = scraped */
}

/* Scrape button as icon-only, hidden until row hover */
.cl-scrape-btn {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--text-muted);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 12px;
  font-family: var(--font-family);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cl-scrape-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  border-color: rgba(0, 0, 0, 0.22);
}
.cl-scrape-btn:disabled {
  opacity: 0.55 !important;
  cursor: not-allowed;
}
.cl-scrape-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Legacy status pill — retained class but rendered invisible (button colour carries status now) */
.cl-website-pill {
  display: none;
}

.cl-link-btn {
  background: transparent;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-family);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.cl-link-btn:hover {
  border-color: var(--color-accent-light);
  color: var(--color-accent-dark);
}

/* Team avatars */
.cl-cell-team {
  flex-direction: row;
}
.cl-avatar-stack {
  display: flex;
  align-items: center;
}
.cl-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-left: -6px;
  border: 2px solid var(--color-secondary);
  position: relative;
  cursor: default;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.cl-avatar:first-child { margin-left: 0; }
.cl-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cl-avatar:hover {
  z-index: 10;
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.cl-avatar-overflow {
  background: rgba(0, 0, 0, 0.12);
  color: var(--text-secondary);
}
.cl-avatar-tooltip {
  position: fixed;
  background: #1a1a1a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}
.cl-avatar-tt-name { font-weight: 700; font-size: 13px; }
.cl-avatar-tt-role { color: #cbd5e1; margin-top: 2px; font-size: 11px; }
.cl-avatar-tt-email { color: #94a3b8; font-size: 11px; margin-top: 2px; }

/* Created cell */
.cl-cell-created {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.cl-muted-cell {
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Empty / error states ===== */
.cl-empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.cl-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(194, 59, 59, 0.05);
  border: 1px solid rgba(194, 59, 59, 0.22);
  color: #b91c1c;
  border-radius: 10px;
  font-size: 13px;
  gap: 12px;
}

/* ===== Modals ===== */
.cl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: cl-modal-fade 0.18s ease;
}
@keyframes cl-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cl-modal {
  background: var(--color-secondary);
  border-radius: 14px;
  padding: 24px 26px 22px;
  min-width: 360px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06);
  animation: cl-modal-pop 0.2s ease;
}
@keyframes cl-modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cl-modal-add-client {
  width: 480px;
}

.cl-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}

.cl-modal-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.cl-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Trash modal — two-column delete vs archive */
.cl-trash-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) {
  .cl-trash-twocol { grid-template-columns: 1fr; }
}
.cl-trash-col {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.012);
}
.cl-trash-col-danger {
  border-color: rgba(194, 59, 59, 0.22);
  background: rgba(194, 59, 59, 0.025);
}
.cl-trash-col-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.cl-trash-col-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

/* Form fields */
.cl-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 4px;
}
.cl-field-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cl-field-input {
  background: var(--color-secondary);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cl-field-input:focus {
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.12);
}
.cl-field-input::placeholder {
  color: var(--text-muted);
}

/* Inline popovers */
.cl-popover {
  position: fixed;
  background: var(--color-secondary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06);
  z-index: 9999;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== Sidebar — list mode (KPI cards) ===== */
.cl-sidebar-back {
  cursor: pointer;
}

.cl-sidebar-sep {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 14px 12px;
}

.cl-stats-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 16px 6px;
}

.cl-stats-host {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px;
}

.cl-stats-loading {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.cl-stats-meta {
  padding: 8px 16px 12px;
  font-size: 10px;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* KPI tile — uppercase micro-label above a big tabular figure (matches the
 * Client Retention / Deliverable Dashboard reference cards). */
.cl-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.cl-stat-row:hover {
  border-color: rgba(245, 166, 35, 0.35);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}
.cl-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  min-width: 0;
  line-height: 1.25;
}
.cl-stat-value {
  font-weight: 800;
  font-size: 20px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
  line-height: 1;
  flex-shrink: 0;
}

/* ===== Legacy compat ===== */
.cl-list-page .client-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 60px;
  font-size: 13px;
  font-style: italic;
}

/* ===== Responsive ===== */
@media (max-width: 1280px) {
  .cl-sheet-row {
    grid-template-columns: 32px 32px minmax(180px, 1.6fr) minmax(140px, 1fr) minmax(180px, 1.2fr) minmax(120px, 1fr) 130px 32px;
    gap: 10px;
  }
}
@media (max-width: 1024px) {
  .cl-list-page {
    padding: 20px 22px 24px;
  }
  .cl-list-title { font-size: 22px; }
}
@media (max-width: 900px) {
  .cl-sheet-row {
    grid-template-columns: 32px 32px 1.4fr 1fr 1fr 1fr 1fr 32px;
    gap: 8px;
    padding: 14px 4px;
  }
}
/* ≤768px — each row reflows into a self-contained labelled card (mirrors the
   proagri-sheet.css card pattern). The client name is the card title; industry,
   website, team and created become labelled label/value lines; select, eye and
   trash drop below as their own labelled rows. Content never clips — values wrap
   and drop to their own line rather than overflow. */
@media (max-width: 768px) {
  .cl-list-page {
    padding: 18px 16px 20px;
    border-radius: 10px;
  }
  .cl-list-header { gap: 12px; }
  .cl-list-title { font-size: 20px; }
  .cl-list-search { width: 100%; }
  .cl-list-header-actions { width: 100%; }
  .cl-list-header-actions .cl-list-btn { flex: 1 1 auto; }

  .cl-sheet-head { display: none; }

  .cl-sheet-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-bottom: 12px;
    padding: 6px 16px 10px;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  }
  .cl-sheet-row:last-child { margin-bottom: 0; }
  .cl-sheet-row:not(.cl-sheet-head):hover { background: var(--card-bg); }

  /* Data cells become label/value lines with a thin top separator. */
  .cl-sheet-cell {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 14px;
    width: 100%;
    padding: 9px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }
  .cl-sheet-cell[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    margin-right: auto;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
  }

  /* Client name = card title: full width, bold, no label, no top rule. */
  .cl-cell-name {
    order: -1;
    border-top: none;
    padding: 4px 0 8px;
  }
  .cl-name-text { font-size: 16px; font-weight: 700; }
  .cl-cell-name .cl-tag-pills { justify-content: flex-start; }

  /* Value clusters hug the right and wrap instead of clipping. */
  .cl-cell-industry,
  .cl-cell-website,
  .cl-cell-team {
    justify-content: flex-end;
  }
  .cl-cell-industry { flex-wrap: wrap; }

  /* Select / eye / trash → labelled label/value rows (control hugs the right),
     ordered below the data rows. Reads consistently with every other card line
     instead of a cramped stack of unlabelled icons. */
  .cl-cell-select,
  .cl-cell-eye,
  .cl-cell-trash {
    order: 99;
    width: 100%;
    flex: none;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
  }
  .cl-cell-select::before { content: "Select"; }
  .cl-cell-eye::before { content: "Open dashboard"; }
  .cl-cell-trash::before { content: "Remove"; }
  .cl-cell-select::before,
  .cl-cell-eye::before,
  .cl-cell-trash::before {
    margin-right: auto;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
  }
  .cl-sheet-row:not(.cl-sheet-head) .cl-cell-select input[type="checkbox"] {
    opacity: 1;
  }
  /* The scrape refresh icon can't rely on hover on touch — always show it. */
  .cl-scrape-btn { opacity: 1; pointer-events: auto; }
}

/* ── #134 dark mode overrides ─────────────────────────────── */
/* This page is mostly token-driven, so theme.css carries the surfaces and text.
   What is left is a long run of rgba(0,0,0,.0x) films used as borders, hovers
   and chip fills — a black film over slate is invisible, so each one flips to a
   white film of comparable weight. */

html[data-theme="dark"] .cl-list-page { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
html[data-theme="dark"] .cl-list-count { background: rgba(255, 255, 255, 0.08); }

/* Inputs share --color-secondary with the page card, so in dark mode they need
   the recessed tone to stay distinguishable from the surface behind them. */
html[data-theme="dark"] .cl-list-search,
html[data-theme="dark"] .cl-filter-select,
html[data-theme="dark"] .cl-field-input {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .cl-list-search:focus,
html[data-theme="dark"] .cl-filter-select:focus,
html[data-theme="dark"] .cl-field-input:focus {
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.20);
}

html[data-theme="dark"] .cl-list-btn { border-color: #334155; }
html[data-theme="dark"] .cl-list-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: #475569;
}
html[data-theme="dark"] .cl-list-btn-primary,
html[data-theme="dark"] .cl-list-btn-add-client,
html[data-theme="dark"] .cl-website-view { color: #0b1220; }

/* filter panel */
html[data-theme="dark"] .cl-filter-panel {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(148, 163, 184, 0.14);
}
html[data-theme="dark"] .cl-filter-chip {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .cl-filter-chip:hover { background: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] .cl-filter-chip.active {
  background: rgba(245, 166, 35, 0.18);
  color: #f5a623;
  border-color: rgba(245, 166, 35, 0.45);
}

html[data-theme="dark"] .cl-bulk-bar {
  background: rgba(245, 166, 35, 0.12);
  border-color: rgba(245, 166, 35, 0.34);
}

/* sheet */
html[data-theme="dark"] .cl-sheet-row { border-bottom-color: rgba(148, 163, 184, 0.14); }
html[data-theme="dark"] .cl-sheet-row:not(.cl-sheet-head):hover { background: rgba(255, 255, 255, 0.04); }
html[data-theme="dark"] .cl-sheet-head {
  background: #273449;
  border-bottom-color: rgba(148, 163, 184, 0.16);
}
html[data-theme="dark"] .cl-sheet-head .cl-sheet-cell { color: #94a3b8; }
html[data-theme="dark"] .cl-sort-arrow { color: rgba(226, 232, 240, 0.30); }

html[data-theme="dark"] .cl-eye-btn:hover { background: rgba(255, 255, 255, 0.10); }
html[data-theme="dark"] .cl-trash-btn { color: #64748b; }
html[data-theme="dark"] .cl-trash-btn:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.16);
}

/* tag + industry pills */
html[data-theme="dark"] .cl-tag-pill { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .cl-tag-pill:hover { background: rgba(255, 255, 255, 0.13); }
html[data-theme="dark"] .cl-tag-pill.cl-tag-booking-form-client,
html[data-theme="dark"] .cl-tag-pill.cl-tag-client {
  background: rgba(39, 174, 96, 0.18);
  color: #6ee7a8;
  border-color: rgba(39, 174, 96, 0.34);
}
html[data-theme="dark"] .cl-tag-pill.cl-tag-booking-form-client:hover,
html[data-theme="dark"] .cl-tag-pill.cl-tag-client:hover { background: rgba(39, 174, 96, 0.26); }
html[data-theme="dark"] .cl-tag-pill.cl-tag-agri4all-product-upload-client,
html[data-theme="dark"] .cl-tag-pill.cl-tag-agri4all-upload-only {
  background: rgba(124, 58, 237, 0.20);
  color: #c4b5fd;
  border-color: rgba(124, 58, 237, 0.36);
}
html[data-theme="dark"] .cl-tag-pill.cl-tag-agri4all-product-upload-client:hover,
html[data-theme="dark"] .cl-tag-pill.cl-tag-agri4all-upload-only:hover { background: rgba(124, 58, 237, 0.30); }

html[data-theme="dark"] .cl-industry-chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(148, 163, 184, 0.18);
}

/* website + scrape controls */
html[data-theme="dark"] .cl-scrape-btn { border-color: #475569; }
html[data-theme="dark"] .cl-scrape-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #64748b;
}
html[data-theme="dark"] .cl-link-btn { border-color: #475569; }

/* team avatars */
html[data-theme="dark"] .cl-avatar { background: rgba(255, 255, 255, 0.10); }
html[data-theme="dark"] .cl-avatar:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.50); }
html[data-theme="dark"] .cl-avatar-overflow { background: rgba(255, 255, 255, 0.16); }
/* The tooltip was near-black on a light page; on a dark page it has to be
   LIGHTER than the surface it floats over, not darker. */
html[data-theme="dark"] .cl-avatar-tooltip {
  background: #334155;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .cl-error-banner {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.34);
  color: #fca5a5;
}

/* modals + popovers */
html[data-theme="dark"] .cl-modal-overlay { background: rgba(0, 0, 0, 0.62); }
html[data-theme="dark"] .cl-modal {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.60), 0 4px 12px rgba(0, 0, 0, 0.40);
}
html[data-theme="dark"] .cl-popover {
  border-color: #334155;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.60), 0 2px 6px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .cl-trash-col {
  border-color: #334155;
  background: rgba(255, 255, 255, 0.03);
}
html[data-theme="dark"] .cl-trash-col-danger {
  border-color: rgba(248, 113, 113, 0.30);
  background: rgba(239, 68, 68, 0.10);
}

/* sidebar KPI cards */
html[data-theme="dark"] .cl-sidebar-sep { background: rgba(148, 163, 184, 0.14); }
html[data-theme="dark"] .cl-stat-row:hover {
  border-color: rgba(245, 166, 35, 0.40);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

/* The ≤768px card reflow carries its own shadow and row separators. */
@media (max-width: 768px) {
  html[data-theme="dark"] .cl-sheet-row { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.40); }
  html[data-theme="dark"] .cl-sheet-cell { border-top-color: rgba(148, 163, 184, 0.14); }
}
