:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel-2: #1f2440;
  --border: #2a3050;
  --text: #e7e9f2;
  --muted: #9aa3c0;
  --primary: #5b8cff;
  --primary-2: #3f6fe0;
  --ok: #35c28b;
  --warn: #f0b429;
  --error: #ff5d6c;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2145 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}
.topbar { padding: 22px 24px 8px; }
.brand { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.logo { font-size: 24px; }
.envbadge {
  font-size: 11px; font-weight: 800; letter-spacing: .5px; padding: 3px 9px;
  border-radius: 999px; border: 1px solid transparent;
}
.envbadge.prod { color: var(--ok); background: rgba(53,194,139,.12); border-color: rgba(53,194,139,.4); }
.envbadge.staging { color: #06122a; background: var(--warn); }
.sub { color: var(--muted); margin-top: 4px; font-size: 14px; }

.tabs {
  display: flex; gap: 8px; padding: 12px 24px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; font-size: 14px;
  color: var(--muted); background: var(--panel); border: 1px solid var(--border);
  cursor: default; user-select: none;
}
.tab span {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--panel-2); font-size: 12px; font-weight: 700;
}
.tab.current { color: #fff; border-color: var(--primary); }
.tab.current span { background: var(--primary); color: #fff; }
.tab.done { color: var(--ok); cursor: pointer; }
.tab.done span { background: rgba(53,194,139,.2); color: var(--ok); }

main { max-width: 860px; margin: 0 auto; padding: 24px; }
.step { display: none; animation: fade .25s ease; }
.step.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 { margin: 0 0 18px; font-size: 22px; }
h2 .muted { font-size: 14px; font-weight: 400; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field.check { flex-direction: row; align-items: center; gap: 10px; grid-column: 1 / -1; }
.field.check span { color: var(--text); }
.field small { color: var(--muted); font-size: 12px; }
input, select {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 11px 12px; border-radius: 10px; font-size: 14px; outline: none;
}
input:focus, select:focus { border-color: var(--primary); }
input[type=checkbox] { width: 18px; height: 18px; }
code {
  background: var(--panel-2); padding: 1px 6px; border-radius: 6px;
  font-size: 12px; color: #cdd6ff;
}

.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
button {
  font: inherit; padding: 11px 20px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent;
}
button.primary { background: var(--primary); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--primary-2); }
button.primary:disabled { background: #38406a; color: #8890b5; cursor: not-allowed; }
button.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
button.ghost:hover { color: var(--text); border-color: var(--primary); }

.hint { color: var(--muted); }
.picker { display: flex; align-items: center; gap: 16px; margin: 14px 0; flex-wrap: wrap; }
.picked { color: var(--muted); }
.filebtn {
  background: var(--primary); color: #fff; font-weight: 600; padding: 11px 20px;
  border-radius: 10px; cursor: pointer; display: inline-block;
}

.report {
  background: #0c0f1c; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; height: 380px; overflow: auto; font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.rhead { color: #cdd6ff; font-weight: 700; margin: 12px 0 6px; border-top: 1px solid var(--border); padding-top: 10px; }
.rhead:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.rline { padding: 2px 0; white-space: pre-wrap; word-break: break-word; }
.rline.ok { color: var(--ok); }
.rline.warn { color: var(--warn); }
.rline.error { color: var(--error); }
.rline.muted, .muted { color: var(--muted); }
.skip { color: var(--muted); }

.progress {
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  height: 26px; overflow: hidden; margin-bottom: 8px;
}
.bar {
  height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--ok));
  color: #06122a; font-weight: 700; font-size: 12px; display: grid; place-items: center;
  transition: width .3s ease; min-width: 34px;
}
.stat { margin-bottom: 12px; }

.toast {
  position: fixed; left: 50%; bottom: -80px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 10px; transition: bottom .3s ease; z-index: 50;
  max-width: 90vw;
}
.toast.show { bottom: 24px; }
.toast.ok { border-color: var(--ok); }
.toast.error { border-color: var(--error); }

/* ---- Drop zone (escolher pasta) ---- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; background: var(--panel);
  transition: border-color .2s, background .2s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--panel-2); }
.dropzone .big { font-size: 40px; }
.dropzone h3 { margin: 10px 0 4px; }
.dropzone p { color: var(--muted); margin: 4px 0; }
.scaninfo { margin-top: 16px; color: var(--muted); }
.scaninfo strong { color: var(--text); }

/* ---- Mapeamento ---- */
.maptop { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 14px; }
.maptop .field { min-width: 150px; }
.rules {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.rule {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.rule .rlabel { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.rule .rlabel .req { color: var(--warn); font-size: 11px; }
.rule .rrow { display: flex; gap: 8px; }
.rule select, .rule input { padding: 8px 10px; font-size: 13px; flex: 1; min-width: 0; }

.tablewrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); max-height: 460px; }
table.preview { border-collapse: collapse; width: 100%; font-size: 13px; }
table.preview th, table.preview td {
  border-bottom: 1px solid var(--border); padding: 7px 10px; text-align: left;
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
table.preview thead th {
  position: sticky; top: 0; background: var(--panel-2); z-index: 1; font-size: 12px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .3px;
}
table.preview td[contenteditable] { cursor: text; outline: none; }
table.preview td[contenteditable]:focus { background: rgba(91,140,255,.15); box-shadow: inset 0 0 0 1px var(--primary); }
table.preview tr.invalid td.status { color: var(--error); white-space: normal; }
table.preview tr.done { opacity: .5; }
table.preview tr.done td.status { color: var(--ok); }
table.preview tr.blocked td.status { color: var(--warn); white-space: normal; }
table.preview td.status { color: var(--ok); }
.tfile { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

.mapbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.mapbar .spacer { flex: 1; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); }
.pill.new { color: var(--ok); border-color: rgba(53,194,139,.4); }
.pill.invalid { color: var(--error); border-color: rgba(255,93,108,.4); }
.pill.done { color: var(--muted); }
.pill.blocked { color: var(--warn); border-color: rgba(240,180,41,.4); }

.teams { margin-top: 6px; }
.teamrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.teamrow .tname { font-weight: 600; }
.teamrow .tstatus { font-size: 12px; }
.tstatus.ok { color: var(--ok); }
.tstatus.missing { color: var(--warn); }
.tstatus.error { color: var(--error); }

details.adv { margin-top: 10px; }
details.adv summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.adv .grid { margin-top: 12px; }

@media (max-width: 680px) {
  .grid { grid-template-columns: 1fr; }
}
