.fq-wrap {
  --fq-bg: #ffffff;
  --fq-text: #1f2937;
  --fq-muted: #6b7280;
  --fq-border: #d1d5db;
  --fq-border-strong: #1f2937;
  --fq-soft: #f3f4f6;
  --fq-danger: #ef4444;
  --fq-send: #16a34a;
  --fq-send-hover: #15803d;
  --fq-radius: 1rem;
  max-width: 36rem;
  margin: 0 auto;
  font-family: inherit;
  color: var(--fq-text);
  position: relative;
}

.fq-wrap *,
.fq-wrap *::before,
.fq-wrap *::after {
  box-sizing: border-box;
}

.fq-card {
  background: var(--fq-bg);
  border: 1px solid var(--fq-border);
  border-radius: var(--fq-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  scroll-margin-top: 7rem;
}

.fq-card.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fq-card.is-entering {
  animation: fq-fade-in 0.3s ease;
}

@keyframes fq-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fq-progress {
  display: block !important;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--fq-border);
}

.fq-progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fq-text);
  letter-spacing: 0.01em;
}

.fq-progress__track {
  display: block;
  height: 0.375rem;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.fq-progress__fill {
  display: block;
  height: 100%;
  width: 12.5%;
  min-width: 0.375rem;
  border-radius: inherit;
  background: #1f2937;
  transition: width 0.25s ease;
}

.fq-label {
  display: block;
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1.125rem;
  line-height: 1.35;
}

.fq-label--sm {
  font-weight: 500;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.fq-req {
  color: var(--fq-danger);
}

.fq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.fq-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--fq-border);
  border-radius: 0.75rem;
  padding: 0.75rem 0.65rem;
  background: #fff;
  transition: background 0.15s ease, border-color 0.15s ease, font-weight 0.15s ease;
  user-select: none;
  font-size: 0.9rem;
  line-height: 1.3;
  min-height: 3rem;
}

@media (max-width: 480px) {
  .fq-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .fq-chip {
    padding: 0.65rem 0.4rem;
    font-size: 0.8rem;
    min-height: 2.75rem;
  }
}

.fq-chip:hover {
  background: #f9fafb;
}

.fq-chip.is-active {
  background: var(--fq-soft);
  border-color: var(--fq-border-strong);
  font-weight: 600;
}

.fq-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fq-field {
  width: 100%;
  border: 1px solid var(--fq-border);
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  background: #fff;
  color: #111;
  font-size: 1rem;
  line-height: 1.4;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.fq-field::placeholder {
  color: #9ca3af;
}

.fq-field:focus {
  border-color: #9ca3af;
}

.fq-field.is-invalid {
  border-color: var(--fq-danger);
}

.fq-hint {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--fq-muted);
  line-height: 1.4;
}

.fq-hint--error {
  color: var(--fq-muted);
  font-size: 0.875rem;
}

.fq-radio-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fq-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.fq-radio input {
  accent-color: #1f2937;
}

.fq-links {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fq-link-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.fq-link-row .fq-field {
  flex: 1;
}

.fq-icon-btn {
  border: 0;
  background: transparent;
  color: var(--fq-danger);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
}

.fq-icon-btn:hover {
  color: #dc2626;
}

.fq-dashed-btn {
  display: inline-block;
  border: 1px dashed #9ca3af;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  font-size: 0.95rem;
  text-align: center;
  transition: background 0.15s ease;
}

.fq-dashed-btn:hover {
  background: var(--fq-soft);
}

.fq-file {
  display: block;
  width: 100%;
  font-size: 0.875rem;
  color: #374151;
}

.fq-file::file-selector-button {
  margin-right: 1rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 0.375rem;
  background: var(--fq-soft);
  color: #1f2937;
  cursor: pointer;
}

.fq-file::file-selector-button:hover {
  background: #e5e7eb;
}

.fq-files {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .fq-files {
    grid-template-columns: 1fr 1fr;
  }
}

.fq-file-card {
  position: relative;
  padding: 0.75rem;
  border: 1px solid var(--fq-border);
  border-radius: 0.5rem;
  background: #f9fafb;
}

.fq-file-preview {
  width: 100%;
  height: 8rem;
  object-fit: cover;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  display: block;
}

.fq-file-fallback {
  height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--fq-border);
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--fq-muted);
  padding: 0.5rem;
  text-align: center;
  word-break: break-word;
}

.fq-file-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.fq-file-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 75%;
}

.fq-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  gap: 0.75rem;
}

.fq-nav__spacer {
  flex: 1;
}

.fq-btn {
  border: 0;
  border-radius: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.fq-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fq-btn--ghost {
  background: var(--fq-soft);
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fq-btn--ghost:hover:not(:disabled) {
  background: #e5e7eb;
}

.fq-btn--primary {
  background: #1f2937;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.fq-btn--primary:hover:not(:disabled) {
  background: #374151;
}

.fq-btn--send {
  background: var(--fq-send);
  color: #fff;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.25);
}

.fq-btn--send:hover:not(:disabled) {
  background: var(--fq-send-hover);
}

.fq-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: #fff;
  border-radius: var(--fq-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  animation: fq-fade-in 0.35s ease;
}

.fq-success[hidden],
.fq-card[hidden],
.fq-toast[hidden],
.fq-btn[hidden] {
  display: none !important;
}

.fq-success__icon {
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.75rem;
  color: #111;
}

.fq-success__icon svg {
  width: 100%;
  height: 100%;
}

.fq-success h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}

.fq-success p {
  margin: 0;
  color: #4b5563;
}

.fq-toast {
  position: absolute;
  top: -0.5rem;
  left: 50%;
  transform: translate(-50%, -100%);
  z-index: 5;
  background: #111827;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.fq-toast.is-error {
  background: #991b1b;
}

.fq-toast.is-ok {
  background: #166534;
}

textarea.fq-field {
  resize: vertical;
  min-height: 6rem;
}

.fq-datetime__wrap {
  position: relative;
  display: block;
  cursor: pointer;
}

.fq-datetime__display {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--fq-border);
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  background: #fff;
  color: #9ca3af;
  font-size: 1rem;
  line-height: 1.4;
  pointer-events: none;
}

.fq-datetime__display.has-value {
  color: #111;
}

.fq-datetime__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  background: transparent;
  color: transparent;
}

/* Desktop: show the native picker control so clicks open reliably */
@media (hover: hover) and (pointer: fine) {
  .fq-datetime__display {
    display: none;
  }

  .fq-datetime__input {
    position: static;
    inset: auto;
    opacity: 1;
    width: 100%;
    height: auto;
    min-height: 2.75rem;
    border: 1px solid var(--fq-border);
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    background: #fff;
    color: #111;
    -webkit-appearance: auto;
    appearance: auto;
  }

  .fq-datetime__input:focus {
    border-color: #9ca3af;
    outline: none;
  }
}
