.ai-markdown-content, .ai-wrapper .ai-msg__text {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-color, #212529);
  word-break: break-word;
}
.ai-markdown-content h1, .ai-wrapper .ai-msg__text h1, .ai-markdown-content h2, .ai-wrapper .ai-msg__text h2, .ai-markdown-content h3, .ai-wrapper .ai-msg__text h3, .ai-markdown-content h4, .ai-wrapper .ai-msg__text h4, .ai-markdown-content h5, .ai-wrapper .ai-msg__text h5, .ai-markdown-content h6, .ai-wrapper .ai-msg__text h6 {
  margin: 8px 0 4px;
  line-height: 1.35;
  font-weight: 600;
  color: inherit;
}
.ai-markdown-content h1, .ai-wrapper .ai-msg__text h1 {
  font-size: 14px;
}
.ai-markdown-content h2, .ai-wrapper .ai-msg__text h2 {
  font-size: 13px;
  margin: 8px 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-color, #e9ecef);
}
.ai-markdown-content h3, .ai-wrapper .ai-msg__text h3 {
  font-size: 12.5px;
}
.ai-markdown-content h4, .ai-wrapper .ai-msg__text h4, .ai-markdown-content h5, .ai-wrapper .ai-msg__text h5, .ai-markdown-content h6, .ai-wrapper .ai-msg__text h6 {
  font-size: 12px;
}
.ai-markdown-content p, .ai-wrapper .ai-msg__text p {
  margin: 0 0 6px;
}
.ai-markdown-content p:last-child, .ai-wrapper .ai-msg__text p:last-child {
  margin-bottom: 0;
}
.ai-markdown-content ul, .ai-wrapper .ai-msg__text ul, .ai-markdown-content ol, .ai-wrapper .ai-msg__text ol {
  margin: 4px 0 6px;
  padding-left: 18px;
}
.ai-markdown-content li, .ai-wrapper .ai-msg__text li {
  margin-bottom: 3px;
  font-size: 12.5px;
  line-height: 1.5;
}
.ai-markdown-content table, .ai-wrapper .ai-msg__text table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 11.5px;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.ai-markdown-content table th, .ai-wrapper .ai-msg__text table th, .ai-markdown-content table td, .ai-wrapper .ai-msg__text table td {
  padding: 5px 8px;
  border: 1px solid var(--border-color, #dee2e6);
  text-align: left;
}
.ai-markdown-content table th, .ai-wrapper .ai-msg__text table th {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.05);
}
.ai-markdown-content table tr:nth-child(even), .ai-wrapper .ai-msg__text table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}
.ai-markdown-content code, .ai-wrapper .ai-msg__text code {
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11.5px;
  font-family: monospace;
}
.ai-markdown-content pre, .ai-wrapper .ai-msg__text pre {
  background: rgba(0, 0, 0, 0.06);
  padding: 8px 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 6px 0;
}
.ai-markdown-content pre code, .ai-wrapper .ai-msg__text pre code {
  background: transparent;
  padding: 0;
}
.ai-markdown-content blockquote, .ai-wrapper .ai-msg__text blockquote {
  border-left: 3px solid rgba(0, 0, 0, 0.2);
  margin: 6px 0;
  padding-left: 8px;
  font-style: italic;
}
.ai-msg--user .ai-markdown-content table th, .ai-msg--user .ai-wrapper .ai-msg__text table th, .ai-wrapper .ai-msg--user .ai-msg__text table th, .ai-msg--user .ai-markdown-content table td, .ai-msg--user .ai-wrapper .ai-msg__text table td, .ai-wrapper .ai-msg--user .ai-msg__text table td {
  border-color: rgba(255, 255, 255, 0.3);
}
.ai-msg--user .ai-markdown-content table th, .ai-msg--user .ai-wrapper .ai-msg__text table th, .ai-wrapper .ai-msg--user .ai-msg__text table th {
  background: rgba(255, 255, 255, 0.15);
}
.ai-msg--user .ai-markdown-content table tr:nth-child(even), .ai-msg--user .ai-wrapper .ai-msg__text table tr:nth-child(even), .ai-wrapper .ai-msg--user .ai-msg__text table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.08);
}
.ai-msg--user .ai-markdown-content code, .ai-msg--user .ai-wrapper .ai-msg__text code, .ai-wrapper .ai-msg--user .ai-msg__text code {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.ai-msg--user .ai-markdown-content pre, .ai-msg--user .ai-wrapper .ai-msg__text pre, .ai-wrapper .ai-msg--user .ai-msg__text pre {
  background: rgba(0, 0, 0, 0.15);
}

.notes-ai-sidebar {
  width: 410px;
  min-width: 340px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.375rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease, visibility 0.28s;
  opacity: 1;
  visibility: visible;
}
.notes-ai-sidebar--collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-width: 0 !important;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
}

.ai-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 318px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  color: var(--text-color, #212529);
  background: #fff;
}
.ai-wrapper .ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-color, #e9ecef);
  flex-shrink: 0;
}
.ai-wrapper .ai-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-wrapper .ai-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--theme-hover-color, #e8f5f5);
  border-radius: 6px;
}
.ai-wrapper .ai-header-icon i {
  color: var(--theme-color, #17a2b8);
  font-size: 12px;
}
.ai-wrapper .ai-header-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-color, #212529);
  letter-spacing: -0.01em;
}
.ai-wrapper .ai-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.ai-wrapper .ai-icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted-color, #6c757d);
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}
.ai-wrapper .ai-icon-btn i {
  font-size: 13px;
}
.ai-wrapper .ai-icon-btn:hover {
  background: var(--theme-hover-color, #e8f5f5);
  color: var(--theme-color, #17a2b8);
}
.ai-wrapper .ai-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color, #dee2e6) transparent;
  padding: 12px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-wrapper .ai-body::-webkit-scrollbar {
  width: 4px;
}
.ai-wrapper .ai-body::-webkit-scrollbar-thumb {
  background: var(--border-color, #dee2e6);
  border-radius: 4px;
}
.ai-wrapper .ai-info-text {
  font-size: 11.5px;
  color: var(--text-muted-color, #6c757d);
  margin: 0;
  line-height: 1.5;
  padding: 0 2px;
}
.ai-wrapper .ai-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-wrapper .ai-field-row--select {
  flex-wrap: nowrap;
}
.ai-wrapper .ai-field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-color, #495057);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 42px;
}
.ai-wrapper .ai-scope-pills {
  display: flex;
  gap: 6px;
}
.ai-wrapper .ai-scope-pill {
  padding: 3px 14px;
  border-radius: 5px;
  border: 1.5px solid var(--border-color, #dee2e6);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted-color, #6c757d);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.5;
}
.ai-wrapper .ai-scope-pill:hover {
  border-color: var(--theme-color, #17a2b8);
  color: var(--theme-color, #17a2b8);
}
.ai-wrapper .ai-scope-pill--active {
  border-color: var(--theme-color, #17a2b8);
  color: var(--theme-color, #17a2b8);
  background: var(--theme-hover-color, #e8f5f5);
}
.ai-wrapper .ai-select-wrap {
  position: relative;
  flex: 1;
}
.ai-wrapper .ai-select-wrap .ai-select-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted-color, #6c757d);
  pointer-events: none;
}
.ai-wrapper .ai-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-color, #212529);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.5;
}
.ai-wrapper .ai-select:focus {
  outline: none;
  border-color: var(--theme-color, #17a2b8);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-color, #17a2b8) 15%, transparent);
}
.ai-wrapper .ai-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ai-wrapper .ai-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border-radius: 5px;
  border: 1.5px solid var(--border-color, #dee2e6);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted-color, #6c757d);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.5;
  flex-shrink: 0;
}
.ai-wrapper .ai-tab i {
  font-size: 12px;
  pointer-events: none;
}
.ai-wrapper .ai-tab span {
  pointer-events: none;
}
.ai-wrapper .ai-tab:hover {
  border-color: var(--theme-color, #17a2b8);
  color: var(--theme-color, #17a2b8);
}
.ai-wrapper .ai-tab--active {
  border-color: var(--theme-color, #17a2b8);
  color: var(--theme-color, #17a2b8);
  background: var(--theme-hover-color, #e8f5f5);
}
.ai-wrapper .ai-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.ai-wrapper .ai-status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted-color, #6c757d);
  background: var(--bg-color, #f8f9fa);
  border: 1px solid var(--border-color, #e9ecef);
  border-radius: 6px;
  padding: 5px 8px;
}
.ai-wrapper .ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ai-wrapper .ai-status-dot--ok {
  background: #28a745;
}
.ai-wrapper .ai-status-dot--warn {
  background: #ffc107;
}
.ai-wrapper .ai-status-dot--error {
  background: #dc3545;
}
.ai-wrapper .ai-status-label {
  font-weight: 500;
  color: var(--text-color, #212529);
  font-size: 11.5px;
}
.ai-wrapper .ai-status-time {
  font-size: 11px;
  color: var(--text-muted-color, #9ca3af);
}
.ai-wrapper .ai-refresh-btn {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}
.ai-wrapper .ai-refresh-btn i {
  font-size: 11px;
}
.ai-wrapper .ai-refresh-btn:hover i {
  animation: ai-spin 0.5s linear;
}
.ai-wrapper .ai-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ai-wrapper .ai-section-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-color, #212529);
  letter-spacing: 0.01em;
}
.ai-wrapper .ai-bullet-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: disc;
}
.ai-wrapper .ai-bullet-list li {
  font-size: 12.5px;
  color: var(--text-color, #495057);
  line-height: 1.55;
}
.ai-wrapper .ai-bullet-list--risk li {
  color: #c0392b;
}
.ai-wrapper .ai-loading {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.ai-wrapper .ai-skeleton {
  background: linear-gradient(90deg, var(--border-color, #e9ecef) 25%, var(--bg-color, #f8f9fa) 50%, var(--border-color, #e9ecef) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: ai-shimmer 1.5s infinite ease-in-out;
  height: 12px;
}
.ai-wrapper .ai-skeleton--sm {
  width: 40%;
}
.ai-wrapper .ai-skeleton--md {
  width: 70%;
}
.ai-wrapper .ai-skeleton--lg {
  width: 100%;
}
.ai-wrapper .ai-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 12px;
  gap: 6px;
}
.ai-wrapper .ai-empty-state__icon {
  font-size: 28px;
  color: var(--theme-color, #17a2b8);
  opacity: 0.5;
  margin-bottom: 4px;
}
.ai-wrapper .ai-empty-state__title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-color, #212529);
  margin: 0;
}
.ai-wrapper .ai-empty-state__sub {
  font-size: 11.5px;
  color: var(--text-muted-color, #6c757d);
  margin: 0;
  max-width: 200px;
}
.ai-wrapper .ai-conversation {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
}
.ai-wrapper .ai-msg {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.ai-wrapper .ai-msg--user {
  flex-direction: row-reverse;
}
.ai-wrapper .ai-msg--assistant {
  flex-direction: row;
}
.ai-wrapper .ai-msg__bubble {
  min-width: 20%;
  max-width: 95%;
  padding: 8px 8px;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.ai-msg--user .ai-wrapper .ai-msg__bubble {
  background: var(--theme-color);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--theme-color) 30%, transparent), 0 1px 2px rgba(0, 0, 0, 0.06);
}
.ai-msg--user .ai-wrapper .ai-msg__bubble .ai-msg__text,
.ai-msg--user .ai-wrapper .ai-msg__bubble .ai-markdown-content,
.ai-msg--user .ai-wrapper .ai-msg__bubble p, .ai-msg--user .ai-wrapper .ai-msg__bubble span:not(.ai-msg__pinned-item-title), .ai-msg--user .ai-wrapper .ai-msg__bubble li {
  color: #fff;
}
.ai-msg--user .ai-wrapper .ai-msg__bubble .ai-msg__pinned-item {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.ai-msg--user .ai-wrapper .ai-msg__bubble .ai-msg__pinned-item i {
  color: var(--theme-color, #17a2b8);
  opacity: 1;
}
.ai-msg--user .ai-wrapper .ai-msg__bubble .ai-msg__pinned-item .ai-msg__pinned-item-title {
  color: #1e293b;
  font-weight: 600;
}
.ai-msg--assistant .ai-wrapper .ai-msg__bubble {
  max-width: 95%;
  background: var(--bg-color, #f1f3f5);
  color: var(--text-color, #212529);
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.ai-wrapper .ai-msg__bubble .ai-msg__pinned-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid rgba(0, 0, 0, 0.08);
  max-width: 100%;
}
.ai-wrapper .ai-msg__bubble .ai-msg__pinned-item i {
  font-size: 10px;
  flex-shrink: 0;
  color: var(--theme-color, #17a2b8);
}
.ai-wrapper .ai-msg__bubble .ai-msg__pinned-item .ai-msg__pinned-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1e293b;
  font-weight: 600;
}
.ai-wrapper .ai-msg__text {
  margin: 0 0 3px;
}
.ai-wrapper .ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--bg-color, #f1f3f5);
  border-radius: 14px 14px 14px 4px;
  width: fit-content;
}
.ai-wrapper .ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--theme-color, #17a2b8);
  opacity: 0.4;
  animation: ai-bounce 1.2s infinite ease-in-out;
}
.ai-wrapper .ai-typing span:nth-child(1) {
  animation-delay: 0s;
}
.ai-wrapper .ai-typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.ai-wrapper .ai-typing span:nth-child(3) {
  animation-delay: 0.4s;
}
.ai-wrapper .ai-ref-pills-container {
  border-top: 1px solid var(--border-color, #e9ecef);
  padding-top: 12px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted-color, #6c757d);
  letter-spacing: 0.5px;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-header i {
  color: var(--theme-color, #17a2b8);
}
.ai-wrapper .ai-ref-pills-container .ai-ref-cards-wrap,
.ai-wrapper .ai-ref-pills-container .ai-ref-pills-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: none;
  padding: 0;
  background: transparent;
  box-sizing: border-box;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--ai-card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 10px 14px;
  gap: 10px;
  box-sizing: border-box;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card:hover,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill:hover {
  background: var(--ai-card-hover-bg, #f8fafc);
  border-color: var(--border-hover-color, #cbd5e1);
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card__icon,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--theme-teal, #14b8a6);
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card__icon svg,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card__title,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color, #1e293b);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card__meta,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill__meta {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted-color, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card__tags,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill__tags {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  flex-shrink: 0;
}
.ai-wrapper .ai-ref-pills-container .ai-ref-card .ai-tag-pill,
.ai-wrapper .ai-ref-pills-container .ai-ref-pill .ai-tag-pill {
  font-size: 10.5px;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}
.ai-wrapper .ai-references {
  border-top: 1px solid var(--border-color, #e9ecef);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-wrapper .ai-references-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.ai-wrapper .ai-references-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-color, #212529);
}
.ai-wrapper .ai-references-count {
  font-weight: 400;
  color: var(--text-muted-color, #6c757d);
}
.ai-wrapper .ai-references-view-all {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--theme-color, #17a2b8);
  text-decoration: none;
}
.ai-wrapper .ai-references-view-all:hover {
  text-decoration: underline;
}
.ai-wrapper .ai-ref-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e9ecef);
  background: var(--bg-color, #f8f9fa);
  transition: background 0.12s ease;
}
.ai-wrapper .ai-ref-item:hover {
  background: var(--theme-hover-color, #e8f5f5);
}
.ai-wrapper .ai-ref-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 4px;
  flex-shrink: 0;
}
.ai-wrapper .ai-ref-icon i {
  font-size: 11px;
  color: var(--theme-color, #17a2b8);
}
.ai-wrapper .ai-ref-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-color, #212529);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-wrapper .ai-ref-type {
  font-size: 10.5px;
  color: var(--text-muted-color, #6c757d);
  background: #fff;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 3px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.ai-wrapper .ai-ref-size {
  font-size: 10.5px;
  color: var(--text-muted-color, #9ca3af);
  flex-shrink: 0;
  min-width: 44px;
  text-align: right;
}
.ai-wrapper .ai-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border-color, #e9ecef);
  padding: 10px 14px 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-wrapper .ai-pinned-item-bar {
  display: flex;
  align-items: center;
  padding: 0 2px;
}
.ai-wrapper .ai-pinned-item-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  background: var(--theme-hover-color, #e8f5f5);
  border: 1px solid color-mix(in srgb, var(--theme-color, #17a2b8) 35%, transparent);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--theme-color, #17a2b8);
  transition: all 0.15s ease;
}
.ai-wrapper .ai-pinned-item-badge .ai-pinned-item-icon {
  font-size: 11px;
  color: var(--theme-color, #17a2b8);
  flex-shrink: 0;
}
.ai-wrapper .ai-pinned-item-badge .ai-pinned-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
  color: var(--text-color, #212529);
  font-weight: 500;
}
.ai-wrapper .ai-pinned-item-badge .ai-pinned-item-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted-color, #6c757d);
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.ai-wrapper .ai-pinned-item-badge .ai-pinned-item-remove i {
  font-size: 10px;
}
.ai-wrapper .ai-pinned-item-badge .ai-pinned-item-remove:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #dc3545;
}
.ai-wrapper .ai-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.ai-wrapper .ai-textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-color, #212529);
  background: var(--bg-color, #fff);
  overflow-y: hidden;
  min-height: 36px;
  max-height: 120px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ai-wrapper .ai-textarea::placeholder {
  color: var(--text-muted-color, #9ca3af);
}
.ai-wrapper .ai-textarea:focus {
  outline: none;
  border-color: var(--theme-color, #17a2b8);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-color, #17a2b8) 12%, transparent);
}
.ai-wrapper .ai-abort-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: #dc3545;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.ai-wrapper .ai-abort-btn i {
  font-size: 12px;
}
.ai-wrapper .ai-abort-btn:hover {
  background: color-mix(in srgb, #dc3545 85%, #000);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3);
}
.ai-wrapper .ai-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: var(--theme-color, #17a2b8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.ai-wrapper .ai-send-btn i {
  font-size: 12px;
}
.ai-wrapper .ai-send-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-color, #17a2b8) 82%, #000);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--theme-color, #17a2b8) 30%, transparent);
}
.ai-wrapper .ai-send-btn:disabled {
  background: var(--border-color, #dee2e6);
  cursor: not-allowed;
}
.ai-wrapper .ai-disclaimer {
  font-size: 10.5px;
  color: var(--text-muted-color, #9ca3af);
  margin: 0;
  text-align: center;
  line-height: 1.4;
}

@keyframes ai-bounce {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes ai-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
@keyframes ai-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.notetooltip {
  position: relative;
}
.notetooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  background: var(--theme-color, #1e2633);
  color: var(--bs-tooltip-color, #fff);
  font-size: 11px;
  font-weight: 500;
  font-family: "Inter", sans-serif;
  line-height: 1.4;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  z-index: 10001;
  letter-spacing: 0.01em;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.notetooltip:not([class*=notetooltip--])::before, .notetooltip.notetooltip--bottom::before {
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}
.notetooltip:not([class*=notetooltip--]):hover::before, .notetooltip:not([class*=notetooltip--]):focus-visible::before, .notetooltip.notetooltip--bottom:hover::before, .notetooltip.notetooltip--bottom:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.notetooltip--top::before {
  top: auto;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}
.notetooltip--top:hover::before, .notetooltip--top:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.notetooltip--left::before {
  top: 50%;
  left: auto;
  right: calc(100% + 7px);
  transform: translateY(-50%) translateX(-4px);
}
.notetooltip--left:hover::before, .notetooltip--left:focus-visible::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.notetooltip--right::before {
  top: 50%;
  left: calc(100% + 7px);
  transform: translateY(-50%) translateX(4px);
}
.notetooltip--right:hover::before, .notetooltip--right:focus-visible::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.ai-pdf-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ai-pdf-card:hover {
  border-color: var(--theme-color, #17a2b8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.ai-pdf-card--loading {
  background: var(--bg-color, #f8f9fa);
  border-style: dashed;
  border-color: var(--border-color, #cbd5e1);
}
.ai-pdf-card--loading:hover {
  border-color: var(--theme-color, #17a2b8);
  box-shadow: none;
}
.ai-pdf-card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ai-pdf-card__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-color, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.ai-pdf-card__subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted-color, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ai-pdf-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ai-pdf-card .ai-pdf-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.ai-pdf-card .ai-pdf-btn i {
  font-size: 12px;
}
.ai-pdf-card .ai-pdf-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.ai-pdf-card .ai-pdf-btn--view {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.ai-pdf-card .ai-pdf-btn--view:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}
.ai-pdf-card .ai-pdf-btn--download {
  background: var(--theme-color, #17a2b8);
  color: #ffffff;
}
.ai-pdf-card .ai-pdf-btn--download:hover:not(:disabled) {
  background: color-mix(in srgb, var(--theme-color, #17a2b8) 85%, #000);
}
.ai-msg--user .ai-pdf-card {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}
.ai-msg--user .ai-pdf-card .ai-pdf-card__title {
  color: #ffffff;
}
.ai-msg--user .ai-pdf-card .ai-pdf-card__subtitle {
  color: rgba(255, 255, 255, 0.8);
}

.ai-chart-card {
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ai-chart-card:hover {
  border-color: var(--theme-color, #17a2b8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.ai-chart-card--loading {
  background: var(--bg-color, #f8f9fa);
  border-style: dashed;
  border-color: var(--border-color, #cbd5e1);
  padding: 14px;
}
.ai-chart-card--loading:hover {
  border-color: var(--theme-color, #17a2b8);
  box-shadow: none;
}
.ai-chart-card--error {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #c53030;
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 6px;
}
.ai-chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ai-chart-card__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-color, #1e293b);
}
.ai-chart-card__subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted-color, #64748b);
}
.ai-chart-card__body {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color, #cbd5e1) transparent;
}
.ai-chart-card__body::-webkit-scrollbar {
  height: 6px;
}
.ai-chart-card__body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}
.ai-chart-card__body::-webkit-scrollbar-thumb {
  background: var(--border-color, #cbd5e1);
  border-radius: 4px;
}
.ai-chart-card__body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.ai-chart-card__inner {
  position: relative;
  width: 100%;
  min-width: 460px;
  height: 240px;
  min-height: 200px;
}
.ai-msg--user .ai-chart-card {
  background: rgba(255, 255, 255, 0.95);
}

.ai-svg-card {
  position: relative;
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--bg-color, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}
.ai-svg-card:hover {
  border-color: var(--theme-color, #17a2b8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.ai-svg-card:hover .ai-svg-card__extend-btn {
  opacity: 1;
}
.ai-svg-card--loading {
  background: var(--bg-color, #f8f9fa);
  border: 1px dashed var(--border-color, #cbd5e1);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted-color, #64748b);
}
.ai-svg-card--error {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #c53030;
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 6px;
}
.ai-svg-card__extend-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  color: #475569;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  opacity: 0.85;
  transition: all 0.15s ease;
}
.ai-svg-card__extend-btn i {
  font-size: 11px;
}
.ai-svg-card__extend-btn:hover {
  opacity: 1;
  background: #ffffff;
  color: var(--theme-color, #17a2b8);
  border-color: var(--theme-color, #17a2b8);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  transform: scale(1.05);
}
.ai-svg-card__extend-btn:active {
  transform: scale(0.95);
}
.ai-svg-card__body {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
.ai-svg-card__body svg {
  max-width: 100%;
  height: auto;
  display: block;
}
.ai-msg--user .ai-svg-card {
  background: rgba(255, 255, 255, 0.95);
}

.ai-custom-block {
  margin: 8px 0;
}
.ai-custom-block--loading {
  background: var(--bg-color, #f8f9fa);
  border: 1px dashed var(--border-color, #cbd5e1);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted-color, #64748b);
}
.ai-custom-block--svg {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
  background: var(--bg-color, #f8f9fa);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  overflow: hidden;
}
.ai-custom-block--svg svg {
  max-width: 100%;
  height: auto;
}