:root {
  --bg: #0d0f0c;
  --panel: #161a14;
  --panel2: #1d2219;
  --line: #2a3125;
  --text: #e6ead9;
  --muted: #8b9480;
  --green: #2fbf4a;
  --yellow: #f2c230;
  --red: #e5483b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--yellow); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 4px; }

.flag { display: flex; height: 4px; }
.flag span { flex: 1; }
.flag span:nth-child(1) { background: var(--green); }
.flag span:nth-child(2) { background: var(--yellow); }
.flag span:nth-child(3) { background: var(--red); }

/* topo */
.top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-size: 18px; letter-spacing: .5px; }
.brand strong { color: var(--green); }
.brand small { color: var(--muted); font-size: 12px; margin-left: 6px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { color: var(--text); padding: 6px 12px; border-radius: 6px; }
.top nav a:hover { background: var(--panel2); text-decoration: none; }
.top nav a.active { background: var(--green); color: #0d0f0c; font-weight: 600; }
.me { color: var(--text); font-size: 13px; }
.me a { margin-left: 8px; }

main { max-width: 1400px; margin: 0 auto; padding: 24px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 16px; }
h3 { margin: 18px 0 8px; font-size: 14px; color: var(--yellow); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.card.narrow { max-width: 420px; margin: 60px auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 18px; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .grid2, .grid2 + .card, .card + .grid2 { margin-top: 18px; }

/* numeros do topo */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--green);
  border-radius: var(--radius); padding: 14px 16px; color: var(--text);
}
.stat:hover { text-decoration: none; border-color: var(--green); }
.stat.warn { border-left-color: var(--yellow); }
.stat.bad { border-left-color: var(--red); }
.stat b { display: block; font-size: 28px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12px; }

/* graficos */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar .fill { width: 100%; min-height: 2px; background: linear-gradient(var(--yellow), var(--green)); border-radius: 4px 4px 0 0; }
.bar small { color: var(--muted); font-size: 11px; }
.hbar { display: grid; grid-template-columns: 170px 1fr 40px; align-items: center; gap: 10px; margin: 8px 0; }
.hbar .track { background: var(--panel2); border-radius: 4px; height: 10px; overflow: hidden; }
.hbar .fill { background: var(--red); height: 100%; }
.hbar b { text-align: right; }

/* tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:hover td { background: rgba(255, 255, 255, .02); }
table.kv th { width: 140px; text-transform: none; font-size: 13px; }
td.red, .alert-red { background: rgba(229, 72, 59, .18) !important; color: #ff8a80; }
td.yellow, .alert-yellow { background: rgba(242, 194, 48, .14) !important; color: var(--yellow); }
.alert-red, .alert-yellow { padding: 0 4px; border-radius: 3px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.green { background: rgba(47, 191, 74, .18); color: var(--green); }
.badge.yellow { background: rgba(242, 194, 48, .18); color: var(--yellow); }
.badge.red { background: rgba(229, 72, 59, .2); color: #ff7b70; }
.badge.gray { background: var(--panel2); color: var(--muted); }

.score { font-weight: 700; padding: 1px 8px; border-radius: 6px; }
.score.green { color: var(--green); }
.score.yellow { color: var(--yellow); background: rgba(242, 194, 48, .12); }
.score.red { color: #ff7b70; background: rgba(229, 72, 59, .15); }
.score.big { font-size: 16px; }

/* formularios */
.form { display: flex; flex-direction: column; gap: 12px; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters { margin-bottom: 14px; }
label { display: flex; flex-direction: column; gap: 4px; }
input, select {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--green); border-color: transparent; }

.btn {
  background: var(--green); color: #0d0f0c; border: 0; border-radius: 6px;
  padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn.red { background: var(--red); color: #fff; }
.btn.green { background: var(--green); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
form > .btn.sm, td form { display: inline; }

.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; color: var(--muted); }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px 18px; }
.settings label { flex-direction: row; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--panel2); padding: 10px 12px; border-radius: 8px; }
.settings input { width: 100px; text-align: right; }

.suggestion {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: var(--panel2); border-left: 4px solid var(--yellow); border-radius: 8px;
  padding: 10px 14px; margin: 8px 0;
}

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: rgba(47, 191, 74, .15); color: var(--green); }
.flash.warn { background: rgba(242, 194, 48, .15); color: var(--yellow); }
.flash.err { background: rgba(229, 72, 59, .18); color: #ff8a80; }

.pager { margin-top: 14px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager a { padding: 4px 10px; border-radius: 6px; background: var(--panel2); color: var(--text); }
.pager a.active { background: var(--green); color: #0d0f0c; }

@media (max-width: 600px) {
  main { padding: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 110px 1fr 30px; }
}
