/* Trợ lý ảo — nút nổi + khung chat (templates/assistant/_widget.html). Chỉ dùng token ATLAS → tự theo chế độ Tối. */
.tl-fab { position: fixed; right: 24px; bottom: 24px; z-index: 1060; display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 20px 0 6px; border: 0; border-radius: var(--at-radius-pill); background: var(--at-ai); color: var(--at-canvas); font: 600 14px/1 var(--at-font); box-shadow: var(--at-shadow-md); cursor: pointer; transition: transform var(--at-fast) var(--at-ease); }
.tl-fab::before { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 var(--at-ai); opacity: .55; animation: tl-ping 2.6s var(--at-ease) infinite; pointer-events: none; }
.tl-fab-bot { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--at-ai-soft); }
@keyframes tl-ping { 0% { box-shadow: 0 0 0 0 var(--at-ai); opacity: .5; } 80%, 100% { box-shadow: 0 0 0 14px var(--at-ai); opacity: 0; } }
.tl-bot-svg { display: block; overflow: visible; }
.tl-bob { animation: tl-bob 3.2s ease-in-out infinite; transform-origin: 32px 40px; }
@keyframes tl-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.tl-eyes { animation: tl-blink 4.5s infinite; transform-origin: 32px 37.5px; }
@keyframes tl-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.tl-tassel { animation: tl-swing 2.4s ease-in-out infinite; transform-origin: 32px 14.5px; }
@keyframes tl-swing { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(7deg); } }
.tl-fab:hover .tl-eyes { animation: none; transform: scaleY(1.15); }
.tl-fab:hover { transform: translateY(-2px); }
.tl-fab:focus-visible, .tl-icon:focus-visible, .tl-send:focus-visible, .tl-chips button:focus-visible { outline: 3px solid var(--at-focus-ring); outline-offset: 2px; }
.tl.is-open .tl-fab { display: none; }
.tl-panel { position: fixed; right: 24px; bottom: 24px; z-index: 1065; display: flex; flex-direction: column; width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 96px)); background: var(--at-surface); color: var(--at-ink); border: 1px solid var(--at-line); border-radius: var(--at-radius-lg); box-shadow: var(--at-shadow-md); overflow: hidden; }
.tl-panel[hidden] { display: none; }
.tl-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; background: var(--at-header); color: var(--at-chrome-ink); }
.tl-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--at-ai-soft); flex: none; }
.tl-head-text { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.tl-head-text strong { display: block; font-size: 14px; }
.tl-head-text small { display: block; font-size: 12px; color: var(--at-chrome-ink-muted); }
.tl-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--at-radius-ctl); background: transparent; color: inherit; cursor: pointer; }
.tl-icon:hover { background: var(--at-sidebar-active); }
.tl-log { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--at-canvas); }
.tl-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.tl-msg p { margin: 0 0 6px; } .tl-msg p:last-child { margin-bottom: 0; }
.tl-msg ul { margin: 2px 0 6px; padding-left: 18px; } .tl-msg li { margin: 2px 0; }
.tl-bot { align-self: flex-start; max-width: 94%; background: var(--at-surface); border: 1px solid var(--at-line); border-bottom-left-radius: 4px; }
.tl-me { align-self: flex-end; background: var(--at-brand); color: var(--at-on-brand); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.tl-err { background: var(--at-danger-soft); border-color: var(--at-danger); color: var(--at-ink); }
.tl-wait { color: var(--at-ink-muted); font-style: italic; }
.tl-wait::after { content: ""; display: inline-block; width: 1em; text-align: left; animation: tl-dots 1.2s steps(4) infinite; }
@keyframes tl-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.tl-ref { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 1px; border-radius: 8px; background: var(--at-ai-soft); color: var(--at-ai); font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; vertical-align: super; }
.tl-src { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--at-line); }
.tl-thumb { --k: var(--at-brand); --k-soft: var(--at-brand-soft); display: flex; align-items: center; gap: 9px; min-width: 0; padding: 6px 8px 6px 6px; border: 1px solid var(--at-line); border-radius: 10px; background: var(--at-surface-2); color: var(--at-ink); text-decoration: none; transition: border-color var(--at-fast) var(--at-ease), transform var(--at-fast) var(--at-ease), box-shadow var(--at-fast) var(--at-ease); }
.tl-thumb--topic { --k: var(--at-ai); --k-soft: var(--at-ai-soft); }
.tl-thumb--lecturer { --k: var(--at-warning); --k-soft: var(--at-warning-soft); }
.tl-thumb--archived { --k: var(--at-info); --k-soft: var(--at-info-soft); }
.tl-thumb-ic { position: relative; display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--k-soft); color: var(--k); }
.tl-thumb-ic b { position: absolute; top: -5px; left: -5px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--k); color: var(--at-canvas); font-size: 10px; line-height: 16px; text-align: center; }
.tl-thumb-tx { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.tl-thumb-tx small { color: var(--at-ink-muted); font-size: 11px; }
.tl-thumb-tx span { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tl-thumb > .at-icon { flex: none; color: var(--at-ink-muted); transition: transform var(--at-fast) var(--at-ease); }
a.tl-thumb:hover { border-color: var(--k); box-shadow: var(--at-shadow-sm); transform: translateY(-1px); }
a.tl-thumb:hover > .at-icon { color: var(--k); transform: translateX(2px); }
a.tl-thumb:focus-visible { outline: 3px solid var(--at-focus-ring); outline-offset: 2px; }
.tl-mode { display: block; margin-top: 6px; color: var(--at-warning); font-size: 12px; }
.tl-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; background: var(--at-canvas); }
.tl-chips[hidden] { display: none; }
.tl-chips button { padding: 5px 10px; border: 1px solid var(--at-line-strong); border-radius: var(--at-radius-pill); background: var(--at-surface); color: var(--at-ink); font: 13px/1.3 var(--at-font); text-align: left; cursor: pointer; }
.tl-chips button:hover { background: var(--at-surface-hover); }
.tl-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 6px; background: var(--at-canvas); }
.tl-form textarea { flex: 1 1 auto; min-height: 40px; max-height: 120px; padding: 9px 12px; border: 1px solid var(--at-line-strong); border-radius: var(--at-radius-ctl); background: var(--at-surface); color: var(--at-ink); font: 14px/1.45 var(--at-font); resize: none; field-sizing: content; }
.tl-form textarea:focus { outline: none; border-color: var(--at-focus); box-shadow: 0 0 0 3px var(--at-focus-ring); }
.tl-send { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: var(--at-radius-ctl); background: var(--at-brand); color: var(--at-on-brand); cursor: pointer; }
.tl-send:hover { background: var(--at-brand-hover); }
.tl-note { margin: 0; padding: 0 14px 10px; background: var(--at-canvas); color: var(--at-ink-muted); font-size: 11.5px; }
@media (max-width: 767.98px) {
  .tl-fab { right: 16px; bottom: calc(var(--at-bottomnav-h) + env(safe-area-inset-bottom) + 12px); width: 56px; padding: 0; justify-content: center; }
  .tl-fab-label { display: none; }
  .tl-panel { right: 0; left: 0; bottom: 0; width: 100%; height: calc(100vh - var(--at-topbar-h)); border-radius: var(--at-radius-lg) var(--at-radius-lg) 0 0; }
}
@media (prefers-reduced-motion: reduce) { .tl-fab, .tl-thumb, .tl-thumb > .at-icon { transition: none; } .tl-fab::before, .tl-bob, .tl-eyes, .tl-tassel { animation: none; } .tl-wait::after { animation: none; content: "…"; } }
