:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2f5bea; --accent-ink: #fff; --danger: #c93636; --ok: #1f8a4c; --warn: #b7791f;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top nav { display: flex; gap: 8px; align-items: center; }
.top form { margin: 0; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 22px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 380px; margin: 60px auto; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
input:not([type=checkbox]):not([type=color]), textarea, select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--ink); background: #fff; }
input[type=color] { display: block; margin-top: 4px; height: 38px; width: 80px; border: 1px solid var(--line); border-radius: 6px; }
input:disabled, textarea:disabled { background: #f7f8fa; color: var(--muted); }
textarea { resize: vertical; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; }
.btn.big { padding: 12px 22px; font-size: 16px; margin-top: 8px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; padding: 0; }
.flash { padding: 10px 14px; border-radius: 8px; background: #e8f0ff; margin-bottom: 14px; }
.flash.warn { background: #fff5dd; }
.flash.err { background: #fde8e8; color: #7a1d1d; white-space: pre-wrap; }
.flash.small { font-size: 13px; padding: 6px 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef0f4; }
.s-done { background: #dff5e8; color: var(--ok); }
.s-failed { background: #fde8e8; color: var(--danger); }
.s-review { background: #fff1d6; color: var(--warn); }
.s-queued, .s-voice, .s-video, .s-render { background: #e6ecff; color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fafbfc; }
td.thumb { width: 44px; }
td.thumb img { width: 36px; height: 64px; object-fit: cover; border-radius: 4px; display: block; }
.table-wrap { overflow-x: auto; }
.jobhead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.jobhead p { margin: 0 0 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; display: flex; gap: 8px; }
.jobgrid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.preview { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; }
.preview video { width: 100%; aspect-ratio: 9/16; background: #000; border-radius: 8px; }
.placeholder { aspect-ratio: 9/16; display: grid; place-items: center; background: #eef0f4; border-radius: 8px; }
.scene { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.scenehead { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
@media (max-width: 800px) {
  .jobgrid { grid-template-columns: 1fr; }
  .preview { position: static; }
  main { padding: 12px 12px 40px; }
  td:nth-child(5), th:nth-child(5), td:nth-child(7), th:nth-child(7) { display: none; }
}

/* podgląd postępu */
.progress .steps { display: flex; list-style: none; padding: 0; margin: 0 0 12px; gap: 4px; flex-wrap: wrap; counter-reset: st; }
.progress .steps li { flex: 1; min-width: 90px; padding: 6px 8px; border-radius: 6px; background: #eef0f4; color: var(--muted); font-size: 13px; text-align: center; }
.progress .steps li.done { background: #dff5e8; color: var(--ok); }
.progress .steps li.done::before { content: "✔ "; }
.progress .steps li.current { background: var(--accent); color: #fff; font-weight: 600; }
.progress .bar { height: 8px; background: #eef0f4; border-radius: 4px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .6s ease; }
.progress .stage { margin: 12px 0 8px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.scene-progress { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; }
.scene-progress li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.scene-progress .dot { width: 9px; height: 9px; border-radius: 50%; background: #c5cad4; }
.st-done .dot { background: var(--ok); }
.st-busy .dot { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.st-wait .dot { background: var(--warn); }
.st-error .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
.progress pre { background: #f7f8fa; padding: 8px 10px; border-radius: 6px; font-size: 12px; white-space: pre-wrap; margin: 6px 0 0; }
.eta-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 4px 0 8px; }
.eta { display: flex; flex-direction: column; }
.eta b { font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pct { font-size: 22px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.progress .bar { height: 12px; border-radius: 6px; }
.progress .bar span { background: linear-gradient(90deg, var(--accent), #6f8cff); background-size: 40px 40px; }
.note { margin: 0 0 6px; font-size: 14px; }
.note:empty { display: none; }
.thinking { font-style: italic; color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.captions { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.captions li { background: #fff5dd; border-radius: 14px; padding: 3px 10px; font-size: 13px; animation: popin .3s ease; }
.scene-progress li { display: block; }
.sp-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.sp-bar { height: 5px; background: #eef0f4; border-radius: 3px; overflow: hidden; margin: 3px 0 6px 17px; }
.sp-bar span { display: block; height: 100%; background: #c5cad4; transition: width 1.5s linear; }
.st-done .sp-bar span { background: var(--ok); }
.st-wait .sp-bar span { background: var(--warn); }
.st-busy .sp-bar span {
  background: repeating-linear-gradient(-45deg, var(--accent) 0 10px, #6f8cff 10px 20px);
  background-size: 28px 28px; animation: stripes 1s linear infinite;
}
@keyframes stripes { to { background-position: 28px 0; } }
@keyframes popin { from { transform: scale(.8); opacity: 0; } }
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin: 8px 0; }
.clips figure { margin: 0; animation: popin .4s ease; }
.clips video { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 6px; background: #000; display: block; }
.clips figcaption { font-size: 12px; color: var(--muted); text-align: center; }

.s-cancelled { background: #eceef2; color: var(--muted); }
.btn.danger { border-color: #f0c9c9; }
