:root {
  color-scheme: dark;
  --bg: #0e1116;
  --panel: #151922;
  --panel-strong: #1b212d;
  --line: #2a3342;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #9ba7b7;
  --muted-strong: #c7d0dc;
  --cyan: #58d6df;
  --green: #65d58b;
  --amber: #f2ba5e;
  --red: #f06b6b;
  --violet: #a78bfa;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(88, 214, 223, 0.08), rgba(88, 214, 223, 0) 28rem),
    linear-gradient(135deg, rgba(101, 213, 139, 0.05), rgba(167, 139, 250, 0.04) 45%, rgba(14, 17, 22, 0) 80%),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1640px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar,
.workspace,
.details-panel,
.queue-panel,
.opened-panel {
  animation: rise-in 420ms ease both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 2px 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.04;
}

h2 {
  font-size: 22px;
  line-height: 1.15;
}

.muted {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.health-strip,
.eta-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted-strong);
  background: rgba(21, 25, 34, 0.86);
  white-space: nowrap;
}

.health-strip {
  color: #ffd3d3;
  border-color: rgba(240, 107, 107, 0.35);
  background: rgba(240, 107, 107, 0.1);
}

.health-strip button {
  border: 0;
  padding: 0;
  color: var(--cyan);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.auth-status {
  max-width: 320px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--muted-strong);
  background: rgba(16, 20, 27, 0.68);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 16px rgba(242, 186, 94, 0.6);
}

.health-strip.is-ok .dot {
  background: var(--green);
  box-shadow: 0 0 16px rgba(101, 213, 139, 0.62);
}

.health-strip.is-bad .dot {
  background: var(--red);
  box-shadow: 0 0 16px rgba(240, 107, 107, 0.58);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
}

.upload-panel,
.history-panel,
.details-panel,
.queue-panel,
.opened-panel,
.pack-section,
.progress-panel,
.timeline-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(21, 25, 34, 0.92);
  box-shadow: var(--shadow);
}

.upload-panel,
.history-panel,
.details-panel,
.queue-panel,
.opened-panel {
  padding: 16px;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(310px, 400px);
  gap: 14px;
}

.drop-zone {
  position: relative;
  display: flex;
  min-height: 258px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  border: 1px dashed rgba(88, 214, 223, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(88, 214, 223, 0.08), rgba(101, 213, 139, 0.04)),
    rgba(14, 17, 22, 0.38);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.drop-zone::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(90deg, transparent, rgba(88, 214, 223, 0.2), transparent);
  transform: translateX(-105%);
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--cyan);
  transform: translateY(-1px);
  background:
    linear-gradient(135deg, rgba(88, 214, 223, 0.14), rgba(242, 186, 94, 0.05)),
    rgba(14, 17, 22, 0.52);
}

.drop-zone.is-dragging::before {
  animation: scan 1100ms ease infinite;
}

.drop-zone.needs-file {
  animation: shake 480ms ease;
  border-color: var(--amber);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(88, 214, 223, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 50% 17px / 22px 2px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 50% 17px / 2px 22px no-repeat,
    linear-gradient(180deg, rgba(88, 214, 223, 0.18), rgba(88, 214, 223, 0.04));
}

.drop-title {
  font-size: 22px;
  font-weight: 800;
}

.drop-meta {
  max-width: 100%;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.run-panel {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(14, 17, 22, 0.38);
}

.selected-files {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}

.file-chip {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.03);
}

.file-chip span {
  margin: 0;
  color: var(--cyan);
}

.file-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #10141b;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(88, 214, 223, 0.12);
}

.primary-button,
.ghost-button,
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-button {
  margin-top: auto;
  background: linear-gradient(135deg, #58d6df, #65d58b);
  color: #071014;
  font-weight: 900;
}

.primary-button:hover,
.ghost-button:hover,
.icon-link:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.is-disabled {
  opacity: 0.48;
  pointer-events: none;
}

.button-icon {
  width: 15px;
  height: 15px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  background: currentColor;
}

.primary-button.is-working .button-icon {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(7, 16, 20, 0.42);
  border-top-color: #071014;
  border-radius: 50%;
  background: none;
  clip-path: none;
  animation: spin 700ms linear infinite;
}

.ghost-button,
.icon-link {
  border-color: var(--line);
  background: rgba(16, 20, 27, 0.8);
}

.sort-select {
  width: auto;
  min-width: 176px;
  min-height: 42px;
  border-color: var(--line);
  background: rgba(16, 20, 27, 0.8);
  color: var(--text);
}

.search-input {
  width: min(260px, 100%);
  min-width: 190px;
  border-color: var(--line);
  background: rgba(16, 20, 27, 0.8);
}

.progress-panel {
  margin-top: 14px;
  padding: 14px;
  background: rgba(18, 24, 33, 0.94);
}

.progress-head,
.section-head,
.details-head,
.pack-head,
.job-top,
.video-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.queue-panel,
.opened-panel {
  margin-top: 16px;
}

.queue-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.source-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: rgba(14, 17, 22, 0.42);
  overflow: hidden;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.delete-source {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(240, 107, 107, 0.42);
  border-radius: 8px;
  color: var(--red);
  background: rgba(9, 12, 17, 0.78);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.source-card:hover .delete-source,
.source-card.is-open .delete-source {
  opacity: 1;
  transform: translateY(0);
}

.delete-source:hover {
  border-color: var(--red);
  background: rgba(240, 107, 107, 0.14);
}

.delete-source svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.source-card:hover,
.source-card.is-open {
  border-color: rgba(88, 214, 223, 0.52);
  background: rgba(88, 214, 223, 0.07);
}

.source-card.running,
.source-card.queued {
  border-color: rgba(242, 186, 94, 0.28);
}

.source-main {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.source-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(88, 214, 223, 0.12), rgba(101, 213, 139, 0.06)),
    #080b10;
  overflow: hidden;
}

.source-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 34%, rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.source-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.source-thumb.is-missing::after {
  content: "preview";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-index {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(88, 214, 223, 0.48);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(9, 12, 17, 0.78);
  backdrop-filter: blur(8px);
  font-size: 18px;
  font-weight: 900;
}

.source-body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding-top: 10px;
}

.source-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.source-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-state {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.page-button,
.page-ellipsis {
  display: inline-grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted-strong);
  background: rgba(16, 20, 27, 0.8);
  font-weight: 800;
}

.page-button {
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.page-button:hover,
.page-button.is-current {
  border-color: rgba(88, 214, 223, 0.58);
  color: var(--text);
  background: rgba(88, 214, 223, 0.12);
  transform: translateY(-1px);
}

.page-ellipsis {
  border-color: transparent;
  background: transparent;
}

.source-state small,
.source-foot {
  color: var(--muted);
  font-size: 12px;
}

.source-state small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-foot {
  display: block;
  min-width: 0;
}

.source-foot span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter,
.mini-meter {
  display: block;
  height: 10px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter span,
.mini-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--amber));
  transition: width 420ms ease;
}

.stage-line {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted-strong);
  overflow-wrap: anywhere;
}

.stage-rail {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.stage-rail li {
  min-height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.stage-rail li.is-done {
  color: #071014;
  border-color: rgba(101, 213, 139, 0.56);
  background: rgba(101, 213, 139, 0.86);
}

.stage-rail li.is-current {
  color: var(--text);
  border-color: rgba(88, 214, 223, 0.7);
  background: rgba(88, 214, 223, 0.16);
  animation: pulse-border 1.8s ease infinite;
}

.history-panel {
  min-height: 420px;
}

.job-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  max-height: 448px;
  overflow: auto;
  padding-right: 3px;
}

.job-card {
  display: grid;
  width: 100%;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: rgba(14, 17, 22, 0.42);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.job-card:hover,
.job-card.is-selected {
  border-color: rgba(88, 214, 223, 0.55);
  background: rgba(88, 214, 223, 0.08);
  transform: translateY(-1px);
}

.job-meta,
.clip-meta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.status-badge {
  min-height: 25px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.status-badge.done {
  color: #06120c;
  background: var(--green);
}

.status-badge.failed {
  color: #1b0707;
  background: var(--red);
}

.status-badge.running,
.status-badge.queued {
  color: #111007;
  background: var(--amber);
}

.mini-meter {
  height: 4px;
  margin: 2px 0 0;
}

.soft-empty,
.empty-state,
.preview-placeholder {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.soft-empty.small {
  min-height: 76px;
  padding: 10px;
}

.details-panel {
  margin-top: 16px;
  min-height: 420px;
}

.pack-section {
  padding: 16px;
  background: rgba(21, 25, 34, 0.78);
  overflow: hidden;
}

.pack-section + .pack-section {
  margin-top: 16px;
}

.pack-head {
  align-items: center;
}

.pack-head .muted {
  margin-top: 6px;
  color: var(--green);
  font-weight: 800;
}

.pack-meter {
  height: 8px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.pack-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--amber));
}

.pack-wait {
  margin-top: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.03);
  overflow-wrap: anywhere;
}

.details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.summary-tile {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  background: rgba(14, 17, 22, 0.4);
}

.summary-tile span {
  color: var(--muted);
  font-size: 12px;
}

.summary-tile strong {
  font-size: 20px;
}

.error-box {
  margin-top: 14px;
  border: 1px solid rgba(240, 107, 107, 0.38);
  border-radius: 8px;
  padding: 12px;
  color: #ffd3d3;
  background: rgba(240, 107, 107, 0.1);
  overflow-wrap: anywhere;
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(240px, 370px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.main-preview video,
.video-card video,
.video-modal-player {
  display: block;
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #05070a;
  object-fit: contain;
}

.main-preview video {
  aspect-ratio: 9 / 16;
  max-height: 620px;
}

.timeline-card {
  padding: 14px;
  box-shadow: none;
}

.timeline-card ol {
  display: grid;
  gap: 9px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.timeline-card li {
  display: grid;
  gap: 3px;
  border-left: 2px solid rgba(88, 214, 223, 0.6);
  padding-left: 10px;
}

.timeline-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-card strong {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.contact-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.contact-strip img {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #05070a;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.video-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: rgba(14, 17, 22, 0.48);
  transition: border-color 160ms ease, transform 160ms ease;
}

.video-frame {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.video-card.is-pending {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.025);
}

.video-card:hover {
  border-color: rgba(88, 214, 223, 0.52);
  transform: translateY(-1px);
}

.video-card video {
  aspect-ratio: 9 / 16;
  max-height: 430px;
  pointer-events: none;
}

.video-open-pill {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(88, 214, 223, 0.38);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--cyan);
  background: rgba(9, 12, 17, 0.78);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.video-frame:hover .video-open-pill,
.video-frame:focus-visible .video-open-pill {
  opacity: 1;
  transform: translateY(0);
}

.video-placeholder {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: min(430px, 58vw);
  aspect-ratio: 9 / 16;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background:
    radial-gradient(circle at 50% 36%, rgba(88, 214, 223, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  overflow: hidden;
}

.video-placeholder span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(88, 214, 223, 0.42);
  border-radius: 8px;
  color: var(--cyan);
  font-weight: 900;
}

.video-placeholder strong {
  margin-top: 14px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
}

.video-placeholder em {
  max-width: 210px;
  margin-top: 8px;
  font-style: normal;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.video-info {
  align-items: flex-start;
  margin-top: 10px;
}

.video-info strong,
.video-info span {
  display: block;
  overflow-wrap: anywhere;
}

.variant-title {
  min-width: 0;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-weight: 900;
  line-height: 1.15;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.variant-title:hover {
  color: var(--cyan);
}

.video-info span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.icon-link {
  min-height: 32px;
  padding: 0 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.clip-meta {
  margin: 8px 0 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid rgba(88, 214, 223, 0.38);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(18, 24, 33, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 170ms ease, transform 170ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 8, 0.7);
  backdrop-filter: blur(14px);
}

.modal-backdrop[hidden] {
  display: none;
}

.confirm-modal,
.auth-modal {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  width: min(520px, 100%);
  border: 1px solid rgba(240, 107, 107, 0.32);
  border-radius: 8px;
  padding: 18px;
  background: rgba(21, 25, 34, 0.98);
  box-shadow: var(--shadow);
  animation: rise-in 180ms ease both;
}

.auth-modal {
  grid-template-columns: 1fr;
  border-color: rgba(88, 214, 223, 0.32);
  width: min(500px, 100%);
}

.video-modal-backdrop {
  z-index: 45;
}

.video-modal {
  display: grid;
  gap: 12px;
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  border: 1px solid rgba(88, 214, 223, 0.32);
  border-radius: 8px;
  padding: 14px;
  background: rgba(21, 25, 34, 0.98);
  box-shadow: var(--shadow);
  animation: rise-in 180ms ease both;
}

.video-modal-head,
.video-modal-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.video-modal-player {
  aspect-ratio: 9 / 16;
  max-height: min(72vh, 760px);
  object-fit: contain;
}

.video-modal-actions {
  justify-content: flex-end;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
}

.auth-form label span {
  margin: 0;
}

.auth-error {
  border: 1px solid rgba(240, 107, 107, 0.38);
  border-radius: 8px;
  padding: 10px 12px;
  color: #ffd3d3;
  background: rgba(240, 107, 107, 0.1);
  overflow-wrap: anywhere;
}

.modal-icon {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(240, 107, 107, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(var(--red), var(--red)) 50% 30px / 18px 2px no-repeat,
    linear-gradient(var(--red), var(--red)) 50% 18px / 18px 2px no-repeat,
    rgba(240, 107, 107, 0.08);
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(240, 107, 107, 0.58);
  border-radius: 8px;
  padding: 0 14px;
  color: #220707;
  background: var(--red);
  font-weight: 900;
  cursor: pointer;
  transition: opacity 160ms ease, transform 160ms ease;
}

.danger-button:hover {
  transform: translateY(-1px);
}

.danger-button:disabled {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 1180px) {
  .workspace,
  .upload-grid,
  .preview-layout {
    grid-template-columns: 1fr;
  }

  .history-panel {
    min-height: 0;
  }

  .job-list {
    max-height: 310px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 12px, 1640px);
    padding-top: 12px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 20px;
  }

  .upload-panel,
  .queue-panel,
  .opened-panel,
  .pack-section {
    padding: 10px;
  }

  .topbar,
  .section-head,
  .details-head,
  .progress-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .controls-row,
  .contact-strip,
  .stage-rail {
    grid-template-columns: 1fr 1fr;
  }

  .queue-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .summary-tile {
    min-width: 0;
    padding: 8px 6px;
  }

  .summary-tile span {
    font-size: 10px;
    line-height: 1.1;
  }

  .summary-tile strong {
    font-size: 18px;
    line-height: 1;
  }

  .source-list,
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: 8px;
  }

  .source-card,
  .video-card {
    padding: 6px;
  }

  .source-body {
    gap: 5px;
    padding-top: 6px;
  }

  .source-copy strong,
  .variant-title {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .source-copy strong {
    font-size: 11px;
    line-height: 1.1;
  }

  .source-state {
    display: grid;
    gap: 4px;
  }

  .source-state small {
    font-size: 9px;
  }

  .source-foot {
    display: none;
  }

  .source-index,
  .delete-source {
    width: 28px;
    height: 28px;
  }

  .source-index {
    top: 6px;
    left: 6px;
    font-size: 15px;
  }

  .delete-source {
    top: 6px;
    right: 6px;
    opacity: 1;
    transform: none;
  }

  .delete-source svg {
    width: 18px;
    height: 18px;
  }

  .pack-head,
  .video-info {
    align-items: stretch;
    flex-direction: column;
  }

  .video-card video {
    max-height: none;
  }

  .video-info {
    gap: 6px;
    margin-top: 6px;
  }

  .variant-title {
    font-size: 10px;
    line-height: 1.08;
  }

  .icon-link {
    width: 100%;
    min-height: 26px;
    padding: 0 6px;
    font-size: 10px;
  }

  .video-open-pill {
    right: 5px;
    bottom: 5px;
    min-height: 22px;
    padding: 0 6px;
    font-size: 9px;
    opacity: 1;
    transform: none;
  }

  .video-placeholder {
    min-height: 0;
    padding: 8px;
  }

  .video-placeholder span {
    width: 30px;
    height: 30px;
  }

  .video-placeholder strong {
    margin-top: 8px;
    font-size: 12px;
  }

  .video-placeholder em {
    display: none;
  }

  .drop-zone {
    min-height: 214px;
  }

  .details-actions,
  .ghost-button,
  .search-input,
  .sort-select,
  .topbar-actions {
    width: 100%;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .auth-status {
    max-width: 100%;
  }

  .video-modal-backdrop {
    padding: 10px;
  }

  .video-modal {
    width: min(420px, 100%);
    max-height: calc(100vh - 20px);
    padding: 10px;
  }

  .video-modal-head {
    align-items: stretch;
    flex-direction: column;
  }

  .video-modal-player {
    max-height: 74vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scan {
  to {
    transform: translateX(105%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-7px);
  }
  75% {
    transform: translateX(7px);
  }
}

@keyframes pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(88, 214, 223, 0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(88, 214, 223, 0.12);
  }
}
