/* =========================================================
   Enriquecimento RF — layout inspirado no ETL CAR AH e TFP
   Monocromático + azul de destaque. Tema claro é o padrão.
   Cada tela foi pensada para caber sem rolagem (>= 1280x800).
   ========================================================= */

:root {
  --page: #e4e4e7;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ececee;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --dash: #c9c9cf;
  --text: #0a0a0b;
  --text-2: #52525b;
  --text-3: #71717a;
  --ink: #111113;
  --ink-text: #ffffff;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-tint: #eff6ff;
  --err: #dc2626;
  --err-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -12px rgba(0,0,0,.12);
  --radius: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #09090b; --surface: #141416; --surface-2: #1b1b1e; --surface-3: #232327;
  --border: #27272a; --border-strong: #3f3f46; --dash: #3f3f46;
  --text: #fafafa; --text-2: #a1a1aa; --text-3: #8b8b93;
  --ink: #fafafa; --ink-text: #0a0a0b;
  --accent: #3b82f6; --accent-soft: rgba(59,130,246,.18); --accent-tint: rgba(59,130,246,.08);
  --err: #f87171; --err-soft: rgba(248,113,113,.14);
  --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 16px;
  min-height: 100vh;
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: inherit; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: .92em; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; text-decoration: none; }
.brand-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--ink-text);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); font-weight: 600; font-size: 13px;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-toggle {
  display: flex; padding: 3px; gap: 2px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
}
.theme-toggle button {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; color: var(--text-3); cursor: pointer;
}
.theme-toggle button svg { width: 15px; height: 15px; }
.theme-toggle button.active { background: var(--ink); color: var(--ink-text); }

.content { padding: 20px 24px 22px; }
.footer {
  text-align: center; color: var(--text-2); font-size: 13px;
  padding: 12px; border-top: 1px solid var(--border);
}
.author {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 700; color: var(--text); text-decoration: none;
  padding: 2px 8px; border-radius: 7px;
  transition: background .12s, color .12s;
}
.author svg { width: 14px; height: 14px; color: var(--accent); }
.author:hover { background: var(--accent-tint); color: var(--accent); }

/* ---------- cabeçalho de página ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head > div { min-width: 0; }
.page-head h1 {
  display: flex; align-items: center; gap: 10px;
  margin: 0; font-size: 24px; letter-spacing: -.01em;
}
.page-head h1 svg { width: 22px; height: 22px; }
.page-head p { margin: 2px 0 0; max-width: 640px; }

.stepper { display: flex; gap: 6px; list-style: none; margin: 4px 0 0; padding: 0; }
.stepper li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3); font-size: 12.5px; font-weight: 600;
}
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11.5px;
  background: var(--surface); border: 1px solid var(--border-strong);
}
.step-num svg { width: 12px; height: 12px; stroke-width: 3; }
.stepper li.current { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.stepper li.current .step-num { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.stepper li.done { color: var(--text-2); }
.stepper li.done .step-num { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ---------- flash ---------- */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--err);
  background: var(--err-soft); color: var(--err); font-weight: 600;
}

/* ---------- dropzone + upload ---------- */
.dropzone {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 24px;
  border: 1.5px dashed var(--dash); border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--text-3); background: var(--surface-2); }
.dropzone.dragging { border-style: solid; }
.drop-icon {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--ink-text);
  transition: transform .2s, background .2s;
}
.dropzone.dragging .drop-icon { transform: translateY(-3px); }
.drop-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.drop-text strong { font-size: 16px; }
.drop-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone.has-file { border-style: solid; border-color: var(--accent); background: var(--accent-tint); }
.dropzone.has-file .drop-icon { background: var(--accent); color: #fff; }
.dropzone.invalid { border-color: var(--err); }
.dropzone.uploading { pointer-events: none; }
.drop-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px;
}
.drop-badge svg { width: 14px; height: 14px; stroke-width: 3; }
.upload { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-width: 560px; }
.upload-bar { position: relative; height: 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
.upload.reading .upload-bar span { background: linear-gradient(90deg, var(--accent) 0 40%, var(--accent-soft) 40% 60%, var(--accent) 60%); background-size: 200% 100%; animation: flow 1s linear infinite; }
@keyframes flow { to { background-position: -200% 0; } }
.upload-text { display: flex; justify-content: space-between; color: var(--text-2); }
.upload-text strong { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- divisor de seção ---------- */
.section-label { display: flex; align-items: center; gap: 10px; margin: 20px 0 10px; }
.pill {
  display: inline-flex; align-items: center; height: 26px; padding: 0 12px;
  border-radius: 999px; background: var(--ink); color: var(--ink-text);
  font-weight: 700; font-size: 12.5px; white-space: nowrap;
}
.section-label .rule { flex: 1; height: 1px; background: var(--border-strong); }

/* ---------- chave (segmentado) ---------- */
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-flex; align-items: center; height: 38px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.seg span:hover { background: var(--surface-2); }
.seg input:checked + span { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- perfis ---------- */
.profiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.profile {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 14px; min-height: 128px;
  border: 1.5px dashed var(--dash); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.profile:hover { border-color: var(--text-3); }
.profile input { position: absolute; opacity: 0; pointer-events: none; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.profile-head strong { font-size: 14.5px; }
.check {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: transparent;
}
.check svg { width: 12px; height: 12px; stroke-width: 3; }
.profile-meta {
  margin-top: auto; align-self: flex-start;
  font-size: 11.5px; font-weight: 700; color: var(--text-2);
  padding: 2px 8px; border-radius: 6px; background: var(--surface-3);
}
.profile:has(input:checked) { border-style: solid; border-color: var(--ink); background: var(--surface); }
.profile:has(input:checked) .check { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.profile:has(input:checked) .profile-meta { background: var(--accent-soft); color: var(--accent); }
.profile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- botões ---------- */
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.actions .muted { margin-right: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: opacity .12s, transform .06s, background .12s, border-color .12s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--ink-text); }
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { background: var(--border-strong); color: var(--surface); cursor: not-allowed; opacity: 1; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.loading { opacity: .7; cursor: progress; }

/* ---------- etapa 2: resumo ---------- */
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.summary-item {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.sum-icon {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border-strong);
}
.sum-body { display: flex; flex-direction: column; min-width: 0; }
.sum-body strong { font-size: 14.5px; }

/* ---------- etapa 2: seletor de colunas ---------- */
.clamp-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.picker {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px;
  margin-top: 14px;
}
.cols-panel {
  display: flex; flex-direction: column; min-width: 0;
  border: 1.5px dashed var(--dash); border-radius: var(--radius);
  background: var(--surface); padding: 14px;
}
.cols-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px; width: 240px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  color: var(--text-3);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 15px; height: 15px; }
.search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); width: 100%; }

.cols {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px;
  align-content: start;
  max-height: 268px; overflow-y: auto; padding: 2px; margin: -2px;
}
.col-opt {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0;
  height: 44px; padding: 0 12px 0 8px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface-2); cursor: pointer;
  transition: background .12s, border-color .12s, transform .12s, box-shadow .12s;
}
.col-opt:hover { background: var(--surface); border-color: var(--text-3); }
.col-opt input { position: absolute; opacity: 0; pointer-events: none; }
.col-letter {
  display: inline-grid; place-items: center; flex: none;
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
  font: 700 12px/1 Consolas, "Cascadia Mono", monospace;
  transition: background .12s, color .12s, border-color .12s;
}
.col-letter.big { min-width: 40px; height: 40px; border-radius: 10px; font-size: 15px; }
.col-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-star { color: var(--accent); display: grid; }
.col-star svg { width: 15px; height: 15px; fill: currentColor; stroke-width: 1.5; }
.col-opt:has(input:checked) {
  background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.col-opt:has(input:checked) .col-letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.col-opt:has(input:checked) .col-name { color: var(--accent); font-weight: 700; }
.col-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.cols-empty { grid-column: 1 / -1; margin: 8px 2px; }

.preview {
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface-2);
}
.preview.swap .preview-head, .preview.swap .quality, .preview.swap .values { animation: fade .25s ease both; }
.preview.swap .quality { animation-delay: .03s; }
.preview.swap .values { animation-delay: .06s; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.preview-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.preview-head .col-letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.preview-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.preview-title strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}

.quality {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.q-ring {
  --p: 0; --c: var(--accent);
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0);
  transition: --p .4s;
}
.q-ring span {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); font: 700 11.5px/1 "Segoe UI", system-ui, sans-serif;
}
.q-text { display: flex; flex-direction: column; min-width: 0; }
.q-text strong { font-size: 14px; }
.quality.good strong { color: var(--accent); }
.quality.warn .q-ring { --c: var(--warn); }
.quality.warn strong { color: var(--warn); }
.quality.empty strong { color: var(--text-3); }

.values { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.values li {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  height: 32px; padding: 0 10px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
}
.v-row { width: 22px; flex: none; color: var(--text-3); font: 600 11px/1 Consolas, monospace; }
.v-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px/1 Consolas, "Cascadia Mono", monospace; }
.v-icon { display: grid; flex: none; }
.v-icon svg { width: 15px; height: 15px; stroke-width: 2.6; }
.v-ok .v-icon { color: var(--accent); }
.v-bad .v-icon { color: var(--warn); }
.v-bad .v-val { color: var(--text-2); }
.v-empty .v-val { color: var(--text-3); font-style: italic; font-family: inherit; }

/* ---------- etapa 3: execução ---------- */
.run-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: stretch; }
.run {
  padding: 18px 22px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  transition: border-color .3s, box-shadow .3s;
}
.run[data-status="completed"] { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.run[data-status="failed"] { border-color: var(--err); box-shadow: 0 0 0 4px var(--err-soft); }
.run-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong);
  font-weight: 700; font-size: 12.5px;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.run[data-status="processing"] .status-pill .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.run[data-status="completed"] .status-pill { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.run[data-status="completed"] .status-pill .dot { background: var(--accent); }
.run[data-status="failed"] .status-pill { background: var(--err-soft); border-color: transparent; color: var(--err); }
.run[data-status="failed"] .status-pill .dot { background: var(--err); }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }

.run-main { display: flex; align-items: center; gap: 22px; margin: 10px 0 14px; }
.percent {
  font-size: 68px; line-height: .95; font-weight: 800; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; min-width: 2.7ch;
}
.pct-sign { font-size: 30px; color: var(--text-3); margin-left: 2px; letter-spacing: 0; }
.run[data-status="completed"] .percent { color: var(--accent); }
.run-stage { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.run-stage strong { font-size: 17px; }
.run-stage .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-main .btn { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.bar {
  position: relative; height: 14px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border);
  overflow: hidden;
}
.bar-fill {
  position: relative; height: 100%; width: 0;
  border-radius: inherit; background: var(--ink);
  transition: width .7s cubic-bezier(.22,.8,.3,1), background .3s;
}
.run[data-status="processing"] .bar-fill { background: linear-gradient(90deg, var(--ink), var(--accent)); }
.run[data-status="processing"] .bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: sweep 1.6s linear infinite;
}
@keyframes sweep { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.run[data-status="completed"] .bar-fill { background: var(--accent); }
.run[data-status="failed"] .bar-fill { background: var(--err); }
.bar-mark { position: absolute; top: 3px; bottom: 3px; width: 2px; border-radius: 2px; background: var(--surface); opacity: .7; }
.bar-legend { display: grid; grid-template-columns: 10fr 72fr 18fr; margin-top: 5px; }
.bar-legend span:nth-child(1) { white-space: nowrap; }
.bar-legend span:nth-child(2) { text-align: center; }
.bar-legend span:nth-child(3) { text-align: right; white-space: nowrap; }

.batches { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--dash); }
.batches-head { display: flex; justify-content: space-between; margin-bottom: 7px; }
.batch-strip { display: flex; gap: 3px; }
.batch-strip span {
  flex: 1; height: 8px; border-radius: 3px; background: var(--surface-3);
  border: 1px solid var(--border); transition: background .3s, border-color .3s;
}
.batch-strip span.on { background: var(--ink); border-color: var(--ink); }
.batch-strip span.now { background: var(--accent); border-color: var(--accent); animation: pulse-bg 1s ease-in-out infinite; }
@keyframes pulse-bg { 50% { opacity: .35; } }
.run[data-status="completed"] .batch-strip span { background: var(--accent); border-color: var(--accent); }

.run .tiles { margin-top: 16px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.tile strong { font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-bar { display: block; height: 5px; margin-top: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mini-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 1s ease; }

.error-box {
  margin: 16px 0 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--err); color: var(--err);
  font: 12.5px/1.5 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; word-break: break-word;
  max-height: 96px; overflow: auto;
}

/* servidor sem resposta por instantes: pausa visual em vez de "Falhou" */
.run.reconnecting .status-pill { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.run.reconnecting .status-pill .dot { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.run.reconnecting .bar-fill::after { animation-play-state: paused; }

/* lateral: etapas */
.card {
  padding: 16px 18px; border-radius: var(--radius);
  border: 1.5px dashed var(--dash); background: var(--surface);
}
.side { display: flex; flex-direction: column; }
.card-title { margin: 0 0 8px; font-size: 14.5px; }
.side-btn { margin-top: auto; width: 100%; }
.side-btn.btn-emph { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }

.timeline { list-style: none; margin: 0 0 14px; padding: 0; }
.timeline li {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 7px 0; color: var(--text-3);
}
.timeline li:not(:last-child)::before {
  content: ""; position: absolute; left: 10px; top: 29px; height: calc(100% - 22px); width: 2px;
  background: var(--border-strong); border-radius: 2px;
}
.timeline li.done:not(:last-child)::before { background: var(--ink); }
.tl-icon {
  position: relative; width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 2px solid var(--border-strong); background: var(--surface);
}
.tl-icon svg { width: 12px; height: 12px; stroke-width: 3; display: none; }
.i-spin { display: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tl-label { flex: 1; font-weight: 600; }
.timeline li.done { color: var(--text); }
.timeline li.done .tl-icon { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.timeline li.done .i-check { display: block; }
.timeline li.active { color: var(--text); }
.timeline li.active .tl-icon { border-color: var(--accent); }
.timeline li.active .i-spin { display: block; }
.timeline li.active .tl-label { font-weight: 700; color: var(--accent); }
.timeline li.failed { color: var(--err); }
.timeline li.failed .tl-icon { border-color: var(--err); background: var(--err-soft); }
.timeline li.done:last-child .tl-icon { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- responsivo ---------- */
@media (max-width: 1080px) {
  .profiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .run-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body { padding: 8px; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .profiles, .summary, .picker { grid-template-columns: 1fr; }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper .step-label { display: none; }
  .stepper li.current .step-label { display: inline; }
  .percent { font-size: 52px; }
  .run-main { flex-wrap: wrap; gap: 10px 16px; }
  .bar-legend { display: none; }
  .search { width: 100%; }
}
@media (max-width: 480px) {
  .chip { display: none; }
  .dropzone { padding: 16px; gap: 14px; }
  .actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
