.floating-tools-shell {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 3200;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.floating-tool-draggable {
  will-change: transform;
}

.floating-tool-draggable.is-dragging {
  z-index: 6;
}

[data-floating-tool-drag-handle] {
  touch-action: none;
}

.floating-tool-draggable:not(.is-dragging) [data-floating-tool-drag-handle] {
  cursor: grab !important;
}

.floating-tool-draggable.is-dragging [data-floating-tool-drag-handle] {
  cursor: grabbing !important;
  user-select: none;
}

.ai-assistant-shell {
  position: relative;
  z-index: 1;
}

.ai-assistant-toggle {
  border: 0;
  border-radius: 999px;
  min-height: 40px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.82), rgba(37, 99, 235, 0.78));
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.ai-assistant-toggle:hover,
.ai-assistant-toggle:focus-visible {
  background: linear-gradient(135deg, #0f172a, #2563eb);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.22);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.ai-assistant-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(420px, calc(100vw - 32px));
  max-height: min(78vh, 760px);
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
  display: none;
  overflow: hidden;
}

.ai-assistant-panel.is-open {
  display: flex;
  flex-direction: column;
}

.ai-assistant-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, #eff6ff, #ffffff);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-assistant-header-copy {
  min-width: 0;
}

.ai-assistant-minimize {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.88);
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.ai-assistant-minimize:hover,
.ai-assistant-minimize:focus-visible {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.32);
}

.ai-assistant-body {
  padding: 16px 18px;
  overflow: auto;
}

.ai-assistant-output {
  min-height: 180px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 14px;
  line-height: 1.55;
  color: #0f172a;
}

.ai-rich-text {
  font-size: 14px;
}

.ai-rich-text h1,
.ai-rich-text h2,
.ai-rich-text h3,
.ai-rich-text h4 {
  margin: 0 0 10px;
  color: #0f172a;
  line-height: 1.3;
}

.ai-rich-text h1 {
  font-size: 22px;
}

.ai-rich-text h2 {
  font-size: 18px;
}

.ai-rich-text h3 {
  font-size: 16px;
}

.ai-rich-text h4 {
  font-size: 14px;
}

.ai-rich-text p {
  margin: 0 0 10px;
}

.ai-rich-text ul,
.ai-rich-text ol {
  margin: 0 0 12px 18px;
  padding: 0;
}

.ai-rich-text li {
  margin-bottom: 6px;
}

.ai-rich-text hr {
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  margin: 14px 0;
}

.ai-rich-text code {
  background: rgba(15, 23, 42, 0.06);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
}

.ai-rich-text a {
  color: #1d4ed8;
  text-decoration: underline;
}

.ai-rich-text-table-wrap {
  overflow-x: auto;
  margin: 0 0 14px;
}

.ai-rich-text-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  overflow: hidden;
}

.ai-rich-text-table th,
.ai-rich-text-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.ai-rich-text-table th {
  background: #eaf2ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ai-rich-text-table tr:last-child td {
  border-bottom: 0;
}

.ai-assistant-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-assistant-chip {
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: #fff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.ai-assistant-chip:hover {
  background: #eff6ff;
}

.ai-module-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .floating-tools-shell {
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .floating-tool-draggable {
    will-change: auto;
    transform: none !important;
  }

  .ai-assistant-panel {
    width: min(420px, calc(100vw - 32px));
  }

  .ai-assistant-toggle {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 0.76rem;
  }
}
