/* Admin surfaces (/admin/*)
   The operator's side of the tape. Same four materials as the public site —
   charcoal panels, 1px hairlines, mono figures, one phosphor lamp — tuned for
   density rather than persuasion: an admin scanning 900 records for the dozen
   that are stuck needs rows that fit on one screen, not cards that breathe. */

.admin-body {
  background: var(--bg-main);
  min-height: 100vh;
  color: var(--text);
}

/* ============ Navigation ============ */

.admin-nav-header {
  background: var(--header-bg);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-nav-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.admin-brand h1 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-bright);
  margin: 0;
  white-space: nowrap;
}

.admin-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex: 1;
}

.admin-nav-link {
  position: relative;
  padding: 0.45rem 0.1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.admin-nav-link:hover {
  color: var(--text-bright);
}

.admin-nav-link.active {
  color: var(--text-bright);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.admin-nav-link.back-link {
  margin-left: auto;
  color: var(--text-dim);
}

.admin-nav-link.back-link:hover {
  color: var(--text);
}

.admin-nav-link:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: 0 0 0 3px var(--ring);
}

/* ============ Page frame ============ */

.admin-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.admin-header {
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-bright);
  margin: 0 0 0.35rem;
}

.admin-header .subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* The page opener is a plain block, not a panel: the rules belong to the data
   below it, and a bordered box here would compete with the table it introduces. */
.section-head {
  margin-bottom: 1.75rem;
}

.section-head-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
}

.section-head-title h2 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 0.35rem 0;
  letter-spacing: 0.01em;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
  max-width: 58ch;
}

/* Rule-not-gap: the counts read as one strip of instrumentation. */
.section-stats {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.stat-badge {
  padding: 0.7rem 1.25rem;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 110px;
}

.stat-badge:first-child {
  border-left: none;
}

.stat-label {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-bright);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
}

/* ============ Pipeline strip (analysis index) ============ */

/* Both readout and filter. The counts an operator watches are the control that
   isolates them, so there is no second navigation to learn. */
.pipeline-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.pipeline-strip--coverage {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.pipeline-cell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-left: 1px solid var(--border);
  text-decoration: none;
  background: var(--bg-elevated);
  transition: background 0.15s ease;
}

.pipeline-cell:first-child {
  border-left: none;
}

.pipeline-cell:hover {
  background: var(--bg-highlight);
}

.pipeline-cell.is-active {
  background: var(--bg-highlight);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.pipeline-cell:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.pipeline-cell.is-active:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary), inset 0 -2px 0 var(--primary);
}

.pipeline-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  line-height: 1.3;
}

.pipeline-cell.is-active .pipeline-label {
  color: var(--text);
}

.pipeline-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-bright);
}

.pipeline-cell.is-empty .pipeline-count {
  color: var(--text-dim);
}

/* ============ Status lamp ============ */

/* The lamp carries tone, the word carries the state. Colour is never the only
   channel — every lamp sits beside the status spelled out. */
.status-lamp {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  background: var(--text-muted);
}

.status-lamp[data-tone="ok"] { background: var(--primary); }
.status-lamp[data-tone="work"] { background: var(--secondary); }
.status-lamp[data-tone="bad"] { background: var(--danger); }
.status-lamp[data-tone="null"] { background: var(--text-muted); }

.status-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.status-name {
  font-family: var(--font-mono);
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  line-height: 1.3;
}

/* ============ Tables ============ */

.table-container {
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.analysis-table thead th {
  padding: 0.7rem 1rem;
  text-align: left;
  background: var(--bg-darker);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.analysis-table tbody tr {
  background: var(--bg-elevated);
  transition: background 0.15s ease;
}

.analysis-table tbody tr:hover {
  background: var(--bg-highlight);
}

.analysis-table td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-light);
}

.analysis-table tbody tr:last-child td {
  border-bottom: none;
}

.analysis-table td img {
  max-width: 40px;
  max-height: 40px;
}

/* --- Column widths (analysis index) --- */
.analysis-table--analyses .status-cell { width: 195px; }
.analysis-table--analyses .calls-cell { width: 70px; }
.analysis-table--analyses .return-cell { width: 95px; }
.analysis-table--analyses .requested-cell { width: 190px; }
.analysis-table--analyses .actions-cell { width: 155px; text-align: right; }

/* The video column absorbs the remaining width; max-width:0 is what lets a
   table cell honour text-overflow. */
.analysis-table--analyses .video-cell {
  width: 100%;
  max-width: 0;
}

/* A title that is not yet a link should not look like one: only analysed rows
   have a page to go to, and bone is reserved for what the eye can act on. */
.video-title {
  display: block;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

a.video-title {
  color: var(--text-bright);
}

a.video-title:hover {
  color: var(--primary);
}

a.video-title:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: 0 0 0 3px var(--ring);
}

.video-sub {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.video-channel {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22ch;
}

.video-channel.is-missing {
  color: var(--text-dim);
}

.video-sep {
  color: var(--text-dim);
}

.video-yt {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.video-yt:hover {
  color: var(--text-bright);
  border-bottom-color: var(--text-muted);
}

.video-yt:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: 0 0 0 3px var(--ring);
}

.calls-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
}

.calls-count.is-zero {
  color: var(--text-dim);
  font-weight: 500;
}

.requested-info {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  white-space: nowrap;
}

.requested-date {
  color: var(--text);
}

.requested-time {
  color: var(--text-dim);
}

.requester-tag {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.requester-tag.is-auto {
  color: var(--text-dim);
}

/* --- Row action cluster --- */

/* Four re-drive jobs per row, forty per page. As labelled buttons they were the
   page; as one hairline-divided instrument cluster they sit where a toolbar
   belongs and give the record back its space. Every job confirms before it
   fires, so the icons never act alone. */
.action-cluster {
  display: flex;
  gap: 0;
  width: max-content;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.action-cluster .op-form {
  display: flex;
  margin: 0;
}

.btn-op {
  width: 34px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.action-cluster .op-form:first-child .btn-op {
  border-left: none;
}

.btn-op svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-op:hover {
  background: var(--bg-highlight);
  color: var(--text-bright);
}

.btn-op:focus-visible {
  outline: none;
  position: relative;
  z-index: 1;
  color: var(--text-bright);
  box-shadow: 0 0 0 2px var(--primary);
}

/* --- Failure detail --- */

.analysis-table tbody tr.has-error td {
  border-bottom: none;
}

.error-row td {
  padding: 0;
  background: var(--bg-darker);
}

.error-banner {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  padding: 0.6rem 1rem 0.7rem;
}

.error-title {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--danger);
}

.error-message {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
}

/* ============ Table foot & pagination ============ */

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.table-foot-readout {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.table-foot-figure {
  font-variant-numeric: tabular-nums;
  color: var(--text-bright);
  letter-spacing: 0.06em;
}

.pagination-container {
  display: flex;
  justify-content: flex-end;
  flex: 1;
}

.pagination {
  display: flex;
  gap: 0;
  align-items: stretch;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.pagination .page,
.pagination .first,
.pagination .last,
.pagination .prev,
.pagination .next,
.pagination .gap {
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  transition: background 0.15s ease, color 0.15s ease;
}

.pagination > *:first-child {
  border-left: none;
}

.pagination .page:hover,
.pagination .first:hover,
.pagination .last:hover,
.pagination .prev:hover,
.pagination .next:hover {
  background: var(--bg-highlight);
  color: var(--text-bright);
}

.pagination .page a,
.pagination .first a,
.pagination .last a,
.pagination .prev a,
.pagination .next a {
  display: block;
  padding: 0.5rem 0.8rem;
  color: inherit;
  text-decoration: none;
}

.pagination a:focus-visible {
  outline: none;
  color: var(--text-bright);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.pagination .current {
  padding: 0.5rem 0.8rem;
  background: var(--bg-highlight);
  color: var(--text-bright);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.pagination .gap {
  padding: 0.5rem 0.6rem;
  color: var(--text-dim);
}

/* ============ Empty state ============ */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-elevated);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-bright);
  margin: 0 0 0.5rem 0;
}

.empty-message {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
  max-width: 52ch;
  margin-inline: auto;
}

.empty-subtitle {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.empty-link:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: 0 0 0 3px var(--ring);
}

.empty-link:hover {
  color: var(--text-bright);
  text-decoration: underline;
}

/* ============ Search (stocks, influencers) ============ */

/* The public search panel is a rounded, shadowed card; inside an admin table
   page it is a control, not a container. Flattened back to the field itself. */
.admin-container .search-section {
  margin-bottom: 1.25rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.admin-container .search-container {
  max-width: 520px;
  margin: 0;
}

/* Search narrows the population the coverage strip then breaks down, so the
   field and its match count sit on one line above the strip. */
.listing-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.admin-container .search-form {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.listing-controls .search-form {
  flex: 0 1 460px;
}

/* One lamp per viewport: the phosphor belongs to the active coverage cell, so
   submitting a search is a ghost control. */
.admin-container .listing-controls .search-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text-bright);
}

.admin-container .listing-controls .search-btn:hover {
  background: var(--bg-highlight);
  border-color: var(--text-muted);
}

.admin-container .listing-controls .search-btn:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.filter-readout {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.filter-readout-figure {
  font-variant-numeric: tabular-nums;
  color: var(--text-bright);
  letter-spacing: 0.06em;
}

.filter-readout-term {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0.02em;
}

.admin-container .search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-container .search-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.admin-container .search-icon {
  position: absolute;
  left: 0.9rem;
  display: flex;
  font-size: 0.85rem;
  color: var(--text-dim);
  pointer-events: none;
}

.admin-container .search-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.admin-container .search-input-wrapper:focus-within .search-icon {
  color: var(--primary);
}

.admin-container .search-input {
  flex: 1;
  padding: 0.7rem 0.75rem 0.7rem 2.5rem;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  color: var(--text-bright);
  outline: none;
}

.admin-container .search-input::placeholder {
  color: var(--text-muted);
}

.admin-container .search-clear {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-container .search-clear:hover {
  background: var(--bg-highlight);
  color: var(--text-bright);
}

.admin-container .search-clear:focus-visible {
  outline: none;
  color: var(--text-bright);
  box-shadow: 0 0 0 2px var(--primary);
}

.admin-container .search-clear svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.admin-container .search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: var(--primary-dark);
  color: #f2efe4;
  border: 1px solid var(--primary);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.admin-container .search-btn:hover {
  background: var(--primary);
  border-color: var(--success);
}

.admin-container .search-btn-icon {
  font-size: 0.85rem;
}

.admin-container .search-highlight {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-container .search-results-info {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 0.75rem;
}

/* ============ Shared table cells (users, stocks, influencers) ============ */

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  font-size: 1rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-radius: 2px;
  border: 1px solid var(--border);
}

.user-email {
  font-weight: 600;
  color: var(--text-bright);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid var(--border);
}

.role-admin {
  color: var(--secondary);
  border-color: rgba(201, 164, 92, 0.45);
}

.role-user {
  color: var(--text-muted);
}

.sessions-count,
.analyses-count,
.videos-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
}

.videos-cell,
.sessions-cell,
.analyses-cell {
  width: 100px;
}

.performance-cell {
  width: 120px;
}

.actions-cell {
  width: 200px;
}

/* --- Column widths (influencers index) --- */
.analysis-table--influencers .videos-cell { width: 130px; }
.analysis-table--influencers .return-cell { width: 140px; }
.analysis-table--influencers .auto-cell { width: 165px; }
.analysis-table--influencers .coverage-cell { width: 205px; }
.analysis-table--influencers .actions-cell { width: 110px; text-align: right; }

/* The channel column absorbs the remaining width; max-width:0 is what lets a
   table cell honour text-overflow. */
.analysis-table--influencers .influencer-cell {
  width: 100%;
  max-width: 0;
}

.member-duration {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* These carry a long localised date, so they stack rather than sit in a row. */
.joined-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.joined-date {
  color: var(--text);
}

.joined-time {
  color: var(--text-dim);
}

/* Stocks still uses labelled buttons in its action column. */
.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Direction is read from colour and sign, not from a filled chip. */
.performance-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 600;
}

.performance-value.profit-positive {
  color: var(--success);
}

.performance-value.profit-negative {
  color: var(--danger);
}

.performance-none {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.influencer-cell {
  width: 240px;
  overflow: hidden;
}

.influencer-cell .influencer-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.influencer-cell .influencer-avatar {
  flex-shrink: 0;
  display: block;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--bg-surface);
}

.influencer-cell .influencer-avatar img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.influencer-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.influencer-name {
  display: block;
  font-weight: 600;
  color: var(--text-bright);
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.influencer-name a,
a.influencer-name {
  color: var(--text-bright);
  text-decoration: none;
  transition: color 0.15s ease;
}

.influencer-name a:hover,
a.influencer-name:hover {
  color: var(--primary);
}

a.influencer-name:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: 0 0 0 3px var(--ring);
}

/* The channel's provenance line: where it came from and when it was picked up,
   as absolute dates — a relative stamp reads as staleness the row cannot
   confirm. */
.influencer-sub {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.influencer-yt {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.influencer-yt:hover {
  color: var(--primary);
}

.influencer-yt:focus-visible {
  outline: none;
  border-radius: 2px;
  color: var(--text-bright);
  box-shadow: 0 0 0 2px var(--primary);
}

/* --- Videos / return figures --- */

.videos-count.is-zero {
  color: var(--text-dim);
}

.videos-scored,
.return-sub {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  color: var(--text-muted);
}

/* --- Auto-analyse switch --- */

/* Ingestion is a state the operator reads down the column and occasionally
   flips, so the control is a lamp with its state spelled out rather than a
   filled green pill competing with every other row. */
.btn-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-switch.is-on {
  color: var(--text-bright);
}

.btn-switch:hover {
  background: var(--bg-highlight);
  border-color: var(--text-muted);
  color: var(--text-bright);
}

.btn-switch:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* --- Coverage marks --- */

/* Two re-drive jobs hang off every row, so the row reports the state of both.
   Lit means the pipeline produced something; the stamp is the only real
   timestamp either job stores. */
.coverage-marks {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.coverage-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  color: var(--text-muted);
}

.coverage-mark[data-state="on"] {
  border-color: var(--border);
  color: var(--text-bright);
}

.coverage-stamp {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ============ Stock price checker (/admin/stock_prices) ============ */

.stock-price-checker {
  background: var(--bg-elevated);
  border-radius: 3px;
  padding: 1.75rem;
  border: 1px solid var(--border);
}

.price-checker-form {
  margin-bottom: 2rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 200px;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 1rem;
  background: var(--bg-surface);
  color: var(--text-bright);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.results-section {
  margin-bottom: 2rem;
}

.results-section h2,
.logs-section h2 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-bright);
  margin-bottom: 1rem;
}

.result-card {
  padding: 1.5rem;
  border-radius: 3px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.success-card h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.15rem;
}

.error-card h3 {
  color: var(--danger);
  margin-bottom: 0.5rem;
}

.error-card p {
  color: var(--text);
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.price-item {
  background: var(--bg-surface);
  padding: 1rem 1.25rem;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.price-item:first-child {
  border-left: none;
}

.price-item.highlight {
  background: var(--bg-highlight);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.price-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.price-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1;
}

.price-item.highlight .price-value {
  color: var(--primary);
}

.logs-section {
  margin-top: 2rem;
}

.logs-container {
  background: var(--bg-darker);
  border-radius: 3px;
  padding: 1.25rem;
  max-height: 500px;
  overflow-y: auto;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}

.log-entry {
  display: flex;
  gap: 1rem;
  padding: 0.35rem 0;
  font-size: 0.75rem;
  align-items: baseline;
}

.log-index {
  color: var(--text-dim);
  min-width: 28px;
  font-variant-numeric: tabular-nums;
}

.log-level {
  font-weight: 600;
  min-width: 62px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.log-message {
  flex: 1;
  word-break: break-word;
  color: var(--text);
}

.log-info .log-level { color: var(--info); }
.log-success .log-level { color: var(--success); }
.log-warning .log-level { color: var(--warning); }
.log-error .log-level { color: var(--danger); }
.log-debug .log-level { color: var(--text-dim); }

.log-error .log-message { color: var(--text-bright); }

.logs-container::-webkit-scrollbar {
  width: 8px;
}

.logs-container::-webkit-scrollbar-track {
  background: var(--bg-surface);
}

.logs-container::-webkit-scrollbar-thumb {
  background: var(--border);
}

.logs-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ============ Responsive ============ */

@media (max-width: 1100px) {
  .pipeline-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pipeline-cell:nth-child(4n + 1) {
    border-left: none;
  }

  .pipeline-cell:nth-child(n + 5) {
    border-top: 1px solid var(--border);
  }

  /* Five cells fit three-up more evenly than four-up-then-one. */
  .pipeline-strip--coverage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pipeline-strip--coverage .pipeline-cell:nth-child(4n + 1) {
    border-left: 1px solid var(--border);
  }

  .pipeline-strip--coverage .pipeline-cell:nth-child(3n + 1) {
    border-left: none;
  }

  .pipeline-strip--coverage .pipeline-cell:nth-child(n + 4) {
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 1024px) {
  .table-container {
    overflow-x: auto;
  }

  /* The table scrolls rather than reflows: a pipeline record only reads as a
     record when its columns stay in line. Wide enough that the title column
     keeps a usable share once the fixed columns take theirs. */
  .analysis-table {
    min-width: 1100px;
  }

  /* Fewer fixed columns here, so the channel name needs less to stay readable. */
  .analysis-table--influencers {
    min-width: 900px;
  }
}

@media (max-width: 768px) {
  .admin-nav-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
  }

  .admin-nav {
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
  }

  .admin-nav-link.back-link {
    margin-left: 0;
  }

  .admin-container {
    padding: 1.75rem 1rem 3rem;
  }

  .section-head-title h2,
  .empty-title,
  .results-section h2,
  .logs-section h2 {
    font-size: 1.75rem;
  }

  .section-stats {
    width: 100%;
  }

  .stat-badge {
    flex: 1;
    min-width: 0;
  }

  .pipeline-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pipeline-cell:nth-child(4n + 1) {
    border-left: 1px solid var(--border);
  }

  .pipeline-cell:nth-child(odd) {
    border-left: none;
  }

  .pipeline-cell:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .pipeline-strip--coverage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pipeline-strip--coverage .pipeline-cell:nth-child(3n + 1) {
    border-left: 1px solid var(--border);
  }

  .pipeline-strip--coverage .pipeline-cell:nth-child(odd) {
    border-left: none;
  }

  /* Five cells over two columns leaves a phantom half-cell; the last one takes
     the full row instead. */
  .pipeline-strip--coverage .pipeline-cell:last-child {
    grid-column: 1 / -1;
  }

  .listing-controls {
    gap: 0.75rem;
  }

  .listing-controls .search-form {
    flex: 1 1 100%;
  }

  .table-foot {
    justify-content: center;
  }

  .pagination-container {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .admin-container .search-form {
    flex-direction: column;
  }

  .admin-container .search-btn {
    justify-content: center;
  }
}
