:root {
  --bg: #15161a; --painel: #1e2027; --borda: #2f323c; --texto: #e6e4df; --fraco: #9a978f;
  --acento: #d9a441; --ok: #6fbf73; --erro: #e06c6c; --mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--texto); font: 14px/1.45 system-ui, sans-serif; }
header, footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--borda); }
footer { border-top: 1px solid var(--borda); border-bottom: 0; justify-content: center; margin-top: 24px; }
h1 { font-size: 18px; margin: 0; }
h1 small { color: var(--fraco); font-weight: normal; margin-left: 8px; }
.totais { display: flex; gap: 12px; align-items: baseline; font-family: var(--mono); }
.totais span { color: var(--fraco); font-family: system-ui; }
.totais b { color: var(--acento); }
main { max-width: 1160px; margin: 0 auto; padding: 16px; }

details { background: var(--painel); border: 1px solid var(--borda); border-radius: 8px; margin-bottom: 12px; }
summary { cursor: pointer; padding: 10px 14px; font-weight: 600; user-select: none; display: flex; justify-content: space-between; }
details[open] > summary { border-bottom: 1px solid var(--borda); }
.corpo { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
details.sub { background: transparent; }
details.sub summary { font-weight: normal; color: var(--fraco); font-size: 12px; }

label { display: flex; flex-direction: column; gap: 4px; color: var(--fraco); font-size: 12px; }
label.linha { flex-direction: row; align-items: center; gap: 8px; }
.campos { flex-wrap: wrap; gap: 14px; }
textarea, input[type=text], input[type=number], select { background: #0f1013; color: var(--texto); border: 1px solid var(--borda); border-radius: 6px; padding: 8px; font: inherit; }
textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input[type=number] { width: 70px; }

.barra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
button, a.botao, #modalBaixar { background: #2a2d37; color: var(--texto); border: 1px solid var(--borda); border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; text-decoration: none; }
button:hover { border-color: var(--acento); }
button:disabled { opacity: .45; cursor: default; }
button.run { background: var(--acento); color: #1a1408; border-color: transparent; font-weight: 600; }
button.perigo { color: var(--erro); }
button.grande { font-size: 16px; padding: 10px 24px; background: var(--acento); color: #1a1408; font-weight: 700; }
.cron { font-family: var(--mono); color: var(--fraco); font-weight: normal; }
#runAtual { color: var(--fraco); font-family: var(--mono); font-size: 12px; }

#terminal { background: #0b0c0f; color: #c9d1d9; font-family: var(--mono); font-size: 12px; height: 260px; overflow: auto; padding: 10px; margin: 0; border-radius: 6px; white-space: pre-wrap; word-break: break-word; }
#terminal .erro { color: var(--erro); }
#terminal .ok { color: var(--ok); }
table { border-collapse: collapse; font-family: var(--mono); font-size: 12px; width: 100%; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--borda); }
th { color: var(--fraco); font-weight: normal; }
td.num { text-align: right; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card { background: #0f1013; border: 1px solid var(--borda); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.card.selecionado { border-color: var(--acento); box-shadow: 0 0 0 1px var(--acento) inset; }
.card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 4px; cursor: zoom-in; }
.card .vazio { width: 100%; aspect-ratio: 1; display: grid; place-items: center; color: var(--fraco); border: 1px dashed var(--borda); border-radius: 4px; }
.card .titulo { font-weight: 600; }
.card .meta { color: var(--fraco); font-size: 11px; font-family: var(--mono); }
.card .acoes { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card .acoes button { padding: 3px 8px; font-size: 12px; }
.card .regen { display: flex; gap: 4px; }
.card .regen input { flex: 1; min-width: 0; padding: 4px 6px; font-size: 12px; }
.card.produto input[type=text], .card.produto textarea { width: 100%; font-family: inherit; }
.refs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.refs img { aspect-ratio: 1; object-fit: cover; }
.refs .slot { aspect-ratio: 1; border: 1px dashed var(--borda); border-radius: 4px; display: grid; place-items: center; color: var(--fraco); font-size: 18px; cursor: pointer; }

dialog { border: 0; background: transparent; padding: 0; max-width: 92vw; max-height: 92vh; }
dialog::backdrop { background: rgba(0,0,0,.75); }
.modalCorpo { background: var(--painel); border: 1px solid var(--borda); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#modalImg { max-width: 88vw; max-height: 72vh; object-fit: contain; background: #fff; border-radius: 6px; }
#modalTexto { max-width: 88vw; max-height: 20vh; overflow: auto; font-size: 11px; color: var(--fraco); margin: 0; white-space: pre-wrap; }

@media (max-width: 720px) {
  header { flex-direction: column; align-items: flex-start; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

#btnHome { font-size: 16px; padding: 2px 10px; margin-right: 6px; }
#home { max-width: 1160px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
#home .card { cursor: pointer; }
#home .card .titulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#home .meta { color: var(--fraco); font-family: var(--mono); font-size: 12px; }
[hidden] { display: none !important; }
