/* Shared AI panel, with its layout independent of the query form. */
.assistant-toggle { position: fixed; right: 24px; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 60; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 11px 19px; border: 1px solid #3c8bff; border-radius: 999px; color: #fff; background: linear-gradient(135deg, #4f98ff, #1764d8); box-shadow: 0 12px 28px -8px #1764d88c, inset 0 1px 0 #ffffff45; font: inherit; font-size: 13px; font-weight: 600; transition: box-shadow .28s cubic-bezier(.22, 1, .36, 1), transform .25s cubic-bezier(.34, 1.56, .64, 1), background-color .2s; animation: assistant-open .55s cubic-bezier(.22, 1, .36, 1) .25s backwards; }
.assistant-toggle::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 45%; background: linear-gradient(100deg, transparent, #ffffff55, transparent); transform: translateX(-165%) skewX(-20deg); transition: transform .5s cubic-bezier(.16, 1, .3, 1); pointer-events: none; }
.assistant-toggle > span, .assistant-toggle .assistant-sparkle { display: inline-grid; place-items: center; font-size: 17px; line-height: 1; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.assistant-toggle:hover { box-shadow: 0 16px 32px -8px #1764d8a6, inset 0 1px 0 #ffffff4d; transform: translateY(-2px); }
.assistant-toggle:hover::before { transform: translateX(305%) skewX(-20deg); }
.assistant-toggle:hover .assistant-sparkle { transform: rotate(22deg) scale(1.15); }
.assistant-toggle:active { transform: translateY(0) scale(.96); }
.assistant-toggle[aria-expanded=true] { background: linear-gradient(135deg, #3986f4, #145dc9); }
.assistant-toggle.working::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px #ffffff38; animation: assistant-pulse 1.4s ease-in-out infinite; }
.assistant-panel { position: fixed; right: 24px; bottom: max(84px, calc(env(safe-area-inset-bottom) + 68px)); z-index: 61; display: flex; flex-direction: column; width: 412px; max-width: calc(100vw - 32px); height: min(690px, calc(100dvh - 110px)); background: #f6f9fd; border: 1px solid #d5e3f3; border-radius: 22px; box-shadow: 0 4px 10px #0f2a4a0d, 0 32px 80px -18px #0f2a4a66; overflow: hidden; transform-origin: bottom right; animation: assistant-open .28s cubic-bezier(.22, 1, .36, 1); }
.assistant-panel.closing { animation: assistant-close .18s cubic-bezier(.4, 0, 1, 1) forwards; pointer-events: none; }
.assistant-panel[hidden], .private-assistant[hidden] { display: none !important; }
.assistant-header { position: relative; display: flex; flex-shrink: 0; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 15px; color: #15263a; background: linear-gradient(120deg, #eaf3ff, #fff 85%); border-bottom: 1px solid #dfe8f3; }
.assistant-header::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, #2b7ff5, #7ab4ff 55%, #ff7a1a); }
.assistant-header strong { color: #15263a; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.assistant-header small { display: block; color: #728aa0; font-size: 11px; margin-top: 3px; line-height: 1.6; }
.assistant-close { display: inline-grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; padding: 0; color: #7390aa; background: #ffffff99; border: 1px solid #dbe7f4; border-radius: 10px; font: inherit; font-size: 22px; line-height: 1; transition: transform .25s cubic-bezier(.22, 1, .36, 1), background-color .2s, color .2s, border-color .2s; }
.assistant-close:hover { color: #1764d8; background: #eef5ff; border-color: #b7d2f4; transform: rotate(90deg); }
.assistant-mode { padding: 2px 6px; margin-left: 5px; border: 1px solid #d2e3fa; border-radius: 999px; color: #567da6; background: #ffffffb3; font-size: 9px; font-weight: 400; white-space: nowrap; }
.assistant-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; scrollbar-width: thin; scrollbar-color: #cfdae7 transparent; scroll-behavior: smooth; }
.assistant-bubble { max-width: 95%; margin: 0 0 14px; padding: 12px 14px; border-radius: 15px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; animation: assistant-bubble-in .26s cubic-bezier(.22, 1, .36, 1) backwards; }
.assistant-bubble.assistant { color: #445e75; background: #fff; border: 1px solid #dfe9f3; box-shadow: 0 2px 6px -2px #0f2a4a0a; border-top-left-radius: 5px; }
.assistant-bubble.user { width: fit-content; margin-left: auto; color: #1b5692; background: linear-gradient(135deg, #e8f2ff, #dcebff); border: 1px solid #cde0fa; border-bottom-right-radius: 5px; box-shadow: 0 2px 8px -3px #2b7ff526; }
.assistant-examples { display: flex; flex-wrap: wrap; gap: 6px; margin: 11px 0 0; }
.assistant-examples button { padding: 5px 10px; color: #4271a4; background: #f6faff; border: 1px solid #d4e4f7; border-radius: 999px; font: inherit; font-size: 11px; line-height: 1.5; transition: transform .2s cubic-bezier(.22, 1, .36, 1), background-color .2s, border-color .2s, color .2s; }
.assistant-examples button:hover:not(:disabled) { color: #1764d8; background: #eaf3ff; border-color: #9ec2f0; transform: translateY(-1px); }
.assistant-examples button:active:not(:disabled) { transform: scale(.96); }
.assistant-citation { position: relative; display: block; width: 100%; padding: 11px 13px; margin-top: 10px; text-align: left; white-space: normal; color: #56748e; background: linear-gradient(135deg, #f5f9ff, #fff); border: 1px solid #d5e5f6; border-left: 3px solid #2b7ff5; border-radius: 11px; font: inherit; box-shadow: 0 2px 6px #0f2a4a06; transition: border-color .2s, box-shadow .25s cubic-bezier(.22, 1, .36, 1), transform .2s cubic-bezier(.22, 1, .36, 1); }
.assistant-citation:hover { border-color: #92bbf0; border-left-color: #1764d8; box-shadow: 0 8px 18px -8px #1764d845; transform: translateY(-1px); }
.assistant-citation:active { transform: scale(.985); }
.assistant-citation strong { color: #1764d8; font-size: 14px; font-weight: 700; }
.assistant-citation span, .assistant-citation small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.6; }
.assistant-citation small { color: #7b90a3; font-size: 10px; }
.assistant-source { display: block; color: #8b9dad; font-size: 10px; margin-top: 9px; }
.assistant-progress { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin: 0 14px 10px; padding: 9px 12px; color: #3d6d99; background: #eaf3ff; border: 1px solid #d3e5fb; border-radius: 10px; font-size: 11px; line-height: 1.6; animation: assistant-fade .2s ease-out; }
.assistant-progress.working::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, transparent, #2b7ff5, #7ab4ff, transparent) no-repeat; width: 50%; animation: assistant-bar 1.5s ease-in-out infinite; }
.assistant-dots { display: none; align-items: center; gap: 3px; flex-shrink: 0; }
.assistant-progress.working .assistant-dots { display: inline-flex; }
.assistant-dots i { width: 5px; height: 5px; border-radius: 50%; background: #2b7ff5; animation: assistant-dot 1.2s ease-in-out infinite; }
.assistant-dots i:nth-child(2) { animation-delay: .16s; }
.assistant-dots i:nth-child(3) { animation-delay: .32s; }
.assistant-form { flex-shrink: 0; padding: 12px 14px; background: #ffffffeb; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-top: 1px solid #e0e9f2; }
.assistant-form textarea { display: block; width: 100%; min-height: 72px; padding: 11px 12px; border: 1px solid #cfddeb; border-radius: 12px; color: #24445e; background: #fbfcfe; resize: none; font: inherit; font-size: 13px; line-height: 1.7; transition: border-color .2s, box-shadow .25s cubic-bezier(.22, 1, .36, 1), background-color .2s; }
.assistant-form textarea::placeholder { color: #8b9eae; }
.assistant-form textarea:focus { outline: none; border-color: #2b7ff5; background: #fff; box-shadow: 0 0 0 3.5px #2b7ff520; }
.assistant-form textarea:disabled { opacity: .7; cursor: not-allowed; }
.assistant-compose { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; }
.assistant-compose > small { color: #8b9caa; font-size: 10px; line-height: 1.6; }
.assistant-controls { display: flex; flex-shrink: 0; gap: 7px; }
.assistant-panel .assistant-form .primary, .assistant-panel .assistant-form .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 33px; padding: 6px 14px; border: 1px solid #cadff6; border-radius: 9px; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.5; }
.assistant-panel .assistant-form .primary { color: #fff; background: linear-gradient(135deg, #4c95ff, #1764d8); border-color: transparent; box-shadow: 0 5px 12px -5px #1764d866; }
.assistant-panel .assistant-form .primary:hover:not(:disabled) { background: linear-gradient(135deg, #3989f8, #145dc9); transform: translateY(-1px); }
.assistant-panel .assistant-form .primary:active:not(:disabled) { transform: scale(.96); }
.assistant-panel .assistant-form .secondary { color: #4d7caa; background: #f5f9ff; }
.assistant-panel .assistant-form .primary:disabled { opacity: .65; background: #dae5f1; color: #7a91a8; box-shadow: none; cursor: not-allowed; }
.assistant-form label.sr-only { display: block; }
.assistant-toggle:focus-visible, .assistant-citation:focus-visible, .assistant-close:focus-visible, .assistant-examples button:focus-visible, .assistant-controls button:focus-visible { outline: 2px solid #1764d8; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes assistant-open { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes assistant-close { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes assistant-bubble-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes assistant-fade { from { opacity: .3; } to { opacity: 1; } }
@keyframes assistant-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.85); } }
@keyframes assistant-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes assistant-bar { from { transform: translateX(-100%); } to { transform: translateX(200%); } }
@media (max-width: 760px) {
  .assistant-panel { right: 12px; left: 12px; bottom: max(76px, calc(env(safe-area-inset-bottom) + 64px)); width: auto; max-width: none; height: min(670px, calc(100dvh - 102px)); border-radius: 18px; }
  .assistant-toggle { right: 15px; bottom: max(16px, env(safe-area-inset-bottom)); min-height: 44px; padding: 10px 15px; font-size: 12px; }
  .assistant-header { padding: 15px 15px 13px; }
  .assistant-header strong { font-size: 15px; }
  .assistant-mode { font-size: 9px; padding-inline: 5px; margin-left: 3px; }
  .assistant-log { padding: 14px 12px 6px; }
  .assistant-bubble { padding: 11px 12px; font-size: 13px; }
  .assistant-compose > small { font-size: 9px; }
  .assistant-form { padding: 11px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .assistant-toggle, .assistant-panel, .assistant-panel *, .assistant-panel *::before, .assistant-panel *::after, .assistant-toggle::after, .assistant-toggle::before { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .assistant-toggle:hover, .assistant-close:hover { transform: none; }
}
@media (forced-colors: active) {
  .assistant-toggle, .assistant-close, .assistant-panel .assistant-form .primary, .assistant-panel .assistant-form .secondary { color: ButtonText; background: ButtonFace; border: 1px solid ButtonText; }
  .assistant-panel, .assistant-header, .assistant-bubble.assistant, .assistant-bubble.user, .assistant-citation, .assistant-progress, .assistant-form { color: CanvasText; background: Canvas; border-color: CanvasText; }
  .assistant-form textarea { color: FieldText; background: Field; border-color: FieldText; }
  .assistant-panel .assistant-form .primary:disabled { color: GrayText; border-color: GrayText; }
}
