/* ☰ → Migration (migration.js): the move guide, the template download, and the upload check report.
   Same tokens as Onboarding (onboarding.css) and the new design, so both setup pages read as one. */

.mg{
  --mg-ink: #0f1b2d;
  --mg-ink-2: #3d4a5c;
  --mg-mute: #646f7f;
  --mg-line: #ebe7df;
  --mg-paper: #ffffff;
  --mg-navy: #102d4e;
  --mg-navy-2: #1c4471;
  --mg-gold: #c48a2c;
  --mg-gold-bg: #fbf0dc;
  --mg-green: #16a34a;
  --mg-green-ink: #15803d;
  --mg-green-bg: #e7f7ec;
  --mg-red: #be123c;
  --mg-red-bg: #fdecef;
  --mg-amber-ink: #a35a04;
  --mg-amber-bg: #fdf1dc;
  --mg-slate-bg: #eef1f5;
  --mg-shadow: 0 1px 2px rgba(15, 27, 45, 0.04), 0 8px 24px -14px rgba(15, 27, 45, 0.18);
  --mg-sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mg-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  color: var(--mg-ink);
  font-family: var(--mg-sans);
}

#rwMigration{
  display: grid;
  gap: 28px;
  max-width: 1080px;
  padding-bottom: 64px;
}

/* ---------- Buttons (header and hero) ---------- */

.mg .mg-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--mg-line);
  border-radius: 10px;
  background: var(--mg-paper);
  color: var(--mg-ink-2);
  font: 500 0.875rem/1 var(--mg-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.mg .mg-btn:hover{
  border-color: var(--mg-navy-2);
  color: var(--mg-navy);
}

.mg .mg-btn--primary{
  border-color: var(--mg-navy);
  background: var(--mg-navy);
  color: #fff;
}

.mg .mg-btn--primary:hover{
  border-color: var(--mg-navy-2);
  background: var(--mg-navy-2);
  color: #fff;
}

.mg .mg-btn:disabled{
  opacity: 0.6;
  cursor: progress;
}

.mg .mg-btn:focus-visible,
.mg .mg-tab:focus-visible{
  outline: 2px solid var(--mg-gold);
  outline-offset: 2px;
}

.mg .ra-invoice-head__actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Hero ---------- */

.mg-kicker{
  margin: 0 0 4px;
  color: var(--mg-gold);
  font: 600 0.75rem/1.2 var(--mg-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mg-hero{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 28px 32px;
  border: 1px solid var(--mg-line);
  border-radius: 18px;
  background: linear-gradient(120deg, var(--mg-gold-bg), var(--mg-paper) 55%);
  box-shadow: var(--mg-shadow);
}

.mg-hero__title{
  margin: 0;
  max-width: 24ch;
  font: 400 2rem/1.12 var(--mg-serif);
  letter-spacing: -0.01em;
}

.mg-hero__sub{
  margin: 8px 0 0;
  max-width: 60ch;
  color: var(--mg-mute);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.mg-hero__cta{
  display: grid;
  justify-items: center;
  gap: 8px;
}

.mg-hero__cta .mg-btn{
  height: 44px;
  padding: 0 22px;
  font-size: 0.9375rem;
}

.mg-hero__meta{
  color: var(--mg-mute);
  font-size: 0.75rem;
}

/* ---------- Steps ---------- */

.mg-section__title{
  margin: 0 0 12px;
  padding: 0 4px;
  font: 400 1.5rem/1.15 var(--mg-serif);
}

.mg-steps{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-step{
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--mg-line);
  border-radius: 14px;
  background: var(--mg-paper);
  box-shadow: var(--mg-shadow);
}

.mg-step__num{
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mg-slate-bg);
  color: var(--mg-navy);
  font: 600 0.875rem/1 var(--mg-sans);
  font-variant-numeric: tabular-nums;
}

.mg-step__title{
  margin: 5px 0 4px;
  font: 600 0.9375rem/1.3 var(--mg-sans);
}

.mg-step__text{
  margin: 0;
  color: var(--mg-ink-2);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ---------- What stays behind ---------- */

.mg-behind{
  padding: 18px 24px;
  border-radius: 14px;
  background: var(--mg-slate-bg);
}

.mg-behind__title{
  margin: 0 0 10px;
  font: 600 0.875rem/1.3 var(--mg-sans);
}

.mg-behind__list{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 6px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-behind__list li{
  position: relative;
  padding-left: 20px;
  color: var(--mg-ink-2);
  font-size: 0.875rem;
  line-height: 1.45;
}

.mg-behind__list li::before{
  content: "";
  position: absolute;
  top: 0.55em;
  left: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mg-navy-2);
}

.mg-behind__warn{
  margin: 14px 0 0;
  color: var(--mg-red);
  font: 600 0.8125rem/1.4 var(--mg-sans);
}

/* ---------- Busy and errors ---------- */

.mg-busy,
.mg-error{
  margin: 0;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.9375rem;
}

.mg-busy{
  background: var(--mg-slate-bg);
  color: var(--mg-ink-2);
}

.mg-error{
  background: var(--mg-red-bg);
  color: var(--mg-red);
  font-weight: 500;
}

/* ---------- Result ---------- */

.mg-result{
  display: grid;
  gap: 20px;
  padding: 24px 28px;
  border: 1px solid var(--mg-line);
  border-radius: 18px;
  background: var(--mg-paper);
  box-shadow: var(--mg-shadow);
  scroll-margin-top: 96px;
}

.mg-result.is-ready{
  border-color: color-mix(in srgb, var(--mg-green) 35%, var(--mg-line));
  background: linear-gradient(120deg, var(--mg-green-bg), var(--mg-paper) 55%);
}

.mg-result.is-blocked{
  border-color: color-mix(in srgb, var(--mg-red) 30%, var(--mg-line));
}

.mg-result__head{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 18px;
}

.mg-result__icon{
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--mg-red-bg);
  color: var(--mg-red);
  font: 700 1.375rem/1 var(--mg-sans);
}

.mg-result.is-ready .mg-result__icon{
  background: var(--mg-green);
  color: #fff;
}

.mg-result__title{
  margin: 0;
  font: 400 1.875rem/1.1 var(--mg-serif);
}

.mg-result__sub{
  margin: 6px 0 0;
  max-width: 62ch;
  color: var(--mg-mute);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.mg-result__chips{
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 300px;
}

.mg-chip{
  padding: 4px 10px;
  border-radius: 999px;
  font: 600 0.75rem/1.4 var(--mg-sans);
  white-space: nowrap;
}

.mg-chip--ok{
  background: var(--mg-green-bg);
  color: var(--mg-green-ink);
}

.mg-chip--bad{
  background: var(--mg-red-bg);
  color: var(--mg-red);
}

.mg-chip--note{
  background: var(--mg-amber-bg);
  color: var(--mg-amber-ink);
}

.mg-result__nothing{
  margin: -8px 0 0;
  color: var(--mg-mute);
  font-size: 0.8125rem;
}

.mg-result__grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.mg-card{
  padding: 18px 20px;
  border: 1px solid var(--mg-line);
  border-radius: 14px;
  background: var(--mg-paper);
}

.mg-card__title{
  margin: 0 0 12px;
  font: 600 0.875rem/1.3 var(--mg-sans);
}

.mg-card__note,
.mg-card__empty{
  margin: 12px 0 0;
  color: var(--mg-mute);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.mg-card__empty{
  margin: 0;
}

/* Trust: the statement on top, what's held below, the difference last. Amounts line up on the right. */
.mg-trust{
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.mg-trust th,
.mg-trust td{
  padding: 7px 0;
  border-bottom: 1px solid var(--mg-line);
  text-align: left;
  font-weight: 400;
}

.mg-trust td{
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--mg-ink);
}

.mg-op{
  display: inline-block;
  width: 16px;
  color: var(--mg-mute);
}

.mg-trust__diff th,
.mg-trust__diff td{
  border-bottom: 0;
  border-top: 2px solid var(--mg-ink);
  font-weight: 600;
}

.mg-trust__diff.is-zero td{
  color: var(--mg-green-ink);
}

.mg-trust__diff.is-off td{
  color: var(--mg-red);
}

.mg-move{
  display: grid;
  gap: 12px;
  margin: 0;
}

.mg-move > div{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--mg-slate-bg);
}

.mg-move dt{
  font-weight: 600;
  font-size: 0.875rem;
}

.mg-move dd{
  margin: 0;
  font: 600 1.125rem/1.2 var(--mg-sans);
  font-variant-numeric: tabular-nums;
  color: var(--mg-navy);
}

.mg-move p{
  grid-column: 1 / -1;
  margin: 0;
  color: var(--mg-mute);
  font-size: 0.8125rem;
}

.mg-counts{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-counts li{
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--mg-slate-bg);
  color: var(--mg-ink-2);
  font-size: 0.8125rem;
}

.mg-counts strong{
  color: var(--mg-ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Problems ---------- */

.mg-problems{
  display: grid;
  gap: 10px;
}

.mg-tabs{
  display: flex;
  gap: 4px;
  padding: 4px;
  width: max-content;
  border-radius: 12px;
  background: var(--mg-slate-bg);
}

.mg .mg-tab{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--mg-ink-2);
  font: 500 0.875rem/1 var(--mg-sans);
  cursor: pointer;
}

.mg .mg-tab span{
  font-variant-numeric: tabular-nums;
  color: var(--mg-mute);
}

.mg .mg-tab.is-on{
  background: var(--mg-paper);
  color: var(--mg-ink);
  box-shadow: 0 1px 2px rgba(15, 27, 45, 0.08);
}

.mg .mg-problems .ra-owner__list{
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--mg-line);
  border-radius: 12px;
}

.mg .mg-grid{
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.mg .mg-grid th{
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  background: #faf9f6;
  border-bottom: 1px solid var(--mg-line);
  color: var(--mg-mute);
  font: 600 0.75rem/1.2 var(--mg-sans);
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.mg .mg-grid td{
  padding: 10px 14px;
  border-bottom: 1px solid var(--mg-line);
  vertical-align: top;
  line-height: 1.45;
}

.mg .mg-grid tr:last-child td{
  border-bottom: 0;
}

.mg .mg-grid td:first-child{
  white-space: nowrap;
  font-weight: 500;
}

.mg .mg-grid__row{
  font-variant-numeric: tabular-nums;
  color: var(--mg-mute);
}

.mg .mg-grid tr.is-error td:last-child{
  color: var(--mg-red);
}

.mg-more{
  margin: 0;
  color: var(--mg-mute);
  font-size: 0.8125rem;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 760px){
  .mg-hero{
    grid-template-columns: 1fr;
    padding: 22px 20px;
  }

  .mg-hero__title{
    font-size: 1.625rem;
  }

  .mg-hero__cta{
    justify-items: start;
  }

  .mg-result{
    padding: 20px;
  }

  .mg-result__head{
    grid-template-columns: auto 1fr;
  }

  .mg-result__chips{
    grid-column: 1 / -1;
    justify-content: flex-start;
    max-width: none;
  }

  .mg-steps,
  .mg-behind__list{
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce){
  .mg .mg-btn{
    transition: none;
  }
}
