:root {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a21;
  --border: #262b36;
  --fg: #e8eaed;
  --muted: #9aa3b2;
  --accent: #6ea8fe;
  --success: #4caf7d;
  --error: #e5637a;
  --warning: #e6b400;
  --performer: #d9a86c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}
main {
  max-width: min(900px, 94vw);
  margin: 0 auto;
  padding: 3rem 1.25rem 6rem;
}
header { text-align: center; margin-bottom: 2.5rem; }
h1 { font-size: 1.9rem; margin: 0 0 0.5rem; }
h2 { margin-top: 0; font-size: 1.1rem; }
.brand { color: var(--muted); font-size: 0.95rem; }
section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
p { color: var(--fg); }
p.muted { color: var(--muted); }
.cta { text-align: center; padding: 1rem; }
.btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  font-size: 1.05rem;
  margin: 0.35rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #0f1115; }
.btn-secondary { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn:hover { filter: brightness(1.1); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.floating-bar .btn[hidden] { display: none; }
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}
details summary { cursor: pointer; font-weight: 600; }
footer { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 2.5rem; }

/* Video picker */
.video-list { display: flex; flex-direction: column; gap: 0.75rem; }
.video-item {
  position: relative;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  overflow: hidden;
}
.video-item input[type="checkbox"] { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.video-body { flex: 1; min-width: 0; }
.video-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.75rem; }
.video-item .title { font-weight: 600; flex: 1 1 200px; min-width: 0; }
.video-item .price { font-weight: 600; color: var(--accent); white-space: nowrap; margin-left: auto; }
.video-item .nft-status { color: var(--error); font-weight: 700; font-size: 0.9rem; margin-top: 0.3rem; }
.video-item .cast { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.video-item .cast .performer.performer-match { color: var(--performer); font-weight: 600; }
.video-item .notes { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.video-item .language { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.video-item .language-flags {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-top: 0.5rem;
}
.video-item .language-flag { font-size: 1.25rem; line-height: 1; }
.video-links { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.btn-small {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
}
.btn-small:hover { border-color: var(--accent); }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.icon-btn img { display: block; }
.icon-btn:hover { border-color: var(--accent); }

.search-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin: 0 0 1.25rem;
}
.search-bar input,
.search-bar select {
  flex: 1 1 160px;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.92rem;
}
.search-bar input[type="search"] { flex: 2 1 220px; }
.search-bar .tag-input {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.search-bar .tag-input input {
  flex: 1 1 100px;
  min-width: 80px;
  border: none;
  background: none;
  padding: 0.2rem 0;
}
.search-bar .tag-input input:focus { outline: none; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(110, 168, 254, 0.18);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.3rem 0.2rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.tag-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.3rem;
}
.performer-suggestions {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.performer-suggestions li {
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.performer-suggestions li:hover,
.performer-suggestions li.active {
  background: rgba(110, 168, 254, 0.18);
  color: var(--accent);
}

.expand-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0 0;
  cursor: pointer;
}
.expand-toggle .chevron { display: inline-block; transition: transform 0.15s ease; }
.video-item.expanded .expand-toggle .chevron { transform: rotate(180deg); }
.video-details { display: none; margin-top: 0.4rem; }
.video-item.expanded .video-details { display: block; }

.floating-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.floating-bar .summary { font-size: 1rem; }
.floating-bar .summary strong { color: var(--accent); }
#discount-note { color: var(--success); font-weight: 600; }

.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.35rem; font-weight: 600; }

.field .agreement-label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
}
.field .agreement-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}
.field input[type="email"], .field input[type="text"], .field input[type="password"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
}
.error-box {
  background: rgba(229, 99, 122, 0.12);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.warning-note {
  background: rgba(230, 180, 0, 0.12);
  border: 1px solid var(--warning);
  color: var(--warning);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.warning-note.warning-note-done {
  background: rgba(76, 175, 125, 0.12);
  border-color: var(--success);
  color: var(--success);
}
.warning-note.warning-note-failed {
  background: rgba(154, 163, 178, 0.12);
  border-color: var(--muted);
  color: var(--muted);
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge-pending { background: rgba(154, 163, 178, 0.2); color: var(--muted); }
.badge-confirmed { background: rgba(76, 175, 125, 0.2); color: var(--success); }
.video-item .badge-new {
  position: absolute;
  top: 0;
  right: 0;
  display: block;
  background: var(--warning);
  color: #1a1400;
  border-radius: 0 9px 0 9px;
  padding: 0.25rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 0;
}
.video-item:has(.badge-new) { padding-top: 2.1rem; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 480px; }

@media (max-width: 640px) {
  main { padding: 1.75rem 1rem 6rem; }
  h1 { font-size: 1.5rem; }
  section, details { padding: 1.1rem; }
  .search-bar { padding: 0.75rem; }
  .floating-bar { flex-direction: column; align-items: stretch; padding: 0.85rem 1rem; }
  .floating-bar .summary { text-align: center; }
  .floating-bar .btn { width: 100%; text-align: center; }
  .video-item { flex-wrap: wrap; }
}
