:root {
  --bg: #f4f3ef;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #6b6f78;
  --line: #e4e2dc;
  --accent: #4f46e5;
  --accent-soft: #eeedfd;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --err: #b91c1c;
  --err-soft: #fdecec;
  --side: #15171c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
#app { display: flex; min-height: 100vh; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* sidebar */
.sidebar { width: 220px; flex-shrink: 0; background: var(--side); color: #d8dae0; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 22px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #6d5dfc, #f59e0b); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; }
.brand strong { display: block; color: #fff; font-size: 15px; }
.brand span { font-size: 12px; color: #9aa0ab; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: #c9ccd3; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.sidebar nav a:hover { background: #22252c; color: #fff; }
.sidebar nav a.active { background: #2a2d36; color: #fff; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: #8b909b; padding: 8px; }
.sidebar-foot .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

main { flex: 1; min-width: 0; padding: 28px 36px 120px; max-width: 1280px; }
.loading { color: var(--muted); padding: 40px; }

/* tipografia e layout */
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 4px 0 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.grid2 > .card, .grid3 > .card { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* formulários */
label { display: block; font-weight: 600; font-size: 12px; color: #3b3f47; margin-bottom: 5px; }
.field { margin-bottom: 12px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; border: 1px solid #d6d4cd; border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7c4fb; border-color: var(--accent); }
input[type=color] { width: 44px; height: 34px; border: 1px solid #d6d4cd; border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13px; }

/* botões */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #d6d4cd; background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f6f5f2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #4338ca; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eceae4; color: #4b4f58; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.notice { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: 13px; }
.notice.ok { background: var(--ok-soft); color: #14532d; }
.notice.warn { background: var(--warn-soft); color: #78350f; }
.notice.err { background: var(--err-soft); color: #7f1d1d; }
.notice.info { background: var(--accent-soft); color: #312e81; }

/* lista de projetos */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .1s; text-decoration: none; color: inherit; }
.pcard:hover { transform: translateY(-2px); }
.pcard .thumb { aspect-ratio: 4/3; background: #e9e7e1 center/cover no-repeat; display: grid; place-items: center; color: #9a9890; font-size: 13px; }
.pcard .info { padding: 12px 14px; }
.pcard .info strong { display: block; margin-bottom: 4px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

/* seleção de tipo */
.tipos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tipo { border: 2px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer; background: #fff; text-align: left; font: inherit; }
.tipo:hover { border-color: #c7c4fb; }
.tipo.sel { border-color: var(--accent); background: var(--accent-soft); }
.tipo strong { display: block; margin-bottom: 4px; font-size: 14px; }
.tipo span { color: var(--muted); font-size: 12px; }

/* etapas */
.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.step { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted); font: inherit; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.step .n { width: 22px; height: 22px; border-radius: 50%; background: #eceae4; display: grid; place-items: center; font-size: 11px; color: #4b4f58; }
.step.done .n { background: var(--ok); color: #fff; }
.step.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.step.active .n { background: var(--accent); color: #fff; }

/* itens */
.item { display: grid; grid-template-columns: 1fr 230px; gap: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.item.video { grid-template-columns: 1fr 170px; }
.item .num { font-weight: 800; color: var(--accent); margin-right: 8px; }
.item .prev img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; background: #eee; }
.item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.approve-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); flex-wrap: wrap; }
.approve-bar.ok { border-color: #b7e2c4; background: #f3fbf5; }

.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.imgcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.imgcard .ph { aspect-ratio: 4/5; background: #ecebe6 center/cover no-repeat; display: grid; place-items: center; color: #9a9890; font-size: 12px; text-align: center; padding: 10px; }
.imgcard .ph.v { aspect-ratio: 9/16; }
.imgcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.imgcard .prompt { font-size: 12px; color: var(--muted); max-height: 64px; overflow: auto; }

.fotos { display: flex; flex-direction: column; gap: 10px; }
.foto { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.foto img { width: 90px; height: 120px; object-fit: cover; border-radius: 8px; }
.drop { border: 2px dashed #cfccc3; border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); background: #fbfaf7; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

.narr { display: grid; grid-template-columns: 1fr 420px; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; align-items: center; }
.narr audio { width: 100%; }
.rec { color: var(--err); font-weight: 700; }

.saidas video { width: 270px; border-radius: 10px; background: #000; display: block; }
.saida { display: flex; gap: 18px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 120px; border-radius: 6px; border: 1px solid var(--line); }

/* job bar */
.jobbar { position: fixed; left: 236px; right: 20px; bottom: 16px; background: #15171c; color: #e8e9ec; border-radius: 14px; padding: 14px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 30; }
.jobbar .top { display: flex; align-items: center; gap: 12px; }
.jobbar .bar { height: 6px; background: #2b2e36; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.jobbar .bar div { height: 100%; background: linear-gradient(90deg, #6d5dfc, #f59e0b); transition: width .4s; }
.jobbar pre { margin: 10px 0 0; max-height: 120px; overflow: auto; font-size: 11px; color: #a9adb7; white-space: pre-wrap; }
.jobbar .btn { background: #2a2d36; border-color: #3a3e48; color: #fff; }
.spinner { width: 16px; height: 16px; border: 2px solid #555; border-top-color: #f59e0b; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toasts */
#toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #15171c; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 420px; font-size: 13px; }
.toast.err { background: #991b1b; }
.toast.ok { background: #166534; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(15,16,20,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: #fff; border-radius: 16px; padding: 24px; width: min(760px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

.cores { display: flex; gap: 14px; flex-wrap: wrap; }
.cores .cor { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.logo-prev { max-height: 70px; max-width: 220px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 50% / 16px 16px; border-radius: 6px; padding: 6px; border: 1px solid var(--line); }
.refs { display: flex; gap: 8px; flex-wrap: wrap; }
.refs .ref { position: relative; }
.refs img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }
.refs button { position: absolute; top: 2px; right: 2px; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; }
.code { background: #f1f0ec; border-radius: 8px; padding: 10px 12px; font-family: Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
details summary { cursor: pointer; font-weight: 600; }

@media (max-width: 900px) {
  .sidebar { width: 64px; padding: 14px 8px; }
  .brand div:last-child, .sidebar-foot { display: none; }
  .sidebar nav a { font-size: 11px; padding: 8px 4px; text-align: center; }
  main { padding: 20px 16px 120px; }
  .grid2, .grid3, .tipos { grid-template-columns: 1fr; }
  .item, .item.video, .narr { grid-template-columns: 1fr; }
  .jobbar { left: 76px; }
}
