:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #617083;
  --line: #d8dee6;
  --accent: #b68a2c;
  --accent-strong: #8f681b;
  --accent-soft: #fff7e3;
  --danger: #b42318;
  --success: #067647;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.page-shell {
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

.form-panel {
  position: relative;
  background: var(--panel);
  min-height: 100vh;
  overflow: hidden;
}

.language-switcher {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(143, 104, 27, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-strong);
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.14);
  padding: 4px;
  backdrop-filter: blur(10px);
}

.language-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px 4px 5px;
}

.language-option:hover {
  background: #fff7e3;
  color: var(--accent-strong);
}

.language-option.is-active {
  border-color: rgba(182, 138, 44, 0.65);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(182, 138, 44, 0.08);
}

.language-flag {
  display: block;
  width: 26px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(31, 41, 51, 0.12);
}

.language-option span {
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1;
}

.form-header {
  padding: 24px 18px 20px;
  border-top: 8px solid var(--accent);
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  display: block;
  width: min(178px, 58vw);
  height: auto;
  margin: 0 0 20px;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.15;
}

.form-header p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
}

.status {
  margin: 18px 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--muted);
}

.status.error {
  border-color: #f6c9c4;
  background: #fff4f2;
  color: var(--danger);
}

.status.success {
  border-color: #abefc6;
  background: #ecfdf3;
  color: var(--success);
}

.email-notifications {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 86px));
  z-index: 12;
  width: min(280px, calc(100vw - 24px));
  border: 1px solid rgba(143, 104, 27, 0.34);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(31, 41, 51, 0.16);
  backdrop-filter: blur(10px);
}

.email-notifications summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  list-style: none;
}

.email-notifications summary::-webkit-details-marker {
  display: none;
}

.email-notifications summary::after {
  content: "+";
  float: right;
}

.email-notifications[open] summary::after {
  content: "-";
}

.email-notifications-form {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.email-notifications-form label {
  gap: 4px;
  margin: 0;
  font-size: 0.78rem;
}

.email-notifications-form input {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.85rem;
}

.email-notifications-actions {
  display: flex;
  justify-content: flex-end;
}

.email-notifications-actions button {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
}

.email-notifications-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.email-notifications-status.error {
  color: var(--danger);
}

.email-notifications-status.success {
  color: var(--success);
}

.contact-form {
  padding: 0 18px 24px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 18px 0 6px;
}

.step-pill {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 0.9rem;
  font-weight: 750;
}

.step-pill:hover {
  background: #f8fafc;
}

.step-pill.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.step-pill.is-complete {
  border-color: rgba(182, 138, 44, 0.45);
  color: var(--text);
}

.form-step {
  display: none;
  gap: 18px;
  padding: 18px 0 4px;
}

.form-step.is-active {
  display: grid;
}

.form-step h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.2;
}

.form-step p {
  margin: -8px 0 0;
  color: var(--muted);
}

label,
fieldset,
.phone-field {
  display: grid;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-weight: 650;
}

.income-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  margin: 0 0 8px;
  padding: 0;
  font-weight: 650;
}

.field-label {
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 450;
  padding: 10px 12px;
}

.combobox {
  position: relative;
}

.combobox input {
  padding-right: 38px;
}

.combobox::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  pointer-events: none;
  transform: rotate(45deg);
}

.combobox-listbox {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 8;
  max-height: min(280px, 44vh);
  overflow-y: auto;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(31, 41, 51, 0.16);
  padding: 4px;
}

.combobox-option,
.combobox-empty {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  padding: 9px 10px;
}

.combobox-option:hover,
.combobox-option.is-highlighted {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.combobox-option[aria-selected="true"] {
  font-weight: 750;
}

.combobox-empty {
  color: var(--muted);
  cursor: default;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(182, 138, 44, 0.18);
}

input.is-invalid,
select.is-invalid,
.combobox.is-invalid input,
.phone-field.is-invalid .phone-control,
fieldset.is-invalid {
  border-color: #f04438;
}

fieldset.is-invalid {
  border-radius: 6px;
  outline: 2px solid rgba(240, 68, 56, 0.12);
  outline-offset: 6px;
}

.field-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.phone-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border-radius: 6px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  color: var(--text);
  font-weight: 500;
}

.choice input {
  width: 18px;
  min-height: 18px;
}

.spouse-fields {
  display: grid;
  gap: 14px;
  border-left: 3px solid var(--accent);
  padding-left: 14px;
}

.representatives {
  display: grid;
  gap: 12px;
}

.repeater-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.repeater-header h3 {
  margin: 0;
  font-size: 1rem;
}

.representative-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.representative-card[open] {
  border-color: rgba(182, 138, 44, 0.5);
}

.representative-card summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 750;
}

.representative-card > label,
.representative-card > .phone-field,
.representative-card > .remove-representative {
  margin-top: 12px;
}

.remove-representative {
  width: fit-content;
}

#website {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 16px -18px -24px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 10px 18px;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button[hidden] {
  display: none;
}

button.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

button.secondary:hover {
  background: #f8fafc;
}

@media (max-width: 560px) {
  .actions button {
    width: 100%;
  }
}

@media (min-width: 680px) {
  .language-switcher {
    top: 18px;
    left: 18px;
  }

  .page-shell {
    width: min(820px, calc(100% - 32px));
    padding: 32px 0 48px;
  }

  .form-panel {
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(31, 41, 51, 0.08);
  }

  .form-header {
    padding: 28px 28px 22px;
  }

  .status {
    margin: 20px 28px 0;
  }

  .contact-form {
    padding: 0 28px 30px;
  }

  .phone-control {
    grid-template-columns: minmax(150px, 220px) 1fr;
  }

  .income-row {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  }

  .stepper {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-top: 22px;
  }

  .actions {
    position: static;
    margin: 18px 0 0;
    padding: 0;
    border-top: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .actions button {
    min-width: 132px;
  }

  .email-notifications {
    right: 18px;
    bottom: 18px;
  }
}
