.quote-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  pointer-events: none;
}

.quote-modal[hidden] {
  display: none;
}

.quote-modal:not([hidden]) {
  pointer-events: auto;
}

.quote-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  opacity: 0;
  transition: opacity 280ms ease;
}

.quote-modal.is-open .quote-modal__backdrop {
  opacity: 1;
}

.quote-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 32rem;
  max-height: min(92svh, 44rem);
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border-top: 3px solid var(--color-accent);
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.18);
  transform: translateY(105%);
  transition: transform 360ms var(--ease-out);
  overflow: hidden;
}

.quote-modal.is-open .quote-modal__panel {
  transform: translateY(0);
}

.quote-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6) var(--gutter-mobile) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.quote-modal__header-text {
  flex: 1;
  min-width: 0;
}

.quote-modal__lead {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-text-muted);
}

.quote-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  flex-shrink: 0;
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0 0;
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 200ms ease, color 200ms ease, background-color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

.quote-modal__close svg {
  width: 1.125rem;
  height: 1.125rem;
}

.quote-modal__close:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.quote-modal__body {
  padding: var(--space-4) var(--gutter-mobile) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.quote-modal__body .form-panel {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.quote-modal__body .form-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-3);
}

.quote-modal__body .form-group--full {
  grid-column: 1 / -1;
}

.quote-modal__body .form-group--actions {
  margin-top: 0;
}

.quote-modal__body .form-label {
  margin-bottom: var(--space-1);
}

.quote-modal__body .form-input,
.quote-modal__body .form-select {
  min-height: 2.625rem;
  padding: var(--space-2) var(--space-3);
}

.quote-modal__body .form-textarea {
  min-height: 3.25rem;
  max-height: 4.5rem;
  padding: var(--space-2) var(--space-3);
  resize: none;
}

.quote-modal__body .form-checkbox {
  font-size: var(--text-xs);
  line-height: 1.45;
}

.quote-modal__body .form-checkbox input {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 1px;
}

.quote-modal__body .btn {
  min-height: 2.75rem;
  padding-block: var(--space-2);
}

.quote-modal__body .btn--full {
  width: 100%;
}

body.is-quote-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

@media (max-width: 767px) {
  .quote-modal__panel {
    max-height: calc(100svh - var(--header-height));
  }

  .quote-modal__header {
    padding: var(--space-4) var(--gutter-mobile) var(--space-3);
  }

  .quote-modal__header .eyebrow {
    font-size: 0.6875rem;
  }

  .quote-modal__header .heading-md {
    font-size: var(--text-lg);
    line-height: 1.15;
  }

  .quote-modal__lead {
    display: none;
  }

  .quote-modal__body {
    flex: 0 1 auto;
    overflow-y: visible;
  }
}

@media (min-width: 768px) {
  .quote-modal {
    align-items: center;
    padding: var(--space-6);
  }

  .quote-modal__panel {
    max-width: 36rem;
    max-height: min(88svh, 40rem);
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-accent);
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    transition:
      transform 360ms var(--ease-spring),
      opacity 280ms ease;
  }

  .quote-modal.is-open .quote-modal__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  .quote-modal__header {
    padding: var(--space-8) var(--space-8) var(--space-5);
  }

  .quote-modal__body {
    padding: var(--space-5) var(--space-8) var(--space-8);
    overflow-y: auto;
  }

  .quote-modal__body .form-fields {
    gap: var(--space-3);
  }

  .quote-modal__body .form-textarea {
    min-height: 4.5rem;
    max-height: none;
    resize: vertical;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quote-modal__backdrop,
  .quote-modal__panel {
    transition: none;
  }

  .quote-modal__panel {
    transform: none;
    opacity: 1;
  }
}

@media (hover: none) {
  .quote-modal__close:hover {
    border-color: var(--color-border);
    color: var(--color-text);
  }
}
