/* Admin lists: retain every field and action, with readable columns that fit a
   desktop viewport. Public foundations own colors, fonts and compact controls.
   The video library has its own composition and is intentionally excluded. */
button[form="rules-bulk-form"] { white-space: nowrap; flex-shrink: 0; }
.lead-status-editor-form { left: auto; right: 0; }
.lead-bio { margin-top: 4px; font-size: .75rem; color: var(--tf-muted); }
.lead-bio summary { width: fit-content; cursor: pointer; min-height: 24px; }
.lead-bio p { margin: 4px 0 0; line-height: var(--tf-table-line-height, 1.35); overflow-wrap: anywhere; }
/* Filter widths follow their contents; actions share the same row whenever the
   available space permits. Compact controls remain owned by the design system. */
.lead-filter-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--tf-space-2); }
.lead-filter-grid > label { flex: 1 0 9rem; gap: var(--tf-space-1); }
.lead-filter-grid > .lead-filter-search-field { flex: 2 0 100%; }
.lead-filter-grid .lead-filter-actions { flex: 0 0 auto; max-width: 100%; gap: var(--tf-space-2); }
.lead-filter-grid .lead-filter-actions .tf-button { white-space: nowrap; flex-shrink: 0; }
@media (min-width: 901px) and (pointer: fine) {
  .lead-filter-grid > label { font-size: var(--tf-text-xs); flex-basis: 6.625rem; }
  .lead-filter-grid > .lead-filter-search-field { flex: 1.8 0 7.75rem; }
  .lead-filter-grid > label:has([name="coverage"]) { flex: .8 0 6.375rem; }
  .lead-filter-grid > label:has([name="dm"]) { flex: .55 0 4.5rem; }
  .lead-filter-grid > label:has([name="lead_source"]) { flex-basis: 7.25rem; }
  .lead-filter-grid > label:has([name="min_followers"]) { flex: .7 0 5.5rem; }
  .lead-filter-grid .tf-input { padding-inline-start: var(--tf-space-2); }
  .inline-actions.nowrap.lead-filter-actions { flex-wrap: nowrap; }
}
@media (min-width: 1500px) and (pointer: coarse) {
  .lead-filter-grid > .lead-filter-search-field { flex-basis: 11rem; }
}
@media (min-width: 901px) {
  :is(.candidate-list-table, .video-cluster-table, .rules-table,
      .bulk-runs-table, .bulk-import-table, .lead-list-table,
      .lead-results-table, .discovery-timeline-table,
      .discovery-ignored-results-table) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: var(--tf-table-font-size, .8125rem);
    line-height: var(--tf-table-line-height, 1.35);
  }
  :is(.candidate-list-table, .video-cluster-table, .rules-table,
      .bulk-runs-table, .bulk-import-table, .lead-list-table,
      .lead-results-table, .discovery-timeline-table,
      .discovery-ignored-results-table) :is(th, td) {
    min-width: 0;
    max-width: none;
    padding: var(--tf-table-cell-padding, .5rem .625rem);
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  :is(.candidate-list-table, .video-cluster-table, .rules-table,
      .bulk-runs-table, .bulk-import-table, .lead-list-table,
      .lead-results-table, .discovery-timeline-table) th {
    color: var(--tf-muted);
    font-size: .75rem;
    font-weight: var(--tf-weight-medium);
  }
  :is(.candidate-list-table, .video-cluster-table, .bulk-import-table,
      .lead-list-table, .lead-results-table) :is(.video-link,
      .candidate-title-link, .candidate-direct-url, .channel-text,
      .channel-link, .text-clamp-2, .bulk-import-record-link,
      .bulk-import-source-link, .lead-identity-copy, .video-id) {
    display: block;
    max-width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-line-clamp: unset;
    line-height: var(--tf-table-line-height, 1.35);
  }
  :is(.candidate-list-table, .video-cluster-table, .lead-list-table,
      .lead-results-table) .video-head-cell {
    padding: 0;
    min-height: 28px;
  }
  :is(.candidate-list-table, .video-cluster-table, .lead-list-table,
      .lead-results-table) .video-head-label {
    font-size: .75rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  :is(.candidate-list-table, .video-cluster-table, .bulk-runs-table,
      .bulk-import-table, .lead-list-table, .lead-results-table)
      :is(.status, .pill, .source-badge) {
    min-height: 20px;
    padding: 2px 5px;
    gap: 4px;
    font-size: .6875rem;
    line-height: 1.3;
    white-space: normal;
  }
  :is(.candidate-list-table, .video-cluster-table, .bulk-runs-table,
      .bulk-import-table, .lead-list-table, .lead-results-table)
      :is(.helper, .event-note) {
    font-size: .75rem;
    line-height: var(--tf-table-line-height, 1.35);
  }
  .table-scroll:has(> :is(.candidate-list-table, .video-cluster-table,
      .rules-table, .lead-list-table, .lead-results-table)) {
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  /* Raw live-usage exports are shown beside the chart on desktop. */
  .stats-snapshot-table { width: 100%; min-width: 0; table-layout: fixed; }
  .stats-snapshot-table :is(th, td) { min-width: 0; max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .stats-snapshot-table .metric-col { width: 18%; min-width: 0; white-space: normal; }
  .stats-snapshot-table .datetime-col { width: 25%; }
  .stats-snapshot-table .slot-col { width: auto; min-width: 0; }
  .stats-snapshot-table .datetime-value { flex-wrap: wrap; white-space: normal; }
  .stats-snapshot-card .table-scroll { margin-inline: 0; padding-inline: 0; overflow: visible; }

  /* Keep publication dates distinct and leave room around the two review signals. */
  .table-scroll:has(> .candidate-list-table) { container: candidate-list / inline-size; }
  .candidate-list-table :is(th, td) { padding: 7px 4px; }
  .candidate-list-table .candidate-select-col { width: 32px; }
  .candidate-list-table .candidate-row-select { width: 24px; min-width: 0; padding: 0; }
  .candidate-list-table .thumbnail-col { width: 48px; }
  .candidate-list-table .video-col { width: auto; }
  .candidate-list-table .candidate-status-col { width: 72px; }
  .candidate-list-table .candidate-channel-col { width: 14%; }
  .candidate-list-table .candidate-posted-col { width: 92px; padding-inline: 8px; font-size: .6875rem; }
  .candidate-list-table .candidate-posted-col .candidate-posted-date { display: grid; white-space: nowrap; }
  .candidate-list-table .identity-col { width: 112px; padding-inline: 12px; }
  .candidate-list-table .candidate-discovery-col { width: 23%; padding-inline: 12px; }
  .candidate-list-table .candidate-discovery-col > * + * { margin-top: 6px; }
  .candidate-list-table .actions-col { width: 78px; }
  .candidate-platform-meta { gap: 4px; }
  .candidate-filter-grid { grid-template-columns: minmax(160px, 1.5fr) repeat(5, minmax(82px, 1fr)) auto; }
  .candidate-filter-actions { flex-wrap: nowrap; }
  .candidate-list-table :is(.thumb, .thumb-table, .video-thumb-button) {
    width: 40px;
    height: 44px;
  }
  .candidate-list-table :is(.candidate-title-link, .candidate-channel-name) {
    font-size: var(--tf-table-font-size, .8125rem);
  }
  .candidate-list-table .candidate-direct-url { font-size: .6875rem; }
  .candidate-list-table .candidate-discovery-col { font-size: .75rem; }
  .candidate-list-table :is(.candidate-channel-name, .candidate-channel-handle,
      .candidate-discovery-query, .candidate-posted-date) {
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }
  .candidate-list-table .video-text-stack { gap: 3px; }
  :is(.candidate-list-table, .video-cluster-table) .detail-field-stack > :is(strong, span) {
    white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
  }

  /* Clusters have fewer fields than individual videos and fit eleven columns. */
  .video-cluster-table :is(th, td) { padding: 7px 5px; }
  .video-cluster-table .thumbnail-col { width: 48px; }
  .video-cluster-table .platform-col { width: 154px; }
  .video-cluster-table .video-col { width: 19%; }
  .video-cluster-table .channel-col { width: 15%; }
  .video-cluster-table .metric-col { width: 5%; text-align: right; }
  .video-cluster-table .datetime-col { width: 84px; }
  .video-cluster-table .status-col { width: 64px; }
  .video-cluster-table .actions-col { width: 78px; }
  .video-cluster-table :is(.thumb, .thumb-table, .video-thumb-button) {
    width: 40px;
    height: 44px;
  }

  /* Rule controls shrink with their columns; long values remain fully editable
     inside native inputs, rather than forcing the entire table to scroll. */
  .rules-table th:nth-child(1) { width: 5%; }
  .rules-table th:nth-child(2) { width: 13%; }
  .rules-table th:nth-child(3) { width: 11%; }
  .rules-table th:nth-child(4) { width: 12%; }
  .rules-table th:nth-child(5) { width: 22%; }
  .rules-table th:nth-child(6) { width: 7%; }
  .rules-table th:nth-child(7) { width: 8%; }
  .rules-table th:nth-child(8) { width: 14%; }
  .rules-table th:nth-child(9) { width: 8%; }
  .rules-table :is(th, td) { padding: 6px 3px; }
  .rules-table :is(input, select) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding-inline: 6px;
    font-size: .75rem;
  }
  .rules-table select { padding-right: 18px; }
  .rules-table .helper.video-id { font-size: .6875rem; line-height: 1.25; overflow-wrap: anywhere; margin-top: 3px; }
  .rules-table .rule-id-cell, .rules-table .rule-actions-cell { white-space: normal; }

  /* Import and sync detail share actions but give record identity the flexible
     column. Dates need two short lines, not one third of the entire table. */
  .bulk-import-table .status-col { width: 90px; }
  .bulk-import-table .metric-col { width: 64px; text-align: right; }
  .bulk-import-table .actions-col { width: 164px; }
  .bulk-import-table .datetime-col { width: 106px; }
  .bulk-import-table .source-url-col { width: 21%; }
  .bulk-import-table:not(:has(.source-url-col)) .metric-col { width: 44px; }
  .bulk-import-table .video-cell { max-width: none; }
  .bulk-import-table .bulk-import-source-link { font-size: .75rem; }
  .bulk-runs-table .metric-col { width: 72px; }
  .bulk-runs-table .created-col { width: 110px; }
  .bulk-runs-table th:first-child { width: 92px; }
  .bulk-runs-table:not(.discovery-runs-table) th:nth-child(2) { width: 31%; }
  .discovery-runs-table .run-col { width: 80px; }
  .discovery-runs-table .status-col { width: 23%; }
  .discovery-runs-table .scope-col { width: 20%; }
  .discovery-runs-table .usage-col { width: 17%; }
  .discovery-runs-table .created-col { width: 108px; }
  .discovery-timeline-table .datetime-col { width: 106px; }
  .discovery-timeline-table .status-col { width: 80px; }
  .discovery-timeline-table .event-message { width: auto; white-space: normal; }
  .discovery-ignored-results-table a { overflow-wrap: anywhere; }

  /* Creator identity is the leading column. Short numeric/status columns no
     longer crowd names into a narrow strip beside the avatar. */
  .lead-list-table :is(th, td), .lead-results-table :is(th, td) {
    padding: 8px 6px;
    border-bottom: 1px solid var(--tf-border);
    border-radius: 0;
    background: transparent;
  }
  .lead-list-table :is(th, td):first-child,
  .lead-results-table :is(th, td):first-child { padding-left: 0; }
  .lead-list-table :is(th, td):last-child,
  .lead-results-table :is(th, td):last-child { padding-right: 0; }
  .lead-list-table .video-col { width: auto; }
  .lead-list-table .metric-col { width: 78px; }
  .lead-list-table .platform-col { width: 106px; }
  .lead-list-table .datetime-col { width: 102px; }
  .lead-list-table th:nth-child(5) { width: 68px; }
  .lead-list-table .dm-col { width: 60px; }
  .lead-list-table th:nth-child(7) { width: 112px; }
  .lead-list-table .actions-col { width: 76px; }
  .lead-list-table .lead-identity { gap: 8px; }
  .lead-list-table :is(.lead-avatar, .lead-avatar-link) { width: 32px; height: 32px; }
  .lead-list-table .lead-identity-copy { gap: 2px; }
  .lead-list-table td:first-child > .helper { margin-top: 4px; font-size: .75rem; }
  .lead-list-table .lead-actions-stack { gap: 4px; flex-wrap: nowrap; }
  .lead-list-table .lead-status-editor-row { gap: 4px; flex-wrap: wrap; }
  .lead-results-table .video-col { width: auto; min-width: 0; }
  .lead-results-table .metric-col { width: 94px; }
  .lead-results-table .status-col { width: 120px; }
  .lead-results-table .actions-col { width: 130px; }
}

@media (min-width: 901px) {
  @container candidate-list (min-width: 1200px) {
    .candidate-list-table .actions-col { width: 148px; }
  }
  @container candidate-list (max-width: 930px) {
    .candidate-list-table .candidate-select-col { width: 28px; }
    .candidate-list-table .candidate-channel-col { width: 13%; }
    .candidate-list-table .candidate-discovery-col { width: 21%; }
    .candidate-list-table .candidate-posted-col { width: 84px; }
    .candidate-list-table .identity-col { width: 104px; }
  }
}

.candidate-list-table .candidate-posted-date.is-google > span:first-child {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  :is(.candidate-list-table, .video-cluster-table, .rules-table,
      .bulk-runs-table, .bulk-import-table, .lead-list-table,
      .lead-results-table) td {
    padding: 0;
    border-bottom: 0;
  }
  :is(.rules-table, .bulk-runs-table, .bulk-import-table,
      .lead-list-table, .lead-results-table) tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  :is(.rules-table, .bulk-runs-table, .bulk-import-table,
      .lead-list-table, .lead-results-table) td + td { margin: 0; }
  .rules-table :is(td[data-label="Rule"], td[data-label="Query"],
      td[data-label="Notes"], .rule-actions-cell, .rule-add-trigger-cell),
  :is(.bulk-import-table, .lead-list-table, .lead-results-table)
      :is(.video-cell, .source-url-col, .actions-col) { grid-column: 1 / -1; }
  .rules-table :is(input, select) { width: 100%; min-width: 0; }
  .rules-table .helper.video-id { font-size: .75rem; line-height: 1.35; }
  .rules-table .rule-actions-cell .inline-actions { justify-content: flex-end; }
  .lead-list-table td:first-child, .lead-results-table td:first-child { grid-column: 1 / -1; }
  .lead-list-table .lead-status-editor { position: relative; }
  .lead-list-table .lead-status-editor-details { position: static; }
  .lead-list-table .lead-status-editor-form { left: 0; right: auto; min-width: min(160px, 75vw); }
  .candidate-list-table .candidate-posted-col { width: auto; min-width: 0; max-width: none; }
  .candidate-list-table .candidate-posted-date { white-space: nowrap; }

  .candidate-list-table td.candidate-channel-col { grid-column: 1 / 3; }
  .candidate-list-table td.candidate-status-col { grid-column: 2 / -1; }
  .candidate-list-table td.candidate-posted-col { grid-column: 3; margin: 0; }
  .candidate-list-table .candidate-posted-date { display: grid; }
  .video-cluster-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .video-cluster-table td { margin: 0 !important; padding: 0; }
  .video-cluster-table .video-cell, .video-cluster-table .channel-col,
  .video-cluster-table .actions-col { grid-column: 1 / -1; }
  .video-cluster-table .thumbnail-col { grid-column: 1; grid-row: 1; }
  .video-cluster-table .platform-col { grid-column: 2 / -1; grid-row: 1; }
  .video-cluster-table .thumbnail-col::before, .video-cluster-table .video-cell::before { display: none; }
  .video-cluster-table .inline-actions { gap: 8px; flex-wrap: wrap; }
}

@media (min-width: 901px) and (pointer: fine) {
  :is(.candidate-list-table, .video-cluster-table, .rules-table,
      .bulk-runs-table, .bulk-import-table, .lead-list-table,
      .lead-results-table) .tf-button {
    min-height: var(--tf-control-height-compact, 32px);
    padding: .35rem .55rem;
    font-size: .75rem;
    line-height: 1.3;
  }
  :is(.candidate-list-table, .video-cluster-table, .bulk-import-table,
      .lead-list-table, .lead-results-table) .tf-button.icon-button {
    width: var(--tf-control-height-compact, 32px);
    min-width: var(--tf-control-height-compact, 32px);
    height: var(--tf-control-height-compact, 32px);
    padding: 0;
  }
  :is(.candidate-list-table, .video-cluster-table, .bulk-import-table)
      td.actions-col .video-icon-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .rules-table .tf-input { min-height: var(--tf-control-height-compact, 32px); padding-block: 5px; }
  .rules-table .tf-button { min-width: 0; max-width: 100%; }
}
