:root {
  --bg: #F6F5F2;
  --surface: #FFFFFF;
  --surface-2: #F0EEEA;
  --border: #E4E1DB;
  --text: #16151A;
  --muted: #6E6A73;
  --accent: #E85D3D;
  --ok: #1F9D6B;
  --warn: #C98A12;
  --danger: #D2483A;
  --shadow: 0 1px 2px rgba(20, 18, 24, .05), 0 4px 16px rgba(20, 18, 24, .05);
  --radius: 12px;
  --s-briefing: #8B8792; --s-producao: #3B7DD8; --s-ajuste: #D2483A;
  --s-revisao: #C98A12; --s-aprovado: #1F9D6B; --s-publicado: #6D4FD8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111014; --surface: #19181D; --surface-2: #222127; --border: #2D2B33;
    --text: #EFEDF2; --muted: #9A96A2;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* Sidebar */
.sidebar { width: 232px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo { font-size: 22px; font-weight: 800; letter-spacing: -.5px; padding: 0 10px 20px; }
.logo span { color: var(--accent); }
nav { flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.ativo { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav-titulo { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 18px 10px 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.nav-item .badge { margin-left: auto; }
.sidebar-rodape { font-size: 12px; color: var(--muted); padding: 10px; }

/* Main */
main { flex: 1; min-width: 0; padding: 32px 36px 60px; }
.topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topo h1 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.topo p { color: var(--muted); margin-top: 4px; max-width: 640px; }
.migalha { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.migalha a:hover { color: var(--text); }
.vazio { color: var(--muted); padding: 40px 0; text-align: center; }
.secao-titulo { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 32px 0 12px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--cor); }
.badge.alerta { background: color-mix(in srgb, var(--s-revisao) 18%, transparent); color: var(--s-revisao); }

/* Cards de projeto */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.projeto-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; border-top: 4px solid var(--cor); transition: transform .15s; }
.projeto-card:hover { transform: translateY(-2px); }
.projeto-card h3 { font-size: 17px; font-weight: 700; }
.projeto-card p { color: var(--muted); font-size: 13px; }
.barra { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.barra span { display: block; height: 100%; }
.contagens { display: flex; flex-wrap: wrap; gap: 6px; }

/* Lista "aguardando você" */
.lista { display: flex; flex-direction: column; }
.linha { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.linha:last-child { border-bottom: none; }
.linha:hover { background: var(--surface-2); }
.linha .titulo { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linha .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Abas */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.aba { padding: 10px 14px; border: none; background: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.aba.ativa { color: var(--text); border-bottom-color: var(--cor, var(--accent)); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.coluna { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; }
.coluna-topo { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 6px; font-weight: 700; font-size: 13px; }
.peca-card { padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.peca-card:hover { border-color: var(--cor); }
.peca-card .titulo { font-weight: 600; line-height: 1.35; }
.peca-card .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.peca-card .pendente { font-size: 12px; color: var(--s-ajuste); font-weight: 600; }

/* Peça */
.peca-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.preview { padding: 0; overflow: hidden; background: var(--surface-2); }
.preview iframe { width: 100%; height: 78vh; border: 0; display: block; background: #E5E7EB; }
.preview img, .preview video { width: 100%; display: block; }
.preview audio { width: 100%; margin: 24px 0; }
.preview .vazio { padding: 80px 20px; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 12px; }
.assets a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.painel { padding: 20px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.painel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.acoes { display: flex; flex-direction: column; gap: 8px; }
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn.primario { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.primario:hover { filter: brightness(1.08); }
.btn.perigo { color: var(--s-ajuste); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
textarea { width: 100%; min-height: 90px; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.comentario { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.comentario .meta { color: var(--muted); font-size: 11px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.comentario.pendente { border-left: 3px solid var(--s-ajuste); }
.historico { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.erro { color: var(--danger); font-size: 13px; }

/* Markdown */
.doc { padding: 24px 28px; }
.md h1 { font-size: 20px; margin: 0 0 12px; } .md h2 { font-size: 16px; margin: 22px 0 8px; } .md h3 { font-size: 14px; margin: 16px 0 6px; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin: 0 0 12px; }
.md ul, .md ol { padding-left: 20px; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.md pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--muted); }

@media (max-width: 1100px) { .peca-layout { grid-template-columns: 1fr; } .painel { position: static; } }
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
  main { padding: 20px 16px 48px; }
}

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; color: var(--text); background: transparent; }
.login .erro { color: #c0392b; font-size: 13px; min-height: 1em; }
.link-sair { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; margin-left: 8px; }
