.admin-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.25rem 1.5rem 2rem;
  display: grid;
  gap: 1rem;
}

.admin-shell {
  align-content: start;
}

.admin-card {
  background: linear-gradient(180deg, #151515 0%, #111111 100%);
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.admin-card-wide {
  min-width: 0;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.hero-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #222;
  border: 1px solid #3a3a3a;
  color: #fff;
  padding: 0.35rem 0.7rem;
  font-size: 12px;
  font-weight: 700;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.metric-card {
  background: #141414;
  border: 1px solid #272727;
  border-radius: 10px;
  padding: 0.85rem;
}

.metric-label {
  color: #9a9a9a;
  font-size: 12px;
  margin: 0;
}

.metric-value {
  color: #fff;
  font-size: 20px;
  margin: 0.3rem 0 0;
  font-weight: 700;
}

/* Statistiques panel */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.engagement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.stat {
  background: #141414;
  border: 1px solid #272727;
  border-radius: 10px;
  padding: 0.7rem;
}

.stat-label {
  color: #9a9a9a;
  font-size: 12px;
  margin: 0;
}

.stat-value {
  color: #fff;
  font-size: 18px;
  margin: 0.25rem 0 0;
  font-weight: 700;
}

.admin-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  align-items: start;
}

.admin-grid-top {
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
}

.admin-grid-bottom {
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
}

.admin-header-row,
.button-row,
.pagination-row {
  display: flex;
  gap: 0.7rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.stack-form,
.compact-form {
  display: grid;
  gap: 0.75rem;
}

.compact-form {
  max-width: 460px;
}

.inline-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.library-search-row {
  margin-bottom: 0.65rem;
}

.inline-form input {
  flex: 1;
}

.filter-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #b6b6b6;
  font-size: 13px;
  margin: 0;
  user-select: none;
}

.filter-checkbox-row input[type='checkbox'] {
  accent-color: #ff9000;
  width: 16px;
  height: 16px;
}

.filter-checkbox-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0;
}

.library-controls-panel {
  border: 1px solid #2b2b2b;
  border-radius: 12px;
  background: #111;
  padding: 0.8rem;
  margin: 0 0 0.95rem;
}

.library-controls-row {
  display: flex;
  gap: 0.85rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.library-filter-group {
  gap: 0.85rem;
}

.library-tools-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #b6b6b6;
  font-size: 13px;
}

.page-size-control select {
  background: #0f0f0f;
  color: #fff;
  border: 1px solid #303030;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.library-selection-hint {
  margin: 0.6rem 0 0;
  font-size: 12px;
}

.preview-admin-panel {
  border: 1px solid #2b2b2b;
  border-radius: 12px;
  padding: 0.9rem;
  background: #121212;
  margin: 0 0 0.95rem;
}

.preview-stats-grid {
  margin-top: 0.6rem;
}

.preview-progress-wrap {
  margin-top: 0.9rem;
}

.preview-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #0c0c0c;
  border: 1px solid #2c2c2c;
}

.preview-progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff9000 0%, #ffb347 100%);
  transition: width 0.2s ease;
}

.preview-progress-label {
  margin: 0.45rem 0 0;
  font-size: 12px;
}

.video-meta-badges {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.video-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 11px;
  font-weight: 700;
}

.video-status-badge.preview-ok {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.video-status-badge.preview-missing {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fca5a5;
}

.video-status-badge.preview-stale {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

.selected-preview-actions {
  margin-top: 0.7rem;
}

.stack-form label {
  display: grid;
  gap: 0.35rem;
}

.stack-form span,
.muted,
.status-text {
  color: #a8a8a8;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.inline-form input {
  width: 100%;
  background: #0f0f0f;
  color: #fff;
  border: 1px solid #303030;
  border-radius: 8px;
  padding: 0.74rem 0.82rem;
}

.stack-form textarea {
  resize: vertical;
  min-height: 84px;
  font-family: inherit;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 8px;
  padding: 0.72rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

a.secondary-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.primary-btn {
  background: #ff9000;
  color: #121212;
}

.secondary-btn {
  background: #272727;
  color: #fff;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.video-list {
  border: 1px solid #2d2d2d;
  border-radius: 10px;
  max-height: 58vh;
  overflow: auto;
  background: #0f0f0f;
}

.video-item {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid #242424;
  cursor: pointer;
}

.video-item:last-child {
  border-bottom: none;
}

.video-item:hover {
  background: #1a1a1a;
}

.video-item.active {
  background: rgba(255, 144, 0, 0.12);
  border-left: 3px solid #ff9000;
  padding-left: calc(0.8rem - 3px);
}

.video-title {
  color: #fff;
  font-size: 14px;
  margin: 0;
}

.video-meta {
  color: #999;
  font-size: 12px;
  margin-top: 0.25rem;
}

.selected-video-box,
.candidate-list {
  background: #0f0f0f;
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  padding: 0.8rem;
  min-height: 160px;
}

.candidate-list.empty {
  color: #8f8f8f;
}

.candidate-list {
  max-height: 70vh;
  overflow: auto;
}

.candidate-item {
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  padding: 0.7rem;
  margin-bottom: 0.65rem;
  background: #121212;
}

.candidate-item:last-child {
  margin-bottom: 0;
}

.candidate-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.candidate-score {
  border-radius: 999px;
  background: rgba(255, 144, 0, 0.2);
  color: #ffb454;
  padding: 0.24rem 0.58rem;
  font-size: 12px;
  font-weight: 700;
}

.candidate-score-muted {
  background: rgba(125, 125, 125, 0.2);
  color: #d0d0d0;
}

.candidate-sub {
  color: #a8a8a8;
  font-size: 12px;
  margin: 0.3rem 0 0.55rem;
}

.divider {
  border: none;
  border-top: 1px solid #2a2a2a;
  margin: 0.95rem 0;
}

.results-box {
  margin-top: 0.7rem;
  background: #0b0b0b;
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  color: #d8d8d8;
  padding: 0.9rem;
  min-height: 140px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.debug-console {
  margin-top: 0.7rem;
  background: #090909;
  border: 1px solid #343434;
  border-radius: 10px;
  color: #8ef7a8;
  padding: 0.9rem;
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
}

.candidate-item .primary-btn.is-running {
  background: #5a4d39;
  color: #f5d7a0;
}

.duplicates-list {
  display: grid;
  gap: 0.7rem;
  max-height: 48vh;
  overflow: auto;
}

.request-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #a8a8a8;
  font-size: 13px;
}

.request-filter-label select {
  background: #0f0f0f;
  color: #fff;
  border: 1px solid #303030;
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}

.request-admin-list {
  display: grid;
  gap: 0.7rem;
  max-height: 60vh;
  overflow: auto;
}

.request-admin-item {
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  background: #101010;
  padding: 0.75rem;
}

.request-admin-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.request-admin-meta {
  color: #9e9e9e;
  font-size: 12px;
  margin-top: 0.35rem;
}

.request-admin-controls {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.request-admin-controls textarea,
.request-admin-controls select {
  width: 100%;
  background: #0f0f0f;
  color: #fff;
  border: 1px solid #303030;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}

.request-admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.duplicate-group {
  border: 1px solid #2e2e2e;
  border-radius: 10px;
  background: #101010;
  padding: 0.75rem;
}

.manual-metadata-form {
  margin-top: 0.65rem;
}

.manual-metadata-fieldset {
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  padding: 0.8rem;
  background: #0f0f0f;
  margin: 0;
}

.manual-metadata-fieldset:disabled {
  opacity: 0.6;
}

.manual-metadata-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.provider-actions {
  justify-content: flex-start;
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 0.35rem;
  flex-wrap: wrap;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: #999;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  padding: 0.55rem 0.95rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: #1e1e1e;
  color: #ddd;
}

.tab-btn.active {
  background: #1f1f1f;
  color: #ff9000;
  box-shadow: inset 0 0 0 1px #3a3a3a;
}

.tab-btn svg {
  opacity: 0.7;
  flex-shrink: 0;
}

.tab-btn.active svg {
  opacity: 1;
  stroke: #ff9000;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-desc {
  font-size: 13px;
  margin-top: 0.2rem;
}

/* ── Provider badges ─────────────────────────────────────────────────── */
.provider-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.provider-header h2 {
  margin: 0;
}

.provider-badge {
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  text-transform: uppercase;
}

.provider-badge-stash {
  background: rgba(100, 149, 237, 0.15);
  border: 1px solid rgba(100, 149, 237, 0.35);
  color: #6495ed;
}

.provider-badge-tpdb {
  background: rgba(255, 144, 0, 0.12);
  border: 1px solid rgba(255, 144, 0, 0.3);
  color: #ff9000;
}

/* ── Suggest action buttons ──────────────────────────────────────────── */
.suggest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 0.6rem 0.9rem;
  transition: opacity 0.15s;
}

.action-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.action-btn-stash {
  background: rgba(100, 149, 237, 0.15);
  border: 1px solid rgba(100, 149, 237, 0.3);
  color: #8aadff;
}

.action-btn-stash:hover:not(:disabled) {
  background: rgba(100, 149, 237, 0.25);
}

.action-btn-tpdb {
  background: rgba(255, 144, 0, 0.12);
  border: 1px solid rgba(255, 144, 0, 0.28);
  color: #ffb454;
}

.action-btn-tpdb:hover:not(:disabled) {
  background: rgba(255, 144, 0, 0.22);
}

.action-btn-danger {
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.28);
  color: #f08080;
}

.action-btn-danger:hover:not(:disabled) {
  background: rgba(220, 80, 80, 0.22);
}

/* ── Matching left column ────────────────────────────────────────────── */
.matching-left-col {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.matching-left-col .top-gap {
  margin-top: 1rem;
}

/* ── Maintenance ─────────────────────────────────────────────────────── */
.maintenance-actions {
  display: grid;
  gap: 0.8rem;
}

.maintenance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #0f0f0f;
  border: 1px solid #282828;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  flex-wrap: wrap;
}

.maintenance-title {
  color: #e8e8e8;
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 0.2rem;
}

/* ── Text link ───────────────────────────────────────────────────────── */
.text-link {
  color: #ff9000;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* ── Empty hint ──────────────────────────────────────────────────────── */
.empty-hint {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #7a7a7a;
  font-size: 14px;
}

.empty-hint svg {
  flex-shrink: 0;
  opacity: 0.5;
}

@media (max-width: 900px) {
  .inline-form {
    flex-direction: column;
  }

  .library-controls-row {
    align-items: stretch;
  }

  .library-filter-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .library-tools-row {
    flex-direction: column;
    align-items: stretch;
  }

  .library-tools-row .primary-btn,
  .library-tools-row .secondary-btn,
  .page-size-control,
  .page-size-control select {
    width: 100%;
  }
}

.duplicate-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.duplicate-rows {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.45rem;
}

.duplicate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid #262626;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #0d0d0d;
  flex-wrap: wrap;
}

.duplicate-link {
  color: #f1f1f1;
  text-decoration: none;
}

.duplicate-link:hover {
  text-decoration: underline;
}

.duplicate-meta {
  color: #9e9e9e;
  font-size: 12px;
}

.top-gap {
  margin-top: 0.8rem;
}

#manualSceneSearchForm {
  align-items: stretch;
}

#manualSceneSearchInput {
  min-width: 0;
}

@media (min-width: 1500px) {
  .admin-main {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .admin-grid-top {
    grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  }

  .admin-grid-bottom {
    grid-template-columns: minmax(400px, 520px) minmax(0, 1fr);
  }
}

@media (max-width: 1080px) {
  .admin-grid-top,
  .admin-grid-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-main {
    padding: 1rem 0.85rem 1.5rem;
  }

  .admin-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-form {
    flex-direction: column;
  }
}

.hidden {
  display: none !important;
}

code {
  background: #0b0b0b;
  border-radius: 6px;
  padding: 0.08rem 0.35rem;
}

.full-width-card {
  margin-top: 1rem;
}

.section-note {
  font-size: 13px;
  margin-bottom: 0.6rem;
}

.section-note-tight {
  margin-bottom: 0.75rem;
}

.section-note-loose {
  margin-bottom: 0.85rem;
}

.signup-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.signup-code-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.signup-code-input {
  flex: 1;
}

@media (max-width: 900px) {
  .signup-code-row {
    flex-direction: column;
    align-items: stretch;
  }

  .signup-code-row .primary-btn,
  .signup-code-row .secondary-btn,
  .signup-code-row .signup-code-input {
    width: 100%;
  }
}
