/* Capacity request page. Layout and form controls only; tokens, header,
   footer, buttons, and type scale come from /capacity.css. */

/* capacity.css mutes the header's first link (a "Sign in" text link on the
   marketplace page). Here the first link is the button. */
.header-actions > a:first-child.button {
  color: #fffdf8;
  font-size: 13px;
}

.request {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 0 96px;
}
.request-head {
  text-align: center;
  margin-bottom: 36px;
}
.request-head h1 {
  font-size: clamp(30px, 3.1vw, 42px);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.4px;
  margin: 0;
  white-space: nowrap;
}
.request-head h1 > span {
  color: var(--orange);
}
.request-head p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 520px;
  margin: 16px auto 0;
  text-wrap: balance;
}

.request-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 36px 40px 40px;
  background: #fffdf9;
}
.request-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.request-form[hidden] {
  display: none;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.field > label,
.field legend {
  font: 11px/1.5 var(--mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #52534d;
  padding: 0;
}
.field legend {
  margin-bottom: 8px;
}
.req {
  font-style: normal;
  color: var(--orange);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  transition: border-color 0.15s ease;
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23595a54' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field textarea {
  min-height: 0;
  padding: 11px 14px;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: #a3a39c;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
}
.field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.chips[aria-invalid="true"] .chip span {
  border-color: var(--orange);
}
.field small {
  font-size: 12px;
  color: #80817a;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.form-section:first-child {
  padding-top: 0;
  border-top: 0;
}
.form-section > h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0 0 2px;
}
.model-blocks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.model-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
  padding: 20px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
}
.remove-model {
  position: absolute;
  top: 18px;
  right: 20px;
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: #80817a;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.remove-model:hover {
  color: var(--orange);
}
.remove-model[hidden] {
  display: none;
}
.add-model {
  align-self: flex-start;
  background: none;
  border: 1px dashed #c9c7bf;
  border-radius: 2px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ink);
}
.add-model:hover {
  border-color: var(--ink);
}
.add-model[hidden] {
  display: none;
}
.throughput {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.throughput-head,
.throughput-row {
  display: grid;
  grid-template-columns: 128px 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.throughput-head span {
  font: 11px/1.5 var(--mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #80817a;
  padding-left: 14px;
}
.throughput-unit {
  font-size: 13px;
  color: var(--ink);
}
.chips-label {
  font: 11px/1.5 var(--mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #52534d;
}

.typeahead {
  position: relative;
}
.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 296px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(17, 18, 16, 0.08);
}
.suggestions[hidden] {
  display: none;
}
.suggestions li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
}
.suggestions li span:last-child {
  font: 11px/1.5 var(--mono);
  color: #80817a;
  white-space: nowrap;
}
.suggestions li[aria-selected="true"],
.suggestions li:hover {
  background: #f3f1ec;
}
.suggestions li mark {
  background: transparent;
  color: inherit;
  font-weight: 600;
}
.suggestions .empty {
  cursor: default;
  color: #80817a;
}
.suggestions .empty:hover {
  background: transparent;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  font-size: 13px;
  color: var(--ink);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.chip:hover span {
  border-color: #b9b8b0;
}
.chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffdf8;
}
.chip input:focus-visible + span {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.consent {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  cursor: pointer;
}
.consent input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--ink);
  cursor: pointer;
}
.consent a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.consent input[aria-invalid="true"] {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}
.consent input[aria-invalid="true"] + span {
  color: var(--ink);
}

.terms-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: min(85vh, 900px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(17, 18, 16, 0.18);
  display: none;
  grid-template-rows: auto 1fr auto;
}
.terms-dialog[open] {
  display: grid;
}
.terms-dialog::backdrop {
  background: rgba(17, 18, 16, 0.45);
}
.terms-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.terms-dialog-head h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  margin: 0;
}
.terms-dialog-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
}
.terms-dialog-close:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.terms-dialog-body {
  overflow-y: auto;
  padding: 8px 24px 24px;
}
.terms-dialog-body .terms {
  max-width: none;
  padding: 0;
}
.terms-dialog-body .terms h1 {
  display: none;
}
.terms-loading {
  font-size: 14px;
  color: var(--muted);
  padding: 16px 0;
}
.terms-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: #fffdf9;
}
.terms-dialog-foot a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 700px) {
  .terms-dialog {
    width: calc(100% - 16px);
    max-height: 92vh;
  }
  .terms-dialog-head,
  .terms-dialog-body,
  .terms-dialog-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
}
.submit {
  width: 100%;
  min-height: 48px;
  font-size: 14px;
}
.submit[disabled] {
  opacity: 0.6;
  cursor: default;
}
.form-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--orange);
}
.form-error[hidden] {
  display: none;
}

.request-done h2 {
  font-size: 42px;
  margin: 0 0 16px;
}
.request-done p {
  font-size: 15px;
  line-height: 1.62;
  color: var(--muted);
  margin: 0 0 24px;
  max-width: 420px;
}
.request-done .text-link {
  color: var(--ink);
}
.request-done[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .request {
    padding: 48px 0 72px;
  }
  .request-panel {
    padding: 28px 24px 32px;
  }
}
@media (max-width: 700px) {
  .request {
    padding: 36px 0 56px;
  }
  .request-head h1 {
    font-size: 30px;
    line-height: 1.1;
    white-space: normal;
  }
  .request-head p {
    font-size: 13px;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .throughput-head,
  .throughput-row {
    grid-template-columns: 96px 1fr 1fr;
    gap: 8px;
  }
  .throughput-unit {
    font-size: 12px;
  }
  .model-block {
    padding: 16px 14px 18px;
  }
  .request-panel {
    padding: 24px 18px 28px;
  }
  .request-done h2 {
    font-size: 34px;
  }
}
