:root {
  --bg: #0d0f14; --panel: #161a22; --panel2: #1d222d; --line: #2a3140;
  --text: #e8ebf1; --muted: #8b94a7; --accent: #7c5cff; --accent2: #3ecf8e;
  --danger: #ff5c6c; --warn: #ffb648;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.muted { color: var(--muted); } .small { font-size: 13px; }
h1 { font-size: 22px; margin: 8px 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--panel2); color: var(--muted); font-size: 12px; padding: 1px 8px; border-radius: 99px; font-weight: 500; }
.count:empty { display: none; }

.logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #c05cff); font-size: 22px; color: #fff; }
.logo.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; display: inline-grid; }

.btn { border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font: inherit; font-size: 14px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #3b4558; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

/* giriş */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px 28px; display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.login-card input, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); padding: 11px 13px; border-radius: 10px; font: inherit; outline: none; }
.login-card input:focus, textarea:focus { border-color: var(--accent); }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; }
.alert { width: 100%; background: rgba(255,92,108,.12); color: var(--danger);
  border: 1px solid rgba(255,92,108,.35); padding: 9px 12px; border-radius: 10px; font-size: 14px; }

/* üst bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: rgba(13,15,20,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.conn { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent2); animation: pulse 2s infinite; }
.conn.off i { background: var(--danger); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 80px; display: flex; flex-direction: column; gap: 36px; }

/* yükleme */
.drop { border: 2px dashed var(--line); border-radius: 16px; padding: 30px 20px; text-align: center;
  cursor: pointer; background: var(--panel); transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: #1a1830; }
.drop-icon { font-size: 26px; color: var(--accent); }
textarea { margin-top: 10px; resize: vertical; }
.queue { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.q-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q.err { border-color: rgba(255,92,108,.5); } .q.err .q-stat { color: var(--danger); }
.q.ok .q-stat { color: var(--accent2); }

.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #c05cff);
  border-radius: 99px; transition: width .4s; }
.job.done .bar > i { background: var(--accent2); }
.job.failed .bar > i { background: var(--danger); }

/* üretimler */
.empty { color: var(--muted); background: var(--panel); border: 1px dashed var(--line);
  border-radius: 14px; padding: 22px; text-align: center; font-size: 14px; }
.list { display: flex; flex-direction: column; gap: 14px; }
.job { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.job.working { border-color: rgba(124,92,255,.55); box-shadow: 0 0 0 3px rgba(124,92,255,.08); }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.job-title { font-weight: 650; font-size: 16px; }
.job-meta { color: var(--muted); font-size: 13px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge.working { background: rgba(124,92,255,.18); color: #b3a1ff; }
.badge.queued { background: rgba(255,182,72,.15); color: var(--warn); }
.badge.done { background: rgba(62,207,142,.15); color: var(--accent2); }
.badge.failed { background: rgba(255,92,108,.15); color: var(--danger); }
.stage { margin-top: 12px; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.stage-text { display: flex; align-items: center; gap: 8px; }
.spin { width: 13px; height: 13px; border: 2px solid var(--accent); border-right-color: transparent;
  border-radius: 50%; animation: rot .8s linear infinite; flex: none; }
.job:not(.working) .spin { display: none; }
@keyframes rot { to { transform: rotate(360deg); } }
.steps { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.steps li { display: flex; gap: 10px; padding: 2px 0; }
.steps li::before { content: "✓"; color: var(--accent2); }
.steps li.cur::before { content: "●"; color: var(--accent); }
.job.failed .steps li.cur::before { content: "✕"; color: var(--danger); }
.job.done .steps li.cur::before { content: "✓"; color: var(--accent2); }
.steps time { margin-left: auto; white-space: nowrap; }
.job-err { margin-top: 10px; color: var(--danger); font-size: 14px; }
.outs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
.job-foot { margin-top: 12px; display: flex; justify-content: flex-end; }

/* video kartları */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; }
.grid .card { background: var(--panel); }
.card video { width: 100%; aspect-ratio: 9/12; background: #000; display: block; object-fit: contain; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.card-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-note { font-size: 13px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.card-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.tag { font-size: 11px; background: rgba(124,92,255,.18); color: #b3a1ff; padding: 1px 7px; border-radius: 99px; }

@media (max-width: 560px) {
  main { padding: 18px 12px 60px; }
  .grid, .outs { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* dosyalar */
#fdrop { margin-bottom: 0; }
.files { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.frow { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; }
.frow .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.frow .fmeta { color: var(--muted); font-size: 13px; white-space: nowrap; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
@media (max-width: 560px) { .frow .fmeta { display: none; } }
.btn.danger { border-color: rgba(255,92,108,.45); }
.btn.danger:hover { background: rgba(255,92,108,.12); border-color: var(--danger); }

/* yandan açılır dosya menüsü */
.drawer-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw); z-index: 21;
  background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .25s ease; box-shadow: -20px 0 50px rgba(0,0,0,.45); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 16px; overflow-y: auto; flex: 1; }
.drawer .drop { padding: 20px 14px; background: var(--bg); }
.drawer .frow { background: var(--bg); flex-wrap: wrap; }
.drawer .frow .fname { flex-basis: 100%; white-space: normal; word-break: break-all; }
.drawer .frow .fmeta { flex: 1; display: block; }
.drawer .empty { margin-top: 12px; background: var(--bg); }
@media (max-width: 560px) { .conn span { display: none; } .top { padding: 10px 12px; } .top-right { gap: 8px; } }
.repo-form { display: flex; gap: 8px; margin-bottom: 8px; }
.repo-form input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: inherit; font: inherit; outline: none; }
@media (max-width: 560px) { .top .btn { white-space: nowrap; padding-left: 8px; padding-right: 8px; font-size: 13px; } .brand { font-size: 0; } .top-right { gap: 6px; } }
/* youtube menüsü */
.drawer.wide { width: min(640px, 100vw); }
.yt-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.yt-form textarea, .yt-reply textarea { margin-top: 0; }
.yt-form select { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font: inherit; }
.yt-row { display: flex; gap: 8px; align-items: center; }
.yt-row input { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; }
.drawer .job { background: var(--bg); padding: 14px; }
.ytm { margin-top: 10px; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.5; }
.ytm.user { background: rgba(124,92,255,.14); margin-left: 15%; }
.ytm.assistant { background: var(--panel2); }
.drawer .stage-text { margin-top: 10px; font-size: 14px; }
.drawer .card-actions { margin-top: 10px; }
.yt-reply { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.yt-reply textarea { flex: 1; min-width: 0; }
@media (max-width: 560px) { .top .lbl { display: none; } }
