:root {
  --bg: #f4f5f7; --panel: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #0d47a1; --accent-2: #1565c0; --ok: #1b7f3b; --ok-bg: #e6f4ea;
  --warn: #8a5a00; --warn-bg: #fff4d6; --err: #b3261e; --err-bg: #fdecea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191d; --panel: #22252b; --text: #e7e9ee; --muted: #9aa1ad; --line: #353a42;
    --accent: #6ea8ff; --accent-2: #8bbaff; --ok: #74d18f; --ok-bg: #1f3325;
    --warn: #f2c35b; --warn-bg: #3a3020; --err: #ff8a80; --err-bg: #3b2322;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px;
  background: #0d47a1; color: #fff; }
.top a, .top .link { color: #fff; }
.brand { font-weight: 700; font-size: 16px; }
.brand span { font-weight: 400; opacity: .75; margin-left: 6px; }
.top nav { display: flex; gap: 18px; align-items: center; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 24px 60px; }
h1 { font-size: 22px; margin: 6px 0 12px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
.crumbs { color: var(--muted); font-size: 13px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 18px 0; }
.card h2:first-child { margin-top: 0; }
.danger-zone { border-color: var(--err); }
table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-size: 12px; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--panel) 92%, var(--text)); }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.current td { background: color-mix(in srgb, var(--ok-bg) 60%, transparent); }
.grid tr.fail td { color: var(--err); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); margin-left: 4px; }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin: 6px 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row .grow { flex: 1 1 260px; }
input, select, textarea, button, .button { font: inherit; }
input:not([type=checkbox]):not([type=file]):not([type=color]), select, textarea {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); min-width: 0; }
textarea { width: 100%; }
input.addr { width: 120px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; }
button, .button { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer; }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--err); border-color: var(--err); background: transparent; }
button.link { background: none; border: 0; padding: 0; text-decoration: underline; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.files input[type=file] { max-width: 240px; }
input[type=file] { display: block; width: 100%; max-width: 440px; min-width: 0; color: var(--muted); font-size: 12px; border-radius: 6px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; padding: 8px 12px; margin-right: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); cursor: pointer; }
input[type=file]:hover::file-selector-button { border-color: var(--accent); color: var(--accent); }
input[type=file]:disabled::file-selector-button { opacity: .45; cursor: default; }
.row > label { margin-bottom: 0; }
.add-files > summary { cursor: pointer; font-weight: 600; }
.add-files > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
[data-zip-dialog] { width: 620px; }
[data-zip-dialog] h2 { margin-top: 0; }
[data-zip-dialog] .actions { justify-content: flex-end; margin-top: 20px; }
.stage-dev { --stage: var(--accent); }
.stage-test { --stage: var(--warn); }
.stage-prod { --stage: var(--err); }
.stage-banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 10px 0; border: 2px solid var(--stage, var(--line));
  border-radius: 8px; background: color-mix(in srgb, var(--stage, var(--muted)) 10%, transparent); }
.stage-banner > span { color: var(--stage, var(--text)); font-weight: 600; }
.stage-badge { flex: none; padding: 3px 12px; border-radius: 6px; background: var(--stage, var(--muted)); color: var(--panel);
  font-size: 18px; font-weight: 800; letter-spacing: .08em; }
[data-zip-info], [data-zip-files], [data-zip-name] { overflow-wrap: anywhere; }
[data-zip-files] { padding-left: 20px; line-height: 1.9; }
[data-zip-status]:empty { display: none; }
[hidden] { display: none !important; }
.login { max-width: 360px; margin: 60px auto; display: flex; flex-direction: column; gap: 4px; }
.login button { margin-top: 10px; }
.config h2 { border-top: 1px solid var(--line); padding-top: 14px; }
.config h2:first-of-type { border-top: 0; padding-top: 0; }
@media (max-width: 720px) {
  main { padding: 14px 16px 40px; }
  .grid { display: block; overflow-x: auto; }
}

.pending-change { background: var(--warn-bg); }
.change-status { color: var(--warn); white-space: normal; margin-top: 6px; }
button:disabled { opacity: .45; cursor: default; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 24px; max-width: min(680px, 90vw); max-height: 85vh; overflow: auto; }
dialog::backdrop { background: #0009; }
#changes, #confirm-changes { overflow-wrap: anywhere; }

.publish-version > summary { cursor: pointer; font-weight: 600; }
.publish-version > summary span { display: inline-block; font-weight: 400; margin-left: 12px; }
.publish-version[open] > summary { margin-bottom: 16px; }
.publish-version > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }

/* ------------------------------------------------------------ relatorios */
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.err-text { color: var(--err); }
.tag.bad { background: var(--err-bg); color: var(--err); border-color: transparent; }
.tag.lock { color: var(--accent); border-color: var(--accent); }
.tag.mode-prod { background: var(--ok-bg); color: var(--ok); border-color: transparent; margin-left: 0; }
.tag.mode-dev { background: var(--warn-bg); color: var(--warn); border-color: transparent; margin-left: 0; }
.mode-tabs { display: flex; gap: 6px; margin: 14px 0 -8px; }
.mode-tabs a { padding: 8px 18px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--bg); color: var(--muted); font-weight: 600; }
.mode-tabs a:hover { text-decoration: none; color: var(--text); }
.mode-tabs a.active { background: var(--panel); color: var(--text); }
.mode-tabs a.mode-prod.active { box-shadow: inset 0 3px 0 var(--ok); }
.mode-tabs a.mode-dev.active { box-shadow: inset 0 3px 0 var(--warn); }
.mode-tabs a.mode-all.active { box-shadow: inset 0 3px 0 var(--accent); }
.filters { border-top-left-radius: 0; }
.filters .row { gap: 10px 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi b { font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.ok b { color: var(--ok); }
.kpi.bad b { color: var(--err); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg a { padding: 5px 12px; color: var(--muted); font-size: 13px; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a.active { background: var(--accent); color: #fff; }
.seg a:hover { text-decoration: none; }
svg.chart { width: 100%; height: auto; display: block; margin-top: 6px; }
svg.chart .axis { stroke: var(--line); }
svg.chart .tick { fill: var(--muted); font-size: 11px; text-anchor: middle; }
svg.chart text.tick:first-of-type { text-anchor: start; }
svg.chart .val { fill: var(--text); font-size: 11px; text-anchor: middle; }
svg.chart .hit { fill: transparent; }
svg.chart g:hover .hit { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.bar-ok { fill: var(--accent); }
.bar-err { fill: var(--err); }
svg.meter { display: block; width: 100%; height: 4px; margin-top: 3px; }
svg.meter .track { fill: var(--line); }
.legend { color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.dot.ok { background: var(--accent); }
.dot.err { background: var(--err); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 16px; }
.cols > .card { margin: 9px 0; }
table.grid.bare { border: 0; background: transparent; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
pre.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12px;
  max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }
details > summary { cursor: pointer; margin: 8px 0; color: var(--muted); }
@media (max-width: 720px) {
  .mode-tabs a { padding: 8px 12px; }
  .kpi b { font-size: 22px; }
}

/* Grafico do dia: cores por grupo (paleta categorica validada, ordem fixa). */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s-other: #a3a7b0; }
@media (prefers-color-scheme: dark) {
  :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s-other: #5d636e; }
}
.s1 { fill: var(--s1); background: var(--s1); }
.s2 { fill: var(--s2); background: var(--s2); }
.s3 { fill: var(--s3); background: var(--s3); }
.s4 { fill: var(--s4); background: var(--s4); }
.s5 { fill: var(--s5); background: var(--s5); }
.s6 { fill: var(--s6); background: var(--s6); }
.s-other { fill: var(--s-other); background: var(--s-other); }
.swatch.bar-ok { background: var(--accent); }
.swatch.bar-err { background: var(--err); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.swatch.now { width: 2px; height: 12px; border-radius: 0; background: var(--text); opacity: .5; }
svg.chart .now { stroke: var(--text); stroke-opacity: .5; stroke-width: 1.5; stroke-dasharray: 3 3; }
svg.chart a:hover .hit { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.series-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 8px 0 0; color: var(--muted); }
.series-legend b { color: var(--text); font-weight: 600; margin-left: 2px; }
.day-nav { display: flex; gap: 6px; align-items: center; }
.day-nav .button, .day-nav button { padding: 5px 10px; }
.day-nav input[type=date] { padding: 4px 8px; }
.day-sum { margin: 4px 0; }
.day-sum b { color: var(--text); font-size: 14px; }
.button.live .pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 7px; }
.button.live.on { border-color: var(--ok); color: var(--ok); }
.button.live.on .pulse { background: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.button.live small { color: var(--muted); font-size: 11px; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .button.live.on .pulse { animation: none; } }
