/* Floating feedback menu and chat */
.feedback-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0369a1, #0e7490);
  color: #fff;
  box-shadow: 0 13px 32px rgba(3, 52, 86, .26), 0 2px 7px rgba(3, 52, 86, .16);
  font: 700 14px/1 var(--u-sans, Inter, Arial, sans-serif);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.feedback-launcher:hover { transform: translateY(-2px); box-shadow: 0 17px 38px rgba(3, 52, 86, .32), 0 3px 9px rgba(3, 52, 86, .18); }
.feedback-launcher:focus-visible, .feedback-close:focus-visible, .feedback-choice:focus-visible, .feedback-send:focus-visible { outline: 3px solid rgba(14, 165, 233, .45); outline-offset: 3px; }
.feedback-launcher__icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 15px; }
.feedback-launcher__badge { display: none; width: 7px; height: 7px; margin-left: -4px; border-radius: 50%; background: #a7f3d0; box-shadow: 0 0 0 4px rgba(167,243,208,.18); }
.feedback-launcher.has-new .feedback-launcher__badge { display: block; }

.feedback-panel {
  position: fixed;
  right: 22px;
  bottom: 84px;
  z-index: 1199;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 112px));
  overflow: hidden;
  border: 1px solid rgba(126, 161, 188, .35);
  border-radius: 20px;
  background: var(--u-surface, #fff);
  color: var(--u-ink, #102b43);
  box-shadow: 0 28px 80px rgba(16, 44, 70, .24), 0 4px 14px rgba(16,44,70,.12);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.feedback-panel.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.feedback-panel[hidden] { display: none !important; }
.feedback-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 15px; background: linear-gradient(135deg, #0c4a6e, #0369a1); color: #fff; }
.feedback-header strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.feedback-header span { display: block; margin-top: 4px; color: rgba(255,255,255,.78); font-size: 12px; line-height: 1.4; }
.feedback-close { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid rgba(255,255,255,.3); border-radius: 9px; background: rgba(255,255,255,.1); color: #fff; font-size: 19px; line-height: 1; cursor: pointer; }
.feedback-body { min-height: 0; overflow: auto; padding: 16px; }
.feedback-view { display: none; }
.feedback-view.is-active { display: block; }
.feedback-intro { margin: 0 0 14px; color: var(--u-ink-muted, #536d84); font-size: 13px; line-height: 1.5; }
.feedback-choices { display: grid; gap: 10px; }
.feedback-choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 1px solid var(--u-hairline-strong, #cad7e2); border-radius: 13px; background: var(--u-surface-1, #f6f9fc); color: inherit; text-align: left; cursor: pointer; transition: border-color .16s, background .16s, transform .16s; }
.feedback-choice:hover { border-color: #38a3d3; background: rgba(14,165,233,.06); transform: translateY(-1px); }
.feedback-choice__icon { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 10px; background: rgba(14,165,233,.12); color: #0369a1; font-size: 17px; }
.feedback-choice strong { display: block; font-size: 14px; }
.feedback-choice small { display: block; margin-top: 3px; color: var(--u-ink-muted, #63798d); font-size: 12px; line-height: 1.35; }
.feedback-back { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 10px; padding: 0; border: 0; background: transparent; color: #0369a1; font: 600 12px/1.2 inherit; cursor: pointer; }
.feedback-form { display: grid; gap: 10px; }
.feedback-form label { display: grid; gap: 5px; color: var(--u-ink-muted, #536d84); font-size: 12px; }
.feedback-form input, .feedback-form textarea { box-sizing: border-box; width: 100%; padding: 10px 11px; border: 1px solid var(--u-hairline-strong, #cad7e2); border-radius: 10px; background: var(--u-surface, #fff); color: var(--u-ink, #102b43); font: inherit; font-size: 13px; resize: vertical; }
.feedback-form input:focus, .feedback-form textarea:focus { border-color: #38a3d3; outline: 2px solid rgba(14,165,233,.12); }
.feedback-consent { display: flex !important; grid-template-columns: none; align-items: flex-start; gap: 7px; font-size: 11px !important; line-height: 1.35; }
.feedback-consent input { width: auto; margin-top: 2px; }
.feedback-consent a { color: #0369a1; }
.feedback-send { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 0; border-radius: 10px; background: #0369a1; color: #fff; font: 700 13px/1 inherit; cursor: pointer; }
.feedback-send[disabled] { opacity: .62; cursor: wait; }
.feedback-message { min-height: 18px; margin: 0; color: #b42318; font-size: 12px; line-height: 1.4; }
.feedback-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.feedback-chat { display: grid; grid-template-rows: minmax(120px, 1fr) auto; min-height: 330px; }
.feedback-chat-log { display: flex; flex-direction: column; gap: 9px; max-height: 330px; overflow-y: auto; padding: 2px 1px 12px; }
.feedback-bubble { max-width: 86%; padding: 9px 11px; border-radius: 13px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-bubble--agent { align-self: flex-start; border-bottom-left-radius: 4px; background: var(--u-surface-1, #f0f5f9); color: var(--u-ink, #102b43); }
.feedback-bubble--user { align-self: flex-end; border-bottom-right-radius: 4px; background: #0369a1; color: #fff; }
.feedback-bubble time { display: block; margin-top: 4px; opacity: .6; font-size: 10px; }
.feedback-chat-form { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--u-hairline, #e2eaf0); }
.feedback-chat-form textarea { min-height: 67px; }
.feedback-chat-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.feedback-chat-meta input { min-width: 0; }
.feedback-status { margin: 0; color: var(--u-ink-muted, #63798d); font-size: 11px; }
.feedback-success { display: grid; gap: 11px; padding: 6px 2px; }
.feedback-success strong { font-size: 15px; }
.feedback-success p { margin: 0; color: var(--u-ink-muted, #536d84); font-size: 13px; line-height: 1.45; }
.feedback-new-chat { justify-self: start; padding: 0; border: 0; background: transparent; color: #0369a1; font: 600 12px/1.2 inherit; cursor: pointer; }
.feedback-consent-gate { position: sticky; bottom: -16px; display: grid; gap: 8px; margin: 16px -16px -16px; padding: 11px 16px 14px; border-top: 1px solid var(--u-hairline, #e2eaf0); background: var(--u-surface, #fff); background: color-mix(in srgb, var(--u-surface, #fff) 96%, transparent); box-shadow: 0 -8px 18px rgba(16,44,70,.06); }
.feedback-consent-gate[hidden] { display: none !important; }
.feedback-consent-gate__label { display: flex; align-items: flex-start; gap: 8px; color: var(--u-ink-muted, #536d84); font-size: 11px; line-height: 1.35; }
.feedback-consent-gate__label input { flex: 0 0 auto; margin-top: 2px; }
.feedback-consent-gate__label a { color: #0369a1; }
.feedback-consent-gate__error { min-height: 0; margin: 0; color: #b42318; font-size: 11px; }
.feedback-consent-gate__button { min-height: 34px; border: 0; border-radius: 9px; background: #0369a1; color: #fff; font: 700 12px/1 inherit; cursor: pointer; }
html[data-theme="dark"] .feedback-consent-gate { background: #122332; border-color: #314b61; }
@media (max-width: 520px) {
  .feedback-launcher { right: 14px; bottom: 14px; min-height: 46px; padding: 0 14px; }
  .feedback-panel { right: 14px; bottom: 72px; width: calc(100vw - 28px); max-height: calc(100vh - 88px); }
}
@media (prefers-reduced-motion: reduce) {
  .feedback-panel, .feedback-launcher, .feedback-choice { transition: none; }
}
html[data-theme="dark"] .feedback-panel { border-color: #314b61; background: #122332; color: #eff7ff; }
html[data-theme="dark"] .feedback-form input, html[data-theme="dark"] .feedback-form textarea { background: #0d1b27; border-color: #365268; color: #eff7ff; }
html[data-theme="dark"] .feedback-choice { background: #172d3e; border-color: #365268; }
html[data-theme="dark"] .feedback-bubble--agent { background: #1b3548; color: #eff7ff; }
