/* PWA — bare functional styles. Designer phase will replace this.
 *
 * All rules are scoped under .pwa-shell (set on the body of the PWA layout)
 * because Propshaft serves every file under app/assets/stylesheets/ on every
 * page, so unscoped rules would bleed into the rest of the app.
 */

.pwa-shell, .pwa-shell * { box-sizing: border-box; }

.pwa-shell {
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #EDF1F4;
  background: #171C21;
  min-height: 100vh;
}

#pwa-root {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#pwa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: #10151A;
  border-bottom: 1px solid #2B343D;
  position: sticky;
  top: 0;
  z-index: 5;
}

/* The PWA layout stamps env-<Rails.env> on the body (issue #221); dev gets a
   caution-striped header top so a build on snapshotted data can't pass for
   production. */
.pwa-shell.env-development #pwa-header {
  border-top: .375rem solid transparent;
  border-image: repeating-linear-gradient(-45deg, #F5C518 0 .75rem, #14181C .75rem 1.5rem) 6;
}

.pwa-status { display: flex; gap: 0.4rem; flex-shrink: 0; }

.pwa-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #2F9153;
  color: #fff;
}
.pwa-pill[data-state="offline"] { background: #CE4435; }
.pwa-pill--quiet { background: #39434D; }
.pwa-pill--warn  { background: #E9B10C; cursor: pointer; }
.pwa-pill[hidden] { display: none; }

.pwa-user {
  font-size: 0.85rem;
  color: #93A0AA;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pwa-shell main { flex: 1; padding: clamp(0.6rem, 3vw, 1rem); }

.pwa-screen { display: block; }
.pwa-screen[hidden] { display: none; }

.pwa-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.pwa-screen-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pwa-msg { color: #C9D2D9; }

.pwa-btn {
  appearance: none;
  border: 0;
  background: #2B343D;
  color: #EDF1F4;
  padding: 0.75rem 1.1rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-btn:active { transform: translateY(1px); }
.pwa-btn--primary { background: #2E6DBE; }
.pwa-btn--ghost { background: transparent; color: #93A0AA; padding: 0.7rem 0.9rem; }
.pwa-btn--remove {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  background: transparent;
  border: 1px solid #5E1D16;
  color: #E4837A;
}
.pwa-btn--edit {
  background: transparent;
  border: 1px solid #39434D;
  color: #C9D2D9;
}

#pwa-scanner-container {
  position: relative;
  background: #000;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  margin-bottom: 1rem;
}
#pwa-scanner { width: 100%; height: 100%; }
#pwa-scanner video { width: 100% !important; height: 100% !important; object-fit: cover; }

#pwa-scanner-resume {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(16, 21, 26, 0.92);
  color: #EDF1F4;
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#pwa-scanner-resume[hidden] { display: none; }
.pwa-scanner-resume-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  background: #2E6DBE;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  padding-left: 0.25rem;
}
.pwa-scanner-resume-text {
  font-size: 1.05rem;
  font-weight: 600;
}

.pwa-or {
  text-align: center;
  color: #66727C;
  margin: 0.6rem 0;
  font-size: 0.85rem;
}

.pwa-manual {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pwa-manual label {
  font-size: 0.85rem;
  color: #93A0AA;
}
.pwa-manual input {
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #2B343D;
  background: #10151A;
  color: #EDF1F4;
  font-size: 1.1rem;
}

.pwa-hint {
  margin-top: 0.5rem;
  color: #EFA79E;
  font-size: 0.9rem;
}

/* Amber-stripe callout shared between the heat-prompt screen and the
 * picker's "currently at" banner. Per-class rules below add layout. */
.pwa-heat-prompt,
.pwa-current-banner {
  background: #10151A;
  border: 1px solid #2B343D;
  border-left: 4px solid #E9B10C;
  border-radius: 0.5rem;
  padding: 0.7rem 0.9rem;
}

.pwa-heat-prompt {
  color: #EDF1F4;
  font-size: 0.95rem;
  line-height: 1.35;
  margin: 0 0 1rem;
}

.pwa-meta {
  color: #93A0AA;
  font-size: 0.9rem;
  margin: 0.25rem 0 0.75rem;
}

.pwa-current-banner {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 1rem;
}
.pwa-current-banner[data-state="empty"] { border-left-color: #66727C; }
.pwa-current-banner[data-state="done"] {
  background: #0E3B22;
  border-color: #14502E;
  border-left-color: #4CBB77;
}
.pwa-current-banner[data-state="done"] .pwa-current-label,
.pwa-current-banner[data-state="done"] .pwa-current-time { color: #B9E4C8; }
.pwa-current-banner[data-state="done"] .pwa-current-value { color: #ffffff; }
.pwa-current-label {
  font-size: 0.8rem;
  color: #93A0AA;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pwa-current-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: #EDF1F4;
  line-height: 1.2;
}
.pwa-current-time {
  font-size: 0.8rem;
  color: #93A0AA;
}

.pwa-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pwa-pick-section {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #93A0AA;
  margin: 0.4rem 0 0.4rem;
}

.pwa-pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pwa-pick-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.5rem;
  background: #2B343D;
  border: 0;
  color: #EDF1F4;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-pick-tile:active { background: #39434D; }
.pwa-pick-tile[data-current="true"] { outline: 2px solid #7FB2E5; }
.pwa-pick-tile--done[data-current="true"] {
  outline: 2px solid #4CBB77;
  background: #0E3B22;
}
.pwa-pick-tile--done[data-current="true"]:active { background: #14502E; }
.pwa-pick-tile-label {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.pwa-pick-tile-meta {
  font-size: 0.85rem;
  color: #93A0AA;
  margin-top: 0.4rem;
}
.pwa-pick-tile--category .pwa-pick-tile-meta { color: #A5C8EC; }

.pwa-pick-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem;
  border-radius: 0.5rem;
  background: #2B343D;
  border: 0;
  color: #EDF1F4;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-pick-item:active { background: #39434D; }
.pwa-pick-item[data-current="true"] {
  outline: 2px solid #7FB2E5;
}
.pwa-pick-label { font-size: 1.2rem; font-weight: 600; overflow-wrap: anywhere; }
.pwa-pick-sub { font-size: 0.85rem; color: #93A0AA; }

.pwa-confirm-card {
  background: #0E3B22;
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}
.pwa-confirm-line { margin: 0.25rem 0; font-size: 1.1rem; }
.pwa-confirm-time { font-size: 0.85rem; color: #B9E4C8; }

.pwa-footer {
  text-align: center;
  padding: 0.5rem 0.75rem 0.75rem;
  font-size: 0.8rem;
  color: #66727C;
  border-top: 1px solid #171C21;
}

.pwa-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.pwa-modal[hidden] { display: none; }
.pwa-modal-card {
  background: #171C21;
  border: 1px solid #2B343D;
  border-radius: 0.75rem;
  padding: 1.25rem;
  max-width: 360px;
  width: 100%;
}
.pwa-modal-title {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #EDF1F4;
}
.pwa-modal-body {
  margin: 0 0 1rem;
  color: #C9D2D9;
  line-height: 1.4;
}
.pwa-modal-body strong { color: #EDF1F4; }
.pwa-modal-actions {
  display: flex;
  gap: 0.5rem;
}
.pwa-modal-actions .pwa-btn { flex: 1; }

.pwa-rejected-list {
  max-height: 60vh;
  overflow-y: auto;
  margin: 0 0 1rem;
}
.pwa-rejected-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid #2B343D;
  color: #C9D2D9;
}
.pwa-rejected-item:last-child { border-bottom: 0; }
.pwa-rejected-head   { color: #EDF1F4; margin-bottom: 0.2rem; }
.pwa-rejected-reason { font-size: 0.9rem; }
.pwa-rejected-time   { font-size: 0.75rem; color: #93A0AA; margin-top: 0.2rem; }

.pwa-profile-tiles {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.pwa-profile-tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1rem;
  border-radius: 0.6rem;
  background: #2B343D;
  border: 0;
  color: #EDF1F4;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-profile-tile[hidden] { display: none; }
.pwa-profile-tile:active { background: #39434D; }
.pwa-profile-tile-label {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
}
.pwa-profile-tile-sub {
  font-size: 0.85rem;
  color: #93A0AA;
}
.pwa-profile-section {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #93A0AA;
  margin: 0 0 0.5rem;
}
.pwa-profile-open-timers[hidden] { display: none; }
.pwa-open-timers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.pwa-open-timer-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  background: #1C242C;
  border: 1px solid #2B343D;
}
.pwa-open-timer-head {
  font-weight: 600;
  color: #EDF1F4;
}
.pwa-open-timer-sub {
  font-size: 0.85rem;
  color: #93A0AA;
}

.pwa-time-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pwa-time-step {
  padding: 0.75rem;
  border-radius: 0.6rem;
  background: #1C242C;
  border: 1px solid #2B343D;
}
.pwa-time-step-head {
  font-weight: 600;
  color: #EDF1F4;
  margin-bottom: 0.15rem;
}
.pwa-time-step-meta {
  font-size: 0.85rem;
  color: #93A0AA;
  margin-bottom: 0.6rem;
}
.pwa-time-phase {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
  padding: 0.4rem 0;
}
.pwa-time-phase + .pwa-time-phase {
  border-top: 1px solid #2B343D;
}
.pwa-time-phase-label {
  font-weight: 600;
  min-width: 3.5rem;
}
.pwa-time-phase .pwa-btn {
  padding: 0.55rem 1rem;
}
.pwa-btn--start { background: #2F9153; }
.pwa-btn--stop  { background: #A93327; }
.pwa-time-running {
  color: #F2D264;
  font-variant-numeric: tabular-nums;
}
.pwa-time-total {
  margin-left: auto;
  color: #93A0AA;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* --- Step editor (commit 13) ------------------------------------------ */

.pwa-step-editor-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pwa-step-editor-pane[hidden] { display: none; }
.pwa-step-editor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pwa-step-editor-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  background: #1C242C;
  border: 1px solid #2B343D;
}
.pwa-step-editor-row.sortable-ghost { opacity: 0.4; }
.pwa-step-editor-row.sortable-chosen { background: #22303C; }
.pwa-step-handle {
  flex: 0 0 auto;
  cursor: grab;
  font-size: 1.4rem;
  line-height: 1;
  color: #93A0AA;
  padding: 0.2rem 0.35rem;
  user-select: none;
  touch-action: none;
}
.pwa-step-handle:active { cursor: grabbing; }
.pwa-step-editor-row-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pwa-step-editor-row-head {
  font-weight: 600;
  color: #EDF1F4;
  word-break: break-word;
}
.pwa-step-editor-row-body {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.pwa-step-editor-row-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.85rem;
  color: #93A0AA;
}
.pwa-step-editor-row-vendor { color: #C9D2D9; }
.pwa-step-editor-row-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 5.5rem;
}
.pwa-step-editor-row-actions .pwa-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}
.pwa-step-editor-empty {
  list-style: none;
  padding: 0.75rem;
  color: #93A0AA;
  font-style: italic;
  text-align: center;
}
.pwa-step-editor-error {
  margin-top: 0.5rem;
  color: #EFA79E;
}

.pwa-step-form-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #EDF1F4;
}
.pwa-step-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.pwa-step-form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #93A0AA;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pwa-step-form-input {
  padding: 0.55rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid #2B343D;
  background: #10151A;
  color: #EDF1F4;
  font: inherit;
}
.pwa-step-form-input:focus {
  outline: 2px solid #7FB2E5;
  outline-offset: 1px;
}
.pwa-step-form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  color: #EDF1F4;
}
.pwa-step-form-check input { width: 1.1rem; height: 1.1rem; }
.pwa-step-form-error {
  color: #EFA79E;
  margin: 0;
}
.pwa-step-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
