.toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 300;
  display: grid;
  gap: 7px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

.toast-stack:has(.toast-message.confirm) {
  z-index: 300;
}

.toast-message {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(21, 149, 107, 0.18) 0 6px, transparent 6px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.98)),
    var(--surface);
  box-shadow: 0 18px 44px rgba(31, 45, 68, 0.14), 0 2px 7px rgba(31, 45, 68, 0.06);
  color: var(--text);
  padding: 9px 9px 9px 13px;
  pointer-events: auto;
  transform: translateY(calc(var(--toast-index, 0) * 1px));
}

.toast-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(21, 149, 107, 0.16);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.toast-message.error {
  background:
    linear-gradient(90deg, rgba(194, 65, 65, 0.18) 0 6px, transparent 6px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.98)),
    var(--surface);
}

.toast-message.error .toast-icon {
  border-color: rgba(194, 65, 65, 0.16);
  background: var(--red-soft);
  color: var(--red);
}

.toast-message.confirm {
  background:
    linear-gradient(90deg, rgba(183, 121, 31, 0.2) 0 6px, transparent 6px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.98)),
    var(--surface);
}

.toast-message.confirm .toast-icon {
  border-color: rgba(183, 121, 31, 0.18);
  background: var(--amber-soft);
  color: var(--amber);
}

.toast-title {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 820;
  letter-spacing: 0;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: normal;
}

.toast-content {
  min-width: 0;
}

.toast-error-details {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.toast-error-details summary {
  width: max-content;
  cursor: pointer;
  font-weight: 780;
  list-style-position: inside;
  user-select: none;
}

.toast-error-detail-panel {
  margin-top: 7px;
  border-top: 1px solid rgba(194, 65, 65, 0.15);
  padding-top: 7px;
}

.toast-error-detail-panel pre {
  max-height: min(240px, 36vh);
  margin: 0;
  overflow: auto;
  color: var(--text);
  font: 500 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: text;
  white-space: pre-wrap;
}

.toast-copy-action {
  margin-top: 7px;
  border: 1px solid rgba(194, 65, 65, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--red);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 780;
}

.toast-copy-action:hover {
  background: var(--red-soft);
}

.toast-message > button {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.toast-message > button:hover {
  border-color: rgba(203, 213, 225, 0.72);
  background: #f4f7fb;
  color: var(--text);
}

.toast-actions {
  grid-column: 2 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 1px;
}

.toast-actions button {
  min-height: 28px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: 8px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0;
}

.toast-message.prompt {
  align-items: start;
  width: min(480px, calc(100vw - 32px));
}

.toast-prompt-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.toast-prompt-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.toast-prompt-form input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.58);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
}

.toast-secondary-action {
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
}

.toast-danger-action {
  border-color: rgba(194, 65, 65, 0.18);
  background: var(--red-soft);
  color: var(--red);
}

.toast-primary-action {
  border-color: color-mix(in srgb, var(--blue) 24%, transparent);
  background: var(--blue);
  color: #ffffff;
}

.toast-actions button:hover {
  transform: translateY(-1px);
}

.tooltip-layer {
  overflow-wrap: anywhere;
  position: fixed;
  z-index: 1000;
  max-width: min(240px, calc(100vw - 20px));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  padding: 7px 9px;
  pointer-events: none;
  text-align: center;
  white-space: normal;
}

.tooltip-layer.tooltip-field-help {
  white-space: pre-wrap;
  text-align: left;
}

.tooltip-layer.task-summary {
  width: max-content;
  max-width: min(360px, calc(100vw - 20px));
  text-align: left;
}

.tooltip-task-title {
  display: block;
  max-width: 100%;
  text-align: left;
}

.tooltip-task-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px;
  margin-top: 6px;
}

.tooltip-task-chip {
  border-radius: 999px;
  background: #eef3f8;
  color: #516074;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.tooltip-arrow {
  position: absolute;
  bottom: -5px;
  width: 9px;
  height: 9px;
  background: rgba(17, 24, 39, 0.94);
  transform: translateX(-50%) rotate(45deg);
}

.tooltip-layer.below .tooltip-arrow {
  top: -5px;
  bottom: auto;
}

.error {
  margin-bottom: 14px;
  border: 1px solid #efb7b7;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  padding: 12px;
  font-weight: 750;
}

.empty-state {
  display: grid;
  place-items: center;
  border: 1px dashed #c5d0de;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  padding: 32px 20px;
  font-weight: 750;
  text-align: center;
}

.feedback-launcher {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 149;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 32px rgba(31, 45, 68, 0.17), 0 2px 7px rgba(31, 45, 68, 0.08);
  color: #1e3a8a;
  padding: 0 15px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}

.feedback-launcher:hover,
.feedback-launcher:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 15px 36px rgba(37, 99, 235, 0.18), 0 0 0 4px rgba(37, 99, 235, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.feedback-launcher .menu-svg-icon {
  width: 17px;
  height: 17px;
}

.feedback-dialog-backdrop {
  z-index: 230;
}

.feedback-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
}

.feedback-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, #eff6ff, #ffffff 74%);
  padding: 17px 18px 15px;
}

.feedback-dialog-header h2,
.feedback-dialog-header p {
  margin: 0;
}

.feedback-dialog-header h2 {
  color: var(--text);
  font-size: 20px;
  line-height: 1.3;
}

.feedback-dialog-header .section-kicker {
  margin-bottom: 3px;
}

.feedback-dialog-header h2 + p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.feedback-dialog-close {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid #d6dee9;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  padding: 0;
  place-items: center;
  font-size: 21px;
  line-height: 1;
}

.feedback-dialog-close:hover,
.feedback-dialog-close:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--blue);
  outline: none;
}

.feedback-dialog-body {
  display: grid;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px;
}

.feedback-category-fieldset {
  display: grid;
  gap: 7px;
  margin: 0;
  border: 0;
  padding: 0;
}

.feedback-category-fieldset legend,
.feedback-form-field > span {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.feedback-form-field b {
  margin-left: 4px;
  color: var(--red);
  font-size: 10px;
}

.feedback-category-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.feedback-category-options label {
  position: relative;
  display: grid;
  gap: 3px;
  border: 1px solid #d8e0eb;
  border-radius: 9px;
  background: #ffffff;
  padding: 11px 12px 11px 38px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.feedback-category-options label::before {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 14px;
  height: 14px;
  border: 2px solid #a5b4c7;
  border-radius: 999px;
  background: #ffffff;
  content: "";
}

.feedback-category-options label.active {
  border-color: #93c5fd;
  background: #f4f8ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.feedback-category-options label.active::before {
  border: 4px solid var(--blue);
}

.feedback-category-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.feedback-category-options strong {
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
}

.feedback-category-options span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.feedback-form-field {
  display: grid;
  gap: 7px;
}

.feedback-form-field input,
.feedback-form-field textarea {
  width: 100%;
}

.feedback-form-field textarea {
  resize: vertical;
}

.feedback-context-card,
.feedback-screenshot-card {
  display: grid;
  gap: 10px;
  border: 1px solid #dce5f0;
  border-radius: 9px;
  background: #f8fafc;
  padding: 12px;
}

.feedback-context-heading,
.feedback-screenshot-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-context-heading > div {
  display: grid;
  gap: 2px;
}

.feedback-context-heading strong,
.feedback-screenshot-heading > strong {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.feedback-context-heading span:not(.feedback-auto-badge) {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.feedback-auto-badge {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
}

.feedback-context-card dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.feedback-context-card dl > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 9px;
}

.feedback-context-card dt,
.feedback-context-card dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.feedback-context-card dt {
  color: #64748b;
  font-weight: 800;
}

.feedback-context-card dd {
  overflow: hidden;
  color: #334155;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-screenshot-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feedback-screenshot-card > img {
  display: block;
  width: 100%;
  max-height: 280px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  object-fit: contain;
}

.feedback-screenshot-placeholder {
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #64748b;
  padding: 28px 16px;
  text-align: center;
}

.feedback-screenshot-placeholder p,
.feedback-screenshot-note {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.feedback-screenshot-note {
  color: #64748b;
}

.feedback-capture-spinner {
  display: none;
  width: 22px;
  height: 22px;
  border: 3px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: feedback-spinner 700ms linear infinite;
}

.feedback-screenshot-placeholder.capturing .feedback-capture-spinner {
  display: block;
}

.feedback-screenshot-placeholder .secondary-button {
  margin-top: 2px;
}

@keyframes feedback-spinner {
  to { transform: rotate(360deg); }
}

.feedback-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  padding: 11px 18px 13px;
}

@media (max-width: 760px) {
  .feedback-launcher {
    right: 64px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    height: 40px;
    padding-inline: 12px;
  }

  .feedback-dialog-backdrop {
    align-items: end;
    padding: 12px 10px 0;
  }

  .feedback-dialog {
    max-height: calc(100vh - 12px);
    border-radius: 12px 12px 0 0;
  }

  .feedback-dialog-header,
  .feedback-dialog-body,
  .feedback-dialog-actions {
    padding-right: 14px;
    padding-left: 14px;
  }
}

@media (max-width: 520px) {
  .feedback-launcher span {
    display: none;
  }

  .feedback-launcher {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

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

  .feedback-context-card dl > div {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-capture-spinner {
    animation-duration: 1.4s;
  }
}

.tooltip-layer.tooltip-help {
  width: 360px;
  max-width: calc(100vw - 20px);
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: 10px;
  background: #172033;
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.tooltip-help-section + .tooltip-help-section {
  margin-top: 12px;
}

.tooltip-help-section strong,
.tooltip-help-section span {
  display: block;
}

.tooltip-help-section strong {
  margin-bottom: 3px;
  font-weight: 700;
}
