.admin-trailers-view {
  display: grid;
  gap: 18px;
}

.admin-trailers-header,
.trailer-panel-heading,
.trailer-storage-row,
.trailer-catalog-toolbar,
.trailer-pagination {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.admin-trailers-header h1 {
  margin: 5px 0 8px;
}

.admin-trailers-header p,
.trailer-panel-heading p,
.trailer-help-text {
  color: var(--text-muted, #9aa8bb);
  line-height: 1.55;
  margin: 0;
  max-width: 850px;
}

.admin-trailers-status {
  border: 1px solid rgba(92, 176, 139, .38);
  border-radius: 12px;
  padding: 12px 15px;
  background: rgba(30, 110, 77, .12);
  color: var(--text-primary, #e8edf5);
}

.admin-trailers-status.error {
  border-color: rgba(232, 102, 102, .48);
  background: rgba(130, 36, 36, .16);
}

.trailer-download-progress {
  border: 1px solid rgba(92, 176, 139, .38);
  border-radius: 10px;
  padding: 10px 13px;
  background: rgba(30, 110, 77, .12);
  color: var(--text-primary, #e8edf5);
  font-size: 13px;
}

.trailer-download-progress.error {
  border-color: rgba(232, 102, 102, .48);
  background: rgba(130, 36, 36, .16);
}

.admin-trailers-panel {
  min-width: 0;
  border: 1px solid var(--border-subtle, rgba(155, 175, 203, .18));
  border-radius: 18px;
  padding: clamp(16px, 2vw, 24px);
  background: var(--surface-panel, rgba(13, 23, 38, .72));
  display: grid;
  gap: 18px;
}

.trailer-panel-heading h2 {
  margin: 5px 0 7px;
}

.trailer-section-kicker {
  color: var(--accent, #70b7ff);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.trailer-storage-row {
  align-items: flex-end;
}

.trailer-storage-field,
.trailer-search-field,
.trailer-root-filter {
  display: grid;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.trailer-storage-field > span,
.trailer-search-field > span,
.trailer-root-filter > span {
  color: var(--text-muted, #9aa8bb);
  font-size: 12px;
  font-weight: 700;
}

.trailer-storage-field input,
.trailer-search-field input,
.trailer-root-filter select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border-subtle, rgba(155, 175, 203, .24));
  border-radius: 10px;
  padding: 12px 13px;
  color: var(--text-primary, #edf3fa);
  background: var(--surface-input, rgba(3, 10, 19, .55));
  font: inherit;
}

.trailer-help-text {
  font-size: 12px;
}

.trailer-primary-button,
.trailer-secondary-button {
  border-radius: 10px;
  padding: 11px 15px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.trailer-primary-button {
  background: var(--accent, #70b7ff);
  color: #07111f;
}

.trailer-secondary-button {
  background: rgba(115, 143, 176, .11);
  border-color: var(--border-subtle, rgba(155, 175, 203, .22));
  color: var(--text-primary, #edf3fa);
}

.trailer-primary-button:disabled,
.trailer-secondary-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.trailer-selection-count {
  color: var(--text-muted, #9aa8bb);
  font-size: 12px;
  white-space: nowrap;
}

.trailer-root-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 10px;
}

.trailer-root-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--border-subtle, rgba(155, 175, 203, .2));
  border-radius: 13px;
  padding: 14px;
  background: rgba(125, 153, 186, .055);
  cursor: pointer;
}

.trailer-root-card:has(input:checked) {
  border-color: rgba(112, 183, 255, .72);
  background: rgba(49, 120, 187, .12);
}

.trailer-root-card.is-disabled {
  opacity: .52;
  cursor: not-allowed;
}

.trailer-root-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.trailer-root-check {
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(159, 182, 210, .58);
  border-radius: 6px;
  margin-top: 2px;
  display: grid;
  place-items: center;
}

.trailer-root-card input:checked + .trailer-root-check {
  border-color: var(--accent, #70b7ff);
  background: var(--accent, #70b7ff);
}

.trailer-root-card input:checked + .trailer-root-check::after {
  content: "✓";
  color: #07111f;
  font-size: 13px;
  font-weight: 900;
}

.trailer-root-info {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.trailer-root-info strong,
.trailer-catalog-main strong {
  overflow-wrap: anywhere;
}

.trailer-root-info small,
.trailer-root-meta,
.trailer-root-info em {
  color: var(--text-muted, #9aa8bb);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.trailer-root-info em {
  color: #e5b46a;
  font-style: normal;
}

.trailer-catalog-toolbar {
  align-items: flex-end;
  flex-wrap: wrap;
}

.trailer-search-field {
  flex: 2 1 220px;
}

.trailer-root-filter {
  flex: 1 1 190px;
}

.trailer-catalog-summary {
  color: var(--text-muted, #9aa8bb);
  font-size: 12px;
  margin: 3px 0 8px;
}

.trailer-catalog-list {
  display: grid;
  border-top: 1px solid var(--border-subtle, rgba(155, 175, 203, .16));
}

.trailer-catalog-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(125px, .7fr) minmax(220px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--border-subtle, rgba(155, 175, 203, .14));
}

.trailer-catalog-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.trailer-catalog-main > div,
.trailer-catalog-tmdb,
.trailer-catalog-status {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.trailer-catalog-main small,
.trailer-catalog-tmdb small,
.trailer-catalog-status small {
  color: var(--text-muted, #9aa8bb);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.trailer-catalog-tmdb strong,
.trailer-catalog-status strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.trailer-download-state {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--border-subtle, rgba(155, 175, 203, .13));
  margin-top: 4px;
  padding-top: 8px;
}

.trailer-download-success {
  color: #7dd6a7;
}

.trailer-download-error {
  color: #ff9b9b;
}

.trailer-type-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text-muted, #aebbd0);
  background: rgba(125, 153, 186, .12);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.trailer-muted {
  color: var(--text-muted, #9aa8bb);
  font-weight: 600;
}

.trailer-empty {
  padding: 22px 12px;
  color: var(--text-muted, #9aa8bb);
  text-align: center;
  line-height: 1.5;
}

.trailer-pagination {
  align-items: center;
  justify-content: flex-end;
  color: var(--text-muted, #9aa8bb);
  font-size: 12px;
}

.trailer-browser-backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(1, 5, 12, .78);
  backdrop-filter: blur(8px);
}

.trailer-browser-dialog {
  width: min(760px, 100%);
  max-height: min(760px, 90vh);
  display: grid;
  grid-template-rows: auto auto minmax(150px, 1fr) auto;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--border-subtle, rgba(155, 175, 203, .25));
  border-radius: 18px;
  background: var(--surface-panel, #0d1726);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}

.trailer-browser-dialog header,
.trailer-browser-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.trailer-browser-dialog h2 {
  margin: 5px 0 0;
}

.trailer-browser-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-subtle, rgba(155, 175, 203, .25));
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary, #edf3fa);
  font-size: 25px;
  cursor: pointer;
}

.trailer-browser-path {
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(1, 7, 15, .4);
  color: var(--text-muted, #aab8cc);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.trailer-browser-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 6px;
}

.trailer-browser-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px;
  background: rgba(125, 153, 186, .07);
  color: var(--text-primary, #edf3fa);
  cursor: pointer;
}

.trailer-browser-entry:hover,
.trailer-browser-entry:focus-visible {
  border-color: rgba(112, 183, 255, .6);
  background: rgba(49, 120, 187, .14);
}

.trailer-browser-entry strong {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.trailer-browser-folder {
  color: var(--accent, #70b7ff);
}

.trailer-browser-parent {
  color: var(--text-muted, #aab8cc);
}

.trailer-browser-dialog footer {
  padding-top: 4px;
  align-items: flex-end;
}

.trailer-browser-dialog footer span {
  color: var(--text-muted, #9aa8bb);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .admin-trailers-header,
  .trailer-panel-heading,
  .trailer-storage-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-trailers-header .trailer-primary-button {
    width: 100%;
  }

  .trailer-catalog-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .trailer-catalog-tmdb,
  .trailer-catalog-status {
    padding-left: 2px;
  }

  .trailer-browser-dialog {
    padding: 16px;
  }

  .trailer-browser-dialog footer {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Trailer work queue: keep the screen compact while the four workers run. */
.trailer-download-progress {
  display: grid;
  gap: 9px;
}

.trailer-download-progress[hidden] {
  display: none;
}

.trailer-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.trailer-progress-heading strong {
  font-size: 15px;
}

.trailer-progress-heading span,
.trailer-download-progress small,
.trailer-download-progress > span {
  color: var(--text-muted, #aab8cc);
  font-size: 12px;
}

.trailer-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(125, 153, 186, .18);
}

.trailer-progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #70b7ff);
  transition: width .25s ease;
}

.trailer-fix-button {
  width: max-content;
  max-width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  font-size: 12px;
  white-space: normal;
}

.trailer-manual-dialog {
  grid-template-rows: auto auto auto auto auto auto;
  width: min(680px, 100%);
  max-height: 90vh;
}

.trailer-manual-title {
  margin: 0;
  color: var(--text-primary, #edf3fa);
  font-size: 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.trailer-manual-dialog footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.trailer-manual-dialog footer button {
  min-height: 42px;
}

.trailer-manual-error {
  font-size: 13px;
}

@media (max-width: 760px) {
  .trailer-catalog-toolbar > button {
    flex: 1 1 140px;
  }
  .trailer-manual-dialog footer button {
    flex: 1 1 140px;
  }
}
