.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 9, 55, .62);
  backdrop-filter: blur(8px);
}

.feedback-dialog {
  width: min(760px, 100%);
  max-height: min(900px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--border, #ddd8f3);
  border-radius: 24px;
  background: var(--surface, #fff);
  box-shadow: 0 26px 80px rgba(28, 10, 75, .3);
}

.feedback-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 28px 20px;
  border-bottom: 1px solid var(--border, #e6e0f4);
  background: color-mix(in srgb, var(--surface, #fff) 94%, transparent);
  backdrop-filter: blur(10px);
}

.feedback-header .eyebrow { margin: 0 0 4px; }
.feedback-header h2 { margin: 0; color: var(--ink, #211b39); font-size: clamp(1.35rem, 3vw, 1.8rem); }
.feedback-header p:last-child { margin: 7px 0 0; color: var(--ink-soft, #6f6887); font-size: 14px; line-height: 1.45; }
.feedback-close {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border, #ddd8f3);
  border-radius: 50%;
  background: var(--surface-2, #f7f5fc);
  color: var(--ink, #211b39);
  cursor: pointer;
}

.feedback-form { display: grid; gap: 18px; padding: 24px 28px 28px; }
.feedback-field { display: grid; gap: 7px; color: var(--ink, #211b39); font-size: 14px; font-weight: 700; }
.feedback-field > small { justify-self: end; color: var(--ink-soft, #6f6887); font-size: 12px; font-weight: 500; }
.feedback-field input,
.feedback-field select,
.feedback-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border-strong, #ccc3eb);
  border-radius: 12px;
  padding: 11px 13px;
  background: var(--surface-2, #faf9fd);
  color: var(--ink, #211b39);
  font: inherit;
  font-weight: 500;
}
.feedback-field textarea { min-height: 118px; resize: vertical; line-height: 1.5; }
.feedback-field input:focus,
.feedback-field select:focus,
.feedback-field textarea:focus { outline: 3px solid color-mix(in srgb, var(--primary, #7251ff) 22%, transparent); border-color: var(--primary, #7251ff); }

.feedback-attachment-field {
  min-width: 0;
  margin: 0;
  padding: 17px;
  border: 1px solid var(--border, #e0daf2);
  border-radius: 16px;
  background: var(--surface-2, #faf9fd);
}
.feedback-attachment-field legend { padding: 0 6px; color: var(--ink, #211b39); font-size: 14px; font-weight: 800; }
.feedback-attachment-field > p { margin: 0 0 13px; color: var(--ink-soft, #6f6887); font-size: 13px; line-height: 1.5; }
.feedback-attachment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.feedback-attachment-actions .btn { min-height: 42px; }
.feedback-upload { position: relative; cursor: pointer; }
.feedback-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.feedback-upload:focus-within { outline: 3px solid color-mix(in srgb, var(--primary, #7251ff) 24%, transparent); outline-offset: 2px; }
.feedback-capture-status { min-height: 20px; margin: 9px 0 0 !important; color: var(--primary-700, #4c2bbd) !important; font-weight: 600; }
.feedback-attachment-actions .recording { border-color: #b2253c; background: #fff0f2; color: #982038; }

.feedback-preview {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border, #e0daf2);
  border-radius: 13px;
  background: var(--surface, #fff);
}
.feedback-preview.hidden { display: none; }
.feedback-preview img,
.feedback-preview video { display: block; width: 100%; max-height: 135px; object-fit: contain; border-radius: 9px; background: #12072d; }
.feedback-preview-copy { display: grid; gap: 4px; min-width: 0; }
.feedback-preview-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink, #211b39); font-size: 13px; }
.feedback-preview-copy span { color: var(--ink-soft, #6f6887); font-size: 12px; }
.feedback-preview-copy button { justify-self: start; margin-top: 5px; padding: 0; border: 0; background: none; color: #a51e37; font-weight: 700; cursor: pointer; }

.feedback-privacy-warning {
  margin-top: 13px;
  padding: 12px 13px;
  border: 1px solid #e9c874;
  border-radius: 12px;
  background: #fffaf0;
  color: #5f4610;
  font-size: 12.5px;
  line-height: 1.45;
}
.feedback-privacy-warning > p { margin: 4px 0 0; }
.feedback-confirm { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-weight: 700; }
.feedback-confirm.hidden { display: none; }
.feedback-confirm input { flex: 0 0 auto; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary, #7251ff); }

.feedback-context { border: 1px solid var(--border, #e0daf2); border-radius: 13px; padding: 12px 14px; color: var(--ink-soft, #6f6887); font-size: 12.5px; }
.feedback-context summary { color: var(--ink, #211b39); font-weight: 750; cursor: pointer; }
.feedback-context dl { display: grid; grid-template-columns: minmax(90px, 130px) 1fr; gap: 6px 12px; margin: 13px 0; }
.feedback-context dt { font-weight: 750; }
.feedback-context dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.feedback-context p { margin: 8px 0 0; line-height: 1.45; }
.feedback-error { min-height: 20px; margin: -5px 0; color: #a51e37; font-size: 13px; font-weight: 650; }
.feedback-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 3px; }

@media (max-width: 620px) {
  .feedback-overlay { align-items: end; padding: 0; }
  .feedback-dialog { max-height: 94vh; border-radius: 22px 22px 0 0; }
  .feedback-header { padding: 20px 18px 16px; }
  .feedback-form { padding: 20px 18px 28px; }
  .feedback-attachment-actions { display: grid; grid-template-columns: 1fr; }
  .feedback-attachment-actions .btn { width: 100%; justify-content: center; }
  .feedback-preview { grid-template-columns: 1fr; }
  .feedback-context dl { grid-template-columns: 1fr; gap: 2px; }
  .feedback-context dd { margin-bottom: 6px; }
  .feedback-footer { position: sticky; bottom: -28px; margin: 0 -18px -28px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--surface, #fff); border-top: 1px solid var(--border, #e0daf2); }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-overlay *, .feedback-overlay *::before, .feedback-overlay *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
