:root {
  --bg: #0b0b0c;
  --panel: #131315;
  --panel-2: #1a1a1d;
  --line: #2a2a2f;
  --line-strong: #3a3a40;
  --text: #f3f3f1;
  --muted: #a0a0a8;
  --faint: #6f6f78;
  --yellow: #f2c94c;
  --yellow-ink: #1c1604;
  --blue: #5dade2;
  --green: #45d18e;
  --red: #ff6b6b;
  --amber: #f0a43a;
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(1200px 500px at 70% -10%, rgba(242, 201, 76, 0.07), transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

code {
  font: 0.86em var(--mono);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

/* ---------- marca e topo */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 17px;
}
.brand-lg {
  font-size: 22px;
  justify-content: center;
}
.brand-sub {
  color: var(--muted);
  font-weight: 600;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(90deg, #fafaf7 0 30%, #0a0a0a 30% 35%, var(--yellow) 35% 65%, #0a0a0a 65% 70%, #fafaf7 70% 100%);
  box-shadow: inset 0 0 0 3px #0a0a0a, 0 0 0 1px var(--line-strong);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(20px, calc((100vw - 1280px) / 2));
  background: rgba(11, 11, 12, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}
.pill[data-state="online"] {
  color: var(--text);
  border-color: rgba(69, 209, 142, 0.35);
}
.pill[data-state="online"] .dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(69, 209, 142, 0.15);
}
.pill[data-state="busy"] {
  color: var(--text);
  border-color: rgba(242, 201, 76, 0.4);
}
.pill[data-state="busy"] .dot {
  background: var(--yellow);
  animation: pulse 1.2s ease-in-out infinite;
}
.pill[data-state="offline"] .dot {
  background: var(--red);
}

/* ---------- botões */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font: 600 14px/1 var(--font);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.05s;
}
.btn:hover:not(:disabled) {
  border-color: var(--faint);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:focus-visible,
input:focus-visible,
.drop:focus-within {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--yellow-ink);
}
.btn.primary:hover:not(:disabled) {
  background: #f7d566;
}
.btn.big {
  font-size: 16px;
  padding: 15px 26px;
  border-radius: 12px;
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  font-size: 13px;
  padding: 7px 12px;
}
.btn.icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
}
.btn.danger:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--red);
}

/* ---------- login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: 12px;
  padding: 32px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.login-card h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}
.login-card label {
  font-weight: 600;
  font-size: 14px;
}

/* ---------- layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
  gap: 28px;
  align-items: start;
  padding: 28px max(20px, calc((100vw - 1280px) / 2)) 8px;
}
.compose {
  display: grid;
  gap: 16px;
}
.section-head h2 {
  font-size: 24px;
  letter-spacing: -0.02em;
}
.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

/* ---------- passos */
.step,
.ready,
.preview-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.step-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 2px solid var(--yellow);
  color: var(--yellow);
}
.step.done .step-num {
  background: var(--green);
  border-color: var(--green);
  color: #06140d;
  font-size: 0;
}
.step.done .step-num::after {
  content: "✓";
  font-size: 16px;
}
.step-title h3 {
  font-size: 17px;
}
.step-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.step-state {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.step-state[data-state="todo"] {
  color: var(--amber);
  border-color: rgba(240, 164, 58, 0.45);
}
.step-state[data-state="done"] {
  color: var(--green);
  border-color: rgba(69, 209, 142, 0.45);
}

/* ---------- área de soltar arquivo */
.drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 30px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover,
.drop.over {
  border-color: var(--yellow);
  background: rgba(242, 201, 76, 0.05);
}
.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-icon {
  font-size: 30px;
  color: var(--yellow);
  line-height: 1;
}
.drop-title {
  font-weight: 700;
}
.drop-sub {
  color: var(--muted);
  font-size: 13px;
}
.drop-small {
  padding: 18px 16px;
}

/* ---------- resumo do MIDI */
.midi-info {
  display: grid;
  gap: 14px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.file-icon {
  color: var(--yellow);
}
.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.stat {
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.stat dt {
  color: var(--muted);
  font-size: 12px;
}
.stat dd {
  margin: 2px 0 0;
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.hand-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
}
.hand-right {
  background: var(--yellow);
}
.hand-left {
  background: var(--blue);
}
.hand-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.legend-right::before,
.legend-left::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: 0;
}
.legend-right::before {
  background: var(--yellow);
}
.legend-left::before {
  background: var(--blue);
}
.tracks,
.notices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.tracks li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 10px;
  border-left: 3px solid var(--line-strong);
}
.tracks li[data-hand="R"] {
  border-left-color: var(--yellow);
}
.tracks li[data-hand="L"] {
  border-left-color: var(--blue);
}
.tracks b {
  color: var(--text);
  font-weight: 600;
}
.notices li {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
}
.notices li.warn {
  color: #ffd9a3;
  background: rgba(240, 164, 58, 0.1);
  border: 1px solid rgba(240, 164, 58, 0.3);
}

/* ---------- campos */
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.field {
  display: grid;
  gap: 5px;
  align-content: start;
}
.field.wide {
  grid-column: 1 / -1;
}
.field label {
  font-weight: 600;
  font-size: 14px;
}
.req {
  color: var(--yellow);
}
.field small,
.hint {
  color: var(--faint);
  font-size: 12.5px;
  margin: 0;
}
input[type="text"],
input[type="password"],
.field input,
.login-card input {
  width: 100%;
  font: 15px/1.3 var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 12px;
}
.field input::placeholder {
  color: #55555c;
}
.field input[aria-invalid="true"] {
  border-color: rgba(240, 164, 58, 0.6);
}

/* ---------- foto */
.photo-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.photo-info img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
}
.photo-meta {
  display: grid;
  gap: 8px;
  justify-items: start;
  min-width: 0;
}

/* ---------- antes de produzir */
.ready {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(242, 201, 76, 0.05), transparent 60%), var(--panel);
}
.ready h3 {
  font-size: 17px;
  margin-bottom: 12px;
}
.checklist {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.checklist li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}
.checklist .mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--faint);
}
.checklist li[data-state="ok"] .mark {
  background: var(--green);
  border-color: var(--green);
  color: #06140d;
}
.checklist li[data-state="missing"] .mark {
  border-color: var(--red);
  color: var(--red);
}
.checklist li[data-state="warn"] .mark {
  border-color: var(--amber);
  color: var(--amber);
}
.checklist .detail {
  color: var(--muted);
}
.ready-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.dest {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- prévias */
.previews {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 16px;
}
.preview-card {
  padding: 16px;
}
.preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.preview-head h3 {
  font-size: 15px;
}
.tag {
  font-size: 12px;
  color: var(--faint);
}
.frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid var(--line);
}
.frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.frame-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 14px;
  background: #0a0a0a;
}
.player {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.player input[type="range"] {
  flex: 1;
  accent-color: var(--yellow);
}
.clock {
  font: 13px var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- produções */
.jobs {
  padding: 28px max(20px, calc((100vw - 1280px) / 2)) 64px;
  display: grid;
  gap: 16px;
}
.jobs-list {
  display: grid;
  gap: 12px;
}
.empty {
  padding: 28px;
  text-align: center;
  color: var(--faint);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.job {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.job-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 28px;
}
.job-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.job-body {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}
.job-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.job-title {
  font-weight: 700;
  font-size: 16px;
}
.job-artist {
  color: var(--muted);
  font-weight: 500;
}
.chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}
.chip[data-status="running"] {
  color: var(--yellow);
  border-color: rgba(242, 201, 76, 0.45);
}
.chip[data-status="done"] {
  color: var(--green);
  border-color: rgba(69, 209, 142, 0.45);
}
.chip[data-status="failed"] {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.45);
}
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--yellow), #f7d97a);
  transition: width 0.6s ease;
}
.progress.queued span {
  width: 100% !important;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 12px, transparent 12px 24px);
  opacity: 0.6;
}
.job-step {
  font-size: 13px;
  color: var(--muted);
}
.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--faint);
}
.job-path {
  font: 12.5px var(--mono);
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  overflow-wrap: anywhere;
}
.job-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.job details {
  font-size: 13px;
}
.job summary {
  cursor: pointer;
  color: var(--red);
}
.job pre {
  margin: 8px 0 0;
  max-height: 260px;
  overflow: auto;
  font: 12px/1.45 var(--mono);
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
}

/* ---------- avisos */
.error {
  margin: 10px 0 0;
  color: var(--red);
  font-size: 14px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  background: #1f1f23;
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-weight: 600;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .previews {
    position: static;
  }
}
@media (max-width: 640px) {
  .fields {
    grid-template-columns: 1fr;
  }
  .job {
    grid-template-columns: 1fr;
  }
  .step-head {
    grid-template-columns: auto 1fr;
  }
  .step-state {
    grid-column: 2;
    justify-self: start;
  }
  .brand-sub,
  #agent-text {
    font-size: 12px;
  }
}
