.amz-aikb-app {
  --amz-aikb-bg: #f6f3ee;
  --amz-aikb-panel: #fffdf9;
  --amz-aikb-ink: #1f2430;
  --amz-aikb-muted: #6b7280;
  --amz-aikb-line: #e6dfd4;
  --amz-aikb-accent: #c45c26;
  --amz-aikb-accent-ink: #fff;
  --amz-aikb-user: #2a3344;
  --amz-aikb-bot: #fff;
  /* Theme-aligned VIP palette (modown .vip-tag) */
  --amz-aikb-vip: #e0bf73;
  --amz-aikb-vip-grad: linear-gradient(90deg, rgba(240, 214, 141, 1) 0%, rgba(224, 191, 115, 1) 100%);
  --amz-aikb-vip-ink: #4e342e;
  --amz-aikb-sidebar-w: 240px;
  /* Assistant answers use the full available main-column width. */
  --amz-aikb-msg-max: 100%;
  position: relative;
  display: grid;
  grid-template-columns: var(--amz-aikb-sidebar-w) 1fr;
  gap: 0;
  height: var(--amz-aikb-height, 560px);
  max-height: 80vh;
  border: 1px solid var(--amz-aikb-line);
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(196, 92, 38, 0.08), transparent 50%),
    linear-gradient(180deg, var(--amz-aikb-bg), #efe9e0);
  color: var(--amz-aikb-ink);
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  transition: grid-template-columns 0.22s ease;
}

.amz-aikb-ai-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 1em;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.14em;
}

.amz-aikb-ai-icon--title {
  color: var(--amz-aikb-accent, #c45c26);
  font-size: 20px;
}

.amz-aikb-side-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.amz-aikb-sidebar {
  border-right: 1px solid var(--amz-aikb-line);
  background: rgba(255, 253, 249, 0.92);
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Grid items default to min-height:auto and silently overflow the fixed
     app height; 0 lets inner lists shrink and actually scroll. */
  min-height: 0;
  /* auto：避免 VIP/加油包过高时底边被 overflow:hidden 裁切 */
  overflow-x: hidden;
  overflow-y: auto;
  opacity: 1;
  transition: opacity 0.18s ease, border-color 0.18s ease;
}

/* Desktop: collapse whole sidebar — leave the grid so it takes no width. */
.amz-aikb-app.is-sidebar-collapsed {
  grid-template-columns: 1fr;
}

.amz-aikb-app.is-sidebar-collapsed .amz-aikb-sidebar {
  display: none;
}

/* Shortcode page fallback: expand control sits in a thin top tools row. */
.amz-aikb-main-tools {
  display: none;
  flex-shrink: 0;
  padding: 8px 14px 0;
}

.amz-aikb-main-tools:not([hidden]) {
  display: flex;
  align-items: center;
}

/* Drawer mode: sidebar toggle lives in drawer-head, hide in-app duplicates. */
.amz-aikb-drawer .amz-aikb-sidebar-toggle--inline,
.amz-aikb-drawer .amz-aikb-main-tools {
  display: none !important;
}

.amz-aikb-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 8px;
}

.amz-aikb-wallet {
  margin: 0 12px 10px;
  padding: 10px;
  background: #fff;
  border: 1px dashed var(--amz-aikb-line);
  font-size: 12px;
  line-height: 1.5;
  color: var(--amz-aikb-muted);
}

/* Numeric placeholders while bootstrap loads — chrome stays fully visible. */
.amz-aikb-skel {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.15em;
  border-radius: 4px;
  color: transparent;
  background: linear-gradient(90deg, #ece7e0 25%, #f7f3ed 50%, #ece7e0 75%);
  background-size: 200% 100%;
  animation: amz-aikb-skel 1.1s ease-in-out infinite;
  vertical-align: -0.05em;
  user-select: none;
}

.amz-aikb-skel-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: transparent;
  background: linear-gradient(90deg, #ece7e0 25%, #f7f3ed 50%, #ece7e0 75%);
  background-size: 200% 100%;
  animation: amz-aikb-skel 1.1s ease-in-out infinite;
  user-select: none;
}

@keyframes amz-aikb-skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.amz-aikb-wallet.is-loading .amz-aikb-wallet-total,
.amz-aikb-drawer-status.is-loading .amz-aikb-wallet-total {
  color: var(--amz-aikb-ink);
}

.amz-aikb-vip-upsell--skel {
  opacity: 0.92;
  pointer-events: none;
}

.amz-aikb-vip-upsell-cta--skel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  cursor: default;
}

.amz-aikb-packs.is-loading > summary.amz-aikb-packs-head {
  opacity: 0.85;
}

.amz-aikb-wallet-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--amz-aikb-ink);
}

.amz-aikb-wallet-total {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25em;
  margin: -2px -4px;
  padding: 2px 4px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
}

.amz-aikb-wallet-total-value {
  display: inline-block;
  min-width: 1.5ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.amz-aikb-wallet-total.is-gaining {
  animation: amz-aikb-wallet-total-gain 0.36s ease-out;
}

@keyframes amz-aikb-wallet-total-gain {
  0% {
    color: var(--amz-aikb-ink);
    background: transparent;
    box-shadow: 0 0 0 0 rgba(196, 92, 38, 0);
  }
  45% {
    color: var(--amz-aikb-accent);
    background: rgba(196, 92, 38, 0.12);
    box-shadow: 0 0 0 4px rgba(196, 92, 38, 0.08);
  }
  100% {
    color: var(--amz-aikb-ink);
    background: transparent;
    box-shadow: 0 0 0 0 rgba(196, 92, 38, 0);
  }
}

.amz-aikb-wallet-gain-feedback {
  position: fixed;
  z-index: 100070;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0;
  transform: translateY(7px) scale(0.94);
  padding: 6px 10px 6px 7px;
  border: 1px solid rgba(196, 92, 38, 0.28);
  border-radius: 10px;
  color: var(--amz-aikb-wallet-gain-accent, #c45c26);
  background: linear-gradient(180deg, #fffdf9 0%, #fff4e9 100%);
  box-shadow:
    0 8px 22px rgba(80, 45, 25, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  isolation: isolate;
  transition: opacity 0.2s ease-out, transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.amz-aikb-wallet-gain-feedback.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.amz-aikb-wallet-gain-feedback.is-leaving {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}

.amz-aikb-wallet-gain-mark {
  display: inline-grid;
  place-items: center;
  position: relative;
  z-index: 2;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #df8758, var(--amz-aikb-wallet-gain-accent, #c45c26));
  box-shadow: 0 3px 8px rgba(196, 92, 38, 0.25);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.amz-aikb-wallet-gain-amount {
  position: relative;
  z-index: 2;
  color: var(--amz-aikb-wallet-gain-accent, #c45c26);
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.amz-aikb-wallet-confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 100069;
  display: block;
  pointer-events: none;
}

body.night .amz-aikb-wallet-gain-feedback {
  border-color: rgba(239, 174, 105, 0.35);
  color: #ffd39f;
  background: linear-gradient(180deg, #3b2b22 0%, #2d221c 100%);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.night .amz-aikb-wallet-gain-amount {
  color: #ffd39f;
}

.amz-aikb-wallet-parts {
  color: var(--amz-aikb-muted);
  font-size: 12px;
  white-space: nowrap;
}

.amz-aikb-wallet-login-tip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.45;
  white-space: nowrap;
  color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.1);
  cursor: pointer;
}

.amz-aikb-wallet-login-tip:hover {
  background: rgba(196, 92, 38, 0.16);
}

.amz-aikb-mycred-exchange {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(196, 92, 38, 0.06);
  border: 1px solid rgba(196, 92, 38, 0.12);
  min-width: 0;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.amz-aikb-mycred-title {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--amz-aikb-text, #2a2118);
  white-space: nowrap;
}

.amz-aikb-mycred-meta {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--amz-aikb-muted);
}

/* 积分不足：紧凑状态卡，两行信息 */
.amz-aikb-mycred-exchange.is-short {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  background: linear-gradient(165deg, #fff8f0 0%, #fffdf9 70%);
  border-color: rgba(196, 92, 38, 0.2);
}

.amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--amz-aikb-muted);
  line-height: 1.2;
}

.amz-aikb-mycred-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.amz-aikb-mycred-info .amz-aikb-mycred-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  line-height: 1.3;
  font-size: 11px;
}

.amz-aikb-mycred-rate {
  color: var(--amz-aikb-muted);
}

.amz-aikb-mycred-bal {
  color: var(--amz-aikb-ink, #2a2118);
  font-weight: 600;
}

.amz-aikb-mycred-bal::before {
  content: '·';
  margin-right: 6px;
  font-weight: 400;
  color: var(--amz-aikb-muted);
  opacity: 0.55;
}

.amz-aikb-mycred-info .amz-aikb-mycred-max.is-short {
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  line-height: 1.3;
  font-size: 12px;
  font-weight: 700;
  color: var(--amz-aikb-accent, #c45c26);
}

.amz-aikb-mycred-info .amz-aikb-mycred-max.is-short em {
  font-style: normal;
  font-size: 1.08em;
}

.amz-aikb-mycred-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--amz-aikb-muted);
  white-space: nowrap;
}

.amz-aikb-mycred-points {
  width: 4.75em;
  min-width: 56px;
  max-width: 72px;
  height: 28px;
  margin: 0 4px;
  padding: 0 6px;
  border: 1px solid rgba(42, 33, 24, 0.14);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  box-sizing: border-box;
  -moz-appearance: textfield;
}

.amz-aikb-mycred-points::-webkit-outer-spin-button,
.amz-aikb-mycred-points::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amz-aikb-mycred-max.is-short {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--amz-aikb-muted);
}

.amz-aikb-mycred-submit {
  flex: 0 0 auto;
  height: 28px;
  min-width: 44px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

/* Nested under packs: secondary strip, collapsed by default */
.amz-aikb-get-points-exchange {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--amz-aikb-line);
}

.amz-aikb-get-points-exchange > summary.amz-aikb-packs-label {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px 0;
  user-select: none;
}

.amz-aikb-get-points-exchange > summary.amz-aikb-packs-label::-webkit-details-marker {
  display: none;
}

.amz-aikb-get-points-exchange > summary.amz-aikb-packs-label::after {
  content: '›';
  font-size: 13px;
  line-height: 1;
  color: var(--amz-aikb-muted);
  transition: transform 0.15s ease;
}

.amz-aikb-get-points-exchange[open] > summary.amz-aikb-packs-label::after {
  transform: rotate(90deg);
}

.amz-aikb-get-points-exchange[open] > summary.amz-aikb-packs-label {
  margin-bottom: 6px;
}

.amz-aikb-get-points-exchange .amz-aikb-mycred-exchange {
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--amz-aikb-line);
}

.amz-aikb-packs-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--amz-aikb-muted);
}

.amz-aikb-wallet-recharge {
  color: var(--amz-aikb-accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.amz-aikb-wallet-recharge:hover {
  text-decoration: underline;
}

.amz-aikb-wallet-links {
  margin-top: 6px;
}

/* VIP retrieval status: confirms that eligible article attachments are
   available to AI without requiring a prior download. */
.amz-aikb-vip-index-status {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(224, 191, 115, 0.66);
  border-radius: 10px;
  background: linear-gradient(145deg, #fff9e9 0%, #fffdf8 72%);
  color: var(--amz-aikb-ink);
  box-sizing: border-box;
}

.amz-aikb-vip-index-status__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(141, 110, 99, 0.12);
}

.amz-aikb-vip-index-status__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.amz-aikb-vip-index-status__copy strong {
  font-size: 12px;
  line-height: 1.35;
  color: var(--amz-aikb-vip-ink);
}

.amz-aikb-vip-index-status__copy small {
  font-size: 11px;
  line-height: 1.5;
  color: var(--amz-aikb-muted);
}

/* VIP upsell — no outer card frame; title / metric cards / CTA only */
.amz-aikb-vip-upsell {
  margin-top: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.amz-aikb-vip-upsell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.amz-aikb-vip-upsell-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--amz-aikb-ink);
  margin: 0;
  line-height: 1.3;
  min-width: 0;
}

.amz-aikb-vip-upsell-compare {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--amz-aikb-muted);
  cursor: pointer;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}

.amz-aikb-vip-upsell-compare:hover {
  color: var(--amz-aikb-accent);
}

.amz-aikb-vip-upsell-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.amz-aikb-vip-upsell-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 10px;
  border-radius: 10px;
  background: #f6f3ee;
  border: 1px solid transparent;
  min-width: 0;
}

.amz-aikb-vip-upsell-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--amz-aikb-vip-ink);
  background: var(--amz-aikb-vip-grad);
}

.amz-aikb-vip-upsell-badge--free {
  color: #fff;
  background: #9aa3ad;
  background-image: none;
}

.amz-aikb-vip-upsell-metric {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 4px;
  min-width: 0;
}

.amz-aikb-vip-upsell-metric strong {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--amz-aikb-ink);
  letter-spacing: -0.02em;
}

.amz-aikb-vip-upsell-metric em {
  font-style: normal;
  font-size: 11px;
  color: var(--amz-aikb-muted);
}

.amz-aikb-vip-upsell-cap {
  margin-top: 6px;
  font-size: 11px;
  color: var(--amz-aikb-muted);
  white-space: nowrap;
}

.amz-aikb-vip-upsell-col.is-vip {
  background: linear-gradient(165deg, #fff9e9 0%, #fff 70%);
  border-color: rgba(224, 191, 115, 0.7);
}

.amz-aikb-vip-upsell-col.is-vip .amz-aikb-vip-upsell-metric strong {
  color: var(--amz-aikb-vip-ink);
}

.amz-aikb-vip-upsell-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  color: var(--amz-aikb-vip-ink);
  background: var(--amz-aikb-vip);
  background-image: var(--amz-aikb-vip-grad);
  box-shadow: 0 1px 2px rgba(78, 52, 46, 0.08);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.amz-aikb-vip-upsell-cta:hover {
  filter: brightness(0.97);
  color: var(--amz-aikb-vip-ink);
  text-decoration: none;
}

.amz-aikb-vip-upsell-cta:active {
  transform: scale(0.98);
}

/* In-panel VIP guide sheet — overlays chat, does not navigate away. */
.amz-aikb-vip-guide {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(31, 36, 48, 0.35);
}

.amz-aikb-vip-guide-card {
  position: relative;
  width: min(340px, 100%);
  max-height: 90%;
  overflow: auto;
  background: #fffdf9;
  border: 1px solid rgba(224, 191, 115, 0.7);
  border-radius: 12px;
  padding: 18px 16px 14px;
  box-shadow: 0 12px 40px rgba(31, 36, 48, 0.18);
}

.amz-aikb-vip-guide-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: var(--amz-aikb-muted);
  cursor: pointer;
}

.amz-aikb-vip-guide-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
  font-size: 11px;
  font-weight: 700;
}

.amz-aikb-vip-guide-card > strong {
  display: block;
  font-size: 16px;
  color: var(--amz-aikb-ink);
  margin-bottom: 6px;
}

.amz-aikb-vip-guide-sub {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--amz-aikb-muted);
  line-height: 1.5;
}

.amz-aikb-vip-vs {
  margin: 0 0 14px;
  border: 1px solid rgba(224, 191, 115, 0.45);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.amz-aikb-vip-vs-head,
.amz-aikb-vip-vs-row {
  display: grid;
  grid-template-columns: 72px 1fr 28px 1fr;
  gap: 4px;
  align-items: center;
  padding: 8px 8px;
  font-size: 12px;
  line-height: 1.35;
}

.amz-aikb-vip-vs-head {
  background: rgba(224, 191, 115, 0.18);
  font-weight: 700;
  color: var(--amz-aikb-vip-ink);
  border-bottom: 1px solid rgba(224, 191, 115, 0.35);
}

.amz-aikb-vip-vs-row + .amz-aikb-vip-vs-row {
  border-top: 1px solid #f0ebe3;
}

.amz-aikb-vip-vs-label {
  color: var(--amz-aikb-muted);
  font-size: 11px;
}

.amz-aikb-vip-vs-free {
  color: #6b7280;
  text-align: center;
}

.amz-aikb-vip-vs-mid {
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--amz-aikb-vip-ink);
  opacity: 0.7;
}

.amz-aikb-vip-vs-vip {
  text-align: center;
  color: var(--amz-aikb-vip-ink);
  font-weight: 700;
  background: rgba(240, 214, 141, 0.22);
  border-radius: 6px;
  padding: 4px 4px;
}

.amz-aikb-vip-guide-card .amz-aikb-btn-vip {
  width: 100%;
  margin-bottom: 6px;
}

.amz-aikb-vip-guide-later {
  display: block;
  width: 100%;
  text-align: center;
  padding: 6px 0;
}

@media (max-width: 420px) {
  .amz-aikb-vip-vs-head,
  .amz-aikb-vip-vs-row {
    grid-template-columns: 64px 1fr 22px 1fr;
    padding: 7px 6px;
    font-size: 11px;
  }
}

/* —— Night mode: inherit the child theme's dark paper hierarchy —— */
body.night .amz-aikb-drawer-panel,
body.night .amz-aikb-app {
  color-scheme: dark;
  --amz-aikb-bg: #181a1f;
  --amz-aikb-panel: #22252b;
  --amz-aikb-ink: #e8ebf0;
  --amz-aikb-text: #e8ebf0;
  --amz-aikb-muted: #a0a7b2;
  --amz-aikb-line: #353a44;
  --amz-aikb-accent: #d4783f;
  --amz-aikb-accent-ink: #fff;
  --amz-aikb-user: #303744;
  --amz-aikb-bot: #292d34;
  --amz-aikb-vip-ink: #f1dfb5;
  --amz-aikb-billing-capsule-bg: linear-gradient(180deg, #292d34, #22252b);
}

body.night .amz-aikb-app {
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(212, 120, 63, 0.1), transparent 50%),
    linear-gradient(180deg, var(--amz-aikb-bg), #14161a);
}

body.night .amz-aikb-drawer-panel,
body.night .amz-aikb-drawer.is-fullscreen {
  background: #181a1f;
}

body.night .amz-aikb-drawer {
  background: rgba(7, 9, 12, 0.68);
}

body.night .amz-aikb-sidebar {
  background: rgba(30, 33, 39, 0.96);
}

body.night .amz-aikb-main,
body.night .amz-aikb-drawer .amz-aikb-app {
  background: var(--amz-aikb-panel);
}

body.night .amz-aikb-drawer-head,
body.night .amz-aikb-composer-tools,
body.night .amz-aikb-composer {
  background: rgba(34, 37, 43, 0.96);
  border-color: var(--amz-aikb-line);
}

body.night .amz-aikb-drawer-title strong,
body.night .amz-aikb-drawer-status,
body.night .amz-aikb-msg-assistant .amz-aikb-bubble h4,
body.night .amz-aikb-msg-assistant .amz-aikb-bubble strong {
  color: var(--amz-aikb-ink);
}

body.night .amz-aikb-drawer-fs,
body.night .amz-aikb-drawer-close {
  color: var(--amz-aikb-muted);
}

body.night .amz-aikb-wallet,
body.night .amz-aikb-sessions-head .amz-aikb-clear-sessions,
body.night .amz-aikb-sessions-head [data-action="clear-sessions"],
body.night .amz-aikb-sessions-head .amz-aikb-new-session,
body.night .amz-aikb-sessions-head [data-action="new-session"],
body.night .amz-aikb-packs > summary.amz-aikb-packs-head,
body.night .amz-aikb-exchange > summary.amz-aikb-exchange-head,
body.night .amz-aikb-packs-pop,
body.night .amz-aikb-packs-pop::after,
body.night .amz-aikb-exchange-pop,
body.night .amz-aikb-exchange-pop::after,
body.night .amz-aikb-packs .amz-aikb-pack-btn,
body.night .amz-aikb-mycred-points,
body.night .amz-aikb-vip-guide-card,
body.night .amz-aikb-vip-vs,
body.night .amz-aikb-gap-item,
body.night .amz-aikb-cite,
body.night .amz-aikb-card,
body.night .amz-aikb-scope-tab.is-active,
body.night .amz-aikb-scope-picker-trigger,
body.night .amz-aikb-scope-picker-menu,
body.night .amz-aikb-post-tools,
body.night .amz-aikb-post-tool,
body.night .amz-aikb-suggestion,
body.night .amz-aikb-followup,
body.night .amz-aikb-premium-toggle,
body.night .amz-aikb-login-wall__card,
body.night .amz-aikb-toast {
  background: var(--amz-aikb-panel);
  border-color: var(--amz-aikb-line);
  color: var(--amz-aikb-ink);
}

body.night .amz-aikb-msg-assistant .amz-aikb-bubble {
  background: var(--amz-aikb-bot);
}

body.night .amz-aikb-composer textarea {
  background: #1c1f25;
  border-color: var(--amz-aikb-line);
  color: var(--amz-aikb-ink);
  caret-color: var(--amz-aikb-accent);
}

body.night .amz-aikb-composer textarea::placeholder {
  color: #8f98a6;
}

body.night .amz-aikb-scope-tabs,
body.night .amz-aikb-premium-toggle .amz-aikb-premium-x {
  background: rgba(255, 255, 255, 0.06);
}

body.night .amz-aikb-scope-picker-opt:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.night .amz-aikb-packs .amz-aikb-pack-btn.has-deal,
body.night .amz-aikb-packs .amz-aikb-pack-btn.is-best,
body.night .amz-aikb-mycred-exchange.is-short,
body.night .amz-aikb-composer-tools--mobile-float .amz-aikb-packs > summary.amz-aikb-packs-head,
body.night .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange > summary.amz-aikb-exchange-head {
  background: linear-gradient(180deg, #292d34, #22252b);
}

body.night .amz-aikb-vip-upsell-col,
body.night .amz-aikb-vip-upsell-col.is-vip,
body.night .amz-aikb-vip-upsell--guest,
body.night .amz-aikb-vip-upsell:not(.amz-aikb-vip-upsell--guest),
body.night .amz-aikb-vip-upsell--slim {
  background: linear-gradient(165deg, #292d34, #22252b);
}

body.night .amz-aikb-vip-index-status {
  border-color: rgba(224, 191, 115, 0.44);
  background: linear-gradient(145deg, rgba(224, 191, 115, 0.16), rgba(35, 39, 46, 0.92));
}

body.night .amz-aikb-vip-index-status__copy strong {
  color: #f5e7c4;
}

body.night .amz-aikb-vip-index-status__copy small {
  color: #b9c0ca;
}

body.night .amz-aikb-gap {
  background: linear-gradient(165deg, #2b2725, #24272d 55%);
}

body.night .amz-aikb-gap-summary,
body.night .amz-aikb-gap-stats,
body.night .amz-aikb-vip-guide-inv,
body.night .amz-aikb-login-wall__benefits,
body.night .amz-aikb-vip-upsell--guest .amz-aikb-guest-benefits,
body.night .amz-aikb-cite-date,
body.night .amz-aikb-msg-assistant .amz-aikb-bubble em {
  color: var(--amz-aikb-muted);
}

body.night .amz-aikb-gap-compare {
  background: rgba(212, 120, 63, 0.1);
  color: #e2a27c;
}

body.night .amz-aikb-msg-assistant .amz-aikb-bubble em {
  background: rgba(212, 120, 63, 0.1);
}

body.night .amz-aikb-msg-assistant .amz-aikb-bubble code {
  background: rgba(255, 255, 255, 0.07);
  color: #dce2ea;
}

body.night .amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-article-link:visited {
  color: #bca4c8;
  text-decoration-color: rgba(188, 164, 200, 0.62);
}

body.night .amz-aikb-msg-error .amz-aikb-bubble {
  border-color: rgba(212, 120, 63, 0.38);
  background: #302522;
}

body.night .amz-aikb-login-wall {
  background: rgba(18, 20, 24, 0.82);
}

body.night .amz-aikb-app table,
body.night .amz-aikb-app th,
body.night .amz-aikb-app td {
  border-color: var(--amz-aikb-line);
}

body.night .amz-aikb-app th {
  background: #30353d;
  color: var(--amz-aikb-ink);
}

body.night .amz-aikb-app td {
  background: transparent;
  color: var(--amz-aikb-ink);
}

@property --amz-aikb-session-scrollbar-visibility {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

body.night .amz-aikb-sessions {
  scrollbar-color: rgb(160 167 178 / calc(0.38 * var(--amz-aikb-session-scrollbar-visibility))) transparent;
}

body.night .amz-aikb-messages {
  scrollbar-color: rgba(160, 167, 178, 0.38) transparent;
}

body.night .amz-aikb-sessions::-webkit-scrollbar-thumb {
  background: rgba(160, 167, 178, 0.34);
  opacity: var(--amz-aikb-session-scrollbar-visibility);
  border: 2px solid transparent;
  background-clip: content-box;
}

body.night .amz-aikb-messages::-webkit-scrollbar-thumb {
  background: rgba(160, 167, 178, 0.34);
  border: 2px solid transparent;
  background-clip: content-box;
}

body.night .amz-aikb-skel,
body.night .amz-aikb-skel-pill {
  background: linear-gradient(90deg, #2b3038 25%, #3a4049 50%, #2b3038 75%);
  background-size: 200% 100%;
}

/* Guide sheet needs a positioning context on the chat shell. */
.amz-aikb-app,
.amz-aikb-drawer-panel {
  position: relative;
}

.amz-aikb-side-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  /* Keep actions right-aligned when the drawer omits the sidebar title */
  margin-left: auto;
}

/* Identity badge in the sidebar head: username + VIP tier tag */
.amz-aikb-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--amz-aikb-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Shared VIP chip — same gold as theme .vip-tag */
.amz-aikb-vip-tag,
.amz-aikb-cite-badge--vip,
.amz-aikb-premium-lock {
  background: var(--amz-aikb-vip);
  background-image: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
  font-weight: 600;
}

.amz-aikb-vip-tag {
  flex-shrink: 0;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
}

.amz-aikb-vip-tag--none {
  background: #9aa3ad;
  background-image: none;
  color: #fff;
  font-weight: 600;
}

/* Citation access badges: what membership/purchase unlocked this source */
.amz-aikb-cite-badge {
  display: inline-block;
  margin-left: 0;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.6;
  vertical-align: 1px;
}

/* One shared "available to AI" mark across the drawer status and citations.
   The surrounding copy can differ, but the gold circular check stays stable. */
.amz-aikb-access-mark,
.amz-aikb-cite-badge--eligible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 999px;
  /* Drawer-header status lives outside .amz-aikb-app; fallbacks keep this
     shared mark visually identical in both DOM contexts. */
  background: var(--amz-aikb-vip-grad, linear-gradient(90deg, #f0d68d 0%, #e0bf73 100%));
  color: #4e342e;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(141, 110, 99, 0.12);
}

.amz-aikb-access-mark--large {
  flex-basis: 28px;
  width: 28px;
  height: 28px;
  font-size: 15px;
}

/* 已购：对齐主题 .bought / .comt-bought 绿色 #5cb85c */
.amz-aikb-cite-badge--bought {
  background: #5cb85c;
  background-image: none;
  color: #fff;
  font-weight: 600;
}

/* 免费资料：仅用于资料下载/数据交易栏目中价格与权限均确认免费的文章。 */
.amz-aikb-cite-badge--free {
  border: 1px solid #b8ddc0;
  background: #edf8ef;
  background-image: none;
  color: #28783a;
  font-weight: 700;
}

.amz-aikb-side-toggle {
  display: none;
}

.amz-aikb-toast {
  /* Above composer-tools (z-index 8) so tips are not sliced by the input bar */
  position: absolute;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(320px, 86%);
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(29, 36, 51, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(20, 24, 32, 0.22);
  pointer-events: none;
  animation: amz-aikb-toast-in 0.18s ease;
}

.amz-aikb-drawer-panel > .amz-aikb-toast,
.amz-aikb-main > .amz-aikb-toast {
  z-index: 80;
}

@keyframes amz-aikb-toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.amz-aikb-app.is-busy .amz-aikb-session-btn,
.amz-aikb-app.is-busy .amz-aikb-session-del,
.amz-aikb-app.is-busy [data-action="new-session"],
.amz-aikb-app.is-busy [data-action="clear-sessions"] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Guest: 清空 / 新会话不可用（点击由 JS 引导登录） */
.amz-aikb-app.is-guest [data-action="new-session"],
.amz-aikb-app.is-guest [data-action="clear-sessions"],
.amz-aikb-app [data-action="new-session"].is-guest-locked,
.amz-aikb-app [data-action="clear-sessions"].is-guest-locked {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(107, 114, 128, 0.28) !important;
  color: #9ca3af !important;
  background: #f3f4f6 !important;
}

.amz-aikb-app.is-guest [data-action="new-session"]:hover,
.amz-aikb-app.is-guest [data-action="clear-sessions"]:hover,
.amz-aikb-app [data-action="new-session"].is-guest-locked:hover,
.amz-aikb-app [data-action="clear-sessions"].is-guest-locked:hover {
  border-color: rgba(107, 114, 128, 0.28) !important;
  color: #9ca3af !important;
  background: #f3f4f6 !important;
}

.amz-aikb-sessions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px 4px;
  font-size: 12px;
  color: var(--amz-aikb-muted);
}

/* Guest sidebar has no wallet row; keep the history controls off the top edge. */
.amz-aikb-side-head + .amz-aikb-session-bar + .amz-aikb-sessions-head {
  margin-top: 8px;
}

.amz-aikb-sessions-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 新会话保留主操作胶囊样式 */
.amz-aikb-sessions-head .amz-aikb-clear-sessions,
.amz-aikb-sessions-head [data-action="clear-sessions"],
.amz-aikb-sessions-head .amz-aikb-new-session,
.amz-aikb-sessions-head [data-action="new-session"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 24px;
  padding: 2px 10px;
  border: 1px solid rgba(196, 92, 38, 0.35);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--amz-aikb-accent) !important;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.amz-aikb-sessions-head .amz-aikb-new-session:hover,
.amz-aikb-sessions-head [data-action="new-session"]:hover {
  border-color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.08);
  color: #a3491a !important;
}

/* 清空是低频破坏性操作，保留触控区但降低视觉优先级。 */
.amz-aikb-sessions-head .amz-aikb-clear-sessions,
.amz-aikb-sessions-head [data-action="clear-sessions"] {
  padding-inline: 7px;
  border-color: transparent;
  background: transparent;
  color: var(--amz-aikb-muted) !important;
  font-weight: 600;
}

.amz-aikb-sessions-head .amz-aikb-clear-sessions:hover,
.amz-aikb-sessions-head [data-action="clear-sessions"]:hover {
  border-color: transparent;
  background: rgba(179, 60, 54, 0.08);
  color: #a63b36 !important;
}

body.night .amz-aikb-sessions-head .amz-aikb-clear-sessions,
body.night .amz-aikb-sessions-head [data-action="clear-sessions"] {
  border-color: transparent;
  background: transparent;
  color: var(--amz-aikb-muted) !important;
}

body.night .amz-aikb-sessions-head .amz-aikb-clear-sessions:hover,
body.night .amz-aikb-sessions-head [data-action="clear-sessions"]:hover {
  border-color: transparent;
  background: rgba(226, 105, 95, 0.12);
  color: #efaaa4 !important;
}

/* 无历史会话：清空不可点 */
.amz-aikb-sessions-head [data-action="clear-sessions"]:disabled,
.amz-aikb-sessions-head [data-action="clear-sessions"].is-empty-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(107, 114, 128, 0.28) !important;
  color: #9ca3af !important;
  background: #f3f4f6 !important;
}

.amz-aikb-sessions-head [data-action="clear-sessions"]:disabled:hover,
.amz-aikb-sessions-head [data-action="clear-sessions"].is-empty-disabled:hover {
  border-color: rgba(107, 114, 128, 0.28) !important;
  color: #9ca3af !important;
  background: #f3f4f6 !important;
}

.amz-aikb-sessions {
  list-style: none;
  margin: 0;
  padding: 0 8px 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.amz-aikb-sessions li {
  position: relative;
  display: flex;
  align-items: stretch;
}

.amz-aikb-sessions li .amz-aikb-session-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 4px 9px 10px;
  cursor: pointer;
  color: var(--amz-aikb-ink);
  border-radius: 8px;
  font-size: 13px;
}

.amz-aikb-session-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.amz-aikb-session-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-top: 3px;
  gap: 5px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--amz-aikb-muted);
}

.amz-aikb-session-intent {
  flex: 0 0 auto;
  color: inherit;
  font-weight: 400;
}

.amz-aikb-session-meta-separator {
  flex: 0 0 auto;
  opacity: 0.68;
}

.amz-aikb-session-time {
  display: inline;
  min-width: 0;
  font-size: inherit;
  color: inherit;
}

.amz-aikb-sessions li .amz-aikb-session-btn:hover,
.amz-aikb-sessions li .amz-aikb-session-btn.is-active {
  background: rgba(196, 92, 38, 0.1);
}

.amz-aikb-sessions li.amz-aikb-sessions-more {
  justify-content: center;
  padding: 6px 0 2px;
}

.amz-aikb-sessions-more-btn {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--amz-aikb-muted);
  font-size: 12px;
  cursor: pointer;
}

.amz-aikb-sessions-more-btn:hover:not(:disabled) {
  background: rgba(196, 92, 38, 0.08);
  color: #a3491a;
}

.amz-aikb-sessions-more-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.amz-aikb-session-del {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--amz-aikb-muted);
  font-size: 15px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.amz-aikb-sessions li:hover .amz-aikb-session-del {
  opacity: 1;
}

.amz-aikb-session-del:hover {
  background: rgba(196, 92, 38, 0.12);
  color: var(--amz-aikb-accent);
}

/* Packs trigger in composer-tools; options open as a floating popover */
.amz-aikb-packs {
  position: relative;
  flex: 0 0 auto;
  min-width: auto;
  margin: 0;
  padding: 0;
  font-size: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  z-index: 6;
}

.amz-aikb-packs.amz-aikb-billing--stow,
.amz-aikb-exchange.amz-aikb-billing--stow {
  display: none !important;
}

.amz-aikb-packs > summary.amz-aikb-packs-head {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0;
  padding: 3px 10px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 999px;
  background: #fff;
  line-height: 1.3;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.amz-aikb-packs > summary.amz-aikb-packs-head:hover {
  border-color: rgba(196, 92, 38, 0.45);
}

.amz-aikb-packs > summary.amz-aikb-packs-head::-webkit-details-marker {
  display: none;
}

.amz-aikb-packs > summary.amz-aikb-packs-head::after {
  content: '›';
  flex-shrink: 0;
  margin-left: 2px;
  color: var(--amz-aikb-muted);
  font-size: 13px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.amz-aikb-packs[open] > summary.amz-aikb-packs-head {
  margin-bottom: 0;
  border-color: rgba(196, 92, 38, 0.45);
  background: rgba(196, 92, 38, 0.06);
}

.amz-aikb-packs[open] > summary.amz-aikb-packs-head::after {
  transform: rotate(90deg);
}

.amz-aikb-packs-head strong {
  color: var(--amz-aikb-ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.amz-aikb-packs-hint {
  color: var(--amz-aikb-muted);
  font-size: 11px;
  white-space: nowrap;
}

/* Capsule still too wide → drop「长期有效」 */
.amz-aikb-packs.amz-aikb-packs--tight > summary .amz-aikb-packs-hint {
  display: none !important;
}

.amz-aikb-packs[open] .amz-aikb-packs-hint {
  color: var(--amz-aikb-accent);
  font-weight: 600;
}

.amz-aikb-packs-pop {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: min(360px, calc(100vw - 28px));
  height: auto;
  max-height: none;
  /* Scroll the inner scroller if needed — not the outer frame.
     Outer overflow:visible so the ::after caret doesn't create a phantom scrollbar. */
  overflow: visible;
  padding: 8px;
  border: 1px solid rgba(196, 92, 38, 0.28);
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 14px 36px rgba(31, 36, 48, 0.18);
  box-sizing: border-box;
  animation: amz-aikb-packs-pop-in 0.16s ease;
}

.amz-aikb-packs[open] > .amz-aikb-packs-pop {
  display: block;
}

.amz-aikb-packs-pop::after {
  content: '';
  position: absolute;
  left: var(--amz-aikb-pop-caret, 18px);
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: #fffdf9;
  border-right: 1px solid rgba(196, 92, 38, 0.28);
  border-bottom: 1px solid rgba(196, 92, 38, 0.28);
  transform: rotate(45deg);
}

@keyframes amz-aikb-packs-pop-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.amz-aikb-packs-scroller {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 0;
}

/* Independent exchange fold (sibling of packs) */
.amz-aikb-exchange {
  position: relative;
  flex: 0 0 auto;
  min-width: auto;
  margin: 0;
  z-index: 6;
}

.amz-aikb-exchange[hidden] {
  display: none !important;
}

.amz-aikb-exchange--guest > summary.amz-aikb-exchange-head {
  opacity: 0.92;
  cursor: pointer;
}

/* Match 加油包 square card (not the old pill capsule) */
.amz-aikb-exchange > summary.amz-aikb-exchange-head {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 2px;
  box-sizing: border-box;
  width: 118px;
  min-width: 118px;
  height: var(--amz-aikb-pack-row-h, 48px);
  min-height: var(--amz-aikb-pack-row-h, 48px);
  max-height: var(--amz-aikb-pack-row-h, 48px);
  margin: 0;
  padding: 0 6px;
  border: 1px solid rgba(196, 92, 38, 0.45);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff8f1, #fff);
  box-shadow: inset 0 0 0 1px rgba(196, 92, 38, 0.08);
  line-height: 1.15;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.amz-aikb-exchange > summary.amz-aikb-exchange-head:hover {
  border-color: var(--amz-aikb-accent);
}

.amz-aikb-exchange > summary.amz-aikb-exchange-head::-webkit-details-marker {
  display: none;
}

.amz-aikb-exchange > summary.amz-aikb-exchange-head::after {
  display: none;
}

.amz-aikb-exchange[open] > summary.amz-aikb-exchange-head {
  border-color: var(--amz-aikb-accent);
  background: linear-gradient(180deg, #fff4ea, #fff);
}

.amz-aikb-exchange-head strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--amz-aikb-accent);
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

.amz-aikb-exchange-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--amz-aikb-muted);
  line-height: 1.2;
  white-space: nowrap;
}

.amz-aikb-exchange-pop {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: max-content;
  max-width: calc(100vw - 28px);
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 8px;
  border: 1px solid rgba(196, 92, 38, 0.28);
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 14px 36px rgba(31, 36, 48, 0.18);
  box-sizing: border-box;
}

/* Same bubble caret as packs-pop — points down to the capsule */
.amz-aikb-exchange-pop::after {
  content: '';
  position: absolute;
  left: var(--amz-aikb-pop-caret, 18px);
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: #fffdf9;
  border-right: 1px solid rgba(196, 92, 38, 0.28);
  border-bottom: 1px solid rgba(196, 92, 38, 0.28);
  transform: rotate(45deg);
}

.amz-aikb-exchange-pop .amz-aikb-mycred-exchange,
.amz-aikb-packs-pop .amz-aikb-mycred-exchange {
  margin: 0;
}

/* Capsule already says「积分兑」— hide duplicate title inside the popover */
.amz-aikb-exchange-pop .amz-aikb-mycred-title,
.amz-aikb-packs-pop .amz-aikb-mycred-title {
  display: none !important;
}

/* Popover hugs input + 兑换 */
.amz-aikb-exchange-pop .amz-aikb-mycred-exchange:not(.is-short) {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  gap: 8px;
  padding: 6px 8px;
}

/* 「还差 N 积分」：单行紧凑，避免空高弹层 */
.amz-aikb-exchange-pop .amz-aikb-mycred-exchange.is-short {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 8px 12px;
  gap: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.amz-aikb-exchange-pop .amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-info {
  flex: 0 0 auto;
  align-items: center;
  gap: 0;
}

.amz-aikb-exchange-pop .amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-meta {
  display: none !important;
}

.amz-aikb-exchange-pop .amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-max.is-short {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--amz-aikb-accent, #c45c26);
  white-space: nowrap;
}

.amz-aikb-exchange[open] > .amz-aikb-exchange-pop {
  display: block;
}

/* Spread mode: content only — hide capsules while inline */
.amz-aikb-packs--inline,
.amz-aikb-exchange--inline {
  --amz-aikb-pack-row-h: var(--amz-aikb-toolbar-control-h, 32px);
  display: block;
  z-index: 2;
}

/* Must beat `.amz-aikb-composer-tools .amz-aikb-packs { flex: 0 1 auto }` */
.amz-aikb-composer-tools .amz-aikb-packs.amz-aikb-packs--inline {
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 342px;
  max-width: none;
}

.amz-aikb-composer-tools .amz-aikb-exchange.amz-aikb-exchange--inline {
  flex: 0 0 auto;
  flex-shrink: 0;
  /* input(4位) +「兑换」；原 110/118 会裁掉按钮 */
  min-width: 156px;
  max-width: none;
}

.amz-aikb-packs--inline > summary.amz-aikb-packs-head,
.amz-aikb-exchange--inline > summary.amz-aikb-exchange-head {
  display: none !important;
}

.amz-aikb-packs--inline > .amz-aikb-packs-pop,
.amz-aikb-packs--inline[open] > .amz-aikb-packs-pop,
.amz-aikb-exchange--inline > .amz-aikb-exchange-pop,
.amz-aikb-exchange--inline[open] > .amz-aikb-exchange-pop {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  position: static;
  left: auto;
  bottom: auto;
  width: auto;
  max-width: none;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.amz-aikb-packs--inline > .amz-aikb-packs-pop::after,
.amz-aikb-exchange--inline > .amz-aikb-exchange-pop::after {
  display: none;
}

.amz-aikb-packs--inline .amz-aikb-packs-scroller {
  flex: 0 0 auto;
  min-width: 342px; /* 3×110 + 2×6 — do not crush into exchange */
  height: var(--amz-aikb-pack-row-h);
  grid-template-columns: repeat(3, 110px);
  gap: 6px;
}

.amz-aikb-packs--inline .amz-aikb-pack-btn {
  height: var(--amz-aikb-pack-row-h);
  min-height: var(--amz-aikb-pack-row-h);
  max-height: var(--amz-aikb-pack-row-h);
  padding: 0 6px;
  box-sizing: border-box;
  justify-content: center;
}

/* Show best-deal only; hover / focus / 触屏点按把其余档叠在当前档上方（底边锚点不变） */
.amz-aikb-composer-tools .amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack {
  position: relative;
  min-width: 118px;
  width: 118px;
  z-index: 8;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack > .amz-aikb-packs-pop {
  /* Fixed slot: current pack stays put; expanded list grows upward from here */
  position: relative;
  display: block;
  width: 118px;
  min-width: 118px;
  height: var(--amz-aikb-pack-row-h);
  min-height: var(--amz-aikb-pack-row-h);
  max-height: var(--amz-aikb-pack-row-h);
  overflow: visible;
  align-items: stretch;
}

/* Native merged exchange shares the desktop stack row with the recommended
   pack. Keep both controls inside the toolbar instead of letting the exchange
   form overflow downward into the composer. */
.amz-aikb-composer-tools
  .amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack.amz-aikb-packs--has-exchange {
  min-width: 280px;
  width: 280px;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack.amz-aikb-packs--has-exchange
  > .amz-aikb-packs-pop {
  width: 280px;
  min-width: 280px;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack.amz-aikb-packs--has-exchange
  > .amz-aikb-packs-pop
  > .amz-aikb-merged-exchange[data-native-exchange="1"] {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 156px;
  height: var(--amz-aikb-pack-row-h);
  margin: 0;
  padding: 0;
  border: 0;
  z-index: 1;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack.amz-aikb-packs--has-exchange
  .amz-aikb-merged-exchange[data-native-exchange="1"]
  .amz-aikb-packs-label {
  display: none;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-packs-scroller {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 118px;
  min-width: 118px;
  height: var(--amz-aikb-pack-row-h);
  min-height: var(--amz-aikb-pack-row-h);
  max-height: none;
  grid-template-columns: unset;
  gap: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: visible;
  z-index: 1;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-btn {
  --amz-aikb-pack-badge-reserve: 58px;
  flex: 0 0 auto;
  order: 1;
  width: 100%;
}

/* Desktop stack cards are only 118px wide. Reserve the right corner for the
   unit-price badge so both rows remain readable without increasing card height. */
.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-points,
.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-sub {
  align-self: flex-start;
  width: calc(100% - var(--amz-aikb-pack-badge-reserve));
  box-sizing: border-box;
  text-align: center;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-sub {
  justify-content: center;
}

/* Keep best / solo at the bottom of the column (= original slot) */
.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-btn.is-best,
.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-btn.amz-aikb-pack-btn--solo {
  order: 10;
}

/* Only hide extras when collapsed — :not() must not outrank reveal rules */
.amz-aikb-packs--inline.amz-aikb-packs--stack:not(:hover):not(:focus-within):not(.is-expanded)
  .amz-aikb-pack-btn:not(.is-best):not(.amz-aikb-pack-btn--solo) {
  display: none;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack:hover,
.amz-aikb-packs--inline.amz-aikb-packs--stack:focus-within,
.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded {
  z-index: 80;
}

/* Expand upward from the fixed anchor. The group panel is painted separately
   so the recommended pack keeps the exact collapsed position and dimensions. */
.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:hover .amz-aikb-packs-scroller,
.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:focus-within .amz-aikb-packs-scroller,
.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded .amz-aikb-packs-scroller {
  left: 0;
  bottom: 0;
  height: auto;
  min-height: var(--amz-aikb-pack-row-h);
  max-height: none;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  z-index: 70;
}

.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-packs-scroller::before {
  content: none;
  position: absolute;
  inset: -7px;
  z-index: -1;
  pointer-events: none;
  border: 1px solid var(--amz-aikb-line, #e6dfd4);
  border-radius: 13px;
  background: var(--amz-aikb-panel, #fffdf9);
  box-shadow: 0 10px 28px rgba(31, 36, 48, 0.14);
}

.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:focus-within .amz-aikb-packs-scroller::before,
.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded .amz-aikb-packs-scroller::before {
  content: "";
}

@media (hover: hover) {
  .amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:hover .amz-aikb-packs-scroller::before {
    content: "";
  }
}

.amz-aikb-packs--inline.amz-aikb-packs--stack:hover .amz-aikb-pack-btn,
.amz-aikb-packs--inline.amz-aikb-packs--stack:focus-within .amz-aikb-pack-btn,
.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded .amz-aikb-pack-btn {
  display: flex;
}

/* Soft lift on the revealed cards only — anchor (best/solo) stays unchanged */
.amz-aikb-packs--inline.amz-aikb-packs--stack:hover
  .amz-aikb-pack-btn:not(.is-best):not(.amz-aikb-pack-btn--solo),
.amz-aikb-packs--inline.amz-aikb-packs--stack:focus-within
  .amz-aikb-pack-btn:not(.is-best):not(.amz-aikb-pack-btn--solo),
.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded
  .amz-aikb-pack-btn:not(.is-best):not(.amz-aikb-pack-btn--solo) {
  box-shadow: 0 4px 12px rgba(31, 36, 48, 0.12);
  animation: amz-aikb-pack-stack-in 0.18s ease-out both;
}

@keyframes amz-aikb-pack-stack-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* The visible anchor must not jump when the pointer opens the stack. */
.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-btn.is-best:hover,
.amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-btn.amz-aikb-pack-btn--solo:hover {
  transform: none;
}

@media (hover: none) {
  /* Touch: tap pack to expand; desktop uses hover */
  .amz-aikb-packs--inline.amz-aikb-packs--stack:not(.is-expanded):hover .amz-aikb-packs-scroller {
    height: var(--amz-aikb-pack-row-h);
    min-height: var(--amz-aikb-pack-row-h);
    max-height: var(--amz-aikb-pack-row-h);
    gap: 0;
    z-index: 1;
  }

  .amz-aikb-packs--inline.amz-aikb-packs--stack:not(.is-expanded)
    .amz-aikb-pack-btn:not(.is-best):not(.amz-aikb-pack-btn--solo) {
    display: none;
  }

  .amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded .amz-aikb-packs-scroller {
    height: auto;
    min-height: var(--amz-aikb-pack-row-h);
    max-height: none;
    gap: 6px;
    z-index: 70;
  }

  .amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded .amz-aikb-pack-btn {
    display: flex;
  }
}

/* 积分兑 stack：底边锚定；宽度需容纳输入 +「兑换」 */
.amz-aikb-composer-tools .amz-aikb-exchange.amz-aikb-exchange--inline.amz-aikb-exchange--stack {
  position: relative;
  min-width: 156px;
  width: 156px;
  z-index: 7;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack > .amz-aikb-exchange-pop {
  position: relative;
  display: block;
  width: 156px;
  min-width: 156px;
  height: var(--amz-aikb-pack-row-h);
  min-height: var(--amz-aikb-pack-row-h);
  max-height: var(--amz-aikb-pack-row-h);
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack .amz-aikb-mycred-exchange {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  width: 156px;
  min-width: 156px;
  min-height: var(--amz-aikb-pack-row-h);
  max-height: none;
  height: auto;
  margin: 0;
  padding: 4px 8px;
  gap: 6px;
  overflow: visible;
  box-sizing: border-box;
  z-index: 1;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack:not(:hover):not(.is-expanded)
  .amz-aikb-mycred-title,
.amz-aikb-exchange--inline.amz-aikb-exchange--stack:not(:hover):not(.is-expanded)
  .amz-aikb-mycred-meta {
  display: none !important;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack:not(:hover):not(.is-expanded)
  .amz-aikb-mycred-exchange.is-short
  .amz-aikb-mycred-info
  .amz-aikb-mycred-meta {
  display: none !important;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack:hover,
.amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded {
  z-index: 80;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack:hover .amz-aikb-mycred-exchange,
.amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded .amz-aikb-mycred-exchange {
  flex-direction: column;
  align-items: stretch;
  height: auto;
  min-height: var(--amz-aikb-pack-row-h);
  max-height: none;
  gap: 6px;
  padding: 8px;
  z-index: 70;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack:hover .amz-aikb-mycred-title,
.amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded .amz-aikb-mycred-title {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--amz-aikb-accent);
  text-align: center;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack:hover .amz-aikb-mycred-meta,
.amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded .amz-aikb-mycred-meta {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--amz-aikb-muted);
  text-align: center;
}

/* Expanded stack: keep input + 兑换 on one row under the title */
.amz-aikb-exchange--inline.amz-aikb-exchange--stack:hover .amz-aikb-mycred-label,
.amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded .amz-aikb-mycred-label {
  display: inline-flex;
  width: 100%;
  justify-content: center;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack:hover .amz-aikb-mycred-submit,
.amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded .amz-aikb-mycred-submit {
  align-self: center;
}

.amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded
  .amz-aikb-mycred-exchange.is-short
  .amz-aikb-mycred-info
  .amz-aikb-mycred-meta {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

@media (hover: none) {
  .amz-aikb-exchange--inline.amz-aikb-exchange--stack:not(.is-expanded):hover .amz-aikb-mycred-exchange {
    height: var(--amz-aikb-pack-row-h);
    min-height: var(--amz-aikb-pack-row-h);
    max-height: var(--amz-aikb-pack-row-h);
    gap: 0;
    padding: 4px 8px;
    z-index: 1;
  }

  .amz-aikb-exchange--inline.amz-aikb-exchange--stack.is-expanded .amz-aikb-mycred-exchange {
    gap: 6px;
    padding: 8px;
  }
}

/* Direct exchange: the input and submit button provide the grouping. */
.amz-aikb-exchange--inline .amz-aikb-mycred-exchange {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 148px;
  height: var(--amz-aikb-pack-row-h);
  min-height: var(--amz-aikb-pack-row-h);
  max-height: var(--amz-aikb-pack-row-h);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  box-sizing: border-box;
  overflow: visible;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-title,
.amz-aikb-exchange--inline .amz-aikb-mycred-meta {
  display: none;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-label {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  color: inherit;
  min-width: 0;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-points {
  width: 4.75em;
  min-width: 56px;
  max-width: 72px;
  height: var(--amz-aikb-pack-row-h);
  min-height: var(--amz-aikb-pack-row-h);
  max-height: var(--amz-aikb-pack-row-h);
  margin: 0;
  padding: 0 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  line-height: var(--amz-aikb-pack-row-h);
  color: var(--amz-aikb-ink, #1f2430);
  -webkit-text-fill-color: var(--amz-aikb-ink, #1f2430);
  caret-color: var(--amz-aikb-accent, #c45c26);
  background: #fff;
  border-radius: 6px;
  border: 1px solid rgba(196, 92, 38, 0.28);
  opacity: 1;
  pointer-events: auto;
  -moz-appearance: textfield;
  box-sizing: border-box;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-points::-webkit-outer-spin-button,
.amz-aikb-exchange--inline .amz-aikb-mycred-points::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-submit {
  flex: 0 0 auto;
  height: var(--amz-aikb-pack-row-h);
  min-height: var(--amz-aikb-pack-row-h);
  max-height: var(--amz-aikb-pack-row-h);
  min-width: 44px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  white-space: nowrap;
}

/* 行内「还差积分」：方块只保留状态文案；标题/汇率用 hover */
.amz-aikb-exchange--inline .amz-aikb-mycred-exchange.is-short {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: 118px;
  min-width: 118px;
  max-width: 118px;
  padding: 5px 8px;
  gap: 2px;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff7ee 0%, #ffffff 85%);
  box-shadow: none;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-title {
  display: none;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-info {
  align-items: center;
  width: 100%;
  gap: 0;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-meta {
  display: none;
}

.amz-aikb-exchange--inline .amz-aikb-mycred-exchange.is-short .amz-aikb-mycred-max.is-short {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--amz-aikb-accent);
}

/* Mobile: 历史 / 新会话靠近会话区；PC 用 sessions-head 里的新会话 */
.amz-aikb-session-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 12px 8px;
  border-top: 1px solid var(--amz-aikb-line);
  box-sizing: border-box;
}

.amz-aikb-new-session--bar {
  display: none;
  color: var(--amz-aikb-accent) !important;
  font-weight: 700;
}

.amz-aikb-packs .amz-aikb-pack-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-width: 0;
  margin-top: 0;
  border: 1px solid var(--amz-aikb-line);
  background: #fff;
  padding: 7px 6px 6px;
  cursor: pointer;
  text-align: center;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

/* Must follow base .pack-btn rules so padding/height are not overridden */
.amz-aikb-packs.amz-aikb-packs--inline .amz-aikb-pack-btn {
  height: var(--amz-aikb-pack-row-h, 48px);
  min-height: var(--amz-aikb-pack-row-h, 48px);
  max-height: var(--amz-aikb-pack-row-h, 48px);
  padding: 0 6px;
  box-sizing: border-box;
}

.amz-aikb-packs.amz-aikb-packs--inline .amz-aikb-packs-scroller {
  height: var(--amz-aikb-pack-row-h, 48px);
}

/* Stack expand must beat the fixed inline scroller height above */
.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:hover .amz-aikb-packs-scroller,
.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:focus-within .amz-aikb-packs-scroller,
.amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded .amz-aikb-packs-scroller {
  height: auto;
  min-height: var(--amz-aikb-pack-row-h, 48px);
  max-height: none;
}

.amz-aikb-exchange.amz-aikb-exchange--inline .amz-aikb-mycred-exchange {
  height: var(--amz-aikb-pack-row-h, 48px);
  min-height: var(--amz-aikb-pack-row-h, 48px);
  max-height: var(--amz-aikb-pack-row-h, 48px);
  box-sizing: border-box;
  margin: 0;
}

.amz-aikb-packs .amz-aikb-pack-btn:hover {
  border-color: color-mix(in srgb, var(--amz-aikb-accent, #c45c26) 52%, transparent);
  background: rgba(196, 92, 38, 0.07);
  background: color-mix(
    in srgb,
    var(--amz-aikb-accent, #c45c26) 8%,
    var(--amz-aikb-panel, #fffdf9)
  );
  box-shadow: 0 4px 12px rgba(31, 36, 48, 0.11);
  transform: translateY(-1px);
  color: inherit;
}

.amz-aikb-exchange.amz-aikb-exchange--inline:hover .amz-aikb-mycred-exchange.is-short {
  border-color: color-mix(in srgb, var(--amz-aikb-accent, #c45c26) 44%, transparent);
  background: rgba(196, 92, 38, 0.07);
  background: color-mix(
    in srgb,
    var(--amz-aikb-accent, #c45c26) 8%,
    var(--amz-aikb-panel, #fffdf9)
  );
  box-shadow: 0 4px 12px rgba(31, 36, 48, 0.09);
}

.amz-aikb-packs .amz-aikb-pack-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--amz-aikb-accent, #c45c26) 42%, transparent);
  outline-offset: 2px;
}

.amz-aikb-packs .amz-aikb-pack-btn.has-deal {
  background: linear-gradient(180deg, #fffdf9, #fff);
}

.amz-aikb-packs .amz-aikb-pack-btn.is-best {
  border-color: rgba(196, 92, 38, 0.45);
  background: linear-gradient(180deg, #fff8f1, #fff);
  box-shadow: inset 0 0 0 1px rgba(196, 92, 38, 0.08);
}

.amz-aikb-packs .amz-aikb-pack-btn.is-loading {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

.amz-aikb-pack-points {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--amz-aikb-ink);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.amz-aikb-packs .amz-aikb-pack-btn.is-best .amz-aikb-pack-points {
  color: var(--amz-aikb-accent);
}

.amz-aikb-pack-sub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.amz-aikb-pack-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--amz-aikb-accent);
  line-height: 1.2;
  white-space: nowrap;
}

.amz-aikb-pack-badge.is-base {
  display: none;
}

.amz-aikb-pack-badge:not(.is-base) {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  padding: 2px 5px;
  border: 0;
  border-left: 1px solid rgba(196, 92, 38, 0.2);
  border-bottom: 1px solid rgba(196, 92, 38, 0.2);
  border-radius: 0 7px 0 7px;
  background: #fff1e8;
  color: var(--amz-aikb-accent);
  pointer-events: none;
}

.amz-aikb-pack-badge.is-entry {
  border-color: rgba(107, 114, 128, 0.18);
  background: #f7f4ef;
  color: var(--amz-aikb-muted);
}

.amz-aikb-pack-btn.is-best .amz-aikb-pack-badge:not(.is-base) {
  border-color: var(--amz-aikb-accent);
  background: var(--amz-aikb-accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(196, 92, 38, 0.2);
}

/* A compact composer can live inside a wide desktop viewport (sidebar, drawer,
   or browser zoom). Its non-inline pack popover still uses the desktop
   three-column grid, so reserve the badge corner instead of letting the
   absolutely positioned unit price cover the centered point amount. */
@media (min-width: 769px) {
  .amz-aikb-composer-tools
    .amz-aikb-packs:not(.amz-aikb-packs--inline)
    .amz-aikb-pack-btn {
    --amz-aikb-pack-badge-reserve: 58px;
  }

  .amz-aikb-composer-tools
    .amz-aikb-packs:not(.amz-aikb-packs--inline)
    .amz-aikb-pack-points,
  .amz-aikb-composer-tools
    .amz-aikb-packs:not(.amz-aikb-packs--inline)
    .amz-aikb-pack-sub {
    align-self: flex-start;
    width: calc(100% - var(--amz-aikb-pack-badge-reserve));
    box-sizing: border-box;
    text-align: center;
  }

  .amz-aikb-composer-tools
    .amz-aikb-packs:not(.amz-aikb-packs--inline)
    .amz-aikb-pack-sub {
    justify-content: center;
  }
}

body.night .amz-aikb-pack-badge:not(.is-base) {
  border-color: rgba(229, 145, 93, 0.3);
  background: rgba(196, 92, 38, 0.2);
  color: #f2b388;
}

body.night .amz-aikb-pack-badge.is-entry {
  border-color: var(--amz-aikb-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--amz-aikb-muted);
}

body.night .amz-aikb-pack-btn.is-best .amz-aikb-pack-badge:not(.is-base) {
  border-color: #d36a34;
  background: #d36a34;
  color: #fff;
}

.amz-aikb-pack-sep {
  display: none;
}

.amz-aikb-pack-ice {
  color: var(--amz-aikb-muted);
  font-weight: 500;
}

/* Pack balance CTA: theme link look + credit layout, without VIP .erphpdown-type-credit */
.layui-layer-dialog .amz-aikb-pack-credit {
  display: block;
  float: none;
  margin: 3px 0 10px;
}

.amz-aikb-main {
  display: flex;
  flex-direction: column;
  container: amz-aikb-main / inline-size;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--amz-aikb-panel);
  overflow: visible;
}

.amz-aikb-messages-wrap {
  flex: 1;
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
}

.amz-aikb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  box-sizing: border-box;
  /* Firefox: slim, always-functional scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 36, 48, 0.25) transparent;
}

.amz-aikb-scroll-latest {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid rgba(31, 36, 48, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(31, 36, 48, 0.14);
  color: #4f5865;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transform: translateX(-50%);
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.amz-aikb-scroll-latest[hidden] {
  display: none !important;
}

.amz-aikb-scroll-latest:hover {
  border-color: var(--amz-aikb-accent);
  color: var(--amz-aikb-accent);
  transform: translateX(-50%) translateY(-1px);
}

.amz-aikb-scroll-latest.is-new {
  border-color: rgba(196, 92, 38, 0.34);
  color: var(--amz-aikb-accent);
}

.amz-aikb-scroll-latest__icon {
  font-size: 15px;
  line-height: 1;
}

body.night .amz-aikb-scroll-latest {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(42, 46, 54, 0.96);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  color: #d6d9df;
}

body.night .amz-aikb-scroll-latest.is-new,
body.night .amz-aikb-scroll-latest:hover {
  border-color: rgba(226, 162, 124, 0.5);
  color: #e2a27c;
}

/* 会话列表滚动条平时隐藏；进入列表区后平缓显示到 40% 可见度。 */
.amz-aikb-sessions {
  --amz-aikb-session-scrollbar-visibility: 0;
  scrollbar-width: thin;
  scrollbar-color: rgb(31 36 48 / calc(0.25 * var(--amz-aikb-session-scrollbar-visibility))) transparent;
  transition: --amz-aikb-session-scrollbar-visibility 0.24s ease;
}

.amz-aikb-sessions:hover,
.amz-aikb-sessions:focus-within {
  --amz-aikb-session-scrollbar-visibility: 0.4;
}

.amz-aikb-sessions::-webkit-scrollbar,
.amz-aikb-messages::-webkit-scrollbar {
  width: 8px;
}

.amz-aikb-sessions::-webkit-scrollbar-track,
.amz-aikb-messages::-webkit-scrollbar-track {
  background: transparent;
}

.amz-aikb-sessions::-webkit-scrollbar-thumb {
  background: rgba(31, 36, 48, 0.22);
  opacity: var(--amz-aikb-session-scrollbar-visibility);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.amz-aikb-messages::-webkit-scrollbar-thumb {
  background: rgba(31, 36, 48, 0.22);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
  .amz-aikb-sessions {
    transition: none;
  }
}

.amz-aikb-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(31, 36, 48, 0.4);
  border: 2px solid transparent;
  background-clip: content-box;
}

.amz-aikb-msg {
  margin: 0 0 14px;
  max-width: var(--amz-aikb-msg-max, 100%);
  width: 100%;
  box-sizing: border-box;
}

.amz-aikb-msg-user .amz-aikb-bubble {
  background: var(--amz-aikb-user);
  color: #f8fafc;
  margin-left: auto;
}

.amz-aikb-msg-user .amz-aikb-bubble--scoped {
  white-space: normal;
}

.amz-aikb-msg-user.has-article-context {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.amz-aikb-summary-article {
  display: flex;
  width: 340px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 14px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
  text-decoration: none;
}

.amz-aikb-summary-article:focus-visible {
  outline: 2px solid var(--amz-aikb-accent);
  outline-offset: 3px;
}

.amz-aikb-summary-article-cover {
  position: relative;
  flex: 0 0 84px;
  min-height: 88px;
  display: grid;
  place-items: center;
  background: var(--amz-aikb-bg);
  color: var(--amz-aikb-muted);
  font-size: 24px;
}

.amz-aikb-summary-article-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.amz-aikb-summary-article-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
}

.amz-aikb-summary-article-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  color: var(--amz-aikb-ink);
  font-size: 15px;
  line-height: 1.4;
}

.amz-aikb-summary-article-source {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--amz-aikb-muted);
  font-size: 12px;
  line-height: 1.4;
}

.amz-aikb-summary-article-source img {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.amz-aikb-summary-article-source span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amz-aikb-msg-user.has-article-context .amz-aikb-bubble {
  background: color-mix(in srgb, var(--amz-aikb-ink) 6%, var(--amz-aikb-panel));
  color: var(--amz-aikb-ink);
}

.amz-aikb-q-scope {
  display: inline-block;
  vertical-align: 0.1em;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  white-space: nowrap;
}

.amz-aikb-q-scope--post {
  background: rgba(224, 191, 115, 0.85);
  color: #3a2a12;
}

.amz-aikb-q-scope--term {
  background: #2e6e9e;
  color: #fff;
}

.amz-aikb-q-scope--site {
  background: rgba(255, 255, 255, 0.22);
  color: #f8fafc;
}

.amz-aikb-q-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.amz-aikb-msg-assistant .amz-aikb-bubble {
  background: var(--amz-aikb-bot);
  border: 1px solid var(--amz-aikb-line);
  white-space: normal;
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 20px clamp(18px, 3vw, 30px) 22px;
  font-size: 15px;
  line-height: 1.78;
  text-align: left;
  text-wrap: pretty;
}

.amz-aikb-bubble {
  display: inline-block;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.7;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* —— Assistant Markdown typography —— */
.amz-aikb-msg-assistant .amz-aikb-bubble > * {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.amz-aikb-msg-assistant .amz-aikb-bubble > :first-child {
  margin-top: 0;
}

.amz-aikb-msg-assistant .amz-aikb-bubble > :last-child {
  margin-bottom: 0;
}

.amz-aikb-bubble p {
  margin-top: 0;
  margin-bottom: 0.9em;
}

.amz-aikb-bubble p:last-child {
  margin-bottom: 0;
}

.amz-aikb-msg-assistant .amz-aikb-bubble h2,
.amz-aikb-msg-assistant .amz-aikb-bubble h3,
.amz-aikb-msg-assistant .amz-aikb-bubble h4 {
  margin-top: 1.45em;
  margin-bottom: 0.62em;
  font-weight: 700;
  line-height: 1.35;
  color: var(--amz-aikb-ink);
  letter-spacing: 0;
}

.amz-aikb-msg-assistant .amz-aikb-bubble h2 {
  font-size: 1.12em;
  padding-bottom: 0.28em;
  border-bottom: 1px solid rgba(230, 223, 212, 0.95);
}

.amz-aikb-msg-assistant .amz-aikb-bubble h3 {
  font-size: 1.04em;
  padding-left: 0.68em;
  border-left: 2px solid var(--amz-aikb-accent);
}

.amz-aikb-msg-assistant .amz-aikb-bubble h4 {
  font-size: 1em;
  margin-top: 1.1em;
  color: #2a3344;
}

.amz-aikb-msg-assistant .amz-aikb-bubble h2:first-child,
.amz-aikb-msg-assistant .amz-aikb-bubble h3:first-child,
.amz-aikb-msg-assistant .amz-aikb-bubble h4:first-child {
  margin-top: 0.15em;
}

.amz-aikb-msg-assistant .amz-aikb-bubble ul,
.amz-aikb-msg-assistant .amz-aikb-bubble ol {
  margin-top: 0.38em;
  margin-bottom: 1em;
  padding: 0 0 0 1.42em;
}

.amz-aikb-msg-assistant .amz-aikb-bubble li {
  margin: 0.5em 0;
  padding-left: 0.26em;
  line-height: 1.72;
}

.amz-aikb-msg-assistant .amz-aikb-bubble li::marker {
  color: var(--amz-aikb-accent);
  font-weight: 700;
}

.amz-aikb-msg-assistant .amz-aikb-bubble ul ul,
.amz-aikb-msg-assistant .amz-aikb-bubble ol ol,
.amz-aikb-msg-assistant .amz-aikb-bubble ul ol,
.amz-aikb-msg-assistant .amz-aikb-bubble ol ul {
  margin: 0.25em 0 0.35em;
}

.amz-aikb-msg-assistant .amz-aikb-bubble strong {
  font-weight: 700;
  color: #1a2030;
}

.amz-aikb-msg-assistant .amz-aikb-bubble em {
  font-style: normal;
  color: #3d4a5c;
  background: rgba(196, 92, 38, 0.08);
  padding: 0 0.2em;
  border-radius: 3px;
}

.amz-aikb-msg-assistant .amz-aikb-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(42, 51, 68, 0.06);
  color: #2a3344;
}

.amz-aikb-msg-assistant {
  position: relative;
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ai-analysis {
  box-sizing: border-box;
  margin: 1.15em 0 0.25em;
  padding: 0.05em 0 0.05em 14px;
  border-left: 3px solid var(--amz-aikb-accent);
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ai-analysis-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 0 0 0.35em;
  font-size: 1em;
  line-height: 1.5;
  color: var(--amz-aikb-accent);
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ai-analysis-heading small {
  font-size: 11px;
  font-weight: 500;
  color: var(--amz-aikb-muted);
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ai-analysis > :last-child {
  margin-bottom: 0;
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref {
  position: static;
  margin-left: 0.08em;
  font-size: 0.68em;
  font-weight: 700;
  line-height: 0;
  vertical-align: super;
  white-space: nowrap;
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref a,
.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  min-height: 1.35em;
  padding: 0 0.3em;
  border-radius: 999px;
  background: rgba(196, 92, 38, 0.12);
  color: var(--amz-aikb-accent);
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  vertical-align: baseline;
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, outline-color 0.15s ease;
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref a:hover,
.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref a:focus-visible,
.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref button:hover,
.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref button:focus-visible {
  background: rgba(196, 92, 38, 0.22);
  text-decoration: none;
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref a:focus-visible,
.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref button:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.45);
  outline-offset: 2px;
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-article-link {
  color: inherit;
  font-weight: inherit;
  text-decoration-line: underline;
  text-decoration-color: rgba(196, 92, 38, 0.42);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-article-link:visited {
  color: #735f7e;
  text-decoration-color: rgba(115, 95, 126, 0.58);
}

.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-article-link:hover,
.amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-article-link:focus-visible {
  color: var(--amz-aikb-accent);
  text-decoration-color: currentColor;
}

.amz-aikb-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--amz-aikb-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.amz-aikb-cost {
  color: var(--amz-aikb-ink);
  font-weight: 600;
}

.amz-aikb-cost {
  color: var(--amz-aikb-ink);
  font-weight: 600;
}

.amz-aikb-cost[title] {
  cursor: help;
  text-decoration: underline dotted color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
}

.amz-aikb-copy {
  border: 0;
  background: transparent;
  color: var(--amz-aikb-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.amz-aikb-copy:hover {
  color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.08);
}

.amz-aikb-copy.is-done {
  color: #16a34a;
}

.amz-aikb-ref a,
.amz-aikb-ref button {
  color: var(--amz-aikb-accent);
  text-decoration: none;
  font-weight: 600;
}

.amz-aikb-ref a:hover,
.amz-aikb-ref button:hover {
  text-decoration: underline;
}

.amz-aikb-msg-error .amz-aikb-bubble {
  border-color: #f0c9b2;
  background: #fdf5ef;
}

.amz-aikb-msg-recoverable .amz-aikb-bubble {
  border-color: color-mix(in srgb, var(--amz-aikb-accent) 22%, var(--amz-aikb-line));
  background: color-mix(in srgb, var(--amz-aikb-accent) 4%, var(--amz-aikb-panel));
}

.amz-aikb-msg-queueing .amz-aikb-bubble {
  padding-block: 16px;
}

.amz-aikb-actions--auto-retry {
  display: block;
}

.amz-aikb-msg-queueing .amz-aikb-actions--auto-retry {
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--amz-aikb-accent) 15%, var(--amz-aikb-line));
}

.amz-aikb-auto-retry-status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 440px);
  min-height: 36px;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 9px;
  color: var(--amz-aikb-ink);
  background: color-mix(in srgb, var(--amz-aikb-panel) 94%, var(--amz-aikb-bg));
  font-size: 12px;
}

.amz-aikb-msg-queueing .amz-aikb-auto-retry-status {
  width: 100%;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
}

.amz-aikb-auto-retry-status.is-cancelled + .amz-aikb-btn {
  min-height: 40px;
  margin-top: 12px;
}

.amz-aikb-auto-retry-spinner {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 2px solid color-mix(in srgb, var(--amz-aikb-accent) 22%, var(--amz-aikb-line));
  border-top-color: var(--amz-aikb-accent);
  border-radius: 50%;
  animation: amz-aikb-spin 0.85s linear infinite;
}

.amz-aikb-auto-retry-text {
  min-width: 0;
  flex: 1 1 auto;
}

.amz-aikb-auto-retry-cancel {
  flex: 0 0 auto;
  padding: 3px 4px;
  color: var(--amz-aikb-muted);
}

.amz-aikb-auto-retry-cancel:hover,
.amz-aikb-auto-retry-cancel:focus-visible {
  color: var(--amz-aikb-accent);
}

.amz-aikb-paywall {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

/* 回答后的知识缺口转化条 */
.amz-aikb-gap {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(196, 92, 38, 0.28);
  border-radius: 10px;
  background: linear-gradient(165deg, #fff9f4 0%, #fff 55%);
}

.amz-aikb-gap-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--amz-aikb-vip);
  background-image: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.amz-aikb-gap-title {
  display: block;
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--amz-aikb-ink);
}

.amz-aikb-gap-summary,
.amz-aikb-gap-compare {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.55;
  color: #5c6570;
}

.amz-aikb-gap-compare {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(196, 92, 38, 0.06);
  color: #7a3d1c;
}

.amz-aikb-gap-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 10px;
  font-size: 12px;
  color: #5c6570;
}

.amz-aikb-gap-stats b {
  color: var(--amz-aikb-ink);
  font-weight: 700;
}

.amz-aikb-gap-items {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.amz-aikb-gap-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  font-size: 12px;
}

.amz-aikb-gap-item:hover {
  border-color: var(--amz-aikb-accent);
}

.amz-aikb-gap-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.amz-aikb-gap-item-tip {
  flex-shrink: 0;
  color: #8a6148;
  font-size: 11px;
}

.amz-aikb-gap-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.amz-aikb-vip-guide-inv {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #5c6570;
}

.amz-aikb-vip-guide-inv strong {
  color: #7a3d1c;
}

/* Citations: compact tag flow instead of full-width stacked rows */
.amz-aikb-citations {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.amz-aikb-citations > .amz-aikb-meta {
  flex-basis: 100%;
  margin: 0 0 2px;
}

.amz-aikb-citations--compact {
  display: block;
  margin-top: 6px;
}

.amz-aikb-citations-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-height: 30px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--amz-aikb-muted);
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  cursor: pointer;
}

.amz-aikb-citations-toggle[hidden] {
  display: none !important;
}

.amz-aikb-citations-toggle:hover,
.amz-aikb-citations-toggle:focus-visible {
  color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.07);
}

.amz-aikb-citations-toggle:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.42);
  outline-offset: 2px;
}

.amz-aikb-citations-summary {
  color: var(--amz-aikb-ink);
  font-weight: 700;
  white-space: nowrap;
}

.amz-aikb-citations-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  min-width: 0;
}

.amz-aikb-citations-items {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.amz-aikb-citations-items .amz-aikb-cite {
  flex: 0 1 auto;
}

.amz-aikb-citations-list:not(.is-expanded):not(.is-unclipped) .amz-aikb-cite:nth-child(n + 4) {
  display: none;
}

.amz-aikb-citations-list.is-measuring {
  grid-template-columns: minmax(0, 1fr);
}

.amz-aikb-citations-list.is-measuring .amz-aikb-citations-items {
  flex-wrap: nowrap !important;
  overflow: visible !important;
}

.amz-aikb-citations-list.is-measuring .amz-aikb-cite {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  max-width: none !important;
}

.amz-aikb-citations-list.is-expanded .amz-aikb-citations-items {
  flex-wrap: wrap;
  overflow: visible;
}

.amz-aikb-citations-list.is-expanded .amz-aikb-cite {
  flex: 0 1 auto;
}

.amz-aikb-citation-preview {
  position: absolute;
  z-index: 48;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
  box-shadow: 0 12px 28px rgba(35, 30, 24, 0.16);
}

.amz-aikb-citation-preview[hidden] {
  display: none;
}

.amz-aikb-citation-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--amz-aikb-muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.amz-aikb-citation-preview-close:hover,
.amz-aikb-citation-preview-close:focus-visible {
  color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.08);
}

.amz-aikb-citation-preview-kicker {
  margin: 0 44px 5px 0;
  color: var(--amz-aikb-accent);
  font-size: 11px;
  font-weight: 700;
}

.amz-aikb-citation-preview-title {
  display: block;
  padding-right: 30px;
  color: var(--amz-aikb-ink);
  font-size: 14px;
  line-height: 1.45;
}

.amz-aikb-citation-preview-meta {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  color: var(--amz-aikb-muted);
  font-size: 11px;
}

.amz-aikb-citation-preview-format,
.amz-aikb-citation-preview-pages,
.amz-aikb-citation-preview-access {
  padding-left: 8px;
  border-left: 1px solid var(--amz-aikb-line);
}

.amz-aikb-citation-preview-access {
  color: var(--amz-aikb-ink);
  font-weight: 600;
}

.amz-aikb-citation-preview-excerpt-label {
  margin-top: 12px;
  color: var(--amz-aikb-accent);
  font-size: 11px;
  font-weight: 700;
}

.amz-aikb-citation-preview-excerpt {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-left: 2px solid rgba(196, 92, 38, 0.34);
  border-radius: 4px;
  background: rgba(196, 92, 38, 0.055);
  color: var(--amz-aikb-ink);
  font-size: 12px;
  line-height: 1.7;
}

.amz-aikb-citation-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.amz-aikb-citation-preview-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 5px 11px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 7px;
  background: transparent;
  color: var(--amz-aikb-accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}

.amz-aikb-citation-preview-link[hidden] {
  display: none !important;
}

.amz-aikb-citation-preview-link.is-primary {
  border-color: var(--amz-aikb-ink);
  background: var(--amz-aikb-ink);
  color: var(--amz-aikb-panel);
}

.amz-aikb-citation-preview-link.is-secondary {
  border-color: rgba(196, 92, 38, 0.34);
  background: rgba(196, 92, 38, 0.055);
}

.amz-aikb-citation-preview-link.is-vip {
  border-color: rgba(141, 110, 99, 0.22);
  background: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
}

.amz-aikb-citation-preview-link:hover,
.amz-aikb-citation-preview-link:focus-visible {
  border-color: var(--amz-aikb-accent);
  text-decoration: none;
}

.amz-aikb-citation-preview-link:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.42);
  outline-offset: 2px;
}

.amz-aikb-citation-preview-link:active {
  transform: translateY(1px);
}

.amz-aikb-cite {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  line-height: 1.6;
  overflow: hidden;
  text-decoration: none;
  color: var(--amz-aikb-ink);
  box-sizing: border-box;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.amz-aikb-cite-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amz-aikb-cite-meta {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  margin-left: 7px;
  white-space: nowrap;
}

.amz-aikb-cite-kind {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 4px;
  color: var(--amz-aikb-muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
}

.amz-aikb-cite-kind--file {
  border-color: rgba(196, 92, 38, 0.26);
  background: rgba(196, 92, 38, 0.055);
  color: var(--amz-aikb-accent);
}

.amz-aikb-cite-badge--locked {
  border: 1px solid rgba(141, 110, 99, 0.28);
  background: rgba(240, 214, 141, 0.28);
  color: var(--amz-aikb-vip-ink);
  font-weight: 700;
}

.amz-aikb-cite:hover {
  border-color: var(--amz-aikb-accent);
  color: var(--amz-aikb-accent);
}

.amz-aikb-cite-date {
  color: #7a818a;
  font-variant-numeric: tabular-nums;
}

.amz-aikb-cite:hover .amz-aikb-cite-date {
  color: inherit;
}

/* Contextual rerun lives in the answer footer instead of a separate card. */
.amz-aikb-scope-expansion {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 2px;
  white-space: nowrap;
}

.amz-aikb-scope-expansion-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.amz-aikb-scope-expansion-btn {
  min-height: 24px;
  padding: 2px 5px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--amz-aikb-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease;
}

.amz-aikb-scope-expansion-btn:hover,
.amz-aikb-scope-expansion-btn:focus-visible {
  background: rgba(196, 92, 38, 0.08);
  color: var(--amz-aikb-accent);
}

.amz-aikb-scope-expansion-btn:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.2);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .amz-aikb-scope-expansion-btn {
    min-height: 44px;
    padding-inline: 8px;
  }
}

.amz-aikb-card {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.amz-aikb-card:hover {
  border-color: var(--amz-aikb-accent);
  box-shadow: 0 2px 8px rgba(196, 92, 38, 0.1);
}

.amz-aikb-card strong {
  display: block;
  margin-bottom: 4px;
}

.amz-aikb-card .amz-aikb-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.amz-aikb-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--amz-aikb-line);
  background: rgba(255, 253, 249, 0.95);
  box-sizing: border-box;
}

.amz-aikb-composer textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  resize: none;
  min-height: 48px;
  max-height: 150px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.amz-aikb-composer textarea:focus {
  outline: none;
  border-color: var(--amz-aikb-accent);
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.12);
}

.amz-aikb-send,
.amz-aikb-btn,
a.amz-aikb-btn {
  border: 0;
  border-radius: 10px;
  background: var(--amz-aikb-accent);
  color: #fff !important;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(31, 36, 48, 0.06);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease,
    filter 0.15s ease;
}

/* Keep white ink on hover — theme a:hover accent was washing out the label */
.amz-aikb-send:hover:not(:disabled),
.amz-aikb-btn:hover,
a.amz-aikb-btn:hover,
.amz-aikb-btn:focus-visible,
a.amz-aikb-btn:focus-visible {
  background: #d4783f;
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: 0 6px 16px rgba(196, 92, 38, 0.28);
  filter: none;
  transform: translateY(-1px);
}

.amz-aikb-send:active:not(:disabled),
.amz-aikb-btn:active,
a.amz-aikb-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 6px rgba(196, 92, 38, 0.2);
  background: #ad4e1e;
  color: #fff !important;
}

.amz-aikb-btn,
a.amz-aikb-btn {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.amz-aikb-btn-dark {
  background: var(--amz-aikb-user);
}

.amz-aikb-btn-dark:hover {
  background: #1d2433;
}

/* VIP CTA — theme gold, used by paywall / upsell / upgrade links */
.amz-aikb-btn-vip {
  background: var(--amz-aikb-vip);
  background-image: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
}

.amz-aikb-btn-vip:hover {
  filter: brightness(0.96);
  background: var(--amz-aikb-vip);
  background-image: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
}

.amz-aikb-wallet-links a[href*="vip"],
.amz-aikb-wallet-links a.amz-aikb-link-vip {
  color: var(--amz-aikb-vip-ink);
  background: var(--amz-aikb-vip-grad);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.amz-aikb-btn-text {
  border: 0;
  background: transparent;
  color: var(--amz-aikb-accent);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

.amz-aikb-login-wall {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(246, 243, 238, 0.82);
  backdrop-filter: blur(2px);
  z-index: 5;
}

.amz-aikb-login-wall__card {
  max-width: 340px;
  width: 100%;
  padding: 22px 20px 20px;
  border-radius: 14px;
  border: 1px solid rgba(230, 223, 212, 0.95);
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(31, 36, 48, 0.1);
  text-align: center;
}

.amz-aikb-login-wall__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #1f2430;
  line-height: 1.35;
}

.amz-aikb-login-wall__benefits {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: #6b7280;
}

.amz-aikb-login-wall__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.amz-aikb-login-wall__actions .amz-aikb-btn {
  min-width: 112px;
}

.amz-aikb-login-wall .amz-aikb-btn.signin-loader,
.amz-aikb-login-wall a.amz-aikb-btn[data-amz-aikb-login="1"] {
  color: #fff !important;
  background: var(--amz-aikb-accent, #c45c26);
  border: 0;
  box-shadow: 0 8px 18px rgba(196, 92, 38, 0.28);
}

.amz-aikb-login-wall .amz-aikb-btn.signin-loader:hover,
.amz-aikb-login-wall a.amz-aikb-btn[data-amz-aikb-login="1"]:hover {
  color: #fff !important;
  filter: brightness(1.05);
}

.amz-aikb-login-wall .amz-aikb-btn--vip-outline {
  background: linear-gradient(90deg, #f0d68d, #e0bf73);
  color: #4e342e !important;
  border: 0;
  font-weight: 700;
}

/* Guest VIP teaser: always stacked — never join the narrow-drawer row layout */
.amz-aikb-vip-upsell--guest {
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(224, 191, 115, 0.45);
  border-radius: 10px;
  background: linear-gradient(165deg, #fffaf0 0%, #fffdf8 100%);
  box-sizing: border-box;
}

.amz-aikb-vip-upsell--guest .amz-aikb-vip-upsell-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--amz-aikb-ink, #1f2430);
  white-space: normal;
}

.amz-aikb-vip-upsell--guest .amz-aikb-guest-benefits {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #6b7280;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.amz-aikb-vip-upsell--guest .amz-aikb-guest-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.amz-aikb-vip-upsell--guest .amz-aikb-vip-upsell-cta {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 96px;
  padding: 8px 12px;
  font-size: 12px;
}

.amz-aikb-vip-upsell--guest .amz-aikb-guest-login-link {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8d6e63;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.amz-aikb-vip-upsell--guest .amz-aikb-guest-login-link:hover {
  color: var(--amz-aikb-accent, #c45c26);
}

/* Guest slim: actions only — benefits stay on the login wall */
.amz-aikb-vip-upsell--guest-slim {
  padding: 8px 10px;
  gap: 0 !important;
}

.amz-aikb-vip-upsell--guest-slim .amz-aikb-guest-actions {
  width: 100%;
}

.amz-aikb-vip-upsell--guest-slim .amz-aikb-vip-upsell-cta {
  flex: 1 1 0;
}

.amz-aikb-vip-upsell--guest-slim .amz-aikb-guest-login-link {
  flex: 1 1 0;
  text-align: center;
  padding: 8px 4px;
}

.amz-aikb-packs--guest .amz-aikb-pack-btn.is-guest-locked {
  opacity: 1;
  cursor: pointer;
  filter: none;
}

.amz-aikb-packs--guest .amz-aikb-pack-btn.is-guest-locked:hover {
  opacity: 1;
}

.amz-aikb-float {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99990;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--amz-aikb-accent, #c45c26);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(31, 36, 48, 0.22);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  /* Prefer hidden until JS mounts into .rollbar; fallback visible so a JS
     error never permanently removes the AI entry from the page. */
  visibility: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.amz-aikb-float > .amz-aikb-ai-icon {
  font-size: 22px;
}

.amz-aikb-float.amz-aikb-ready {
  visibility: visible;
}

/* If JS never marks ready (parse/runtime error), still show after paint. */
@keyframes amz-aikb-float-fallback {
  to {
    visibility: visible;
  }
}
.amz-aikb-float:not(.amz-aikb-ready) {
  animation: amz-aikb-float-fallback 0s linear 2s forwards;
}

.amz-aikb-float:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 14px 28px rgba(31, 36, 48, 0.28);
}

/* Ask continues after drawer close — pulse the float until done. */
.amz-aikb-float.amz-aikb-float--busy {
  position: relative;
  box-shadow: 0 0 0 0 rgba(196, 92, 38, 0.45), 0 10px 24px rgba(31, 36, 48, 0.22);
  animation: amz-aikb-float-busy 1.4s ease-out infinite;
}

.amz-aikb-float.amz-aikb-float--busy::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px var(--amz-aikb-accent, #c45c26);
}

@keyframes amz-aikb-float-busy {
  0% {
    box-shadow: 0 0 0 0 rgba(196, 92, 38, 0.45), 0 10px 24px rgba(31, 36, 48, 0.22);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(196, 92, 38, 0), 0 10px 24px rgba(31, 36, 48, 0.22);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(196, 92, 38, 0), 0 10px 24px rgba(31, 36, 48, 0.22);
  }
}

.rollbar .amz-aikb-float.amz-aikb-float--busy::after {
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
}

/* 挂载进主题侧边工具栏（.rollbar）后的形态：绝对定位悬于工具栏顶部，
   不参与 ul 布局，插入时其他图标零位移；自身淡入出现。 */
.rollbar .amz-aikb-roll-li {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  margin-bottom: 5px;
  text-align: center;
  border-radius: var(--theme-radius, 6px);
  background: var(--amz-aikb-accent, #c45c26);
  animation: amz-aikb-roll-in 0.25s ease;
}

.rollbar .amz-aikb-roll-li:hover h6 {
  opacity: 0.9;
  right: 100%;
}

@keyframes amz-aikb-roll-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.amz-aikb-retry-icon {
  display: inline-block;
  margin-right: 2px;
  font-size: 14px;
  line-height: 1;
}

.amz-aikb-btn:hover .amz-aikb-retry-icon {
  animation: amz-aikb-spin 0.6s ease;
}

@keyframes amz-aikb-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rollbar .amz-aikb-float-roll {
  position: static;
  width: 100%;
  height: 40px;
  line-height: 40px;
  padding: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  transition: none;
}

.rollbar .amz-aikb-float-roll:hover {
  transform: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  .rollbar .amz-aikb-float-roll {
    height: 35px;
    line-height: 35px;
  }
}

/* 栏目横幅搜索框下方的 AI 引导行（横幅多为深色背景图） */
.amz-aikb-search-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.amz-aikb-search-hint .amz-aikb-search-ask {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 6px;
  padding: 3px 14px;
  border: 0;
  border-radius: 30px;
  background: var(--amz-aikb-accent, #c45c26);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.amz-aikb-search-hint .amz-aikb-search-ask:hover {
  transform: translateY(-1px);
}

/* 博客模板筛选条搜索框右侧的「问 AI」小按钮 */
.amz-aikb-search-ask-mini {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-left: 8px;
  padding: 0 14px;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--amz-aikb-accent, #c45c26);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.amz-aikb-search-ask-mini:hover {
  opacity: 0.9;
}

body.amz-aikb-drawer-open {
  overflow: hidden;
}

/* The site scroll container is the root element. Lock it only while the AI
 * drawer is fullscreen, leaving the drawer's own message scrollbar active. */
html.amz-aikb-page-scroll-locked {
  /* The theme normally reserves a stable 12px page-scrollbar gutter.
     A fullscreen drawer must reclaim it or its right edge looks clipped. */
  scrollbar-gutter: auto !important;
}

html.amz-aikb-page-scroll-locked,
html.amz-aikb-page-scroll-locked body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.amz-aikb-drawer {
  position: fixed;
  inset: 0;
  z-index: 99991;
  background: rgba(20, 24, 32, 0.45);
  display: flex;
  justify-content: flex-end;
  animation: amz-aikb-fade 0.18s ease;
}

/*
 * Modown .sign defaults to z-index 10003. AI drawer is 99991, so the login
 * modal would open "with no reaction" — actually buried under the drawer.
 */
body.sign-show .sign {
  z-index: 100050;
}

/* Theme-owned purchase confirmation; kept above both the AI drawer and Modown. */
html.amz-aikb-confirm-scroll-locked,
html.amz-aikb-confirm-scroll-locked body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.amz-aikb-confirm-overlay {
  --amz-aikb-panel: #fffdf9;
  --amz-aikb-ink: #1f2430;
  --amz-aikb-muted: #6b7280;
  --amz-aikb-line: #e6dfd4;
  --amz-aikb-accent: #c45c26;
  --amz-aikb-accent-ink: #fff;
  position: fixed;
  inset: 0;
  z-index: 100060;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 16px;
  background: rgba(20, 24, 32, 0.54);
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  animation: amz-aikb-confirm-overlay-in 0.16s ease-out;
}

.amz-aikb-confirm-dialog {
  width: min(420px, 100%);
  box-sizing: border-box;
  padding: 20px;
  border: 1px solid rgba(196, 92, 38, 0.24);
  border-radius: 14px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
  box-shadow: 0 18px 48px rgba(20, 24, 32, 0.24);
  animation: amz-aikb-confirm-dialog-in 0.18s ease-out;
}

.amz-aikb-confirm-head {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: -8px -8px 8px 0;
}

.amz-aikb-confirm-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--amz-aikb-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.amz-aikb-confirm-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--amz-aikb-muted);
  font: 400 26px/1 Arial, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.amz-aikb-confirm-close:hover {
  background: rgba(196, 92, 38, 0.08);
  color: var(--amz-aikb-accent);
}

.amz-aikb-confirm-body {
  margin: 0 0 20px;
}

.amz-aikb-confirm-summary,
.amz-aikb-confirm-note {
  margin: 0;
}

.amz-aikb-confirm-summary {
  color: var(--amz-aikb-ink);
  font-size: 15px;
  line-height: 1.7;
}

.amz-aikb-confirm-summary strong {
  color: var(--amz-aikb-accent);
  font-weight: 700;
}

.amz-aikb-confirm-note {
  margin-top: 6px;
  color: var(--amz-aikb-muted);
  font-size: 13px;
  line-height: 1.6;
}

.amz-aikb-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.amz-aikb-confirm-btn {
  min-width: 96px;
  min-height: 44px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 18px;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.amz-aikb-confirm-btn--cancel {
  border: 1px solid var(--amz-aikb-line);
  background: transparent;
  color: var(--amz-aikb-ink);
}

.amz-aikb-confirm-btn--cancel:hover {
  border-color: rgba(196, 92, 38, 0.42);
  background: rgba(196, 92, 38, 0.06);
}

.amz-aikb-confirm-btn--primary {
  border: 1px solid var(--amz-aikb-accent);
  background: var(--amz-aikb-accent);
  color: var(--amz-aikb-accent-ink);
  box-shadow: 0 8px 18px rgba(196, 92, 38, 0.22);
}

.amz-aikb-confirm-btn--primary:hover {
  border-color: #d4783f;
  background: #d4783f;
}

.amz-aikb-confirm-close:focus-visible,
.amz-aikb-confirm-btn:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.45);
  outline-offset: 2px;
}

body.night .amz-aikb-confirm-overlay {
  --amz-aikb-panel: #22252b;
  --amz-aikb-ink: #e8ebf0;
  --amz-aikb-muted: #a0a7b2;
  --amz-aikb-line: #353a44;
  --amz-aikb-accent: #d4783f;
  --amz-aikb-accent-ink: #fff;
  background: rgba(7, 9, 12, 0.72);
}

body.night .amz-aikb-confirm-dialog {
  border-color: rgba(212, 120, 63, 0.34);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

body.night .amz-aikb-confirm-btn--cancel:hover,
body.night .amz-aikb-confirm-close:hover {
  background: rgba(212, 120, 63, 0.12);
}

@keyframes amz-aikb-confirm-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes amz-aikb-confirm-dialog-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .amz-aikb-confirm-dialog {
    padding: 18px;
  }

  .amz-aikb-confirm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .amz-aikb-confirm-btn {
    min-width: 0;
    padding: 0 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .amz-aikb-confirm-overlay,
  .amz-aikb-confirm-dialog,
  .amz-aikb-confirm-overlay * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Trusted visual summaries ------------------------------------------------ */
.amz-aikb-session-menu {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
}

.amz-aikb-session-menu > summary {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  border-radius: 8px;
  color: var(--amz-aikb-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.amz-aikb-session-menu > summary::marker { content: ''; }
.amz-aikb-session-menu > summary::-webkit-details-marker { display: none; }

.amz-aikb-session-menu > summary::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: -6px 0 0 currentColor, 6px 0 0 currentColor;
}

.amz-aikb-session-menu > summary:hover { background: rgba(196, 92, 38, 0.08); color: var(--amz-aikb-accent); }

.amz-aikb-session-menu-pop {
  position: absolute;
  z-index: 20;
  top: calc(100% + 3px);
  right: 0;
  width: 172px;
  padding: 5px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  background: var(--amz-aikb-panel);
  box-shadow: 0 12px 28px rgba(28, 32, 39, 0.15);
}

.amz-aikb-session-menu-pop button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--amz-aikb-ink);
  text-align: left;
  cursor: pointer;
}

.amz-aikb-session-menu-pop button:hover { background: rgba(196, 92, 38, 0.08); }
.amz-aikb-session-menu-pop .amz-aikb-session-delete-action { color: #b33c36; }

.amz-aikb-generate-visual {
  min-height: 0;
  padding: 2px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--amz-aikb-muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.amz-aikb-generate-visual:hover {
  color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.08);
}

.amz-aikb-post-tool--visual {
  border-color: rgba(196, 92, 38, 0.45);
  background: rgba(196, 92, 38, 0.08);
  color: var(--amz-aikb-accent);
  font-weight: 600;
}

.amz-aikb-visual-task {
  width: min(100%, 640px);
  box-sizing: border-box;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid rgba(196, 92, 38, 0.24);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 253, 249, 0.98), rgba(249, 243, 234, 0.98));
  box-shadow: 0 8px 24px rgba(34, 39, 48, 0.07);
}

.amz-aikb-visual-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.amz-aikb-visual-task-head strong,
.amz-aikb-visual-task-head span { display: block; }
.amz-aikb-visual-task-head span { margin-top: 3px; color: var(--amz-aikb-muted); font-size: 12px; }
.amz-aikb-visual-edit-instruction {
  margin: 11px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(196, 92, 38, 0.07);
  color: var(--amz-aikb-ink);
  font-size: 12px;
  line-height: 1.55;
}
.amz-aikb-visual-task-head button {
  min-width: 60px;
  min-height: 40px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 9px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-muted);
  cursor: pointer;
}

.amz-aikb-visual-progress { margin-top: 14px; }
.amz-aikb-visual-progress-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--amz-aikb-ink);
  font-size: 12px;
}
.amz-aikb-visual-progress-summary time {
  flex: 0 0 auto;
  color: var(--amz-aikb-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.amz-aikb-visual-live { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.amz-aikb-visual-live > i {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amz-aikb-accent);
  box-shadow: 0 0 0 4px rgba(196, 92, 38, 0.11);
  animation: amz-aikb-visual-live 1.5s ease-in-out infinite;
}
.amz-aikb-visual-live > b { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.amz-aikb-visual-task.is-retrying .amz-aikb-visual-live > i { background: #c7902f; }
.amz-aikb-visual-progress-bar {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8dfd2;
}
.amz-aikb-visual-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 -28%;
  width: 28%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.82), transparent);
  animation: amz-aikb-visual-scan 1.8s ease-in-out infinite;
}
.amz-aikb-visual-progress-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c45c26, #e4a55f);
  transition: width 0.3s ease;
}
.amz-aikb-visual-progress-tip { margin: 9px 0 0; color: var(--amz-aikb-ink); font-size: 12px; line-height: 1.55; }
.amz-aikb-visual-progress-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  color: #a39a8f;
  font-size: 11px;
  list-style: none;
}
.amz-aikb-visual-progress-steps li { min-width: 0; }
.amz-aikb-visual-progress-steps li.is-active { color: var(--amz-aikb-accent); font-weight: 650; }
.amz-aikb-visual-progress-steps li.is-done { color: #3e7c68; }
.amz-aikb-visual-progress-note { display: block; margin-top: 9px; color: var(--amz-aikb-muted); font-size: 11px; line-height: 1.5; }
.amz-aikb-visual-task.is-failed,
.amz-aikb-visual-task.is-expired {
  border-color: rgba(117, 108, 96, 0.24);
  background: linear-gradient(145deg, rgba(255, 253, 249, 0.98), rgba(247, 244, 239, 0.98));
  box-shadow: 0 6px 18px rgba(34, 39, 48, 0.05);
}
.amz-aikb-visual-task-error {
  max-width: 660px;
  margin: 12px 0 0;
  color: var(--amz-aikb-muted);
  font-size: 13px;
  line-height: 1.65;
}
.amz-aikb-visual-failure-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.amz-aikb-visual-failure-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 9px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
  cursor: pointer;
}
.amz-aikb-visual-failure-actions button:first-child:not(:last-child) {
  border-color: rgba(196, 92, 38, 0.34);
  color: var(--amz-aikb-accent);
}
.amz-aikb-visual-expired-actions button {
  border-color: rgba(196, 92, 38, 0.34);
  background: rgba(196, 92, 38, 0.06);
  color: var(--amz-aikb-accent);
  font-weight: 650;
}

@keyframes amz-aikb-visual-live {
  0%, 100% { opacity: 0.58; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes amz-aikb-visual-scan {
  from { left: -28%; }
  to { left: 100%; }
}

.amz-aikb-visual-results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.amz-aikb-visual-results.is-card-set { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.amz-aikb-visual-results figure {
  min-width: 0;
  margin: 0;
  border-radius: 12px;
  transition: box-shadow 180ms ease;
}
.amz-aikb-visual-results figure.is-edit-target {
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.48), 0 10px 28px rgba(98, 51, 27, 0.14);
}
.amz-aikb-visual-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: zoom-in;
}
.amz-aikb-visual-preview:focus-visible { outline: 3px solid rgba(196, 92, 38, 0.38); outline-offset: 3px; }
.amz-aikb-visual-results img { display: block; width: 100%; max-height: 680px; border-radius: 12px; object-fit: contain; background: #eee8df; }
.amz-aikb-visual-version-nav { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.amz-aikb-visual-version-nav button {
  min-width: 36px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 999px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-muted);
  font-size: 12px;
  cursor: pointer;
}
.amz-aikb-visual-version-nav button.is-active {
  border-color: rgba(196, 92, 38, 0.48);
  background: rgba(196, 92, 38, 0.1);
  color: var(--amz-aikb-accent);
  font-weight: 700;
}
.amz-aikb-visual-asset-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.amz-aikb-visual-asset-actions button {
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 8px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-muted);
  font-size: 12px;
  cursor: pointer;
}

.amz-aikb-visual-edit-bar {
  display: grid;
  grid-template-columns: minmax(220px, max-content) minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
  width: calc(100% - 28px);
  max-width: none;
  margin: 8px 14px 0;
  padding: 9px 9px 7px;
  border: 1px solid rgba(196, 92, 38, 0.3);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: rgba(255, 253, 249, 0.98);
  box-sizing: border-box;
}
.amz-aikb-visual-edit-bar[hidden] { display: none !important; }
.amz-aikb-visual-edit-bar.is-submitting { opacity: 0.68; pointer-events: none; }
.amz-aikb-visual-edit-context {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.amz-aikb-visual-edit-thumbs {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  max-width: 126px;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}
.amz-aikb-visual-edit-thumbs::-webkit-scrollbar { display: none; }
.amz-aikb-visual-edit-thumb {
  width: 38px;
  height: 38px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 9px;
  object-fit: cover;
  background: var(--amz-aikb-soft);
}
.amz-aikb-visual-edit-thumb-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 1px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.amz-aikb-visual-edit-thumb-button .amz-aikb-visual-edit-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.amz-aikb-visual-edit-thumb-button.is-active {
  border-color: rgba(196, 92, 38, 0.62);
  background: rgba(196, 92, 38, 0.1);
  box-shadow: 0 0 0 2px rgba(196, 92, 38, 0.08);
}
.amz-aikb-visual-edit-thumb-button:focus-visible {
  outline: 3px solid rgba(196, 92, 38, 0.28);
  outline-offset: 1px;
}
.amz-aikb-visual-edit-thumb-button:disabled { cursor: not-allowed; opacity: 0.42; }
.amz-aikb-visual-edit-copy { min-width: 0; }
.amz-aikb-visual-edit-copy strong,
.amz-aikb-visual-edit-copy span { display: block; }
.amz-aikb-visual-edit-copy strong {
  overflow: hidden;
  color: var(--amz-aikb-ink);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amz-aikb-visual-edit-copy span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--amz-aikb-muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amz-aikb-visual-edit-cancel,
.amz-aikb-visual-edit-presets button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 8px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.amz-aikb-visual-edit-cancel { border-color: transparent; background: transparent; }
.amz-aikb-visual-edit-cancel:hover,
.amz-aikb-visual-edit-cancel:focus-visible { background: var(--amz-aikb-soft); color: var(--amz-aikb-ink); outline: none; }
.amz-aikb-visual-edit-presets {
  display: flex;
  gap: 6px;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
  white-space: nowrap;
}
.amz-aikb-visual-edit-presets::-webkit-scrollbar { display: none; }
.amz-aikb-visual-edit-presets button { flex: 0 0 auto; }
.amz-aikb-visual-edit-presets button.is-active {
  border-color: rgba(196, 92, 38, 0.48);
  background: rgba(196, 92, 38, 0.1);
  color: var(--amz-aikb-accent);
  font-weight: 650;
}
.amz-aikb-app.is-visual-editing .amz-aikb-composer {
  align-items: end;
  width: calc(100% - 28px);
  max-width: none;
  margin: 0 14px 12px;
  padding: 0 8px 8px;
  gap: 7px;
  border: 1px solid rgba(196, 92, 38, 0.3);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 253, 249, 0.98);
}
.amz-aikb-app.is-visual-editing .amz-aikb-composer textarea {
  height: 46px;
  min-height: 46px;
  max-height: 120px;
  padding: 11px 12px;
  border-color: var(--amz-aikb-line);
  border-radius: 10px;
  background: var(--amz-aikb-panel);
  box-shadow: none;
}
.amz-aikb-app.is-visual-editing .amz-aikb-composer textarea:focus {
  border-color: rgba(196, 92, 38, 0.62);
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.1);
}
.amz-aikb-app.is-visual-editing .amz-aikb-send {
  min-height: 46px;
  padding: 0 15px;
  white-space: nowrap;
}
body.night .amz-aikb-visual-edit-bar,
body.night .amz-aikb-app.is-visual-editing .amz-aikb-composer {
  border-color: rgba(229, 145, 93, 0.34);
  background: rgba(34, 37, 43, 0.98);
}
body.night .amz-aikb-visual-edit-presets button,
body.night .amz-aikb-app.is-visual-editing .amz-aikb-composer textarea {
  background: #1c1f25;
  border-color: var(--amz-aikb-line);
  color: var(--amz-aikb-ink);
}
body.night .amz-aikb-visual-edit-thumb-button.is-active {
  background: rgba(229, 145, 93, 0.14);
}

@container amz-aikb-main (max-width: 760px) {
  .amz-aikb-visual-edit-bar {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .amz-aikb-visual-edit-presets {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .amz-aikb-visual-edit-cancel {
    grid-column: 2;
    grid-row: 1;
  }
}

html.amz-aikb-visual-modal-open { overflow: hidden; }
.amz-aikb-visual-modal {
  position: fixed;
  z-index: 1000002;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 24, 32, 0.58);
  backdrop-filter: blur(5px);
}

.amz-aikb-visual-dialog {
  display: flex;
  flex-direction: column;
  width: min(820px, 100%);
  max-height: min(880px, calc(100vh - 48px));
  max-height: min(880px, calc(100dvh - 48px));
  overflow: hidden;
  border: 1px solid #e6ddd1;
  border-radius: 20px;
  background: #fffdf9;
  color: #1f2430;
  box-shadow: 0 26px 80px rgba(17, 22, 30, 0.28);
}

.amz-aikb-visual-dialog-head {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #ece4d9;
  background: rgba(255, 253, 249, 0.97);
  backdrop-filter: blur(8px);
}

.amz-aikb-visual-dialog h2 { margin: 0; font-size: 21px; }
.amz-aikb-visual-dialog-head p { margin: 5px 0 0; color: #77706a; font-size: 12px; }
.amz-aikb-visual-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #f2ece4;
  color: #514a43;
  font-size: 25px;
  cursor: pointer;
}

.amz-aikb-visual-form { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; padding: 0; }
.amz-aikb-visual-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 4px 22px 0;
  -webkit-overflow-scrolling: touch;
}
.amz-aikb-visual-form fieldset { margin: 18px 0 0; padding: 0; border: 0; }
.amz-aikb-visual-form legend,
.amz-aikb-visual-focus > span { display: block; margin-bottom: 8px; color: #38332f; font-size: 13px; font-weight: 700; }
.amz-aikb-visual-focus em { color: #928a82; font-size: 11px; font-style: normal; font-weight: 400; }
.amz-aikb-visual-segment,
.amz-aikb-visual-choice-grid,
.amz-aikb-visual-output-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.amz-aikb-visual-choice,
.amz-aikb-visual-segment button,
.amz-aikb-visual-output-grid button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #ddd3c6;
  border-radius: 10px;
  background: #fff;
  color: #58514a;
  cursor: pointer;
}

.amz-aikb-visual-choice.is-active,
.amz-aikb-visual-segment button.is-active,
.amz-aikb-visual-output-grid button.is-active {
  border-color: #c45c26;
  background: #fff7ef;
  color: #a7471d;
  box-shadow: inset 0 0 0 1px rgba(196, 92, 38, 0.14);
}

.amz-aikb-visual-segment button:disabled { opacity: 0.38; cursor: not-allowed; }
.amz-aikb-visual-choice-grid--layout .amz-aikb-visual-choice { flex: 1 0 128px; }
.amz-aikb-visual-style-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.amz-aikb-visual-style {
  position: relative;
  min-height: 104px;
  padding: 64px 6px 8px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f2eee8;
  color: #322d28;
  cursor: pointer;
}

.amz-aikb-visual-style::before { content: ""; position: absolute; inset: 0 0 38px; background: linear-gradient(145deg, #17304f 0 46%, #f4e8d6 46% 70%, #c28b42 70%); }
.amz-aikb-visual-style[data-value="minimal"]::before { background: linear-gradient(145deg, #fbfbf8 0 55%, #16867a 55% 62%, #242f2d 62%); }
.amz-aikb-visual-style[data-value="handdrawn"]::before { background: repeating-linear-gradient(-12deg, #fff7e8 0 14px, #d7c59f 15px, #fff7e8 16px 28px); }
.amz-aikb-visual-style[data-value="tech"]::before { background: linear-gradient(135deg, #061c31, #0d4664 60%, #36d3ff); }
.amz-aikb-visual-style[data-value="social"]::before { background: linear-gradient(135deg, #ffdfd5 0 33%, #e64e69 33% 65%, #563658 65%); }
.amz-aikb-visual-style.is-active { border-color: #c45c26; box-shadow: 0 0 0 2px #fff7ef; }

.amz-aikb-visual-focus { position: relative; display: block; margin-top: 18px; }
.amz-aikb-visual-focus input { width: 100%; height: 46px; box-sizing: border-box; padding: 0 64px 0 12px; border: 1px solid #ddd3c6; border-radius: 10px; background: #fff; color: #1f2430; font-size: 14px; }
.amz-aikb-visual-focus small { position: absolute; right: 12px; bottom: 14px; color: #948b83; font-size: 11px; }
.amz-aikb-visual-range > p,
.amz-aikb-visual-source-note { margin: -2px 0 9px; color: #77706a; font-size: 12px; }
.amz-aikb-visual-custom-range { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.amz-aikb-visual-custom-range label { display: flex; align-items: center; gap: 5px; }
.amz-aikb-visual-custom-range input { width: 74px; height: 44px; border: 1px solid #ddd3c6; border-radius: 9px; text-align: center; }
.amz-aikb-visual-output-grid { display: grid; grid-template-columns: 1fr 1fr; }
.amz-aikb-visual-output-grid button { height: auto; min-height: 68px; text-align: left; }
.amz-aikb-visual-output-grid strong,
.amz-aikb-visual-output-grid span { display: block; }
.amz-aikb-visual-output-grid span { margin-top: 4px; color: #80776e; font-size: 11px; }
.amz-aikb-visual-form-error { min-height: 20px; margin-top: 12px; color: #b44138; font-size: 12px; }
.amz-aikb-visual-dialog-foot { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; margin-top: 6px; padding: 15px 22px 22px; border-top: 1px solid #ece4d9; background: #fffdf9; }
.amz-aikb-visual-dialog-foot > span { color: #80776e; font-size: 11px; }
.amz-aikb-visual-submit { flex: 0 0 auto; min-width: 170px; min-height: 48px; border: 0; border-radius: 11px; background: #c45c26; color: #fff; font-weight: 700; cursor: pointer; }
.amz-aikb-visual-submit:disabled { opacity: 0.62; cursor: wait; }

body.night .amz-aikb-visual-dialog,
body.night .amz-aikb-visual-dialog-head,
body.night .amz-aikb-visual-dialog-foot { background: #20242b; color: #f5eee5; border-color: #3b414a; }
body.night .amz-aikb-visual-form legend,
body.night .amz-aikb-visual-focus > span { color: #efe8df; }

.amz-aikb-image-editor-modal {
  --amz-aikb-panel: #fffdf9;
  --amz-aikb-ink: #1f2430;
  --amz-aikb-muted: #6b7280;
  --amz-aikb-line: #e6dfd4;
  --amz-aikb-accent: #c45c26;
  --amz-aikb-soft: #f6f1ea;
  padding: 16px;
  background: rgba(15, 18, 23, 0.72);
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.amz-aikb-image-editor {
  display: flex;
  flex-direction: column;
  width: min(1440px, calc(100vw - 32px));
  height: min(900px, calc(100vh - 32px));
  height: min(900px, calc(100dvh - 32px));
  overflow: hidden;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 18px;
  background: var(--amz-aikb-panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  color: var(--amz-aikb-ink);
}
.amz-aikb-image-editor:focus { outline: none; }
.amz-aikb-image-editor-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--amz-aikb-line);
  background: var(--amz-aikb-panel);
}
.amz-aikb-image-editor-head h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.amz-aikb-image-editor-head p { margin: 3px 0 0; color: var(--amz-aikb-muted); font-size: 12px; }
.amz-aikb-image-editor-head-actions { display: flex; align-items: center; gap: 7px; }
.amz-aikb-image-editor-head-actions button,
.amz-aikb-image-editor-stage-tools button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 9px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.amz-aikb-image-editor-head-actions button:hover,
.amz-aikb-image-editor-head-actions button:focus-visible { border-color: rgba(196, 92, 38, 0.42); background: var(--amz-aikb-soft); outline: none; }
.amz-aikb-image-editor-head-actions button:disabled,
.amz-aikb-image-editor-stage-tools button:disabled { cursor: not-allowed; opacity: 0.42; }
.amz-aikb-image-editor-body {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 80px minmax(0, 1fr) 336px;
  min-height: 0;
  overflow: hidden;
}
.amz-aikb-image-editor-body.is-single-image { grid-template-columns: minmax(0, 1fr) 336px; }
.amz-aikb-image-editor-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow-y: auto;
  padding: 10px;
  border-right: 1px solid var(--amz-aikb-line);
  background: var(--amz-aikb-soft);
}
.amz-aikb-image-editor-strip[hidden] { display: none; }
.amz-aikb-image-editor-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 70px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--amz-aikb-panel);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}
.amz-aikb-image-editor-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: cover;
}
.amz-aikb-image-editor-thumb > span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: rgba(22, 25, 31, 0.82);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.amz-aikb-image-editor-thumb.is-active { border-color: var(--amz-aikb-accent); background: rgba(196, 92, 38, 0.12); }
.amz-aikb-image-editor-thumb:focus-visible { outline: 3px solid rgba(196, 92, 38, 0.28); outline-offset: 1px; }
.amz-aikb-image-editor-stage {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: #171a20;
  color: #f8f4ee;
}
.amz-aikb-image-editor-stage-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: #1d2026;
}
.amz-aikb-image-editor-stage-tools button {
  border-color: rgba(255, 255, 255, 0.14);
  background: #252932;
  color: #f7f3ed;
}
.amz-aikb-image-editor-stage-tools button:hover,
.amz-aikb-image-editor-stage-tools button:focus-visible { border-color: rgba(239, 155, 105, 0.68); background: #303541; outline: none; }
.amz-aikb-image-editor-pager,
.amz-aikb-image-editor-zoom { display: flex; align-items: center; gap: 6px; }
.amz-aikb-image-editor-pager > span {
  min-width: 54px;
  color: #c8cbd2;
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.amz-aikb-image-editor-zoom button:first-child,
.amz-aikb-image-editor-zoom button:last-child { width: 36px; padding: 0; font-size: 18px; }
.amz-aikb-image-editor-zoom [data-role="visual-editor-zoom"] { min-width: 58px; font-variant-numeric: tabular-nums; }
.amz-aikb-image-editor-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}
.amz-aikb-image-editor-canvas {
  position: relative;
  flex: 0 0 auto;
  width: 240px;
  height: 320px;
  margin: auto;
  line-height: 0;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);
}
.amz-aikb-image-editor-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}
.amz-aikb-image-editor-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--amz-aikb-line);
  background: var(--amz-aikb-panel);
}
.amz-aikb-image-editor-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.amz-aikb-image-editor-section {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}
.amz-aikb-image-editor-section legend,
.amz-aikb-image-editor-section-title strong,
.amz-aikb-image-editor-prompt > span {
  color: var(--amz-aikb-ink);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}
.amz-aikb-image-editor-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.amz-aikb-image-editor-section-title span { color: var(--amz-aikb-muted); font-size: 11px; }
.amz-aikb-image-editor-version-list,
.amz-aikb-image-editor-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.amz-aikb-image-editor-version-list button,
.amz-aikb-image-editor-presets button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 8px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.amz-aikb-image-editor-version-list button.is-active,
.amz-aikb-image-editor-presets button.is-active {
  border-color: rgba(196, 92, 38, 0.58);
  background: rgba(196, 92, 38, 0.1);
  color: var(--amz-aikb-accent);
  font-weight: 700;
}
.amz-aikb-image-editor-version-list button:focus-visible,
.amz-aikb-image-editor-presets button:focus-visible { outline: 3px solid rgba(196, 92, 38, 0.24); outline-offset: 1px; }
.amz-aikb-image-editor-version-list button:disabled,
.amz-aikb-image-editor-presets button:disabled { cursor: not-allowed; opacity: 0.42; }
.amz-aikb-image-editor-prompt { position: relative; display: block; }
.amz-aikb-image-editor-prompt > span { display: block; margin-bottom: 8px; }
.amz-aikb-image-editor-prompt textarea {
  display: block;
  width: 100%;
  min-height: 128px;
  max-height: 260px;
  resize: vertical;
  padding: 11px 12px 28px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  box-sizing: border-box;
}
.amz-aikb-image-editor-prompt textarea:focus { border-color: rgba(196, 92, 38, 0.62); outline: none; box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.1); }
.amz-aikb-image-editor-prompt textarea:disabled { cursor: not-allowed; opacity: 0.56; }
.amz-aikb-image-editor-prompt small { position: absolute; right: 9px; bottom: 7px; color: var(--amz-aikb-muted); font-size: 10px; }
.amz-aikb-image-editor-error { min-height: 20px; margin-top: 7px; color: #b44138; font-size: 12px; line-height: 1.45; }
.amz-aikb-image-editor-foot {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--amz-aikb-line);
  background: var(--amz-aikb-panel);
}
.amz-aikb-image-editor-foot > span { color: var(--amz-aikb-muted); font-size: 10px; line-height: 1.4; }
.amz-aikb-image-editor-submit {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--amz-aikb-accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.amz-aikb-image-editor-submit:hover,
.amz-aikb-image-editor-submit:focus-visible { filter: brightness(0.96); outline: 3px solid rgba(196, 92, 38, 0.24); outline-offset: 2px; }
.amz-aikb-image-editor-submit:disabled { cursor: not-allowed; opacity: 0.48; }
body.night .amz-aikb-image-editor,
body.night .amz-aikb-image-editor-head,
body.night .amz-aikb-image-editor-panel,
body.night .amz-aikb-image-editor-foot { background: #20242b; border-color: #3b414a; }
body.night .amz-aikb-image-editor-strip { background: #181c22; border-color: #3b414a; }
body.night .amz-aikb-image-editor-head-actions button,
body.night .amz-aikb-image-editor-version-list button,
body.night .amz-aikb-image-editor-presets button,
body.night .amz-aikb-image-editor-prompt textarea { background: #191d23; border-color: #3b414a; color: #f5eee5; }
body.night .amz-aikb-image-editor-modal {
  --amz-aikb-panel: #22252b;
  --amz-aikb-ink: #e8ebf0;
  --amz-aikb-muted: #a0a7b2;
  --amz-aikb-line: #353a44;
  --amz-aikb-accent: #d4783f;
  --amz-aikb-soft: #191d23;
}

@media (max-width: 1024px) {
  .amz-aikb-image-editor-body { grid-template-columns: 72px minmax(0, 1fr) 304px; }
  .amz-aikb-image-editor-body.is-single-image { grid-template-columns: minmax(0, 1fr) 304px; }
  .amz-aikb-image-editor-strip { padding-inline: 7px; }
}

@media (max-width: 860px) {
  .amz-aikb-side-tab,
  .amz-aikb-visual-filters button,
  .amz-aikb-session-menu > summary,
  .amz-aikb-generate-visual,
  .amz-aikb-visual-task-head button,
  .amz-aikb-visual-failure-actions button,
  .amz-aikb-visual-asset-actions button,
  .amz-aikb-visual-version-nav button,
  .amz-aikb-visual-edit-cancel,
  .amz-aikb-visual-edit-presets button { min-height: 44px; }
  .amz-aikb-visual-edit-bar { width: calc(100% - 20px); margin-inline: 10px; padding-inline: 8px; }
  .amz-aikb-app.is-visual-editing .amz-aikb-composer { width: calc(100% - 20px); margin-inline: 10px; }
  .amz-aikb-session-menu > summary { width: 44px; }
  .amz-aikb-visual-modal { align-items: end; padding: 0; }
  .amz-aikb-visual-dialog { width: 100%; max-height: min(92vh, 920px); max-height: min(92dvh, 920px); border-radius: 20px 20px 0 0; }
  .amz-aikb-visual-dialog-head { padding: 16px 16px 12px; }
  .amz-aikb-visual-dialog-body { padding: 2px 16px 0; }
  .amz-aikb-visual-style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amz-aikb-visual-style:last-child { grid-column: 1 / -1; }
  .amz-aikb-visual-output-grid { grid-template-columns: 1fr; }
  .amz-aikb-visual-dialog-foot { flex-direction: column; align-items: stretch; padding: 10px 16px max(16px, env(safe-area-inset-bottom, 0px)); }
  .amz-aikb-visual-submit { width: 100%; }
  .amz-aikb-visual-results.is-card-set { grid-template-columns: 1fr; }
  .amz-aikb-visual-progress-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
  .amz-aikb-image-editor-modal { align-items: stretch; padding: 0; }
  .amz-aikb-image-editor {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .amz-aikb-image-editor-head { min-height: 60px; padding: 8px 10px 8px 14px; }
  .amz-aikb-image-editor-head h2 { font-size: 16px; }
  .amz-aikb-image-editor-head-actions button,
  .amz-aikb-image-editor-stage-tools button,
  .amz-aikb-image-editor-version-list button,
  .amz-aikb-image-editor-presets button { min-height: 44px; }
  .amz-aikb-image-editor-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(280px, 42dvh) auto;
    overflow-y: auto;
  }
  .amz-aikb-image-editor-body.is-single-image { grid-template-columns: minmax(0, 1fr); }
  .amz-aikb-image-editor-strip {
    flex-direction: row;
    grid-row: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--amz-aikb-line);
  }
  .amz-aikb-image-editor-thumb { width: 52px; height: 58px; }
  .amz-aikb-image-editor-stage { grid-row: 2; min-height: 280px; }
  .amz-aikb-image-editor-panel { grid-row: 3; min-height: 0; border-top: 1px solid var(--amz-aikb-line); border-left: 0; }
  .amz-aikb-image-editor-panel-scroll { overflow: visible; padding: 16px 14px 8px; }
  .amz-aikb-image-editor-foot { position: sticky; z-index: 3; bottom: 0; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .amz-aikb-image-editor-prompt textarea { min-height: 104px; font-size: 16px; }
}

@media (max-width: 520px) {
  .amz-aikb-image-editor-head { gap: 8px; }
  .amz-aikb-image-editor-head-actions { gap: 4px; }
  .amz-aikb-image-editor-head-actions [data-action="copy-editor-image"] { display: none; }
  .amz-aikb-image-editor-head-actions button { padding-inline: 9px; }
  .amz-aikb-image-editor-stage-tools { padding-inline: 8px; }
  .amz-aikb-image-editor-pager button { padding-inline: 8px; }
  .amz-aikb-image-editor-viewport { padding: 16px; }
  .amz-aikb-image-editor-foot { align-items: stretch; flex-direction: column; }
  .amz-aikb-image-editor-foot > span { text-align: center; }
  .amz-aikb-image-editor-submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .amz-aikb-visual-modal *,
  .amz-aikb-visual-task * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

.amz-aikb-drawer[hidden] {
  display: none !important;
}

@keyframes amz-aikb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Opacity-only: transform on the panel would trap position:fixed descendants. */
@keyframes amz-aikb-slide {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

.amz-aikb-drawer-panel {
  position: relative;
  width: min(960px, 100%);
  min-width: min(480px, 100%);
  max-width: 100%;
  height: 100%;
  background: #f6f3ee;
  display: flex;
  flex-direction: column;
  padding: 12px;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
  animation: amz-aikb-slide 0.22s ease;
  container-type: inline-size;
  container-name: amz-aikb-drawer;
  box-sizing: border-box;
}

/* Left-edge drag handle — widen/narrow the right-docked drawer. */
.amz-aikb-drawer-resize {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  margin-left: -2px;
  cursor: ew-resize;
  z-index: 6;
  touch-action: none;
  user-select: none;
}

.amz-aikb-drawer-resize::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 40px;
  border-radius: 2px;
  background: rgba(196, 92, 38, 0.4);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.amz-aikb-drawer-resize:hover::after,
body.amz-aikb-drawer-resizing .amz-aikb-drawer-resize::after {
  opacity: 1;
}

body.amz-aikb-drawer-resizing {
  cursor: ew-resize !important;
  user-select: none !important;
}

.amz-aikb-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin-bottom: 8px;
  min-width: 0;
  box-sizing: border-box;
}

.amz-aikb-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

/* 桌面抽屉：标题在侧栏列内居中，收起按钮钉在左缘（面板控件，不粘标题） */
.amz-aikb-drawer .amz-aikb-drawer-title {
  position: relative;
  width: var(--amz-aikb-sidebar-w, 240px);
  max-width: var(--amz-aikb-sidebar-w, 240px);
  justify-content: center;
  box-sizing: border-box;
  padding-left: 0;
  padding-right: 0;
}

.amz-aikb-drawer .amz-aikb-drawer-title .amz-aikb-sidebar-toggle--icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* 侧栏收起后：按钮回到标题前，整组左对齐 */
.amz-aikb-drawer:has(.amz-aikb-app.is-sidebar-collapsed) .amz-aikb-drawer-title {
  width: auto;
  max-width: none;
  justify-content: flex-start;
}

.amz-aikb-drawer:has(.amz-aikb-app.is-sidebar-collapsed)
  .amz-aikb-drawer-title
  .amz-aikb-sidebar-toggle--icon {
  position: static;
  transform: none;
}

/* Drawer head already owns the title, identity and sidebar control. The
   in-app side head is otherwise empty, so collapse it instead of reserving
   desktop padding above the wallet/status content. */
.amz-aikb-drawer .amz-aikb-side-head {
  display: none;
}

.amz-aikb-drawer-title strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--amz-aikb-ink, #1f2430);
}

.amz-aikb-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.amz-aikb-drawer-new-session {
  display: none;
  align-items: center;
  flex-shrink: 0;
  line-height: 1;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid rgba(196, 92, 38, 0.38);
  border-radius: 999px;
  background: transparent;
  color: var(--amz-aikb-accent, #c45c26);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.amz-aikb-drawer:has(.amz-aikb-app.is-sidebar-collapsed) .amz-aikb-drawer-new-session {
  display: inline-flex;
}

.amz-aikb-drawer-new-session:hover {
  background: rgba(196, 92, 38, 0.08);
}

.amz-aikb-drawer-new-session.is-guest-locked,
.amz-aikb-drawer:has(.amz-aikb-app.is-busy) .amz-aikb-drawer-new-session {
  opacity: 0.45;
  cursor: not-allowed;
}

.amz-aikb-drawer-new-session:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.45);
  outline-offset: 1px;
}

.amz-aikb-drawer-fs,
.amz-aikb-drawer-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  line-height: 1;
  margin: 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.amz-aikb-drawer-fs:hover,
.amz-aikb-drawer-close:hover {
  color: var(--amz-aikb-accent, #c45c26);
  background: rgba(196, 92, 38, 0.1);
}

.amz-aikb-drawer-fs:active,
.amz-aikb-drawer-close:active {
  color: var(--amz-aikb-accent, #c45c26);
  background: rgba(196, 92, 38, 0.16);
}

.amz-aikb-drawer-fs:focus-visible,
.amz-aikb-drawer-close:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.45);
  outline-offset: 1px;
}

.amz-aikb-drawer-fs-icon,
.amz-aikb-drawer-close-icon {
  display: block;
  flex-shrink: 0;
}

.amz-aikb-drawer-fs-icon[hidden] {
  display: none !important;
}

/* Optional fullscreen: panel fills the viewport */
.amz-aikb-drawer.is-fullscreen {
  background: #f6f3ee;
}

.amz-aikb-drawer.is-fullscreen .amz-aikb-drawer-panel {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-shadow: none;
  animation: none;
}

.amz-aikb-drawer.is-fullscreen .amz-aikb-drawer-resize {
  display: none;
}

/* Fullscreen: main column content tracks the widened panel (not stuck at 920px). */
.amz-aikb-drawer.is-fullscreen .amz-aikb-app {
  --amz-aikb-msg-max: 100%;
}

.amz-aikb-drawer.is-fullscreen .amz-aikb-messages {
  padding-left: 22px;
  padding-right: 28px;
}

.amz-aikb-drawer.is-fullscreen .amz-aikb-composer-tools,
.amz-aikb-drawer.is-fullscreen .amz-aikb-composer {
  padding-left: 22px;
  padding-right: 28px;
}

.amz-aikb-drawer.is-fullscreen .amz-aikb-post-tools,
.amz-aikb-drawer.is-fullscreen .amz-aikb-suggestions,
.amz-aikb-drawer.is-fullscreen .amz-aikb-followups {
  max-width: 100%;
}

/* Resizable drawer: let answers track the available main-column width. */
.amz-aikb-drawer:not(.is-fullscreen) .amz-aikb-app {
  --amz-aikb-msg-max: 100%;
}

/* User + quota summary in drawer top bar (filled by renderWallet). */
.amz-aikb-drawer-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  color: var(--amz-aikb-ink);
}

.amz-aikb-drawer-status[hidden] {
  display: none !important;
}

.amz-aikb-drawer-index-status {
  display: none;
}

body.night .amz-aikb-drawer-index-status {
  border: 0;
  background: transparent;
  color: #f5e7c4;
}

.amz-aikb-drawer-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.amz-aikb-drawer-quota {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.amz-aikb-drawer-quota .amz-aikb-wallet-total {
  font-size: 12px;
}

.amz-aikb-drawer-quota .amz-aikb-wallet-parts {
  font-size: 11px;
}

.amz-aikb-drawer-quota .amz-aikb-wallet-login-tip {
  font-size: 11px;
}

.amz-aikb-drawer-status .amz-aikb-wallet-recharge {
  border: 0;
  background: transparent;
  color: var(--amz-aikb-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.amz-aikb-drawer-status .amz-aikb-wallet-recharge:hover {
  text-decoration: underline;
}

/* 抽屉变窄（拖拽宽度，非仅视口）：顶栏换行，避免用户/点数/按钮挤叠 */
@container amz-aikb-drawer (max-width: 920px) {
  .amz-aikb-drawer-head {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 6px;
  }

  .amz-aikb-drawer-title {
    width: auto !important;
    max-width: none !important;
    justify-content: flex-start !important;
  }

  .amz-aikb-drawer-title .amz-aikb-sidebar-toggle--icon {
    position: static !important;
    transform: none !important;
  }

  .amz-aikb-drawer-actions {
    margin-left: auto;
  }

  .amz-aikb-drawer-status {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 8px;
  }

  .amz-aikb-drawer-quota .amz-aikb-wallet-parts {
    display: none;
  }

  .amz-aikb-drawer-fs-label {
    display: none;
  }
}

@container amz-aikb-drawer (max-width: 640px) {
  .amz-aikb-drawer-user .amz-aikb-vip-tag {
    display: none;
  }

  .amz-aikb-drawer-user {
    max-width: 36%;
  }

  .amz-aikb-drawer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Drawer: identity/quota live in head — hide sidebar duplicates. */
.amz-aikb-drawer .amz-aikb-side-head [data-role="user-badge"] {
  display: none !important;
}

/* Drawer: drop the empty wallet chrome — VIP card already has its own panel. */
.amz-aikb-drawer .amz-aikb-wallet--drawer-side {
  margin: 0 12px 10px;
  padding: 0;
  background: transparent;
  border: 0;
}

.amz-aikb-drawer .amz-aikb-wallet--drawer-side .amz-aikb-vip-upsell {
  margin-top: 0;
}

.amz-aikb-drawer .amz-aikb-wallet--drawer-side:not(:has(.amz-aikb-vip-upsell)):not(:has(.amz-aikb-wallet-links)):not(:has(.amz-aikb-vip-index-status)) {
  display: none;
}

/* Quiet circular sidebar toggle: readable on both paper and night surfaces. */
.amz-aikb-sidebar-toggle--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--amz-aikb-line, #e6dfd4);
  border-radius: 999px;
  background: var(--amz-aikb-panel, #fffdf9);
  color: var(--amz-aikb-muted, #6b7280);
  box-shadow: 0 1px 3px rgba(31, 36, 48, 0.08);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease;
}

.amz-aikb-sidebar-toggle--icon:hover {
  border-color: color-mix(in srgb, var(--amz-aikb-accent, #c45c26) 48%, transparent);
  color: var(--amz-aikb-accent, #c45c26);
  background: rgba(196, 92, 38, 0.08);
  background: color-mix(
    in srgb,
    var(--amz-aikb-accent, #c45c26) 9%,
    var(--amz-aikb-panel, #fffdf9)
  );
  box-shadow: 0 3px 10px rgba(31, 36, 48, 0.12);
}

.amz-aikb-sidebar-toggle--icon:active {
  background: rgba(196, 92, 38, 0.13);
  box-shadow: inset 0 1px 2px rgba(31, 36, 48, 0.12);
}

.amz-aikb-sidebar-toggle--icon:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--amz-aikb-accent, #c45c26) 42%, transparent);
  outline-offset: 2px;
}

.amz-aikb-sidebar-toggle-icon {
  display: block;
  flex-shrink: 0;
}

.amz-aikb-drawer .amz-aikb-app {
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  max-height: none;
  box-sizing: border-box;
}

.amz-aikb-typing {
  color: var(--amz-aikb-muted);
  font-size: 13px;
}

.amz-aikb-typing::after {
  content: '…';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: amz-aikb-dots 1.2s steps(4, end) infinite;
}

.amz-aikb-wait-elapsed {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--amz-aikb-muted);
  background: rgba(0, 0, 0, 0.04);
  vertical-align: 1px;
  animation: amz-aikb-wait-pulse 1.6s ease-in-out infinite;
}

.amz-aikb-msg-assistant .amz-aikb-bubble > .amz-aikb-thought-flow {
  width: 100%;
  box-sizing: border-box;
  container-name: amz-aikb-vip-card;
  container-type: inline-size;
  padding: 13px 15px 12px;
  border: 1px solid color-mix(in srgb, var(--amz-aikb-accent) 20%, var(--amz-aikb-line));
  border-radius: 11px;
  color: var(--amz-aikb-ink);
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--amz-aikb-accent) 7%, var(--amz-aikb-panel)) 0%,
      var(--amz-aikb-panel) 72%
    );
  box-shadow: 0 7px 22px rgba(31, 36, 48, 0.055);
}

/* Deep-mode progress is a compact transient component, not a finished answer.
   Remove the full-width answer shell while it is active; the final answer that
   replaces this node keeps the normal fluid reading layout. */
.amz-aikb-msg-assistant.amz-aikb-msg--vip-progress .amz-aikb-bubble {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.amz-aikb-thought-flow-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  font-size: 13px;
}

.amz-aikb-thought-flow-head strong {
  color: var(--amz-aikb-ink);
  font-weight: 650;
}

.amz-aikb-thought-vip-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--amz-aikb-vip) 72%, transparent);
  border-radius: 999px;
  color: var(--amz-aikb-vip-ink);
  background: var(--amz-aikb-vip-grad);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
}

.amz-aikb-thought-flow-spark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--amz-aikb-accent);
  background: color-mix(in srgb, var(--amz-aikb-accent) 11%, transparent);
  animation: amz-aikb-thought-spark 1.8s ease-in-out infinite;
}

.amz-aikb-thought-flow-time {
  margin-left: auto;
  color: var(--amz-aikb-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amz-aikb-thought-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--amz-aikb-muted);
  font-size: 10px;
  white-space: nowrap;
}

.amz-aikb-thought-live > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amz-aikb-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amz-aikb-accent) 12%, transparent);
  animation: amz-aikb-live-dot 1.4s ease-in-out infinite;
}

.amz-aikb-thought-live.is-waiting > span {
  background: var(--amz-aikb-muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amz-aikb-muted) 12%, transparent);
}

.amz-aikb-thought-live.is-recovering {
  color: var(--amz-aikb-vip-ink);
}

.amz-aikb-thought-live.is-recovering > span {
  background: var(--amz-aikb-vip);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amz-aikb-vip) 14%, transparent);
}

.amz-aikb-thought-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 12px 0 10px;
  padding: 0;
  list-style: none;
}

.amz-aikb-thought-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--amz-aikb-muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
}

.amz-aikb-thought-step:not(:last-child)::after {
  content: '';
  position: absolute;
  z-index: 0;
  top: 5px;
  left: calc(50% + 8px);
  width: calc(100% - 16px);
  height: 1px;
  background: var(--amz-aikb-line);
}

.amz-aikb-thought-step.is-done::after {
  background: color-mix(in srgb, var(--amz-aikb-accent) 62%, var(--amz-aikb-line));
}

.amz-aikb-thought-step-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  box-sizing: border-box;
  border: 2px solid var(--amz-aikb-line);
  border-radius: 50%;
  background: var(--amz-aikb-panel);
}

.amz-aikb-thought-step.is-done,
.amz-aikb-thought-step.is-active {
  color: var(--amz-aikb-ink);
}

.amz-aikb-thought-step.is-done .amz-aikb-thought-step-dot {
  border-color: var(--amz-aikb-accent);
  background: var(--amz-aikb-accent);
}

.amz-aikb-thought-step.is-active .amz-aikb-thought-step-dot {
  border-color: var(--amz-aikb-accent);
  background: var(--amz-aikb-panel);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--amz-aikb-accent) 14%, transparent);
  animation: amz-aikb-thought-node 1.4s ease-in-out infinite;
}

.amz-aikb-thought-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amz-aikb-reasoning-stream {
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--amz-aikb-line) 82%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--amz-aikb-panel) 76%, transparent);
}

.amz-aikb-reasoning-stream-title {
  margin-bottom: 5px;
  color: var(--amz-aikb-muted);
  font-size: 10px;
  font-weight: 650;
}

.amz-aikb-reasoning-events {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.amz-aikb-reasoning-event {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--amz-aikb-muted);
  font-size: 11px;
  line-height: 1.4;
}

.amz-aikb-reasoning-event.is-active {
  color: var(--amz-aikb-ink);
}

.amz-aikb-reasoning-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--amz-aikb-muted) 44%, transparent);
}

.amz-aikb-reasoning-event.is-active .amz-aikb-reasoning-event-dot {
  background: var(--amz-aikb-accent);
  animation: amz-aikb-live-dot 1.4s ease-in-out infinite;
}

.amz-aikb-reasoning-event-text {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.amz-aikb-reasoning-event-time {
  color: var(--amz-aikb-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amz-aikb-reasoning-live-text {
  max-height: 240px;
  overflow: auto;
  padding-right: 4px;
  color: var(--amz-aikb-ink);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

.amz-aikb-reasoning-live-limit {
  margin-top: 7px;
  color: var(--amz-aikb-muted);
  font-size: 10px;
}

.amz-aikb-reasoning-details {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  border: 1px solid color-mix(in srgb, var(--amz-aikb-accent) 18%, var(--amz-aikb-line));
  border-radius: 10px;
  color: var(--amz-aikb-ink);
  background: color-mix(in srgb, var(--amz-aikb-accent) 4%, var(--amz-aikb-panel));
}

.amz-aikb-reasoning-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  box-sizing: border-box;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.amz-aikb-reasoning-summary::-webkit-details-marker {
  display: none;
}

.amz-aikb-reasoning-summary:focus-visible {
  border-radius: 9px;
  outline: 2px solid color-mix(in srgb, var(--amz-aikb-accent) 48%, transparent);
  outline-offset: 2px;
}

.amz-aikb-reasoning-summary-icon {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  border-radius: 50%;
  color: var(--amz-aikb-accent);
  background: color-mix(in srgb, var(--amz-aikb-accent) 11%, transparent);
  font-size: 11px;
}

.amz-aikb-reasoning-summary strong {
  font-size: 12px;
  font-weight: 650;
}

.amz-aikb-reasoning-summary-duration {
  color: var(--amz-aikb-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.amz-aikb-reasoning-summary-chevron {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--amz-aikb-muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 180ms ease;
}

.amz-aikb-reasoning-details[open] .amz-aikb-reasoning-summary-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.amz-aikb-reasoning-body {
  padding: 0 12px 11px;
  border-top: 1px solid color-mix(in srgb, var(--amz-aikb-line) 76%, transparent);
}

.amz-aikb-reasoning-text {
  max-height: min(42vh, 420px);
  overflow: auto;
  padding: 10px 2px 3px;
  color: color-mix(in srgb, var(--amz-aikb-ink) 88%, var(--amz-aikb-muted));
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  scrollbar-width: thin;
}

.amz-aikb-reasoning-truncated,
.amz-aikb-reasoning-note {
  margin: 8px 0 0;
  color: var(--amz-aikb-muted);
  font-size: 10px;
  line-height: 1.5;
}

.amz-aikb-reasoning-note {
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--amz-aikb-line) 82%, transparent);
}

.amz-aikb-vip-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 0 0 9px;
}

.amz-aikb-vip-progress-title {
  margin-right: 1px;
  color: var(--amz-aikb-muted);
  font-size: 10px;
  white-space: nowrap;
}

.amz-aikb-vip-progress-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 20px;
  box-sizing: border-box;
  padding: 1px 7px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 999px;
  color: var(--amz-aikb-muted);
  background: color-mix(in srgb, var(--amz-aikb-panel) 90%, transparent);
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
}

.amz-aikb-vip-progress-item.is-done {
  border-color: color-mix(in srgb, var(--amz-aikb-vip) 46%, var(--amz-aikb-line));
  color: var(--amz-aikb-ink);
  background: color-mix(in srgb, var(--amz-aikb-vip) 9%, var(--amz-aikb-panel));
}

.amz-aikb-vip-progress-item.is-active {
  border-color: color-mix(in srgb, var(--amz-aikb-vip) 76%, var(--amz-aikb-line));
  color: var(--amz-aikb-vip-ink);
  background: color-mix(in srgb, var(--amz-aikb-vip) 24%, var(--amz-aikb-panel));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--amz-aikb-vip) 9%, transparent);
}

.amz-aikb-vip-progress-item.is-entitled {
  border-color: color-mix(in srgb, var(--amz-aikb-vip) 56%, var(--amz-aikb-line));
  color: var(--amz-aikb-vip-ink);
  background: color-mix(in srgb, var(--amz-aikb-vip) 14%, var(--amz-aikb-panel));
}

.amz-aikb-vip-progress-item.is-live {
  border-color: color-mix(in srgb, var(--amz-aikb-accent) 38%, var(--amz-aikb-line));
  color: var(--amz-aikb-ink);
  background: color-mix(in srgb, var(--amz-aikb-accent) 7%, var(--amz-aikb-panel));
}

.amz-aikb-vip-progress-item.is-live > span:first-child {
  color: var(--amz-aikb-accent);
  font-size: 8px;
}

.amz-aikb-vip-progress--run {
  margin-top: -3px;
}

.amz-aikb-thought-detail {
  min-height: 22px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--amz-aikb-line) 76%, transparent);
}

@keyframes amz-aikb-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '…'; }
}

@keyframes amz-aikb-wait-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

@keyframes amz-aikb-thought-spark {
  0%, 100% { transform: scale(0.92) rotate(0); opacity: 0.72; }
  50% { transform: scale(1.06) rotate(12deg); opacity: 1; }
}

@keyframes amz-aikb-thought-node {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--amz-aikb-accent) 10%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--amz-aikb-accent) 18%, transparent); }
}

@keyframes amz-aikb-live-dot {
  0%, 100% { opacity: 0.5; transform: scale(0.86); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* The progress card responds to its own width, so the same component works in
   a narrow drawer, fullscreen mode, and embedded layouts without viewport guesses. */
@container amz-aikb-vip-card (max-width: 520px) {
  .amz-aikb-thought-flow-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  .amz-aikb-thought-flow-time {
    margin-left: 0;
  }

  .amz-aikb-thought-live {
    margin-left: auto;
  }

  .amz-aikb-thought-steps {
    margin-bottom: 8px;
  }

  .amz-aikb-thought-step {
    font-size: 10px;
  }

  .amz-aikb-reasoning-event {
    grid-template-columns: 8px minmax(0, 1fr);
  }

  .amz-aikb-reasoning-event-time {
    display: none;
  }
}

@container amz-aikb-vip-card (max-width: 400px) {
  .amz-aikb-vip-progress-title {
    flex: 1 0 100%;
  }
}

.amz-aikb-post-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: var(--amz-aikb-msg-max, 100%);
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 6px 8px;
  border: 1px solid rgba(196, 92, 38, 0.16);
  border-radius: 12px;
  background: rgba(196, 92, 38, 0.03);
}

.amz-aikb-post-tools-head {
  flex: 0 0 auto;
  padding-left: 2px;
}

.amz-aikb-post-tools-label {
  color: var(--amz-aikb-ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.amz-aikb-post-tools-actions {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 6px;
  padding: 2px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.amz-aikb-post-tools-actions::-webkit-scrollbar {
  display: none;
}

.amz-aikb-post-tool {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 999px;
  background: #fff;
  color: var(--amz-aikb-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
    transform 0.12s ease;
}

.amz-aikb-post-tool:hover,
.amz-aikb-post-tool:focus-visible {
  border-color: var(--amz-aikb-accent);
  color: var(--amz-aikb-accent);
  box-shadow: 0 3px 10px rgba(196, 92, 38, 0.12);
}

.amz-aikb-post-tool:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.34);
  outline-offset: 2px;
}

.amz-aikb-post-tool:active {
  transform: translateY(1px);
}

.amz-aikb-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}

.amz-aikb-suggestions-head {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin-bottom: 2px;
}

.amz-aikb-suggestions-label {
  font-size: 12px;
  color: var(--amz-aikb-muted);
  margin: 0;
}

.amz-aikb-scope-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--amz-aikb-muted);
  white-space: nowrap;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.amz-aikb-followups-label[data-role="scope-badge"] {
  display: inline-block;
  margin-bottom: 6px;
}

.amz-aikb-scope-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--amz-aikb-line);
}

.amz-aikb-scope-tab {
  border: 0;
  background: transparent;
  color: var(--amz-aikb-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.amz-aikb-scope-tab:hover {
  color: var(--amz-aikb-ink);
}

.amz-aikb-scope-tab.is-active {
  background: #fff;
  color: var(--amz-aikb-accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Tight mobile: upward scope menu (shown via --mobile-tight) */
.amz-aikb-scope-picker {
  position: relative;
  display: none;
}

.amz-aikb-scope-picker-trigger {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--amz-aikb-ink);
  white-space: nowrap;
}

.amz-aikb-scope-picker-trigger::-webkit-details-marker {
  display: none;
}

.amz-aikb-scope-picker-value {
  color: var(--amz-aikb-accent);
}

.amz-aikb-scope-picker-caret {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  color: var(--amz-aikb-muted);
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.amz-aikb-scope-picker[open] .amz-aikb-scope-picker-caret {
  transform: rotate(-90deg);
}

.amz-aikb-scope-picker-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: max(100%, 120px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 -6px 20px rgba(31, 36, 48, 0.12);
  z-index: 90;
}

.amz-aikb-scope-picker-opt {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--amz-aikb-muted);
  cursor: pointer;
  white-space: nowrap;
}

.amz-aikb-scope-picker-opt:hover {
  color: var(--amz-aikb-ink);
  background: rgba(0, 0, 0, 0.03);
}

.amz-aikb-scope-picker-opt.is-active {
  background: rgba(196, 92, 38, 0.08);
  color: var(--amz-aikb-accent);
}

.amz-aikb-suggestions-empty {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--amz-aikb-muted);
}

.amz-aikb-suggestion {
  border: 1px solid var(--amz-aikb-line);
  background: #fff;
  color: var(--amz-aikb-ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.amz-aikb-suggestion:hover {
  border-color: var(--amz-aikb-accent);
  color: var(--amz-aikb-accent);
  box-shadow: 0 2px 8px rgba(196, 92, 38, 0.1);
}

/* Questions tailored to the current page: accent border + context tag
   (本文 / 本栏目 / 搜索, injected via data-tag) */
.amz-aikb-suggestion--page {
  border-color: rgba(196, 92, 38, 0.4);
  background: rgba(196, 92, 38, 0.04);
}

.amz-aikb-suggestion--term {
  border-color: rgba(46, 110, 158, 0.35);
  background: rgba(46, 110, 158, 0.04);
}

.amz-aikb-suggestion[data-tag]::before {
  content: attr(data-tag);
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #6b7280;
  color: #fff;
  font-size: 10px;
  line-height: 1.5;
  vertical-align: 1px;
}

.amz-aikb-suggestion--page[data-tag]::before {
  background: var(--amz-aikb-accent);
}

.amz-aikb-suggestion--term[data-tag]::before {
  background: #2e6e9e;
}

/* Site-wide popular questions: red tag to stand apart from page-tailored */
.amz-aikb-suggestion--hot {
  border-color: rgba(214, 69, 65, 0.35);
}

.amz-aikb-suggestion--hot[data-tag]::before {
  background: #d64541;
}

/* Attention flash when guiding the user to the packs section */
.amz-aikb-flash {
  animation: amz-aikb-flash 0.9s ease 2;
  border-radius: 10px;
}

@keyframes amz-aikb-flash {
  50% {
    box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.35);
  }
}

/* Packs + ask-scope + premium above the composer */
.amz-aikb-composer-tools {
  --amz-aikb-toolbar-control-h: 32px;
  position: relative;
  z-index: 8;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 14px 1px;
  border-top: 1px solid var(--amz-aikb-line);
  background: rgba(255, 253, 249, 0.95);
  overflow: visible;
  box-sizing: border-box;
}

.amz-aikb-composer-tools .amz-aikb-packs:not(.amz-aikb-packs--inline),
.amz-aikb-composer-tools .amz-aikb-exchange:not(.amz-aikb-exchange--inline) {
  flex: 0 0 auto;
  flex-shrink: 0;
  max-width: none;
}

.amz-aikb-composer-tools-end {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.amz-aikb-ask-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.amz-aikb-ask-scope[hidden] {
  display: none !important;
}

.amz-aikb-ask-scope .amz-aikb-scope-tabs {
  flex-shrink: 0;
  height: var(--amz-aikb-toolbar-control-h);
  box-sizing: border-box;
}

.amz-aikb-ask-scope .amz-aikb-scope-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--amz-aikb-toolbar-control-h) - 6px);
  box-sizing: border-box;
  padding-block: 0;
}

.amz-aikb-composer {
  border-top: 0;
  padding-top: 8px;
}

.amz-aikb-premium-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: var(--amz-aikb-toolbar-control-h);
  box-sizing: border-box;
  border: 1px solid var(--amz-aikb-line);
  background: rgba(245, 242, 237, 0.92);
  color: var(--amz-aikb-muted);
  padding: 2px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.amz-aikb-mode-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: calc(var(--amz-aikb-toolbar-control-h) - 6px);
  box-sizing: border-box;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--amz-aikb-muted);
  font-weight: 600;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.amz-aikb-mode-option--standard {
  background: #fff;
  color: var(--amz-aikb-accent);
  box-shadow: 0 1px 4px rgba(31, 36, 48, 0.12);
}

.amz-aikb-premium-toggle.is-on .amz-aikb-mode-option--standard {
  background: transparent;
  color: var(--amz-aikb-muted);
  box-shadow: none;
}

.amz-aikb-premium-toggle.is-on .amz-aikb-mode-option--deep {
  background: linear-gradient(180deg, rgba(240, 214, 141, 0.52), rgba(224, 191, 115, 0.34));
  color: var(--amz-aikb-vip-ink);
  box-shadow: 0 1px 5px rgba(141, 110, 99, 0.18);
}

.amz-aikb-premium-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.amz-aikb-brain-lobe {
  opacity: 0.78;
  transform-box: fill-box;
  transform-origin: center;
}

.amz-aikb-brain-core {
  opacity: 0.9;
}

.amz-aikb-premium-toggle:hover:not(.is-activating) .amz-aikb-brain-lobe {
  animation: amz-aikb-brain-think 1.8s ease-in-out infinite;
}

.amz-aikb-premium-toggle:hover:not(.is-activating) .amz-aikb-brain-lobe--right {
  animation-delay: -0.9s;
}

.amz-aikb-premium-toggle:hover:not(.is-activating) .amz-aikb-brain-core {
  animation: amz-aikb-brain-core 1.8s ease-in-out infinite;
}

.amz-aikb-premium-toggle.is-activating .amz-aikb-premium-icon {
  animation: amz-aikb-brain-activate 0.82s cubic-bezier(0.22, 0.9, 0.28, 1) both;
}

.amz-aikb-premium-toggle.is-activating .amz-aikb-brain-lobe {
  animation: amz-aikb-brain-activate-lobe 0.72s ease-out both;
}

.amz-aikb-premium-toggle.is-activating .amz-aikb-brain-lobe--right {
  animation-delay: 0.08s;
}

.amz-aikb-premium-toggle.is-activating .amz-aikb-brain-core {
  animation: amz-aikb-brain-activate-core 0.72s ease-out both;
}

@keyframes amz-aikb-brain-think {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.91);
  }
  50% {
    opacity: 1;
    transform: scale(1.075);
  }
}

@keyframes amz-aikb-brain-core {
  0%,
  100% {
    opacity: 0.68;
  }
  50% {
    opacity: 1;
  }
}

@keyframes amz-aikb-brain-activate {
  0% {
    transform: scale(0.9) rotate(-4deg);
    filter: drop-shadow(0 0 0 rgba(141, 110, 99, 0));
  }
  44% {
    transform: scale(1.16) rotate(3deg);
    filter: drop-shadow(0 0 2.4px rgba(141, 110, 99, 0.48));
  }
  72% {
    transform: scale(0.97) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0);
    filter: drop-shadow(0 0 0 rgba(141, 110, 99, 0));
  }
}

@keyframes amz-aikb-brain-activate-lobe {
  0% {
    opacity: 0.28;
    transform: scale(0.82);
  }
  55% {
    opacity: 1;
    transform: scale(1.12);
  }
  100% {
    opacity: 0.78;
    transform: scale(1);
  }
}

@keyframes amz-aikb-brain-activate-core {
  0% {
    opacity: 0.42;
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .amz-aikb-premium-toggle,
  .amz-aikb-mode-option,
  .amz-aikb-premium-toggle.is-activating .amz-aikb-premium-icon,
  .amz-aikb-premium-toggle:hover:not(.is-activating) .amz-aikb-brain-lobe,
  .amz-aikb-premium-toggle:hover:not(.is-activating) .amz-aikb-brain-core,
  .amz-aikb-premium-toggle.is-activating .amz-aikb-brain-lobe,
  .amz-aikb-premium-toggle.is-activating .amz-aikb-brain-core {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes amz-aikb-brain-fade {
  0%,
  100% {
    opacity: 0.38;
  }
  50% {
    opacity: 1;
  }
}

@keyframes amz-aikb-brain-activate-fade {
  0%,
  100% {
    opacity: 0.52;
  }
  50% {
    opacity: 1;
  }
}

.amz-aikb-premium-toggle .amz-aikb-premium-x {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(141, 110, 99, 0.1);
}

.amz-aikb-premium-toggle:hover {
  border-color: var(--amz-aikb-vip);
  box-shadow: 0 0 0 2px rgba(224, 191, 115, 0.12);
}

.amz-aikb-premium-toggle:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.4);
  outline-offset: 2px;
}

.amz-aikb-premium-toggle.is-on {
  border-color: var(--amz-aikb-vip);
  background: rgba(245, 242, 237, 0.92);
}

.amz-aikb-premium-toggle.is-on .amz-aikb-premium-x {
  background: var(--amz-aikb-vip-grad);
  color: var(--amz-aikb-vip-ink);
}

body.night .amz-aikb-premium-toggle.is-on {
  border-color: rgba(224, 191, 115, 0.78);
  background: rgba(31, 34, 41, 0.96);
}

body.night .amz-aikb-mode-option--standard {
  background: rgba(255, 255, 255, 0.09);
  color: #e2a27c;
}

body.night .amz-aikb-premium-toggle.is-on .amz-aikb-mode-option--standard {
  background: transparent;
  color: var(--amz-aikb-muted);
}

body.night .amz-aikb-premium-toggle.is-on .amz-aikb-mode-option--deep {
  background: var(--amz-aikb-vip-grad);
  color: #4e342e;
}

body.night .amz-aikb-premium-toggle.is-on .amz-aikb-premium-x {
  background: var(--amz-aikb-vip-grad);
  color: #4e342e;
  box-shadow: 0 0 0 1px rgba(240, 214, 141, 0.2);
}

/* Non-VIP: toggle rendered locked as an upgrade nudge */
.amz-aikb-premium-toggle.is-locked {
  opacity: 0.9;
  cursor: not-allowed;
}

.amz-aikb-premium-toggle.is-locked:hover {
  border-color: var(--amz-aikb-vip);
}

.amz-aikb-premium-lock {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
}

.amz-aikb-send:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Live "stop generating" state of the send button */
.amz-aikb-send.is-stop {
  background: var(--amz-aikb-user);
}

.amz-aikb-send.is-stop:hover:not(:disabled) {
  background: #1d2433;
}

.amz-aikb-stopped {
  margin-top: 6px;
  font-size: 12px;
  color: var(--amz-aikb-muted);
}

/* Helpful / not-helpful feedback on answers — icon + title hover tip */
.amz-aikb-feedback {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.amz-aikb-fb-btn {
  border: 0;
  background: transparent;
  color: var(--amz-aikb-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.amz-aikb-fb-btn .amz-aikb-fb-icon {
  display: block;
}

.amz-aikb-fb-btn:hover {
  color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.08);
}

.amz-aikb-generate-visual:focus-visible {
  outline: 2px solid rgba(196, 92, 38, 0.34);
  outline-offset: 2px;
}

.amz-aikb-generate-visual:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.amz-aikb-fb-btn--up.is-active {
  color: #2e9e5b;
  background: rgba(46, 158, 91, 0.12);
}

.amz-aikb-fb-btn--down.is-active {
  color: var(--amz-aikb-accent);
  background: rgba(196, 92, 38, 0.12);
}

/* Follow-up question chips under the latest answer */
.amz-aikb-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 14px;
}

.amz-aikb-followups-label {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--amz-aikb-muted);
  margin-bottom: 2px;
}

.amz-aikb-followups--refresh {
  align-items: center;
}

.amz-aikb-followup-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(36, 48, 65, 0.08);
}

.amz-aikb-followup-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.72) 48%,
    transparent 76%
  );
  transform: translateX(-115%);
  animation: amz-aikb-skeleton-sweep 1.35s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.amz-aikb-followups--skeleton {
  align-items: center;
}

.amz-aikb-followup-skeleton,
.amz-aikb-followup {
  box-sizing: border-box;
  flex: 0 1 auto;
}

.amz-aikb-followup-skeleton {
  width: clamp(210px, 41%, 420px);
}

.amz-aikb-followup {
  width: auto;
  max-width: 100%;
}

.amz-aikb-followup-skeleton {
  height: 36px;
  border: 1px solid color-mix(in srgb, var(--amz-aikb-line) 72%, transparent);
  border-radius: 999px;
}

.amz-aikb-followup-skeleton:nth-child(3) {
  width: clamp(220px, 45%, 460px);
}

.amz-aikb-followup-skeleton:nth-child(4) {
  width: clamp(190px, 36%, 370px);
}

body.night .amz-aikb-followup-skeleton {
  background: rgba(255, 255, 255, 0.09);
}

body.night .amz-aikb-followup-skeleton::after {
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.13) 48%,
    transparent 76%
  );
}

.amz-aikb-followups-refresh-status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--amz-aikb-muted);
  font-size: 13px;
}

.amz-aikb-followups--refresh.is-loading .amz-aikb-followups-refresh-status::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--amz-aikb-accent);
  animation: amz-aikb-followup-refresh-pulse 0.9s ease-in-out infinite alternate;
}

.amz-aikb-followups-refresh-retry {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 999px;
  background: #fff;
  color: var(--amz-aikb-ink);
  font-size: 13px;
  cursor: pointer;
}

.amz-aikb-followups-refresh-retry:hover,
.amz-aikb-followups-refresh-retry:focus-visible {
  border-color: var(--amz-aikb-accent);
  color: var(--amz-aikb-accent);
}

body.night .amz-aikb-followups-refresh-retry {
  background: var(--amz-aikb-panel);
  border-color: var(--amz-aikb-line);
  color: var(--amz-aikb-ink);
}

@keyframes amz-aikb-followup-refresh-pulse {
  from {
    opacity: 0.35;
    transform: scale(0.82);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes amz-aikb-skeleton-sweep {
  to {
    transform: translateX(115%);
  }
}

@keyframes amz-aikb-followup-reveal {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.amz-aikb-followups.is-revealing .amz-aikb-followups-label,
.amz-aikb-followups.is-revealing .amz-aikb-followup {
  animation: amz-aikb-followup-reveal 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.amz-aikb-followups.is-revealing .amz-aikb-followup:nth-child(3) {
  animation-delay: 0.025s;
}

.amz-aikb-followups.is-revealing .amz-aikb-followup:nth-child(4) {
  animation-delay: 0.05s;
}

@media (prefers-reduced-motion: reduce) {
  .amz-aikb-followups--refresh.is-loading .amz-aikb-followups-refresh-status::before {
    animation: none;
  }

  .amz-aikb-followup-skeleton::after,
  .amz-aikb-followups.is-revealing .amz-aikb-followups-label,
  .amz-aikb-followups.is-revealing .amz-aikb-followup {
    animation: none;
  }
}

.amz-aikb-followup {
  height: 36px;
  border: 1px solid var(--amz-aikb-line);
  background: #fff;
  color: var(--amz-aikb-ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.amz-aikb-followup:hover {
  border-color: var(--amz-aikb-accent);
  color: var(--amz-aikb-accent);
  box-shadow: 0 2px 8px rgba(196, 92, 38, 0.1);
}

.amz-aikb-followup.is-asked {
  opacity: 0.62;
  border-style: dashed;
  color: var(--amz-aikb-muted);
  background: rgba(0, 0, 0, 0.02);
}

.amz-aikb-followup.is-asked[data-asked]::before {
  content: attr(data-asked);
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--amz-aikb-muted);
  font-size: 10px;
  line-height: 1.5;
  vertical-align: 1px;
}

.amz-aikb-followup.is-asked:hover {
  opacity: 0.85;
  border-color: var(--amz-aikb-line);
  color: var(--amz-aikb-ink);
  box-shadow: none;
}

@media (max-width: 860px) {
  .amz-aikb-followup-skeleton {
    width: 92%;
    height: 52px;
  }

  .amz-aikb-followup-skeleton:nth-child(3) {
    width: 82%;
  }

  .amz-aikb-followup-skeleton:nth-child(4) {
    width: 88%;
  }

  .amz-aikb-followup {
    display: block;
    width: auto;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    line-height: 18px;
    white-space: nowrap;
  }

  .amz-aikb-post-tools {
    gap: 7px;
    padding: 5px 6px;
  }

  .amz-aikb-post-tool {
    min-height: 38px;
    padding: 7px 11px;
  }

  /* Mobile drawer already fills the viewport */
  .amz-aikb-drawer-fs {
    display: none;
  }

  /* dvh 跟随移动端地址栏伸缩，保证输入区始终可见（旧浏览器回退 inset:0） */
  .amz-aikb-drawer {
    height: 100dvh;
  }

  .amz-aikb-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    /* Definite height keeps messages/sessions scrolling internally;
       height:auto would grow the page and kill the inner scrollbars. */
    height: var(--amz-aikb-height, 75vh);
    min-height: 420px;
  }

  .amz-aikb-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--amz-aikb-line);
    max-height: none;
  }

  /* Mobile uses the "历史" accordion instead of desktop sidebar collapse. */
  .amz-aikb-drawer-head .amz-aikb-sidebar-toggle,
  .amz-aikb-sidebar-toggle--inline,
  .amz-aikb-main-tools {
    display: none !important;
  }

  .amz-aikb-drawer-head {
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 0;
  }

  /* 第二行单行：用户 · 可用N点 */
  .amz-aikb-drawer-status {
    order: 3;
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px 8px;
    font-size: 11px;
    min-width: 0;
    overflow: hidden;
  }

  .amz-aikb-drawer-user {
    flex: 0 1 auto;
    max-width: 42%;
  }

  .amz-aikb-drawer-user .amz-aikb-vip-tag {
    transform: scale(0.9);
    transform-origin: left center;
    flex-shrink: 0;
  }

  .amz-aikb-drawer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .amz-aikb-drawer-quota {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 4px 6px;
    min-width: 0;
    overflow: hidden;
  }

  .amz-aikb-drawer-quota .amz-aikb-wallet-total {
    font-size: 11px;
    white-space: nowrap;
  }

  /* Put the attachment-index confirmation in the unused right side of the
     account row instead of spending a separate line of chat height. */
  .amz-aikb-drawer-index-status {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--amz-aikb-vip-ink, #4e342e);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
  }

  .amz-aikb-drawer-index-status__icon {
    flex-basis: 14px;
    width: 14px;
    height: 14px;
    font-size: 9px;
  }

  .amz-aikb-drawer-index-status__short {
    display: none;
  }

  .amz-aikb-app.is-sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .amz-aikb-app.is-sidebar-collapsed .amz-aikb-sidebar {
    display: flex;
  }

  /* 历史 / 新会话：贴近会话列表与聊天区 */
  .amz-aikb-session-bar {
    display: flex;
  }

  .amz-aikb-side-toggle {
    display: inline-flex;
  }

  .amz-aikb-new-session--bar {
    display: inline-flex;
  }

  .amz-aikb-sessions-head,
  .amz-aikb-sessions {
    display: none;
  }

  .amz-aikb-sidebar.is-expanded .amz-aikb-sessions-head {
    display: flex;
  }

  /* 展开历史时 session-bar 已有「新会话」，避免侧栏重复 */
  .amz-aikb-sidebar.is-expanded .amz-aikb-new-session--side {
    display: none;
  }

  .amz-aikb-sidebar.is-expanded .amz-aikb-sessions {
    display: block;
    max-height: 28vh;
    overflow: auto;
  }

  /* 触控目标：计费胶囊高度由下方 composer-tools 规则统一为 32px */

  /* 移动端浮窗样式统一由下方「向上弹出面板」规则控制 */

  .amz-aikb-packs-scroller {
    gap: 5px;
  }

  .amz-aikb-packs .amz-aikb-pack-btn {
    padding: 5px 2px 4px;
    gap: 1px;
  }

  .amz-aikb-packs.amz-aikb-packs--inline .amz-aikb-pack-btn {
    height: var(--amz-aikb-pack-row-h, 48px);
    min-height: var(--amz-aikb-pack-row-h, 48px);
    max-height: var(--amz-aikb-pack-row-h, 48px);
    padding: 0 4px;
  }

  .amz-aikb-packs.amz-aikb-packs--inline .amz-aikb-packs-scroller,
  .amz-aikb-exchange.amz-aikb-exchange--inline:not(.amz-aikb-exchange--stack) .amz-aikb-mycred-exchange,
  .amz-aikb-exchange.amz-aikb-exchange--inline.amz-aikb-exchange--stack:not(.is-expanded) .amz-aikb-mycred-exchange {
    height: var(--amz-aikb-pack-row-h, 48px);
    min-height: var(--amz-aikb-pack-row-h, 48px);
    max-height: var(--amz-aikb-pack-row-h, 48px);
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs.amz-aikb-packs--inline {
    min-width: 0;
  }

  .amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:hover .amz-aikb-packs-scroller,
  .amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack:focus-within .amz-aikb-packs-scroller,
  .amz-aikb-packs.amz-aikb-packs--inline.amz-aikb-packs--stack.is-expanded .amz-aikb-packs-scroller {
    height: auto;
    min-height: var(--amz-aikb-pack-row-h, 48px);
    max-height: none;
  }

  .amz-aikb-pack-points {
    font-size: 12px;
  }

  .amz-aikb-pack-sub {
    gap: 3px;
    font-size: 9px;
  }

  .amz-aikb-pack-badge {
    font-size: 9px;
  }

  .amz-aikb-main {
    min-height: 0;
  }

  /* 抽屉贴边：去掉外层 padding / 双重边框 */
  .amz-aikb-drawer-panel {
    padding: 0;
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
  }

  .amz-aikb-drawer-head {
    position: relative;
    padding: 10px 12px 8px;
    margin: 0;
    border-bottom: 1px solid var(--amz-aikb-line);
    background: rgba(255, 253, 249, 0.96);
    min-height: 44px;
    align-items: center;
  }

  .amz-aikb-drawer-title strong {
    font-size: 18px;
  }

  /* 手机端：标题视口居中（类 iOS 导航栏），关闭靠右 */
  .amz-aikb-drawer .amz-aikb-drawer-title {
    position: absolute;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    width: auto;
    max-width: calc(100% - 112px);
    justify-content: center;
    z-index: 1;
    pointer-events: none;
  }

  .amz-aikb-drawer .amz-aikb-drawer-title strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .amz-aikb-drawer .amz-aikb-drawer-title .amz-aikb-sidebar-toggle--icon {
    display: none;
  }

  .amz-aikb-drawer-actions {
    margin-left: auto;
    z-index: 2;
  }

  .amz-aikb-drawer .amz-aikb-app {
    border: 0;
    border-radius: 0;
    background: #fffdf9;
  }

  .amz-aikb-drawer .amz-aikb-wallet--drawer-side {
    margin: 2px 8px 4px;
  }

  .amz-aikb-drawer .amz-aikb-wallet--drawer-side .amz-aikb-vip-index-status {
    display: none;
  }

  /* Mobile: keep the attachment-index confirmation to one compact line. */
  .amz-aikb-vip-index-status {
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 34px;
    margin-top: 0;
    padding: 6px 9px;
    border-radius: 8px;
  }

  .amz-aikb-vip-index-status__icon {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .amz-aikb-vip-index-status__copy {
    display: block;
  }

  .amz-aikb-vip-index-status__copy strong {
    display: block;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .amz-aikb-vip-index-status__copy small {
    display: none;
  }

  /* VIP 轻量单行：左文案+对比，右小号按钮（非整宽大金条） */
  .amz-aikb-vip-upsell:not(.amz-aikb-vip-upsell--guest),
  .amz-aikb-vip-upsell--slim {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid rgba(224, 191, 115, 0.45);
    border-radius: 8px;
    background: linear-gradient(90deg, #fffaf0, #fffdf8);
  }

  .amz-aikb-vip-upsell-top {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    margin: 0;
  }

  .amz-aikb-vip-upsell-title {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
  }

  .amz-aikb-vip-upsell-compare {
    font-size: 11px;
  }

  .amz-aikb-vip-upsell-cols {
    display: none;
  }

  .amz-aikb-vip-upsell-cta {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
  }

  .amz-aikb-vip-upsell--slim .amz-aikb-vip-upsell-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .amz-aikb-packs[open] .amz-aikb-packs-scroller {
    margin-bottom: 4px;
  }

  .amz-aikb-get-points-exchange {
    margin: 0;
    padding-top: 4px;
    border-top: 1px dashed var(--amz-aikb-line);
  }

  .amz-aikb-get-points-exchange .amz-aikb-mycred-exchange {
    margin: 0;
    padding: 6px 8px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--amz-aikb-line);
  }

  .amz-aikb-packs-label {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--amz-aikb-muted);
  }

  .amz-aikb-drawer-quota .amz-aikb-wallet-parts {
    display: none;
  }

  .amz-aikb-session-bar {
    padding: 4px 10px 6px;
  }

  .amz-aikb-drawer-resize {
    display: none;
  }

  /* 关闭按钮加大触控区 */
  .amz-aikb-drawer-close {
    padding: 8px 12px;
  }

  /* 消息区收窄留白，让内容更宽 */
  .amz-aikb-messages {
    padding: 12px 12px 6px;
  }

  .amz-aikb-scroll-latest {
    bottom: 10px;
    min-height: 44px;
    padding: 7px 12px;
  }

  .amz-aikb-msg {
    margin: 0 0 12px;
  }

  .amz-aikb-bubble {
    padding: 10px 12px;
  }

  .amz-aikb-msg-assistant .amz-aikb-bubble {
    padding: 15px 14px 16px;
    font-size: 14px;
    line-height: 1.75;
  }

  .amz-aikb-msg-assistant .amz-aikb-bubble > * {
    width: 100%;
  }

  .amz-aikb-msg-assistant .amz-aikb-bubble h2,
  .amz-aikb-msg-assistant .amz-aikb-bubble h3,
  .amz-aikb-msg-assistant .amz-aikb-bubble h4 {
    margin-top: 1.25em;
  }

  /* Citation cards keep their content width on narrow screens. A long title
     shrinks within the available row while date/access remain visible. */
  .amz-aikb-citations {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .amz-aikb-cite {
    width: auto;
    min-height: 30px;
    align-items: center;
    padding: 3px 8px;
    border-radius: 8px;
  }

  .amz-aikb-cite-title {
    display: block;
    overflow: hidden;
    line-height: 1.45;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .amz-aikb-cite-meta {
    align-self: center;
    gap: 4px;
    margin-left: 6px;
    padding-top: 0;
  }

  .amz-aikb-citations--compact {
    display: block;
  }

  .amz-aikb-citations-toggle {
    min-height: 44px;
    padding-inline: 8px;
  }

  .amz-aikb-citations-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
  }

  .amz-aikb-citations-list:not(.is-expanded):not(.is-unclipped) .amz-aikb-cite:nth-child(n + 3) {
    display: none;
  }

  .amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ai-analysis-heading {
    margin-top: 0;
  }

  .amz-aikb-msg-assistant .amz-aikb-bubble .amz-aikb-ref button {
    min-width: 24px;
    min-height: 24px;
  }

  .amz-aikb-citation-preview {
    position: fixed;
    z-index: 1005;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: min(420px, calc(100vw - 24px));
    max-height: min(68vh, 520px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 18px 16px 16px;
    border-radius: 12px;
  }

  .amz-aikb-citation-preview-close {
    min-width: 44px;
    min-height: 44px;
    top: 4px;
    right: 4px;
  }

  .amz-aikb-citation-preview-title {
    padding-right: 50px;
  }

  .amz-aikb-citation-preview-link {
    min-height: 44px;
    flex: 1 1 120px;
  }

  .amz-aikb-suggestion {
    padding: 8px 12px;
    font-size: 12.5px;
  }

  .amz-aikb-followup,
  .amz-aikb-followups-refresh-retry {
    min-height: 44px;
  }

  /* 输入区避开 iPhone 底部 Home 指示条 */
  .amz-aikb-composer {
    padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  /* Mobile: 单行工具条 — 左侧计费卡片等分、右侧控件胶囊，垂直居中 */
  .amz-aikb-composer-tools,
  .amz-aikb-composer-tools.amz-aikb-composer-tools--mobile-caps {
    --amz-aikb-toolbar-control-h: 44px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 6px 10px 2px;
    gap: 6px;
    row-gap: 0;
    min-height: 0;
    overflow: visible;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs,
  .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange:not([hidden]) {
    display: inline-flex !important;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* 计费入口：统一双行胶囊卡片（主值 + 说明），点按向上弹出面板 */
  .amz-aikb-composer-tools.amz-aikb-composer-tools--mobile-float .amz-aikb-packs,
  .amz-aikb-composer-tools.amz-aikb-composer-tools--mobile-float .amz-aikb-exchange {
    flex: 0 1 auto;
    flex-shrink: 1;
    min-width: 0;
    max-width: 38%;
  }

  .amz-aikb-composer-tools--mobile-merged .amz-aikb-packs {
    flex-basis: auto;
    max-width: 42%;
  }

  .amz-aikb-msg-queueing .amz-aikb-auto-retry-cancel,
  .amz-aikb-auto-retry-status.is-cancelled + .amz-aikb-btn {
    min-height: 44px;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs > summary.amz-aikb-packs-head,
  .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange > summary.amz-aikb-exchange-head {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: auto;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    height: var(--amz-aikb-toolbar-control-h);
    min-height: var(--amz-aikb-toolbar-control-h);
    max-height: var(--amz-aikb-toolbar-control-h);
    margin: 0;
    padding: 0 12px;
    border: 1px solid rgba(196, 92, 38, 0.32);
    border-radius: 10px;
    background: var(--amz-aikb-billing-capsule-bg, linear-gradient(180deg, #fff8f1, #fff));
    box-shadow: 0 1px 2px rgba(31, 36, 48, 0.05);
    overflow: hidden;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs > summary.amz-aikb-packs-head::after,
  .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange > summary.amz-aikb-exchange-head::after {
    display: none;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs[open] > summary.amz-aikb-packs-head,
  .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange[open] > summary.amz-aikb-exchange-head {
    border-color: rgba(196, 92, 38, 0.55);
    background: rgba(196, 92, 38, 0.08);
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs-head strong,
  .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange-head strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs-hint,
  .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange-hint {
    font-size: 10px;
    font-weight: 600;
    color: var(--amz-aikb-muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
  }

  /* inline 残留兜底：手机端不允许铺开进工具条 */
  .amz-aikb-composer-tools--mobile-caps .amz-aikb-packs--inline > .amz-aikb-packs-pop,
  .amz-aikb-composer-tools--mobile-caps .amz-aikb-exchange--inline > .amz-aikb-exchange-pop {
    display: none !important;
  }

  /* 点按胶囊 → 面板从卡片上方浮出 */
  .amz-aikb-composer-tools .amz-aikb-packs[open]:not(.amz-aikb-packs--inline) > .amz-aikb-packs-pop,
  .amz-aikb-composer-tools .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline) > .amz-aikb-exchange-pop {
    position: absolute !important;
    left: 0;
    right: auto !important;
    top: auto !important;
    bottom: calc(100% + 10px) !important;
    transform: none !important;
    max-width: calc(100vw - 24px) !important;
    max-height: min(56vh, 400px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    margin: 0 !important;
    padding: 10px !important;
    z-index: 85;
    border-radius: 14px;
    box-shadow: 0 -10px 30px rgba(31, 36, 48, 0.16);
    animation: amz-aikb-packs-pop-in 0.16s ease !important;
  }

  .amz-aikb-composer-tools .amz-aikb-packs[open]:not(.amz-aikb-packs--inline) > .amz-aikb-packs-pop {
    width: min(210px, calc(100vw - 24px)) !important;
  }

  .amz-aikb-composer-tools .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline) > .amz-aikb-exchange-pop {
    width: max-content !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    padding: 8px !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-exchange:not(.is-short) {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    width: max-content;
    min-width: 0;
    max-width: none;
    padding: 6px 8px;
    gap: 8px;
    overflow: visible;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-title {
    display: none !important;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-meta {
    display: none;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-points {
    width: 4.75em;
    min-width: 56px;
    max-width: 72px;
    margin: 0;
    padding: 0 6px;
    box-sizing: border-box;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-submit {
    flex: 0 0 auto;
    min-width: 44px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-exchange.is-short {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-height: 0;
    height: auto;
    padding: 8px 12px;
    gap: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    text-align: center;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-exchange.is-short
    .amz-aikb-mycred-info {
    flex: 0 0 auto;
    align-items: center;
    gap: 0;
  }

  .amz-aikb-composer-tools
    .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline)
    .amz-aikb-mycred-exchange.is-short
    .amz-aikb-mycred-meta {
    display: none !important;
  }

  /* 面板内滚动会裁掉小箭头，直接隐藏 */
  .amz-aikb-composer-tools .amz-aikb-packs[open]:not(.amz-aikb-packs--inline) > .amz-aikb-packs-pop::before,
  .amz-aikb-composer-tools .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline) > .amz-aikb-exchange-pop::before,
  .amz-aikb-composer-tools .amz-aikb-packs[open]:not(.amz-aikb-packs--inline) > .amz-aikb-packs-pop::after,
  .amz-aikb-composer-tools .amz-aikb-exchange[open]:not(.amz-aikb-exchange--inline) > .amz-aikb-exchange-pop::after {
    content: none !important;
    display: none !important;
  }

  /* 档位竖排成列（同桌面上展叠档的观感） */
  .amz-aikb-composer-tools .amz-aikb-packs[open]:not(.amz-aikb-packs--inline) .amz-aikb-packs-scroller {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
  }

  .amz-aikb-composer-tools .amz-aikb-packs[open]:not(.amz-aikb-packs--inline) .amz-aikb-pack-btn {
    flex-direction: row;
    height: 44px;
    min-height: 44px;
    padding: 4px 12px;
    gap: 6px;
  }

  .amz-aikb-composer-tools
    .amz-aikb-packs[open]:not(.amz-aikb-packs--inline)
    .amz-aikb-pack-sub {
    gap: 6px;
  }

  .amz-aikb-composer-tools
    .amz-aikb-packs[open]:not(.amz-aikb-packs--inline)
    .amz-aikb-pack-sep {
    display: inline;
    color: #cfc7bc;
    font-weight: 500;
  }

  .amz-aikb-composer-tools .amz-aikb-packs-head strong,
  .amz-aikb-composer-tools .amz-aikb-exchange-head strong {
    font-size: 12px;
    font-weight: 800;
    color: var(--amz-aikb-accent);
  }

  .amz-aikb-composer-tools .amz-aikb-packs-hint,
  .amz-aikb-composer-tools .amz-aikb-exchange-hint {
    font-size: 10px;
    font-weight: 600;
    color: var(--amz-aikb-muted);
  }

  .amz-aikb-composer-tools--mobile-merged .amz-aikb-packs-hint {
    display: inline;
  }

  /* Merged sheet: hide separate 积分兑 capsule; label stays 加油包 */
  .amz-aikb-composer-tools--mobile-merged .amz-aikb-exchange,
  .amz-aikb-composer-tools--mobile-merged .amz-aikb-exchange.amz-aikb-billing--stow {
    display: none !important;
  }

  .amz-aikb-composer-tools .amz-aikb-packs.amz-aikb-billing--stow {
    display: inline-flex !important;
  }

  .amz-aikb-composer-tools:not(.amz-aikb-composer-tools--mobile-merged) .amz-aikb-exchange.amz-aikb-billing--stow {
    display: inline-flex !important;
  }

  .amz-aikb-composer-tools-end {
    order: 1;
    flex: 1 1 0;
    margin-left: auto;
    justify-content: flex-end;
    align-items: center;
    min-width: 0;
    gap: 6px;
    overflow: visible;
    touch-action: manipulation;
  }

  .amz-aikb-ask-scope {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 46%;
  }

  /* 右侧控件继承工具条统一触控高度 */
  .amz-aikb-composer-tools--mobile-float .amz-aikb-scope-picker-trigger {
    height: var(--amz-aikb-toolbar-control-h);
    box-sizing: border-box;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    max-width: 100%;
    touch-action: manipulation;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-scope-picker-value {
    display: inline-block;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-scope-picker-menu {
    z-index: 90;
  }

  /* 手机端：范围用上展 picker，省横向空间 */
  .amz-aikb-composer-tools--mobile-caps .amz-aikb-scope-tabs {
    display: none !important;
  }

  .amz-aikb-composer-tools--mobile-caps .amz-aikb-scope-picker {
    display: block;
  }

  .amz-aikb-composer-tools:not(.amz-aikb-composer-tools--mobile-caps) .amz-aikb-scope-picker {
    display: none !important;
  }

  /* 范围切换：与同行计费、模式控件等高 */
  .amz-aikb-ask-scope .amz-aikb-scope-tab {
    padding: 0 9px;
    font-size: 12px;
  }

  /* 响应式工具条统一使用 44px 触控高度 */
  .amz-aikb-composer-tools--mobile-caps .amz-aikb-packs--inline,
  .amz-aikb-composer-tools--mobile-caps .amz-aikb-exchange--inline {
    --amz-aikb-pack-row-h: var(--amz-aikb-toolbar-control-h);
  }

  /* 模式切换：两个选项始终可见，避免被误认为静态状态标签。 */
  .amz-aikb-premium-toggle {
    height: var(--amz-aikb-toolbar-control-h);
    box-sizing: border-box;
    align-items: center;
    padding: 2px;
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    font-size: 12px;
  }

  .amz-aikb-premium-toggle .amz-aikb-premium-x {
    font-size: 10px;
    padding: 1px 3px;
  }

  .amz-aikb-mode-option {
    height: calc(var(--amz-aikb-toolbar-control-h) - 6px);
    padding: 0 7px;
    font-size: 11px;
  }

  .amz-aikb-premium-icon {
    width: 13px;
    height: 13px;
    flex-basis: 13px;
  }

  .amz-aikb-premium-lock {
    display: none;
  }

  /* Redundant with bottom scope tabs */
  .amz-aikb-suggestions-head .amz-aikb-scope-badge {
    display: none;
  }

  .amz-aikb-packs--merged .amz-aikb-merged-exchange {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--amz-aikb-line);
  }

  /* The collapsed trigger stays compact; its opened sheet uses readable width. */
  .amz-aikb-composer-tools--mobile-merged
    .amz-aikb-packs[open]:not(.amz-aikb-packs--inline)
    > .amz-aikb-packs-pop {
    width: min(232px, calc(100vw - 24px)) !important;
  }

  .amz-aikb-packs--merged .amz-aikb-merged-exchange .amz-aikb-mycred-exchange {
    margin: 0;
  }

  .amz-aikb-packs--merged
    .amz-aikb-merged-exchange
    .amz-aikb-mycred-exchange:not(.is-short) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    max-width: none;
    padding: 8px;
    gap: 8px;
  }

  .amz-aikb-packs--merged .amz-aikb-merged-exchange .amz-aikb-mycred-meta {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.35;
  }

  .amz-aikb-packs--merged .amz-aikb-merged-exchange .amz-aikb-mycred-label {
    display: block;
    min-width: 0;
  }

  .amz-aikb-packs--merged .amz-aikb-merged-exchange .amz-aikb-mycred-points {
    width: 100%;
    max-width: none;
  }

  .amz-aikb-wallet-login-tip--exchange {
    margin-left: 0;
  }

  /* iOS zooms in on inputs below 16px — keep it at 16 on touch layouts. */
  .amz-aikb-composer textarea {
    font-size: 16px;
  }

  .amz-aikb-session-del {
    opacity: 1;
  }

  .amz-aikb-float {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .amz-aikb-toast {
    bottom: calc(128px + env(safe-area-inset-bottom, 0px));
  }

  @keyframes amz-aikb-sheet-in {
    from {
      opacity: 0;
      transform: translate(-50%, 14px);
    }
    to {
      opacity: 1;
      transform: translate(-50%, 0);
    }
  }
}

@media (max-width: 520px) {
  .amz-aikb-citations-list:not(.is-expanded):not(.is-unclipped) .amz-aikb-cite:nth-child(n + 2) {
    display: none;
  }
}

/* Narrow desktop/tablet: keep direct switches visible without mobile-sized vertical chrome. */
@media (min-width: 481px) and (max-width: 860px) {
  .amz-aikb-composer-tools,
  .amz-aikb-composer-tools.amz-aikb-composer-tools--mobile-caps {
    --amz-aikb-toolbar-control-h: 36px;
    padding: 6px 10px 0;
    gap: 8px;
  }

  .amz-aikb-composer-tools--mobile-merged .amz-aikb-packs {
    max-width: none;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs > summary.amz-aikb-packs-head,
  .amz-aikb-composer-tools--mobile-float .amz-aikb-exchange > summary.amz-aikb-exchange-head {
    flex-direction: row;
    width: auto;
    height: var(--amz-aikb-toolbar-control-h);
    min-height: var(--amz-aikb-toolbar-control-h);
    max-height: var(--amz-aikb-toolbar-control-h);
    padding: 0 10px;
    gap: 5px;
    border-radius: 10px;
  }

  .amz-aikb-composer-tools-end {
    flex: 0 0 auto;
    gap: 6px;
  }

  .amz-aikb-ask-scope {
    max-width: none;
  }

  .amz-aikb-composer-tools--mobile-caps .amz-aikb-scope-tabs {
    display: inline-flex !important;
    height: var(--amz-aikb-toolbar-control-h);
    box-sizing: border-box;
  }

  .amz-aikb-composer-tools--mobile-caps .amz-aikb-scope-picker {
    display: none !important;
  }

  .amz-aikb-ask-scope .amz-aikb-scope-tab {
    height: calc(var(--amz-aikb-toolbar-control-h) - 6px);
    padding: 0 9px;
    font-size: 11px;
  }

  .amz-aikb-premium-toggle {
    height: var(--amz-aikb-toolbar-control-h);
    padding: 2px;
    border-color: rgba(31, 36, 48, 0.1);
    background: rgba(245, 242, 237, 0.82);
    box-shadow: inset 0 1px 2px rgba(31, 36, 48, 0.04);
  }

  .amz-aikb-mode-option {
    height: calc(var(--amz-aikb-toolbar-control-h) - 6px);
    padding: 0 7px;
    font-size: 11px;
  }

  .amz-aikb-premium-icon {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
  }

  .amz-aikb-composer {
    align-items: center;
    gap: 8px;
    padding: 4px 10px 8px;
  }

  .amz-aikb-composer textarea {
    height: 52px;
    min-height: 52px;
    max-height: 120px;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.4;
  }

  .amz-aikb-send {
    height: 52px;
    min-height: 52px;
    padding: 0 18px;
  }
}

@media (max-width: 360px) {
  .amz-aikb-composer-tools,
  .amz-aikb-composer-tools.amz-aikb-composer-tools--mobile-caps {
    padding-inline: 5px;
    gap: 3px;
  }

  .amz-aikb-composer-tools--mobile-merged .amz-aikb-packs {
    max-width: 35%;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs > summary.amz-aikb-packs-head {
    padding-inline: 6px;
  }

  .amz-aikb-composer-tools-end {
    gap: 3px;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-scope-picker-trigger {
    padding-inline: 5px;
  }

  .amz-aikb-mode-option {
    padding-inline: 3px;
  }

  .amz-aikb-drawer-index-status__full {
    display: none;
  }

  .amz-aikb-drawer-index-status__short {
    display: inline;
  }
}

@media (min-width: 361px) and (max-width: 430px) {
  .amz-aikb-composer-tools,
  .amz-aikb-composer-tools.amz-aikb-composer-tools--mobile-caps {
    padding-inline: 6px;
    gap: 4px;
  }

  .amz-aikb-composer-tools--mobile-merged .amz-aikb-packs {
    max-width: 38%;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-packs > summary.amz-aikb-packs-head {
    padding-inline: 8px;
  }

  .amz-aikb-composer-tools-end {
    gap: 4px;
  }

  .amz-aikb-composer-tools--mobile-float .amz-aikb-scope-picker-trigger {
    padding-inline: 7px;
  }

  .amz-aikb-mode-option {
    padding-inline: 5px;
  }
}

/* Composer responsiveness follows the component's own measured width.
   This also covers a narrow drawer/card inside a wide desktop viewport. */
.amz-aikb-composer-tools[data-composer-size="narrow"],
.amz-aikb-composer-tools[data-composer-size="compact"] {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  row-gap: 0;
  min-height: 0;
  overflow: visible;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] {
  --amz-aikb-toolbar-control-h: 44px;
  --amz-aikb-toolbar-visual-h: 36px;
  padding: 2px 10px 0;
  gap: 4px;
}

.amz-aikb-composer-tools[data-composer-size="compact"] {
  --amz-aikb-toolbar-control-h: 36px;
  padding: 6px 10px 0;
  gap: 8px;
}

/* Fullscreen used wider asymmetric gutters for both rows. Component-sized
   composer rules later narrow only the input row, so pin the toolbar to the
   same 10px edges whenever it is in narrow/compact mode. */
.amz-aikb-drawer.is-fullscreen .amz-aikb-composer-tools[data-composer-size="narrow"],
.amz-aikb-drawer.is-fullscreen .amz-aikb-composer-tools[data-composer-size="compact"] {
  padding-left: 10px;
  padding-right: 10px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange:not([hidden]),
.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs,
.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange:not([hidden]) {
  display: inline-flex !important;
  position: relative;
  flex: 0 1 auto;
  flex-shrink: 1;
  min-width: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-merged
  .amz-aikb-packs {
  flex-basis: auto;
  max-width: 38%;
}

.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-merged
  .amz-aikb-packs {
  max-width: none;
}

/* A merged pack sheet owns the exchange form. Keep the stowed duplicate hidden
   even when the mobile-float visibility rule above also matches it. */
.amz-aikb-composer-tools.amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange.amz-aikb-billing--stow:not([hidden]) {
  display: none !important;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head,
.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head,
.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  height: var(--amz-aikb-toolbar-control-h);
  min-height: var(--amz-aikb-toolbar-control-h);
  max-height: var(--amz-aikb-toolbar-control-h);
  margin: 0;
  border: 1px solid rgba(196, 92, 38, 0.32);
  border-radius: 10px;
  background: var(--amz-aikb-billing-capsule-bg, linear-gradient(180deg, #fff8f1, #fff));
  box-shadow: 0 1px 2px rgba(31, 36, 48, 0.05);
  overflow: hidden;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  summary::after,
.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-float
  summary::after {
  display: none;
}

/* The clickable controls remain 44px high; their border/background is inset,
   so the visible capsules are only 36px high. */
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-picker-trigger,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-premium-toggle {
  position: relative;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head::before,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head::before,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-picker-trigger::before,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-premium-toggle::before {
  content: '';
  position: absolute;
  inset: 3px 0;
  border-radius: inherit;
  border: 1px solid var(--amz-aikb-line);
  background: rgba(245, 242, 237, 0.92);
  box-sizing: border-box;
  z-index: 0;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head::before,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head::before {
  border-color: rgba(196, 92, 38, 0.32);
  background: var(--amz-aikb-billing-capsule-bg, linear-gradient(180deg, #fff8f1, #fff));
  box-shadow: 0 1px 2px rgba(31, 36, 48, 0.05);
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-picker-trigger > *,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-premium-toggle > *,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  summary
  > * {
  position: relative;
  z-index: 1;
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs[open]
  > summary.amz-aikb-packs-head::before,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange[open]
  > summary.amz-aikb-exchange-head::before {
  border-color: rgba(196, 92, 38, 0.55);
  background: rgba(196, 92, 38, 0.08);
}

body.night
  .amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  summary::before,
body.night
  .amz-aikb-composer-tools[data-composer-size="narrow"]
  .amz-aikb-scope-picker-trigger::before,
body.night
  .amz-aikb-composer-tools[data-composer-size="narrow"]
  .amz-aikb-premium-toggle::before {
  border-color: var(--amz-aikb-line);
  background: var(--amz-aikb-panel);
  box-shadow: none;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-packs-head strong,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-exchange-head strong,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-packs-head strong,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-exchange-head strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--amz-aikb-accent);
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-packs-hint,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-exchange-hint,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-packs-hint,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-exchange-hint {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--amz-aikb-muted);
}

.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head,
.amz-aikb-composer-tools[data-composer-size="narrow"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head {
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
}

.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-packs
  > summary.amz-aikb-packs-head,
.amz-aikb-composer-tools[data-composer-size="compact"].amz-aikb-composer-tools--mobile-float
  .amz-aikb-exchange
  > summary.amz-aikb-exchange-head {
  flex-direction: row;
  gap: 5px;
  padding: 0 10px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-composer-tools-end,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-composer-tools-end {
  order: 1;
  margin-left: auto;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
  overflow: visible;
  touch-action: manipulation;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-composer-tools-end {
  flex: 1 1 0;
  gap: 4px;
}

.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-composer-tools-end {
  flex: 0 0 auto;
  gap: 6px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-ask-scope {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 46%;
}

.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-ask-scope {
  max-width: none;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-tabs {
  display: none !important;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-picker {
  display: block !important;
}

.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-scope-tabs {
  display: inline-flex !important;
  height: var(--amz-aikb-toolbar-control-h);
  box-sizing: border-box;
}

.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-scope-picker {
  display: none !important;
}

/* Keep responsive toolbar outer controls rectangular and visually consistent.
   Inner selected segments retain their pill shape to preserve switch hierarchy. */
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-picker-trigger,
.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-premium-toggle,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-scope-tabs,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-premium-toggle {
  border-radius: 10px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-picker-trigger,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-scope-picker-trigger {
  height: var(--amz-aikb-toolbar-control-h);
  box-sizing: border-box;
  align-items: center;
  max-width: 100%;
  touch-action: manipulation;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-scope-picker-trigger {
  padding-inline: 7px;
  font-size: 12px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-premium-toggle,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-premium-toggle {
  height: var(--amz-aikb-toolbar-control-h);
  box-sizing: border-box;
  align-items: center;
  padding: 2px;
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  font-size: 12px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-mode-option,
.amz-aikb-composer-tools[data-composer-size="compact"] .amz-aikb-mode-option {
  height: calc(var(--amz-aikb-toolbar-control-h) - 6px);
  padding: 0 7px;
  font-size: 11px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] .amz-aikb-mode-option {
  height: calc(var(--amz-aikb-toolbar-visual-h) - 6px);
  padding-inline: 5px;
}

.amz-aikb-composer-tools[data-composer-size="narrow"] + .amz-aikb-composer {
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
}

.amz-aikb-composer-tools[data-composer-size="narrow"] + .amz-aikb-composer textarea {
  font-size: 16px;
}

.amz-aikb-composer-tools[data-composer-size="compact"] + .amz-aikb-composer {
  align-items: center;
  gap: 8px;
  padding: 4px 10px 8px;
}

.amz-aikb-composer-tools[data-composer-size="compact"] + .amz-aikb-composer textarea {
  height: 52px;
  min-height: 52px;
  max-height: 120px;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.4;
}

.amz-aikb-composer-tools[data-composer-size="compact"] + .amz-aikb-composer .amz-aikb-send {
  height: 52px;
  min-height: 52px;
  padding: 0 18px;
}

/* Structured document-query result: one card, server-authorized pagination. */
.amz-aikb-msg-assistant .amz-aikb-bubble.amz-aikb-bubble--structured-hidden {
  display: none;
}

.amz-aikb-msg.has-structured-parts {
  max-width: min(1080px, 100%);
}

.amz-aikb-doc-result {
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 14px;
  background: var(--amz-aikb-panel);
  box-shadow: 0 8px 26px rgba(31, 36, 48, 0.06);
}

.amz-aikb-doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--amz-aikb-line);
  background: linear-gradient(135deg, rgba(196, 92, 38, 0.08), rgba(255, 253, 249, 0));
}

.amz-aikb-doc-heading {
  min-width: 0;
}

.amz-aikb-doc-badge {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(196, 92, 38, 0.12);
  color: var(--amz-aikb-accent);
  font-size: 11px;
  font-weight: 700;
}

.amz-aikb-doc-title {
  overflow: hidden;
  margin: 0;
  color: var(--amz-aikb-ink);
  font-size: 16px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amz-aikb-doc-summary {
  flex: 0 0 auto;
  padding-top: 22px;
  color: var(--amz-aikb-accent);
  font-size: 14px;
  line-height: 1.4;
  text-align: right;
}

.amz-aikb-doc-count {
  display: none;
  align-items: baseline;
  gap: 8px;
  padding: 24px 20px;
}

.amz-aikb-doc-result.is-count-only .amz-aikb-doc-count {
  display: flex;
}

.amz-aikb-doc-count span {
  color: var(--amz-aikb-accent);
  font-size: clamp(32px, 7vw, 52px);
  font-weight: 800;
  line-height: 1;
}

.amz-aikb-doc-count small {
  color: var(--amz-aikb-muted);
  font-size: 13px;
}

.amz-aikb-doc-changed {
  margin: 12px 20px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(196, 92, 38, 0.08);
  color: var(--amz-aikb-accent);
  font-size: 12px;
  line-height: 1.45;
}

.amz-aikb-doc-search {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
}

.amz-aikb-doc-search input,
.amz-aikb-doc-jump input {
  box-sizing: border-box;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 8px;
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
  font: inherit;
  outline: none;
}

.amz-aikb-doc-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
}

.amz-aikb-doc-search input:focus,
.amz-aikb-doc-jump input:focus {
  border-color: var(--amz-aikb-accent);
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.1);
}

.amz-aikb-doc-result button {
  min-height: 36px;
  box-sizing: border-box;
  border: 1px solid var(--amz-aikb-accent);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--amz-aikb-accent);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.amz-aikb-doc-result button.is-secondary,
.amz-aikb-doc-pager button,
.amz-aikb-doc-copy {
  border-color: var(--amz-aikb-line);
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
}

.amz-aikb-doc-result button:disabled {
  opacity: 0.42;
  cursor: default;
}

.amz-aikb-doc-table-shell {
  overflow: auto;
  max-height: min(52vh, 560px);
  margin: 0 20px;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  scrollbar-width: thin;
}

.amz-aikb-doc-table {
  width: 100%;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--amz-aikb-ink);
  font-size: 13px;
  line-height: 1.45;
}

.amz-aikb-doc-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--amz-aikb-line);
  background: #f7f2eb;
  color: var(--amz-aikb-muted);
  font-weight: 700;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.amz-aikb-doc-table td {
  max-width: 340px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(230, 223, 212, 0.72);
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.amz-aikb-doc-table tbody tr:last-child td {
  border-bottom: 0;
}

.amz-aikb-doc-table th.amz-aikb-doc-cell--compact,
.amz-aikb-doc-table td.amz-aikb-doc-cell--compact {
  width: 1%;
  max-width: none;
  white-space: nowrap;
}

.amz-aikb-doc-table th.amz-aikb-doc-cell--index,
.amz-aikb-doc-table td.amz-aikb-doc-cell--index {
  color: var(--amz-aikb-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.amz-aikb-doc-table th.amz-aikb-doc-cell--grow,
.amz-aikb-doc-table td.amz-aikb-doc-cell--grow {
  width: 100%;
  min-width: min(220px, 48vw);
  max-width: min(640px, 72vw);
}

.amz-aikb-doc-table th.amz-aikb-doc-cell--wrap,
.amz-aikb-doc-table td.amz-aikb-doc-cell--wrap {
  min-width: min(240px, 65vw);
  max-width: 340px;
}

.amz-aikb-doc-empty-row td {
  padding: 30px 12px;
  color: var(--amz-aikb-muted);
  text-align: center !important;
}

.amz-aikb-doc-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px 8px;
}

.amz-aikb-doc-page-label {
  min-width: 90px;
  color: var(--amz-aikb-ink);
  font-size: 12px;
  text-align: center;
}

.amz-aikb-doc-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  color: var(--amz-aikb-muted);
  font-size: 12px;
}

.amz-aikb-doc-jump input {
  width: 64px;
  height: 36px;
  padding: 0 7px;
}

.amz-aikb-doc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 20px 16px;
  color: var(--amz-aikb-muted);
  font-size: 11px;
}

.amz-aikb-doc-status {
  flex: 1 1 auto;
}

.amz-aikb-doc-result.is-loading {
  cursor: progress;
}

.amz-aikb-doc-result.is-loading .amz-aikb-doc-table-shell {
  opacity: 0.58;
}

body.night .amz-aikb-doc-result,
body.night .amz-aikb-doc-search input,
body.night .amz-aikb-doc-jump input,
body.night .amz-aikb-doc-result button.is-secondary,
body.night .amz-aikb-doc-pager button,
body.night .amz-aikb-doc-copy {
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
}

body.night .amz-aikb-doc-table th {
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 680px) {
  .amz-aikb-doc-head {
    display: block;
    padding: 15px 14px 12px;
  }

  .amz-aikb-doc-title {
    white-space: normal;
  }

  .amz-aikb-doc-summary {
    display: block;
    padding-top: 8px;
    text-align: left;
  }

  .amz-aikb-doc-search {
    padding: 12px 14px;
  }

  .amz-aikb-doc-search button {
    padding-inline: 10px;
  }

  .amz-aikb-doc-table-shell {
    margin: 0 14px;
  }

  .amz-aikb-doc-pager {
    justify-content: flex-start;
    padding: 12px 14px 6px;
  }

  .amz-aikb-doc-jump {
    width: 100%;
    margin: 2px 0 0;
  }

  .amz-aikb-doc-foot {
    padding: 8px 14px 14px;
  }
}

/* Static structured views: content-shape routing, responsive without canvas. */
.amz-aikb-msg.has-presentation-parts {
  max-width: min(1080px, 100%);
}

.amz-aikb-presentation {
  container-type: inline-size;
  width: 100%;
  box-sizing: border-box;
  margin-top: 16px;
  color: var(--amz-aikb-ink);
}

.amz-aikb-presentation-body {
  padding: 0;
}

.amz-aikb-presentation-foot {
  padding: 8px 0 0;
  color: var(--amz-aikb-muted);
  font-size: 11px;
  line-height: 1.45;
}

.amz-aikb-view-node {
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--amz-aikb-panel);
}

.amz-aikb-view-node--root,
.amz-aikb-view-node--decision {
  border-color: rgba(196, 92, 38, 0.38);
  background: rgba(196, 92, 38, 0.07);
}

.amz-aikb-view-node-meta {
  display: block;
  margin-bottom: 4px;
  color: var(--amz-aikb-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.amz-aikb-view-node-label {
  display: block;
  color: var(--amz-aikb-ink);
  font-size: 13px;
  line-height: 1.45;
}

.amz-aikb-view-node-detail {
  margin: 5px 0 0;
  color: var(--amz-aikb-muted);
  font-size: 12px;
  line-height: 1.55;
}

.amz-aikb-mindmap {
  display: grid;
  gap: 12px;
}

.amz-aikb-mindmap-root {
  position: relative;
}

.amz-aikb-mindmap-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.amz-aikb-mindmap-list--nested {
  gap: 7px;
  margin-top: 7px;
  padding-left: 14px;
  border-left: 1px solid rgba(196, 92, 38, 0.28);
}

.amz-aikb-mindmap-item {
  min-width: 0;
}

.amz-aikb-mindmap-list--nested .amz-aikb-view-node {
  padding: 9px 10px;
  background: color-mix(in srgb, var(--amz-aikb-panel) 92%, var(--amz-aikb-line));
}

.amz-aikb-flowchart {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.amz-aikb-flow-level {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.amz-aikb-flow-entry {
  min-width: 0;
}

.amz-aikb-flow-relation {
  display: inline-flex;
  margin: 0 0 5px 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(196, 92, 38, 0.1);
  color: var(--amz-aikb-accent);
  font-size: 10px;
  font-weight: 700;
}

.amz-aikb-flow-arrow {
  align-self: center;
  color: var(--amz-aikb-accent);
  font-size: 20px;
  line-height: 1;
  transform: rotate(90deg);
}

.amz-aikb-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.amz-aikb-timeline::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 6px;
  width: 1px;
  background: rgba(196, 92, 38, 0.3);
  content: '';
}

.amz-aikb-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 10px;
}

.amz-aikb-timeline-item:last-child {
  padding-bottom: 0;
}

.amz-aikb-timeline-marker {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  box-sizing: border-box;
  margin-top: 9px;
  border: 2px solid var(--amz-aikb-panel);
  border-radius: 50%;
  background: var(--amz-aikb-accent);
  box-shadow: 0 0 0 1px rgba(196, 92, 38, 0.34);
}

.amz-aikb-comparison-table-shell {
  overflow-x: auto;
  width: 100%;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.amz-aikb-markdown-table-shell {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  margin: 12px 0;
}

.amz-aikb-msg-assistant .amz-aikb-bubble > .amz-aikb-markdown-table-shell {
  width: auto;
}

.amz-aikb-comparison-table.amz-aikb-markdown-table {
  width: max-content;
  max-width: none;
}

.amz-aikb-markdown-table-shell.amz-aikb-comparison-table-shell--compact .amz-aikb-markdown-table {
  width: max-content;
  table-layout: auto;
}

.amz-aikb-markdown-table-shell.amz-aikb-comparison-table-shell--compact .amz-aikb-markdown-table th:first-child {
  width: auto;
}

.amz-aikb-msg-assistant .amz-aikb-bubble > .amz-aikb-markdown-table-shell--wrap {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
}

.amz-aikb-markdown-table-shell--wrap.amz-aikb-comparison-table-shell--compact .amz-aikb-markdown-table {
  width: max-content;
  max-width: 100%;
  table-layout: auto;
}

.amz-aikb-markdown-table-shell:first-child {
  margin-top: 0;
}

.amz-aikb-markdown-table-shell:last-child {
  margin-bottom: 0;
}

.amz-aikb-comparison-table {
  width: 100%;
  min-width: 520px;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--amz-aikb-ink);
  font-size: 12px;
  line-height: 1.5;
}

.amz-aikb-comparison-table-shell--compact .amz-aikb-comparison-table {
  min-width: 0;
  table-layout: fixed;
}

.amz-aikb-comparison-table-shell--compact .amz-aikb-comparison-table th,
.amz-aikb-comparison-table-shell--compact .amz-aikb-comparison-table td {
  min-width: 0;
}

.amz-aikb-comparison-table-shell--compact .amz-aikb-comparison-table th:first-child {
  width: 28%;
}

.amz-aikb-comparison-table-shell--content-fit {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  vertical-align: top;
}

.amz-aikb-comparison-table-shell--content-fit .amz-aikb-comparison-table {
  width: max-content;
  max-width: 100%;
  table-layout: auto;
}

.amz-aikb-comparison-table th,
.amz-aikb-comparison-table td {
  min-width: 110px;
  max-width: 420px;
  padding: 10px;
  border-right: 1px solid var(--amz-aikb-line);
  border-bottom: 1px solid var(--amz-aikb-line);
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}

.amz-aikb-markdown-table th,
.amz-aikb-markdown-table td {
  white-space: pre-wrap;
}

.amz-aikb-markdown-table .is-align-center {
  text-align: center;
}

.amz-aikb-markdown-table .is-align-right {
  text-align: right;
}

.amz-aikb-comparison-table thead th,
.amz-aikb-comparison-table tbody th {
  min-width: 92px;
  background: rgba(196, 92, 38, 0.06);
  font-weight: 700;
}

.amz-aikb-comparison-table th:last-child,
.amz-aikb-comparison-table td:last-child {
  border-right: 0;
}

.amz-aikb-comparison-table tbody tr:last-child > * {
  border-bottom: 0;
}

@container (max-width: 440px) {
  .amz-aikb-comparison-table-shell--compact .amz-aikb-comparison-table th,
  .amz-aikb-comparison-table-shell--compact .amz-aikb-comparison-table td {
    padding: 9px 7px;
    font-size: 11px;
  }
}

.amz-aikb-checklist {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.amz-aikb-checklist-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--amz-aikb-line);
  border-radius: 10px;
  padding: 11px;
  background: var(--amz-aikb-panel);
}

.amz-aikb-checklist-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(196, 92, 38, 0.11);
  color: var(--amz-aikb-accent);
  font-size: 12px;
  font-weight: 800;
}

.amz-aikb-checklist-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
}

.amz-aikb-checklist-heading strong {
  color: var(--amz-aikb-ink);
  font-size: 13px;
  line-height: 1.45;
}

.amz-aikb-checklist-status {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(196, 92, 38, 0.1);
  color: var(--amz-aikb-accent);
  font-size: 10px;
  font-weight: 700;
}

.amz-aikb-checklist-content p {
  margin: 4px 0 0;
  color: var(--amz-aikb-muted);
  font-size: 12px;
  line-height: 1.55;
}

.amz-aikb-checklist-content small {
  display: block;
  margin-top: 5px;
  color: var(--amz-aikb-accent);
  font-size: 11px;
  line-height: 1.4;
}

body.night .amz-aikb-view-node,
body.night .amz-aikb-checklist-item {
  background: var(--amz-aikb-panel);
  color: var(--amz-aikb-ink);
}

body.night .amz-aikb-view-node--root,
body.night .amz-aikb-view-node--decision,
body.night .amz-aikb-comparison-table thead th,
body.night .amz-aikb-comparison-table tbody th {
  background: rgba(196, 92, 38, 0.1);
}

@container (min-width: 560px) {
  .amz-aikb-mindmap {
    grid-template-columns: minmax(180px, 0.62fr) minmax(0, 1.55fr);
    align-items: center;
    gap: 28px;
  }

  .amz-aikb-mindmap-root::after {
    position: absolute;
    top: 50%;
    right: -28px;
    width: 28px;
    height: 1px;
    background: rgba(196, 92, 38, 0.34);
    content: '';
  }

  .amz-aikb-flowchart {
    flex-direction: row;
    align-items: center;
  }

  .amz-aikb-flow-level {
    flex: 1 1 0;
  }

  .amz-aikb-flow-arrow {
    flex: 0 0 24px;
    transform: none;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .amz-aikb-root *,
  .amz-aikb-root *::before,
  .amz-aikb-root *::after,
  .amz-aikb-float,
  .amz-aikb-float *,
  .amz-aikb-float *::before,
  .amz-aikb-float *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .amz-aikb-packs--inline.amz-aikb-packs--stack .amz-aikb-pack-btn {
    animation: none !important;
  }
}
