:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1c2530; --muted: #6b7785; --line: #e2e7ec;
  --accent: #1f5f8b; --accent-2: #e8f1f8; --bad: #b42318; --bad-bg: #fdecea; --warn-bg: #fff6e0;
  --g3: #1e7a46; --g2: #2f6fa8; --g1: #a3670b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); overflow-x: hidden; }
.chartbox { max-width: 900px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 22px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: .5px; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 22px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h3 { font-size: 14px; margin: 0 0 12px; color: #2b3947; }
.mt { margin-top: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.bad { color: var(--bad); }

.btn { background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn.big { padding: 12px 22px; font-size: 15px; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--line); }

.drop { min-height: 70vh; display: grid; place-items: center; }
.dropbox { background: #fff; border: 2px dashed #c4d0db; border-radius: 14px; padding: 50px 60px; text-align: center; max-width: 560px; }
.drop.hover .dropbox { border-color: var(--accent); background: var(--accent-2); }

.head { margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; } .grid2 { margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid3 > .card { margin-bottom: 0; }
.grid-side { display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 16px; align-items: start; }
.side { position: sticky; top: 70px; }
@media (max-width: 1000px) { .grid-side { grid-template-columns: 1fr; } .side { position: static; } .grid2 { grid-template-columns: 1fr; } }

.stat span { color: var(--muted); font-size: 12px; display: block; }
.stat b { font-size: 24px; display: block; margin: 4px 0; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.hero { border-left: 4px solid var(--accent); }
.hero .big { font-size: 30px; font-weight: 700; margin: 2px 0 14px; color: var(--accent); font-variant-numeric: tabular-nums; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid #f0f2f5; }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.eq { font-family: ui-monospace, Consolas, monospace; background: #f7f9fb; padding: 10px 12px; border-radius: 6px; line-height: 1.6; word-break: break-word; }
.warn { background: var(--warn-bg); padding: 8px 10px; border-radius: 6px; margin: 12px 0 0; }
.alert { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }

.badge { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 6px; white-space: nowrap; }
.gIII { background: #e3f4ea; color: var(--g3); } .gII { background: #e4eef8; color: var(--g2); }
.gI { background: #fbf0dc; color: var(--g1); } .gFora { background: var(--bad-bg); color: var(--bad); }

.bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 12px; }
.bar input[type=search] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; min-width: 240px; font: inherit; }
select, input.aval { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
input.aval { width: 96px; }
.side { overflow-x: auto; }
.tbl.cfg select { max-width: 78px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.scroll { overflow: auto; max-height: 72vh; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.card .scroll { border: 0; max-height: 420px; }
.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid #eef1f4; text-align: left; white-space: nowrap; }
.tbl thead th { background: #f7f9fb; position: sticky; top: 0; font-weight: 600; color: #3b4957; z-index: 1; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.off td { color: #a5afb9; text-decoration: line-through; }
.tbl tr.off td:nth-child(-n+2) { text-decoration: none; }
.tbl tr.out td { background: var(--bad-bg); }
.tbl tr.sel td { background: var(--accent-2); }
.tbl tr.st td { background: #f7f9fb; font-weight: 600; color: #3b4957; }
.tbl td.bad { color: var(--bad); font-weight: 600; }
.tbl.kvt th { width: 260px; color: var(--muted); font-weight: 500; background: none; position: static; }
.tbl.cfg td, .tbl.cfg th { padding: 5px 6px; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #eef1f4; }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart .axl { font-size: 12px; fill: #3b4957; font-weight: 600; }
.chart .ref { stroke: #9aa7b4; stroke-dasharray: 4 4; }
.chart .pt { fill: var(--accent); fill-opacity: .75; stroke: #fff; stroke-width: 1.5; }
.chart .pt.outp { fill: var(--bad); }
.chart .pt.aval { fill: #e08a00; fill-opacity: 1; stroke: #6b4100; }
.chart .pt:hover { fill-opacity: 1; stroke: var(--ink); }

/* ---------- sistema ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.loginbox { width: 340px; display: grid; gap: 14px; padding: 26px; }
.loginbox label, .formgrid label { display: grid; gap: 5px; font-size: 13px; color: #3b4957; font-weight: 500; }
input, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd8e1; border-radius: 7px; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid #9cc3e3; outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }
.mainnav { display: flex; gap: 4px; }
.mainnav button { background: none; border: 0; padding: 8px 14px; border-radius: 7px; font: inherit; color: var(--muted); cursor: pointer; font-weight: 600; }
.mainnav button.on { background: var(--accent-2); color: var(--accent); }
.tools { display: flex; gap: 10px; align-items: center; }
.pghead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pghead h1 { margin-bottom: 2px; }
.vhead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.vactions { display: flex; gap: 8px; flex-wrap: wrap; }
.vazio { text-align: center; padding: 30px; }
.clic { cursor: pointer; }
.clic:hover td { background: #f3f7fb; }
.tbl td.wrap { white-space: normal; min-width: 180px; }
.perigo { color: var(--bad) !important; }
input.mini { width: 80px; padding: 4px 6px; }
.filtros label { display: flex; gap: 6px; align-items: center; }

.drawer { position: fixed; inset: 0; background: rgba(20, 30, 40, .35); z-index: 20; display: flex; justify-content: flex-end; }
.drawer-in { background: #fff; width: min(640px, 100%); height: 100%; overflow-y: auto; padding: 20px 24px 40px; box-shadow: -8px 0 30px rgba(0,0,0,.15); }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.dhead h2 { margin: 0; font-size: 19px; }
.x { background: none; border: 0; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.formgrid .f-full { grid-column: 1 / -1; }
.lab { display: block; font-size: 13px; color: #3b4957; font-weight: 500; margin-bottom: 6px; }
.lab em { font-weight: 400; font-style: normal; font-size: 12px; }
.colar { grid-column: 1 / -1; background: var(--accent-2); border-radius: 10px; padding: 12px; display: grid; gap: 8px; justify-items: start; }
.colar label { width: 100%; }
.unitbox { color: var(--muted); min-height: 18px; margin-top: -6px; }
.unitbox b { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-width: 38px; padding: 7px 11px; border: 1px solid #cfd8e1; border-radius: 8px; background: #fff; font: inherit; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.acts { margin-top: 6px; }

.steps { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px 6px 6px; font: inherit; color: var(--muted); cursor: pointer; }
.step b { width: 24px; height: 24px; border-radius: 50%; background: #e7ecf1; display: grid; place-items: center; font-size: 12px; }
.step.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.step.on b { background: var(--accent); color: #fff; }
.step.feito b { background: #e3f4ea; color: var(--g3); }
.passos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.passos div { display: flex; gap: 10px; align-items: center; }
.passos b { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1c2530; color: #fff; padding: 11px 18px; border-radius: 9px; z-index: 40; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: 90vw; }
.toast.ruim { background: var(--bad); }
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; }
  .formgrid { grid-template-columns: 1fr; }
  main { padding: 14px 12px 50px; }
}

/* metas */
.metas { border-left: 4px solid var(--accent); }
.mhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.mhead h3 { margin: 0; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 18px; }
.checks li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; }
.checks li.ok { background: #eef8f2; }
.checks li.no { background: var(--bad-bg); }
.checks .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.checks li.ok .ic { background: var(--g3); }
.checks li.no .ic { background: var(--bad); }
.checks .nm { flex: 1; }
.checks b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.metaedit { margin-top: 10px; }
.metaedit summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; }
.metaedit .row { margin-top: 8px; gap: 14px; }
.metaedit label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.vtag { display: inline-block; background: #eef2f6; border-radius: 6px; padding: 2px 7px; margin: 1px 0; font-size: 12px; white-space: nowrap; }
.vtag i { color: var(--muted); font-style: normal; }
.vtag.incoer { background: var(--bad-bg); color: var(--bad); }
.tbl tr.okrow td { background: #f1faf4; }
.tbl td.good { color: var(--g3); font-weight: 600; }
