:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #17211f;
  --muted: #5d6b67;
  --border: #d9e1de;
  --border-strong: #9eb3ad;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #dff4f0;
  --warning: #b45309;
  --danger: #b42318;
  --success: #116b45;
  --shadow: 0 24px 70px rgba(23, 33, 31, 0.12);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(180, 83, 9, 0.06)),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.page {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  place-items: center;
}

.form-panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid rgba(217, 225, 222, 0.88);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 44px);
}

.page-header {
  max-width: 760px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.commission-form {
  display: grid;
  gap: 26px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.field > span {
  display: block;
  margin-bottom: 10px;
  color: #263532;
  font-size: 0.92rem;
  font-weight: 800;
}

.first-field legend {
  margin-bottom: 12px;
}

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

.profile-option,
.phase-option {
  position: relative;
  cursor: pointer;
}

.profile-option input,
.phase-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.profile-option > span {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfc;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.profile-option strong {
  font-size: 1.05rem;
}

.profile-option small {
  color: var(--muted);
  font-size: 0.88rem;
}

.profile-option input:checked + span,
.phase-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.profile-option input:focus-visible + span,
.phase-option input:focus-visible + span,
input:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.26);
  outline-offset: 2px;
}

.grid {
  display: grid;
  gap: 18px;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  min-width: 0;
}

.field input,
.percent-input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.field input {
  padding: 0 15px;
}

.field input::placeholder {
  color: #91a09b;
}

.field input:hover,
.percent-input:hover {
  border-color: var(--border-strong);
}

.field.has-error input,
.field-group.has-error .phase-grid,
.field.has-error .percent-input {
  border-color: var(--danger);
}

.percent-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
}

.percent-input input {
  min-height: 50px;
  border: 0;
}

.percent-input input:focus-visible {
  outline: 0;
}

.percent-input span {
  padding: 0 16px 0 10px;
  color: var(--muted);
  font-weight: 800;
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.phase-option > span {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfc;
  color: #243330;
  font-size: 0.94rem;
  line-height: 1.25;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.phase-option b {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #e8efec;
  color: #34443f;
  font-size: 0.76rem;
}

.field-error {
  min-height: 18px;
  display: block;
  margin-top: 7px;
  color: var(--danger);
  font-size: 0.83rem;
  font-weight: 700;
}

.feedback {
  border-radius: 8px;
  padding: 13px 15px;
  font-size: 0.94rem;
  font-weight: 750;
}

.feedback.success {
  border: 1px solid rgba(17, 107, 69, 0.24);
  background: #e7f6ee;
  color: var(--success);
}

.feedback.error {
  border: 1px solid rgba(180, 35, 24, 0.22);
  background: #fff0ee;
  color: var(--danger);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

button:active {
  transform: translateY(1px);
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.22);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.secondary-button {
  background: #edf2f0;
  color: #273734;
}

.secondary-button:hover {
  background: #e1ebe7;
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 20px, 560px);
    padding: 10px 0;
    align-items: start;
  }

  .form-panel {
    padding: 22px 18px;
  }

  .profile-toggle,
  .two-columns,
  .phase-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }

  .intro {
    font-size: 0.96rem;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  button {
    width: 100%;
  }
}
