body {
  --ui-font-family: system-ui, sans-serif;
  --ui-font-family-headings: "Bricolage Grotesque", sans-serif;
}

/* Override base-styles overlay/display transitions on dialogs —
   these can break Chrome's compositor during htmx morphs,
   causing all hover/inspect highlighting to stop working */
dialog.ui-modal:not([open]) {
  transition: none;
  overlay: none;
}
dialog.ui-modal::backdrop {
  transition: none;
}
.ui-dropdown {
  & > [popover] {
    position-area: bottom center;
  }
  & > [popover].--anchor-right {
    position-area: bottom span-left;
  }
  .--trigger.--nobg {
    background-image: none;
  }
}
.border-b, .border-t {
  border-color: var(--color-gray-100);
}

/* Work Grid Component - Multi-pane layout for work page */
/* Pane styles */
.ui-work-grid__pane {
  overflow-y: auto;
  min-height: 0;
}

.ui-work-grid__pane.--sessions {
  background: var(--color-gray-50);
}

.ui-work-grid__pane.--chat {
  background: white;
}

.ui-work-grid__pane.--tasks {
  background: var(--color-gray-50);
}

/* Pane header */
.ui-work-grid__header {
  padding: 1rem;
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ui-work-grid__header-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-gray-700);
}

/* List item styles */
.ui-work-grid__item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-gray-100);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ui-work-grid__item:hover {
  background: var(--color-gray-100);
}

.ui-work-grid__item.--active {
  background: white;
  box-shadow: inset 3px 0 0 var(--color-blue-500);
}

.ui-work-grid__item-title {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-gray-900);
  margin-bottom: 0.25rem;
}

.ui-work-grid__item-meta {
  font-size: 0.75rem;
  color: var(--color-gray-500);
}

/* Floating Chats System */
.floating-chats-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: row-reverse;
  gap: 12px;
  align-items: flex-end;
  justify-content: flex-start;
  pointer-events: none;
}

.floating-chats-container > * {
  pointer-events: auto;
}

/* Minimized chat button */
.floating-chat-button {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #1f2937;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
  position: relative;
  border: none;
}

.floating-chat-button:hover {
  background: #111827;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.floating-chat-button.active {
  background: #2563eb;
}

/* Unread badge */
.floating-chat-button .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
}

/* Expanded chat panel */
.floating-chat-panel {
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 100px);
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease-out;
  position: relative;
}

/* Resize handle (top-left corner) */
.floating-chat-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 10;
  border-top-left-radius: 12px;
}

.floating-chat-resize-handle::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-left: 2px solid rgba(156, 163, 175, 0.5);
  border-top: 2px solid rgba(156, 163, 175, 0.5);
  border-top-left-radius: 2px;
  transition: border-color 0.15s;
}

.floating-chat-resize-handle:hover::before {
  border-left-color: rgba(59, 130, 246, 0.8);
  border-top-color: rgba(59, 130, 246, 0.8);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive: Smaller screens */
@media (max-width: 768px) {
  .floating-chats-container {
    bottom: 10px;
    left: 10px;
    right: 10px;
  }

  .floating-chat-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
  }
}

/* Line clamp utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Resizable Drawer */
.resizable-drawer-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resizable-drawer-handle:hover,
.resizable-drawer-handle.--active {
  background: rgba(59, 130, 246, 0.1);
}

.resizable-drawer-handle-line {
  width: 3px;
  height: 40px;
  background: var(--color-gray-300);
  border-radius: 2px;
  transition: background-color 0.15s, height 0.15s;
}

.resizable-drawer-handle:hover .resizable-drawer-handle-line,
.resizable-drawer-handle.--active .resizable-drawer-handle-line {
  background: var(--color-blue-500);
  height: 60px;
}

/* Docked Chat Panel (in-flow flex sibling) */
#session-panel-manager-state.--docked {
  border-left: 1px solid var(--color-gray-200);
  background: white;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}


.docked-chat-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.docked-chat-resize-handle:hover,
.docked-chat-resize-handle.--active {
  background: rgba(59, 130, 246, 0.1);
}

.docked-chat-resize-handle-line {
  width: 3px;
  height: 40px;
  background: var(--color-gray-300);
  border-radius: 2px;
  transition: background-color 0.15s, height 0.15s;
}

.docked-chat-resize-handle:hover .docked-chat-resize-handle-line,
.docked-chat-resize-handle.--active .docked-chat-resize-handle-line {
  background: var(--color-blue-500);
  height: 60px;
}

/* Docked session tabs */
.docked-session-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-gray-500);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  max-width: 120px;
  flex-shrink: 0;
  transition: color 0.1s, border-color 0.1s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.docked-session-tab:hover {
  color: var(--color-gray-700);
  background: var(--color-gray-100);
}

.docked-session-tab.--active {
  color: var(--color-blue-700);
  border-bottom-color: var(--color-blue-600);
}

.docked-session-tab.--minimized {
  opacity: 0.5;
}

.docked-session-tab-close {
  display: none;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-gray-400);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  flex-shrink: 0;
}

.docked-session-tab:hover .docked-session-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
}

.docked-session-tab-close:hover {
  color: var(--color-gray-700);
  background: var(--color-gray-200);
}

/* Fix icon alignment in tabnav buttons (base-styles uses justify-items which is grid-only) */
.ui-tabnav button,
.ui-tabnav a {
  align-items: center;
}