.assistant-dock { position: fixed; z-index: 140; width: 84px; height: 126px; --eye-x: 0px; --eye-y: 0px; }
.assistant-hide { position: absolute; top: 0; right: 0; width: 24px; height: 24px; border: 0; border-radius: 0; background: transparent; color: var(--medi-close-color, #475569); font-size: 20px; line-height: 1; padding: 0; cursor: pointer; box-shadow: none; }
.assistant-hide:hover { background: transparent; color: var(--medi-close-color, #475569); transform: scale(1.12); }
.assistant-hide:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.assistant-launcher { position: absolute; inset: 24px 0 0; width: 84px; height: 102px; padding: 0; display: flex; flex-direction: column; align-items: center; border: 0; color: #006b61; background: transparent; cursor: grab; touch-action: none; user-select: none; filter: drop-shadow(0 4px 5px #123e352d); }
.is-dragging .assistant-launcher { cursor: grabbing; }
.assistant-launcher:focus-visible { outline: 2px solid #008575; outline-offset: 3px; border-radius: 16px; }
.assistant-launcher-label { font-size: 10px; font-weight: 800; margin-top: 9px; padding: 1px 7px; background: #ffffffdd; border-radius: 8px; }
.assistant-mascot { flex-shrink: 0; width: 56px; height: 40px; position: relative; display: grid; align-items: center; background: linear-gradient(140deg,#f7fffc,#bce8da); border: 2px solid #008575; border-radius: 16px; z-index: 1; }
.assistant-antenna { position: absolute; width: 3px; height: 8px; top: -9px; left: 25px; background: #008575; border-radius: 3px; }
.assistant-antenna::before { content: ''; width: 7px; height: 7px; position: absolute; top: -4px; left: -2px; border-radius: 50%; background: #f6c75d; }
.assistant-face { width: 42px; height: 25px; margin: auto; background: #075c57; border-radius: 10px; display: flex; align-items: center; justify-content: space-evenly; }
.assistant-eye { width: 10px; height: 12px; background: #eafff7; border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.assistant-eye::after { content: ''; width: 5px; height: 7px; border-radius: 50%; background: #008575; transform: translate(var(--eye-x),var(--eye-y)); }
.assistant-body { position: relative; display: grid; place-items: center; flex-shrink: 0; width: 37px; height: 29px; margin-top: 3px; border: 2px solid #008575; border-radius: 9px 9px 12px 12px; background: linear-gradient(140deg,#f7fffc,#bce8da); font-size: 21px; font-weight: 800; }
.assistant-body::before { content: ''; position: absolute; left: -13px; top: 1px; width: 8px; height: 21px; border-radius: 7px; background: #008575; box-shadow: 50px 0 #008575; }
.assistant-body::after { content: ''; position: absolute; left: 4px; bottom: -9px; width: 10px; height: 8px; border-radius: 0 0 4px 4px; background: #008575; box-shadow: 16px 0 #008575; }
.assistant-panel { position: fixed; right: 18px; bottom: 18px; z-index: 145; width: min(350px, calc(100vw - 116px)); height: min(500px, calc(100dvh - 24px)); display: flex; flex-direction: column; background: var(--gcn-surface, #fff); color: var(--gcn-text, #102536); border: 1px solid #c9dfdc; border-radius: 18px; box-shadow: 0 12px 48px #102e3440; overflow: hidden; }
.assistant-panel[hidden], .assistant-dock[hidden], .assistant-launcher[hidden] { display: none !important; }
.assistant-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; background: #e8f6f1; color: #075d54; border-bottom: 1px solid #d0e8df; }
.assistant-header strong { display: block; font-size: 20px; } .assistant-header small { display: block; margin-top: 3px; font-size: 11px; }
.assistant-header button { border: 0; background: transparent; font-size: 25px; color: inherit; cursor: pointer; width: 36px; height: 36px; }
.assistant-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px 0; font-size: 11px; }
.assistant-toolbar label { display: flex; align-items: center; gap: 5px; margin-right: auto; }
.assistant-toolbar button, .assistant-suggestions button { border: 1px solid #d8e6e7; border-radius: 8px; background: var(--gcn-surface, #fff); color: #007a6d; font-size: 11px; padding: 7px; cursor: pointer; }
.assistant-status { padding: 8px 14px; margin: 0; color: var(--gcn-muted, #64748b); font-size: 11px; }
.assistant-messages { flex: 1; min-height: 80px; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.assistant-message { max-width: 100%; border-radius: 12px; border: 1px solid #e0e8ee; background: var(--gcn-surface, #fff); padding: 11px 12px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.assistant-message p { margin: 0; white-space: pre-wrap; } .assistant-message-user { align-self: flex-end; max-width: 90%; background: #e5f6ee; color: #124e44; border-color: #cde6db; }
.assistant-result { margin-top: 10px; border-top: 1px solid #dbe8e7; padding-top: 10px; }
.assistant-result dl { display: grid; grid-template-columns: minmax(90px, .7fr) 1.3fr; gap: 4px 8px; margin: 8px 0; }
.assistant-result dt { color: var(--gcn-muted, #64748b); font-size: 11px; } .assistant-result dd { margin: 0; white-space: pre-wrap; }
.assistant-result .button { min-height: 30px; font-size: 11px; padding: 5px 10px; }
.assistant-source { display: block; margin-top: 9px; color: var(--gcn-muted, #64748b); font-size: 10px; }
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid #e1e9ee; }
.assistant-compose { display: flex; align-items: flex-end; gap: 8px; padding: 0 12px 12px; }
.assistant-compose textarea { flex: 1; min-width: 0; max-height: 110px; resize: vertical; border: 1px solid #c9dbe0; border-radius: 10px; padding: 10px; font: inherit; font-size: 12px; background: var(--gcn-surface, #fff); color: inherit; }
.assistant-compose .button { min-height: 42px; padding: 10px 12px; }
.assistant-settings { flex-shrink: 0; max-height: 45%; overflow-y: auto; margin: 0 12px; padding: 12px; border: 1px solid #c9dfda; border-radius: 10px; font-size: 12px; }
.assistant-settings[hidden] { display: none; } .assistant-settings label { display: block; margin: 8px 0; }
.assistant-settings input:not([type=checkbox]), .assistant-settings select { display: block; width: 100%; min-height: 32px; margin-top: 4px; border: 1px solid #cadce0; border-radius: 6px; background: var(--gcn-surface, #fff); color: inherit; padding: 5px; }
.assistant-settings small { display: block; color: var(--gcn-muted, #64748b); margin-bottom: 10px; }
@media (max-width: 600px) { .assistant-header { padding: 10px 12px; } .assistant-header small { font-size: 10px; } .assistant-compose { flex-wrap: wrap; } .assistant-compose textarea { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .assistant-launcher:hover { transform: none; } }

/* Gentle idle movement stays on the character, keeping the drag target steady. */
.assistant-emblem { display: block; width: 20px; height: 20px; object-fit: contain; border-radius: 4px; pointer-events: none; }
.assistant-mascot { animation: medi-head 7s ease-in-out infinite; transform-origin: center bottom; }
.assistant-body { animation: medi-breathe 4s ease-in-out infinite; }
.assistant-eye { animation: medi-blink 6.7s infinite; transform-origin: center; }
.assistant-antenna::before { animation: medi-light 4s ease-in-out infinite; }
.assistant-launcher:hover .assistant-mascot { animation-duration: 3.5s; }
.is-dragging .assistant-mascot, .is-dragging .assistant-body, .is-dragging .assistant-eye, .is-dragging .assistant-antenna::before { animation-play-state: paused; }
@keyframes medi-head { 0%, 25%, 60%, 100% { transform: translateY(0) rotate(0); } 35%, 45% { transform: translateY(-2px) rotate(-5deg); } 75%, 85% { transform: translateY(-1px) rotate(4deg); } }
@keyframes medi-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@keyframes medi-blink { 0%, 37%, 41%, 73%, 77%, 81%, 85%, 100% { transform: scaleY(1); } 39%, 75%, 83% { transform: scaleY(.08); } }
@keyframes medi-light { 0%, 100% { box-shadow: 0 0 0 transparent; } 50% { box-shadow: 0 0 6px #f6c75d80; } }
@media (prefers-reduced-motion: reduce) { .assistant-mascot, .assistant-body, .assistant-eye, .assistant-antenna::before { animation: none !important; } }

.assistant-panel { box-sizing: border-box; max-width: none; max-height: none; }
.assistant-header, .assistant-toolbar, .assistant-status, .assistant-suggestions, .assistant-compose { flex-shrink: 0; }
.assistant-header { padding: 10px 14px; }
.assistant-messages { min-height: 0; }
.assistant-settings { min-height: 0; max-height: 40%; }
.assistant-compose textarea { max-height: 72px; }
@media (max-height: 520px) { .assistant-header small, .assistant-suggestions { display: none; } .assistant-status { padding: 4px 12px; } .assistant-settings { max-height: 32%; } }

/* Rounded shell, friendly smile and soft cheeks; controls keep their original hit area. */
.assistant-mascot { border-radius: 19px 19px 17px 17px; background: linear-gradient(145deg, #ffffff 5%, #dcf8ee 55%, #a9dfce); box-shadow: inset 0 2px 2px #fff, inset 0 -2px 3px #00857526; }
.assistant-face { position: relative; height: 27px; padding-bottom: 4px; box-sizing: border-box; background: linear-gradient(155deg, #064d49, #078174); box-shadow: inset 0 1px 3px #003c3b50; }
.assistant-face::after { content: ''; position: absolute; width: 9px; height: 4px; border: 1.5px solid #aef6dc; border-top: 0; border-radius: 0 0 10px 10px; bottom: 3px; left: calc(50% - 4.5px); }
.assistant-mascot::before, .assistant-mascot::after { content: ''; position: absolute; width: 5px; height: 3px; border-radius: 50%; background: #f4b8ae; bottom: 6px; z-index: 2; opacity: .8; }
.assistant-mascot::before { left: 7px; } .assistant-mascot::after { right: 7px; }
.assistant-body { border-radius: 11px 11px 14px 14px; box-shadow: inset 0 2px 2px #fff; }
.assistant-launcher * { pointer-events: none; }

.assistant-learn { display: flex; align-items: center; gap: 6px; margin: 10px 0; }
#assistant-memories textarea { display: block; width: 100%; box-sizing: border-box; }
#assistant-memory-list { display: grid; gap: 8px; }
#assistant-context { padding-top: 0; font-weight: 600; }

#assistant-usage-panel .table-wrapper { overflow-x: auto; margin: 14px 0; }
#assistant-usage-panel table { width: 100%; border-collapse: collapse; font-size: 12px; }
#assistant-usage-panel th, #assistant-usage-panel td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #e1e9ee; white-space: nowrap; }
#assistant-usage-panel th { background: #f3f8fa; font-size: 11px; }
#assistant-usage-panel .openrouter-stat { min-width: 0; }

#assistant-admin-panel .assistant-settings { max-height: none; margin: 16px 0; padding: 20px; }
#assistant-admin-panel #assistant-memory-list { max-height: 420px; overflow-y: auto; }
#assistant-admin-panel input:not([type="checkbox"]), #assistant-admin-panel select { max-width: 520px; }
