:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #6a737d;
  --line: #dfe3e8;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --primary: #2fc6f6;
  --primary-dark: #12a8d9;
  --warning-bg: #fff8e6;
  --warning-line: #f2cf66;
  --warning-ink: #674d00;
  --success-bg: #edf9f1;
  --success-line: #a9ddb9;
  --success-ink: #1e6d37;
  --error-bg: #fff0f0;
  --error-line: #efb0b0;
  --error-ink: #9b2525;
  --radius: 14px;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.page {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 28px 38px;
  background: var(--surface);
}

.eyebrow {
  margin-bottom: 8px;
  color: #0796c4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 22px;
  font-size: 27px;
  line-height: 1.2;
}

h2 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.35;
}

.compact-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px;
  background: transparent;
}

.compact-caption {
  color: var(--muted);
  font-size: 12px;
}

.button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}

.button:disabled {
  cursor: wait;
  opacity: .65;
}

.button-primary {
  color: #fff;
  background: var(--primary-dark);
}

.button-primary:hover:not(:disabled) {
  background: #098eb7;
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-soft);
}

.compact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 194px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0 solid #0075ff;
  border-radius: 9999px;
  background: #0075ff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 28px;
  white-space: nowrap;
}

.compact-button:hover:not(:disabled) {
  background: color-mix(in srgb, #0075ff 100%, #000 3%);
}

.compact-button:active:not(:disabled) {
  background: color-mix(in srgb, #0075ff 100%, #000 6%);
}

.compact-button:disabled {
  cursor: not-allowed;
  opacity: .3;
}

.status-card,
.deal-card,
.question-card,
.submit-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.deal-card {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  background: var(--surface-soft);
}

.deal-card > div {
  display: grid;
  gap: 4px;
}

.meta-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.notice {
  margin-bottom: 18px;
  padding: 15px 17px;
  border: 1px solid;
  border-radius: 10px;
  line-height: 1.45;
}

.notice-warning {
  color: var(--warning-ink);
  border-color: var(--warning-line);
  background: var(--warning-bg);
}

.notice-success {
  color: var(--success-ink);
  border-color: var(--success-line);
  background: var(--success-bg);
}

.notice-error {
  color: var(--error-ink);
  border-color: var(--error-line);
  background: var(--error-bg);
}

.notice-details {
  margin-top: 7px;
}

.compact-notice {
  margin-top: 14px;
  margin-bottom: 0;
}

.immediate-card {
  border-color: var(--success-line);
  background: var(--success-bg);
}

.immediate-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.retry-immediate {
  margin-top: 12px;
}

.question-card {
  margin-bottom: 16px;
  padding: 20px;
  box-shadow: 0 4px 18px rgba(23, 33, 43, .05);
}

.question-card.card-invalid {
  border-color: #da4b4b;
  box-shadow: 0 0 0 3px rgba(218, 75, 75, .08);
}

.question-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.question-badge {
  flex: 0 0 auto;
  max-width: 230px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #087ca1;
  background: #e7f8fd;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.source-question {
  margin: -4px 0 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--warning-line);
  color: var(--muted);
  background: var(--surface-soft);
  line-height: 1.45;
  white-space: pre-line;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  align-content: start;
  gap: 7px;
}

.field:has(.field-textarea) {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
}

.required-mark {
  color: #d72c2c;
}

.field-input,
.field-textarea {
  width: 100%;
  border: 1px solid #bcc4cc;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field-input {
  min-height: 42px;
  padding: 0 12px;
}

.field-textarea {
  min-height: 96px;
  padding: 11px 12px;
  resize: vertical;
}

.field-input:focus,
.field-textarea:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(18, 168, 217, .15);
}

.field-invalid {
  border-color: #da4b4b;
  box-shadow: 0 0 0 3px rgba(218, 75, 75, .1);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.field-error {
  min-height: 14px;
  color: #b42a2a;
  font-size: 11px;
}

.compact-card-notice {
  margin: 0;
}

.question-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 18px;
}

.group-status {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.group-status.status-error {
  color: var(--error-ink);
}

.group-submit {
  flex: 0 0 auto;
  max-width: 420px;
  padding-top: 9px;
  padding-bottom: 9px;
  line-height: 1.25;
}

.submit-panel {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding: 16px;
  box-shadow: 0 -8px 28px rgba(23, 33, 43, .08);
}

.submit-note {
  max-width: 390px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.submit-actions {
  display: flex;
  gap: 9px;
}

.progress-message {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.progress-message-left {
  margin-top: 0;
  text-align: left;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #b8dce7;
  border-top-color: var(--primary-dark);
  border-radius: 50%;
  vertical-align: -4px;
  animation: spin .8s linear infinite;
}

.spinner-light {
  width: 15px;
  height: 15px;
  border-color: rgba(255, 255, 255, .45);
  border-top-color: #fff;
}

.result-page {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.result-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
}

.result-success {
  background: #38aa60;
}

.result-warning {
  background: #d99a24;
}

.result-text {
  margin: 0 0 8px;
  line-height: 1.5;
}

.technical-note {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 11px;
}

.demo-ribbon {
  position: fixed;
  z-index: 10;
  top: 12px;
  right: -36px;
  width: 150px;
  padding: 6px 0;
  transform: rotate(35deg);
  color: #fff;
  background: #7b61d1;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 620px) {
  .page {
    padding: 22px 16px 30px;
  }

  .fields-grid {
    grid-template-columns: 1fr;
  }

  .field:has(.field-textarea) {
    grid-column: auto;
  }

  .question-heading,
  .question-actions,
  .submit-panel,
  .immediate-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .question-badge {
    max-width: none;
    align-self: flex-start;
  }

  .submit-panel {
    position: static;
  }

  .submit-actions {
    justify-content: flex-end;
  }

  .group-submit {
    width: 100%;
  }
}
