/* AI Assistant — floating widget + full page */
.ai-fab {
    position: fixed; right: 22px; bottom: 22px; z-index: 1060;
    width: 52px; height: 52px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-size: 1.3rem;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4); cursor: pointer;
}
.ai-fab:hover { transform: scale(1.06); }
.ai-widget {
    position: fixed; right: 22px; bottom: 84px; z-index: 1060;
    width: min(560px, calc(100vw - 32px)); height: min(640px, calc(100vh - 120px));
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.25); display: flex; flex-direction: column; overflow: hidden;
}
.ai-widget[hidden] { display: none; }
.ai-widget-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.55rem 0.8rem; background: linear-gradient(135deg, #1e3a8a, #4c1d95); color: #fff; font-weight: 600; font-size: 0.9rem;
}
.ai-head-btn { background: none; border: none; color: #fff; opacity: 0.85; margin-left: 0.5rem; padding: 0; font-size: 0.9rem; }
.ai-head-btn:hover { opacity: 1; color: #fff; }
.ai-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ai-log { flex: 1; overflow-y: auto; padding: 0.75rem; background: #f8fafc; }
.ai-form { display: flex; gap: 0.4rem; padding: 0.55rem; border-top: 1px solid #e2e8f0; background: #fff; }
.ai-msg { margin-bottom: 0.7rem; font-size: 0.82rem; }
.ai-user {
    margin-left: auto; max-width: 80%; width: fit-content;
    background: #2563eb; color: #fff; padding: 0.45rem 0.75rem; border-radius: 12px 12px 2px 12px;
}
.ai-bot { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px 12px 12px 2px; padding: 0.6rem 0.75rem; }
.ai-answer-title { font-weight: 700; color: #1e3a8a; margin-bottom: 0.3rem; }
.ai-text { margin-bottom: 0.35rem; line-height: 1.45; }
.ai-table-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: #64748b; margin: 0.5rem 0 0.2rem; }
.ai-table-wrap { max-height: 260px; overflow: auto; }
.ai-table th, .ai-table td { font-size: 0.72rem; white-space: nowrap; padding: 0.25rem 0.45rem; }
.ai-links { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; }
.ai-chip {
    border: 1px solid #c7d2fe; background: #eef2ff; color: #3730a3; border-radius: 999px;
    font-size: 0.72rem; padding: 0.15rem 0.6rem; cursor: pointer;
}
.ai-chip:hover { background: #e0e7ff; }
.ai-page { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.ai-page-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 0.55rem 0.8rem; border-bottom: 1px solid #e2e8f0; gap: 0.5rem; flex-wrap: wrap; }
.ai-chat-page { height: calc(100vh - 230px); min-height: 480px; }
.ai-chat-page .ai-msg { font-size: 0.86rem; }
.ai-chat-page .ai-table-wrap { max-height: 380px; }
@media print { .ai-fab, .ai-widget { display: none !important; } }
