/* Shared Agent / Ask chat composer (matches Agent dialog design) */

.ag-composer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ag-composer--initial {
  padding: 10px 12px 0;
}

.ag-composer--sticky {
  padding: 8px 12px 10px;
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.ag-composer-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.ag-composer-card {
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  /* visible so mode dropdown + focus rings are not clipped (was overflow:hidden) */
  overflow: visible;
}

.ag-composer-card--followup {
  background: #fafafa;
}

.ag-composer-card--drag {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
  background: #f8fafc;
}

.ag-attachment-chip {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.35);
}

.ag-playbook-chip {
  background: #f0fdf4;
  border-color: rgba(34, 197, 94, 0.35);
  color: #166534;
}

.ag-icon-ghost--active {
  color: #16a34a;
  background: rgba(34, 197, 94, 0.08);
}

.ag-image-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
}

.ag-image-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 11px;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  cursor: pointer;
}

.ag-image-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.ag-composer-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  border: none;
  padding: 10px 12px 6px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.45;
  color: #111827;
  background: transparent;
  outline: none;
  min-height: 40px;
  border-radius: 11px 11px 0 0;
}

.ag-composer-textarea::placeholder {
  color: #9ca3af;
}

.ag-composer-textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ag-composer-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px 8px 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fafafa;
  border-radius: 0 0 11px 11px;
}

.ag-composer-toolbar-hint-row {
  width: 100%;
  padding: 0 2px;
}

.ag-composer-toolbar-hint {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.4;
}

.ag-composer-toolbar-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.ag-composer-toolbar-mode {
  flex-shrink: 0;
  min-width: 0;
}

.ag-composer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Pill + chevron dropdown (similar to IDE Plan / Debug mode controls) */
.ag-mode-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 2;
}

.ag-mode-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #374151;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ag-mode-dropdown[data-open='true'] .ag-mode-dropdown-trigger {
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ag-mode-dropdown-trigger:hover:not(:disabled) {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.16);
}

.ag-mode-dropdown-trigger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ag-mode-dropdown-icon {
  flex-shrink: 0;
  color: #6b7280;
}

.ag-mode-dropdown-label {
  flex-shrink: 0;
}

.ag-mode-dropdown-chevron {
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.ag-mode-dropdown-chevron--open {
  transform: rotate(180deg);
}

.ag-mode-dropdown-menu {
  position: absolute;
  left: 0;
  z-index: 5000;
  min-width: 220px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
}

/* First message (composer at top): open into the main content area */
.ag-mode-dropdown--placement-down .ag-mode-dropdown-menu {
  top: calc(100% + 8px);
  bottom: auto;
}

/* Follow-up (sticky composer at bottom): open above so it is not clipped */
.ag-mode-dropdown--placement-up .ag-mode-dropdown-menu {
  bottom: calc(100% + 8px);
  top: auto;
}

.ag-mode-dropdown-menu li {
  margin: 0;
}

.ag-mode-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  font: inherit;
  color: #374151;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.ag-mode-dropdown-item:hover {
  background: #f3f4f6;
}

.ag-mode-dropdown-item > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ag-mode-dropdown-item .ag-mode-dropdown-item-title {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}

.ag-mode-dropdown-item .ag-mode-dropdown-item-desc {
  font-size: 11px;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.35;
}

.ag-mode-dropdown-item svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #6b7280;
}

.ag-mode-dropdown-item--active {
  background: #f3f4f6;
}

.ag-mode-dropdown-item--active .ag-mode-dropdown-item-title {
  color: #0f172a;
}

.ag-icon-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.ag-icon-ghost:hover:not(:disabled) {
  color: #374151;
  background: rgba(0, 0, 0, 0.05);
}

.ag-icon-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ag-send-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  background: #e5e7eb;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s;
}

.ag-send-circle:hover:not(:disabled) {
  background: #d1d5db;
  border-color: rgba(0, 0, 0, 0.1);
}

.ag-send-circle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ag-send-icon {
  flex-shrink: 0;
}

.ag-hidden-file {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.ag-kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
  font-weight: 600;
  color: #6b7280;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.spinning {
  animation: chat-composer-spin 0.9s linear infinite;
}

@keyframes chat-composer-spin {
  to {
    transform: rotate(360deg);
  }
}

.editor-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
}

/* Single scrollable main: selection → (after Polish / send) suggested edit */
.editor-main-area {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-main-error {
  flex-shrink: 0;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.editor-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.editor-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.editor-panel-dismiss {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #9ca3af;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.editor-panel-dismiss:hover {
  color: #374151;
  background: rgba(0, 0, 0, 0.05);
}

.editor-panel-header--streaming {
  align-items: flex-start;
}

.editor-panel-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.editor-generating-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
}

.spinner--inline {
  width: 14px;
  height: 14px;
  border-width: 2px;
  flex-shrink: 0;
}

.editor-streaming-card {
  transition: border-color 0.2s ease;
}

.editor-streaming-output {
  white-space: pre-wrap;
  word-break: break-word;
}

.editor-panel-card {
  margin-top: 0;
}

/* Request + summary — one panel below Replace / icon row */
.editor-suggested-meta {
  margin-top: 10px;
  padding: 10px 12px;
  background: linear-gradient(to bottom, #f9fafb 0%, #f3f4f6 100%);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-suggested-meta .editor-suggested-request,
.editor-suggested-meta .editor-suggested-summary {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-suggested-meta .editor-suggested-summary {
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.editor-suggested-explanation-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

.editor-suggested-explanation-value {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  color: #374151;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* AskMarkdown inside Summary — compact panel typography */
.editor-suggested-summary-md {
  margin-top: 2px;
}

.editor-suggested-summary-md .ask-markdown-content {
  white-space: normal;
  font-size: 12px;
  line-height: 1.55;
  color: #1f2937;
}

.editor-suggested-summary-md .ask-markdown-content p {
  margin: 0 0 8px;
}

.editor-suggested-summary-md .ask-markdown-content p:last-child {
  margin-bottom: 0;
}

.editor-suggested-summary-md .ask-markdown-content h1,
.editor-suggested-summary-md .ask-markdown-content h2,
.editor-suggested-summary-md .ask-markdown-content h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 10px 0 6px;
  color: #374151;
}

.editor-suggested-summary-md .ask-markdown-content h1:first-child,
.editor-suggested-summary-md .ask-markdown-content h2:first-child,
.editor-suggested-summary-md .ask-markdown-content h3:first-child {
  margin-top: 0;
}

.editor-suggested-summary-md .ask-markdown-content ul,
.editor-suggested-summary-md .ask-markdown-content ol {
  margin: 4px 0 8px;
  padding-inline-start: 1.25em;
}

.editor-suggested-summary-md .ask-markdown-content li {
  margin-bottom: 4px;
}

.editor-suggested-summary-md .ask-markdown-content strong {
  font-weight: 700;
  color: #111827;
}

.editor-suggested-summary-md .ask-markdown-content em {
  font-style: italic;
  color: #4b5563;
}

.editor-suggested-summary-md .ask-markdown-content code {
  font-size: 11px;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
}

.editor-suggested-summary-md .ask-markdown-content blockquote {
  margin: 6px 0;
  padding: 6px 10px;
  border-inline-start: 3px solid #e5e7eb;
  color: #4b5563;
  font-size: 11px;
}

.editor-suggested-summary-md .ask-markdown-content.rtl {
  direction: rtl;
  text-align: right;
}

.editor-suggested-summary-md .ask-markdown-content.ltr {
  direction: ltr;
  text-align: left;
}

.selected-text-full {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: #374151;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.selected-text-xml {
  width: 100%;
  line-height: 1.6;
  color: #374151;
}

/* Track changes styling in selected text */
.selected-text-xml del.track-change-deletion,
.selected-text-xml .track-change-deletion {
  text-decoration: line-through !important;
  text-decoration-color: #dc2626 !important;
  text-decoration-thickness: 2px !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

.selected-text-xml ins.track-change-insertion,
.selected-text-xml .track-change-insertion {
  text-decoration: none !important;
  border-bottom: 2px solid #dc2626 !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

/* Newly generated redlines - blue background highlight (only for track-change-new class) */
/* This matches the styling used in ClauseCard for playbook suggestions */
.selected-text-xml del.track-change-deletion.track-change-new,
.selected-text-xml .track-change-deletion.track-change-new {
  text-decoration: line-through !important;
  text-decoration-color: #2563eb !important;
  text-decoration-thickness: 2px !important;
  color: #1e40af !important;
  background-color: #dbeafe !important;
  padding: 2px 0 !important;
  display: inline !important;
}

.selected-text-xml ins.track-change-insertion.track-change-new,
.selected-text-xml .track-change-insertion.track-change-new {
  text-decoration: none !important;
  border-bottom: 2px solid #2563eb !important;
  color: #1e40af !important;
  background-color: #dbeafe !important;
  padding: 2px 0 !important;
  display: inline !important;
}

.selected-text-plain {
  width: 100%;
}

/* Quick Actions - Moved to bottom near chat input */
.quick-actions-bottom {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  overflow-x: auto;
  margin-top: 0;
}

.quick-action-btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.quick-action-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #3b82f6;
  color: #3b82f6;
}

.quick-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bottom composer (ChatComposer — matches Agent / Ask) */
.editor-chat-area {
  flex-shrink: 0;
  background: #ffffff;
}

.processing-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: #6b7280;
}

.streaming-state {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.streaming-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  background: #f9fafb;
  border-radius: 8px;
}

.streaming-text {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #111827;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 60px;
  max-height: 400px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease-in;
  position: relative;
  /* Ensure text is always visible */
  visibility: visible;
  opacity: 1;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
}

.error-icon {
  font-size: 18px;
}

.editor-panel--result .selected-text-full {
  max-height: none;
  overflow: visible;
}

.result-text {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #111827;
  max-height: 400px;
  overflow-y: auto;
}


.track-changes-preview {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #111827;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Track changes HTML display from OOXML */
.track-changes-html-display {
  width: 100%;
  line-height: 1.6;
}

.track-changes-html-display ins.track-change-insert {
  text-decoration: underline !important;
  text-decoration-color: #dc2626 !important;
  text-decoration-thickness: 2px !important;
  color: #dc2626 !important;
  background-color: transparent;
  border-bottom: 2px solid #dc2626;
  text-decoration: none !important; /* Use border instead */
}

.track-changes-html-display del.track-change-delete {
  text-decoration: line-through !important;
  text-decoration-color: #dc2626 !important;
  text-decoration-thickness: 2px !important;
  color: #dc2626 !important;
  background-color: transparent;
}

/* Suggested edit row — aligned with Proofread language issue actions */
.editor-suggested-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.editor-replace-btn {
  appearance: none;
  -webkit-appearance: none;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s;
  height: 26px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.editor-replace-btn:hover {
  background: #2563eb;
}

.editor-icon-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  box-sizing: border-box;
  padding: 0;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  color: #6b7280;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.editor-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #374151;
  border-color: rgba(0, 0, 0, 0.2);
}

.editor-icon-btn.editor-ignore-btn:hover {
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6b7280;
  padding: 48px 16px;
  min-height: 200px;
}

.empty-state .empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
  color: #6b7280;
  stroke-width: 1.5;
}

.empty-state p {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 4px;
}

.example-text {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  margin-top: 8px;
}

/* Responsive adjustments */
@media (max-width: 360px) {
  .quick-action-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .editor-main-area {
    padding: 10px 12px 6px;
  }
}


.ask-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #ffffff;
}

/* ── Messages list ──────────────────────────────────── */
.ask-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Empty state ────────────────────────────────────── */
.ask-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 12px;
  color: #6b7280;
  font-size: 13px;
}
.ask-empty-icon { opacity: 0.35; margin-bottom: 10px; color: #9ca3af; }
.ask-empty-hint { font-size: 12px; font-style: italic; color: #9ca3af; margin-top: 6px; }

.ask-empty-loading {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.ask-empty-error {
  margin: 0;
  color: #b45309;
  font-size: 13px;
  line-height: 1.45;
  max-width: 280px;
}

/* ── Bubbles ────────────────────────────────────────── */
.ask-bubble {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}
/* User: right-aligned, blue — distinct from assistant on the left */
.ask-bubble-user {
  align-self: flex-end;
  background: #dbeafe;
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: #1e3a8a;
}

.ask-bubble-user .ask-bubble-role {
  color: #2563eb;
  opacity: 0.9;
}

/* Assistant: left-aligned, neutral gray */
.ask-bubble-assistant {
  align-self: flex-start;
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #1f2937;
}

.ask-bubble-assistant .ask-bubble-role {
  color: #6b7280;
  opacity: 1;
}

.ask-bubble-role {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.ask-bubble-content {
  white-space: pre-wrap;
  word-break: break-word;
}

/* RTL / LTR alignment helpers on user bubbles */
.ask-bubble-user .ask-bubble-content[dir="rtl"] { text-align: right; }
.ask-bubble-user .ask-bubble-content[dir="ltr"] { text-align: left; }

/* ── Markdown inside assistant bubbles ──────────────── */
.ask-markdown-content { white-space: normal; }

.ask-markdown-content p            { margin: 0 0 8px; line-height: 1.6; }
.ask-markdown-content p:last-child { margin-bottom: 0; }

.ask-markdown-content h1,
.ask-markdown-content h2,
.ask-markdown-content h3,
.ask-markdown-content h4,
.ask-markdown-content h5,
.ask-markdown-content h6 {
  font-weight: 700;
  margin: 12px 0 6px;
  line-height: 1.3;
  color: #111827;
}
.ask-markdown-content h1 { font-size: 15px; }
.ask-markdown-content h2 { font-size: 14px; }
.ask-markdown-content h3 { font-size: 13px; }

.ask-markdown-content ul,
.ask-markdown-content ol {
  margin: 4px 0 8px;
  padding-left: 18px;
  padding-right: 0;
}
.ask-markdown-content li { margin-bottom: 4px; line-height: 1.55; }
.ask-markdown-content li p { margin-bottom: 4px; }

.ask-markdown-content strong { font-weight: 700; color: #111827; }
.ask-markdown-content em     { font-style: italic; }

.ask-markdown-content code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
}
.ask-markdown-content pre {
  background: rgba(0,0,0,0.06);
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 11px;
  line-height: 1.5;
}
.ask-markdown-content pre code { background: transparent; padding: 0; }

.ask-markdown-content blockquote {
  border-left: 3px solid #d1d5db;
  padding-left: 10px;
  margin: 8px 0;
  color: #6b7280;
  font-style: italic;
}

/* RTL overrides for lists / blockquote */
.ask-markdown-content.rtl ul,
.ask-markdown-content.rtl ol {
  padding-right: 18px;
  padding-left: 0;
}
.ask-markdown-content.rtl blockquote {
  border-right: 3px solid #d1d5db;
  border-left: none;
  padding-right: 10px;
  padding-left: 0;
}
.ask-markdown-content.rtl { direction: rtl; }
.ask-markdown-content.ltr { direction: ltr; }

/* ── Typing indicator ───────────────────────────────── */
.ask-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.ask-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: ask-typing-bounce 1.2s infinite ease-in-out;
}
.ask-typing span:nth-child(1) { animation-delay: 0s; }
.ask-typing span:nth-child(2) { animation-delay: 0.2s; }
.ask-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ask-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-4px); opacity: 1; }
}

/* ── Input area (ChatComposer supplies top border) ─── */
.ask-input-area {
  flex-shrink: 0;
  background: #fff;
}

.review-results-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0f0f0f;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.results-header {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.results-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

.results-header .header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.results-header .restart-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
}

.results-header .restart-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.results-header .restart-button svg {
  flex-shrink: 0;
}

.results-header .restart-button span {
  line-height: 1;
}

.results-header .theme-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #9ca3af;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
}

.results-header .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: scale(1.05);
}

.results-header .info-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #9ca3af;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.results-header .info-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.categories-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 10px;
  gap: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.review-category {
  margin-bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: visible;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.review-category:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.review-category.critical {
  border-left: 4px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.review-category.critical:hover {
  border-left-color: #f87171;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.review-category.warning {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.review-category.warning:hover {
  border-left-color: #fbbf24;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.review-category.info {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.review-category.info:hover {
  border-left-color: #60a5fa;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
}

.category-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.category-header:hover::before {
  opacity: 0.3;
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.category-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.review-category.critical .category-icon {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.review-category.warning .category-icon {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
}

.review-category.info .category-icon {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.15);
}

.category-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  color: #e5e7eb;
  letter-spacing: 0.01em;
}

.category-caret {
  font-size: 12px;
  color: #9ca3af;
  flex-shrink: 0;
  transition: all 0.2s ease;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-90deg);
}

.category-caret.expanded {
  transform: rotate(0deg);
}

.category-header:hover .category-caret {
  color: #ffffff;
}

.category-content {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  display: block;
  visibility: visible;
  opacity: 1;
  animation: fadeInContent 0.25s ease-out;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.no-findings {
  padding: 14px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  font-style: italic;
}

.review-finding {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.review-finding:last-child {
  margin-bottom: 0;
}

.review-finding:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.finding-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}


.explanation-badge {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  letter-spacing: 0.01em;
}

.finding-header .explanation-badge,
.finding-header .review-navigate-btn {
  height: 21px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.explanation-badge:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.explanation-badge:active {
  transform: translateY(0);
}

.review-navigate-btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: transparent;
  color: #3b82f6;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 28px;
}

.review-navigate-btn:hover {
  background: #3b82f6;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transform: translateX(2px);
}

.review-navigate-btn:active {
  transform: translateX(0);
}

.finding-content {
  font-size: 12px;
  line-height: 1.45;
}

.paragraph-text {
  color: #e5e7eb;
  margin: 0 0 8px 0;
  word-wrap: break-word;
  line-height: 1.45;
  font-size: 12px;
}

.show-more-btn {
  display: inline;
  margin-left: 6px;
  padding: 0;
  font-size: 12px;
  color: #60a5fa;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.show-more-btn:hover {
  color: #3b82f6;
  text-decoration: underline;
}

.explanation-content {
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.explanation-section {
  margin-bottom: 10px;
}

.explanation-section:last-child {
  margin-bottom: 0;
}

.explanation-section strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.explanation-section p {
  margin: 0;
  font-size: 12px;
  color: #1f2937;
  line-height: 1.45;
  font-weight: 400;
}

/* Scrollbar styling for dark theme */
.categories-list::-webkit-scrollbar {
  width: 10px;
}

.categories-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}

.categories-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.categories-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
  background-clip: padding-box;
}

/* RTL/LTR Support */
.paragraph-text[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.paragraph-text[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.explanation-content[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.explanation-content[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.explanation-section p[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.explanation-section p[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

/* Enterprise-level polish */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.review-category {
  animation: fadeIn 0.3s ease-out;
}

.review-finding {
  animation: fadeIn 0.2s ease-out;
}

/* Focus states for accessibility */
.category-header:focus-visible,
.explanation-badge:focus-visible,
.review-navigate-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Light Mode Styles */
.review-results-container.light-mode {
  background: #ffffff;
  color: #1f2937;
}

.review-results-container.light-mode .results-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 100%);
}

.review-results-container.light-mode .results-header h2 {
  color: #1f2937;
}

.review-results-container.light-mode .results-header .restart-button {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #6b7280;
}

.review-results-container.light-mode .results-header .restart-button:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.review-results-container.light-mode .results-header .theme-toggle {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #6b7280;
}

.review-results-container.light-mode .results-header .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #1f2937;
}

.review-results-container.light-mode .results-header .info-icon {
  background: rgba(0, 0, 0, 0.05);
  color: #6b7280;
}

.review-results-container.light-mode .results-header .info-icon:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #1f2937;
}

.review-results-container.light-mode .review-category {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.01) 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.review-results-container.light-mode .review-category:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.review-results-container.light-mode .review-category.critical {
  border-left: 4px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(0, 0, 0, 0.01) 100%);
}

.review-results-container.light-mode .review-category.critical:hover {
  border-left-color: #f87171;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.review-results-container.light-mode .review-category.warning {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(0, 0, 0, 0.01) 100%);
}

.review-results-container.light-mode .review-category.warning:hover {
  border-left-color: #fbbf24;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.review-results-container.light-mode .review-category.info {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(0, 0, 0, 0.01) 100%);
}

.review-results-container.light-mode .review-category.info:hover {
  border-left-color: #60a5fa;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.review-results-container.light-mode .category-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.review-results-container.light-mode .category-title {
  color: #1f2937;
}

.review-results-container.light-mode .category-count {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #4b5563;
}

.review-results-container.light-mode .category-caret {
  color: #6b7280;
}

.review-results-container.light-mode .category-header:hover .category-caret {
  color: #1f2937;
}

.review-results-container.light-mode .review-category.critical .category-icon {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.review-results-container.light-mode .review-category.warning .category-icon {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
}

.review-results-container.light-mode .review-category.info .category-icon {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.15);
}

.review-results-container.light-mode .category-content {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.02);
}

.review-results-container.light-mode .no-findings {
  color: #9ca3af;
}

.review-results-container.light-mode .review-finding {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.review-results-container.light-mode .review-finding:hover {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}


.review-results-container.light-mode .paragraph-text {
  color: #374151;
}

.review-results-container.light-mode .explanation-content {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.01) 100%);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.review-results-container.light-mode .explanation-section strong {
  color: #6b7280;
}

.review-results-container.light-mode .explanation-section p {
  color: #1f2937;
}

.review-results-container.light-mode .categories-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}

.review-results-container.light-mode .categories-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

.review-results-container.light-mode .categories-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Responsive adjustments */
@media (max-width: 400px) {
  .category-header {
    padding: 9px 10px;
  }
  
  .category-content {
    padding: 8px 10px 10px;
  }
  
  .review-finding {
    padding: 9px;
  }
}

.review-view {
  padding: 0;
  background: white;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.review-view.dark-theme {
  background: #1a1a1a;
  color: #e5e5e5;
  height: 100%;
}

.questions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.questions-title {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.questions-progress {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
}

.question-container {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0; /* Important for flex scrolling */
}

.question-text {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.option-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.option-item.selected {
  background: #eff6ff;
  border-color: #3b82f6;
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  flex-shrink: 0;
}

.option-item.selected .option-letter {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.option-text {
  flex: 1;
  font-size: 11px;
  color: #111827;
  line-height: 1.4;
}

.option-checkmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #3b82f6;
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  flex-shrink: 0;
}

.option-label {
  font-size: 11px;
  color: #9ca3af;
  margin-left: 6px;
}

.options-placeholder {
  padding: 12px;
  text-align: center;
  color: #9ca3af;
  font-size: 11px;
}

.manual-input-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 5px;
  border: 1px solid #e5e7eb;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.review-input {
  padding: 6px 10px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  outline: none;
  transition: border-color 0.2s;
  background: #ffffff;
  color: #111827;
}

.review-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.review-input::placeholder {
  color: #6b7280;
}

.optional-details {
  margin-top: 12px;
}

.optional-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  outline: none;
  transition: border-color 0.2s;
  background: #ffffff;
  color: #111827;
}

.optional-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.optional-input::placeholder {
  color: #6b7280;
}

.selected-entity-display {
  margin-top: 10px;
  padding: 6px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
}

.selected-entity-display p {
  margin: 0 0 6px 0;
  font-size: 11px;
  color: #111827;
}

.selected-entity-display strong {
  color: #3b82f6;
  font-weight: 600;
}

.selected-entities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.selected-entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  background: #ffffff;
  border: 1px solid #3b82f6;
  border-radius: 3px;
  font-size: 11px;
  color: #111827;
}

.remove-entity-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
}

.remove-entity-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.questions-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  flex-shrink: 0; /* Prevent footer from shrinking */
}

.button-skip {
  padding: 5px 10px;
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.button-skip:hover {
  color: #111827;
  border-color: #9ca3af;
}

.button-continue {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #ea580c;
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.button-continue:hover:not(:disabled) {
  background: #c2410c;
}

.button-continue:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.button-arrow {
  font-size: 12px;
}

.assignment-buttons {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.assignment-button {
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.assignment-button:hover {
  background: #f3f4f6;
}

.assignment-button.active.our-side {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.assignment-button.active.their-side {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.review-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px;
  color: #9ca3af;
  font-size: 11px;
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #3b82f6;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-message {
  padding: 6px 10px;
  background: #7f1d1d;
  border: 1px solid #991b1b;
  border-radius: 3px;
  color: #fecaca;
  font-size: 11px;
  margin-bottom: 10px;
}

/* Dark theme overrides for question flow */
.review-view.dark-theme .questions-header {
  border-bottom-color: #2d2d2d;
}

.review-view.dark-theme .questions-title,
.review-view.dark-theme .question-text,
.review-view.dark-theme .option-text,
.review-view.dark-theme .selected-entity-display p {
  color: #e5e5e5;
}

.review-view.dark-theme .option-item {
  background: #2d2d2d;
  border-color: #3d3d3d;
}

.review-view.dark-theme .option-item:hover {
  background: #353535;
  border-color: #4d4d4d;
}

.review-view.dark-theme .option-item.selected {
  background: #3d3d3d;
}

.review-view.dark-theme .option-letter,
.review-view.dark-theme .review-input,
.review-view.dark-theme .optional-input,
.review-view.dark-theme .assignment-button {
  background: #1a1a1a;
  border-color: #3d3d3d;
  color: #e5e5e5;
}

.review-view.dark-theme .manual-input-section,
.review-view.dark-theme .selected-entity-display {
  background: #2d2d2d;
  border-color: #3d3d3d;
}

.review-view.dark-theme .selected-entity-tag {
  background: #3d3d3d;
  color: #e5e5e5;
}

.review-view.dark-theme .remove-entity-btn:hover {
  background: #4d4d4d;
  color: #e5e5e5;
}

.review-view.dark-theme .questions-footer {
  border-top-color: #2d2d2d;
  background: #1a1a1a;
}

.review-view.dark-theme .button-skip {
  color: #9ca3af;
  border-color: #3d3d3d;
}

.review-view.dark-theme .button-skip:hover {
  color: #e5e5e5;
  border-color: #4d4d4d;
}

.review-view.dark-theme .button-continue:disabled {
  background: #4d4d4d;
}

.review-view.dark-theme .assignment-button:hover {
  background: #2d2d2d;
}

.review-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  text-align: center;
  min-height: 160px;
}

.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
}

.review-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e5e5;
  margin: 0 0 5px 0;
}

.review-description {
  font-size: 11px;
  color: #9ca3af;
  margin: 0;
}

/* ======================================================
   ProofreadView — light-mode, compact, matches Review style
   ====================================================== */

.proofread-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  overflow: hidden;
}

/* ---- Header ---- */
.pf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.pf-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pf-header-right {
  display: flex;
  align-items: center;
}

.pf-total-badge {
  background: #3b82f6;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.pf-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
}

.pf-filter-btn.active {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  color: #2563eb;
}

.pf-filter-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.pf-top-scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.pf-top-scan-btn:hover:not(:disabled) {
  background: #2563eb;
}

.pf-top-scan-btn:disabled {
  opacity: 0.75;
  cursor: default;
}

/* ---- Categories list ---- */
.pf-categories {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0 12px;
}

.pf-categories::-webkit-scrollbar {
  width: 4px;
}

.pf-categories::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

/* ---- Category ---- */
.pf-category {
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 10px;
  margin: 0 10px 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.pf-category:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.pf-cat-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  transition: background 0.15s;
}

.pf-cat-header:hover {
  background: #f3f4f6;
}

.pf-cat-icon {
  color: #6b7280;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pf-cat-title {
  flex: 1;
}

.pf-cat-count {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  color: #4b5563;
}

.pf-cat-caret {
  color: #9ca3af;
  display: flex;
  align-items: center;
  margin-left: auto;
}

/* ---- Category body ---- */
.pf-cat-body {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 6px 8px 8px;
}

/* ---- Subcategory ---- */
.pf-subcat {
  margin-bottom: 4px;
}

.pf-subcat-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #7c3aed;
  text-align: left;
  border-radius: 6px;
  transition: background 0.15s;
}

.pf-subcat-header:hover {
  background: rgba(124, 58, 237, 0.05);
}

.pf-subcat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}

.pf-dot-purple {
  color: #7c3aed;
  border-color: #7c3aed;
}

.pf-dot-blue {
  color: #2563eb;
  border-color: #2563eb;
}

/* Word comment item */
.pf-wc-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.pf-wc-author {
  font-size: 10px;
  font-weight: 600;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pf-wc-anchor {
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-subcat-title {
  flex: 1;
}

.pf-subcat-count {
  font-size: 11px;
  font-weight: 600;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  padding: 1px 6px;
  color: #7c3aed;
}

.pf-subcat-caret {
  color: #a78bfa;
  display: flex;
  align-items: center;
}

/* ---- Definition item ---- */
.pf-def-item {
  padding: 6px 8px 8px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.pf-def-item:last-child {
  border-bottom: none;
}

.pf-def-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.pf-def-term {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
}

.pf-def-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pf-def-snippets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pf-snippet-chip {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  font-size: 10px;
  color: #4b5563;
  padding: 3px 8px;
  cursor: pointer;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s;
}

.pf-snippet-chip:hover {
  background: rgba(59, 130, 246, 0.07);
  border-color: rgba(59, 130, 246, 0.3);
  color: #2563eb;
}

/* ---- Drafting note item ---- */
.pf-draft-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.pf-draft-item:last-child {
  border-bottom: none;
}

.pf-draft-text {
  flex: 1;
  font-size: 11px;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Icon buttons ---- */
.pf-icon-btn {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  color: #6b7280;
  cursor: pointer;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.pf-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #374151;
  border-color: rgba(0, 0, 0, 0.2);
}

.pf-ignore-btn:hover {
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

/* ---- Language section ---- */
.pf-lang-idle {
  padding: 10px 12px;
  color: #6b7280;
  font-size: 12px;
}

.pf-lang-idle strong {
  color: #3b82f6;
}

.pf-lang-scanning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  color: #6b7280;
  font-size: 12px;
}

.pf-error {
  padding: 8px 12px;
  font-size: 12px;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.05);
  border-radius: 6px;
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pf-retry-btn {
  background: none;
  border: 1px solid #dc2626;
  color: #dc2626;
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
}

.pf-lang-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pf-lang-item {
  padding: 7px 8px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 7px;
  background: #fafafa;
  transition: border-color 0.15s;
}

.pf-lang-item:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

.pf-lang-resolved {
  opacity: 0.45;
}

.pf-lang-item-text {
  font-size: 12px;
  color: #1f2937;
  margin-bottom: 6px;
  line-height: 1.4;
}

.pf-lang-original {
  font-weight: 600;
}

.pf-lang-explanation {
  color: #6b7280;
  font-weight: 400;
  font-size: 11px;
}

.pf-lang-redline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 7px 0;
  font-size: 12px;
  line-height: 1.35;
}

.pf-lang-del {
  color: #dc2626;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.pf-lang-arrow {
  color: #9ca3af;
  font-weight: 600;
}

.pf-lang-ins {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1.5px;
}

.pf-lang-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pf-replace-btn {
  appearance: none;
  -webkit-appearance: none;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s;
  height: 22px;
  box-sizing: border-box;
}

.pf-replace-btn:hover {
  background: #2563eb;
}

/* ---- Language footer ---- */
.pf-lang-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.pf-replace-all-btn {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.pf-replace-all-btn:hover {
  background: #3b82f6;
  color: white;
}

.pf-replace-summary {
  margin-top: 6px;
  font-size: 11px;
  color: #6b7280;
  padding: 4px 8px;
}

/* ---- Empty states ---- */
.pf-empty-cat {
  padding: 10px 12px;
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
}

/* ---- Spinner ---- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spin 1s linear infinite;
}

/* PlaybookPickerModal – Agent mode playbook / past-contract context picker */

.pb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  box-sizing: border-box;
}

.pb-modal {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pb-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  color: #374151;
}

.pb-modal-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.pb-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  color: #6b7280;
}

.pb-modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.pb-modal-hint {
  font-size: 11px;
  color: #9ca3af;
  padding: 8px 16px 4px;
  margin: 0;
  line-height: 1.5;
}

.pb-modal-project-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 10px;
}

.pb-modal-project-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pb-modal-project-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #111827;
  cursor: pointer;
}

.pb-modal-project-select:focus {
  outline: 2px solid #16a34a;
  outline-offset: 1px;
}

.pb-modal-project-loading,
.pb-modal-project-error {
  font-size: 12px;
  color: #9ca3af;
}

.pb-modal-project-error {
  color: #ef4444;
}

.pb-modal-project-fallback {
  font-size: 11px;
  color: #6b7280;
  margin: 4px 0 0;
  line-height: 1.45;
}

.pb-modal-link-error {
  margin: 0 16px 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: #b91c1c;
  background: #fef2f2;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

.pb-modal-actions {
  padding: 8px 16px 16px;
  display: flex;
  justify-content: stretch;
}

.pb-link-playbook-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #16a34a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.pb-link-playbook-btn:hover:not(:disabled) {
  background: #15803d;
}

.pb-link-playbook-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pb-modal-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 4px 12px 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: #f9fafb;
}

.pb-search-icon {
  flex-shrink: 0;
  color: #9ca3af;
}

.pb-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12px;
  color: #111827;
  outline: none;
}

.pb-search-input::placeholder {
  color: #9ca3af;
}

.pb-modal-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 12px;
}

.pb-modal-state {
  padding: 24px 12px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}

.pb-modal-state--error {
  color: #ef4444;
}

.pb-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  transition: background 0.1s, border-color 0.1s;
  margin-bottom: 2px;
}

.pb-row:hover {
  background: #f0fdf4;
  border-color: rgba(34, 197, 94, 0.25);
}

.pb-row:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 1px;
}

.pb-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.pb-row-filename {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.pb-row-author {
  font-size: 10px;
  color: #9ca3af;
  flex-shrink: 0;
}

.pb-row-side {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #6b7280;
  flex-shrink: 0;
}

.pb-row-side--ours {
  background: #dcfce7;
  color: #166534;
}

.pb-row-preview {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ======================================================
   AgentView — transcript + Cursor-style bottom composer
   ====================================================== */

.agent-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #ffffff;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  overflow: hidden;
}

.agent-view--thread {
  min-height: 0;
}

/* First-message composer sits above .ag-idle so the mode dropdown (opens downward) is not covered */
.agent-view:not(.agent-view--thread) > .ag-composer.ag-composer--initial {
  position: relative;
  z-index: 30;
}

/* ---- Scrollable transcript (after first send) ---- */
.ag-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Prevent flex from shrinking tall blocks (superseded lists, categories) — parent scrolls instead */
.ag-scroll > * {
  flex-shrink: 0;
}

/* Chronological thread: one block per user turn + agent response */
.ag-thread-round {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.ag-thread-round:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.ag-thread-round--pending {
  border-bottom: none;
}

/* Stale: user follow-up submitted; prior pass kept in thread + sent to model */
.ag-thread-round--stale {
  opacity: 0.94;
}

.ag-thread-round--stale .ag-plan-card,
.ag-thread-round--stale .ag-activity-log,
.ag-thread-round--stale .ag-round-summary-md,
.ag-thread-round--stale .ag-user-bubble {
  opacity: 0.9;
}

.ag-stale-banner {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
  padding: 2px 0 6px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
  margin-bottom: 2px;
}

.ag-prev-issues--stale .ag-prev-issues-toggle {
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.08);
  background: #f3f4f6;
}

.ag-results-header--readonly .ag-total-badge {
  background: #9ca3af;
}

.ag-categories--readonly .ag-apply-btn,
.ag-categories--readonly .ag-replace-all-btn,
.ag-categories--readonly .ag-filter-btn,
.ag-categories--readonly .ag-cat-apply-btn {
  pointer-events: none;
  opacity: 0.45;
}

.ag-actions--locked {
  padding: 6px 12px 8px 14px;
}

.ag-locked-hint {
  font-size: 11px;
  font-style: italic;
  color: #9ca3af;
}

/* Collapsed “earlier suggestions” for past rounds (latest round stays fully open) */
.ag-prev-issues {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ag-prev-issues-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  background: #f9fafb;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: #4b5563;
  flex-shrink: 0;
}

.ag-prev-issues-toggle:hover {
  background: #f3f4f6;
  border-color: rgba(0, 0, 0, 0.16);
}

.ag-prev-issues-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  flex-shrink: 0;
}

.ag-prev-issues-meta {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: #6b7280;
}

.ag-prev-issues-caret {
  flex-shrink: 0;
  color: #9ca3af;
  display: flex;
  align-items: center;
}

.ag-scroll::-webkit-scrollbar {
  width: 4px;
}

.ag-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.ag-user-bubble {
  align-self: flex-start;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #111827;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.ag-scanning-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
  padding: 2px 0;
}

/* ---- Results header ---- */
.ag-results-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.ag-total-badge {
  background: #3b82f6;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.ag-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
}

.ag-filter-btn.active {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  color: #2563eb;
}

.ag-replace-all-btn {
  margin-left: auto;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}

.ag-replace-all-btn:hover {
  background: #2563eb;
}

/* ---- Error / retry ---- */
.ag-error {
  margin: 10px 12px 0;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: #dc2626;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ag-retry-btn {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ---- Categories list (inside .ag-scroll) ---- */
.ag-categories {
  padding: 0 0 8px;
}

.ag-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 12.5px;
  padding: 24px 20px;
  font-style: italic;
}

/* ---- Category ---- */
.ag-category {
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 10px;
  margin: 0 10px 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.ag-category:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.ag-cat-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #f9fafb;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: #111827;
  transition: background 0.15s;
}

.ag-cat-header:hover {
  background: #f3f4f6;
}

.ag-cat-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Category icon colors */
.ag-icon-risk         { color: #dc2626; }
.ag-icon-legal_improvement { color: #7c3aed; }
.ag-icon-consistency  { color: #2563eb; }
.ag-icon-simplification { color: #d97706; }
.ag-icon-clarity      { color: #059669; }

.ag-cat-title {
  flex: 1;
}

.ag-cat-count {
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  padding: 1px 6px;
  border: 1px solid currentColor;
  opacity: 0.85;
}

.ag-count-risk               { color: #dc2626; }
.ag-count-legal_improvement  { color: #7c3aed; }
.ag-count-consistency        { color: #2563eb; }
.ag-count-simplification     { color: #d97706; }
.ag-count-clarity            { color: #059669; }

.ag-cat-apply-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 6px;
  color: #2563eb;
  cursor: pointer;
  transition: background 0.15s;
}

.ag-cat-apply-btn:hover {
  background: rgba(59, 130, 246, 0.18);
}

.ag-cat-caret {
  display: flex;
  align-items: center;
  color: #9ca3af;
}

/* ---- Category body ---- */
.ag-cat-body {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 4px 0 4px;
}

.ag-empty-cat {
  padding: 8px 12px;
  font-size: 11.5px;
  color: #9ca3af;
  font-style: italic;
}

/* ---- Issue item ---- */
.ag-issue {
  padding: 8px 12px 8px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  border-left: 3px solid transparent;
  transition: background 0.12s;
}

.ag-issue:last-child {
  border-bottom: none;
}

.ag-issue:hover {
  background: rgba(0, 0, 0, 0.02);
}

.ag-issue-resolved {
  opacity: 0.45;
}

/* Severity left border */
.ag-sev-high   { border-left-color: #dc2626; }
.ag-sev-medium { border-left-color: #d97706; }
.ag-sev-low    { border-left-color: #6b7280; }

/* ---- Issue meta row ---- */
.ag-issue-meta {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 5px;
}

.ag-sev-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 3px;
}

.ag-sev-dot-high   { background: #dc2626; }
.ag-sev-dot-medium { background: #d97706; }
.ag-sev-dot-low    { background: #9ca3af; }

.ag-issue-explanation {
  font-size: 12px;
  color: #374151;
  line-height: 1.4;
  flex: 1;
  font-weight: 500;
}

/* ---- Suggested edit preview (matches EditorView suggested-edit / track-change-new) ---- */
.ag-suggested-preview {
  margin: 2px 0 8px 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #374151;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ag-suggested-preview .selected-text-xml {
  width: 100%;
  line-height: 1.6;
  color: #374151;
}

.ag-suggested-preview .selected-text-xml del.track-change-deletion,
.ag-suggested-preview .selected-text-xml .track-change-deletion {
  text-decoration: line-through !important;
  text-decoration-color: #dc2626 !important;
  text-decoration-thickness: 2px !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

.ag-suggested-preview .selected-text-xml ins.track-change-insertion,
.ag-suggested-preview .selected-text-xml .track-change-insertion {
  text-decoration: none !important;
  border-bottom: 2px solid #dc2626 !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

.ag-suggested-preview .selected-text-xml del.track-change-deletion.track-change-new,
.ag-suggested-preview .selected-text-xml .track-change-deletion.track-change-new {
  text-decoration: line-through !important;
  text-decoration-color: #2563eb !important;
  text-decoration-thickness: 2px !important;
  color: #1e40af !important;
  background-color: #dbeafe !important;
  padding: 2px 0 !important;
  display: inline !important;
}

.ag-suggested-preview .selected-text-xml ins.track-change-insertion.track-change-new,
.ag-suggested-preview .selected-text-xml .track-change-insertion.track-change-new {
  text-decoration: none !important;
  border-bottom: 2px solid #2563eb !important;
  color: #1e40af !important;
  background-color: #dbeafe !important;
  padding: 2px 0 !important;
  display: inline !important;
}

/* ---- Issue action buttons ---- */
.ag-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 14px;
}

.ag-apply-btn {
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.ag-apply-btn:hover {
  background: #2563eb;
}

.ag-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.ag-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #374151;
}

.ag-ignore-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.25);
}

/* ---- Replace summary ---- */
.ag-replace-summary {
  margin: 6px 12px 0;
  padding: 6px 10px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 6px;
  font-size: 12px;
  color: #1d4ed8;
  font-weight: 500;
}

/* ---- Idle state ---- */
.ag-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  color: #6b7280;
  gap: 10px;
  position: relative;
  z-index: 0;
}

.ag-idle-icon {
  color: #d1d5db;
}

.ag-idle p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.ag-idle-hint {
  font-size: 11px !important;
  color: #9ca3af;
}

/* ---- Spinner ---- */
.spinning {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Primary goal + plan + activity ---- */
.ag-primary-goal {
  align-self: flex-start;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid rgba(59, 130, 246, 0.2);
  font-size: 12px;
  line-height: 1.45;
  color: #1e3a8a;
}

.ag-primary-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #3b82f6;
  margin-bottom: 4px;
}

.ag-plan-card {
  align-self: stretch;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fafafa;
}

.ag-plan-card--compact {
  opacity: 0.95;
}

.ag-plan-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  margin-bottom: 8px;
}

.ag-plan-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
  color: #374151;
}

.ag-plan-list li {
  margin-bottom: 4px;
}

.ag-plan-done {
  color: #059669;
}

.ag-activity-log {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.ag-activity-log--done {
  padding-bottom: 4px;
}

.ag-activity-line {
  font-size: 12px;
  line-height: 1.45;
  color: #4b5563;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.ag-activity-line--live {
  background: #f0fdf4;
  border-color: rgba(16, 185, 129, 0.2);
}

.ag-cursor {
  display: inline-block;
  animation: ag-blink 1s step-end infinite;
  color: #059669;
  margin-left: 1px;
}

@keyframes ag-blink {
  50% {
    opacity: 0;
  }
}

/* Round summary: plain flow, graceful markdown (AskMarkdown + AskView.css + tweaks below) */
.ag-round-summary-md {
  align-self: stretch;
  max-width: 100%;
  font-size: 12.5px;
  line-height: 1.55;
  color: #1f2937;
  word-break: break-word;
}

.ag-round-summary-md .ask-markdown-content {
  line-height: 1.62;
}

.ag-round-summary-md .ask-markdown-content > p:first-child {
  margin-top: 0;
}

.ag-round-summary-md .ask-markdown-content p {
  margin-bottom: 10px;
}

.ag-round-summary-md .ask-markdown-content h1,
.ag-round-summary-md .ask-markdown-content h2,
.ag-round-summary-md .ask-markdown-content h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.ag-round-summary-md .ask-markdown-content ul,
.ag-round-summary-md .ask-markdown-content ol {
  margin: 6px 0 12px;
  padding-left: 1.15em;
}

.ag-round-summary-md .ask-markdown-content li {
  margin-bottom: 5px;
}

.ag-round-summary-md .ask-markdown-content blockquote {
  margin: 8px 0;
  padding-left: 10px;
  border-left: 3px solid rgba(59, 130, 246, 0.35);
}

.ag-stale-run {
  align-self: stretch;
  border-radius: 8px;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  background: #f9fafb;
  overflow: visible;
  min-height: min-content;
}

.ag-stale-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: #6b7280;
}

.ag-stale-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.ag-stale-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #4b5563;
}

.ag-stale-title {
  flex: 1;
  min-width: 0;
}

.ag-stale-caret {
  flex-shrink: 0;
  color: #9ca3af;
}

.ag-stale-body {
  padding: 0 10px 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  overflow: visible;
  max-height: none;
}

.ag-stale-summary {
  font-size: 12px;
  line-height: 1.45;
  color: #6b7280;
  padding: 8px 0;
}

.ag-stale-issues {
  opacity: 0.88;
  flex-shrink: 0;
}

.ag-stale-issues .ag-category {
  overflow: visible;
  flex-shrink: 0;
}

.ag-stale-issues .ag-cat-body {
  overflow: visible;
  max-height: none;
}

.ag-stale-issues .ag-cat-header {
  cursor: default;
}

.workflow-timeline {
  position: relative;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  min-width: 200px;
  width: 100%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin: 0;
  box-sizing: border-box;
}


.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 0px;
  padding-bottom: 0px;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
}

.timeline-task {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  color: #111827;
}

.timeline-task:hover:not(.upcoming) {
  opacity: 0.8;
  transform: translateX(2px);
}

.timeline-task.upcoming {
  cursor: default;
  opacity: 0.5;
}

.task-arrow {
  color: #6b7280;
  flex-shrink: 0;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.timeline-task:hover:not(.upcoming) .task-arrow {
  color: #374151;
  opacity: 1;
}

.task-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.task-status-icon.completed {
  color: #10b981;
}

.task-status-icon.active {
  color: #3b82f6;
}

.task-status-icon.pending {
  color: #9ca3af;
}

.task-status-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #9ca3af;
  background: transparent;
  transition: all 0.2s ease;
}

.timeline-task.active .task-status-circle {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.task-description {
  font-size: 13px;
  color: #111827;
  line-height: 1.5;
  flex: 1;
  font-weight: 500;
}

.timeline-task.upcoming .task-description {
  color: #9ca3af;
}

.timeline-dot-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  width: 100%;
  justify-content: center;
  height: 24px;
  align-self: flex-start;
  margin-bottom: 2px;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px #e2e8f0, 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  z-index: 2;
  position: relative;
  margin: 0 auto;
  align-self: center;
}

.timeline-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.timeline-dot.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 0 0 2px #3b82f6, 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 20px;
  height: 20px;
  border-width: 3px;
  animation: pulse-dot 2s ease-in-out infinite;
}

.timeline-dot.active::before {
  opacity: 1;
  width: 8px;
  height: 8px;
}

.timeline-dot.completed {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15), 0 0 0 2px #10b981, 0 2px 8px rgba(16, 185, 129, 0.3), 0 1px 2px rgba(0, 0, 0, 0.1);
  border-width: 3px;
}

.timeline-dot.completed::before {
  opacity: 1;
  background: rgba(255, 255, 255, 0.9);
  width: 7px;
  height: 7px;
}

.timeline-dot.upcoming {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  box-shadow: 0 0 0 2px #e2e8f0, 0 1px 2px rgba(0, 0, 0, 0.05);
}

@keyframes pulse-dot {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 0 0 2px #3b82f6, 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), 0 0 0 2px #3b82f6, 0 4px 16px rgba(59, 130, 246, 0.5), 0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

.timeline-line {
  position: absolute;
  top: 7px;
  left: calc(50% + 7px);
  right: -50%;
  height: 2px;
  background: #d1d5db;
  z-index: 0;
}

.timeline-line.completed {
  background: #10b981;
}

.timeline-line.active {
  background: linear-gradient(to right, #10b981 0%, #d1d5db 50%);
}

.timeline-label-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  padding-top: 2px;
  align-items: center;
  text-align: center;
  width: 100%;
}

.timeline-step-number {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  line-height: 1.3;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.timeline-step.active .timeline-step-number {
  color: #2563eb;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.timeline-step.completed .timeline-step-number {
  color: #059669;
  font-weight: 700;
}

.timeline-step-label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  line-height: 1.4;
  transition: all 0.3s ease;
  margin-top: 2px;
}

.timeline-step.active .timeline-step-label {
  color: #1e40af;
  font-weight: 700;
  font-size: 14px;
}

.timeline-step.completed .timeline-step-label {
  color: #047857;
  font-weight: 600;
}

.timeline-step-description {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
  margin-top: 3px;
  font-weight: 400;
  transition: all 0.3s ease;
  max-width: 180px;
}

.timeline-step.active .timeline-step-description {
  color: #64748b;
  font-weight: 500;
}

.timeline-step.completed .timeline-step-description {
  color: #64748b;
}



.project-selector {
  padding: 0;
  background: #ffffff;
  flex-shrink: 0;
  width: 100%;
  transition: all 0.3s ease;
}

.project-selector.collapsed {
  padding: 0;
}

.project-selector-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.project-selector-timeline {
  margin-top: 16px;
  margin-bottom: 16px;
  width: 100%;
  padding: 0 16px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  box-sizing: border-box;
}

.project-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 12px;
  border-bottom: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.project-selector.collapsed .project-selector-header {
  border-bottom: none;
}

.project-selector-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.collapse-toggle-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: all 0.2s;
  border-radius: 4px;
}

.collapse-toggle-button:hover {
  background: #f3f4f6;
  color: #374151;
}

.collapse-icon {
  transition: transform 0.2s ease;
}

.collapse-icon.collapsed {
  transform: rotate(-90deg);
}

.project-selector-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.2;
}

.refresh-button {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  padding: 0;
  color: #6b7280;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.refresh-button:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
  transform: translateY(-1px);
}

.refresh-button:active:not(:disabled) {
  transform: translateY(0) scale(0.95);
}

.refresh-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.refresh-button svg {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.refresh-button:hover:not(:disabled) svg {
  transform: rotate(180deg);
}

.error-message {
  padding: 12px 16px;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 8px;
  margin: 16px;
  font-size: 12px;
  border: 1px solid #fecaca;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  line-height: 1.4;
}

.select-group {
  margin-bottom: 0;
  margin-top: 0;
  padding: 0 16px;
}

.project-selector-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 0 18px;
}

.select-group label {
  display: block;
  margin-bottom: 10px;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.select-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 12 12%27%3E%3Cpath fill=%27%236b7280%27 d=%27M6 9L1 4h10z%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.select-group select:hover:not(:disabled) {
  border-color: #9ca3af;
  background: #fafafa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.select-group select:disabled {
  background: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
  border-color: #e5e7eb;
  opacity: 0.7;
}

.select-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #ffffff;
}

.select-group select option {
  background: #ffffff;
  color: #111827;
}

.clause-card {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 12px;
  background: white;
}

.clause-card.locked {
  opacity: 0.8;
}

.clause-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background-color 0.2s;
}

.clause-header:hover {
  background: #f3f4f6;
}

.clause-header-content {
  flex: 1;
  min-width: 0;
}

.clause-title-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clause-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.clause-title {
  font-weight: 600;
  font-size: 12px;
  color: #111827;
}

.clause-status {
  font-size: 11px;
  margin-top: 2px;
}

.clause-description {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

.clause-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.verification-button,
.lock-button {
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.verification-button {
  color: #9ca3af;
}

.verification-button.verified {
  color: #10b981;
}

.verification-button:hover:not(:disabled) {
  color: #059669;
}

.lock-button {
  color: #9ca3af;
}

.lock-button.locked {
  color: #dc2626;
}

.lock-button:hover:not(:disabled) {
  color: #b91c1c;
}

.navigate-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: #3b82f6;
  border: 1.5px solid #3b82f6;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: auto;
  height: 28px;
  white-space: nowrap;
}

.navigate-btn:hover {
  background: #3b82f6;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transform: translateX(2px);
}

.navigate-btn:active {
  transform: translateX(0);
}

.delete-button {
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.delete-button:hover:not(:disabled) {
  color: #dc2626;
}

.delete-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.verification-button:disabled,
.lock-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon {
  width: 16px;
  height: 16px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.clause-locked-message {
  padding: 12px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

.verified-badge {
  color: #10b981;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.clause-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clause-section {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.clause-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: #f9fafb;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  font-size: 12px;
  color: #374151;
  gap: 8px;
}

.clause-section-header::-webkit-details-marker {
  display: none;
}

.clause-section-header:hover {
  background: #f3f4f6;
}

.clause-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.insights-icon {
  width: 20px;
  height: 20px;
  background: #fbbf24;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.insights-icon:hover {
  background: #f59e0b;
  transform: scale(1.1);
}

.insights-icon svg {
  width: 12px;
  height: 12px;
}

.chevron {
  width: 20px;
  height: 20px;
  color: #9ca3af;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.clause-section[open] .chevron {
  transform: rotate(180deg);
}

.clause-section-content {
  padding: 10px;
  font-size: 12px;
  color: #374151;
  border-top: 1px solid #e5e7eb;
  position: relative;
}

.client-request-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}

.client-request-content {
  padding: 12px;
  font-size: 12px;
  color: #374151;
  position: relative;
}

.client-request-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.paragraph-xml-display {
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
  margin-bottom: 0;
}

.selected-text-xml {
  width: 100%;
  line-height: 1.4;
  color: #374151;
  margin-bottom: 0;
}

/* Make newly generated redlines clickable */
.track-change-new {
  cursor: pointer;
  position: relative;
}

.track-change-new:hover {
  opacity: 0.8;
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Accept/Reject buttons */
.redline-action-buttons {
  display: flex;
  gap: 6px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  margin-left: 8px;
}

.accept-redline-btn,
.reject-redline-btn {
  padding: 4px 10px;
  font-size: 11px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.accept-redline-btn {
  background: #10b981;
  color: white;
}

.accept-redline-btn:hover {
  background: #059669;
}

.reject-redline-btn {
  background: #ef4444;
  color: white;
}

.reject-redline-btn:hover {
  background: #dc2626;
}

/* Track changes styling in selected text */
.selected-text-xml del.track-change-deletion,
.selected-text-xml .track-change-deletion {
  text-decoration: line-through !important;
  text-decoration-color: #dc2626 !important;
  text-decoration-thickness: 2px !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

.selected-text-xml ins.track-change-insertion,
.selected-text-xml .track-change-insertion {
  text-decoration: none !important;
  border-bottom: 2px solid #dc2626 !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

/* Newly generated redlines - blue background highlight (only for track-change-new class) */
del.track-change-deletion.track-change-new,
.track-change-deletion.track-change-new {
  text-decoration: line-through !important;
  text-decoration-color: #2563eb !important;
  text-decoration-thickness: 2px !important;
  color: #1e40af !important;
  background-color: #dbeafe !important;
  padding: 2px 0 !important;
  display: inline !important;
}

ins.track-change-insertion.track-change-new,
.track-change-insertion.track-change-new {
  text-decoration: none !important;
  border-bottom: 2px solid #2563eb !important;
  color: #1e40af !important;
  background-color: #dbeafe !important;
  padding: 2px 0 !important;
  display: inline !important;
}

.ai-playbook-suggestion-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(251, 191, 36, 0.3);
}

.ai-playbook-suggestion-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 6px rgba(251, 191, 36, 0.4);
  transform: translateY(-1px);
}

.ai-playbook-suggestion-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ai-playbook-suggestion-button svg {
  width: 16px;
  height: 16px;
}

.playbook-suggestion-section .clause-section-header {
  background: #fef3c7;
  border-bottom: 2px solid #fbbf24;
}

.playbook-insights-header {
  background: #fef3c7;
  border-bottom: 2px solid #fbbf24;
}

.playbook-insights-header:hover {
  background: #fde68a;
}

.playbook-insights-header-controls {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  margin-right: 8px;
  min-width: 0;
}

.insights-navigation-header {
  margin: 0;
  padding: 0;
  border-top: none;
  gap: 6px;
}

.nav-button-header {
  padding: 4px 8px;
  font-size: 10px;
}

.insight-counter-header {
  font-size: 10px;
  padding: 0 4px;
}

.playbook-suggestion-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}

.insights-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.insights-label {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.badge-icon {
  width: 12px;
  height: 12px;
}

.inline-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
}

.similarity-badge {
  background: #dbeafe;
  color: #1e40af;
}

.similarity-badge:hover {
  background: #bfdbfe;
}

.explanation-badge {
  background: #d1fae5;
  color: #065f46;
}

.explanation-badge:hover {
  background: #a7f3d0;
}

.source-badge {
  background: #fef3c7;
  color: #92400e;
}

.source-badge:hover {
  background: #fde68a;
}

.ai-suggestion-badge {
  background: #e9d5ff;
  color: #6b21a8;
}

.ai-suggestion-badge:hover {
  background: #ddd6fe;
}

/* Playbook Insights Section */
.playbook-insights-section {
  margin-top: 0;
  padding: 10px;
  background: #fef3c7;
  border-radius: 6px;
  border: 1px solid #fbbf24;
}

/* Remove the wrapper background when inside clause-section-content */
.clause-section-content > .playbook-insights-section {
  background: transparent;
  border: none;
  padding: 0;
}

.insight-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.insight-badge.similarity-badge {
  background: #dbeafe;
  color: #1e40af;
}

.insight-badge.similarity-badge:hover {
  background: #bfdbfe;
}

.insight-badge.explanation-badge {
  background: #d1fae5;
  color: #065f46;
}

.insight-badge.explanation-badge:hover {
  background: #a7f3d0;
}

.insight-badge.source-badge {
  background: #fef3c7;
  color: #92400e;
}

.insight-badge.source-badge:hover {
  background: #fde68a;
}

.insight-badge.suggestion-badge {
  background: #e9d5ff;
  color: #6b21a8;
}

.insight-badge.suggestion-badge:hover {
  background: #ddd6fe;
}

.insights-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #fbbf24;
}

.insights-navigation-header {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  gap: 6px;
}

.nav-button {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid #fbbf24;
  background: white;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-button-header {
  padding: 4px 8px;
  font-size: 10px;
}

.nav-button:hover:not(:disabled) {
  background: #fef3c7;
  border-color: #f59e0b;
}

.nav-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.insight-counter {
  font-size: 11px;
  font-weight: 500;
  color: #92400e;
}

.insight-counter-header {
  font-size: 10px;
  padding: 0 4px;
}

/* Insight Details Modal */
.insight-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.similarity-section h4,
.source-info-section h4,
.explanation-section h4 {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.similarity-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.similarity-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.similarity-bar-fill {
  height: 100%;
  background: linear-gradient(to right, #3b82f6, #1d4ed8);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.similarity-percentage {
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
}

.source-info-section {
  background: #f9fafb;
  border-radius: 6px;
  padding: 10px;
}

.source-info-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.source-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.source-label {
  color: #6b7280;
  font-weight: 500;
}

.source-value {
  color: #111827;
  font-weight: 600;
}

.source-value.side-their_side {
  color: #ea580c;
}

.source-value.side-our_side {
  color: #2563eb;
}

.explanation-section {
  background: #dbeafe;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  padding: 10px;
}

.explanation-content {
  font-size: 11px;
  color: #111827;
  white-space: pre-wrap;
  line-height: 1.4;
}

.insight-footer-note {
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.suggestion-intro {
  background: #e9d5ff;
  border: 1px solid #a855f7;
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
  color: #581c87;
  margin-bottom: 12px;
}

.suggestion-content h4 {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.suggested-xml-display {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px;
  background: white;
  max-height: 320px;
  overflow-y: auto;
}

.submit-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.submit-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.response-button {
  background: #3b82f6;
  color: white;
}

.response-button:hover:not(:disabled) {
  background: #2563eb;
}

.response-button.submitted {
  background: #6b7280;
}

.response-button.submitted:hover:not(:disabled) {
  background: #4b5563;
}

.button-icon {
  width: 16px;
  height: 16px;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.insights-modal {
  max-width: 900px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #fef3c7;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-icon {
  width: 20px;
  height: 20px;
  color: #f59e0b;
}

.modal-title h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-description {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insight-item {
  border: 1px solid #fbbf24;
  border-radius: 8px;
  padding: 16px;
  background: #fef3c7;
  display: flex;
  gap: 12px;
}

.insight-number {
  width: 24px;
  height: 24px;
  background: #f59e0b;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.insight-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.insight-header h4 {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.insight-clause-content {
  background: white;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #fbbf24;
  font-size: 12px;
  color: #374151;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.insight-explanation {
  margin-top: 8px;
}

.insight-explanation h4 {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 3px;
}

.insight-explanation > div {
  font-size: 12px;
  color: #374151;
  white-space: pre-wrap;
}

.insight-ai-suggestion {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #c084fc;
}

.insight-ai-suggestion h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #6b21a8;
  margin-bottom: 6px;
}

.ai-suggestion-content {
  background: white;
  border: 1px solid #c084fc;
  border-radius: 5px;
  padding: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.source-info {
  background: white;
  border: 1px solid #fbbf24;
  border-radius: 5px;
  padding: 10px;
  margin-top: 6px;
  position: relative;
}

.source-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.source-info h5 {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 8px 0;
}

.source-info > div {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.source-info > div > span {
  font-weight: 600;
  color: #374151;
  margin-right: 8px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.button-secondary {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.button-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.modal-button-secondary {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-button-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.modal-button-danger {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  background: #dc2626;
  border: 1px solid #dc2626;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-button-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* RTL Support */
.rtl {
  direction: rtl;
  text-align: right;
}

.ltr {
  direction: ltr;
  text-align: left;
}

/* Playbook Initial State */
.playbook-initial-state {
  padding: 10px;
  background: #dbeafe;
  border-radius: 6px;
  border: 1px solid #3b82f6;
}

.initial-state-message {
  font-size: 12px;
  font-weight: 500;
  color: #1e40af;
  text-align: center;
}

/* Streaming State (similar to Editor mode) */
.streaming-state {
  padding: 12px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  margin-bottom: 10px;
}

.streaming-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}

.streaming-text {
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.4;
  color: #111827;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.streaming-text::-webkit-scrollbar {
  width: 6px;
}

.streaming-text::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.streaming-text::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.streaming-text::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Helper function for text direction detection */
.streaming-text[dir="rtl"] {
  text-align: right;
  direction: rtl;
}

.streaming-text[dir="ltr"] {
  text-align: left;
  direction: ltr;
}

/* Generating Indicator in Header */
.header-generating-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 3px 10px;
  background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
  border: 1px solid #a855f7;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: #6b21a8;
  animation: pulse-glow 2s ease-in-out infinite;
}

.header-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #a855f7;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0);
  }
}

/* Beautiful Background Animation for Generating State */
.clause-section-content.generating-background,
.client-request-content.generating-background {
  position: relative;
  background: #ffffff;
  animation: gentle-shimmer 3s ease-in-out infinite;
}

.clause-section-content.generating-background::before,
.client-request-content.generating-background::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(233, 213, 255, 0.3) 25%,
    rgba(216, 180, 254, 0.5) 50%,
    rgba(233, 213, 255, 0.3) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 2.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.clause-section-content.generating-background > *,
.client-request-content.generating-background > * {
  position: relative;
  z-index: 1;
}

@keyframes gentle-shimmer {
  0%, 100% {
    background-color: #ffffff;
  }
  50% {
    background-color: #faf5ff;
  }
}

@keyframes shimmer-sweep {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Playbook Explanation */
.playbook-explanation {
  margin-top: 12px;
  padding: 10px;
  background: #dbeafe;
  border: 1px solid #3b82f6;
  border-radius: 6px;
}

.explanation-label {
  font-size: 11px;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 6px;
}

.explanation-content {
  font-size: 12px;
  color: #111827;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}

.explanation-content[dir="rtl"] {
  text-align: right;
  direction: rtl;
}

.explanation-content[dir="ltr"] {
  text-align: left;
  direction: ltr;
}

.explanation-generating {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  font-size: 14px;
  color: #1e40af;
  font-style: italic;
}

.explanation-generating .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #3b82f6;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.explanation-placeholder {
  padding: 8px;
  font-size: 14px;
  color: #9ca3af;
  font-style: italic;
}

/* Clause Feedback Buttons - Minimalistic Design */
.clause-feedback-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: -15px;
  padding-top: 0;
  padding-left: 12px;
  margin-bottom: 0;
}

/* Insight Feedback Buttons - Enterprise Level Design */
.insight-feedback-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.feedback-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.feedback-replace {
  width: auto;
  height: 20px;
  padding: 0 6px;
  gap: 4px;
}

.feedback-text {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

.feedback-icon {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

.feedback-like {
  color: #6b7280;
}

.feedback-like:hover {
  border-color: #10b981;
  background: #f0fdf4;
  color: #10b981;
}

.feedback-like.active {
  border-color: #10b981;
  background: #10b981;
  color: white;
}

.feedback-dislike {
  color: #6b7280;
}

.feedback-dislike:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}

.feedback-dislike.active {
  border-color: #ef4444;
  background: #ef4444;
  color: white;
}

.feedback-replace {
  color: #6b7280;
}

.feedback-replace:hover:not(:disabled) {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #3b82f6;
}

.feedback-replace:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.feedback-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.clauses-editor {
  display: flex;
  flex-direction: column;
  background: white;
  width: 100%;
  flex-shrink: 0;
  min-height: 100%;
}

.clauses-editor-sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.clauses-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.clauses-editor-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clauses-editor-filter-tabs {
  display: flex;
  gap: 3px;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: white;
}

.filter-tab {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-tab:hover:not(:disabled) {
  background: #f3f4f6;
  color: #374151;
}

.filter-tab.filter-tab-active {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
}

.filter-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.clauses-editor-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.refresh-button {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 3px 6px;
  color: #6b7280;
  transition: color 0.2s;
}

.refresh-button:hover:not(:disabled) {
  color: #111827;
}

.refresh-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.error-message {
  padding: 10px 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 3px;
  margin: 10px 12px;
  font-size: 12px;
}

.loading-indicator {
  padding: 30px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.progress-bar-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #3b82f6 100%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: progress-animation 1.5s ease-in-out infinite;
  transition: width 0.3s ease;
  min-width: 2px;
}

@keyframes progress-animation {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.progress-text {
  text-align: center;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
}

.clauses-editor-empty {
  padding: 18px;
  text-align: center;
  color: #6b7280;
  font-size: 12px;
}

.clauses-list {
  padding: 12px;
  width: 100%;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.clause-card {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 10px;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.clause-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  transition: background 0.2s;
}

.clause-header:hover {
  background: #f3f4f6;
}

.clause-title {
  font-weight: 600;
  color: #111827;
  font-size: 12px;
}

.clause-toggle {
  color: #6b7280;
  font-size: 11px;
}

.clause-content {
  padding: 12px;
}

.lock-indicator {
  padding: 6px 10px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 3px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 500;
}

.status-badge {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 10px;
  margin-right: 6px;
}

.status-badge.schedule {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.response {
  background: #dcfce7;
  color: #166534;
}

.clause-field {
  margin-bottom: 12px;
}

.clause-field:last-child {
  margin-bottom: 0;
}

.clause-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.field-content {
  position: relative;
}

.field-content p {
  margin: 0;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  color: #111827;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 32px;
}

.edit-button {
  margin-top: 6px;
  padding: 5px 10px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.edit-button:hover {
  background: #2563eb;
}

.edit-mode {
  display: flex;
  flex-direction: column;
}

.edit-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

.edit-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.save-button,
.cancel-button {
  padding: 5px 12px;
  border: none;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.save-button {
  background: #10b981;
  color: white;
}

.save-button:hover {
  background: #059669;
}

.cancel-button {
  background: #e5e7eb;
  color: #374151;
}

.cancel-button:hover {
  background: #d1d5db;
}

/* Similarity Slider Styles */
.similarity-slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0;
  transition: background 0.3s ease;
}

.similarity-slider-container:hover {
  background: linear-gradient(135deg, #f3f4f6 0%, #f9fafb 100%);
}

.similarity-slider-label {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  min-width: 120px;
}

.similarity-slider-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.similarity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, 
    #ef4444 0%, 
    #ef4444 20%, 
    #fbbf24 50%, 
    #10b981 100%
  );
  outline: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.similarity-slider:hover {
  opacity: 0.9;
}

.similarity-slider:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Webkit (Chrome, Safari, Edge) */
.similarity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid #3b82f6;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.similarity-slider::-webkit-slider-thumb:hover {
  width: 24px;
  height: 24px;
  border-width: 4px;
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.similarity-slider::-webkit-slider-thumb:active {
  width: 22px;
  height: 22px;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.6);
}

/* Firefox */
.similarity-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid #3b82f6;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.similarity-slider::-moz-range-thumb:hover {
  width: 24px;
  height: 24px;
  border-width: 4px;
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.similarity-slider::-moz-range-thumb:active {
  width: 22px;
  height: 22px;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.6);
}

/* Firefox track */
.similarity-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, 
    #ef4444 0%, 
    #ef4444 20%, 
    #fbbf24 50%, 
    #10b981 100%
  );
}

.similarity-slider-value {
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  background: #dbeafe;
  padding: 3px 10px;
  border-radius: 10px;
  min-width: 40px;
  text-align: center;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.similarity-slider-container:hover .similarity-slider-value {
  background: #bfdbfe;
  color: #1e3a8a;
}

/* Playbook Statistics */
.playbook-stats {
  padding: 6px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
}

.playbook-stats-text {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}


/* ─── Card Shell ─────────────────────────────────────────────────────────── */
.cc-clause-card {
  border: 1px solid #e5e7eb;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 12px;
  background: white;
}

.cc-clause-card.cc-locked {
  opacity: 1;
}

/* Collapsed locked state: message bar (matches dashboard) */
.cc-clause-locked-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}
.cc-clause-locked-text {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}
.cc-clause-locked-icon {
  margin-right: 6px;
}
.cc-clause-verified-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #166534;
}
.cc-verified-icon {
  width: 12px;
  height: 12px;
  margin-right: 4px;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.cc-clause-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.cc-clause-header-clickable {
  cursor: pointer;
  transition: background 0.15s ease;
}

.cc-clause-header-clickable:hover {
  background: #f3f4f6;
}

.cc-clause-header-left {
  flex: 1;
  min-width: 0;
}

.cc-clause-title {
  font-weight: 700;
  font-size: 13px;
  color: #111827;
  margin: 0 0 4px 0;
}

.cc-clause-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cc-clause-badge.cc-identified { background: #dcfce7; color: #166534; }
.cc-clause-badge.cc-matched    { background: #dbeafe; color: #1e40af; }
.cc-clause-badge.cc-missing    { background: #fee2e2; color: #991b1b; }
.cc-clause-badge.cc-saved      { background: #f3e8ff; color: #6b21a8; }

.cc-clause-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  flex-shrink: 0;
}

.cc-action-btn {
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.cc-action-btn:hover { color: #374151; }
.cc-action-btn.cc-verified { color: #10b981; }
.cc-action-btn.cc-locked-btn { color: #dc2626; }

.cc-icon {
  width: 16px;
  height: 16px;
}

/* ─── Body ───────────────────────────────────────────────────────────────── */
.cc-clause-body {
  padding: 12px;
}

/* ─── Sections ───────────────────────────────────────────────────────────── */
.cc-section {
  margin-bottom: 12px;
}

.cc-section:last-child { margin-bottom: 0; }

.cc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.cc-section-label-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cc-lightning {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.cc-section-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0;
  text-transform: none;
}

/* Client Request header: label row + optional explanation row below */
.cc-client-request-header {
  display: block;
  margin-bottom: 6px;
}

.cc-client-request-header-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.cc-explanation-row {
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* Interpretation pill — same look as Past negotiations “Explanation” (.cc-pa-explanation-badge) */
.cc-explanation-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cc-explanation-pill:hover {
  background: #dbeafe;
  border-color: #60a5fa;
}

.cc-explanation-pill-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: inherit;
}

.cc-modal-explanation-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Insight circle (matches dashboard: yellow circle + light bulb, clickable) */
.cc-insight-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #facc15; /* yellow-400 */
  color: white;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.cc-insight-circle:hover {
  background: #eab308; /* yellow-500 */
  transform: scale(1.1);
}
.cc-insight-circle-icon {
  width: 12px;
  height: 12px;
}

/* ─── Client Request Content ─────────────────────────────────────────────── */
.cc-client-request-content {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
}

/* AI suggestion in progress: gradient shimmer while original client request stays visible */
.cc-client-request-content--ai-processing {
  position: relative;
  background: #ffffff;
  animation: cc-ai-gentle-shimmer 3s ease-in-out infinite;
}

.cc-client-request-content--ai-processing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(233, 213, 255, 0.35) 25%,
    rgba(216, 180, 254, 0.55) 50%,
    rgba(233, 213, 255, 0.35) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: cc-ai-shimmer-sweep 2.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.cc-client-request-content--ai-processing > * {
  position: relative;
  z-index: 1;
}

@keyframes cc-ai-gentle-shimmer {
  0%,
  100% {
    background-color: #ffffff;
  }
  50% {
    background-color: #faf5ff;
  }
}

@keyframes cc-ai-shimmer-sweep {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.cc-client-request-content[dir="rtl"],
.cc-client-request-content[dir="rtl"] .cc-selected-text-xml,
.cc-client-request-content[dir="rtl"] .cc-section-text {
  text-align: right;
}

.cc-client-request-content[dir="ltr"] .cc-selected-text-xml,
.cc-client-request-content[dir="ltr"] .cc-section-text {
  text-align: left;
}

/* XML / track-changes display (mirrors Negotiator's paragraph-xml-display) */
.cc-paragraph-xml-display {
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
}

.cc-selected-text-xml {
  width: 100%;
  line-height: 1.5;
  color: #374151;
  font-size: 12px;
}

/* Track-change styling in the XML display */
.cc-selected-text-xml del,
.cc-selected-text-xml .track-change-deletion {
  text-decoration: line-through !important;
  text-decoration-color: #dc2626 !important;
  text-decoration-thickness: 2px !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

.cc-selected-text-xml ins,
.cc-selected-text-xml .track-change-insertion {
  text-decoration: none !important;
  border-bottom: 2px solid #dc2626 !important;
  color: #dc2626 !important;
  background-color: transparent !important;
  display: inline !important;
}

/* Side-based coloring for Past Agreement XML previews */
.cc-paragraph-xml-display.cc-side-our_side .cc-selected-text-xml del,
.cc-paragraph-xml-display.cc-side-our_side .cc-selected-text-xml .track-change-deletion {
  text-decoration-color: #15803d !important;
  color: #15803d !important;
}

.cc-paragraph-xml-display.cc-side-our_side .cc-selected-text-xml ins,
.cc-paragraph-xml-display.cc-side-our_side .cc-selected-text-xml .track-change-insertion {
  border-bottom-color: #15803d !important;
  color: #15803d !important;
}

.cc-section-text {
  margin: 0;
  color: #111827;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.cc-section-text.cc-empty {
  color: #9ca3af;
  font-style: italic;
}

/* ─── Action row (AI + Edit / + Add New + Edit) ──────────────────────────── */
.cc-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.cc-action-row-boc {
  margin-top: 8px;
}

/* Fixed dimensions and alignment for all action buttons */
.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  box-sizing: border-box;
}

.cc-btn-ai {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #c4b5fd;
  min-width: 56px;
}

.cc-btn-ai:hover {
  background: #ddd6fe;
}

.cc-btn-edit {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
  min-width: 56px;
}

.cc-btn-edit:hover {
  background: #bfdbfe;
}

/* + Add New: green (matches dashboard) */
.cc-btn-add-new {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
  min-width: 88px;
}

.cc-btn-add-new:hover {
  background: #bbf7d0;
}

.cc-btn-star {
  font-size: 11px;
}

.cc-btn-bolt {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.cc-btn-icon {
  width: 12px;
  height: 12px;
}

/* ─── AI - Already Exist (full-width yellow) ─────────────────────────────── */
.cc-btn-ai-exist {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 12px;
  margin-top: 6px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
  transition: opacity 0.15s;
}

.cc-btn-ai-exist:hover { opacity: 0.9; }

/* ─── AI source picker wrapper + dropdown ─────────────────────────────────── */
.cc-ai-btn-wrapper {
  position: relative;
  display: inline-flex;
}

.cc-ai-chevron {
  width: 10px;
  height: 10px;
  margin-left: 2px;
  flex-shrink: 0;
}

.cc-ai-source-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  min-width: 200px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  overflow: hidden;
}

.cc-ai-source-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.cc-ai-source-item:hover {
  background: #f5f3ff;
}

.cc-ai-source-item + .cc-ai-source-item {
  border-top: 1px solid #f3f4f6;
}

.cc-ai-source-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.cc-ai-source-item strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}

.cc-ai-source-hint {
  display: block;
  font-size: 11px;
  color: #6b7280;
  margin-top: 1px;
}

/* ─── Bank of Changes ────────────────────────────────────────────────────── */
/* Badge: circular (not oval), vertically centered with "Bank of Changes" label (matches dashboard) */
.cc-boc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  max-width: 20px;
  min-height: 20px;
  max-height: 20px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 50%;
  background: #16a34a;
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-right: 2px;
  flex-shrink: 0;
  align-self: center;
}

.cc-boc-badge:hover { background: #15803d; }

.cc-chevron-btn {
  padding: 2px 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
}

.cc-chevron-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}

.cc-chevron-icon.cc-open { transform: rotate(180deg); }

/* Options list when expanded */
.cc-boc-options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cc-boc-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
}
.cc-boc-option:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.cc-boc-option.cc-boc-option-primary {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left: 3px solid #22c55e;
}

.cc-boc-option-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d1d5db;
  color: #374151;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.cc-boc-option.cc-boc-option-primary .cc-boc-option-rank {
  background: #16a34a;
  color: white;
}

.cc-boc-option-text {
  margin: 0;
  font-size: 12px;
  color: #111827;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Past Agreement: selectable list (primary highlight like Bank of Changes) */
.cc-pa-option-readonly {
  cursor: pointer;
}
.cc-pa-option-readonly:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.cc-pa-option-readonly.cc-boc-option-primary:hover {
  background: #ecfdf5;
  border-color: #86efac;
}
.cc-boc-option.cc-pa-option-readonly.cc-pa-option-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Past negotiations expanded row: rank + badges on row 1; clause text full-width row 2.
   Card inset matches .cc-client-request-content (8px 10px) so text lines up with Client Request. */
.cc-boc-option.cc-pa-option-readonly {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 4px;
  row-gap: 6px;
  align-items: start;
  padding: 8px 10px;
}

.cc-boc-option.cc-pa-option-readonly > .cc-boc-option-rank {
  grid-row: 1;
  grid-column: 1;
}

.cc-boc-option.cc-pa-option-readonly > .cc-pa-option-main {
  grid-row: 1;
  grid-column: 2;
  min-width: 0;
}

.cc-boc-option.cc-pa-option-readonly > .cc-paragraph-xml-display,
.cc-boc-option.cc-pa-option-readonly > .cc-boc-option-text {
  grid-row: 2;
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.cc-boc-option.cc-pa-option-readonly > .cc-boc-option-text {
  margin: 0;
}

.cc-pa-collapsed-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.cc-pa-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* Expanded list: wraps badge row only (body text is a sibling grid cell). */
.cc-pa-option-main {
  min-width: 0;
}
.cc-pa-explanation-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cc-pa-explanation-badge:hover {
  background: #dbeafe;
  border-color: #60a5fa;
}

/* Past Agreement — Source (warm cream / brown, distinct from Explanation blue) */
.cc-pa-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #8d4f1b;
  background: #fff8e1;
  border: 1px solid #e8c98a;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cc-pa-source-badge:hover {
  background: #ffefcc;
  border-color: #d4a574;
}
.cc-pa-source-badge-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: #753a0e;
}

/* Similarity badge (non-interactive pill) */
.cc-pa-similarity-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 999px;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

/* ─── Sales Agreement (collapsible) ──────────────────────────────────────── */
.cc-collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.cc-sa-label { color: #374151; }

.cc-collapsible-content {
  margin-top: 6px;
}

/* Sales Agreement body: flow as paragraph, no preserved newlines (matches dashboard) */
.cc-collapsible-content .cc-sa-content {
  white-space: normal;
  word-wrap: break-word;
}

.cc-collapsible-content[dir="rtl"] .cc-section-text,
.cc-sa-preview[dir="rtl"] {
  text-align: right;
}

.cc-collapsible-content[dir="ltr"] .cc-section-text,
.cc-sa-preview[dir="ltr"] {
  text-align: left;
}

.cc-sa-preview {
  font-size: 11px;
  color: #9ca3af;
  margin: 4px 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Insights inline row ────────────────────────────────────────────────── */
.cc-insights-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  margin-top: 6px;
}

.cc-insights-label {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
}

.cc-insight-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.cc-insight-explanation {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.cc-insight-explanation:hover { background: #dcfce7; }

.cc-insight-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
}

/* BoC header: label + badge on the left, chevron on the right */
.cc-boc-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

/* ─── Inline edit ────────────────────────────────────────────────────────── */
.cc-inline-edit {
  margin-top: 6px;
}

.cc-inline-add {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d1d5db;
}

.cc-edit-textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  outline: none;
  resize: vertical;
  font-family: inherit;
  color: #111827;
  background: white;
  box-sizing: border-box;
}

.cc-edit-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

.cc-inline-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 5px;
  justify-content: flex-end;
}

.cc-btn-save {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.cc-btn-save:hover { background: #1d4ed8; }

.cc-btn-cancel {
  background: white;
  color: #374151;
  border-color: #d1d5db;
}

.cc-btn-cancel:hover { background: #f3f4f6; }

/* ─── Submit button ──────────────────────────────────────────────────────── */
/* Line between Sales Agreement content and Submit button */
.cc-submit-row {
  border-top: 1px solid #e5e7eb;
  margin-top: 12px;
  padding-top: 12px;
}

.cc-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  background: #2563eb;
  color: white;
}

.cc-submit-btn:hover:not(:disabled) { background: #1d4ed8; }
.cc-submit-btn:disabled { background: #93c5fd; cursor: not-allowed; }
.cc-submit-btn.cc-submit-ok  { background: #10b981; color: white; }
.cc-submit-btn.cc-submit-err { background: #ef4444; color: white; }

/* Undo Response button */
.cc-submit-btn.cc-undo-response {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.cc-submit-btn.cc-undo-response:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
}
.cc-submit-btn.cc-undo-response:disabled,
.cc-submit-btn.cc-undo-response.cc-undoing {
  opacity: 0.7;
  cursor: not-allowed;
}

.cc-undo-not-found-msg {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
}

.cc-submit-icon {
  width: 16px;
  height: 16px;
}

.cc-submit-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: cc-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.cc-spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #6b7280;
  border-radius: 50%;
  animation: cc-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes cc-spin {
  to {
    transform: rotate(360deg);
  }
}

.cc-action-btn-busy {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.cc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Past negotiation PDF: near-full viewport so the page preview is readable */
.cc-modal-overlay--past-source {
  padding: 12px;
  box-sizing: border-box;
}

.cc-modal {
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cc-modal--past-source {
  width: calc(100vw - 24px);
  max-width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  min-height: 0;
}

.cc-modal-body--past-source {
  /* Single scroll surface: PDF lives in .cc-source-pdf-canvas-wrap (flex-fill + overflow auto). */
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cc-source-filename {
  font-size: 12px;
  color: #4b5563;
  margin: 0;
  word-break: break-word;
  flex-shrink: 0;
}

.cc-source-loading {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.cc-source-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: cc-spin 0.75s linear infinite;
  flex-shrink: 0;
}

.cc-source-loading-text {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
  text-align: center;
}

.cc-source-pdf-error {
  font-size: 12px;
  margin: 0;
  color: #b91c1c;
}

.cc-source-pdf-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.cc-source-pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cc-source-pdf-nav {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
}

.cc-source-pdf-nav:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cc-source-pdf-page-label {
  font-size: 11px;
  color: #374151;
}

.cc-source-pdf-badge {
  color: #15803d;
  font-weight: 600;
}

.cc-source-pdf-canvas-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f3f4f6;
  display: flex;
  flex-direction: row;
  justify-content: center;
  /* flex-start: centering on the cross-axis breaks scrolling to the top when the canvas is taller
     than this box (align-items: center leaves “dead” space and traps scroll). */
  align-items: flex-start;
  padding: 8px;
}

.cc-source-pdf-canvas {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  flex-shrink: 0;
  vertical-align: top;
}

.cc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  flex-shrink: 0;
}

.cc-modal-title {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  flex: 1;
  min-width: 0;
}

/* Insights "Existing clause" row: go-to (eye) + collapse/expand (chevron) */
.cc-modal-insight-section-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.cc-modal-insight-go-to-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.cc-modal-insight-go-to-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.cc-modal-insight-go-to-icon {
  width: 18px;
  height: 18px;
}

.cc-modal-insight-expand-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.2s;
}

.cc-modal-insight-expand-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.cc-modal-insight-expand-chevron {
  width: 18px;
  height: 18px;
  transition: transform 0.2s;
}

/* Collapsed: chevron points up (“expand”); expanded: default path points down (“collapse”) */
.cc-modal-insight-expand-btn.cc-collapsed-state .cc-modal-insight-expand-chevron {
  transform: rotate(180deg);
}

.cc-modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  padding: 2px 5px;
  border-radius: 4px;
  transition: background 0.15s;
}

.cc-modal-close:hover { background: #f3f4f6; color: #111827; }

.cc-modal-body {
  overflow-y: auto;
  padding: 14px;
}

.cc-modal-insight {
  font-size: 12px;
  line-height: 1.6;
}

.cc-modal-insight-score {
  display: inline-block;
  padding: 2px 8px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}

.cc-modal-insight-section {
  margin-bottom: 10px;
}

.cc-modal-insight-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.cc-modal-insight-section-title {
  flex: 1;
  min-width: 0;
}

.cc-modal-insight-section strong {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.cc-modal-insight-section-head .cc-modal-insight-section-title {
  margin-bottom: 0;
}

.cc-modal-insight-section p {
  margin: 0;
  color: #111827;
}

.cc-modal-xml {
  font-size: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 8px;
  line-height: 1.5;
}

.cc-modal-xml del, .cc-modal-xml .track-change-deletion {
  text-decoration: line-through;
  color: #dc2626;
}

.cc-modal-xml ins, .cc-modal-xml .track-change-insertion {
  color: #dc2626;
  text-decoration: none;
  border-bottom: 2px solid #dc2626;
}

.cc-modal-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 12px 0;
}

.cc-modal-empty {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
  text-align: center;
  padding: 12px 0;
}

/* ─── Status chips ───────────────────────────────────────────────────────── */
.cc-status-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cc-status-chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

.cc-status-chip.cc-schedule { background: #dbeafe; color: #1e40af; }
.cc-status-chip.cc-response { background: #dcfce7; color: #166534; }

.cc-results-view {
  display: flex;
  flex-direction: column;
  background: white;
  width: 100%;
  flex-shrink: 0;
  min-height: 100%;
}

/* Workflow steps: normal document flow — scrolls away with .clauses-view (like Project Settings above) */
.cc-results-steps-scroll {
  flex-shrink: 0;
}

/* Non-blocking sync banner */
.cc-sync-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 13px;
  border-bottom: 1px solid #bfdbfe;
  flex-shrink: 0;
}

.cc-sync-banner-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #93c5fd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: cc-sync-spin 0.8s linear infinite;
}

@keyframes cc-sync-spin {
  to {
    transform: rotate(360deg);
  }
}

.cc-sync-banner-text {
  font-weight: 500;
}

/* Sticky header */
.cc-results-sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.cc-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.cc-results-progress {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cc-results-progress-bar {
  width: 100%;
  height: 6px;
  background-color: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.cc-results-progress-fill {
  height: 100%;
  width: 0%;
  background-color: #22c55e;
  border-radius: 3px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.cc-results-progress-text {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
}

.cc-results-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cc-refresh-btn {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 3px 6px;
  color: #6b7280;
  transition: color 0.2s;
}

.cc-refresh-btn:hover:not(:disabled) {
  color: #111827;
}

.cc-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tabs */
.cc-results-tabs {
  display: flex;
  gap: 3px;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: white;
  overflow-x: auto;
}

/* Running workflow steps (styled like negotiator timeline, above clause editor controls) */
.cc-run-steps-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin: 10px 12px 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cc-run-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.cc-run-step-item + .cc-run-step-item {
  border-top: 1px solid #f0f2f5;
}

.cc-run-arrow {
  color: #6b7280;
  opacity: 0.8;
  font-size: 16px;
  line-height: 1;
}

.cc-run-status-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  font-weight: 700;
}

.cc-run-label {
  flex: 1;
  line-height: 1.4;
}

.cc-run-timer {
  min-width: 48px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.cc-run-step-item.cc-run-complete {
  color: #047857;
}

.cc-run-step-item.cc-run-complete .cc-run-status-icon {
  color: #10b981;
}

.cc-run-step-item.cc-run-running {
  color: #1e40af;
}

.cc-run-step-item.cc-run-running .cc-run-status-icon {
  color: #3b82f6;
}

.cc-run-step-item.cc-run-pending {
  opacity: 0.7;
}

.cc-run-step-item.cc-run-error {
  color: #b91c1c;
}

.cc-run-step-item.cc-run-error .cc-run-status-icon {
  color: #dc2626;
}

.cc-tab {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.cc-tab:hover {
  background: #f3f4f6;
  color: #374151;
}

.cc-tab.cc-tab-active {
  font-weight: 600;
}

.cc-tab.cc-tab-all.cc-tab-active {
  background: #dbeafe;
  color: #1e40af;
}

.cc-tab.cc-tab-sales.cc-tab-active {
  background: #dcfce7;
  color: #166534;
}

.cc-tab.cc-tab-appendix.cc-tab-active {
  background: #dbeafe;
  color: #1e40af;
}

.cc-tab.cc-tab-saved.cc-tab-active {
  background: #f3e8ff;
  color: #6b21a8;
}

/* List — no inner scroll: outer .clauses-view scrolls so sticky progress + tabs work */
.cc-results-list {
  padding: 12px;
  width: 100%;
  flex-shrink: 0;
  overflow-x: hidden;
}

/* Loading */
.cc-loading {
  padding: 30px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.cc-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: cc-spin 0.8s linear infinite;
}

@keyframes cc-spin {
  to { transform: rotate(360deg); }
}

.cc-loading-text {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.cc-loading-sub {
  font-size: 11px;
  color: #9ca3af;
}

/* Empty state */
.cc-empty-state {
  padding: 40px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.cc-empty-icon {
  font-size: 32px;
  opacity: 0.4;
}

.cc-empty-title {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.cc-empty-subtitle {
  font-size: 11px;
  color: #9ca3af;
}

/* Error */
.cc-error {
  padding: 10px 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 4px;
  margin: 10px 12px;
  font-size: 12px;
}

.project-setup {
  padding: 0px 16px 16px 16px;
  background: #ffffff;
  min-height: 100%;
  color: #111827;
}

.project-setup-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.project-setup-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
  letter-spacing: 0.02em;
}

.project-setup-description {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

.project-setup-completed {
  padding: 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.success-message {
  color: #166534;
  font-weight: 500;
  font-size: 13px;
}

.project-setup-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  color: #3b82f6;
  font-size: 13px;
  justify-content: center;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.project-setup-assignments {
  margin-top: 16px;
}

.assignments-header {
  margin-bottom: 16px;
}

.assignments-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  letter-spacing: 0.01em;
}

.assignments-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding-right: 4px;
}

.assignments-list::-webkit-scrollbar {
  width: 6px;
}

.assignments-list::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.assignments-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.assignments-list::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.assignment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.assignment-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.author-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  flex: 1;
}

.assignment-buttons {
  display: flex;
  gap: 8px;
}

.assignment-button {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.assignment-button:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #374151;
}

.assignment-button.active.our-side {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.assignment-button.active.their-side {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #10b981;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.save-assignments-button {
  width: 100%;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  letter-spacing: 0.02em;
}

.save-assignments-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.save-assignments-button:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.project-setup-empty {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.project-setup-empty p {
  margin: 0 0 20px 0;
  font-size: 13px;
  line-height: 1.6;
}

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  letter-spacing: 0.02em;
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.button-primary:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.button-secondary {
  padding: 8px 16px;
  background: #ffffff;
  color: #3b82f6;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.button-secondary:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.button-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-message {
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 12px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 500;
}

.create-subproject-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.create-subproject-form .form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.create-subproject-form .subproject-name-input {
  padding: 11px 14px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: all 0.2s ease;
  background: #ffffff;
  color: #111827;
  font-weight: 500;
  width: 100%;
  box-sizing: border-box;
  unicode-bidi: plaintext;
}

.subproject-name-input::placeholder {
  color: #9ca3af;
}

.subproject-name-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #ffffff;
}

.subproject-name-input:disabled {
  background-color: #f3f4f6;
  cursor: not-allowed;
  opacity: 0.6;
}

.form-hint {
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
}


.mcc-initiation {
  padding: 18px 16px 24px;
  background: #ffffff;
  color: #111827;
}

.mcc-initiation-header {
  margin-top: 4px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

/* Name step: less air between title/subtitle and the project-name card */
.mcc-initiation:has(> .create-subproject-form) .mcc-initiation-header {
  margin-bottom: 8px;
  padding-bottom: 10px;
}

.mcc-initiation:has(> .create-subproject-form) .mcc-initiation-header h3 {
  margin-bottom: 6px;
}

.mcc-initiation-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 10px 0;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.mcc-initiation-description {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  line-height: 1.55;
  max-width: 36em;
}

.mcc-initiation-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* Guided create: tighter card, less dead space between field and actions */
.mcc-initiation .create-subproject-form {
  padding: 16px;
  gap: 14px;
  margin-top: 0;
}

.mcc-initiation .create-subproject-form .form-group {
  gap: 8px;
}

.mcc-initiation .create-subproject-form .form-group label {
  margin-top: 0;
}

.mcc-initiation .create-subproject-form .mcc-initiation-buttons {
  justify-content: center;
  margin-top: 4px;
  padding-top: 4px;
}

.mcc-initiation > .error-message {
  margin: 0 0 16px 0;
}

/* Success state (File Uploaded Successfully + Start Cross-Check) */
.mcc-success-block {
  text-align: center;
  padding: 16px 0 20px;
}

.mcc-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: #dcfce7;
  border-radius: 50%;
}

.mcc-success-check {
  width: 32px;
  height: 32px;
  color: #16a34a;
}

.mcc-success-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
}

.mcc-button-start-cross-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(to right, #3b82f6, #2563eb, #7c3aed);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  transition: opacity 0.2s, transform 0.2s;
}

.mcc-button-start-cross-check:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
}

.mcc-button-start-cross-check:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.mcc-play-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Follow-up question: pre-start step tracker */
.mcc-followup-steps {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin: 4px 0 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mcc-followup-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.mcc-followup-step + .mcc-followup-step {
  border-top: 1px solid #f0f2f5;
}

.mcc-followup-arrow {
  color: #6b7280;
  opacity: 0.8;
  font-size: 16px;
  line-height: 1;
}

.mcc-followup-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  font-weight: 700;
}

.mcc-followup-label {
  line-height: 1.4;
}

.mcc-followup-complete {
  color: #047857;
}

.mcc-followup-complete .mcc-followup-icon {
  color: #10b981;
}

.mcc-followup-pending {
  color: #6b7280;
}

/* ─────────────────────────────────────────────
   CLA: Running Cross-Check progress steps
   ───────────────────────────────────────────── */

.cl-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 4px 0 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.cl-progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  transition: background 0.2s;
}

.cl-progress-step + .cl-progress-step {
  border-top: 1px solid #f3f4f6;
}

.cl-progress-step.cl-step-complete {
  background: #f0fdf4;
}

.cl-progress-step.cl-step-running {
  background: #f0f9ff;
}

.cl-step-icon-col {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.cl-step-icon {
  width: 20px;
  height: 20px;
}

.cl-step-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #bae6fd;
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: cl-spin 0.8s linear infinite;
}

@keyframes cl-spin {
  to { transform: rotate(360deg); }
}

.cl-step-pending-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d1d5db;
  margin: 5px;
}

.cl-step-label {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

.cl-step-label--done {
  color: #15803d;
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   CLA: Identified request cards
   ───────────────────────────────────────────── */

.cl-identified-requests {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  max-height: 340px;
  overflow-y: auto;
}

.cl-identified-requests-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}

.cl-request-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
}

.cl-request-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.cl-request-clause-tag {
  font-size: 11px;
  font-weight: 600;
  color: #4b5563;
  background: #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
}

.cl-request-side-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 7px;
}

.cl-side-their {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.cl-side-our {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.cl-request-text {
  font-size: 12px;
  color: #374151;
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 24px;
  background: #f9fafb;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 32px;
}

.login-card h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  text-align: center;
}

.login-subtitle {
  margin: 0 0 24px 0;
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}

.login-error {
  padding: 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.form-group input {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.login-button {
  padding: 12px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.login-button:hover:not(:disabled) {
  background: #2563eb;
}

.login-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}


/* Solutions grid - cube/card layout matching Quick Actions style */
.solutions-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}

.solutions-section {
  margin-bottom: 20px;
}

.solutions-section:last-child {
  margin-bottom: 0;
}

.solutions-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px 0;
  padding: 0;
}

.solutions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 0 auto;
}

.solutions-grid-generic {
  max-width: 280px;
}

.solution-cube {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 72px;
  text-align: center;
}

.solution-cube:hover {
  background: #f9fafb;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.solution-cube:active {
  transform: scale(0.98);
}

.solution-cube-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  color: #3b82f6;
}

.solution-cube-icon {
  flex-shrink: 0;
}

.solution-cube-label {
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  line-height: 1.25;
}

.solution-cube:hover .solution-cube-label {
  color: #1f2937;
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 6px 3px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 6px 3px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  gap: 3px;
  min-width: 0;
  color: #6b7280;
}

.nav-item-group {
  position: relative;
  flex: 1;
  display: flex;
  align-items: stretch;
}

.nav-item:hover {
  background: #f3f4f6;
  border-radius: 8px;
  color: #374151;
}

.nav-item.active {
  color: #3b82f6;
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.2s, color 0.2s;
  stroke-width: 2;
  flex-shrink: 0;
  color: currentColor;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nav-item.active .nav-label {
  font-weight: 600;
}

.nav-label-with-caret {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  max-width: 100%;
}

.nav-item-group > .nav-item {
  width: 100%;
  height: 100%;
}

.nav-caret {
  position: absolute;
  left: calc(100% + 2px);
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  color: currentColor;
  transition: transform 0.2s ease;
}

.nav-caret.open {
  transform: translateY(-50%) rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  min-width: 140px;
  overflow: hidden;
  z-index: 200;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: #ffffff;
  color: #111827;
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.nav-dropdown-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.nav-dropdown-item:hover {
  background: #f3f4f6;
}

.nav-dropdown-item-placeholder {
  color: #6b7280;
}


.task-pane {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  overflow: hidden;
  position: relative;
}

.task-pane-content {
  flex: 1;
  overflow: hidden;
  padding-bottom: 56px; /* Space for bottom navigation */
  display: flex;
  flex-direction: column;
  min-height: 0; /* Important for flex scrolling */
}

.task-pane-content > * {
  height: 100%;
}

.agent-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 14px;
  text-align: center;
  padding: 18px;
}

.clauses-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.clauses-view > * {
  flex-shrink: 0;
}

/* Guided client setup sits under Project Settings — pull wizard titles closer to the collapsed header */
.clauses-guided-initiation .mcc-initiation {
  padding-top: 4px;
}

.clauses-guided-initiation .mcc-initiation-header {
  margin-top: 0;
}

.clauses-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: #6b7280;
  font-size: 12px;
  text-align: center;
  gap: 12px;
}

.clauses-filename-match-loading {
  min-height: 120px;
}

.filename-match-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: filename-match-spin 0.65s linear infinite;
}

@keyframes filename-match-spin {
  to {
    transform: rotate(360deg);
  }
}

.or-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  position: relative;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.or-divider span {
  padding: 0 16px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #ffffff;
  position: relative;
}

.clauses-setup-actions {
  margin-bottom: 8px;
}

/* Separator between manual project selection and "load by document name" follow-up */
.clauses-load-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0 12px;
  flex-shrink: 0;
}

/* Follow-up question block (Review-style: what project? what sub-project?) */
.clauses-followup {
  flex: 1;
  padding: 12px 18px;
  min-height: 0;
  overflow-y: auto;
}

.clauses-back-link {
  display: inline-block;
  margin-bottom: 12px;
  padding: 0;
  background: none;
  border: none;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
}

.clauses-back-link:hover {
  color: #374151;
}

.clauses-question-text {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.clauses-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clauses-option-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
  font-size: 13px;
  color: #111827;
  transition: background 0.15s, border-color 0.15s;
}

.clauses-option-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.clauses-option-project {
  font-weight: 600;
}

.clauses-option-sub {
  font-weight: 400;
  color: #6b7280;
}

.clauses-manual-toggle {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 8px 12px;
  font-size: 12px;
  color: #6b7280;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
}

.clauses-manual-toggle:hover {
  color: #374151;
  border-color: #9ca3af;
  background: #f9fafb;
}

.clauses-placeholder .clauses-manual-toggle {
  margin-top: 0;
}

.clauses-placeholder .clauses-guided-create {
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: 600;
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.clauses-placeholder .clauses-guided-create:hover {
  color: #fff;
  background: #1d4ed8;
  border-color: #1d4ed8;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 12px;
  line-height: 1.4;
  color: #333;
  background-color: #fff;
}

#root {
  width: 100%;
  height: 100vh;
  overflow-y: auto;
}

button {
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  border: none;
  border-radius: 3px;
  padding: 6px 12px;
  transition: background-color 0.2s;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}



/*# sourceMappingURL=styles.25421b28d5d44a9ae19a.css.map*/