body.auth-locked #ai-fab, body.auth-locked #ai-panel { display: none; }
.ai-fab { position: fixed; right: 24px; bottom: 24px; z-index: 800; display: inline-flex; align-items: center; gap: 7px; width: 134px; height: 54px; padding: 5px 12px 5px 6px; border: 1px solid #155d72; border-radius: 27px; background: #155d72; color: #fff; box-shadow: 0 8px 24px #173b4a3b; font: inherit; font-size: 13px; font-weight: 700; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; transition: background .18s, box-shadow .18s, scale .18s; }
.ai-fab:hover, .ai-fab:focus-visible { background: #114d5c; box-shadow: 0 10px 28px #173b4a55, 0 0 0 3px #8ce1cc66; scale: 1.04; }
.ai-fab.dragging { cursor: grabbing; scale: 1; box-shadow: 0 14px 30px #173b4a66; }
.ai-fab.panel-open { opacity: 0; pointer-events: none; }
.ai-fab-label { white-space: nowrap; }
.ai-fab-tip { position: absolute; right: 0; bottom: calc(100% + 10px); padding: 6px 9px; border: 1px solid #bfe7dd; border-radius: 6px; background: #fff; color: #155d72; box-shadow: 0 5px 18px #173b4a22; font-size: 11px; font-weight: 600; white-space: nowrap; opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .18s, transform .18s; }
.ai-fab:hover .ai-fab-tip, .ai-fab:focus-visible .ai-fab-tip { opacity: 1; transform: translateY(0); }
.ai-fab.dragging .ai-fab-tip { opacity: 0; }
.ai-fab.near-top .ai-fab-tip { bottom: auto; top: calc(100% + 10px); }
.ai-bot { --look-x: 0px; --look-y: 0px; position: relative; display: inline-block; flex: none; width: 40px; height: 40px; border-radius: 50%; background: #e4fbf5; animation: ai-bot-float 3.6s ease-in-out infinite; }
.ai-bot-antenna { position: absolute; left: 19px; top: 1px; width: 3px; height: 9px; border-radius: 3px; background: #155d72; transform-origin: bottom; transition: transform .2s; }
.ai-bot-antenna::after { content: ""; position: absolute; left: -2px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: #ff937e; box-shadow: 0 0 0 2px #fff8; }
.ai-bot-head { position: absolute; inset: 9px 4px 4px; border: 2px solid #155d72; border-radius: 10px; background: #f8fffd; box-shadow: inset 0 -4px 0 #c6efe6; transition: transform .2s ease; }
.ai-bot-head::before, .ai-bot-head::after { content: ""; position: absolute; top: 8px; width: 3px; height: 9px; background: #8ce1cc; }
.ai-bot-head::before { left: -5px; border-radius: 2px 0 0 2px; }
.ai-bot-head::after { right: -5px; border-radius: 0 2px 2px 0; }
.ai-bot-eye { position: absolute; top: 7px; width: 6px; height: 8px; border-radius: 4px; background: #155d72; transform: translate(var(--look-x), var(--look-y)); transition: transform .1s; animation: ai-bot-blink 5.5s infinite; }
.ai-bot-eye::after { content: ""; position: absolute; top: 1px; right: 1px; width: 2px; height: 2px; border-radius: 50%; background: #fff; }
.ai-bot-eye-left { left: 7px; }
.ai-bot-eye-right { right: 7px; }
.ai-bot-mouth { position: absolute; left: 13px; bottom: 4px; width: 6px; height: 4px; border-bottom: 2px solid #ed8973; border-radius: 50%; }
.ai-fab:hover .ai-bot-head, .ai-fab:focus-visible .ai-bot-head { transform: translateY(-2px) rotate(-7deg); }
.ai-fab:hover .ai-bot-antenna { transform: rotate(18deg); }
.ai-fab.dragging .ai-bot-head { transform: rotate(8deg); }
.ai-bot-small { width: 36px; height: 36px; animation: none; }
.ai-bot-small .ai-bot-antenna { left: 17px; }
@keyframes ai-bot-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes ai-bot-blink { 0%, 45%, 49%, 100% { height: 8px; } 47% { height: 2px; } }
.ai-panel { position: fixed; inset: 0 0 0 auto; z-index: 801; display: flex; flex-direction: column; width: min(440px, 100vw); height: 100dvh; border-left: 1px solid #d8dfe5; background: #fff; box-shadow: -12px 0 36px #172b3a22; transform: translateX(101%); visibility: hidden; pointer-events: none; transition: transform .22s ease, visibility .22s; }
.ai-panel.open { transform: translateX(0); visibility: visible; pointer-events: auto; }
.ai-panel-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #e5eaed; }
.ai-panel-head h2 { font-size: 18px; line-height: 1.3; }
.ai-panel-identity { display: flex; align-items: center; gap: 10px; }
.ai-panel-head #ai-page-context { display: block; margin-top: 4px; color: #53636c; font-size: 12px; }
.ai-panel-head button { width: 30px; height: 30px; border: 0; background: transparent; color: #53636c; font-size: 24px; line-height: 1; cursor: pointer; }
.ai-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 24px; }
.ai-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ai-topic { display: inline-flex; border: 1px solid #d8dfe5; border-radius: 6px; overflow: hidden; }
.ai-topic button { border: 0; border-right: 1px solid #d8dfe5; background: #fff; padding: 7px 11px; color: #28343a; font: inherit; font-size: 13px; cursor: pointer; }
.ai-topic button:last-child { border-right: 0; }
.ai-topic button.active { background: #eaf2f4; color: #176577; font-weight: 700; }
.ai-period { font-size: 12px; color: #53636c; white-space: nowrap; }
.ai-period select { margin-left: 3px; padding: 7px 5px; border: 1px solid #d8dfe5; border-radius: 6px; background: #fff; font: inherit; font-size: 12px; }
.ai-scope { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; padding-bottom: 12px; border-bottom: 1px solid #e5eaed; color: #53636c; font-size: 12px; }
.ai-message { min-height: 24px; padding-top: 12px; font-size: 12px; color: #53636c; }
.ai-result { padding-top: 12px; }
.ai-result-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; align-items: baseline; }
.ai-result-head h3 { font-size: 15px; }
.ai-result-head span { font-size: 11px; color: #667; }
.ai-answer { white-space: pre-wrap; margin-top: 12px; line-height: 1.7; font-size: 13px; overflow-wrap: anywhere; }
.ai-evidence { margin-top: 18px; }
.ai-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-metric { display: flex; flex-direction: column; gap: 2px; border-top: 2px solid #176577; padding: 8px 0; min-width: 0; }
.ai-metric span, .ai-metric small { color: #53636c; font-size: 11px; }
.ai-metric strong { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.ai-evidence h4 { font-size: 13px; margin: 14px 0 8px; }
.ai-table-wrap { overflow-x: auto; }
.ai-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ai-table th, .ai-table td { border-bottom: 1px solid #e5eaed; padding: 8px 5px; text-align: left; }
.ai-table th { background: #f3f6f7; color: #53636c; }
.ai-table td:first-child { min-width: 140px; overflow-wrap: anywhere; }
.ai-table .num, .ai-table th:not(:first-child) { text-align: right; white-space: nowrap; }
.ai-query { flex: none; padding: 12px 20px 18px; border-top: 1px solid #e5eaed; background: #fff; }
.ai-query label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.ai-query-row { display: flex; gap: 8px; }
.ai-query input { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid #d8dfe5; border-radius: 6px; font: inherit; font-size: 12px; }
.ai-query input:disabled { background: #f6f8f9; color: #667; }
.ai-query button { flex: none; height: 40px; padding: 0 13px; border: 0; border-radius: 6px; background: #176577; color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.ai-query button:disabled { opacity: .55; cursor: wait; }
#ai-fab:focus-visible, #ai-panel button:focus-visible, #ai-panel input:focus-visible, #ai-panel select:focus-visible { outline: 2px solid #176577; outline-offset: 2px; }
@media (max-width: 600px) { .ai-fab { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); } .ai-panel-body { padding: 14px 16px 20px; } .ai-panel-head { padding: 14px 16px; } .ai-query { padding: 10px 16px max(12px, env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { .ai-panel, .ai-bot, .ai-bot-eye, .ai-fab { animation: none; transition: none; } }
