:root {
  --navy: #0d2b52;
  --navy-dark: #081d38;
  --ink: #16202e;
  --muted: #667486;
  --line: #e3e7ed;
  --line-strong: #c9d1dc;
  --bg: #ffffff;
  --danger: #b3261e;
  --radius: 7px;
  /* Farmand CPAs' real brand colors (sampled from farmandcpa.com), used on
     the partner approval pages rather than the navy tokens above. */
  --brand-gold: #dca134;
  --brand-charcoal: #0d0b0c;
  --brand-cream: #f9f9e5;
}

* {
  box-sizing: border-box;
}

/* An explicit display on .field would otherwise beat the user agent's
   [hidden] rule, leaving conditional fields on screen. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 48px 20px 64px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.embed-mode {
  padding: 20px 16px 32px;
}

.form-container {
  max-width: 580px;
  margin: 0 auto;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 36px;
  font-size: 0.95rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* Every section is styled identically: a title with a hairline beneath it.
   No first-child exception, which is what made the old layout read as
   inconsistent. */
.section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

label,
.label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
}

.req {
  color: var(--danger);
  font-weight: 400;
  margin-left: 1px;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input::placeholder,
textarea::placeholder {
  color: #9aa4b2;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="tel"]:hover,
select:hover,
textarea:hover {
  border-color: #a9b4c2;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(13, 43, 82, 0.12);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23667486' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

select:invalid,
select:has(option[value=""]:checked) {
  color: #9aa4b2;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

/* Selectable options read as tappable chips, which makes a multi-select
   obviously multi-select. */
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px 8px 11px;
  font-weight: 400;
  font-size: 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.check:hover {
  border-color: #a9b4c2;
  background: #f7f9fb;
}

.check:has(input:checked) {
  border-color: var(--navy);
  background: rgba(13, 43, 82, 0.05);
  font-weight: 500;
}

.check:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(13, 43, 82, 0.12);
}

.check input {
  width: auto;
  margin: 0;
  flex: none;
  accent-color: var(--navy);
}

button[type="submit"] {
  margin-top: 4px;
  padding: 13px 20px;
  font-size: 0.98rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background-color: var(--navy);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

button[type="submit"]:hover {
  background-color: var(--navy-dark);
}

button[type="submit"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 43, 82, 0.3);
}

button[type="submit"]:disabled {
  background-color: #8894a5;
  cursor: not-allowed;
}

.error-message {
  display: none;
  margin: 0;
  padding: 11px 13px;
  font-size: 0.875rem;
  color: var(--danger);
  background: #fdf3f2;
  border: 1px solid #f3d3d0;
  border-radius: var(--radius);
}

.error-message.visible {
  display: block;
}

@media (max-width: 520px) {
  body {
    padding: 32px 16px 48px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .subtitle {
    margin-bottom: 28px;
  }

  form {
    gap: 30px;
  }

  .check {
    font-size: 0.88rem;
  }
}

/* Industry type-ahead */
.typeahead {
  position: relative;
}

.typeahead-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(16, 32, 46, 0.1);
}

.typeahead-option {
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 0.92rem;
  cursor: pointer;
}

.typeahead-option:hover,
.typeahead-option.active {
  background: rgba(13, 43, 82, 0.07);
}

/* Shown in place of the form once a lead is saved and there is no redirect */
.thank-you {
  padding: 18px 20px;
  background: #f2f7f3;
  border: 1px solid #cfe3d5;
  border-radius: var(--radius);
}

.thank-you p {
  margin: 0;
  font-size: 1rem;
  color: #1f4a30;
}

/* Partner approve/decline pages (server.js). On-brand per farmandcpa.com
   rather than the navy tokens above, since this page represents the firm
   directly to a partner. */
.page-eyebrow {
  margin: 0 0 6px;
  color: var(--brand-gold);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lead-summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 20px;
  margin: 24px 0;
  padding: 20px 22px;
  background: var(--brand-cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.lead-summary div {
  display: contents;
}

.lead-summary dt {
  font-weight: 600;
  color: var(--ink);
}

.lead-summary dd {
  margin: 0;
  color: var(--muted);
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.approval-actions form {
  flex: none;
}

/* Matches button[type="submit"]'s selector specificity (attribute + type)
   so these on-brand variants actually override the navy default instead of
   losing to it. */
button[type="submit"].btn-approve,
button[type="submit"].btn-decline {
  padding: 13px 24px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

button[type="submit"].btn-approve {
  color: var(--brand-charcoal);
  background-color: var(--brand-gold);
  border: 1px solid var(--brand-gold);
}

button[type="submit"].btn-approve:hover {
  background-color: #c38e2a;
  border-color: #c38e2a;
}

button[type="submit"].btn-decline {
  color: var(--brand-charcoal);
  background-color: transparent;
  border: 1px solid var(--brand-charcoal);
}

button[type="submit"].btn-decline:hover {
  background-color: rgba(13, 11, 12, 0.06);
}

button[type="submit"].btn-approve:focus-visible,
button[type="submit"].btn-decline:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 161, 52, 0.35);
}

@media (max-width: 520px) {
  .lead-summary {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .lead-summary div {
    display: block;
    margin-bottom: 10px;
  }

  .approval-actions form {
    flex: 1 1 auto;
  }

  .btn-approve,
  .btn-decline {
    width: 100%;
  }
}
