/* Printed-form look: ink on paper, hairlines, one warning tint for TBC. */

:root {
  color-scheme: light;

  --paper: #ffffff;
  --ink: #141413;
  --ink-2: #55544f;
  --ink-3: #8c8b85;
  --line: #e4e3de;
  --line-input: #b8b7b0;
  --hover: #f4f4f1;
  --row-focus: #f8f8f5;
  --warn-bg: #f6e6b4;
  --warn-ink: #6b4a00;
  --danger: #b42318;
  --focus: #2b59c3;

  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Spacing scale: every margin and padding below comes from here. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  --gutter: 40px;
  --tint-x: var(--s2);
  --field-h: 28px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/20px var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter) var(--s8);
}

.mono {
  font-family: var(--mono);
}

.caps {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.muted {
  color: var(--ink-3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Document header */

.doc-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s5);
  padding: var(--s6) 0 var(--s4);
  border-bottom: 1px solid var(--ink);
}

.doc-title {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
}

.doc-meta {
  margin-top: var(--s1);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-2);
}

.doc-side {
  display: flex;
  align-items: center;
  gap: var(--s5);
  flex-shrink: 0;
}

.save-state[data-state='error'] {
  color: var(--danger);
}

/* Section heading and step indicator */

.step-head {
  margin-top: var(--s6);
}

.step-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
}

.bar {
  height: 2px;
  margin-top: var(--s2);
  background: var(--line);
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--ink);
  transition: width 200ms ease-out;
}

.step-title {
  margin-top: var(--s4);
  font-size: 24px;
  line-height: 32px;
  font-weight: 500;
}

.step-title .mono {
  margin-right: var(--s3);
  font-size: 20px;
  color: var(--ink-3);
}

.step-hint {
  max-width: 760px;
  text-wrap: pretty;
  margin-top: var(--s2);
  color: var(--ink-2);
}

.sheet {
  margin-top: var(--s5);
  isolation: isolate;
}

/* Rows shared by every table. Rules align with the page edge; the focus and
   hover tint sits on a layer that reaches a little past them so text never
   touches its edge. */

.t-head,
.t-row {
  display: grid;
  column-gap: var(--s5);
  padding: var(--s3) 0;
}

.t-head {
  align-items: end;
  padding-top: 0;
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--ink);
}

.t-row {
  position: relative;
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.t-row::before {
  content: '';
  position: absolute;
  inset: 0 calc(-1 * var(--tint-x));
  z-index: -1;
}

.t-row:focus-within::before {
  background: var(--row-focus);
}

.t-num {
  padding-top: var(--s1);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.t-label {
  padding-top: var(--s1);
}

.t-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 18px;
  color: var(--ink-2);
}

.req {
  margin-left: 2px;
  color: var(--danger);
}

.cols-status {
  grid-template-columns: 24px minmax(180px, 1.15fr) 216px minmax(150px, 1fr) 72px minmax(140px, 0.85fr);
}

.cols-profile {
  grid-template-columns: 24px 300px minmax(0, 1fr);
}

/* Underlined fields */

.u {
  display: block;
  width: 100%;
  min-height: var(--field-h);
  padding: var(--s1) 0 3px;
  border: 0;
  border-bottom: 1px solid var(--line-input);
  border-radius: 0;
  background: transparent;
  outline: none;
  line-height: 20px;
  transition: border-color 120ms, box-shadow 120ms;
}

.u::placeholder {
  color: var(--ink-3);
}

/* Column headers already name these fields on wide screens; the placeholders
   only show once rows stack on narrow screens. */
.cols-status .u::placeholder {
  color: transparent;
}

.u:hover {
  border-bottom-color: var(--ink-2);
}

.u:focus {
  border-bottom-color: var(--ink);
  box-shadow: 0 1px 0 0 var(--ink);
}

textarea.u {
  resize: none;
  overflow: hidden;
}

select.u {
  appearance: none;
  padding-right: var(--s5);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23141413' stroke-width='1.2'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") right 2px center / 10px 6px no-repeat;
  cursor: pointer;
}

select.u:invalid {
  color: var(--ink-3);
}

.u.is-error,
.u.is-error:focus {
  border-bottom-color: var(--danger);
  box-shadow: 0 1px 0 0 var(--danger);
}

.field-error {
  margin-top: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--danger);
}

.unit-fixed {
  display: block;
  padding-top: var(--s1);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

/* Segment control (Status) */

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: var(--field-h);
  border: 1px solid var(--ink);
}

.seg label {
  position: relative;
  display: flex;
  cursor: pointer;
}

.seg label + label {
  border-left: 1px solid var(--ink);
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
}

.seg label:hover span {
  background: var(--hover);
}

.seg input:checked + span {
  background: var(--ink);
  color: var(--paper);
}

.seg input:checked + span.is-tbc {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.seg input:focus-visible + span {
  box-shadow: inset 0 0 0 2px var(--focus);
}

/* Square checkboxes */

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  padding-top: var(--s1);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  cursor: pointer;
}

.check input {
  appearance: none;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper) center / 10px 8px no-repeat;
  cursor: pointer;
}

.check input:checked {
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' fill='none' stroke='white' stroke-width='1.6'%3E%3Cpath d='M1 4l2.6 2.6L9 1'/%3E%3C/svg%3E");
}

.check input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Contacts mini-table inside the profile step */

.contacts {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
  column-gap: var(--s4);
  row-gap: var(--s2);
  align-items: start;
}

.contacts .caps {
  padding-bottom: 0;
}

.contacts .role {
  padding-top: var(--s1);
}

/* The contacts table needs more room than the answer column: it runs under its label instead. */
.t-row.is-wide > .t-label {
  grid-column: 2 / -1;
}

.t-row.is-wide > :nth-child(3) {
  grid-column: 2 / -1;
  margin-top: var(--s3);
}

.contacts .role .mono {
  margin-right: var(--s2);
  font-size: 12px;
  color: var(--ink-3);
}

/* Product capability matrix */

.cols-matrix {
  grid-template-columns: 24px minmax(0, 1fr) repeat(6, 84px);
  column-gap: var(--s3);
}

.cols-matrix > .t-label {
  padding-right: var(--s3);
}

.mx-head {
  text-align: center;
  font-size: 10px;
  line-height: 14px;
}

.mx-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--field-h);
  cursor: pointer;
}

.mx-cell input {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 120ms;
}

.mx-cell:hover input {
  border-color: var(--ink);
}

.mx-cell input:checked {
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: inset 0 0 0 3px var(--paper);
}

.mx-cell input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.mx-structures {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: 96px repeat(4, minmax(0, 1fr));
  column-gap: var(--s4);
  align-items: start;
  margin-top: var(--s3);
}

.mx-structures .caps {
  padding-top: 6px;
  font-size: 10px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 var(--s5);
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: #2d2d2b;
}

.btn:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn[aria-busy='true'] {
  cursor: progress;
  opacity: 0.7;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}

.link:hover {
  text-decoration-thickness: 2px;
}

/* Step footer */

.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--ink);
}

.step-nav .actions {
  display: flex;
  align-items: center;
  gap: var(--s5);
}

.step-nav .note {
  color: var(--ink-2);
}

/* Review list */

.cols-review {
  grid-template-columns: 24px minmax(0, 1fr) 120px 64px 16px;
  align-items: center;
}

.review-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
}

.review-row:hover::before {
  background: var(--hover);
}

.review-row:focus-visible {
  outline: none;
}

.review-row:focus-visible::before {
  box-shadow: inset 0 0 0 2px var(--focus);
}

.review-row .t-num,
.review-row .t-label {
  padding-top: 0;
}

.num-r {
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
}

.t-head .num-r {
  font-size: inherit;
}

.is-partial {
  color: var(--ink-2);
}

.is-warn {
  color: var(--warn-ink);
}

.notice {
  margin-top: var(--s5);
  padding: var(--s3) var(--s4);
  border-left: 2px solid var(--danger);
  background: #fbf1f0;
}

.notice .link {
  margin-left: var(--s2);
}

/* Read-only answers (review after submit, admin view, print) */

.ro-section {
  margin-top: var(--s7);
}

.ro-section .sheet {
  margin-top: 0;
}

.ro-section h2 {
  margin-bottom: var(--s4);
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
}

.ro-section h2 .mono {
  margin-right: var(--s3);
  font-size: 15px;
  color: var(--ink-3);
}

.ro-section .t-row {
  padding-top: 10px;
  padding-bottom: 10px;
}

.ro-section .t-row:focus-within::before {
  background: none;
}

.ro-section .t-num,
.ro-section .t-label {
  padding-top: 0;
}

.ro-empty {
  color: var(--ink-3);
}

.ro-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ro-tag.is-tbc {
  padding: 1px 6px;
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.cols-ro-status {
  grid-template-columns: 24px minmax(180px, 1.2fr) 120px minmax(150px, 1fr) 72px minmax(140px, 0.9fr);
}

.cols-ro-matrix {
  grid-template-columns: 24px minmax(0, 1fr) 180px minmax(0, 1fr);
}

.done-block {
  margin-top: var(--s6);
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}

.done-block h2 {
  margin-top: var(--s2);
  font-size: 24px;
  line-height: 32px;
  font-weight: 500;
}

.done-block p {
  max-width: 640px;
  margin-top: var(--s2);
  color: var(--ink-2);
}

.empty-page {
  padding: var(--s8) 0;
}

.empty-page h1 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 500;
}

.empty-page p {
  margin-top: var(--s2);
  color: var(--ink-2);
}

/* Narrow screens: stack table rows instead of squeezing columns. */

@media (max-width: 900px) {
  :root {
    --gutter: 16px;
  }

  .doc-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s2);
    padding-top: var(--s5);
  }

  .t-head {
    display: none;
  }

  .t-row.cols-status,
  .t-row.cols-profile,
  .t-row.cols-ro-status,
  .t-row.cols-ro-matrix {
    grid-template-columns: 24px minmax(0, 1fr);
    row-gap: var(--s2);
  }

  .t-row.cols-status > :nth-child(n + 3),
  .t-row.cols-profile > :nth-child(n + 3),
  .t-row.cols-ro-status > :nth-child(n + 3),
  .t-row.cols-ro-matrix > :nth-child(n + 3) {
    grid-column: 2;
  }

  .cols-status .u::placeholder {
    color: var(--ink-3);
  }

  /* Matrix becomes a two-column option list under each product group. */
  .t-row.cols-matrix {
    grid-template-columns: 24px repeat(2, minmax(0, 1fr));
    column-gap: var(--s4);
    row-gap: 0;
  }

  .t-row.cols-matrix > .t-label {
    grid-column: 2 / -1;
    padding-right: 0;
    padding-bottom: var(--s2);
  }

  .t-row.cols-matrix > .mx-cell:nth-child(odd) {
    grid-column: 2;
  }

  .t-row.cols-matrix > .mx-cell:nth-child(even) {
    grid-column: 3;
  }

  .mx-cell {
    justify-content: flex-start;
    gap: var(--s2);
    height: 32px;
  }

  .mx-cell::after {
    content: attr(data-short);
    font-size: 13px;
    line-height: 16px;
  }

  .t-row.cols-matrix > .mx-structures {
    grid-column: 2 / -1;
    row-gap: var(--s2);
  }

  .mx-structures,
  .contacts {
    grid-template-columns: minmax(0, 1fr);
  }

  .contacts > .caps {
    display: none;
  }

  .contacts .role {
    margin-top: var(--s3);
  }

  .step-nav {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .step-nav .actions {
    justify-content: space-between;
  }
}

@media print {
  :root {
    --gutter: 0;
  }

  body {
    font-size: 11px;
    line-height: 15px;
  }

  .no-print {
    display: none !important;
  }

  .page {
    max-width: none;
    padding-bottom: 0;
  }

  .doc-head {
    padding-top: 0;
  }

  .ro-section {
    margin-top: var(--s5);
    break-inside: auto;
  }

  .ro-section h2 {
    break-after: avoid;
  }

  .t-row {
    break-inside: avoid;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
}

/* Admin */

.block {
  margin-top: var(--s6);
}

.block + .block {
  margin-top: var(--s7);
}

.block-title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
}

.block-title .mono {
  margin-left: var(--s2);
  font-size: 14px;
  color: var(--ink-3);
}

.block-hint {
  margin-top: var(--s1);
  color: var(--ink-2);
}

.invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  column-gap: var(--s5);
  align-items: start;
  max-width: 880px;
  margin-top: var(--s4);
}

.invite-form label .caps {
  display: block;
  margin-bottom: var(--s1);
}

/* Label (16px) + gap (4px) + field (28px) = 48px; the 36px button ends on the underline. */
.invite-form .btn {
  margin-top: 12px;
}

.invite-result {
  display: flex;
  align-items: center;
  gap: var(--s4);
  max-width: 880px;
  margin-top: var(--s4);
  padding: var(--s3) var(--s4);
  background: var(--hover);
}

.invite-result .url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12px;
}

.cols-suppliers {
  grid-template-columns: 88px minmax(0, 1fr) 120px 56px 136px 200px;
  align-items: center;
}

.cols-suppliers .t-num,
.cols-suppliers .t-label {
  padding-top: 0;
}

.cols-suppliers .ref {
  font-family: var(--mono);
  font-size: 12px;
}

.cols-suppliers .date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s4);
  font-size: 13px;
}

.tag {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-submitted {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.tag-in_progress {
  border-color: var(--ink);
}

.tag-invited {
  border: 1px dashed var(--ink-3);
  color: var(--ink-2);
}

.empty-row {
  padding: var(--s5) 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}

.view-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s6);
  margin-top: var(--s5);
}

.view-summary div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 900px) {
  .invite-form {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--s4);
  }

  .invite-form .btn {
    margin-top: 0;
  }

  .t-row.cols-suppliers {
    grid-template-columns: 88px minmax(0, 1fr);
    row-gap: var(--s2);
  }

  .t-row.cols-suppliers > :nth-child(n + 3) {
    grid-column: 2;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .doc-side {
    flex-wrap: wrap;
  }
}

.bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px 0; }
.bulk-actions .block-hint { margin: 0; }
.mail-form { display: grid; gap: 12px; max-width: 720px; }
.mail-form label { display: grid; gap: 4px; }
.mail-form textarea.u { width: 100%; min-height: 200px; resize: vertical; overflow: auto; font: inherit; line-height: 1.5; }
.mfr-scroll { overflow-x: auto; }
.mfr-table { border-collapse: collapse; min-width: 1800px; width: 100%; }
.mfr-table th, .mfr-table td { padding: 8px 10px; border-bottom: 1px solid currentColor; border-color: rgba(127, 127, 127, .25); text-align: left; vertical-align: top; }
.mfr-table .col-name { min-width: 220px; }
.mfr-table .col-capabilities, .mfr-table .col-screeningNotes { min-width: 300px; }
.mfr-table .row-actions { white-space: nowrap; }

/* Row actions stay visible while the wide list scrolls sideways. */
.mfr-table th:last-child, .mfr-table td:last-child { position: sticky; right: 0; background: var(--paper); box-shadow: -8px 0 8px -8px rgba(0, 0, 0, .18); }
.bulk-actions button:disabled { opacity: .4; cursor: default; }
