:root {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7fb;
  color: #111;
}

body {
  margin: 0;
  background: #f4f6fb;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: #fff;
  color: #0f172a;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  background: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
}

.brand-logo img {
  display: block;
  max-height: 55px;
  height: auto;
  width: auto;
  max-width: 260px;
}

.brand-text p {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.brand-text small {
  color: #475569;
}

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

.user-info img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.search-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0 auto;
  justify-content: center;
  width: fit-content;
}

.search-form input[type="text"] {
  flex: 0 0 auto;
  min-width: 320px;
  max-width: 36ch;
  font-size: 0.95rem;
  text-align: center;
  padding: 0.45rem 1rem;
  border-radius: 16px;
}

.search-form button {
  padding: 0.35rem 1rem;
}

.admin-button {
  margin-left: 0.5cm;
  margin-right: 0.5cm;
}

.content {
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
}

.with-sidebar .content {
  padding: 2rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-label {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 1px;
}

.hero {
  text-align: center;
}

.muted-card {
  text-align: center;
  color: #64748b;
}

.upload-card {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.upload-card form {
  flex: 1;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

input[type="text"],
textarea,
input[type="file"],
select {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  font-size: 1rem;
}

.button,
button {
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  gap: 0.35rem;
}

.button.primary,
button.primary {
  background: #2563eb;
  color: #fff;
}

.video-grid {
  display: grid;
  gap: 1rem;
}

.video-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  background: #fff;
}

.video-card.highlight {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.video-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.video-card details {
  margin: 0.5rem 0;
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.inline-form.danger {
  border-top: 1px solid #fcdada;
  padding-top: 0.75rem;
}

.inline-form button {
  align-self: flex-start;
}

.button.ghost {
  background: transparent;
  border: 1px solid #cbd5f5;
  color: #0f172a;
}

.button.danger,
button.danger {
  background: #dc2626;
  color: #fff;
}

.pill {
  background: #0f172a;
  color: #fff;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.pill-cert {
  background: #e0e7ff;
  color: #1e3a8a;
  margin-left: 0.5rem;
}

.embed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.embed-actions .button,
.embed-actions button {
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: 1px solid #cbd5f5;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

.embed-actions .button.primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.embed-replace-form {
  display: inline-flex;
  margin: 0;
}

.embed-replace-form input[type="file"] {
  display: none;
}

.embed-replace-form .replace-trigger {
  margin: 0;
}

.embed-actions button.primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.embed-block[hidden] {
  display: none;
}

.status-log {
  font-size: 0.9rem;
  color: #475569;
  margin: 0.5rem 0 0;
}

.processing-steps {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.processing-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  align-items: center;
  background: #fff;
}

.processing-step:last-child {
  border-bottom: none;
}

.processing-step p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #475569;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.processing-step.step-done .step-number {
  background: #22c55e;
  color: #fff;
}

.processing-step.step-current .step-number {
  background: #f59e0b;
  color: #fff;
}

.processing-step.step-error .step-number {
  background: #ef4444;
  color: #fff;
}

.processing-step.step-done strong {
  color: #15803d;
}

.processing-step.step-current strong {
  color: #92400e;
}

.processing-step.step-error p,
.processing-step.step-error strong {
  color: #b91c1c;
}

.processing-step.step-pending strong {
  color: #0f172a;
}

.processing-step.step-error strong {
  color: #b91c1c;
}

.live-log {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

[hidden] {
  display: none !important;
}

.status {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: capitalize;
  font-size: 0.85rem;
}

.status-ready {
  background: #dcfce7;
  color: #166534;
}

.status-processing,
.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

textarea[readonly] {
  font-family: monospace;
  font-size: 0.85rem;
}

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 80px);
}

.layout.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.layout.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: #2563eb;
  color: #1d4ed8;
}

.sidebar-toggle-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.sidebar {
  background: #0f172a;
  color: #fff;
  padding: 1.5rem 1rem;
}

.sidebar-section + .sidebar-section {
  margin-top: 1.5rem;
}

.tvtoro-admin-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 80px);
  min-height: 700px;
  border: 0;
  background: #0f172a;
}

.with-sidebar .tvtoro-panel {
  display: block;
  padding: 0;
}

.sidebar-link {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
  background: #2563eb;
}

.sidebar-certifications summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
}

.sidebar-certifications summary::-webkit-details-marker {
  display: none;
}

.sidebar-certifications[open] summary {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

.sidebar-certifications[open] .sidebar-chevron {
  transform: rotate(225deg);
}

.sidebar-list {
  list-style: none;
  padding: 0.5rem 0 0;
  margin: 0;
  display: grid;
  gap: 0.25rem;
}

.sidebar-list a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
  display: block;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
}

.sidebar-list a.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.sidebar-list a:hover {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    grid-row: 1;
  }

  .search-form {
    margin: 0;
  }

  .search-form input[type="text"] {
    min-width: 0;
    max-width: 100%;
  }

  .user-info {
    flex-wrap: wrap;
  }
}

.main-panel {
  background: #f7f7fb;
  min-height: calc(100vh - 80px);
}

#infinite-sentinel {
  width: 100%;
  height: 1px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: min(700px, 90%);
  max-height: 80vh;
  overflow: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.user-grid {
  display: grid;
  gap: 1rem;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr 160px 100px;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid #e2e8f0;
  padding: 0.75rem;
  border-radius: 10px;
}
