.lib-detailed-quote-form-component {
  display: flex;
  flex-direction: column;
  gap: var(--lib-space-6);
}

.lib-detailed-quote-form-component__honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.lib-detailed-quote-form-component__group {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--lib-space-3);
}

.lib-detailed-quote-form-component__legend {
  padding: 0;
  font-family: var(--lib-font-heading);
  font-weight: 700;
  font-size: var(--lib-font-size-body-sm);
  color: var(--lib-text-primary);
}

.lib-detailed-quote-form-component__legend-note {
  font-weight: 500;
  color: var(--lib-text-secondary);
}

.lib-detailed-quote-form-component__required {
  color: var(--lib-detailed-quote-form-accent, var(--lib-text-brand));
  margin-left: var(--lib-space-1);
}

/* Property type segmented control */
.lib-detailed-quote-form-component__segmented {
  display: inline-flex;
  gap: var(--lib-space-1);
  padding: var(--lib-space-1);
  border: 1px solid var(--lib-border-default);
  border-radius: var(--lib-radius-lg);
  background: var(--lib-surface-card);
  width: fit-content;
}

.lib-detailed-quote-form-component__segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lib-detailed-quote-form-component__segmented label {
  font-family: var(--lib-font-heading);
  font-weight: 700;
  font-size: var(--lib-font-size-small);
  padding: var(--lib-space-2) var(--lib-space-5);
  border-radius: var(--lib-radius-md, var(--lib-radius-lg));
  color: var(--lib-text-secondary);
  cursor: pointer;
  transition: background var(--lib-transition-base), color var(--lib-transition-base);
}

.lib-detailed-quote-form-component__segmented input:checked + label {
  background: var(--lib-detailed-quote-form-accent, var(--lib-action-primary-bg));
  color: var(--lib-action-primary-text);
}

.lib-detailed-quote-form-component__segmented input:focus-visible {
  outline: 3px solid var(--lib-focus-ring);
  outline-offset: 2px;
}

.lib-detailed-quote-form-component__segmented input:focus-visible + label {
  outline: 3px solid color-mix(in srgb, var(--lib-border-accent) 30%, transparent);
}

/* Field grid */
.lib-detailed-quote-form-component__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--lib-space-4);
}

.lib-detailed-quote-form-component__field-label {
  display: grid;
  gap: var(--lib-space-2);
  color: var(--lib-text-primary);
  font-weight: 700;
  font-size: var(--lib-font-size-small);
}

.lib-detailed-quote-form-component__field-label--full {
  grid-column: 1 / -1;
}

.lib-detailed-quote-form-component__field {
  width: 100%;
  min-height: 3.25rem;
  padding: var(--lib-space-3) var(--lib-space-4);
  border: 1px solid var(--lib-border-default);
  border-radius: var(--lib-radius-lg);
  background: var(--lib-surface-card);
  font: inherit;
  color: var(--lib-text-primary);
  transition: border-color var(--lib-transition-base), box-shadow var(--lib-transition-base);
}

.lib-detailed-quote-form-component__field:focus {
  outline: none;
  border-color: var(--lib-detailed-quote-form-accent, var(--lib-focus-ring));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lib-detailed-quote-form-accent, var(--lib-focus-ring)) 16%, transparent);
}

.lib-detailed-quote-form-component__field--textarea {
  min-height: 6rem;
  resize: vertical;
}

.lib-detailed-quote-form-component__field--select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b6b' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--lib-space-4) center;
  padding-right: var(--lib-space-8);
}

/* Phone with country flag */
.lib-detailed-quote-form-component__phone-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--lib-border-default);
  border-radius: var(--lib-radius-lg);
  background: var(--lib-surface-card);
  overflow: hidden;
}

.lib-detailed-quote-form-component__phone-group:focus-within {
  border-color: var(--lib-detailed-quote-form-accent, var(--lib-focus-ring));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lib-detailed-quote-form-accent, var(--lib-focus-ring)) 16%, transparent);
}

.lib-detailed-quote-form-component__phone-flag {
  display: flex;
  align-items: center;
  padding: 0 var(--lib-space-3);
  border-right: 1px solid var(--lib-border-default);
  font-size: var(--lib-font-size-lead);
  flex-shrink: 0;
}

.lib-detailed-quote-form-component__phone-group .lib-detailed-quote-form-component__field--phone {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.lib-detailed-quote-form-component__phone-group .lib-detailed-quote-form-component__field--phone:focus {
  outline: none;
  box-shadow: none;
}

/* Conditional commercial-only fields */
.lib-detailed-quote-form-component__conditional {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--lib-space-4);
  padding: var(--lib-space-4);
  border: var(--lib-space-hairline) dashed var(--lib-border-default);
  border-radius: var(--lib-radius-lg);
  background: var(--lib-surface-card);
}

.lib-detailed-quote-form-component__conditional[hidden] {
  display: none;
}

/* Service needed checklist */
.lib-detailed-quote-form-component__checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--lib-space-3);
}

.lib-detailed-quote-form-component__check-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--lib-space-2);
  padding: var(--lib-space-3) var(--lib-space-4);
  border: 1.5px solid var(--lib-border-default);
  border-radius: var(--lib-radius-lg);
  cursor: pointer;
  font-size: var(--lib-font-size-small);
  color: var(--lib-text-primary);
  transition: border-color var(--lib-transition-base), background var(--lib-transition-base);
}

.lib-detailed-quote-form-component__check-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lib-detailed-quote-form-component__check-mark {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  border-radius: var(--lib-radius-sm, 0.25rem);
  border: 1.5px solid var(--lib-border-default);
  background: var(--lib-surface-card);
}

.lib-detailed-quote-form-component__check-card input:checked ~ .lib-detailed-quote-form-component__check-mark {
  background: var(--lib-detailed-quote-form-accent, var(--lib-action-primary-bg));
  border-color: var(--lib-detailed-quote-form-accent, var(--lib-border-brand));
}

.lib-detailed-quote-form-component__check-card:has(input:checked) {
  border-color: var(--lib-detailed-quote-form-accent, var(--lib-border-brand));
  background: color-mix(in srgb, var(--lib-detailed-quote-form-accent, var(--lib-text-brand)) 6%, var(--lib-surface-page, transparent));
}

.lib-detailed-quote-form-component__check-card input:focus-visible ~ .lib-detailed-quote-form-component__check-mark {
  outline: 3px solid color-mix(in srgb, var(--lib-border-accent) 30%, transparent);
}

/* Privacy / consent, message, actions, success -- shared shape with
   Contact Form (UI-004) so the two components read as one family. */
.lib-detailed-quote-form-component__privacy {
  display: flex;
  align-items: flex-start;
  min-height: 2.75rem;
  gap: var(--lib-space-3);
  font-size: var(--lib-font-size-small);
  line-height: 1.4;
  color: var(--lib-text-secondary);
  cursor: pointer;
}

.lib-detailed-quote-form-component__checkbox {
  margin-top: var(--lib-space-1);
  width: 1rem;
  height: 1rem;
  accent-color: var(--lib-detailed-quote-form-accent, var(--lib-action-primary-bg));
  flex-shrink: 0;
}

.lib-detailed-quote-form-component__message {
  border-radius: var(--lib-radius-lg);
  padding: var(--lib-space-3) var(--lib-space-4);
  font-size: var(--lib-font-size-small);
  line-height: 1.4;
  text-align: center;
}

.lib-detailed-quote-form-component__message[hidden] {
  display: none;
}

.lib-detailed-quote-form-component__message.is-error {
  background: color-mix(in srgb, var(--lib-color-error) 10%, white);
  color: color-mix(in srgb, var(--lib-color-error) 82%, black);
  border: 1px solid color-mix(in srgb, var(--lib-color-error) 22%, transparent);
}

.lib-detailed-quote-form-component__actions {
  display: flex;
  justify-content: center;
}

.lib-detailed-quote-form-component__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding-block: var(--lib-space-3);
}

.lib-detailed-quote-form-component__submit[disabled] {
  opacity: 0.72;
  pointer-events: none;
}

.lib-detailed-quote-form-component__success[hidden] {
  display: none;
}

.lib-detailed-quote-form-component__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--lib-space-5);
  padding: var(--lib-space-8) var(--lib-space-6);
  text-align: center;
}

.lib-detailed-quote-form-component__success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--lib-radius-pill);
  background: color-mix(in srgb, var(--lib-detailed-quote-form-accent, var(--lib-icon-brand)) 14%, var(--lib-surface-card));
  color: var(--lib-detailed-quote-form-accent, var(--lib-icon-brand));
  flex-shrink: 0;
}

.lib-detailed-quote-form-component__success-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.lib-detailed-quote-form-component__success-title {
  margin: 0;
  font-family: var(--lib-font-heading);
  font-size: var(--lib-font-size-title-sm);
  font-weight: 700;
  line-height: 1.25;
  color: var(--lib-text-primary);
}

.lib-detailed-quote-form-component__success-body {
  margin: 0;
  font-family: var(--lib-font-body);
  color: var(--lib-text-secondary);
}

@media (max-width: 40rem) {
  .lib-detailed-quote-form-component__grid,
  .lib-detailed-quote-form-component__conditional {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lib-detailed-quote-form-component__field,
  .lib-detailed-quote-form-component__segmented label,
  .lib-detailed-quote-form-component__check-card {
    transition: none;
  }
}

/* Label text and its required marker share one row; the control spans the
   full width below. As a plain grid, the text node and the asterisk became
   separate rows, leaving the marker alone on its own line (2026-10-09). */
.lib-detailed-quote-form-component__field-label {
  grid-template-columns: max-content 1fr;
  column-gap: 0;
  align-items: baseline;
}

.lib-detailed-quote-form-component__field-label > :is(input, select, textarea, div, .lib-detailed-quote-form-component__phone-group) {
  grid-column: 1 / -1;
}

.lib-detailed-quote-form-component__field-label > .lib-detailed-quote-form-component__legend-note {
  margin-left: var(--lib-space-1);
}
