/* Custom styles for the application */

html {
  scrollbar-gutter: stable;
}

.menu {
  --menu-active-bg: var(--color-primary-soft) !important;
  --menu-active-fg: var(--color-primary) !important;
}

/* Center legacy dialogs without constraining daisyUI's full-viewport modal. */
dialog:not(.modal) {
  margin: auto;
  min-width: min(800px, 90vw);
  max-width: 90vw;
  max-height: 90vh;
}

dialog.modal {
  min-width: 0;
  max-width: none;
  max-height: none;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.database-sidebar-resizable {
  min-width: 13rem;
  max-width: min(30rem, 80vw);
}

.database-sidebar-resizer {
  position: absolute;
  top: 0;
  right: -0.5rem;
  bottom: 0;
  width: 1rem;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  border: 0;
  padding: 0;
}

.database-sidebar-resizer::before {
  content: "";
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 9999px;
  background: var(--color-border);
  transition: background-color 0.2s ease;
}

.database-sidebar-resizable:hover .database-sidebar-resizer::before,
.database-sidebar-resizer:hover::before,
.database-sidebar-resizer:focus-visible::before,
.database-sidebar-resizable.is-resizing .database-sidebar-resizer::before {
  background: var(--color-primary);
}

.database-sidebar-resizer:focus-visible {
  outline: none;
}

/* Admin section styling */
.admin-section {
  margin-top: auto;
  border-top: 1px solid var(--color-border); /* gray-200 */
  padding-top: 16px;
}

/* Action Text table styling for content display */
.action-text-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1rem;
}

.action-text-content th,
.action-text-content td {
  border: 1px solid var(--color-border);
  padding: 0.5rem;
}

.action-text-content th {
  background-color: var(--color-background-subtle);
  font-weight: bold;
}

.action-text-content tr:nth-child(even) {
  background-color: var(--color-background-subtle);
}

/* Drag and drop styles for document management */
.dragging {
  opacity: 0.4;
  cursor: move;
  background-color: var(--color-background-subtle); /* gray-100 */
  outline: 2px solid var(--color-border); /* gray-300 */
}

.drag-over {
  background-color: var(--color-primary-light) !important; /* brand-50 */
  outline: 2px solid var(--color-primary) !important; /* brand-500 */
  outline-offset: -2px;
  position: relative;
  z-index: 5;
}

/* Override hover and all child backgrounds when dragging over */
.drag-over > div,
.drag-over > div > *,
.drag-over div {
  background-color: var(--color-primary-light) !important;
}

/* Top-level container drop zone styles */
.section-title[data-folder-id=""].drag-over::after {
  content: "Move to Top Level";
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* Provide a specific highlight for the top level container */
.section-title[data-folder-id=""].drag-over {
  background-color: var(--color-success-light) !important; /* success-50 */
  box-shadow: inset 0 0 0 2px var(--color-success); /* success-500 */
  cursor: copy;
}

.section-title[data-folder-id=""].drag-over::after {
  background-color: var(--color-success); /* success-500 */
}

/* Make the section title appear interactive on hover */
.section-title[data-folder-id=""] {
  position: relative;
  transition: background-color 0.2s ease;
}

.section-title[data-folder-id=""]:hover {
  background-color: var(--color-background-subtle); /* gray-50 */
}

/* Custom word wrap for database table names with underscore break preference */
.overflow-wrap-anywhere {
  overflow-wrap: break-word;
  word-break: break-all;
  hyphens: none;
  /* Use a smaller indent for wrapped lines */
  text-indent: -1px;
  padding-left: 1px;
}

/* Special rule to break at underscores */
.overflow-wrap-anywhere::after {
  content: "";
  display: inline;
  word-break: break-all;
}

/* Target underscore characters to create break opportunities */
span.text-sm {
  /* Add zero-width spaces after underscores to encourage breaks there */
  word-spacing: 0.05em;
}

/* Extra space for links with long text */
a .text-sm {
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1.2;
}

/* Drag ghost element */
.drag-ghost {
  background-color: white;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  border: 2px solid var(--color-primary); /* brand-500 */
  cursor: grabbing;
  outline: none;
  transform-origin: center;
}

/* Make the cursor show grabbing on the document being dragged */
tr[draggable="true"].dragging * {
  cursor: grabbing !important;
}

/* Adjust folder row highlighting when it's a drop target */
tr.folder-parent.drag-over td {
  background-color: var(--color-primary-light) !important; /* brand-50 */
}

/* Flash messages for drag-and-drop feedback */
.flash-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  transform: translateY(-20px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.flash-message.visible {
  transform: translateY(0);
  opacity: 1;
}

.flash-success {
  background-color: var(--color-success); /* success-500 */
}

.flash-error {
  background-color: var(--color-error); /* error-500 */
}

/* Drag handle styling */
.drag-handle {
  opacity: 0;
  transition: opacity 0.2s ease;
  width: 20px;
  height: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.drag-handle:hover {
  opacity: 1;
  background-color: var(--color-background-subtle); /* gray-100 */
  border-radius: 4px;
}

.document-item:hover .drag-handle {
  opacity: 0.9;
}

.document-item.dragging .drag-handle {
  opacity: 1;
}

/* Document list and folder tree styles */
.folder-toggle-icon {
  transition: transform 0.2s ease;
}

.folder-toggle-icon.rotate-90 {
  transform: rotate(90deg); /* Changed to 90deg to make it point down when expanded */
}

/* Document item styling - cleaner design */
.document-item {
  border-bottom: 1px solid var(--color-background-subtle); /* gray-100 */
  transition: background-color 0.15s ease;
}

.document-item:hover {
  background-color: var(--color-background-subtle); /* gray-50 */
}

/* Document container styling */
#tenant-documents-container,
#example-documents-container {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border-radius: 0.375rem;
  background-color: white;
}

/* Folder icon styling */
.document-item[data-folder-id] .folder-toggle {
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.document-item[data-folder-id] .folder-toggle:hover {
  background-color: var(--color-border); /* gray-200 */
}

/* Section title styling */
.document-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

/* CRUD Table Cell Hover Effects - Beautiful Tooltip */
.table-crud-cell {
  position: relative;
}

/* Keep cells stable - no expansion */
.table-crud-cell .truncate {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

/* Tooltip container with smooth animations */
.table-crud-cell .cell-tooltip {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  bottom: auto;
  top: var(--tooltip-top);
  left: var(--tooltip-left);
  transform: translateX(-50%) translateY(-100%) translateY(-12px);
  background: linear-gradient(to bottom, var(--color-text), var(--color-text));
  color: var(--color-background-subtle);
  padding: 16px 20px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  min-width: 280px;
  max-width: 600px;
  z-index: 10000;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
              0 0 0 1px rgba(255, 255, 255, 0.1);
  font-size: 0.9375rem;
  line-height: 1.7;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.01em;
}

/* Beautiful gradient border effect */
.table-crud-cell .cell-tooltip::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0.5;
  z-index: -1;
}

/* Show tooltip on hover with smooth animation */
.table-crud-cell:hover .cell-tooltip {
  visibility: visible;
  opacity: 1;
  transition-delay: 0.3s;
}

/* Arrow for tooltip with gradient */
.table-crud-cell .cell-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--color-text);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Subtle text shadow for better readability */
.table-crud-cell .cell-tooltip {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Handle very long content gracefully */
.table-crud-cell .cell-tooltip {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Beautiful scrollbar for long content */
.table-crud-cell .cell-tooltip::-webkit-scrollbar {
  width: 8px;
}

.table-crud-cell .cell-tooltip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  margin: 8px 0;
}

.table-crud-cell .cell-tooltip::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--color-primary), var(--color-primary));
  border-radius: 4px;
  border: 2px solid var(--color-text);
}

.table-crud-cell .cell-tooltip::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, var(--color-primary), var(--color-primary));
}

/* Ensure tooltip appears above other elements */
.table-crud-cell:hover {
  z-index: 50;
}

/* Add subtle highlight to hovered cell */
.table-crud-cell:hover .truncate {
  color: var(--color-primary);
  transition: color 0.2s ease;
}

/* Admin Database Table Cell Hover Effects - Beautiful Tooltip */
.admin-db-cell {
  position: relative;
}

/* Tooltip container with smooth animations for admin database */
.admin-db-cell .cell-tooltip {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  bottom: auto;
  top: var(--tooltip-top);
  left: var(--tooltip-left);
  transform: translateX(-50%) translateY(-100%) translateY(-12px);
  background: linear-gradient(to bottom, var(--color-text), var(--color-text));
  color: var(--color-background-subtle);
  padding: 16px 20px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  min-width: 280px;
  max-width: 600px;
  z-index: 10000;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
              0 0 0 1px rgba(255, 255, 255, 0.1);
  font-size: 0.9375rem;
  line-height: 1.7;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.01em;
}

/* Beautiful gradient border effect for admin database */
.admin-db-cell .cell-tooltip::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0.5;
  z-index: -1;
}

/* Show tooltip on hover with smooth animation for admin database */
.admin-db-cell:hover .cell-tooltip {
  visibility: visible;
  opacity: 1;
  transition-delay: 0.5s; /* Slightly longer delay to avoid interfering with click */
}

/* Arrow for tooltip with gradient for admin database */
.admin-db-cell .cell-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--color-text);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Subtle text shadow for better readability */
.admin-db-cell .cell-tooltip {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Handle very long content gracefully for admin database */
.admin-db-cell .cell-tooltip {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Beautiful scrollbar for long content in admin database */
.admin-db-cell .cell-tooltip::-webkit-scrollbar {
  width: 8px;
}

.admin-db-cell .cell-tooltip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  margin: 8px 0;
}

.admin-db-cell .cell-tooltip::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--color-primary), var(--color-primary));
  border-radius: 4px;
  border: 2px solid var(--color-text);
}

.admin-db-cell .cell-tooltip::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, var(--color-primary), var(--color-primary));
}

/* Ensure tooltip appears above other elements */
.admin-db-cell:hover {
  z-index: 50;
}


/* Asset row title column - narrower to accommodate 3 CIA pills */
.asset-title-column {
  max-width: 16rem !important; /* max-w-64 equivalent, narrower than default max-w-md */
}

/* Connect document post formatting */
.connect-post-content {
  font-size: 1rem;
  line-height: 1.5;
  color: #19283a;
}

.connect-post-content h1,
.connect-post-content h2,
.connect-post-content h3,
.connect-post-content h4 {
  letter-spacing: 0.1px;
  font-weight: 700;
  color: #19283a;
}

.connect-post-content h1 {
  font-size: 1.5rem;
  line-height: 1.16666667;
  margin-top: 1.625rem;
  margin-bottom: 1rem;
}

.connect-post-content h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  margin-top: 1.5625rem;
  margin-bottom: 0.9375rem;
}

.connect-post-content h3 {
  font-size: 1.125rem;
  line-height: 1.5;
  margin-top: 0.9375rem;
  margin-bottom: 0.625rem;
}

.connect-post-content h4 {
  font-size: 1rem;
  line-height: 1.5;
  margin-top: 0.9375rem;
  margin-bottom: 0.625rem;
}

.connect-post-content p {
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: 1.5;
  letter-spacing: 0.1px;
  color: #19283a;
}

.connect-post-content ul,
.connect-post-content ol {
  margin-top: 0;
  margin-bottom: 1rem;
  margin-left: 1.5rem;
  padding-left: 0;
  list-style: none;
  color: #19283a;
  line-height: 1.5;
  letter-spacing: 0.1px;
}

.connect-post-content ul {
  counter-reset: none;
}

.connect-post-content ol {
  counter-reset: connect-post-list;
}

.connect-post-content li {
  position: relative;
  margin-top: 0;
  margin-bottom: 0;
  padding-left: 1rem;
  line-height: 1.5;
}

.connect-post-content ul > li::before {
  content: "•";
  position: absolute;
  left: 0.1rem;
  top: 0;
  color: #475569;
}

.connect-post-content ol > li::before {
  counter-increment: connect-post-list;
  content: counter(connect-post-list) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: #475569;
}

.connect-post-content li::marker {
  color: #475569;
}

.connect-post-content blockquote {
  margin: 0.95rem 0;
  border-left: 4px solid #3b82f6;
  padding: 0.6rem 0.9rem;
  background: #eff6ff;
  color: #1f2937;
}

.connect-post-content img {
  max-width: 100%;
  height: auto;
  margin: 0.95rem 0;
  border-radius: 10px;
}

.connect-post-content a {
  color: #2563eb;
}

.connect-post-content hr {
  margin: 1.25rem 0;
}

.connect-post-content > :first-child {
  margin-top: 0;
}

.connect-post-content > :last-child {
  margin-bottom: 0;
}

.connect-post-editor trix-editor {
  min-height: 320px;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  padding: 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #19283a;
}

.connect-post-editor trix-editor h1,
.connect-post-editor trix-editor h2,
.connect-post-editor trix-editor h3,
.connect-post-editor trix-editor h4,
.connect-post-editor trix-editor .trix-content h1,
.connect-post-editor trix-editor .trix-content h2,
.connect-post-editor trix-editor .trix-content h3,
.connect-post-editor trix-editor .trix-content h4 {
  letter-spacing: 0.1px;
  font-weight: 700 !important;
  color: #19283a !important;
}

.connect-post-editor trix-editor h1 {
  font-size: 1.5rem;
  line-height: 1.16666667;
  margin-top: 1.625rem;
  margin-bottom: 1rem;
}

.connect-post-editor trix-editor h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  margin-top: 1.5625rem;
  margin-bottom: 0.9375rem;
}

.connect-post-editor trix-editor h3 {
  font-size: 1.125rem;
  line-height: 1.5;
  margin-top: 0.9375rem;
  margin-bottom: 0.625rem;
}

.connect-post-editor trix-editor h4 {
  font-size: 1rem;
  line-height: 1.5;
  margin-top: 0.9375rem;
  margin-bottom: 0.625rem;
}

.connect-post-editor trix-editor p {
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: 1.5;
  letter-spacing: 0.1px;
  color: #19283a;
}

.connect-post-editor trix-editor ul,
.connect-post-editor trix-editor ol {
  margin-top: 0;
  margin-bottom: 1rem;
  margin-left: 1.5rem;
  padding-left: 0;
  line-height: 1.5;
  color: #19283a;
}

.connect-post-editor trix-editor blockquote {
  margin: 0.95rem 0;
  border-left: 4px solid #3b82f6;
  padding: 0.6rem 0.9rem;
  background: #eff6ff;
  color: #1f2937;
}

.connect-post-editor trix-editor a {
  color: #2563eb;
}

.connect-post-editor trix-editor > :first-child {
  margin-top: 0;
}

.connect-post-editor trix-editor > :last-child {
  margin-bottom: 0;
}

.connect-post-editor lexxy-editor div[contenteditable="true"].lexxy-editor__content h1,
.connect-post-editor lexxy-editor div[contenteditable="true"].lexxy-editor__content h2,
.connect-post-editor lexxy-editor div[contenteditable="true"].lexxy-editor__content h3,
.connect-post-editor lexxy-editor div[contenteditable="true"].lexxy-editor__content h4,
.connect-post-editor lexxy-editor div.lexxy-content h1,
.connect-post-editor lexxy-editor div.lexxy-content h2,
.connect-post-editor lexxy-editor div.lexxy-content h3,
.connect-post-editor lexxy-editor div.lexxy-content h4,
.connect-post-editor .lexxy-content h1,
.connect-post-editor .lexxy-content h2,
.connect-post-editor .lexxy-content h3,
.connect-post-editor .lexxy-content h4 {
  color: #19283a !important;
  font-weight: 700 !important;
}

.connect-document-content {
  font-size: 0.95rem;
  line-height: 1.6;
}

.connect-document-content h2,
.connect-document-content h3,
.connect-document-content h4 {
  margin-top: 1.1rem;
  margin-bottom: 0.5rem;
}

.connect-inline-image-link {
  display: block;
  margin: 0.75rem 0;
}

.connect-inline-image-figure {
  display: block;
  margin: 1rem 0;
  max-width: 100%;
}

.connect-inline-image-figure .connect-inline-image-link {
  margin: 0;
}

.connect-inline-image {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  cursor: zoom-in;
}

.connect-inline-image-link:hover .connect-inline-image {
  border-color: #bfd0f7;
  box-shadow: 0 8px 20px rgba(37, 119, 201, 0.12);
}

.connect-inline-image-caption,
.document-inline-image-caption {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #6b7280;
  text-align: center;
}

.document-inline-image-figure {
  display: inline-block;
  margin: 0.75rem 0;
  max-width: 100%;
}

.connect-inline-file {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid #dfe5ef;
  border-radius: 10px;
  text-decoration: none;
  background: #f8fafc;
}

.connect-inline-file:hover {
  border-color: #bfd0f7;
  background: #f3f7ff;
}

/* A file in a document: a card with a download icon, the file name and its size.
   The sanitizer strips SVG, so the icon is a CSS mask and the word "Download"
   stays in the markup for screen readers. */
.lexxy-content a.document-inline-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 32rem;
  margin: 0.75rem 0;
  padding: 0.65rem 0.9rem;
  border: 1px solid #dce5f2;
  border-radius: 10px;
  background: #ffffff;
  text-decoration: none !important;
}

.lexxy-content a.document-inline-file:hover {
  border-color: #bfd0f7;
  background: #f8faff;
}

.document-inline-file__badge {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: #e7efff;
  font-size: 0;
  position: relative;
}

.document-inline-file__badge::after {
  content: "";
  position: absolute;
  inset: 0.45rem;
  background: #4f6ff0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.document-inline-file__name {
  min-width: 0;
  flex: 1;
  color: #1f2937;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-inline-file__size {
  flex-shrink: 0;
  color: #6b7280;
  font-size: 0.8rem;
}

body.image-lightbox-open {
  overflow: hidden;
}

.image-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
}

.image-lightbox-panel {
  position: relative;
  z-index: 1;
  display: flex;
  max-height: calc(100vh - 3rem);
  max-width: min(1100px, calc(100vw - 3rem));
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.image-lightbox-image {
  display: block;
  max-height: calc(100vh - 7rem);
  max-width: 100%;
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.image-lightbox-close {
  align-self: flex-end;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.14);
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.55rem 0.8rem;
}

.image-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.image-lightbox-caption {
  max-width: 70ch;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}

.connect-inline-file__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e7efff;
  color: #3457b2;
  font-size: 11px;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
}

.connect-inline-file__name {
  color: #1f2937;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connect-inline-file__size {
  color: #6b7280;
  font-size: 12px;
}

/* Default read-only rich text typography for guide/help style content. */
.app-rich-text-content,
.connect-guide-content {
  font-size: 1rem;
  line-height: 1.7;
}

.app-rich-text-content h2,
.connect-guide-content h2 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.app-rich-text-content h3,
.connect-guide-content h3 {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #334155;
}

.app-rich-text-content blockquote,
.connect-guide-content blockquote {
  margin: 0.75rem 0;
  border-left: 3px solid #93c5fd;
  padding: 0.35rem 0.85rem;
  color: #334155;
  background: #f8fbff;
}

.app-rich-text-content blockquote p:first-of-type::before,
.app-rich-text-content blockquote p:last-of-type::after,
.connect-guide-content blockquote p:first-of-type::before,
.connect-guide-content blockquote p:last-of-type::after {
  content: none;
}

.app-rich-text-content p,
.app-rich-text-content ul,
.app-rich-text-content ol,
.connect-guide-content p,
.connect-guide-content ul,
.connect-guide-content ol {
  margin-top: 0.45rem;
  margin-bottom: 0.45rem;
}

.app-rich-text-content .connect-inline-image-link,
.app-rich-text-content .connect-inline-image-figure,
.connect-guide-content .connect-inline-image-link,
.connect-guide-content .connect-inline-image-figure {
  max-width: min(100%, 46rem);
}

.app-rich-text-content .connect-inline-image,
.connect-guide-content .connect-inline-image {
  width: auto;
  max-height: 34rem;
  object-fit: contain;
}

/* Neutralize Lexxy editor wrapper styles inside the guide view so the
   prose/connect-guide-content typography wins. Without this, .lexxy-content's
   !important rules force padding: 24px, font-family: system, color: #333 etc. */
.app-rich-text-content .lexxy-content,
.connect-guide-content .lexxy-content,
[data-record-content] .lexxy-content {
  padding: 0 !important;
  color: inherit !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}

/* Desktop sidebar drag-resize / collapse */
@media (min-width: 768px) {
  /* Reveal the mobile-style top bar so its hamburger can re-expand a
     collapsed desktop sidebar. */
  body[data-sidebar-collapsed="true"] .mobile-top-bar {
    display: flex;
  }
}

/* Smooth snap animation when a drag is released onto a snap point. Only
   applied on desktop, and disabled while actively dragging so the pointer
   tracks width 1:1. */
@media (min-width: 768px) {
  body:not(.sidebar-is-resizing) aside[data-desktop-sidebar-target="sidebar"] {
    transition: width 200ms ease-in-out, transform 300ms ease-in-out;
  }
}

body.sidebar-is-resizing main {
  transition: none !important;
}
body.sidebar-is-resizing aside {
  transition: none !important;
}
