[x-cloak] { display: none !important; }

/* Section accordion */
.section-panel.collapsed .section-body {
  display: none;
}
.section-panel.collapsed .section-chevron {
  transform: rotate(-90deg);
}
.section-panel .section-chevron {
  transform: rotate(0deg);
}

/* Toolbar buttons */
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 4px;
  color: #374151;
  transition: background 0.1s, color 0.1s;
}
.toolbar-btn:hover {
  background: #e5e7eb;
  color: #111827;
}
.toolbar-btn.is-active {
  background: #eef2ff;
  color: #4f46e5;
}
.toolbar-sep {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #d1d5db;
  margin: 0 4px;
}

/* Table dropdown menu items */
.table-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  font-size: 13px;
  color: #374151;
  text-align: left;
}
.table-menu-item:hover {
  background: #f3f4f6;
}
.table-menu-item.text-red-600 {
  color: #dc2626;
}
.table-menu-item.text-red-600:hover {
  background: #fef2f2;
}

/* Table context menu (right-click) */
.tiptap-context-menu {
  position: fixed;
  z-index: 100;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 4px 10px -5px rgba(0,0,0,0.04);
  padding: 4px 0;
  min-width: 200px;
}
.tiptap-context-menu .ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  font-size: 13px;
  color: #374151;
  text-align: left;
}
.tiptap-context-menu .ctx-item:hover {
  background: #f3f4f6;
}
.tiptap-context-menu .ctx-item.danger {
  color: #dc2626;
}
.tiptap-context-menu .ctx-item.danger:hover {
  background: #fef2f2;
}
.tiptap-context-menu .ctx-sep {
  border-top: 1px solid #f3f4f6;
  margin: 4px 0;
}
.tiptap-context-menu .ctx-label {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* TipTap / ProseMirror editor styles */
.ProseMirror {
  min-height: calc(100vh - 280px);
  padding: 0.5rem 0;
  outline: none;
  line-height: 1.625;
  font-size: 0.875rem;
  color: #374151;
}
.ProseMirror:focus {
  outline: none;
}
.ProseMirror p {
  margin-bottom: 0.5rem;
}
.ProseMirror h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #111827;
}
.ProseMirror h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #111827;
}
.ProseMirror h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #111827;
}
.ProseMirror ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}
.ProseMirror ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}
.ProseMirror li {
  margin-bottom: 0.25rem;
}
.ProseMirror blockquote {
  border-left: 4px solid #d1d5db;
  padding-left: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}
.ProseMirror pre {
  background: #111827;
  color: #f3f4f6;
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 0.75rem;
  overflow-x: auto;
  margin-bottom: 0.5rem;
}
.ProseMirror a {
  color: #4f46e5;
  text-decoration: underline;
}
.ProseMirror table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0.5rem;
}
.ProseMirror td, .ProseMirror th {
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  min-width: 80px;
}
.ProseMirror th {
  background: #f9fafb;
  font-weight: 600;
}
.ProseMirror hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 1rem 0;
}

/* Paragraph dropdown menu items */
.paragraph-menu-item:hover {
  background: #f9fafb;
}

.ProseMirror p.is-editor-empty:first-child::before {
  content: 'Start typing...';
  color: #9ca3af;
  float: left;
  pointer-events: none;
  height: 0;
}

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: block; }
.htmx-request .htmx-hide-on-request { opacity: 0.5; pointer-events: none; }

#loading-bar {
  animation: loading 1s ease-in-out infinite;
}

@keyframes loading {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

* {
  scrollbar-width: thin;
  scrollbar-color: #9ca3af #f3f4f6;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 9999px;
}

*::-webkit-scrollbar-track {
  background: #f3f4f6;
}

/* Toast animations */
.toast-enter {
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.toast-enter-active {
  transform: translateX(0);
  opacity: 1;
}

.toast-leave {
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.3s ease-in, opacity 0.3s ease-in;
}

.toast-leave-active {
  transform: translateX(100%);
  opacity: 0;
}

/* Loading skeletons */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 0.375rem;
}

.skeleton-text {
  height: 0.875rem;
  width: 100%;
}

.skeleton-text-sm {
  height: 0.75rem;
  width: 60%;
}

.skeleton-circle {
  border-radius: 9999px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.skeleton-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Mention & Doc-ref suggestion popup --- */
.tiptap-suggestion-popup {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 200px;
  max-width: 340px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.tiptap-suggestion-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  border: none;
  background: none;
}
.tiptap-suggestion-item.is-selected,
.tiptap-suggestion-item:hover {
  background: #eef2ff;
  color: #4338ca;
}
.tiptap-suggestion-empty {
  padding: 8px 10px;
  font-size: 0.8125rem;
  color: #9ca3af;
}

/* Inline mention/doc-ref badges */
.mention {
  background: #eef2ff;
  color: #4338ca;
  border-radius: 4px;
  padding: 1px 4px;
  font-weight: 500;
  font-size: 0.875em;
  white-space: nowrap;
}
.mention-doc {
  background: #f0fdf4;
  color: #166534;
}

/* ── Document Diff highlights ── */
.diff-added {
  background-color: #dcfce7;
  color: #166534;
  padding: 1px 2px;
  border-radius: 2px;
}
.diff-removed {
  background-color: #fee2e2;
  color: #991b1b;
  text-decoration: line-through;
  padding: 1px 2px;
  border-radius: 2px;
}
.diff-added::before { content: "[+] "; font-weight: 600; }
.diff-removed::before { content: "[−] "; font-weight: 600; }

@media (max-width: 767px) {
  .diff-section-pair .grid.md\:grid-cols-2 { grid-template-columns: 1fr; }
}

@media print {
  .diff-added { background-color: #dcfce7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .diff-removed { background-color: #fee2e2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
