.feedback-trigger {
  position: fixed;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 9000;
  min-width: 108px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(20, 83, 45, 0.26);
  border-radius: 8px;
  color: #ffffff;
  background: #166534;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
  font: 700 14px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.feedback-trigger:hover {
  background: #14532d;
}

.feedback-trigger:focus-visible,
.feedback-dialog button:focus-visible,
.feedback-dialog textarea:focus-visible,
.feedback-dialog input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.38);
  outline-offset: 2px;
}

.feedback-trigger[hidden],
.feedback-modal[hidden] {
  display: none !important;
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding:
    max(20px, env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
}

.feedback-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
}

.feedback-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 24px;
  border: 1px solid #d7e1dc;
  border-radius: 8px;
  color: #17233b;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.32);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.feedback-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.feedback-dialog h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.feedback-close {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #d7e1dc;
  border-radius: 6px;
  color: #334155;
  background: #ffffff;
  font: 400 25px/1 system-ui, sans-serif;
  cursor: pointer;
}

.feedback-close:hover {
  background: #f1f5f3;
}

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

.feedback-field {
  display: grid;
  gap: 7px;
  color: #24344d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.feedback-optional {
  color: #64748b;
  font-weight: 500;
}

.feedback-field textarea,
.feedback-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #b9c8c0;
  border-radius: 6px;
  color: #17233b;
  background: #ffffff;
  font: 400 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.feedback-field textarea {
  min-height: 168px;
  resize: vertical;
  padding: 11px 12px;
}

.feedback-field input {
  min-height: 44px;
  padding: 8px 12px;
}

.feedback-status {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.45;
}

.feedback-status[data-kind="success"] {
  color: #14532d;
  background: #ecfdf3;
}

.feedback-status[data-kind="pending"] {
  color: #334155;
  background: #f1f5f9;
}

.feedback-status[data-kind="error"] {
  color: #991b1b;
  background: #fef2f2;
}

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

.feedback-actions button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  font: 700 14px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.feedback-cancel {
  border: 1px solid #cbd5e1;
  color: #334155;
  background: #ffffff;
}

.feedback-submit {
  min-width: 126px;
  border: 1px solid #166534;
  color: #ffffff;
  background: #166534;
}

.feedback-submit:hover:not(:disabled) {
  background: #14532d;
}

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

body.feedback-dialog-open {
  overflow: hidden;
}

@media (max-width: 580px) {
  .feedback-trigger {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    min-width: 96px;
  }

  .feedback-modal {
    align-items: end;
    padding:
      max(12px, env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      max(12px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
  }

  .feedback-dialog {
    padding: 18px;
  }

  .feedback-field textarea {
    min-height: 132px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-trigger,
  .feedback-dialog {
    scroll-behavior: auto;
  }
}
