:root {
  --steel: #26323a;
  --steel-2: #34434d;
  --zinc: #e7eaec;
  --plate: #ffffff;
  --line: #c8ced3;
  --muted: #5e6b74;
  --yellow: #f2c230;
  --yellow-ink: #3a2e00;
  --green: #2e7d4f;
  --amber: #a86a12;
  --red: #b23a2b;
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--zinc); color: var(--steel);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
h1, h2, h3 { font-stretch: 78%; font-weight: 750; line-height: 1.15; margin: 0; }
button, input, select { font: inherit; color: inherit; }

.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--steel) 280px, transparent 280px); }

/* rail */
.rail { background: var(--steel); color: #dfe5e9; padding: 28px 22px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.brand h1 { font-size: 26px; color: #fff; }
.brand p { margin: 6px 0 0; color: #a9b5bd; font-size: 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.steps button {
  width: 100%; text-align: left; background: none; border: 0; border-left: 4px solid transparent;
  padding: 10px 12px; display: grid; grid-template-columns: 28px 1fr; column-gap: 8px; cursor: pointer; color: inherit;
}
.steps button:hover { background: var(--steel-2); }
.steps .n { grid-row: span 2; font-stretch: 70%; font-weight: 800; font-size: 22px; color: #7f8e98; line-height: 1.1; }
.steps .t { font-weight: 650; color: #fff; }
.steps .s { font-size: 12.5px; color: #a9b5bd; }
.steps button[aria-current="step"] { border-left-color: var(--yellow); background: var(--steel-2); }
.steps button[aria-current="step"] .n { color: var(--yellow); }
.steps button.done .n { color: #9fd3b4; }
.rail-foot { margin-top: auto; font-size: 12.5px; color: #8796a0; }

/* main */
main { min-width: 0; padding: 40px clamp(20px, 4vw, 56px) 80px; max-width: 1280px; width: 100%; }
.step-head { max-width: 72ch; margin-bottom: 28px; }
.step-head h2 { font-size: 36px; }
.step-head p { color: var(--muted); margin: 10px 0 0; }
h3 { font-size: 19px; margin: 0 0 12px; }
.block { background: var(--plate); border: 1px solid var(--line); padding: 20px 22px; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13.5px; max-width: 75ch; }
.msg { min-height: 1.5em; font-weight: 600; }
.msg.err, .inline-msg.err { color: var(--red); }
.msg.ok, .inline-msg.ok { color: var(--green); }
.inline-msg { font-size: 14px; }

/* upload */
.drop {
  display: grid; place-items: center; gap: 4px; text-align: center; cursor: pointer;
  border: 2px dashed #9aa6ae; background: var(--plate); padding: 56px 20px; transition: border-color .15s, background .15s;
}
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop strong { font-size: 20px; font-stretch: 85%; }
.drop span { color: var(--muted); }
.drop.over, .drop:focus-within { border-color: var(--steel); background: #f6f7f8; }
.file-info { color: var(--muted); margin: 0 0 16px; }

/* figures */
.figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-bottom: 20px; }
.figures div { background: var(--plate); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 16px; }
.figures b { display: block; font-size: 26px; font-stretch: 80%; font-weight: 750; }
.figures span { font-size: 13px; color: var(--muted); }
.figures.compact b { font-size: 20px; }

/* buttons */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.btn { border: 1px solid var(--steel); background: var(--plate); padding: 9px 16px; cursor: pointer; font-weight: 600; }
.btn:hover:not(:disabled) { background: #f1f3f4; }
.btn.primary { background: var(--yellow); border-color: #c99c12; color: var(--yellow-ink); }
.btn.primary:hover:not(:disabled) { background: #f6cf4f; }
.btn.quiet { border-color: transparent; background: none; text-decoration: underline; text-underline-offset: 3px; padding-inline: 6px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* forms */
.row { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: end; }
.field { display: grid; gap: 4px; font-size: 13.5px; font-weight: 600; }
.field input, .field select { border: 1px solid var(--line); background: #fff; padding: 8px 10px; min-width: 220px; font-weight: 400; }
.field.small select { min-width: 90px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 16px; }
.choice { position: relative; border: 1px solid var(--line); padding: 12px 14px 12px 40px; cursor: pointer; background: #fff; }
.choice input { position: absolute; left: 14px; top: 15px; accent-color: var(--steel); }
.choice b { display: block; }
.choice span { font-size: 13px; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--steel); box-shadow: inset 4px 0 0 var(--yellow); }

.params { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.params fieldset { background: var(--plate); border: 1px solid var(--line); padding: 16px 20px 18px; margin: 0; }
.params legend { font-weight: 750; font-stretch: 80%; font-size: 18px; padding: 0 6px; }
.params label { display: grid; grid-template-columns: 1fr 110px; gap: 4px 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid #edf0f1; font-size: 14px; }
.params label:last-child { border-bottom: 0; }
.params label small { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }
.params input { border: 1px solid var(--line); padding: 6px 8px; text-align: right; width: 110px; }

/* progress */
.progress { height: 14px; background: #dde1e4; margin: 6px 0 16px; overflow: hidden; }
.progress .bar {
  height: 100%; width: 0; transition: width .4s;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, #e2b11f 12px 24px);
}
.run.active .progress .bar { animation: avanza 1s linear infinite; background-size: 34px 34px; }
@keyframes avanza { to { background-position: 34px 0; } }
@media (prefers-reduced-motion: reduce) { .run.active .progress .bar { animation: none; } }
.log { list-style: none; margin: 0; padding: 10px 12px; background: #f4f6f7; font-size: 13px; max-height: 170px; overflow: auto; color: var(--muted); }
.log li + li { margin-top: 2px; }
.log li.err { color: var(--red); }

/* funnel */
.funnel { display: grid; gap: 6px; margin-bottom: 28px; }
.funnel .f { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: center; }
.funnel .lab { font-size: 14px; text-align: right; }
.funnel .lab b { display: block; font-size: 22px; font-stretch: 78%; line-height: 1; }
.funnel .track { height: 34px; display: flex; align-items: center; }
.funnel .seg { height: 100%; background: var(--steel); min-width: 3px; }
.funnel .f.A .seg { background: var(--green); }
.funnel .f.B .seg { background: var(--amber); }
.funnel .f.C .seg { background: #6c7f8c; }
.funnel .f.D .seg { background: #b9c1c7; }
.funnel .f.nf .seg { background: #d4d9dd; }
.funnel .sep { height: 1px; background: var(--line); margin: 6px 0; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--plate); border: 1px solid var(--line); }
.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--steel); color: #fff; text-align: left; font-weight: 600; padding: 8px 10px; white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid #e6e9eb; vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl tr:hover td { background: #fafbfb; }
.tbl .desc { min-width: 260px; max-width: 360px; }
.tbl .desc small { display: block; color: var(--muted); }
.tbl .note { font-size: 12.5px; color: var(--muted); min-width: 160px; }
.tbl a { color: var(--steel); font-weight: 600; }
.pos { color: var(--green); font-weight: 650; }
.neg { color: var(--red); font-weight: 650; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border: 1px solid currentColor; white-space: nowrap; }
.tag.ALTO { color: var(--green); } .tag.MEDIO { color: var(--amber); } .tag.BASSO { color: var(--red); }
.tbl select, .tbl input[type=text] { border: 1px solid var(--line); padding: 4px 6px; font-size: 13px; }
.tbl input[type=text] { width: 150px; }
.tbl tr.ok td:first-child { box-shadow: inset 4px 0 0 var(--green); }
.tbl tr.ko td:first-child { box-shadow: inset 4px 0 0 var(--red); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: end; margin-bottom: 10px; }
.tabs { display: flex; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: #fff; padding: 8px 14px; cursor: pointer; margin-right: -1px; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--steel); border-color: var(--steel); color: #fff; }
.tabs button small { font-weight: 400; opacity: .8; margin-left: 4px; }
#cerca { border: 1px solid var(--line); padding: 8px 10px; min-width: 280px; background: #fff; }
.verified { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.empty { padding: 28px; color: var(--muted); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .rail { position: static; height: auto; padding: 18px; gap: 14px; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .rail-foot { display: none; }
  .step-head h2 { font-size: 28px; }
  .funnel .f { grid-template-columns: 130px 1fr; }
  #cerca { min-width: 0; width: 100%; }
}
