/* TAS-2441 locked Feedback chat. The launcher is quiet; the modal is the only feedback surface. */
.feedback-launcher {
  position: fixed;
  right: max(var(--mf-space-6), env(safe-area-inset-right));
  bottom: max(var(--mf-space-6), env(safe-area-inset-bottom));
  z-index: 70;
  display: inline-flex;
  /* width/min-width/height opt out of the global `button` base (styles.css): its own
     min-width:132px/height:54px survive the class override, and its <=620px `button { width: 100% }`
     stretches this to the full viewport otherwise — see .mf-cash-withdraw for the same pattern. */
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 44px;
  align-items: center;
  gap: var(--mf-space-2);
  padding: 0 var(--mf-space-4);
  border: 1px solid var(--mf-border-strong);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-panel);
  box-shadow: var(--mf-shadow-sticky);
  color: var(--mf-text-primary);
  cursor: pointer;
  font: var(--mf-font-weight-semibold) var(--mf-font-size-body-sm)/1 var(--mf-font-sans);
}
.feedback-launcher:hover { border-color: var(--mf-signal-accent-ink); background: var(--mf-surface-hover); }
.feedback-launcher svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.feedback-launcher:disabled { cursor: default; opacity: .55; }

/* Let modal controls opt out of the legacy global CTA geometry; component rules below own their dimensions. */
.feedback-modal :where(button) {
  width: auto;
  min-width: 0;
  height: auto;
  padding: 0;
}

.feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--mf-space-6);
  background: rgba(17, 19, 22, .46);
}
.feedback-modal {
  display: flex;
  width: min(620px, 100%);
  max-height: min(760px, 100%);
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--mf-radius-lg);
  background: var(--mf-surface-panel);
  box-shadow: var(--mf-shadow-overlay);
  animation: feedback-modal-in 180ms cubic-bezier(.16, 1, .3, 1);
}
.feedback-modal:focus { outline: none; }
@keyframes feedback-modal-in { from { transform: translateY(10px) scale(.99); opacity: 0; } }
.feedback-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--mf-space-5);
  padding: var(--mf-space-6) var(--mf-space-6) var(--mf-space-5);
  border-bottom: 1px solid var(--mf-border-subtle);
}
.feedback-modal-actions { display: flex; align-items: center; gap: 5px; }
.feedback-quiet-action { min-height: 40px; padding: 0 9px; border: 0; border-radius: var(--mf-radius-xs); background: transparent; color: var(--mf-text-secondary); cursor: pointer; font-size: var(--mf-font-size-meta); font-weight: var(--mf-font-weight-semibold); }
.feedback-quiet-action:hover { background: var(--mf-surface-subtle); color: var(--mf-text-primary); }
.feedback-quiet-action:disabled { cursor: wait; opacity: .45; }
.feedback-modal-head h2 { margin: 0; color: var(--mf-text-strong); font-size: 1.4375rem; line-height: 1.2; text-wrap: balance; }
.feedback-close {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid var(--mf-border-default);
  border-radius: var(--mf-radius-sm);
  background: transparent;
  color: var(--mf-text-secondary);
  cursor: pointer;
}
.feedback-close:hover { border-color: var(--mf-border-strong); color: var(--mf-text-primary); }
.feedback-close:disabled { cursor: wait; opacity: .45; }
.feedback-close svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.feedback-modal-body { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
.feedback-form { display: flex; height: 100%; min-height: min(430px, 100%); flex-direction: column; }
.feedback-thread {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  align-content: start;
  gap: var(--mf-space-5);
  overflow-y: auto;
  padding: var(--mf-space-6);
  overscroll-behavior: contain;
}
.feedback-turn { display: grid; width: fit-content; max-width: 84%; gap: var(--mf-space-1); }
/* The heading is built in JS as a bare <h3>; without this it keeps the UA's 1em block margins and adds ~32px
   of dead space to the thread's own 20px grid gap. Matches .feedback-who so the list reads as one surface. */
.feedback-history-heading {
  margin: 0;
  color: var(--mf-text-secondary);
  font: var(--mf-font-weight-semibold) var(--mf-font-size-meta)/1.2 var(--mf-font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}
/* Rows are inset rather than flush to the thread's content edge: the padding is what makes each one read as a
   pressable item, and it survives the `.feedback-modal :where(button)` padding reset only by coming later. */
.feedback-history-row {
  display: grid;
  width: 100%;
  gap: 5px;
  padding: 13px var(--mf-space-4);
  border: 0;
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-subtle);
  color: var(--mf-text-primary);
  cursor: pointer;
  text-align: left;
}
.feedback-history-row:hover { background: var(--mf-surface-hover); }
.feedback-history-row strong { font-size: var(--mf-font-size-body-sm); font-weight: var(--mf-font-weight-semibold); overflow-wrap: anywhere; }
/* Status and date sit together under the title. `space-between` stretched them to opposite edges of a 572px
   row, leaving ~490px of gap between a 30px label and a 48px date. */
.feedback-history-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; color: var(--mf-text-secondary); font-size: var(--mf-font-size-meta); }
.feedback-history-empty { color: var(--mf-text-secondary); }
.feedback-turn-assistant { justify-self: start; }
.feedback-turn-user { justify-self: end; }
.feedback-who {
  color: var(--mf-text-secondary);
  font: var(--mf-font-weight-semibold) var(--mf-font-size-meta)/1.2 var(--mf-font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.feedback-turn-user .feedback-who { justify-self: end; }
.feedback-bubble { margin: 0; padding: 10px 12px; border-radius: var(--mf-radius-md); line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.feedback-turn-assistant .feedback-bubble { border: 1px solid var(--mf-border-subtle); background: var(--mf-surface-subtle); color: var(--mf-text-primary); }
.feedback-turn-user .feedback-bubble { background: var(--mf-text-strong); color: var(--mf-surface-panel); }
.feedback-suggestions { display: flex; max-width: 100%; flex-wrap: wrap; gap: var(--mf-space-2); }
.feedback-suggestions.feedback-scenarios { display: grid; width: min(100%, 470px); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feedback-suggestion {
  min-height: 40px;
  padding: var(--mf-space-2) var(--mf-space-3);
  border: 1px solid var(--mf-border-default);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-panel);
  color: var(--mf-text-primary);
  cursor: pointer;
  font: var(--mf-font-weight-semibold) var(--mf-font-size-body-sm)/1.35 var(--mf-font-sans);
  text-align: left;
}
.feedback-suggestion:hover { border-color: var(--mf-signal-accent-ink); background: var(--mf-surface-selected); }
.feedback-suggestion-primary { border-color: var(--mf-text-strong); background: var(--mf-text-strong); color: var(--mf-surface-panel); }
.feedback-suggestion-primary:hover { border-color: var(--mf-signal-accent-ink); background: var(--mf-signal-accent-ink); }
.feedback-composer { flex: 0 0 auto; padding: var(--mf-space-4) var(--mf-space-6) var(--mf-space-5); border-top: 1px solid var(--mf-border-subtle); background: var(--mf-surface-panel); }
.feedback-composer-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: end; gap: var(--mf-space-2); }
.feedback-composer textarea {
  display: block;
  width: 100%;
  min-height: 70px;
  max-height: 150px;
  resize: vertical;
  border: 1px solid var(--mf-border-default);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-raised);
  padding: 11px 12px;
  color: var(--mf-text-primary);
  font: inherit;
  line-height: 1.5;
}
.feedback-composer textarea::placeholder { color: var(--mf-text-disabled); }
.feedback-composer textarea:focus { border-color: var(--mf-signal-accent-ink); outline: 2px solid var(--mf-surface-selected); outline-offset: 1px; }
.feedback-send-message {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--mf-text-strong);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-text-strong);
  color: var(--mf-surface-panel);
  cursor: pointer;
}
.feedback-send-message:hover { border-color: var(--mf-signal-accent-ink); background: var(--mf-signal-accent-ink); }
.feedback-send-message:disabled { cursor: wait; opacity: .45; }
.feedback-send-message svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.feedback-input-note { margin: var(--mf-space-2) 0 0; color: var(--mf-text-secondary); font-size: var(--mf-font-size-meta); }
.feedback-error { margin: var(--mf-space-5) var(--mf-space-6) 0; padding: 10px 12px; border-radius: var(--mf-radius-xs); background: color-mix(in srgb, var(--mf-status-negative) 10%, transparent); color: var(--mf-status-negative-text); font-size: var(--mf-font-size-body-sm); font-weight: var(--mf-font-weight-semibold); }
.feedback-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.feedback-sending, .feedback-success, .feedback-unconfirmed { display: grid; min-height: 360px; place-items: center; padding: var(--mf-space-8); text-align: center; }
.feedback-sending-inner, .feedback-success-inner, .feedback-unconfirmed-inner { max-width: 320px; }
.feedback-unconfirmed h3 { margin: 0; color: var(--mf-text-strong); font-size: var(--mf-font-size-title-md); }
.feedback-unconfirmed p { margin: var(--mf-space-2) 0 0; color: var(--mf-text-secondary); }
.feedback-spinner { width: 38px; height: 38px; margin: 0 auto var(--mf-space-5); border: 3px solid var(--mf-border-default); border-top-color: var(--mf-signal-accent-ink); border-radius: 50%; animation: feedback-spin 720ms linear infinite; }
@keyframes feedback-spin { to { transform: rotate(360deg); } }
.feedback-sending h3, .feedback-success h3 { margin: 0; color: var(--mf-text-strong); font-size: var(--mf-font-size-title-md); }
.feedback-sending p, .feedback-success p { margin: var(--mf-space-2) 0 0; color: var(--mf-text-secondary); }
.feedback-success-mark { display: grid; width: 56px; height: 56px; margin: 0 auto var(--mf-space-5); place-items: center; border-radius: var(--mf-radius-round); background: color-mix(in srgb, var(--mf-status-positive) 11%, transparent); color: var(--mf-status-positive-text); }
.feedback-success-mark svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.feedback-ticket-number { color: var(--mf-text-strong) !important; font: var(--mf-font-weight-semibold) 18px/1.2 var(--mf-font-mono); }
.feedback-done { min-height: 42px; margin-top: var(--mf-space-5); padding: 0 var(--mf-space-4); border: 1px solid var(--mf-text-strong); border-radius: var(--mf-radius-sm); background: var(--mf-text-strong); color: var(--mf-surface-panel); cursor: pointer; font: var(--mf-font-weight-semibold) var(--mf-font-size-body-sm)/1 var(--mf-font-sans); }
.feedback-done:hover { border-color: var(--mf-signal-accent-ink); background: var(--mf-signal-accent-ink); }

@media (max-width: 639px) {
  /* Collapses to an icon-only circle so the label doesn't compete with page content on a phone screen; the
     label stays in the DOM as the button's accessible name (sr-only clip), it just stops being painted. */
  .feedback-launcher {
    right: var(--mf-space-4);
    bottom: max(var(--mf-space-4), env(safe-area-inset-bottom));
    /* The global `button` base rule (styles.css) sets min-width: 132px and height: 54px — both need an
       explicit override here, not just width/min-height, or they win the used size regardless of this rule's
       higher specificity (min/max-width and an explicit height are never beaten by a plain width/min-height). */
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .feedback-launcher span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .feedback-backdrop { align-items: flex-end; padding: 0; }
  .feedback-modal { width: 100%; height: 100%; max-height: none; border-radius: 0; animation-name: feedback-sheet-in; }
  @keyframes feedback-sheet-in { from { transform: translateY(16px); opacity: 0; } }
  .feedback-modal-head { gap: var(--mf-space-1); padding: 17px var(--mf-space-4) 15px; }
  .feedback-modal-actions { margin-left: auto; }
  .feedback-quiet-action { padding-inline: 5px; font-size: 11px; }
  .feedback-thread { padding: var(--mf-space-5) var(--mf-space-4); }
  .feedback-history-row { padding: 13px var(--mf-space-3); }
  .feedback-composer { padding: 14px var(--mf-space-4) max(14px, env(safe-area-inset-bottom)); }
  .feedback-suggestion { min-height: 44px; }
  .feedback-suggestions.feedback-scenarios { grid-template-columns: 1fr; }
}
@media (forced-colors: active) {
  .feedback-modal, .feedback-suggestion, .feedback-turn-assistant .feedback-bubble, .feedback-success-mark { border: 1px solid CanvasText; }
  .feedback-history-row { border: 1px solid CanvasText; }
  .feedback-spinner { border-color: CanvasText; }
}
@media (prefers-reduced-motion: reduce) {
  .feedback-modal, .feedback-spinner { animation: none; }
}
