.feedback-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.42);
}

.feedback-modal.visible {
  display: flex;
}

.feedback-dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  padding: 24px 24px 16px;
  overflow-y: auto;
  color: var(--color-text);
  border-radius: 14px;
  background: white;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}

.feedback-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 4px;
}

.feedback-heading h2 {
  margin: 0;
}

.feedback-field-help,
.feedback-form label span {
  color: var(--color-text-muted);
}

.feedback-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--color-text-muted);
  font-size: 1.55rem;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface-subtle);
  cursor: pointer;
}

.feedback-form {
  display: grid;
  gap: 9px;
}

.feedback-form label {
  margin-top: 8px;
  font-weight: 700;
}

.feedback-form label:first-child {
  margin-top: 0;
}

.feedback-form .feedback-email-label {
  margin-top: 10px;
}

.feedback-form input,
.feedback-form select,
.feedback-form textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 11px 13px;
  color: var(--color-text);
  font: inherit;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: white;
}

.feedback-form textarea {
  min-height: 125px;
  resize: vertical;
}

.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
  border-color: var(--color-primary);
  outline: 3px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
}

.feedback-field-help {
  margin: -3px 2px 2px;
  font-size: 0.82rem;
  text-align: right;
}

.feedback-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -3px 2px 2px;
}

.feedback-message-meta .feedback-field-help {
  margin: 0;
}

.feedback-upload-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  border: 0;
  background: none;
  cursor: pointer;
}

.feedback-upload-link:hover {
  color: var(--color-primary-dark);
}

.feedback-paperclip {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.feedback-image-input {
  display: none;
}

.feedback-image-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  gap: 16px;
  color: var(--color-text-muted);
  font-size: 0.86rem;
}

.feedback-image-file[hidden] {
  display: none;
}

.feedback-image-file span {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-image-file button {
  flex: 0 0 auto;
  padding: 0;
  color: var(--color-primary-dark);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  border: 0;
  background: none;
  cursor: pointer;
}

.feedback-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 0;
}

.feedback-cancel,
.feedback-submit {
  padding: 11px 17px;
  font: inherit;
  font-weight: 700;
  border-radius: 9px;
  cursor: pointer;
}

.feedback-cancel {
  color: var(--color-text-muted);
  border: 0;
  background: none;
}

.feedback-submit {
  color: white;
  border: 0;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

.feedback-submit:hover {
  filter: brightness(1.06);
}

.feedback-close:focus-visible,
.feedback-cancel:focus-visible,
.feedback-submit:focus-visible,
.feedback-upload-link:focus-visible,
.feedback-image-file button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 45%, transparent);
  outline-offset: 3px;
}

.feedback-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.feedback-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.feedback-result {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: 8px;
}

.feedback-result--error {
  color: #721c24;
  border-color: #f5c6cb;
  background: #f8d7da;
}

.feedback-result--success {
  color: #155724;
  border-color: #c3e6cb;
  background: #d4edda;
}

@media (max-width: 560px) {
  .feedback-modal {
    padding: 12px;
  }

  .feedback-dialog {
    max-height: calc(100vh - 24px);
    padding: 20px 20px 14px;
  }
}
