/* Cortes · Engrenatec — mesmos tokens do orquestrador (DS IA, registro produto):
   laranja só no botão que dispara o trabalho, status sempre com ponto + texto. */

:root {
  --bg: #020517;
  --surface: #070d26;
  --surface-2: #0d1533;
  --line: #1b2547;
  --line-strong: #2a3663;
  --text: #f2f5ff;
  --text-2: #9aa6c8;
  --cyan: #00cbf9;
  --electric: #4b70ff;
  --orange: #fd731c;
  --grad-orange: linear-gradient(90deg, #fd731c, #fd8f29);
  --success: #2ee6a8;
  --warn: #ffc24d;
  --error: #ff5d5d;
  --ring: 0 0 0 3px rgba(0, 203, 249, .22);
  --glow-orange: 0 0 24px rgba(253, 115, 28, .35);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Space Grotesk', var(--font-ui);
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --radius: 8px;
  --radius-lg: 12px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 15px/1.55 var(--font-ui);
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
small { font-size: .8125rem; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 16px;
  background: rgba(2, 5, 23, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__word { font: 700 1.125rem var(--font-display); letter-spacing: .01em; }

.container { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; display: grid; gap: 16px;
}
.title { font: 700 1.375rem/1.2 var(--font-display); margin: 0; }
.subtitle { font: 600 1rem var(--font-ui); margin: 0 0 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; }

.field { display: grid; gap: 6px; }
.field__label { font-weight: 600; font-size: .875rem; }
.input {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea.input { resize: vertical; min-height: 96px; }
.input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--ring); }
.input--num { font-family: var(--font-mono); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 .field:first-child { grid-column: 1 / -1; } }

.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; width: fit-content; }
.tab { font: 600 .875rem var(--font-ui); color: var(--text-2); background: none; border: 0; border-radius: 6px; padding: 6px 14px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--line-strong); color: var(--text); }
.tab:focus-visible { outline: none; box-shadow: var(--ring); }

.drop {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 28px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface-2); cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--cyan); background: #0b1840; }
.drop:focus-within { box-shadow: var(--ring); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { color: var(--cyan); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 500 .8125rem var(--font-ui); color: var(--text-2); background: none;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 10px; cursor: pointer; text-align: left;
}
.chip:hover { color: var(--text); border-color: var(--cyan); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .9375rem var(--font-ui); border-radius: var(--radius); padding: 11px 18px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); cursor: pointer;
  text-decoration: none; transition: box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { border-color: var(--cyan); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--grad-orange); border-color: transparent; color: #fff; }
.btn--primary:hover:not(:disabled) { box-shadow: var(--glow-orange); border-color: transparent; }
.btn--ghost { background: none; }
.btn--sm { padding: 6px 12px; font-size: .8125rem; }
.btn--danger:hover { border-color: var(--error); color: var(--error); }

.form-error { margin: 0; color: var(--error); font-size: .875rem; }

.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--electric); border-radius: inherit; transition: width .4s var(--ease); }
.envio { display: grid; gap: 6px; }

/* Trabalhos */
#lista { display: grid; gap: 14px; }
.job { gap: 12px; }
.job__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.job__nome { font-weight: 600; word-break: break-word; }
.job__prompt { margin: 0; font-size: .875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job__progresso { display: grid; gap: 6px; }
.job__acoes { display: flex; flex-wrap: wrap; gap: 8px; }
.job__avisos { display: grid; gap: 6px; }
.aviso { font-size: .8125rem; border-left: 3px solid var(--warn); padding: 4px 10px; color: var(--text-2); background: rgba(255, 194, 77, .06); border-radius: 0 6px 6px 0; }
.aviso--erro { border-color: var(--error); background: rgba(255, 93, 93, .07); color: var(--text); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); }
.status--fila i { background: var(--text-2); }
.status--processando i { background: var(--electric); animation: pulsar 1.4s infinite; }
.status--concluido i { background: var(--success); }
.status--falhou i { background: var(--error); }
.status--cancelado i { background: var(--warn); }
@keyframes pulsar { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .status--processando i { animation: none; } .bar span { transition: none; } }

.job__pecas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.peca { display: grid; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; align-content: start; }
.peca video { width: 100%; max-height: 420px; border-radius: 6px; background: #000; }
.peca__titulo { font-weight: 600; font-size: .9375rem; line-height: 1.3; }
.peca__meta { font: 500 .75rem var(--font-mono); color: var(--text-2); }
.peca__legenda { font-size: .8125rem; color: var(--text-2); white-space: pre-wrap; max-height: 7.5em; overflow: auto; }
.peca__acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.peca__removido { font-size: .8125rem; color: var(--text-2); }
.peca__removido summary { cursor: pointer; }
.peca__removido p { margin: 4px 0 0; }

.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon--lg { width: 28px; height: 28px; color: var(--cyan); }

.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
details.mais > summary { cursor: pointer; font-weight: 600; font-size: .875rem; }
details.mais[open] > summary { margin-bottom: 10px; }
.pacotes { margin: 0; padding-left: 18px; font-size: .875rem; color: var(--text-2); }
.linha { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
