/* Screen-specific rules. Tokens only (var(--...)); no raw colours, gradients, shadows outside tokens, animation or uppercase. */

/* Radio and checkbox groups built as fieldsets with a legend. */
.onb-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.onb-fieldset-row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--sp-4);
}

/* Section status for optional sections such as Extras. */
.status-word-muted {
  color: var(--ink-3);
  font-size: var(--t-meta-size);
  font-weight: 500;
}

/* One design card plus, when its preview failed, the Retry button below it. */
.design-cell {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}

.design-cell > .btn {
  align-self: flex-start;
}

/* Seven designs when Compact is hidden for a short resume: still four across on wide screens. */
@media (min-width: 900px) {
  .designs-grid.designs-grid-three {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Phones: the typing field inside a choice box (roles, countries, companies, title words) is a full tap target. */
@media (max-width: 599px) {
  .choice-box .choice-input-bare {
    min-height: 44px;
  }
}

/* ---------- Onboarding: one centred column, sticky header with named progress ---------- */

.onb-header {
  position: sticky;
  top: 0;
  z-index: 30;
}

.onb-header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-6) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.onb-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  min-width: 0;
}

.onb-back,
.onb-footer-back,
.onb-change {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
}

.onb-back-gap {
  display: none;
}

.onb-header-step {
  flex: 1 1 auto;
  min-width: 0;
}

.onb-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.onb-parts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
}

.onb-part.is-done { color: var(--ink-2); }
.onb-part.is-current { color: var(--ink); font-weight: 600; }
.onb-part.is-todo { color: var(--ink-3); }

.onb-track {
  display: flex;
  gap: var(--sp-1);
  height: 4px;
}

.onb-seg {
  flex: 1 1 0;
  background: var(--rule);
  border-radius: var(--r-ctl);
}

.onb-seg.is-done,
.onb-seg.is-current {
  background: var(--navy);
}

.onb-main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6) var(--sp-16);
  min-width: 0;
}

.onb-main p {
  max-width: none;
}

/* Long button labels wrap instead of pushing the page sideways on a phone. */
.onb-main .btn,
.onb-header .btn {
  white-space: normal;
}

.onb-more,
.onb-question,
.onb-wrap-btn {
  text-align: left;
  justify-content: flex-start;
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.onb-section-title {
  margin-bottom: 0;
}

.onb-eyebrow {
  margin-bottom: var(--sp-1);
}

.onb-role-title {
  overflow-wrap: anywhere;
}

/* Read-back rows: label, value, Edit. An open row turns into a labelled input in place. */
.onb-facts {
  border-top: 1px solid var(--rule);
}

.onb-issues {
  border: 1px solid var(--caution);
  border-radius: var(--r-box);
  background: var(--caution-wash);
  padding: 0 var(--sp-4);
}

.onb-issues .onb-fact:last-child {
  border-bottom: 0;
}

.onb-fact {
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}

.onb-fact.onb-fact-wide,
.onb-fact.onb-role-line {
  grid-template-columns: minmax(0, 1fr) auto;
}

.onb-fact.is-open {
  display: block;
}

.onb-fact-label {
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  color: var(--ink-2);
}

.onb-fact-value {
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
}

.onb-fact-value.is-empty,
.onb-fact-value .is-empty {
  color: var(--ink-3);
}

.onb-fact-field {
  margin-bottom: 0;
}

.onb-fact-note {
  color: var(--caution);
  font-weight: 500;
  margin: 0 0 var(--sp-1);
}

.onb-flag {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) 0;
}

.onb-flag-text {
  color: var(--caution);
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  margin: 0;
}

.onb-flag-text:empty {
  display: none;
}

.onb-role-form .field {
  margin-bottom: 0;
}

.onb-dates {
  gap: var(--sp-4);
}

/* What we'll say: the lines as plain text, or a draft with checks. */
.onb-lines {
  margin: 0;
  padding-left: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.onb-lines-draft {
  border-left: 2px solid var(--navy);
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-8);
  background: var(--navy-wash);
  border-radius: var(--r-ctl);
}

.onb-line-copy {
  margin: 0;
  overflow-wrap: anywhere;
}

.onb-draft-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--sp-2);
  border: 1px solid var(--navy);
  border-radius: var(--r-ctl);
  color: var(--navy);
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  font-weight: 500;
}

.onb-check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-2);
}

.onb-check-text {
  color: var(--caution);
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* The box at the centre of each job screen. */
.onb-write {
  border: 1px solid var(--rule);
  border-radius: var(--r-box);
  background: var(--wash);
  padding: var(--sp-6);
}

.onb-write-label {
  font-size: var(--t-title-size);
  line-height: var(--t-title-line);
  font-weight: 600;
}

.onb-notes {
  min-height: 180px;
}

.onb-q-intro {
  margin: 0;
}

.onb-question {
  align-self: flex-start;
  max-width: 100%;
}

.onb-writing {
  color: var(--ink-2);
  font-size: var(--t-meta-size);
}

.onb-save-state {
  white-space: nowrap;
}

/* Save for later (JA-075): a short note beside the button, and a full-width notice under the header row.
   The note is empty most of the time and then takes no room. While it shows, step 2's own autosave word is hidden so
   the two never say "Saved" side by side. The notice row is empty (and hidden) until a save fails or only partly worked. */
.onb-save-later-note {
  white-space: nowrap;
  font-size: var(--t-meta-size);
}

.onb-save-later-note:empty {
  display: none;
}

.onb-save-later-note:not(:empty) + .onb-save-state {
  display: none;
}

.onb-save-later-msg:empty {
  display: none;
}

/* While the notice says "Not saved", step 2's own "Saved" (its autosave of the typing) would read as a contradiction. */
.onb-header:has(.onb-save-later-msg:not(:empty)) .onb-save-state {
  display: none;
}

/* Compact: this notice sits in the sticky header, so it must not take a third of a phone screen. */
.onb-save-later-msg .notice {
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  gap: var(--sp-1) var(--sp-3);
  flex-wrap: nowrap;
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
}

.onb-save-later-msg .notice > span {
  flex: 1 1 auto;
  min-width: 0;
}

.onb-save-later-msg .notice .btn {
  flex: 0 0 auto;
}

.onb-line {
  margin-bottom: 0;
}

.onb-line-text {
  min-height: 72px;
}

/* Review: parts with their state. */
.onb-part-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.onb-part-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--rule);
}

.onb-part-row-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.onb-part-name {
  font-weight: 500;
}

/* Main button with the sentence that explains what is missing right beside it. */
.onb-footer {
  display: flex;
  flex-wrap: wrap-reverse;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}

.onb-footer-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  order: 2;
  min-width: 0;
}

.onb-footer-back {
  order: 1;
}

.onb-main .field-error:empty,
.field .field-error:empty {
  display: none;
}

.choice-box.has-error {
  border-color: var(--bad);
}

/* Step 1: the reading state. */
.onb-reading {
  border: 1px solid var(--rule);
  border-radius: var(--r-box);
  background: var(--wash);
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--ink-2);
}

/* Step 4 inside the 720 px column: two designs a row on phones, three across from 600 px up. */
.onb-main .designs-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 600px) {
  .onb-main .designs-grid,
  .onb-main .designs-grid.designs-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .onb-header-inner {
    padding: var(--sp-2) var(--sp-4);
  }

  .onb-parts .onb-part:not(.is-current) {
    display: none;
  }

  .onb-main {
    padding: var(--sp-6) var(--sp-4) var(--sp-16);
  }

  .onb-fact {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .onb-fact-label {
    grid-column: 1 / -1;
  }

  .onb-write {
    padding: var(--sp-4);
  }

  .onb-footer-main,
  .onb-footer-main .btn-primary {
    width: 100%;
  }
}

.onb-write > :last-child {
  margin-bottom: 0;
}

.onb-footer-main > span:empty {
  display: none;
}

.onb-main .btn-quiet {
  text-align: left;
}

/* Below 900px the floating Report button (report.css: 44px tall, bottom sp-12 + sp-4) sits over the page end:
   leave room under the last control so it is never covered. */
@media (max-width: 899px) {
  .onb-main {
    padding-bottom: calc(var(--sp-12) + var(--sp-4) + 44px + var(--sp-6));
  }
}

/* JA-039 preferences (step 3 and Settings): pick-list rows and grids built on .check-label. */
.pref-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}

.pref-row {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  padding: var(--sp-2) 0;
}

.pref-list .pref-row {
  border-bottom: 1px solid var(--rule);
}

.pref-row input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: 2px;
}

.pref-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pref-row-note {
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  color: var(--ink-3);
}

.pref-choices {
  display: flex;
  flex-direction: column;
}

.pref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
  gap: 0 var(--sp-3);
}

.pref-sub {
  padding-left: var(--sp-4);
  border-left: 2px solid var(--rule);
}

/* ---------- Finish your set-up (JA-075) ----------
   A v7 panel (the Today panel) that holds the set-up's own progress bars (.onb-track / .onb-seg): layout only, no new
   component. Copy on the left and the two buttons on the right on a wide screen; stacked on a phone, so the card is
   about a hand high and the real dashboard starts right below it. */
.setup-resume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-6);
  padding: var(--sp-4) var(--sp-6);
}

.setup-resume-copy {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1 1 280px;
  min-width: 0;
}

.setup-resume-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 24px;
  letter-spacing: -0.015em;
}

.setup-resume-track {
  max-width: 320px;
  margin-top: var(--sp-1);
}

.setup-resume-actions {
  align-items: center;
  flex: 0 1 auto;
}

/* The quiet line above Roles, Apply, Resume and an empty Tracker for a person whose set-up is paused. */
.setup-hint {
  margin: 0;
  padding: var(--sp-3) var(--sp-6) 0;
}

/* Inside a screen's own empty state the line already sits in the screen's padding. */
.empty-state .setup-hint,
.v7-tracker-page .setup-hint {
  padding: var(--sp-2) 0 0;
}

@media (max-width: 599px) {
  .setup-resume {
    padding: var(--sp-3) var(--sp-4);
  }

  .setup-hint {
    padding: var(--sp-3) var(--sp-4) 0;
  }

  .setup-resume-actions {
    width: 100%;
  }

  .setup-resume-actions .btn-primary {
    flex: 1 1 auto;
  }
}
