/* Shared feedback UI — section buttons, badges, toolbar */
.review-toolbar-btn.active {
  background: var(--qs-primary);
  color: #fff;
  border-color: var(--qs-primary);
}

.review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--qs-accent);
  color: #fff;
  border-radius: 999px;
  vertical-align: middle;
}

.review-toolbar-btn .review-badge {
  margin-left: 0;
}

.review-section-btn {
  display: none;
  position: relative;
  vertical-align: middle;
  margin-left: 0.5rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid #0f172a;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.review-section-btn:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.review-section-icon {
  width: 14px;
  height: 14px;
  display: block;
}

body.review-mode .review-section-btn { display: inline-flex; align-items: center; justify-content: center; }

/* Customer feedback section button — always visible */
.crv-section-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.crv-section-btn:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.review-panel {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  width: min(380px, 100vw);
  height: calc(100vh - var(--topbar-height));
  background: var(--qs-surface);
  border-left: 1px solid var(--qs-border);
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.08);
  z-index: 190;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.review-panel.open { transform: translateX(0); }

.review-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--qs-border);
  flex-shrink: 0;
}
.review-panel-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.review-identity {
  font-size: 0.8rem;
  color: var(--qs-muted);
}
.review-identity strong { color: var(--qs-text); }
.review-identity button {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--qs-primary);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.review-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.review-panel-actions .btn { font-size: 0.75rem; padding: 0.35rem 0.6rem; }
.review-scope-btn.active {
  background: var(--qs-primary);
  color: #fff;
  border-color: var(--qs-primary);
}

.review-panel-summary {
  padding: 0.55rem 1.25rem 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--qs-muted);
}

.review-authors-strip {
  flex-shrink: 0;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--qs-border);
  background: var(--qs-bg);
  max-height: 28%;
  overflow-y: auto;
}
.review-authors-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--qs-muted);
  margin-bottom: 0.45rem;
}
.review-authors-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.review-author-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: var(--qs-surface);
  border: 1px solid var(--qs-border);
  border-radius: 10px;
}
.review-author-chip-avatar { width: 26px; height: 26px; font-size: 0.65rem; }
.review-author-chip-meta { flex: 1; min-width: 0; }
.review-author-chip-name { font-size: 0.78rem; font-weight: 700; }
.review-author-chip-email { font-size: 0.68rem; color: var(--qs-muted); }
.review-author-chip-count {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--qs-primary-light);
  color: var(--qs-primary-dark);
  border-radius: 999px;
}

.review-thread-page {
  display: inline-flex;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.review-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.review-compose {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--qs-border);
  flex-shrink: 0;
  background: var(--qs-bg);
}
.review-compose label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--qs-muted);
  margin-bottom: 0.35rem;
}
.review-compose textarea {
  width: 100%;
  min-height: 72px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--qs-border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.875rem;
  resize: vertical;
}
.review-compose textarea:focus {
  outline: none;
  border-color: var(--qs-primary);
  box-shadow: var(--focus-ring);
}
.review-compose .btn-primary { width: 100%; margin-top: 0.5rem; }

.review-empty {
  text-align: center;
  color: var(--qs-muted);
  font-size: 0.875rem;
  padding: 2rem 1rem;
}

.review-thread-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--qs-primary-dark);
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed var(--qs-border);
}
.review-thread-title:first-child { margin-top: 0; }

.review-card {
  background: var(--qs-bg);
  border: 1px solid var(--qs-border);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}
.review-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.review-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.review-card-meta { flex: 1; min-width: 0; }
.review-card-author {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}
.review-card-time {
  font-size: 0.7rem;
  color: var(--qs-muted);
}
.review-card-text {
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.review-card-delete {
  background: none;
  border: none;
  color: var(--qs-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem;
}
.review-card-delete:hover { color: #dc2626; }

.review-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.review-modal {
  background: var(--qs-surface);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--qs-shadow);
}
.review-modal h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.review-modal p { margin: 0 0 1rem; font-size: 0.875rem; color: var(--qs-muted); }
.review-modal label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.review-modal input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--qs-border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-family: var(--font);
  font-size: 0.9rem;
}
.review-modal input:focus {
  outline: none;
  border-color: var(--qs-primary);
  box-shadow: var(--focus-ring);
}
.review-modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

body.review-panel-open .main-content {
  margin-right: min(380px, 100vw);
  transition: margin-right 0.25s ease;
}

@media (max-width: 960px) {
  body.review-panel-open .main-content { margin-right: 0; }
}

@media print {
  .review-panel, .review-section-btn, .review-toolbar-btn, .review-modal-overlay { display: none !important; }
}

.discovery-response-input {
  width: 100%;
  min-width: 8rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--qs-border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
  background: var(--qs-surface);
  color: var(--qs-text);
}

.discovery-response-input:focus {
  outline: none;
  border-color: var(--qs-primary);
  box-shadow: var(--focus-ring);
}
