.mrun-page {
  --mrun-green: #285f40;
  --mrun-green-soft: #edf6f0;
  --mrun-ink: #25352a;
  --mrun-muted: #6e7c73;
  --mrun-line: #dce5df;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 30px 60px;
  color: var(--mrun-ink);
}

.mrun-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
}

.mrun-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  color: #557064;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.mrun-eyebrow,
.mrun-flow-heading > div > span {
  margin-top: 14px;
  color: #75877c;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .1em;
}

.mrun-header h1 {
  margin: 5px 0 5px;
  color: #203328;
  font: 700 30px/1.12 Georgia, serif;
}

.mrun-header p {
  max-width: 760px;
  margin: 0;
  color: var(--mrun-muted);
  font-size: 13px;
}

.mrun-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.mrun-targets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid #cdded3;
  border-radius: 12px;
  background: linear-gradient(115deg, #f9fcfa, #eef6f1);
}

.mrun-targets > div {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid #d6e3da;
}

.mrun-targets > div:last-child { border-right: 0; }
.mrun-targets span,
.mrun-targets strong { display: block; }
.mrun-targets span { color: #789083; font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.mrun-targets strong { margin-top: 4px; overflow: hidden; color: #28533a; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }

.mrun-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 355px;
  gap: 18px;
  align-items: start;
}

.mrun-flow {
  padding: 20px;
  border: 1px solid var(--mrun-line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(27, 51, 35, .05);
}

.mrun-flow-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.mrun-flow-heading h2 {
  margin: 4px 0 0;
  font: 700 21px/1.2 Georgia, serif;
}

.mrun-progress-label { text-align: right; }
.mrun-progress-label strong,
.mrun-progress-label span { display: block; }
.mrun-progress-label strong { color: var(--mrun-green); font-size: 15px; }
.mrun-progress-label span { color: #829087; font-size: 9px; }

.mrun-progress {
  height: 6px;
  margin: 13px 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eeeb;
}

.mrun-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #3b8c5e;
  transition: width .2s ease;
}

.mrun-step {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 13px;
  padding: 15px;
  border: 1px solid #dfe6e2;
  border-radius: 11px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}

.mrun-step.is-active {
  border-color: #6ca080;
  box-shadow: 0 0 0 3px rgba(48, 128, 80, .1), 0 10px 24px rgba(24, 71, 43, .08);
}

.mrun-step.is-complete { border-color: #c7dccf; background: #f8fcf9; }
.mrun-step.is-upcoming { opacity: .72; }

.mrun-step-number {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #597166;
  font-size: 17px;
  font-weight: 850;
}

.mrun-step.is-active .mrun-step-number { background: #bd7c25; }
.mrun-step.is-complete .mrun-step-number { background: #35815a; }

.mrun-step-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.mrun-step-title span {
  color: #89958e;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mrun-step-title h3 {
  margin: 2px 0 0;
  color: #2e4034;
  font-size: 14px;
}

.mrun-step-body > p {
  margin: 7px 0 0;
  color: #65736b;
  font-size: 11px;
  line-height: 1.5;
}

.mrun-step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.mrun-step-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  color: #4d6657;
  background: #edf4ef;
  font-size: 9px;
  font-weight: 700;
}

.mrun-step-meta .mrun-stamp { color: #305f78; background: #edf5f8; }

.mrun-additions {
  display: grid;
  gap: 6px;
  padding: 10px;
  margin-top: 10px;
  border: 1px solid #e4eae6;
  border-radius: 8px;
  background: #f9fbfa;
}

.mrun-additions > span {
  color: #89948e;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .08em;
}

.mrun-addition {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 7px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #edf1ee;
}

.mrun-addition > wa-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #456954;
  background: #edf4ef;
  font-size: 11px;
}

.mrun-addition strong,
.mrun-addition small { display: block; }
.mrun-addition strong { color: #3a4c40; font-size: 10px; }
.mrun-addition small { margin-top: 1px; color: #8a958f; font-size: 8px; text-transform: capitalize; }
.mrun-addition b { color: #28553a; font-size: 10px; white-space: nowrap; }

.mrun-actuals {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.mrun-actuals span {
  padding: 4px 7px;
  border: 1px solid #cee0d4;
  border-radius: 6px;
  color: #356047;
  background: #f4faf6;
  font-size: 9px;
}

.mrun-connector {
  height: 28px;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  color: #799085;
}

.mrun-connector i { width: 2px; height: 18px; background: #c8d6ce; }
.mrun-connector wa-icon { margin-top: -4px; font-size: 11px; }
.mrun-steps > .mrun-connector:last-child { display: none; }

.mrun-rail {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 13px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
}

.mrun-rail > .card { padding: 16px; border: 1px solid var(--mrun-line); border-radius: 11px; }
.mrun-rail-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding-bottom: 10px; margin-bottom: 11px; border-bottom: 1px solid #e5ebe7; }
.mrun-rail-heading > span { color: #74827a; font-size: 9px; font-weight: 850; letter-spacing: .1em; }

.mrun-setup { background: linear-gradient(180deg, #fff, #f7fbf8); }
.mrun-setup dl { display: grid; gap: 5px; margin: 0; }
.mrun-setup dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mrun-setup dt { color: #849087; font-size: 9px; }
.mrun-setup dd { margin: 0; color: #374b3d; font-size: 10px; font-weight: 750; text-align: right; }

.mrun-lots { padding-top: 11px; margin-top: 11px; border-top: 1px solid #e2e8e4; }
.mrun-lots > strong { display: block; margin-bottom: 7px; font-size: 10px; }
.mrun-lots > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 9px; padding: 6px 0; border-bottom: 1px solid #edf1ee; }
.mrun-lots span { overflow: hidden; font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mrun-lots b { color: #315e45; font-size: 9px; }
.mrun-lots small { grid-column: 1 / -1; color: #929b95; font-size: 7px; }
.mrun-lots p { margin: 5px 0 0; color: #89938d; font-size: 9px; }

.mrun-active h2,
.mrun-finish h2,
.mrun-terminal h2 { margin: 0 0 5px; font: 700 18px/1.25 Georgia, serif; }
.mrun-active > p,
.mrun-finish > p,
.mrun-terminal > p { margin: 0 0 12px; color: #748078; font-size: 10px; line-height: 1.45; }

.mrun-actual-grid,
.mrun-finish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 9px; }
.mrun-active wa-textarea,
.mrun-finish > wa-input { display: block; margin-bottom: 9px; }
.mrun-active #mrun-step-at,
.mrun-finish #mrun-finish-at { margin-top: 9px; }
.mrun-time-note { display: flex; align-items: center; gap: 5px; margin: -4px 0 10px !important; color: #87928b !important; font-size: 8px !important; }
.mrun-active > wa-button,
.mrun-finish > wa-button,
.mrun-terminal > wa-button { width: 100%; margin-top: 7px; }

.mrun-confirm {
  display: grid;
  gap: 7px;
  padding: 10px;
  margin-top: 9px;
  border: 1px solid #dec28f;
  border-radius: 8px;
  background: #fff9ee;
}

.mrun-confirm > strong { color: #76501a; font-size: 10px; }
.mrun-confirm > p { margin: 0; color: #806f56; font-size: 8px; line-height: 1.4; }
.mrun-confirm > div:last-child { display: flex; justify-content: flex-end; gap: 5px; }
.mrun-finish { border-color: #bdd8c7 !important; background: linear-gradient(180deg, #fff, #f2faf5); }
.mrun-terminal { background: #f8faf8; }
.mrun-error { max-width: 620px; padding: 24px; margin: 40px auto; }
.mrun-error h2 { margin-top: 0; }
.mrun-error p { color: var(--mrun-muted); }
.mrun-confirm.is-hidden { display: none !important; }

.mrun-sop {
  color: #415548;
  font-size: 12px;
  line-height: 1.7;
}

.mrun-checkpoint-entry {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--mrun-line);
}

.mrun-checkpoint-entry > wa-button {
  justify-self: start;
}

.mrun-checkpoint-error {
  padding: 9px 10px;
  border: 1px solid var(--wa-color-danger-70);
  border-radius: 7px;
  background: var(--wa-color-danger-50);
  color: var(--wa-color-danger-30);
  font-size: 12px;
  line-height: 1.45;
}

.mrun-checkpoint-error.is-hidden { display: none; }

.mrun-corrective-guidance {
  padding: 12px;
  border: 1px solid #d8a54a;
  border-radius: 8px;
  background: #fff8e8;
}

.mrun-corrective-guidance.is-hidden { display: none; }
.mrun-corrective-guidance > strong { color: #76501a; }
.mrun-corrective-options p { margin: 8px 0; color: #65491e; }
.mrun-corrective-action.is-hidden { display: none; }
.mrun-corrective-material-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, .6fr);
  gap: 10px;
  align-items: end;
  margin: 8px 0 12px;
}
.mrun-corrective-guidance wa-textarea,
.mrun-corrective-guidance wa-input { display: block; margin-top: 8px; }

@media (max-width: 720px) {
  .mrun-corrective-material-fields { grid-template-columns: 1fr; }
}

@media (max-width: 1080px) {
  .mrun-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .mrun-targets { grid-template-columns: repeat(3, 1fr); }
  .mrun-targets > div:nth-child(3) { border-right: 0; }
  .mrun-targets > div:nth-child(n+4) { border-top: 1px solid #d6e3da; }
}

@media (max-width: 820px) {
  .mrun-page { padding: 20px 16px 50px; }
  .mrun-header { align-items: flex-start; flex-direction: column; }
  .mrun-layout { grid-template-columns: 1fr; }
  .mrun-rail { position: static; max-height: none; overflow: visible; }
}

@media (max-width: 560px) {
  .mrun-header-actions { width: 100%; justify-content: space-between; }
  .mrun-targets { grid-template-columns: 1fr 1fr; }
  .mrun-targets > div { border-top: 1px solid #d6e3da; }
  .mrun-targets > div:nth-child(odd) { border-right: 1px solid #d6e3da; }
  .mrun-targets > div:nth-child(even) { border-right: 0; }
  .mrun-targets > div:first-child,
  .mrun-targets > div:nth-child(2) { border-top: 0; }
  .mrun-step { grid-template-columns: 38px minmax(0, 1fr); gap: 9px; padding: 11px; }
  .mrun-step-number { width: 36px; height: 36px; font-size: 14px; }
  .mrun-step-title { flex-direction: column; }
  .mrun-addition { grid-template-columns: 24px minmax(0, 1fr); }
  .mrun-addition b { grid-column: 2; }
  .mrun-actual-grid,
  .mrun-finish-grid { grid-template-columns: 1fr; }
}
