/* ── Downloads Panel ── */
.downloads-panel {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(450px, 100vw); z-index: 1200;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.4);
}
.downloads-panel.open { transform: translateX(0); }
.downloads-backdrop { position:fixed; inset:0; z-index:1199; background:rgba(0,0,0,.46); backdrop-filter:blur(5px); -webkit-backdrop-filter:blur(5px); opacity:0; pointer-events:none; transition:opacity .25s; }
.downloads-backdrop.open { opacity:1; pointer-events:auto; }

.panel-header {
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  font-size: 17px; font-weight: 700; display: flex; justify-content: space-between; align-items: center;
  letter-spacing: -0.3px;
}
.panel-close {
  background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all var(--transition);
}
.panel-close:hover { background: rgba(255,255,255,.05); color: var(--text); }

.downloads-panel-title { display:flex; flex-direction:column; gap:2px; }
.downloads-panel-title small { color:var(--text-muted); font-size:10px; font-weight:500; letter-spacing:0; }
.jobs-list { flex: 1; overflow-y: auto; padding: 10px 12px 24px; }

.job-item { position:relative; padding:10px; background:color-mix(in srgb,var(--bg-elevated) 92%,transparent); border-radius:12px; margin-bottom:8px; border:1px solid var(--border); transition:border-color var(--transition),opacity .18s ease,transform .18s ease; }
.job-item:hover { border-color: var(--border-hover); }
.job-item.running { border-color:color-mix(in srgb,var(--accent) 35%,var(--border)); }
.job-item.removing { opacity:0; transform:translateX(18px); pointer-events:none; }
.job-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.download-queue-row { display:grid; grid-template-columns:44px minmax(0,1fr) auto; align-items:center; gap:10px; }
.download-open-local { cursor:pointer; }
.download-open-local:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.download-queue-cover { width:44px; height:44px; border-radius:9px; object-fit:cover; background:var(--bg-input); }
.download-queue-placeholder { display:grid; place-items:center; color:var(--accent); background:var(--accent-dim); border:1px solid color-mix(in srgb,var(--accent) 30%,transparent); }
.download-queue-placeholder svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.download-queue-content { min-width:0; }
.download-queue-heading { display:flex; align-items:center; gap:8px; min-width:0; }
.download-queue-heading .job-title { flex:1; min-width:0; }
.download-queue-actions { display:flex; justify-content:flex-end; align-items:center; gap:4px; }
.job-meta { font-size:10px; color:var(--text-muted); margin-top:2px; display:flex; align-items:center; }
.job-time { margin-top:2px; color:var(--text-muted); font-size:9px; }
.job-progress-line { display:flex; align-items:center; gap:7px; margin-top:6px; }
.job-progress-line > span { width:27px; color:var(--text-muted); font-size:9px; text-align:right; }
.job-progress-bar { flex:1; height:4px; background:var(--bg-input); border-radius:3px; overflow:hidden; }
.job-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .5s; box-shadow: 0 0 8px var(--accent-glow); }
.job-progress-text { font-size:10px; color:var(--text-muted); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.job-status { font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:.45px; display:flex; align-items:center; gap:4px; }
.job-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.job-status.done { color: var(--accent); }
.job-status.done::before { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.job-status.failed { color: var(--red); }
.job-status.failed::before { background: var(--red); }
.job-status.running { color: var(--blue); }
.job-status.running::before { background: var(--blue); animation: pulse 1.5s ease infinite; }
.job-status.queued { color: var(--text-muted); }
.job-status.queued::before { background: var(--text-muted); }
.job-status.cancelled { color: var(--text-dim); }
.job-status.cancelled::before { background: var(--text-dim); }

.job-cancel { background:none; border:none; color:var(--text-muted); cursor:pointer; width:30px; height:30px; border-radius:50%; font:inherit; font-size:20px; display:grid; place-items:center; }
.job-cancel:hover { color: var(--red); }

.job-retry { background:none; border:1px solid var(--accent); color:var(--accent); cursor:pointer; width:30px; height:30px; border-radius:50%; font:inherit; font-size:17px; display:grid; place-items:center; transition:all var(--transition); }
.job-retry:hover { background: var(--accent); color: #000; }
.job-remove { display:grid; place-items:center; width:28px; height:28px; padding:0; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--text-muted); cursor:pointer; transition:all var(--transition); }
.job-remove svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.job-remove:hover { color:var(--text); border-color:var(--border); background:var(--bg-input); }
.job-remove:disabled { opacity:.4; cursor:default; }
@media(max-width:520px){.downloads-panel{width:100vw}.jobs-list{padding-inline:9px}.download-queue-row{grid-template-columns:40px minmax(0,1fr) auto;gap:8px}.download-queue-cover{width:40px;height:40px}}
