// ─── Tokens ───────────────────────────────────────────────────────────────────
$bg-base:      #f8fafc;
$bg-panel:     #ffffff;
$bg-card:      #f1f5f9;
$bg-card-alt:  #e2e8f0;
$border:       #e2e8f0;
$text-primary: #1e293b;
$text-muted:   #64748b;
$text-sub:     #475569;
$accent-teal:  #0d9488;
$accent-blue:  #2563eb;
$accent-orange:#d97706;
$accent-green: #16a34a;
$accent-red:   #dc2626;

// ─── Host / form fill ──────────────────────────────────────────────────────────
// The app shell (gbtabcontainer's ".tab-container"/".tab-content") never sets an
// explicit height on itself, so a %-based height on :host has nothing definite to
// resolve against and silently falls back to auto — every panel below then grows
// to fit its content and gets invisibly clipped by the shell's own overflow:hidden
// with no scrollbar in sight. Anchoring to the viewport (vh) sidesteps that broken
// chain entirely: 56px is the app header (--field-height-xl) and 36px is the tab
// strip (gbtabcontainer .tab-menu) — the only fixed chrome rendered above us.
:host {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 96px);
  overflow: hidden;
}

form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

// ─── Selector bar ─────────────────────────────────────────────────────────────
.wi-selector {
  padding: 6px 16px 8px;
  background: $bg-panel;
  border-bottom: 1px solid $border;
}

// ─── Title row (picklist + compact header cards beside it) ───────────────────
// Background matches the panels below so the picklist's taller label+input box
// doesn't leave a bare gray seam above the sidebar/content when it's taller than
// the cards sitting next to it.
.wi-title-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 6px 16px;
  
}

.wi-title-picklist {
  flex-shrink: 0;
  min-width: 220px;

  // Material always reserves a hint/error line below the input even when none is shown
  // (.mat-mdc-form-field-subscript-wrapper) - that invisible strip was making this
  // picklist's real bottom edge sit lower than its visible input box, so bottom-aligning
  // it against .wi-scan-inline (flex-end, below) left the input box itself floating
  // higher than the scan card next to it. Hiding it is the established fix for this in
  // this codebase - see maintenanceworkbench.component.scss's identical rule/comment for
  // why forcing an exact pixel height instead was tried and abandoned as too fragile.
  ::ng-deep .mat-mdc-form-field-subscript-wrapper {
    display: none !important;
  }
}

// Scan-workstation card sits inline beside the picklist rather than on its own
// row below — its own component already renders as a bordered card, so this
// wrapper just constrains its width and drops the card's own bottom margin
// (::ng-deep — the card's styles are scoped to its own component) so it sits
// flush with the picklist/header-cards baseline.
.wi-scan-inline {
  flex: 0 1 320px;
  min-width: 240px;

  ::ng-deep .ws-card {
    margin-bottom: 0;
  }
}

// Wraps the real global .input_label class (styles.scss) instead of re-declaring its
// font tokens locally, so this reproduces gb-newpicklist's own label-row wrapper
// (newpicklist.component.html ~line 135: "display:flex; padding-bottom: calc(var(--space-xs) * 1px)")
// exactly rather than approximately.
.wi-scan-inline__label-spacer {
  display: flex;
  padding-bottom: calc(var(--space-xs) * 1px);
  visibility: hidden;
}

// One unified card holding process/sub-process/code/version/steps — segments are
// separated by an internal divider rather than each being its own floating box.
.wi-header-cards {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: 0 1 auto;
 background: $bg-panel;
  border: 1px solid $border;
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 14px;
}

.header-seg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 16px;
  border-right: 1px solid $border;

  &:first-child { padding-left: 0; }
  &:last-child { border-right: none; padding-right: 0; }

  &.header-seg--inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
}

.field-label {
  font-size: 9px;
  color: $text-muted;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
}

.field-value {
  font-size: 14px;
  font-weight: 600;
  color: $text-primary;

  &.fw-bold { font-weight: 800; font-size: 15px; }
  &.serial-val { color: $accent-orange; font-weight: 700; }
}

.wi-code-badge {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
}

.version-badge {
  background: $bg-card;
  color: $text-muted;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  border: 1px solid $border;
}

.count-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.count-done {
  background: #d1fae5;
  color: $accent-green;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.count-sep {
  color: $text-muted;
  font-size: 18px;
  font-weight: 300;
}

.count-target {
  background: $bg-card-alt;
  color: $text-primary;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.count-label {
  font-size: 9px;
  color: $text-muted;
  text-transform: uppercase;
  letter-spacing: .6px;
}

// ─── Body ─────────────────────────────────────────────────────────────────────
.wi-body {
  display: grid;
  grid-template-columns: 80px 1fr 280px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

// ─── Step Nav (left) ──────────────────────────────────────────────────────────
.wi-steps-nav {
  // background: $bg-panel;
  border-right: 1px solid $border;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.breadcrumb-nav {
  font-size: 9px;
  color: $text-muted;
  line-height: 1.6;
  word-break: break-word;
}

.crumb { color: $text-sub; }
.crumb-active { color: $text-primary; font-weight: 600; }
.crumb-sep { color: $text-muted; }

.step-counter-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-counter {
  font-size: 10px;
  color: $accent-blue;
  font-weight: 600;
}

.step-timer {
  font-size: 9px;
  color: $accent-orange;
}

.steps-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

// Marks where a new section's steps begin. Truncates to fit the 80px-wide nav —
// the native [title] tooltip on the host element shows the full name on hover.
.step-group-label {
  max-width: 62px;
  padding: 3px 6px;
  border-radius: 4px;
  background: $bg-card-alt;
  color: $text-sub;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  margin-top: 6px;

  &:first-child { margin-top: 0; }
}

.step-nav-item {
  position: relative;
  display: flex;
  justify-content: center;
  cursor: pointer;
  padding: 2px 0;

  &:hover .step-circle { filter: brightness(.95); }

  // Connecting track between circles of the same section — omitted on the last
  // step of a group (.step-track-end) so sections read as distinct segments.
  &:not(.step-track-end)::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    width: 2px;
    height: 8px;
    background: $border;
    transform: translateX(-50%);
  }

  &.completed:not(.step-track-end)::after {
    background: $accent-green;
  }
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: $bg-card-alt;
  color: $text-sub;
  border: 2px solid $border;
  transition: background .2s, border-color .2s;

  .step-nav-item.completed & {
    background: #dcfce7;
    color: $accent-green;
    border-color: #16a34a;
  }

  .step-nav-item.current & {
    background: #dbeafe;
    color: $accent-blue;
    border-color: $accent-blue;
  }

  .step-nav-item.pending & {
    background: #fee2e2;
    color: $accent-red;
    border-color: #fca5a5;
  }
}

// ─── Center Content ───────────────────────────────────────────────────────────
.wi-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow-y: auto;
  background: $bg-base;
}

// Diagram panel
.diagram-panel {
  background: $bg-panel;
  border: 1px solid $border;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.diagram-label {
  padding: 10px 14px;
  font-size: 10px;
  color: $text-muted;
  font-weight: 700;
  letter-spacing: .6px;
  background: $bg-card;
  border-bottom: 1px solid $border;
}

.diagram-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 180px;
}

.diagram-img {
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.no-diagram-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: $text-muted;
  font-size: 12px;

  .placeholder-icon { font-size: 36px; opacity: .3; }
}

.warning-banner {
  background: #fff7ed;
  border-top: 2px solid $accent-orange;
  color: $accent-orange;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
}

.warning-icon { margin-right: 4px; }

.diagram-zoom-hint {
  padding: 6px 14px;
  font-size: 9px;
  color: $text-muted;
  text-align: right;
  background: $bg-card;
  border-top: 1px solid $border;
}

// Step detail panel
.step-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.step-section-label {
  font-size: 11px;
  color: $accent-teal;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-tag {
  background: #ccfbf1;
  color: $accent-teal;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  letter-spacing: .5px;
}

.step-number-label {
  font-size: 10px;
  color: $text-muted;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.step-title {
  font-size: 22px;
  font-weight: 800;
  color: $text-primary;
  line-height: 1.2;
  margin: 0;
}

.step-description {
  font-size: 13px;
  color: $text-sub;
  line-height: 1.75;
  margin: 0;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: $bg-panel;
  border: 1px solid $border;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13px;
  color: $text-primary;
  transition: background .15s, border-color .15s;

  &:hover { background: $bg-card; }

  &.item-checked {
    background: #f0fdf4;
    border-color: #16a34a;
  }
}

.checklist-item-mandatory {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: $accent-orange;
  text-transform: uppercase;
}

.check-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  color: #fff;
  transition: background .15s, border-color .15s;

  &.check-done {
    background: $accent-green;
    border-color: $accent-green;
  }
}

.text-strike {
  text-decoration: line-through;
  color: $text-muted;
}

// ─── Right Stats ──────────────────────────────────────────────────────────────
.wi-stats {
  // background: $bg-panel;
  border-left: 1px solid $border;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-section-title {
  font-size: 9px;
  color: $text-muted;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.stats-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  background: $bg-card;
  border: 1px solid $border;
  border-radius: 6px;
  padding: 10px 12px;
}

// Elapsed timer, checklist progress and the all-steps list read as plain text
// sections rather than boxed cards — no fill, just a divider from the section above.
.elapsed-card,
.progress-card,
.all-steps-card {
  background: transparent;
  border: none;
  border-top: 1px solid $border;
  border-radius: 0;
  padding: 10px 0 0;
}

.stat-lbl {
  font-size: 8px;
  color: $text-muted;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-val {
  font-size: 18px;
  font-weight: 700;
  color: $text-primary;

  &.orange { color: $accent-orange; }
  &.green  { color: $accent-green; }
}

.elapsed-card { text-align: center; }

.elapsed-display {
  font-size: 38px;
  font-weight: 800;
  color: $accent-teal;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 2px;
  line-height: 1.1;
  margin: 6px 0 2px;
}

.std-time-label {
  font-size: 9px;
  color: $text-muted;
  text-align: right;
}

.progress-bar-track {
  background: $bg-card-alt;
  border-radius: 4px;
  height: 8px;
  margin: 8px 0 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, $accent-teal, $accent-blue);
  border-radius: 4px;
  transition: width .4s ease;
}

.progress-label {
  font-size: 9px;
  color: $text-muted;
}

.skill-badge {
  margin-top: 6px;
  background: #f0fdf4;
  border: 1px solid #16a34a;
  color: $accent-green;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;

  &:not(.skill-verified) {
    background: #fef2f2;
    border-color: #fca5a5;
    color: $accent-red;
  }
}

.eligible-yes { color: $accent-green; font-weight: 700; }
.eligible-no  { color: $accent-red;   font-weight: 700; }

.eligibility-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;

  .eligibility-name { font-weight: 600; }

  &.status-met {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: $accent-green;
  }

  &.status-notmet-block {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: $accent-red;
  }

  &.status-notmet-warn {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: $accent-orange;
  }

  &.status-unverifiable {
    background: #f1f5f9;
    border: 1px solid $border;
    color: $text-muted;
  }
}

.all-steps-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.all-steps-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 60px;
  overflow-y: auto;
  margin-top: 6px;
}

.all-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: $text-sub;
  cursor: pointer;
  transition: background .1s;

  &:hover { background: $bg-card; }

  &.all-step-done { color: $accent-green; }
  &.all-step-active { color: $accent-blue; font-weight: 700; border-left: 3px solid $accent-blue; padding-left: 3px; }
}

.all-step-icon { flex-shrink: 0; width: 14px; text-align: center; }
.all-step-name { line-height: 1.3; }

// ─── Footer ───────────────────────────────────────────────────────────────────
.wi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: $bg-panel;
  border-top: 1px solid $border;
  padding: 12px 24px;
  box-shadow: 0 -1px 3px rgba(0,0,0,.05);
}

.btn-back {
  background: $bg-card;
  color: $text-sub;
  border: 1px solid $border;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;

  &:hover:not(:disabled) { background: $bg-card-alt; }
  &:disabled { opacity: .4; cursor: not-allowed; }
}

.footer-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: $text-muted;
  flex: 1;
  justify-content: center;

  kbd {
    background: $bg-card;
    border: 1px solid $border;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: $text-primary;
    font-family: inherit;
  }
}

.scan-status {
  background: $bg-card;
  border: 1px solid $border;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  color: $text-muted;
}

.btn-next {
  background:var(--button-primary-bg-default);
  color: #fff;
  border: none;
  padding: 12px 34px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .3px;
  transition: background .15s;
  &:disabled { opacity: .4; cursor: not-allowed; }
}

.btn-flag {
  background: transparent;
  color: $accent-red;
  border: 1px solid #fca5a5;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;

  &:hover { background: #fef2f2; }
}

.tools-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: $bg-card;
  border: 1px solid $border;
  border-radius: 6px;
  font-size: 12px;

  .tools-label { color: $accent-orange; font-weight: 700; flex-shrink: 0; }
  .tools-value  { color: $text-sub; }
}

.skill-remarks {
  margin-top: 6px;
  font-size: 10px;
  color: $text-muted;
  font-style: italic;
}

// ─── Step meta header (title + warning + tools above containers) ──────────────
.step-meta-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

// ─── Container: Single Column ─────────────────────────────────────────────────
.wi-container--single {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: $bg-panel;
  border: 1px solid $border;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

// ─── Container: Two Column ────────────────────────────────────────────────────
.wi-container--two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wi-zone--left,
.wi-zone--right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: $bg-panel;
  border: 1px solid $border;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

// ─── Container: Banner ────────────────────────────────────────────────────────
.wi-container--banner {
  border-radius: 8px;
  overflow: hidden;
  background: $bg-panel;
  border: 1px solid $border;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

// ─── Container: Accordion ─────────────────────────────────────────────────────
.wi-container--accordion {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.accordion-panel {
  background: $bg-panel;
  border: 1px solid $border;
  border-radius: 6px;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: $bg-card;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: $text-primary;
  border-bottom: 1px solid $border;
  user-select: none;
  transition: background .15s;

  &:hover { background: $bg-card-alt; }
}

.accordion-chevron {
  font-size: 11px;
  color: $text-muted;
}

.accordion-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

// ─── Container: Tab ───────────────────────────────────────────────────────────
.wi-container--tab {
  background: $bg-panel;
  border: 1px solid $border;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.tab-bar {
  display: flex;
  background: $bg-card;
  border-bottom: 2px solid $border;
  overflow-x: auto;
}

.tab-btn {
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: $text-muted;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;

  &:hover { color: $text-primary; }

  &.tab-btn--active {
    color: $accent-blue;
    border-bottom-color: $accent-blue;
    font-weight: 700;
  }
}

.tab-content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

// ─── Block types ──────────────────────────────────────────────────────────────
.block-richtext {
  font-size: 13.5px;
  color: $text-sub;
  line-height: 1.75;

  p  { margin-bottom: 8px; }
  ol, ul { padding-left: 20px; margin-bottom: 8px; }
  li { margin-bottom: 4px; }
  strong { color: $text-primary; }
}

.block-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;

  .block-img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid $border;
  }
}

.block-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.block-warning {
  background: #fff7ed;
  border-left: 3px solid $accent-orange;
  color: $accent-orange;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 0 6px 6px 0;
}

.block-video {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;

  .block-vid {
    max-width: 100%;
    max-height: 320px;
    border-radius: 6px;
    border: 1px solid $border;
    background: #000;
  }

  .block-vid-embed {
    width: 100%;
    max-width: 560px;
    height: 320px;
    border: 0;
  }
}

.block-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  .block-pdf-frame {
    width: 100%;
    max-width: 100%;
    height: 420px;
    border: 1px solid $border;
    border-radius: 6px;
    background: #fff;
  }

  .block-pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: $accent-blue;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;

    &:hover { background: #dbeafe; }
  }
}

.block-media-caption {
  font-size: 11px;
  color: $text-muted;
  text-align: center;
  font-style: italic;
}

.block-media-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: #f8fafc;
  border: 1px dashed $border;
  border-radius: 6px;
  color: $text-muted;
  font-size: 13px;
  text-align: center;
}

// ─── Responsive ───────────────────────────────────────────────────────────────

// Tablet: shrink the fixed side columns instead of removing them.
@media (max-width: 1024px) {
  .wi-body {
    grid-template-columns: 64px 1fr 220px;
  }

  .wi-container--two-col {
    grid-template-columns: 1fr;
  }

  .wi-title-picklist {
    min-width: 180px;
  }
}

// Mobile: stack nav / content / stats instead of a 3-column grid, and let the
// page scroll as a whole rather than clipping each column to the viewport.
@media (max-width: 768px) {
  :host {
    height: auto;
    min-height: calc(100vh - 96px);
    overflow: visible;
  }

  form {
    overflow: visible;
  }

  .wi-title-row {
    padding: 6px 10px;
  }

  .wi-header-cards {
    width: 100%;
    padding: 8px 10px;
  }

  .wi-scan-inline {
    flex: 1 1 100%;
    min-width: 0;
  }

  .header-seg {
    padding: 0 10px;
  }

  .wi-body {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  // Step nav becomes a horizontal scroll strip along the top.
  .wi-steps-nav {
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid $border;
    padding: 10px;
    overflow-x: auto;
    overflow-y: visible;
  }

  .step-counter-row {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }

  .steps-list {
    flex-direction: row;
    flex: 0 0 auto;
  }

  .step-group-label {
    max-width: none;
    margin-top: 0;
    writing-mode: horizontal-tb;
  }

  .step-nav-item {
    &:not(.step-track-end)::after {
      top: 50%;
      left: 100%;
      width: 8px;
      height: 2px;
      transform: translateY(-50%);
    }
  }

  .wi-content {
    padding: 10px;
  }

  .wi-container--two-col {
    grid-template-columns: 1fr;
  }

  .wi-stats {
    border-left: none;
    border-top: 1px solid $border;
    padding: 10px;
  }

  .wi-footer {
    padding: 10px;
    flex-wrap: wrap;
  }

  .btn-back,
  .btn-next {
    flex: 1;
    text-align: center;
  }
}

// Small phones: tighten typography and card padding further.
@media (max-width: 480px) {
  .step-title {
    font-size: 18px;
  }

  .stats-grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .elapsed-display {
    font-size: 28px;
  }

  .wi-header-cards {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-seg {
    border-right: none;
    padding: 4px 0;
    width: 100%;
  }
}

// ── Workstation Config adaptation (WI.MWORKSTATIONCONFIG.DisplayMode/FontScale) ──────────────
// Applied on the root <form> via [ngClass] in the template — was configurable admin-side but
// never actually consumed by this screen before.

.font-large {
  font-size: 1.15em;
}

.font-xlarge {
  font-size: 1.35em;
}

// Kiosk: a fixed, unattended shop-floor display — maximize the current step, de-emphasize chrome.
.disp-kiosk {
  .wi-title-picklist {
    max-width: 260px;
  }
}

// Twin-monitor: this screen is one half of a two-monitor setup (the other typically shows a
// camera feed or a secondary reference view) — keep the layout as-is, full width, no split
// needed within this component itself.
.disp-twinmonitor {
  max-width: 100%;
}

// Tablet: touch-friendly compact spacing.
.disp-tablet {
  .btn-back,
  .btn-next {
    min-height: 48px;
  }
}
