@font-face { font-family: Plex; src: url(vendor/fonts/plex-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Plex; src: url(vendor/fonts/plex-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Plex; src: url(vendor/fonts/plex-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --ink: #17233f;
  --muted: #5b6784;
  --line: #d6dcea;
  --ground: #eef1f7;
  --sheet: #fff;
  --route: #2f55c9;
  --route-soft: #e4eafb;
  --ok: #157a5c;
  --warn: #a35f00;
  --bad: #b3261e;
  --bs-body-font-family: Plex, system-ui, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--ground);
  --bs-primary: var(--route);
  --bs-primary-rgb: 47, 85, 201;
  --bs-border-color: var(--line);
  --bs-link-color-rgb: 47, 85, 201;
}

body { font-size: 15px; }
h1 { font-size: 1.6rem; font-weight: 600; margin: 0; }
h2 { font-size: 1.1rem; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--route); --bs-btn-border-color: var(--route); --bs-btn-hover-bg: #2547ad; --bs-btn-hover-border-color: #2547ad; --bs-btn-active-bg: #1f3c94; --bs-btn-disabled-bg: var(--route); --bs-btn-disabled-border-color: var(--route); }
.btn-outline-primary { --bs-btn-color: var(--route); --bs-btn-border-color: var(--route); --bs-btn-hover-bg: var(--route); --bs-btn-hover-border-color: var(--route); --bs-btn-active-bg: var(--route); }
:focus-visible { outline: 2px solid var(--route); outline-offset: 2px; }

.topbar { background: var(--ink); color: #fff; }
.topbar .inner { max-width: 1180px; margin: auto; padding: .7rem 1rem; display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.topbar b { font-weight: 600; }
.topbar a { color: #c3cce4; text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
.topbar a.on, .topbar a:hover { color: #fff; border-color: #fff; }
.topbar nav { display: flex; gap: 1.25rem; flex: 1; }
.topbar button { background: none; border: 0; color: #c3cce4; }
main { max-width: 1180px; margin: auto; padding: 1.5rem 1rem 6rem; }

.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem; margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: .875rem; }

/* Percorso della procedura: e' una vera sequenza. */
.steps { display: flex; gap: 0; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.steps li { flex: 1; padding: .5rem .25rem .5rem 0; border-top: 3px solid var(--line); color: var(--muted); font-size: .875rem; }
.steps li.on { border-color: var(--route); color: var(--ink); font-weight: 500; }
.steps li.done { border-color: var(--route); }
.steps button { all: unset; cursor: pointer; }
.steps button:focus-visible { outline: 2px solid var(--route); }

.drop { border: 2px dashed var(--line); border-radius: 6px; padding: 2.5rem 1rem; text-align: center; cursor: pointer; display: block; }
.drop.over, .drop:hover { border-color: var(--route); background: var(--route-soft); }

/* La tabella di mappatura e' il cuore dell'app: dato a sinistra, destinazione a destra. */
.map { width: 100%; border-collapse: collapse; }
.map th { font-weight: 500; font-size: .875rem; color: var(--muted); padding: .35rem .5rem; text-align: left; }
.map td { padding: .45rem .5rem; border-top: 1px solid var(--line); vertical-align: middle; }
.map .col-name { font-weight: 500; }
.map .sample { color: var(--muted); font-size: .85rem; display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map .arrow { width: 44px; padding: 0; }
.map .arrow i { display: block; height: 2px; background: var(--line); position: relative; }
.map .arrow i::after { content: ""; position: absolute; right: 0; top: -3px; border-left: 7px solid var(--line); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.map tr.linked .arrow i { background: var(--route); }
.map tr.linked .arrow i::after { border-left-color: var(--route); }
.map tr.off .col-name { color: var(--muted); font-weight: 400; }
.map select, .map input { min-width: 0; }
.opts { display: flex; gap: .4rem; flex-wrap: wrap; }
.opts > * { width: auto; }

.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--route-soft); color: var(--ink); border-radius: 4px; padding: .1rem .5rem; margin: 0 .3rem .3rem 0; font-size: .875rem; }
.chip.neg { background: #fbe9e7; }
.chip button { all: unset; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .1rem; }
.pick { max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; padding: .4rem .6rem; }

.preview { overflow: auto; max-height: 280px; font-size: .85rem; }
.preview td, .preview th { white-space: nowrap; padding: .2rem .6rem; border-bottom: 1px solid var(--line); }
pre.payload { background: var(--ground); padding: .75rem; border-radius: 4px; font-size: .82rem; max-height: 280px; overflow: auto; margin: 0; }

.tally { display: flex; flex-wrap: wrap; gap: 2rem; }
.tally div b { display: block; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.tally div span { color: var(--muted); font-size: .875rem; }
.tally .ok b { color: var(--ok); } .tally .warn b { color: var(--warn); } .tally .bad b { color: var(--bad); }
.progress { --bs-progress-bar-bg: var(--route); height: 8px; }

.status { font-weight: 500; }
.status.completed { color: var(--ok); } .status.failed { color: var(--bad); }
.status.paused, .status.interrupted { color: var(--warn); }

.actionbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--sheet); border-top: 1px solid var(--line); z-index: 10; }
.actionbar .inner { max-width: 1180px; margin: auto; padding: .7rem 1rem; display: flex; gap: .75rem; align-items: center; justify-content: space-between; }

.login { max-width: 360px; margin: 12vh auto; }

@media (max-width: 760px) {
  .map thead { display: none; }
  .map tr { display: block; border-top: 1px solid var(--line); padding: .5rem 0; }
  .map td { display: block; border: 0; padding: .2rem 0; }
  .map .arrow { display: none; }
  .steps li { font-size: .75rem; }
  .tally { gap: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.form-control, .form-select { background-color: #fff; }
.form-check-input { background-color: #fff; border-color: #9aa5bf; }
.form-check-input:checked { background-color: var(--route); border-color: var(--route); }
