/* VideoGen MKS — estilo enxuto, sem framework. Claro/escuro pelo sistema. */
:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #3b5bdb; --accent-text: #fff; --ok: #2b8a3e; --warn: #b7791f; --err: #c92a2a;
  --cache: #5f3dc4; --radius: 10px; --gap: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11141a; --surface: #1a1f28; --text: #e6e9ef; --muted: #98a0b3; --line: #2a303c;
          --accent: #748ffc; --accent-text: #0c0f14; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); }
code { font-size: .9em; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
          padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar nav form { margin: 0; }
.container { max-width: 1120px; margin: 0 auto; padding: 1.25rem; }
#flash:empty { display: none; }
#flash { max-width: 1120px; margin: .75rem auto 0; padding: 0 1.25rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 1.1rem 1.25rem; margin-bottom: var(--gap); }
.card.narrow { max-width: 420px; margin: 3rem auto; }
.card.center { text-align: center; padding: 2.5rem 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .warn { color: var(--warn); }

label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 600; }
label.check { flex-direction: row; align-items: center; font-weight: 500; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; width: 100%; }
label.check input { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); border-radius: 8px; padding: .5rem .9rem;
  text-decoration: none; display: inline-block; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger { border-color: var(--err); color: var(--err); }
button.small { padding: .3rem .6rem; font-size: .85rem; }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 500; }
button.icon { background: transparent; color: var(--text); border-color: var(--line); padding: .15rem .5rem; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.htmx-request { opacity: .6; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.grid .wide { grid-column: 1 / -1; }
.inline { display: flex; gap: .5rem; align-items: flex-end; margin: 0; }
.grow { flex: 1; }
.row, .scene-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.scene-head .actions { display: flex; gap: .3rem; margin-left: auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }

.alert { border-left: 4px solid var(--accent); background: var(--bg); padding: .5rem .75rem;
         border-radius: 6px; margin: .4rem 0; }
.alert.error { border-color: var(--err); } .alert.warn { border-color: var(--warn); }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 99px; font-size: .8rem;
         font-weight: 600; background: var(--line); }
.badge.completed { background: var(--ok); color: #fff; }
.badge.failed { background: var(--err); color: #fff; }
.badge.rendering, .badge.finalizing, .badge.scripting, .badge.approved { background: var(--accent); color: var(--accent-text); }
.badge.awaiting_approval { background: var(--warn); color: #fff; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); }
table.list.compact td, table.list.compact th { padding: .25rem .3rem; font-size: .9rem; }

.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap); margin-bottom: var(--gap); }
.head-side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--gap); align-items: start; }
.sidebar { position: sticky; top: 1rem; }
.scene label { margin-top: .6rem; }
.scene .inline { margin-top: .6rem; }
.total { font-size: 1.05rem; margin: .5rem 0 .2rem; }

.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; margin: .75rem 0; }
.scene-tile { border: 1px solid var(--line); border-radius: 8px; padding: .6rem; display: flex; flex-direction: column; gap: .3rem; }
.chip { font-size: .8rem; padding: .1rem .5rem; border-radius: 6px; background: var(--line); }
.chip.running { background: var(--accent); color: var(--accent-text); }
.chip.done { background: var(--ok); color: #fff; }
.chip.cached { background: var(--cache); color: #fff; }
.chip.failed { background: var(--err); color: #fff; }

.player { width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius); }
.player.vertical { width: auto; max-width: 100%; display: block; margin: 0 auto; }
.voice-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
             padding: .6rem 0; border-bottom: 1px solid var(--line); }
.voice-row p { margin: .2rem 0 0; }

.spinner { width: 36px; height: 36px; margin: 0 auto 1rem; border-radius: 50%;
           border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .editor-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .job-head { flex-direction: column; }
  .head-side { align-items: flex-start; }
}
