:root {
  --bg: #0f1117; --card: #1a1d27; --line: #2a2e3b; --txt: #e7e9ee;
  --muted: #9aa0ad; --accent: #5b8cff; --ok: #3ecf8e; --err: #ff6b6b;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--txt); line-height: 1.5;
}
header { padding: 32px 24px 8px; max-width: 1040px; margin: 0 auto; }
header h1 { margin: 0; font-size: 28px; }
header p { color: var(--muted); margin: 4px 0 0; }
main { max-width: 1040px; margin: 0 auto; padding: 16px 24px 64px; }

/* --- Upload --- */
.dropzone {
  border: 2px dashed var(--line); border-radius: 14px; padding: 40px;
  text-align: center; cursor: pointer; transition: .15s; background: var(--card);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #1f2331; }
.dz-inner strong { display: block; font-size: 18px; word-break: break-word; }
.dz-inner span { color: var(--muted); font-size: 14px; }

.actions { display: flex; gap: 12px; margin: 16px 0; }
button, .clip-dl {
  background: var(--card); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 14px; font-size: 14px; font-family: inherit;
}
button#send { background: var(--accent); border-color: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
button#send:disabled { opacity: .5; cursor: not-allowed; }

.upload-bar { margin-top: 4px; height: 22px; background: var(--card); border-radius: 8px;
  position: relative; overflow: hidden; border: 1px solid var(--line); }
.upload-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-pct { position: absolute; right: 8px; top: 1px; font-size: 12px; }

/* --- Jobs --- */
.jobs h2 { margin-top: 32px; font-size: 18px; }
.job-list { display: flex; flex-direction: column; gap: 14px; }
.job {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.job-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.job-info { min-width: 0; }
.job-name { font-weight: 600; word-break: break-word; }
.job-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.job-actions { display: flex; gap: 8px; align-items: center; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.badge.done { color: var(--ok); border-color: var(--ok); }
.badge.error { color: var(--err); border-color: var(--err); }
.badge.run { color: var(--accent); border-color: var(--accent); }
.del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px; }
.del:hover { color: var(--err); }

.progress { height: 6px; background: #11141c; border-radius: 6px; margin: 12px 0 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.stage { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stage.err { color: var(--err); }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.hidden { display: none; }

/* --- Grid de cortes (Reels/Shorts) --- */
.clip-grid {
  display: grid; gap: 14px; margin-top: 16px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.clip {
  background: #14171f; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
}
.clip-thumb {
  position: relative; width: 100%; aspect-ratio: 9 / 16; background: #0b0d13;
  display: flex; align-items: center; justify-content: center; border: 0; padding: 0;
}
.clip-thumb.playable { cursor: pointer; }
.clip-poster, .clip-video {
  width: 100%; height: 100%; object-fit: cover; display: block; background: #000;
}
.clip-video { object-fit: contain; }
.clip-play {
  position: absolute; inset: 0; margin: auto; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); color: #fff; border-radius: 50%; font-size: 18px;
  pointer-events: none; transition: .15s;
}
.clip-thumb.playable:hover .clip-play { background: var(--accent); }
.clip-thumb.pending, .clip-thumb.failed {
  font-size: 13px; color: var(--muted); text-transform: lowercase;
}
.clip-thumb.failed { color: var(--err); }

.clip-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.clip-title { font-size: 14px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.clip-meta { font-size: 12px; color: var(--muted); }
.clip-dl {
  margin-top: 2px; text-align: center; text-decoration: none; color: var(--txt);
  background: #232838; border: 1px solid var(--line); cursor: pointer; padding: 7px 10px; font-size: 13px;
}
.clip-dl:hover { border-color: var(--accent); }
.clip-dl.disabled { opacity: .5; cursor: default; pointer-events: none; }

@media (max-width: 520px) {
  .clip-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
