/* ===== Job stages (05-stages.js) =====
   The rail's "On site: Whole job | By stage" and its summary, the stage
   board, the dual generators by stage (board and section 5), and the
   "What runs when" slide. Ported from the approved stage preview. */

/* ---- rail: section 3, under "On site: Whole job | By stage" ---- */
#panel .stg-railsum {
  margin: 8px 0 14px;
  padding: 10px 12px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(120, 190, 240, 0.35);
  animation: stgIn 0.18s ease-out;
}
#panel .stg-railsum[hidden] { display: none; }
@keyframes stgIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
#panel .stg-rs-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.8rem; }
#panel .stg-rs-top span { font-size: 0.72rem; opacity: 0.7; }
#panel .stg-pstrip { display: flex; gap: 2px; height: 16px; margin: 8px 0 8px; }
#panel .stg-pstrip i {
  display: flex; align-items: center; justify-content: center; min-width: 14px;
  font-style: normal; font-size: 0.6rem; font-weight: 800; color: #063a56;
  background: #7ec8f2; border-radius: 3px;
}
#panel .stg-pstrip i:nth-child(even) { background: #4bbded; }
#panel .stg-rs-warn {
  margin: 0 0 6px; padding: 5px 8px; border-radius: 6px; font-size: 0.68rem; line-height: 1.4;
  background: rgba(239, 168, 58, 0.08); border-left: 3px solid var(--gold); color: #f3d6a5;
}
#panel .stg-railsum .stg-edit { margin-top: 4px; border-color: rgba(75, 189, 237, 0.6); color: var(--cyan); font-weight: 700; }
#panel .eqrow .stg-cardline { margin-top: 6px; }
#panel .eqrow .stg-cardline .runslink { margin-left: 4px; }
#panel .eqrow .stg-cardline.stg-warn { color: #f3c871; }
#panel input.stg-locked { opacity: 0.75; cursor: default; }
#panel .stg-gennote { margin-top: 6px; color: #bfe6fa; }
#panel .stg-gennote[hidden] { display: none; }

/* ---- the stage sheet ---- */
html.stgx-lock, html.stgx-lock body { overflow: hidden; }
.stgx {
  position: fixed; inset: 0; z-index: 220;
  display: flex; align-items: stretch; justify-content: center;
  padding: 3vh 2vw;
  font-family: "Roboto", "Segoe UI", system-ui, sans-serif;
}
.stgx[hidden] { display: none; }
.stgx-back { position: absolute; inset: 0; background: rgba(6, 26, 42, 0.62); }
.stgx-card {
  position: relative; z-index: 1; width: min(1320px, 100%); min-height: 0;
  display: flex; flex-direction: column;
  background: #fff; color: var(--ink, #080605);
  border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden; animation: stgIn 0.18s ease-out;
}
.stgx-head {
  display: flex; gap: 20px; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px 14px; border-bottom: 1px solid #eef1f4;
}
.stgx-head h3 { margin: 0 0 5px; font-size: 1.12rem; font-weight: 800; color: var(--navy-950); }
.stgx-head h3 .stgx-sum { margin-left: 10px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.stgx-head p { margin: 0; font-size: 0.8rem; line-height: 1.5; color: var(--ink-2); max-width: 660px; }
.stgx-head p b { color: var(--navy-950); white-space: nowrap; }
.stgx-tools { display: flex; gap: 6px; align-items: center; flex: none; }
.stgx-btn {
  border: 1px solid #d5dce2; background: #fff; color: var(--navy-950);
  border-radius: 8px; padding: 9px 15px; cursor: pointer;
  font: 700 0.8rem/1 "Roboto", "Segoe UI", system-ui, sans-serif;
  transition: background 0.12s, border-color 0.12s;
}
.stgx-btn:hover { background: #f3f7fa; }
.stgx-btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.stgx-btn.primary:hover { background: #075680; }
.stgx-btn.ghost { border-color: transparent; color: var(--ink-2); }
.stgx-btn:disabled { opacity: 0.38; cursor: default; background: transparent; }
.stgx-btn.primary:disabled { background: var(--navy); }
.stgx-btn:focus-visible, .stgx button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.stgx-notes p { margin: 6px 0 0; padding: 6px 9px; border-radius: 6px; font-size: 0.72rem; line-height: 1.45; }
.stgx .w { background: #fdf3e3; border-left: 3px solid var(--gold); color: #6d4300; }
.stgx .i { background: #eef6fb; border-left: 3px solid var(--cyan); color: #164f6d; }

/* the table */
.stgx-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 6px 24px 14px; }
table.stgx-t { border-collapse: separate; border-spacing: 0; font-size: 0.84rem; margin-top: 6px; table-layout: fixed; }
/* the load and hours columns stay in view while the stages scroll sideways */
.stgx-t th.c-load, .stgx-t td.c-load, .stgx-t tbody.res th { position: sticky; left: 0; z-index: 2; background: #fff; }
@media (min-width: 761px) {
  .stgx-t th.c-runs, .stgx-t td.c-runs { position: sticky; left: var(--wl, 214px); z-index: 2; background: #fff; }
  .stgx-t td.c-runs { box-shadow: 6px 0 6px -6px rgba(6, 58, 86, 0.18); }
}
@media (max-width: 760px) { .stgx-t td.c-load { box-shadow: 6px 0 6px -6px rgba(6, 58, 86, 0.18); } }
.stgx-t thead th { vertical-align: top; text-align: left; padding: 0 0 10px; font-weight: 400; }
.stgx-t thead .lab { display: block; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-top: 8px; }
.stgx-t thead .sub { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.stgx-t th.c-st {
  padding: 8px 8px 9px; background: #f3f7fa; border: 1px solid #e3e9ee; border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.stgx-t th.c-st + th.c-st { border-left: 0; }
.stgx-t .st-top { display: flex; align-items: center; justify-content: space-between; min-height: 22px; }
.stgx-t .st-top .num {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy-950); color: #fff; font-size: 0.72rem; font-weight: 800;
}
.stgx-t .st-tools { display: inline-flex; gap: 1px; opacity: 0.35; transition: opacity 0.12s; }
.stgx-t th.c-st:hover .st-tools, .stgx-t th.c-st:focus-within .st-tools { opacity: 1; }
@media (hover: none) { .stgx-t .st-tools { opacity: 1; } }
.stgx .ic {
  width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; cursor: pointer;
  color: var(--ink-2); font: 700 0.95rem/1 "Roboto", system-ui, sans-serif;
}
.stgx .ic:hover { background: #e3eaf0; color: var(--navy-950); }
.stgx .ic.x:hover { background: #fde7e2; color: #b2401f; }
.stgx-t textarea.nm {
  display: block; width: 100%; box-sizing: border-box; margin: 6px 0 4px; padding: 4px 6px; resize: none; overflow: hidden; height: 64px;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  font: 700 0.76rem/1.2 "Roboto", system-ui, sans-serif; color: var(--navy-950);
}
.stgx-t textarea.nm::placeholder { color: var(--navy-950); opacity: 0.62; font-weight: 600; }
.stgx-t textarea.nm:hover { border-color: #d5dce2; background: #fff; }
.stgx-t textarea.nm:focus { border-color: var(--navy); background: #fff; outline: none; }
.stgx-t .st-mo { display: flex; align-items: center; gap: 5px; font-size: 0.74rem; color: var(--ink-2); }
.stgx-t input.mo {
  width: 46px; box-sizing: border-box; padding: 4px 5px; text-align: center;
  border: 1px solid #d5dce2; border-radius: 6px; background: #fff;
  font: 700 0.84rem/1.2 "Roboto", system-ui, sans-serif; color: var(--ink);
  -moz-appearance: textfield;
}
.stgx-t input.mo::-webkit-inner-spin-button, .stgx-t input.hrs::-webkit-inner-spin-button { opacity: 0.5; }
.stgx-t input.mo:focus, .stgx-t input.hrs:focus { border-color: var(--navy); outline: 2px solid rgba(9, 102, 151, 0.2); }
.stgx-t .conf {
  border: 0; border-radius: 999px; padding: 2px 7px; cursor: pointer;
  font: 700 0.62rem/1.5 "Roboto", system-ui, sans-serif; letter-spacing: 0.03em;
  background: #fdf0d8; color: #8a5600;
}
.stgx-t .conf.on { background: #e3f3e6; color: var(--good-text); }
.stgx-t .st-when { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 6px; margin-top: 5px; font-size: 0.68rem; color: var(--muted); }
.stgx-t th.c-add { vertical-align: top; padding: 8px 0 0 10px; }
.stgx .addst, .stgx .addload {
  border: 1px dashed #9cc9e4; background: transparent; color: var(--navy); border-radius: 8px;
  padding: 8px 12px; cursor: pointer; font: 700 0.78rem/1 "Roboto", system-ui, sans-serif; white-space: nowrap;
}
.stgx .addload { position: sticky; left: 0; }
.stgx .addst:hover, .stgx .addload:hover { background: #eef6fb; border-style: solid; }
.stgx .addst:disabled { opacity: 0.5; cursor: default; }

.stgx-t tbody td { padding: 0; border-bottom: 1px solid #edf1f4; vertical-align: middle; }
.stgx-t tbody tr:first-child td { border-top: 1px solid #e3e9ee; }
.stgx-t td.c-load { padding: 5px 8px 5px 0; }
.stgx-t select.ty {
  width: 100%; box-sizing: border-box; padding: 7px 8px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; font: 600 0.84rem/1.2 "Roboto", system-ui, sans-serif; color: var(--ink); cursor: pointer;
}
.stgx-t select.ty:hover { border-color: #d5dce2; background: #fff; }
.stgx-t select.ty:focus { border-color: var(--navy); outline: none; background: #fff; }
.stgx-t td.c-runs { padding: 5px 8px 5px 0; white-space: nowrap; }
.stgx-t .hrsw { display: inline-flex; align-items: center; gap: 3px; font-size: 0.76rem; color: var(--ink-2); }
.stgx-t input.hrs {
  width: 44px; box-sizing: border-box; padding: 5px 4px; text-align: center; border: 1px solid #d5dce2; border-radius: 6px;
  background: #fff; font: 600 0.82rem/1.2 "Roboto", system-ui, sans-serif; color: var(--ink);
}
.stgx-t input.hrs.shift { color: var(--muted); border-style: dashed; }
.stgx-t td.c-runs .tag {
  display: inline-block; margin-left: 5px; border-radius: 999px; padding: 1px 6px;
  font-size: 0.6rem; font-weight: 700; background: #fdf0d8; color: #8a5600; vertical-align: 1px;
}
.stgx-t td.c-cell { position: relative; border-left: 1px solid #edf1f4; background: #fff; transition: background 0.12s; }
.stgx-t td.c-cell.on { background: #eaf6fd; }
.stgx-t td.c-cell:last-of-type { border-right: 0; }
.stgx-t input.cell {
  display: block; width: 100%; height: 38px; box-sizing: border-box; padding: 0 12px 0 30px;
  border: 0; background: transparent; text-align: right;
  font: 700 0.92rem/1 "Roboto", system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--navy-950);
}
.stgx-t input.cell::placeholder { color: #c3ccd3; font-weight: 400; }
.stgx-t input.cell:focus { outline: 2px solid var(--navy); outline-offset: -2px; background: #fff; }
.stgx-t input.cell.bad, .stgx-t input.bad { background: #fdecea !important; outline-color: #b2401f !important; }
.stgx-t td.c-cell .n {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  font-size: 0.66rem; font-weight: 700; color: #4a7f9c; pointer-events: none;
}
.stgx-t td.c-x { text-align: left; padding-left: 8px; border-left: 1px solid #edf1f4; }
.stgx-t tr[data-j] .c-x .ic { opacity: 0.3; }
.stgx-t tr[data-j]:hover .c-x .ic, .stgx-t tr[data-j] .c-x .ic:focus { opacity: 1; }
.stgx-t tr.addrow td { border-bottom: 0; padding: 10px 0 14px; }

/* results, per stage */
.stgx-t tbody.res tr:first-child th, .stgx-t tbody.res tr:first-child td { border-top: 2px solid var(--navy-950); }
.stgx-t tbody.res th {
  text-align: left; padding: 7px 8px 7px 0; font-size: 0.74rem; font-weight: 700; color: var(--ink-2);
  border-bottom: 1px solid #edf1f4; vertical-align: top;
}
.stgx-t tbody.res th .sub { display: block; font-weight: 400; font-size: 0.66rem; color: var(--muted); }
.stgx-t tbody.res td {
  text-align: right; padding: 7px 12px; font-size: 0.78rem; font-variant-numeric: tabular-nums; color: var(--ink);
  border-left: 1px solid #edf1f4; vertical-align: top; transition: opacity 0.15s;
}
.stgx-t tbody.res td:nth-last-child(-n+2) { border-left: 0; }
.stgx-t tbody.res tr.sum td { font-weight: 800; color: var(--navy-950); font-size: 0.86rem; }
.stgx-t tbody.res .ok { color: var(--good-text); font-weight: 800; }
.stgx-t tbody.res .off { color: #8a5600; font-size: 0.66rem; font-weight: 700; }
.stgx-t tbody.res .sz {
  display: inline-block; margin-left: 3px; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  color: #fff; background: var(--navy-2); border-radius: 3px; padding: 1px 4px; vertical-align: 1px;
}
.stgx-t tbody.res tr.dz td { line-height: 1.45; }
.stgx-t tbody.res .l2 { display: block; white-space: nowrap; }
.stgx-t tbody.res td.stale, .stgx-t tbody.res.calc tr:not(.sum) td { opacity: 0.45; }
.stgx .stg-good { color: var(--good-text); font-weight: 700; }
.stgx .stg-bad { color: #b2401f; font-weight: 700; }

.stgx-foot {
  display: flex; gap: 24px; justify-content: space-between; align-items: flex-start;
  padding: 10px 24px 16px; border-top: 1px solid #eef1f4; background: #fbfcfd;
}
.stgx-notes { min-width: 0; max-width: 820px; }
.stgx-notes p:first-child { margin-top: 0; }
.stgx-total { flex: none; text-align: right; display: grid; gap: 2px; padding-top: 2px; }
.stgx-total span { font-size: 0.7rem; color: var(--muted); }
.stgx-total b { font-size: 1.3rem; color: var(--good-text); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .stgx { padding: 0; }
  .stgx-card { border-radius: 0; }
  .stgx-head { flex-direction: column; padding: 14px 16px 10px; gap: 10px; }
  .stgx-tools { flex-wrap: wrap; }
  .stgx-scroll { padding: 4px 16px 12px; }
  .stgx-foot { flex-direction: column; padding: 10px 16px 14px; gap: 10px; }
  .stgx-total { text-align: left; }
  .stgx-t select.ty { font-size: 0.78rem; padding: 6px 4px; }
}

/* ---- slides ---- */
.slide .stg-sized {
  display: inline-block; margin-left: 10px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: #fff; background: var(--navy-2); border-radius: 4px; padding: 3px 7px; vertical-align: 6px;
}
.slide .stg-gantt { width: 100%; display: block; }
.slide .stg-good { color: var(--good-text); font-weight: 700; }
.slide .stg-bad { color: #b2401f; font-weight: 700; }
.slide .stg-est {
  display: inline-block; margin-left: 4px; font-size: 8.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  color: #8a5600; background: #fdf0d8; border-radius: 3px; padding: 1px 4px; vertical-align: 1px;
}
.slide .stg-runsbox { position: relative; }
.slide .stg-editbtn {
  position: absolute; top: 10px; right: 12px; border: 1px solid #b9d9ec; background: #fff; color: var(--navy);
  border-radius: 6px; padding: 4px 10px; font: 700 11px/1.3 "Roboto", system-ui, sans-serif; cursor: pointer;
}
.slide .stg-editbtn:hover { background: #eef6fb; }
@media print { .slide .stg-editbtn { display: none !important; } }
.print-render .slide .stg-editbtn { display: none !important; }
.slide.stg-flash { animation: stgFlash 1.4s ease-out; }
@keyframes stgFlash { 0% { box-shadow: 0 0 0 4px #4bbded; } 100% { box-shadow: 0 0 0 4px rgba(75, 189, 237, 0); } }

.slide .loadtable .stg-mocol { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy-950); }
.slide .loadtable th.stg-mocol { font-weight: inherit; color: inherit; }
.slide .loadtable td.stg-dash { color: var(--muted); font-size: 0.9em; font-style: italic; }
.slide .sectionbadge .stg-dvnote {
  margin-left: 8px; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 600; letter-spacing: 0.04em; text-transform: none; opacity: 0.9;
}
.slide .stg-bystage { margin: 4px 0 2px; }
.slide .stg-bystage table { width: 100%; border-collapse: collapse; font-size: 12px; color: var(--ink); }
.slide .stg-bystage th {
  text-align: right; font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--grid);
}
.slide .stg-bystage td { text-align: right; padding: 6px 8px; border-bottom: 1px solid #f0f2f4; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slide .stg-bystage th:first-child, .slide .stg-bystage td:first-child { text-align: left; white-space: normal; }
.slide .stg-bystage th:nth-child(2), .slide .stg-bystage td:nth-child(2) { text-align: center; }
.slide .stg-bystage tr.sz td { font-weight: 700; color: var(--navy-950); background: #f2f8fc; }
.slide .stg-bystage tr.gap td { color: var(--muted); }
.slide .stg-bystage .stg-sz {
  font-size: 8px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: var(--navy-2); border-radius: 3px; padding: 1px 4px; margin-left: 4px;
}
.slide .stg-bystage.dense td { padding: 3px 8px; }
.slide .stg-bystage.dense2 table { font-size: 10.5px; }
.slide .stg-bystage.dense2 td { padding: 0 8px; line-height: 1.35; }
.slide .stg-bystage.dense2 th { padding: 3px 8px; }

@media (max-width: 760px) {
  .stgx-notes { max-height: 26vh; overflow: auto; }
}
/* the deck's phone layer turns every table into a squeezed block; the sheet keeps its columns and scrolls inside .stgx-scroll */
.stgx table.stgx-t { display: table !important; max-width: none !important; overflow: visible !important; }
.stgx table.stgx-t > thead { display: table-header-group !important; width: auto !important; }
.stgx table.stgx-t > tbody { display: table-row-group !important; width: auto !important; }
.stgx table.stgx-t > * > tr { display: table-row !important; }
.stgx table.stgx-t > * > tr > * { display: table-cell !important; }
.stgx table.stgx-t select, .stgx table.stgx-t input, .stgx table.stgx-t textarea { max-width: none; }
html.stgx-lock .mdrawer-fab { display: none !important; }
.stgx-t th.c-load, .stgx-t td.c-load, .stgx-t tbody.res th { box-shadow: -24px 0 0 #fff; }
@media (max-width: 760px) { .stgx-t td.c-load { box-shadow: -24px 0 0 #fff, 6px 0 6px -6px rgba(6, 58, 86, 0.18); } }

/* ===== the board: the rail's equipment, a column per stage =====
   On a desktop it sits beside the rail, so a card can be fixed while it's
   open; on a phone it takes the screen (the rail is a drawer there). */
@media (min-width: 761px) {
  .stgx { left: var(--panel-w, 324px); padding: 2.5vh 2vw; z-index: 150; }
  html.stgx-lock #panel { box-shadow: 6px 0 24px rgba(0, 0, 0, 0.25); }
}
.stgx-t td.c-load { padding: 3px 10px 3px 0; }
.stgx .eq {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 6px 8px; border-radius: 7px; font: 400 0.84rem/1.25 "Roboto", system-ui, sans-serif; color: var(--ink);
}
.stgx .eq:hover { background: #f3f7fa; }
.stgx .eq b { font-weight: 700; color: var(--navy-950); }
.stgx .eq .q { color: var(--ink-2); font-weight: 600; }
.stgx .eq .sub { display: block; margin-top: 2px; font-size: 0.7rem; color: var(--muted); }
.stgx .eq .tag {
  display: inline-block; margin-top: 3px; border-radius: 999px; padding: 1px 6px;
  font-size: 0.6rem; font-weight: 700; background: #fdf0d8; color: #8a5600;
}
.stgx-t td.c-cell { padding: 4px 0; border-left: 0; background: transparent; user-select: none; -webkit-user-select: none; }
.stgx-t td.c-cell.on { background: transparent; }
.stgx-t td.c-cell .bar {
  position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  height: 34px; margin: 0 3px; padding: 0 10px; box-sizing: border-box; border-radius: 8px; cursor: pointer;
  background: #4bbded; color: #fff; font: 700 0.86rem/1 "Roboto", system-ui, sans-serif; font-variant-numeric: tabular-nums;
  transition: background 0.1s, box-shadow 0.1s;
}
.stgx-t td.c-cell.jl .bar { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.stgx-t td.c-cell.jr .bar { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.stgx-t td.c-cell .bar:hover { background: #33a9dc; }
.stgx-t td.c-cell.cust .bar { background: #0b7cb2; }
.stgx-t td.c-cell .bar .n { font-style: normal; font-size: 0.66rem; opacity: 0.85; }
.stgx-t td.c-cell .bar.off {
  background: transparent; color: #b8c4cd; border: 1px dashed #d8e1e8; justify-content: center;
}
.stgx-t td.c-cell .bar.off .plus { font-size: 1.05rem; font-weight: 400; opacity: 0; transition: opacity 0.1s; }
.stgx-t td.c-cell .bar.off:hover { background: #eef7fc; border-color: #9cc9e4; color: var(--navy); }
.stgx-t td.c-cell .bar.off:hover .plus { opacity: 1; }
.stgx-t td.c-cell .bar:focus-visible { outline: 2px solid var(--navy-950); outline-offset: 1px; z-index: 1; }
.stgx-t td.c-cell .bar .ed {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: 0; border-radius: 5px; padding: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.22); color: #fff; font-size: 0.78rem; line-height: 22px; opacity: 0; transition: opacity 0.1s;
}
.stgx-t td.c-cell .bar:hover .ed, .stgx-t td.c-cell .bar:focus .ed { opacity: 1; }
.stgx-t td.c-cell .bar .ed:hover { background: rgba(255, 255, 255, 0.38); }
@media (hover: none) { .stgx-t td.c-cell .bar .ed { opacity: 0.9; } }
.stgx-t td.c-cell .bar input.szin {
  width: 100%; height: 26px; box-sizing: border-box; border: 0; border-radius: 5px; padding: 0 6px; text-align: right;
  font: 700 0.86rem/1 "Roboto", system-ui, sans-serif; color: var(--navy-950); background: #fff; outline: none;
}
.stgx-t td.c-cell .bar input.szin.bad { background: #fdecea; }
.stgx-t tbody tr[data-j] td { border-bottom: 1px solid #f0f3f6; }
.stgx-t tr.empty td { padding: 26px 8px; color: var(--ink-2); font-size: 0.86rem; }
.stgx-t th.c-load .sub { max-width: 200px; }
.stgx-t tbody.res td { border-left: 0; }
#panel .eqrow.stg-flash { animation: stgFlashCard 1.4s ease-out; }
@keyframes stgFlashCard { 0% { box-shadow: 0 0 0 3px #4bbded; } 100% { box-shadow: 0 0 0 3px rgba(75, 189, 237, 0); } }
/* confirm buttons on what's assumed */
.stgx-t .conf u, .stgx .tag u, #panel .stg-rs-warn u { text-decoration: underline; text-underline-offset: 2px; font-weight: 800; }
.stgx-t .conf:hover { background: #fbe2b5; }
.stgx-t .conf.on:hover { background: #d3ecd8; }
.stgx button.tag { border: 0; cursor: pointer; margin-left: 8px; font-family: inherit; }
.stgx button.tag:hover { background: #fbe2b5; }
.stgx .nbtn {
  margin-left: 6px; border: 1px solid #e7b866; background: #fff; color: #6d4300; border-radius: 6px;
  padding: 2px 9px; font: 700 0.72rem/1.5 "Roboto", system-ui, sans-serif; cursor: pointer;
}
.stgx .nbtn:hover { background: #fdf0d8; }
#panel button.stg-rs-warn { display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit; border-top: 0; border-right: 0; border-bottom: 0; }
#panel button.stg-rs-warn:hover { background: rgba(239, 168, 58, 0.16); }
#panel .eqrow .stg-hrsline { margin-top: 6px; color: #f3c871; }
/* square boxes: one per stage, filled when the equipment is on site then */
.stgx-t td.c-cell { padding: 5px 4px; }
.stgx-t td.c-cell .bar,
.stgx-t td.c-cell.jl .bar,
.stgx-t td.c-cell.jr .bar { margin: 0; border-radius: 3px; }
.stgx-t td.c-cell .bar { height: 40px; justify-content: center; }
.stgx-t td.c-cell .bar.off { border: 1.5px solid #d3dde5; border-style: solid; background: #fff; }
.stgx-t td.c-cell .bar.off:hover { border-color: #4bbded; background: #eef7fc; }
.stgx-t tbody.res .subt { font-weight: 400; font-size: 0.66rem; color: var(--muted); white-space: normal; }
.stgx-t tbody.res tr.g2 th .nbtn { display: inline-block; margin: 5px 0 0; }
.stgx-t tbody.res tr.g2 th .sub { max-width: 220px; }
.stgx-t tbody.res .gbox {
  display: block; padding: 7px 6px; border-radius: 3px; text-align: center; font-weight: 700; font-size: 0.74rem;
  border: 1.5px solid #e3d3b5; color: #b49a6c; background: #fff;
}
.stgx-t tbody.res .gbox.on { background: #efa83a; border-color: #efa83a; color: #fff; }
.stgx button.tag {
  display: inline-block; margin: 4px 0 2px 8px; border: 0; border-radius: 999px; padding: 2px 8px; cursor: pointer;
  font: 700 0.62rem/1.5 "Roboto", system-ui, sans-serif; background: #fdf0d8; color: #8a5600;
}
.stgx button.tag:hover { background: #fbe2b5; }

/* ===== dual generators per stage ===== */
.stgx-t tr.grp td {
  padding: 14px 0 4px; border-bottom: 0; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.stgx-t tr.g2row td { border-bottom: 0; }
.stgx .g2lab { cursor: default; }
.stgx .g2lab:hover { background: transparent; }
.stgx-t td.c-g2 { padding: 4px; }
.stgx-t .g2box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 46px; box-sizing: border-box; padding: 4px 6px; border-radius: 3px; cursor: pointer; text-align: center;
  background: #fff; border: 1.5px solid #e6d6b8; color: #a88e60; user-select: none; -webkit-user-select: none;
  transition: background 0.1s, border-color 0.1s;
}
.stgx-t .g2box b { font-size: 0.82rem; font-weight: 800; }
.stgx-t .g2box span { font-size: 0.6rem; font-weight: 600; opacity: 0.85; }
.stgx-t .g2box.on { background: #efa83a; border-color: #efa83a; color: #fff; }
.stgx-t .g2box.on.own { background: #d98a17; border-color: #d98a17; }
.stgx-t .g2box.off.warn { border-color: #e08a3c; border-style: dashed; color: #b0601c; }
.stgx-t .g2box:hover { border-color: #d98a17; }
.stgx-t .g2box.off:hover { background: #fff7ea; }
.stgx-t .g2box.tgt { outline: 2px dashed #d98a17; outline-offset: 2px; }
.stgx-t .g2box:focus-visible { outline: 2px solid var(--navy-950); outline-offset: 1px; }

.stgx .g2ed {
  position: absolute; z-index: 5; box-sizing: border-box; padding: 14px 16px 12px; border-radius: 12px;
  background: #fff; border: 1px solid #e3d3b5; box-shadow: 0 18px 50px rgba(6, 26, 42, 0.28); animation: stgIn 0.14s ease-out;
}
.stgx .g2ed-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.stgx .g2ed-h b { font-size: 0.9rem; color: var(--navy-950); }
.stgx .g2ed-h span { flex: 1; font-size: 0.72rem; color: var(--muted); }
.stgx .g2set { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid #f1ece2; }
.stgx .g2set .g2n { width: 42px; font-size: 0.72rem; font-weight: 700; color: var(--ink-2); }
.stgx .g2set label { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; color: var(--ink-2); }
.stgx .g2set input {
  width: 58px; box-sizing: border-box; padding: 5px 6px; text-align: right; border: 1px solid #d5dce2; border-radius: 6px;
  font: 700 0.84rem/1.2 "Roboto", system-ui, sans-serif; color: var(--ink); background: #fff;
}
.stgx .g2set input[data-g2f="hours"] { width: 44px; }
.stgx .g2set input::placeholder { color: #a7b2ba; font-weight: 600; }
.stgx .g2set input:focus { border-color: #d98a17; outline: 2px solid rgba(239, 168, 58, 0.25); }
.stgx .g2set input.bad { background: #fdecea; }
.stgx .g2set .au { font-style: normal; font-size: 0.6rem; font-weight: 700; color: #8a5600; background: #fdf0d8; border-radius: 999px; padding: 1px 5px; }
.stgx .g2none { margin: 4px 0 8px; font-size: 0.76rem; color: var(--ink-2); }
.stgx .g2ed-f { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.stgx .g2ed-f .sp { flex: 1; }
.stgx .g2ed-f .addst { padding: 6px 10px; }
.stgx .g2hint { margin: 8px 0 0; font-size: 0.66rem; color: var(--muted); }

/* the same sets in the rail, section 5 */
#panel .stg-g2rail { margin: 12px 0 4px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
#panel .stg-g2rail[hidden] { display: none; }
#panel .g2r-hd { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; margin-bottom: 6px; }
#panel .g2r-hd .runslink { text-transform: none; letter-spacing: 0; font-weight: 600; }
#panel .g2r { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
#panel .g2r .n {
  flex: none; width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy-2); font-size: 0.62rem; font-weight: 800;
}
#panel .g2r-b { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.72rem; }
#panel .g2r-b .t { opacity: 0.8; }
#panel .g2rl { display: flex; align-items: center; gap: 3px; width: 100%; font-size: 0.66rem; }
#panel .g2rl span { opacity: 0.7; }
#panel .g2rl input {
  width: 44px; min-width: 0; padding: 4px 4px; margin: 0; text-align: right; font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 5px; color: #fff;
}
#panel .g2rl input.w { width: 52px; }
#panel .g2rl input::placeholder { color: rgba(255, 255, 255, 0.45); }
#panel .g2rl input.bad { border-color: #ffb4b4; }
#panel .g2rl .g2rx { margin-left: auto; border: 0; background: transparent; color: rgba(255, 255, 255, 0.5); cursor: pointer; font-size: 0.95rem; padding: 0 2px; }
#panel .g2rl .g2rx:hover { color: #ffb4b4; }
#panel .g2r-ft { margin-top: 6px; font-size: 0.64rem; opacity: 0.55; line-height: 1.4; }
#panel .stg-g2rail button[data-g2r]:not(.g2rx) {
  border: 0; background: transparent; padding: 0; margin: 0; cursor: pointer;
  font: 600 0.68rem/1.4 "Roboto", system-ui, sans-serif; color: var(--cyan); text-decoration: underline; text-underline-offset: 2px;
  text-transform: none; letter-spacing: 0; width: auto;
}
#panel .stg-g2rail button[data-g2r]:not(.g2rx):hover { color: #fff; }

/* A month range ("6–8") stays on one line. */
.stg-nw { white-space: nowrap; }
/* By stage the load table has an extra "On site" column, so the deck's
   right-aligned headings (2nd–4th) stop one short: Average demand sat left
   of its figures. */
.slide .loadtable.stg-mo th:nth-child(5) { text-align: right; }
.slide .loadtable .stg-ftsub { font-size: 0.82em; font-weight: 500; color: var(--muted); }
