/* CSS file header */

/* Header button styles */
.ai-assistant-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 14px;
  margin-top: 8px;
  margin-right: 10px;

  border: 1px solid #d1d5db;
  border-radius: 8px;

  background: #ffffff;
  color: #1f2937;

  font-size: 13px;
  font-weight: 600;

  cursor: pointer;

  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.ai-assistant-btn:hover {
  background: #f8fafc;
  border-color: #2563eb;
  color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}

.ai-assistant-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ai-assistant-btn-icon {
  font-size: 13px;
  margin-bottom: 4px;
}

/* Sidebar layout styles */
.ai-assistant-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 28%;
  min-width: 340px;
  max-width: 500px;
  height: 100vh;
  transform: translateX(100%);
  transition: transform 0.3s ease, background 0.2s ease, color 0.2s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.18);
}

.ai-assistant-sidebar.ai-assistant-open {
  transform: translateX(0);
}

@media (max-width: 768px) {
  .ai-assistant-sidebar {
    width: 90%;
    min-width: 0;
  }
}

/* Light theme styles */

.ai-assistant-theme-light {
  background: #ffffff;
  color: #1f2937;
}

.ai-assistant-theme-light .ai-assistant-header {
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.ai-assistant-theme-light .ai-assistant-subtitle {
  color: #6b7280;
}

.ai-assistant-theme-light .ai-assistant-icon-btn {
  color: #4b5563;
  margin-left: 4px;
}

.ai-assistant-theme-light .ai-assistant-icon-btn:hover {
  background: #e5e7eb;
}

.ai-assistant-theme-light .ai-assistant-info-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.ai-assistant-theme-light .ai-assistant-option-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;
}

.ai-assistant-theme-light .ai-assistant-option-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.ai-assistant-theme-light .ai-assistant-option-card.ai-assistant-option-disabled {
  background: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

.ai-assistant-theme-light .ai-assistant-review-row {
  border-bottom: 1px solid #f0f0f0;
}

.ai-assistant-theme-light .ai-assistant-textarea {
  background: #ffffff;
  color: #111111;
  border: 1px solid #d1d5db;
}

/* Dark theme styles */

.ai-assistant-theme-dark {
  background: #1f2937;
  color: #f3f4f6;
}

.ai-assistant-theme-dark .ai-assistant-header {
  background: #111827;
  border-bottom: 1px solid #374151;
}

.ai-assistant-theme-dark .ai-assistant-subtitle {
  color: #9ca3af;
}

.ai-assistant-theme-dark .ai-assistant-icon-btn {
  color: #e5e7eb;
}

.ai-assistant-theme-dark .ai-assistant-icon-btn:hover {
  background: #374151;
}

.ai-assistant-theme-dark .ai-assistant-info-banner {
  background: #1e3a8a;
  border: 1px solid #3b82f6;
  color: #dbeafe;
}

.ai-assistant-theme-dark .ai-assistant-option-card {
  background: #273449;
  border: 1px solid #374151;
  color: #f9fafb;
}

.ai-assistant-theme-dark .ai-assistant-option-card:hover {
  border-color: #60a5fa;
  box-shadow: 0 4px 14px rgba(96, 165, 250, 0.18);
}

.ai-assistant-theme-dark .ai-assistant-option-card.ai-assistant-option-disabled {
  background: #1f2a3a;
  color: #6b7280;
  cursor: not-allowed;
}

.ai-assistant-theme-dark .ai-assistant-review-row {
  border-bottom: 1px solid #374151;
}

.ai-assistant-theme-dark .ai-assistant-textarea {
  background: #111827;
  color: #f3f4f6;
  border: 1px solid #374151;
}

/* Header layout styles */

.ai-assistant-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-assistant-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.ai-assistant-subtitle {
  font-size: 12px;
  margin-top: 2px;
}

.ai-assistant-header-actions {
  display: flex;
  gap: 4px;
}

.ai-assistant-icon-btn {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-assistant-close-x {
  font-size: 22px;
}

/* Body layout styles */

.ai-assistant-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.ai-assistant-section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
}

.ai-assistant-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.ai-assistant-info-banner-icon {
  font-size: 16px;
  line-height: 1.3;
}

/* Option card styles */

.ai-assistant-option-card {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}

.ai-assistant-option-card:hover:not(.ai-assistant-option-disabled) {
  transform: translateY(-1px);
}

.ai-assistant-option-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.ai-assistant-option-card-desc {
  font-size: 12px;
  opacity: 0.75;
}

.ai-assistant-server-card {
  padding: 10px 12px;
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.ai-assistant-theme-dark .ai-assistant-server-card {
  border-color: #34465a;
  background: #17202b;
}

.ai-assistant-server-card-title {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.ai-assistant-server-card-banner {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(120, 120, 120, 0.18);
  color: #475569;
}

.ai-assistant-server-card-banner-readonly {
  background: rgba(217, 119, 6, 0.16);
  color: #92400e;
}

.ai-assistant-theme-dark .ai-assistant-server-card-banner {
  background: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}

.ai-assistant-theme-dark .ai-assistant-server-card-banner-readonly {
  background: rgba(217, 119, 6, 0.28);
  color: #fde68a;
}

/* Browser regression #3: a card whose Partner has been saved/confirmed
   persisted becomes permanently non-interactive -- visually distinct so
   it never looks like it can still be acted on. */
.ai-assistant-card-persisted {
  opacity: 0.88;
}

.ai-assistant-action-disabled {
  cursor: default;
  opacity: 0.55;
  pointer-events: none;
}

/* A request from this exact button is in flight -- visually distinct
   from a permanently-retired (.ai-assistant-action-disabled) button so
   a user can tell "working on it" from "this can never be clicked
   again". */
.ai-assistant-action-pending {
  cursor: progress;
  opacity: 0.7;
}

.ai-assistant-open-partner-link {
  text-decoration: none;
}

/* Card Identity/Navigation Convergence: the small identity/navigation
   header a structured review card (Partner Details, Update Partner,
   Update Partner Contact, Contact Report) carries above its own
   business content -- name/parent Partner + Open Partner, never part of
   the counted field rows below it. */
.ai-assistant-card-identity {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.ai-assistant-card-identity-name {
  font-size: 13px;
  font-weight: 700;
}

.ai-assistant-card-identity-partner {
  font-size: 13px;
}

.ai-assistant-card-identity-label {
  font-weight: 600;
  color: #64748b;
}

.ai-assistant-theme-dark .ai-assistant-card-identity-label {
  color: #94a3b8;
}

/* A Contact/Contact Report review card whose save could not be
   confirmed by readback (`verification_pending`). Never styled like
   `.ai-assistant-card-persisted` (a confirmed save) -- a database
   record may or may not exist yet, so the card is visibly "on hold"
   rather than either fully live or fully done. */
.ai-assistant-card-verification-pending {
  opacity: 0.82;
  border-color: rgba(217, 119, 6, 0.45);
}

.ai-assistant-theme-dark .ai-assistant-card-verification-pending {
  border-color: rgba(217, 119, 6, 0.55);
}

.ai-assistant-verification-pending-status {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(217, 119, 6, 0.16);
  color: #92400e;
}

.ai-assistant-theme-dark .ai-assistant-verification-pending-status {
  background: rgba(217, 119, 6, 0.28);
  color: #fde68a;
}

/* The `verification_pending_actions`/`recovery_actions` card -- offers
   only backend-supplied recovery actions, never a Confirm-and-Save
   control. */
.ai-assistant-lifecycle-actions-card {
  border-color: rgba(217, 119, 6, 0.35);
}

.ai-assistant-server-note {
  color: #667085;
  font-size: 12px;
  margin-bottom: 8px;
}

.ai-assistant-server-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-assistant-server-actions .btn {
  margin: 0;
}

/* Server-driven (V2) review card -- full editable Partner/Contact/Contact
   Report draft. Reuses the same visual language as the older editable
   table (.ai-assistant-tbl-*): section headers, label-above-control rows,
   bordered inputs. See .ai-assistant-result-row/-label/-value for the row
   grid layout itself; the rules below cover what's new here: the section
   spacing, the field input's own look (lost when
   aiAssistantServerFieldRowHtml renames ai-assistant-tbl-input to
   ai-assistant-server-field-input so it never collides with the legacy
   table's own field handlers), and the missing-required inline marker. */

.ai-assistant-chat-bubble-wide {
  max-width: 96%;
  width: 96%;
}

.ai-assistant-chat-bubble-assistant:has(.ai-assistant-review-block),
.ai-assistant-chat-bubble-assistant:has(.ai-assistant-match-options) {
  max-width: 96%;
  width: 96%;
}

.ai-assistant-server-section {
  margin-top: 4px;
}

.ai-assistant-server-section + .ai-assistant-server-section {
  margin-top: 10px;
}

.ai-assistant-server-section .ai-assistant-result-row {
  grid-template-columns: 160px minmax(0, 1fr);
}

.ai-assistant-server-field-input {
  width: 100%;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #cdd1d6;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  color: inherit;
  box-sizing: border-box;
  font-family: inherit;
}

.ai-assistant-server-field-input:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.15);
}

select.ai-assistant-server-field-input {
  min-height: 34px;
}

select.ai-assistant-server-field-input[multiple] {
  min-height: 120px;
  padding: 4px;
}

select.ai-assistant-server-field-input[multiple] option {
  padding: 4px 6px;
}

textarea.ai-assistant-server-field-input {
  resize: vertical;
  min-height: 70px;
}

.ai-assistant-theme-dark .ai-assistant-server-field-input {
  background: #1f2126;
  border-color: #4a4d54;
  color: #e6e6e6;
}

.ai-assistant-server-field-row-missing {
  background: rgba(220, 68, 68, 0.08);
  border-radius: 6px;
  padding-left: 6px;
  padding-right: 6px;
}

.ai-assistant-server-field-row-missing .ai-assistant-server-field-input {
  border-color: #d64545;
}

.ai-assistant-server-field-hint {
  color: #d64545;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.ai-assistant-theme-dark .ai-assistant-server-field-row-missing {
  background: rgba(255, 120, 120, 0.12);
}

.ai-assistant-theme-dark .ai-assistant-server-field-hint {
  color: #ff9b9b;
}

@media (max-width: 480px) {
  .ai-assistant-server-section .ai-assistant-result-row {
    grid-template-columns: 1fr;
  }
}

/* Existing-Partner update review card ("Update Partner") -- read-only
   Current/Proposed pairs, distinct from the editable draft field rows
   above (this card is never directly editable; a change requires a new
   proposal). */
.ai-assistant-update-field-values {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-assistant-update-field-current,
.ai-assistant-update-field-proposed {
  font-size: 13px;
}

.ai-assistant-update-field-current {
  color: #6b7076;
}

.ai-assistant-update-field-proposed {
  color: inherit;
  font-weight: 600;
}

.ai-assistant-update-field-tag {
  font-weight: 400;
  color: #9297a0;
  margin-right: 4px;
}

.ai-assistant-theme-dark .ai-assistant-update-field-current {
  color: #9ba1a8;
}

.ai-assistant-theme-dark .ai-assistant-update-field-tag {
  color: #7d838b;
}

/* Create view styles */

.ai-assistant-textarea {
  width: 100%;
  min-height: 140px;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
}

/* Review view styles */

.ai-assistant-review-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
}

.ai-assistant-review-label {
  font-weight: 600;
  opacity: 0.85;
}

.ai-assistant-review-value {
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.ai-assistant-warning {
  background: #fff8e1;
  border: 1px solid #ffe082;
  padding: 8px 10px;
  margin: 12px 0;
  border-radius: 6px;
  font-size: 13px;
  color: #6d4c00;
}

.ai-assistant-theme-dark .ai-assistant-warning {
  background: #3b2f00;
  border-color: #b58900;
  color: #ffe9a8;
}

/* Shared action rows */
.ai-assistant-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Chat layout styles */

.ai-assistant-body.ai-assistant-chat-mode {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.ai-assistant-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.ai-assistant-chat-row {
  display: flex;
  margin-bottom: 10px;
}

.ai-assistant-chat-row-user {
  justify-content: flex-end;
}

.ai-assistant-chat-row-assistant {
  justify-content: flex-start;
}

.ai-assistant-chat-bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.ai-assistant-chat-bubble-user {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ai-assistant-chat-bubble-assistant {
  border-bottom-left-radius: 4px;
}

.ai-assistant-theme-light .ai-assistant-chat-bubble-assistant {
  background: #f3f4f6;
  color: #111827;
}

.ai-assistant-theme-dark .ai-assistant-chat-bubble-assistant {
  background: #374151;
  color: #f9fafb;
}

/* Chat input styles */

.ai-assistant-chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e7eb;
}

.ai-assistant-theme-dark .ai-assistant-chat-input-bar {
  border-top: 1px solid #374151;
}

.ai-assistant-chat-input {
  flex: 1;
  min-height: 36px;
  max-height: 140px;
  padding: 8px 10px;
  border-radius: 12px;
  resize: none;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  overflow-y: hidden;
}

.ai-assistant-theme-light .ai-assistant-chat-input {
  background: #ffffff;
  color: #111827;
  border: 1px solid #d1d5db;
}

.ai-assistant-theme-dark .ai-assistant-chat-input {
  background: #111827;
  color: #f9fafb;
  border: 1px solid #374151;
}

.ai-assistant-chat-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

.ai-assistant-chat-btn:hover {
  transform: translateY(-1px);
}

.ai-assistant-theme-light .ai-assistant-chat-btn {
  background: #f3f4f6;
  color: #374151;
}

.ai-assistant-theme-dark .ai-assistant-chat-btn {
  background: #374151;
  color: #f9fafb;
}

.ai-assistant-chat-send {
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700;
}

.ai-assistant-chat-send-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

/* Loading animation styles */

.ai-assistant-chat-bubble-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-assistant-chat-loading-text {
  background: linear-gradient(90deg, #9ca3af 0%, #ffffff 50%, #9ca3af 100%);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: aiAssistantShimmer 1.2s linear infinite;
}

@keyframes aiAssistantShimmer {
  0% {
    background-position: 200% center;
  }

  100% {
    background-position: -200% center;
  }
}

.ai-assistant-chat-dots {
  display: inline-flex;
  gap: 3px;
}

.ai-assistant-chat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: aiAssistantDotBounce 1s infinite ease-in-out;
}

.ai-assistant-chat-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-assistant-chat-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes aiAssistantDotBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-4px);
    opacity: 0.9;
  }
}

/* Yes no card */

.ai-assistant-yesno-card {
  border: 1px solid #d6d9de;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 6px 0;
  background: #fbfbfd;
}

.ai-assistant-theme-dark .ai-assistant-yesno-card {
  background: #2a2d33;
  border-color: #3a3d44;
}

.ai-assistant-yesno-question {
  font-weight: 600;
  margin-bottom: 8px;
}

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

.ai-assistant-yesno-actions .btn {
  min-width: 96px;
}

/* Editable review table */

.ai-assistant-tbl-card {
  border: 1px solid #d6d9de;
  border-radius: 8px;
  padding: 12px;
  margin: 6px 0;
  background: #ffffff;
}

.ai-assistant-theme-dark .ai-assistant-tbl-card {
  background: #2a2d33;
  border-color: #3a3d44;
  color: #e6e6e6;
}

.ai-assistant-tbl-header {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 14px;
}

.ai-assistant-tbl-section-title,
.ai-assistant-review-section-title,
.ai-assistant-result-section-title,
.ai-assistant-clar-section-title {
  color: #30363d;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 12px 0 6px;
}

.ai-assistant-theme-dark .ai-assistant-tbl-section-title,
.ai-assistant-theme-dark .ai-assistant-review-section-title,
.ai-assistant-theme-dark .ai-assistant-result-section-title,
.ai-assistant-theme-dark .ai-assistant-clar-section-title {
  color: #d8dee9;
}

.ai-assistant-tbl-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid #eef0f3;
}

.ai-assistant-theme-dark .ai-assistant-tbl-row {
  border-top-color: #3a3d44;
}

.ai-assistant-tbl-row:first-of-type {
  border-top: none;
}

.ai-assistant-tbl-label {
  font-size: 12px;
  color: #6b7079;
  font-weight: 600;
}

.ai-assistant-theme-dark .ai-assistant-tbl-label {
  color: #aab0ba;
}

.ai-assistant-tbl-value {
  width: 100%;
}

.ai-assistant-tbl-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cdd1d6;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  color: inherit;
  box-sizing: border-box;
}

.ai-assistant-tbl-input:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.15);
}

.ai-assistant-theme-dark .ai-assistant-tbl-input {
  background: #1f2126;
  border-color: #4a4d54;
  color: #e6e6e6;
}

.ai-assistant-tbl-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.ai-assistant-tbl-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid #eef0f3;
  padding-top: 12px;
}

.ai-assistant-theme-dark .ai-assistant-tbl-actions {
  border-top-color: #3a3d44;
}

/* Clarification card styles */

.ai-assistant-clar-card {
  border: 1px solid #cdd1d6;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 4px 0;
  background: #fffaf2;
}

.ai-assistant-theme-dark .ai-assistant-clar-card {
  background: #2e2a22;
  border-color: #4a4338;
  color: #e6e6e6;
}

.ai-assistant-clar-header {
  font-weight: 600;
  margin-bottom: 6px;
}

.ai-assistant-clar-row {
  padding: 2px 0;
  font-size: 13px;
}

.ai-assistant-clar-label {
  color: #6b7079;
  font-weight: 600;
}

.ai-assistant-theme-dark .ai-assistant-clar-label {
  color: #aab0ba;
}

.ai-assistant-clar-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ai-assistant-clar-actions .btn {
  min-width: 96px;
}

/* Result card styles */

.ai-assistant-result-card {
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 120, 120, 0.25);
  background: rgba(255, 255, 255, 0.92);
}

.ai-assistant-theme-dark .ai-assistant-result-card {
  background: rgba(35, 35, 35, 0.92);
  border-color: rgba(255, 255, 255, 0.16);
}

.ai-assistant-result-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.ai-assistant-partner-link {
  font-weight: 700;
  text-decoration: none;
}

.ai-assistant-partner-link:hover {
  text-decoration: underline;
}

.ai-assistant-result-row {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid rgba(120, 120, 120, 0.18);
}

.ai-assistant-result-row:first-of-type {
  border-top: 0;
}

.ai-assistant-result-row-highlight {
  background: rgba(255, 220, 120, 0.16);
  border-radius: 8px;
  padding-left: 6px;
  padding-right: 6px;
}

.ai-assistant-result-label {
  font-weight: 600;
  opacity: 0.78;
}

.ai-assistant-result-value {
  word-break: break-word;
}

.ai-assistant-muted {
  opacity: 0.7;
  font-size: 13px;
  margin: 6px 0;
}

.ai-assistant-suggestions-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.ai-assistant-suggestion-chip {
  border: 1px solid rgba(120, 120, 120, 0.28);
  border-radius: 16px;
  background: transparent;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.ai-assistant-suggestion-chip:hover {
  background: rgba(120, 120, 120, 0.12);
}

.ai-assistant-suggestion-btn {
  text-align: left;
  border: 1px solid rgba(120, 120, 120, 0.25);
  border-radius: 10px;
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
}

.ai-assistant-suggestion-btn:hover {
  background: rgba(120, 120, 120, 0.12);
}

.ai-assistant-match-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-assistant-match-row .ai-assistant-suggestion-btn {
  flex: 1 1 auto;
}

.ai-assistant-match-open-link {
  flex: 0 0 auto;
  font-size: 12px;
}

/* Legacy compatibility cards */

.ai-assistant-details-card,
.ai-assistant-matches-card,
.ai-assistant-filter-card,
.ai-assistant-proposal-card {
  border: 1px solid #d6d9de;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 4px 0;
  background: #ffffff;
}

.ai-assistant-theme-dark .ai-assistant-details-card,
.ai-assistant-theme-dark .ai-assistant-matches-card,
.ai-assistant-theme-dark .ai-assistant-filter-card {
  background: #2a2d33;
  border-color: #3a3d44;
  color: #e6e6e6;
}

.ai-assistant-details-header,
.ai-assistant-matches-header,
.ai-assistant-filter-header,
.ai-assistant-proposal-header {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.ai-assistant-details-row,
.ai-assistant-filter-row,
.ai-assistant-proposal-row {
  padding: 3px 0;
  font-size: 13px;
  border-radius: 4px;
}

.ai-assistant-details-row.highlight {
  background: #fff7d6;
  padding: 3px 6px;
}

.ai-assistant-theme-dark .ai-assistant-details-row.highlight {
  background: #4a3e1a;
}

.ai-assistant-details-label,
.ai-assistant-proposal-label {
  color: #6b7079;
  font-weight: 600;
}

.ai-assistant-theme-dark .ai-assistant-details-label,
.ai-assistant-theme-dark .ai-assistant-proposal-label {
  color: #aab0ba;
}

.ai-assistant-matches-card {
  background: #fbfbfd;
}

.ai-assistant-theme-dark .ai-assistant-matches-card {
  background: #2a2d33;
  border-color: #3a3d44;
}

.ai-assistant-matches-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-assistant-match-btn,
.ai-assistant-value-suggestion-btn {
  margin: 0;
}

.ai-assistant-filter-row {
  border-top: 1px solid #eef0f3;
}

.ai-assistant-theme-dark .ai-assistant-filter-row {
  border-top-color: #3a3d44;
}

.ai-assistant-filter-row:first-of-type {
  border-top: none;
}

.ai-assistant-filter-sub {
  color: #6b7079;
  font-size: 12px;
}

.ai-assistant-theme-dark .ai-assistant-filter-sub {
  color: #aab0ba;
}

.ai-assistant-proposal-card {
  padding: 12px;
  margin: 6px 0;
  background: #f4faff;
  border-color: #cdd1d6;
}

.ai-assistant-theme-dark .ai-assistant-proposal-card {
  background: #1f2a35;
  border-color: #34465a;
  color: #e6e6e6;
}

.ai-assistant-proposal-preview {
  font-style: italic;
  margin-bottom: 8px;
  font-size: 13px;
}

.ai-assistant-proposal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid #dde2e8;
  padding-top: 10px;
  flex-wrap: wrap;
}

.ai-assistant-theme-dark .ai-assistant-proposal-actions {
  border-top-color: #34465a;
}

/* Partner Additional Contact child-object cards */

.ai-assistant-contact-parent,
.ai-assistant-contact-parent-block,
.ai-assistant-contact-existing-context {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(120, 120, 120, 0.22);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.06);
}

.ai-assistant-contact-derived-row {
  background: rgba(120, 120, 120, 0.07);
  padding-left: 6px;
  padding-right: 6px;
}

.ai-assistant-contact-matches-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-assistant-contact-card {
  padding: 10px 12px;
}

.ai-assistant-contact-summary .ai-assistant-result-row,
.ai-assistant-contact-details .ai-assistant-result-row,
.ai-assistant-contact-draft-summary .ai-assistant-result-row {
  grid-template-columns: 120px 1fr;
  padding: 5px 0;
}

.ai-assistant-contact-details[hidden] {
  display: none;
}

.ai-assistant-contact-details {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(120, 120, 120, 0.22);
}

.ai-assistant-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-assistant-contact-actions .btn {
  margin: 0;
}

.ai-assistant-contact-draft-summary {
  margin-bottom: 8px;
}

.ai-assistant-contact-pending-question {
  margin: 8px 0 10px;
  padding: 9px 10px;
  border-left: 3px solid #d97706;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.1);
  font-weight: 600;
}

.ai-assistant-object-matches {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ai-assistant-object-match-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  white-space: normal;
  text-align: left;
}

.ai-assistant-object-match-kind {
  margin-top: 2px;
  font-size: 11px;
  opacity: 0.75;
}

.ai-assistant-contact-match-btn {
  text-align: left;
  white-space: normal;
}

.ai-assistant-contact-current {
  margin-bottom: 5px;
  font-size: 12px;
  opacity: 0.78;
}

.ai-assistant-contact-proposed-label {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
}

.ai-assistant-contact-draft-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #cfd4dc;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
}

textarea.ai-assistant-contact-draft-input {
  min-height: 84px;
  resize: vertical;
}

.ai-assistant-theme-dark .ai-assistant-contact-draft-input {
  border-color: #4b5563;
  background: #111827;
  color: #f3f4f6;
}

.ai-assistant-theme-dark .ai-assistant-contact-parent,
.ai-assistant-theme-dark .ai-assistant-contact-parent-block,
.ai-assistant-theme-dark .ai-assistant-contact-existing-context {
  border-color: #3f526b;
  background: rgba(59, 130, 246, 0.12);
}

/* Voice dictation styles */

/* Listening mic button */
.ai-assistant-chat-btn.ai-assistant-mic-listening {
  background: #ef4444 !important;
  color: #ffffff !important;
  position: relative;
}

.ai-assistant-chat-btn.ai-assistant-mic-listening::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid rgba(239, 68, 68, 0.6);
  animation: aiAssistantMicPulse 1.2s ease-out infinite;
  pointer-events: none;
}

@keyframes aiAssistantMicPulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Voice status row */
.ai-assistant-voice-status {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.ai-assistant-voice-status.ai-assistant-voice-status-visible {
  display: flex;
}

/* Recording dot indicator */
.ai-assistant-voice-status.ai-assistant-voice-status-listening::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  animation: aiAssistantRecBlink 1s ease-in-out infinite;
}

@keyframes aiAssistantRecBlink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

/* Voice status colors */
.ai-assistant-theme-light .ai-assistant-voice-status-listening {
  color: #b91c1c;
}

.ai-assistant-theme-dark .ai-assistant-voice-status-listening {
  color: #fca5a5;
}

.ai-assistant-theme-light .ai-assistant-voice-status-processing {
  color: #1d4ed8;
}

.ai-assistant-theme-dark .ai-assistant-voice-status-processing {
  color: #93c5fd;
}

.ai-assistant-theme-light .ai-assistant-voice-status-error {
  color: #92400e;
}

.ai-assistant-theme-dark .ai-assistant-voice-status-error {
  color: #fcd34d;
}

/* Voice mode toggle */

.ai-assistant-voice-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 17px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-assistant-theme-light .ai-assistant-voice-mode-btn {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.ai-assistant-theme-light .ai-assistant-voice-mode-btn:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.ai-assistant-theme-dark .ai-assistant-voice-mode-btn {
  background: #374151;
  color: #e5e7eb;
  border-color: #4b5563;
}

.ai-assistant-theme-dark .ai-assistant-voice-mode-btn:hover {
  border-color: #60a5fa;
  color: #bfdbfe;
}

/* Status dot button */
.ai-assistant-voice-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  flex: 0 0 auto;
}

/* Active voice state */
.ai-assistant-voice-mode-btn.ai-assistant-voice-mode-on {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.ai-assistant-theme-dark .ai-assistant-voice-mode-btn.ai-assistant-voice-mode-on {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}

.ai-assistant-voice-mode-btn.ai-assistant-voice-mode-on:hover {
  color: #ffffff;
}

/* On air dot */
.ai-assistant-voice-mode-btn.ai-assistant-voice-mode-on .ai-assistant-voice-mode-dot {
  background: #ffffff;
  opacity: 1;
  animation: aiAssistantVoiceModePulse 1.2s ease-in-out infinite;
}
.ai-assistant-selected-summary {
    font-size: 12px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.ai-assistant-tbl-select {
    width: 100%;
    min-height: 34px;
}

.ai-assistant-tbl-multiselect {
    width: 100%;
    min-height: 120px;
    padding: 4px;
}

.ai-assistant-tbl-multiselect option {
    padding: 4px 6px;
}
@keyframes aiAssistantVoiceModePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.7);
  }
}

/* ---------------------------------------------------------------------
   Structured assistant choice buttons -- ONE reused rendering component
   for every structured choice payload the backend already emits
   (`resolution_actions` ui_blocks, `pendingQuestion.options`). Never
   generated from parsed assistant_message text. Colors are hardcoded
   per light/dark selector, matching this file's existing convention
   (`.ai-assistant-theme-dark .ai-assistant-*` overrides) -- there are no
   `:root` custom properties defined anywhere in this stylesheet to reuse
   instead.
   ------------------------------------------------------------------ */

/* Workflow-action choices (2-5 stacked full-width buttons) -- e.g. "Use
   Taylor Jones" / "Create under AARP" / "Search AARP Contacts" /
   "Change Partner" / "Cancel". */
.ai-assistant-choice-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-width: 100%;
}

.ai-assistant-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(120, 120, 120, 0.28);
  background: rgba(255, 255, 255, 0.94);
  color: inherit;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  min-height: 40px;
}

.ai-assistant-choice-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.ai-assistant-choice-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.ai-assistant-choice-btn:active:not(:disabled) {
  transform: translateY(0);
  background: rgba(37, 99, 235, 0.08);
}

.ai-assistant-choice-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.ai-assistant-choice-btn-title {
  display: block;
}

.ai-assistant-choice-btn-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 400;
  opacity: 0.72;
}

/* The suggested/primary action, when the backend identifies one. */
.ai-assistant-choice-btn-primary {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(37, 99, 235, 0.08);
}

.ai-assistant-choice-btn-primary:hover:not(:disabled) {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.14);
}

/* Cancel / destructive / secondary -- visually subdued. */
.ai-assistant-choice-btn-muted {
  opacity: 0.78;
  font-weight: 500;
}

.ai-assistant-choice-btn-selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.14);
}

.ai-assistant-choice-group-pending .ai-assistant-choice-btn:not(.ai-assistant-choice-btn-selected) {
  opacity: 0.5;
}

/* Structured Choice / Match Selection UI Convergence: real matched
   entities (Partner/Contact search results) rendered as compact,
   scannable rows -- NOT one full-width button per result the way an
   ordinary workflow choice renders. Reuses `.ai-assistant-choice-btn`'s
   own base (border/hover/focus/disabled/selected states, retirement
   opacity) via the SAME class; this only overrides layout/density. */
.ai-assistant-result-row-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-assistant-result-row-group-scroll {
  max-height: 230px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.ai-assistant-choice-btn-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  min-height: 0;
}

.ai-assistant-choice-btn-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ai-assistant-choice-btn-row .ai-assistant-choice-btn-subtitle {
  margin-top: 1px;
}

.ai-assistant-choice-btn-chevron {
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
  opacity: 0.4;
}

/* The Create/Search-again/Cancel commands below a matched-entity row
   group -- visually distinct (smaller, less prominent) from the result
   rows above them, per the same `.ai-assistant-choice-btn` base. */
.ai-assistant-choice-secondary-label {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.5;
}

.ai-assistant-choice-command-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-assistant-choice-command-group .ai-assistant-choice-btn {
  padding: 7px 12px;
  min-height: 0;
  font-size: 12.5px;
}

.ai-assistant-theme-dark .ai-assistant-choice-btn-chevron {
  opacity: 0.5;
}

/* Compact chip-style choices -- select-field pendingQuestion answers
   (Partner Status, Grantor/Grantee, Yes/No, ...) up to ~6 options: a
   responsive wrapped row, since these are VALUES, not workflow actions,
   and don't need one enormous full-width button each. */
.ai-assistant-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  max-width: 100%;
}

.ai-assistant-chip-btn {
  box-sizing: border-box;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(120, 120, 120, 0.28);
  background: rgba(255, 255, 255, 0.94);
  color: inherit;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.ai-assistant-chip-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.ai-assistant-chip-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.ai-assistant-chip-btn:active:not(:disabled) {
  transform: translateY(0);
  background: rgba(37, 99, 235, 0.1);
}

.ai-assistant-chip-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.ai-assistant-chip-btn-selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.16);
}

/* Many-option select-field answers (more than ~6, e.g. Contact Person
   Type) -- a responsive grid instead of one long wrapped row, so the
   sidebar never overflows horizontally regardless of option count. */
.ai-assistant-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 10px;
  max-width: 100%;
}

.ai-assistant-chip-grid .ai-assistant-chip-btn {
  width: 100%;
}

.ai-assistant-theme-dark .ai-assistant-choice-btn,
.ai-assistant-theme-dark .ai-assistant-chip-btn {
  border-color: #34465a;
  background: #17202b;
  color: #e2e8f0;
}

.ai-assistant-theme-dark .ai-assistant-choice-btn:hover:not(:disabled),
.ai-assistant-theme-dark .ai-assistant-chip-btn:hover:not(:disabled) {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.ai-assistant-theme-dark .ai-assistant-choice-btn-primary {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.18);
}

.ai-assistant-theme-dark .ai-assistant-choice-btn-primary:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.26);
}

.ai-assistant-theme-dark .ai-assistant-choice-btn-selected,
.ai-assistant-theme-dark .ai-assistant-chip-btn-selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.26);
}

/* Multiselect pending-question block (Partner Interest, or any future
   schema-driven `expectedEntityType: "multiselect"` field) -- wraps the
   SAME chip-group/chip-grid choices above with a Continue button; a
   click on a chip toggles it (see the checkmark below), nothing is sent
   until Continue. Reuses `.ai-assistant-choice-btn`/`.ai-assistant-chip-
   btn`'s own styling entirely -- only the container layout and the
   selected-chip checkmark are new here. */
.ai-assistant-multiselect-block {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  max-width: 100%;
}

.ai-assistant-multiselect-block .ai-assistant-chip-group,
.ai-assistant-multiselect-block .ai-assistant-chip-grid {
  margin-top: 0;
}

.ai-assistant-multiselect-continue-btn {
  margin-top: 10px;
  align-self: flex-start;
}

.ai-assistant-multiselect-block .ai-assistant-chip-btn-selected::before {
  content: "\2713 ";
}

.ai-assistant-multiselect-block.ai-assistant-choice-group-pending .ai-assistant-chip-btn:not(.ai-assistant-chip-btn-selected) {
  opacity: 0.5;
}
