.importer-page {
  background: #10121c;
}

.importer-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.importer-toolbar,
.importer-panel {
  background: #171a27;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0,0,0,.22);
}

.importer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.importer-lock {
  width: min(420px, 100%);
  margin: 2rem auto;
}

.importer-lock h1 {
  margin: 0 0 .4rem;
}

.importer-lock p {
  color: #b9b9c8;
}

.importer-message {
  min-height: 1.4rem;
  color: #ffb4b4;
}

.importer-toolbar-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.importer-toolbar h1,
.importer-panel h2 {
  margin: 0;
}

.importer-toolbar p {
  margin: .35rem 0 0;
  color: #b9b9c8;
}

.importer-status {
  padding: .45rem .7rem;
  border-radius: 6px;
  background: #24283a;
  color: #d8d8e4;
  font-weight: 700;
}

.importer-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.importer-panel {
  padding: 1rem;
}

.importer-form {
  display: grid;
  gap: .75rem;
}

.importer-form label,
.progress-head,
.log-head {
  color: #f7f7fb;
  font-weight: 700;
}

.importer-form input[type="url"],
.importer-form input[type="password"],
.importer-form input[type="email"],
.importer-form input[type="text"],
.importer-form input[type="number"],
.importer-form textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: #0f111b;
  color: #fff;
  padding: .75rem;
}

.importer-form textarea {
  min-height: 116px;
  resize: vertical;
}

.queue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .75rem;
}

.queue-limit {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #d8d8e4;
  font-size: .85rem;
}

.queue-limit input {
  width: 82px;
}

.importer-options {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.importer-options label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .7rem;
  border-radius: 6px;
  background: #202438;
}

.importer-check {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: #d8d8e4;
  font-weight: 700;
}

.importer-actions,
.log-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.log-head {
  justify-content: space-between;
  margin-bottom: .75rem;
}

.importer-actions button,
.importer-form button,
.importer-secondary {
  border: 0;
  border-radius: 6px;
  padding: .75rem 1rem;
  color: #fff;
  background: #0c70de;
  cursor: pointer;
  font-weight: 800;
}

.importer-secondary {
  background: #2d3246;
}

.importer-danger {
  background: #b4232c;
}

.queue-actions {
  padding-top: .25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.compact-actions {
  gap: .45rem;
}

.compact-actions button {
  padding: .55rem .75rem;
}

.importer-actions button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.progress-bar {
  height: 14px;
  overflow: hidden;
  background: #0d1019;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08);
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0c70de, #22c55e);
  transition: width .25s ease;
}

.progress-message {
  min-height: 1.25rem;
  margin: .65rem 0 0;
  color: #aeb4c8;
  font-size: .86rem;
  line-height: 1.35;
}

.progress-message.ok {
  color: #86efac;
}

.progress-message.error {
  color: #fca5a5;
}

.importer-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0 0;
}

.importer-stats div {
  padding: .75rem;
  border-radius: 6px;
  background: #10131f;
}

.importer-stats dt {
  color: #9fa4ba;
  font-size: .82rem;
}

.importer-stats dd {
  margin: .25rem 0 0;
  color: #fff;
  font-weight: 800;
}

.importer-preview {
  margin-bottom: 1rem;
}

.preview-head {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  align-items: start;
}

.preview-head img {
  width: 88px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #0d1019;
}

.preview-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .75rem;
}

.preview-badges span {
  border-radius: 6px;
  background: #202438;
  color: #d8d8e4;
  padding: .35rem .55rem;
  font-size: .85rem;
}

.episode-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.episode-table th,
.episode-table td {
  padding: .6rem;
  border-top: 1px solid rgba(255,255,255,.08);
  text-align: left;
  color: #d8d8e4;
}

.episode-table th {
  color: #fff;
}

.history-list {
  display: grid;
  gap: .75rem;
}

.queue-list {
  display: grid;
  gap: .5rem;
  max-height: 360px;
  overflow: auto;
}

.queue-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .65rem;
  align-items: start;
  padding: .75rem;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: #10131f;
}

.queue-item strong {
  display: block;
  color: #fff;
}

.queue-item small {
  display: block;
  margin-top: .25rem;
  color: #9fa4ba;
  overflow-wrap: anywhere;
}

.massive-shell {
  width: min(1320px, calc(100% - 2rem));
}

.massive-grid {
  grid-template-columns: minmax(320px, 470px) 1fr;
}

.massive-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.massive-options-grid label {
  display: grid;
  gap: .4rem;
  color: #f7f7fb;
}

.massive-queue {
  max-height: 560px;
}

.massive-item em {
  display: inline-flex;
  width: fit-content;
  margin-top: .5rem;
  padding: .25rem .45rem;
  border-radius: 6px;
  background: #2d3246;
  color: #d8d8e4;
  font-style: normal;
  font-weight: 800;
  font-size: .78rem;
}

.massive-ready em {
  background: #0e4f75;
  color: #bce9ff;
}

.massive-imported em,
.massive-skipped em {
  background: #14532d;
  color: #bbf7d0;
}

.massive-analyzing em,
.massive-importing em {
  background: #713f12;
  color: #fde68a;
}

.massive-error em {
  background: #7f1d1d;
  color: #fecaca;
}

.auto-shell {
  width: min(1080px, calc(100% - 2rem));
}

.auto-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem;
  border-radius: 6px;
  background: #10131f;
}

.auto-switch-row p {
  margin: .35rem 0 0;
  color: #b9b9c8;
}

.auto-log-list {
  display: grid;
  gap: .6rem;
  max-height: 520px;
  overflow: auto;
}

.auto-log-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .65rem;
  align-items: start;
  padding: .8rem;
  border: 1px solid rgba(255,255,255,.08);
  border-left: 4px solid #2d3246;
  border-radius: 6px;
  background: #10131f;
}

.auto-log-item.error {
  border-left-color: #ef4444;
}

.auto-log-item.warning {
  border-left-color: #f59e0b;
}

.auto-log-item.info {
  border-left-color: #38bdf8;
}

.auto-log-item.resolved {
  opacity: .72;
}

.auto-log-item span,
.auto-log-item small,
.auto-log-item em,
.auto-log-item b {
  display: block;
}

.auto-log-item strong,
.auto-log-item b {
  color: #fff;
}

.auto-log-item em {
  margin: .15rem 0 .35rem;
  color: #9fa4ba;
  font-style: normal;
  font-size: .82rem;
}

.auto-log-item small {
  margin-top: .35rem;
  color: #9fa4ba;
  overflow-wrap: anywhere;
}

.empty-history {
  margin: 0;
  color: #9fa4ba;
}

.history-item {
  padding: .85rem;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: #10131f;
}

.history-item div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.history-item strong {
  color: #fff;
}

.history-item span,
.history-item small {
  color: #9fa4ba;
}

.history-item p {
  margin: .5rem 0;
  color: #d8d8e4;
}

.history-item small {
  display: block;
  overflow-wrap: anywhere;
}

.import-log {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  border-radius: 6px;
  background: #090b12;
  color: #c8f7d1;
  white-space: pre-wrap;
}

@media (max-width: 820px) {
  .importer-toolbar,
  .preview-head {
    grid-template-columns: 1fr;
  }

  .importer-toolbar {
    display: block;
  }

  .importer-toolbar-actions {
    margin-top: 1rem;
  }

  .importer-grid,
  .importer-stats,
  .massive-options-grid {
    grid-template-columns: 1fr;
  }

  .auto-switch-row {
    display: grid;
  }
}

.admin-capacity-panel,
.admin-cleanup-panel {
  grid-column: 1 / -1;
}

.capacity-help {
  margin: 0 0 1rem;
  color: #aeb4c8;
}

.capacity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
}

.capacity-card {
  padding: .9rem;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: #10131f;
}

.capacity-card > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}

.capacity-card b { color: #fff; }
.capacity-card small,
.capacity-card em { display: block; margin-top: .45rem; color: #aeb4c8; font-style: normal; }
.capacity-card em { font-size: .78rem; }

.capacity-track {
  height: 10px;
  margin-top: .75rem;
  overflow: hidden;
  border-radius: 99px;
  background: #252a3b;
}

.capacity-track span { display: block; height: 100%; border-radius: inherit; background: #22c55e; }
.capacity-card.warning .capacity-track span { background: #f59e0b; }
.capacity-card.danger .capacity-track span { background: #ef4444; }

.capacity-badge {
  padding: .3rem .55rem;
  border-radius: 99px;
  background: #183323;
  color: #86efac;
  font-size: .78rem;
}
.capacity-badge.warning { background: #4a3510; color: #fcd34d; }
.capacity-badge.danger { background: #4c1519; color: #fca5a5; }
.capacity-warning { margin-top: 1rem; padding: .8rem; border-left: 4px solid #f59e0b; background: #3b2a0d; color: #fde68a; }
.capacity-links { margin-top: 1rem; }

.cleanup-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem 1rem;
  align-items: end;
}

.cleanup-actions label { display: grid; gap: .35rem; color: #d8d8e4; }
.cleanup-actions select { width: 100%; }

@media (max-width: 820px) {
  .capacity-grid,
  .cleanup-actions { grid-template-columns: 1fr; }
}
