#feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 4300;
  display: none;
  background: var(--overlay-bg, rgba(10, 12, 20, 0.74));
  backdrop-filter: blur(8px);
}

#feedback-modal.active {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.feedback-shell {
  width: min(1240px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px));
  margin: 16px;
  display: grid;
  grid-template-columns: minmax(440px, 1fr) 380px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 80px var(--shadow-color, rgba(0, 0, 0, 0.5));
  overflow: hidden;
}

.feedback-main,
.feedback-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.feedback-main {
  border-right: 1px solid var(--border);
}

.feedback-header {
  height: 48px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}

.feedback-title {
  font-size: 13px;
  font-weight: 650;
  flex: 1;
  min-width: 0;
}

.feedback-status-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-dim);
  padding: 3px 8px;
  font-size: 10px;
  white-space: nowrap;
}

.feedback-status-pill.ready {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 42%, transparent);
  background: var(--success-soft);
}

.feedback-status-pill.needs {
  color: var(--yellow);
  border-color: color-mix(in srgb, var(--yellow) 42%, transparent);
  background: var(--warning-soft);
}

.feedback-icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-dim);
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.feedback-icon-btn:hover,
.feedback-icon-btn:focus-visible {
  color: var(--fg);
  border-color: var(--accent);
  outline: none;
}

.feedback-form {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px minmax(230px, 280px);
  gap: 8px;
  align-items: stretch;
}

.feedback-title-input,
.feedback-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-lighter);
  color: var(--fg);
  outline: none;
  font-size: 12px;
}

.feedback-title-input {
  height: 44px;
  padding: 0 10px;
  min-width: 0;
  font-weight: 600;
}

.feedback-title-input:focus,
.feedback-select:focus,
.feedback-editor:focus {
  border-color: var(--accent);
}

.feedback-select {
  height: 26px;
  padding: 0 8px;
  width: 100%;
}

.feedback-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 8px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-lighter);
}

.feedback-field > span {
  font-size: 9px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--fg-dim);
  font-weight: 650;
}

.feedback-field .feedback-select {
  height: 25px;
  padding: 0;
  border: 0;
  background: transparent;
}

.feedback-destination-note {
  margin-top: -6px;
  color: var(--fg-dim);
  font-size: 11px;
  line-height: 1.4;
}

.feedback-segmented {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-light);
}

.feedback-type-btn {
  min-width: 0;
  height: 32px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--fg-dim);
  font-size: 11px;
  cursor: pointer;
}

.feedback-type-btn:last-child {
  border-right: 0;
}

.feedback-type-btn.active {
  background: var(--accent-soft);
  color: var(--fg);
}

.feedback-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--bg-light);
}

.feedback-editor-wrap {
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

.feedback-editor {
  flex: 1;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  background: var(--bg-input);
  padding: 14px 16px;
  outline: none;
  overflow: auto;
  line-height: 1.55;
  font-size: 13px;
  white-space: pre-wrap;
}

.feedback-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--fg-dim);
}

.feedback-editor img {
  max-width: 100%;
  max-height: 220px;
  display: block;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.feedback-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feedback-attachment {
  position: relative;
  width: 118px;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-light);
  overflow: hidden;
}

.feedback-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.feedback-attachment span {
  position: absolute;
  left: 6px;
  bottom: 5px;
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.feedback-submit-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-light);
}

.feedback-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-lighter);
  color: var(--fg);
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
}

.feedback-btn:disabled {
  opacity: 0.62;
  cursor: wait;
}

.feedback-btn:hover {
  border-color: var(--accent);
}

.feedback-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
}

.feedback-note {
  flex: 1 1 260px;
  color: var(--fg-dim);
  font-size: 11px;
  line-height: 1.4;
}

.feedback-side {
  background: var(--bg-card);
  overflow: auto;
}

.feedback-side-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.feedback-side-section h3 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--fg-dim);
}

.feedback-review-section {
  background: var(--accent-soft);
}

.feedback-review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.feedback-review-heading h3 {
  margin: 0;
}

.feedback-review-state {
  font-size: 10px;
  line-height: 18px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-dim);
  white-space: nowrap;
}

.feedback-review-state.ready {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 42%, transparent);
  background: var(--success-soft);
}

.feedback-review-state.needs {
  color: var(--yellow);
  border-color: color-mix(in srgb, var(--yellow) 42%, transparent);
  background: var(--warning-soft);
}

.feedback-side-details {
  padding: 0;
}

.feedback-side-details summary {
  cursor: pointer;
  list-style: none;
  padding: 12px;
  color: var(--fg);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0;
}

.feedback-side-details summary::-webkit-details-marker {
  display: none;
}

.feedback-side-details summary::after {
  content: '▾';
  float: right;
  color: var(--fg-dim);
}

.feedback-side-details:not([open]) summary::after {
  content: '▸';
}

.feedback-side-details > div {
  padding: 0 12px 12px;
}

.feedback-context-line {
  font-size: 11px;
  line-height: 1.45;
  color: var(--fg);
  word-break: break-word;
}

.feedback-context-line.muted {
  color: var(--fg-dim);
}

.feedback-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 240px;
  overflow: auto;
}

.feedback-evidence-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 6px;
  align-items: start;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-panel);
}

.feedback-evidence-item input {
  margin-top: 2px;
}

.feedback-evidence-title {
  font-size: 11px;
  color: var(--fg);
  line-height: 1.35;
}

.feedback-evidence-meta {
  font-size: 10px;
  color: var(--fg-dim);
  margin-top: 2px;
}

.feedback-sensitivity {
  font-size: 9px;
  color: var(--fg-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 5px;
}

.feedback-triage-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-agent-msg {
  border-left: 2px solid var(--accent);
  padding: 7px 8px;
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  color: var(--fg);
  font-size: 11px;
  line-height: 1.45;
}

.feedback-agent-msg.warn {
  border-left-color: var(--yellow);
  background: var(--warning-soft);
}

.feedback-agent-msg.question {
  background: var(--bg-panel);
}

.feedback-review-label {
  color: var(--fg-dim);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .feedback-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - 16px);
    width: calc(100vw - 16px);
    margin: 8px;
  }

  .feedback-main {
    border-right: 0;
  }

  .feedback-side {
    min-height: 240px;
    border-top: 1px solid var(--border);
  }

  .feedback-row {
    grid-template-columns: 1fr;
  }

  .feedback-segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feedback-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .feedback-submit-row .feedback-btn.primary {
    width: 100%;
  }
}
