:root {
  --ground: #eef1f4;
  --surface: #fff;
  --ink: #1b2026;
  --muted: #5d6874;
  --line: #d7dde3;
  --go: #0f8a4f;
  --go-ink: #fff;
  --amber: #b86e00;
  --amber-bg: #fff4e0;
  --bad: #b3261e;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
[hidden] { display: none !important; }
a { color: var(--go); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); margin: .25rem 0 1rem; }
.err { color: var(--bad); min-height: 1.2em; margin: .5rem 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.meter { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.meter-num { font-size: 1.25rem; font-weight: 700; color: var(--go); }
.meter-unit { color: var(--muted); font-size: .9rem; }
.meter-bar { width: 90px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: var(--go); transition: transform .25s ease; }
.meter.pending .meter-bar i { background: var(--amber); }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.gate { max-width: 420px; margin: 4rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
input, select, textarea { width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] { --ground: #12110d; --surface: #1b1a15; --ink: #f2f0e9; --muted: #a7a496; --line: #34322a; --go: #fbb040; --go-ink: #1c1c1a; --amber: #f7be63; --amber-bg: #3a2c12; --bad: #ff8a80; color-scheme: dark; }
.theme { background: none; border: 1px solid var(--line); color: var(--ink); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.brand { display: inline-flex; align-items: center; gap: .5rem; }
.brand img { width: 26px; height: 26px; }
textarea { min-height: 90px; }
input[type=checkbox] { width: auto; }
:focus-visible { outline: 3px solid #5aa7ff; outline-offset: 2px; }
button.primary { background: var(--go); color: var(--go-ink); border: 0; border-radius: 6px; padding: .65rem 1.25rem; font: inherit; font-weight: 600; cursor: pointer; transition: filter .15s ease; }
button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: .55; cursor: wait; }

.studio { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; }
.picker { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; align-self: start; }
.picker h3 { font-size: .75rem; color: var(--muted); margin: .75rem .5rem .25rem; font-weight: 600; }
.picker button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .45rem .6rem; border-radius: 6px; font: inherit; cursor: pointer; color: var(--ink); transition: background .15s ease; }
.picker button:hover { background: var(--ground); }
.picker button[aria-current=true] { background: var(--go); color: var(--go-ink); }

.work > form, .jobs { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; }
.jobs { margin-top: 1.25rem; }
.slot { margin-bottom: 1rem; }
.slot .row { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.slot .row input[type=url] { flex: 1; }
.slot .row small { color: var(--muted); white-space: nowrap; }
.slot .remove { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 1.1rem; }
.slot .add { background: none; border: 1px dashed var(--line); border-radius: 6px; padding: .4rem .8rem; cursor: pointer; color: var(--muted); font: inherit; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; margin-top: .5rem; }
.field small { display: block; color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.field.check { display: flex; align-items: center; gap: .5rem; }
.field.check label { margin: 0; }
.field.wide { grid-column: 1 / -1; }

.runbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cost { background: var(--amber-bg); color: var(--amber); padding: .35rem .75rem; border-radius: 6px; font-size: .9rem; }
.cost-label { margin-right: .5rem; }

.joblist { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.job { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; }
.job header { display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; }
.job .state { font-weight: 400; color: var(--muted); }
.job .state.failed { color: var(--bad); }
.job .state.done { color: var(--go); }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: .5rem; }
.bar i { display: block; height: 100%; width: 35%; background: var(--go); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.files { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.files a { display: inline-block; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: .85rem; }
.preview { margin-top: .6rem; max-width: 100%; border-radius: 6px; }
pre.data { background: var(--ground); padding: .6rem; border-radius: 6px; overflow: auto; max-height: 260px; font-size: .8rem; margin: .6rem 0 0; }

@media (max-width: 760px) { .studio { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
