ui-state:not(:defined) { opacity: 0; }

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);
}

.docked-session-tab-edit {
  font-size: 12px;
  font-family: inherit;
  padding: 1px 4px;
  border: 1px solid var(--color-blue-400);
  border-radius: 3px;
  outline: none;
  background: white;
  color: var(--color-gray-900);
  width: 120px;
  max-width: 160px;
}

/* Spotlight (Cmd+K) */
.spotlight-modal {
  max-width: 560px;
  width: 90vw;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  margin-top: 20vh;
}

.spotlight-modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.spotlight-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-gray-200);
}

.spotlight-search-icon {
  width: 20px;
  height: 20px;
  color: var(--color-gray-400);
  flex-shrink: 0;
}

.spotlight-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  color: var(--color-gray-900);
}

.spotlight-input::placeholder {
  color: var(--color-gray-400);
}

.spotlight-kbd {
  font-size: 11px;
  font-family: inherit;
  padding: 2px 6px;
  border: 1px solid var(--color-gray-300);
  border-radius: 4px;
  color: var(--color-gray-400);
  background: var(--color-gray-50);
  flex-shrink: 0;
}

.spotlight-results {
  max-height: 360px;
  overflow-y: auto;
}

.spotlight-group {
  padding: 4px 0;
}

.spotlight-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-gray-400);
  padding: 8px 16px 4px;
}

.spotlight-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.1s;
}

.spotlight-result:hover,
.spotlight-result.--selected {
  background: var(--color-gray-100);
}

.spotlight-result-icon {
  width: 16px;
  height: 16px;
  color: var(--color-gray-400);
  flex-shrink: 0;
}

.spotlight-result-title {
  flex: 1;
  font-size: 14px;
  color: var(--color-gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotlight-result-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.spotlight-result-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--color-gray-100);
  color: var(--color-gray-500);
  border: 1px solid var(--color-gray-200);
  flex-shrink: 0;
}

.spotlight-result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.spotlight-result-description {
  font-size: 12px;
  color: var(--color-gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotlight-empty,
.spotlight-loading {
  padding: 20px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-gray-400);
}

/* Skill card highlight animation (when navigated via ?highlight=slug) */
[data-skill-slug].--highlighted {
  animation: skill-highlight-pulse 2s ease-out;
}

@keyframes skill-highlight-pulse {
  0% {
    background-color: var(--color-blue-100);
    box-shadow: 0 0 0 4px var(--color-blue-200);
  }
  100% {
    background-color: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Session space chip with dropdown */
.session-space-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--color-blue-50);
  border: 1px solid var(--color-blue-200);
  border-radius: 9999px;
  padding: 0 4px 0 0;
  font-size: 12px;
  line-height: 1;
}

.session-space-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: var(--color-blue-700);
  padding: 3px 4px 3px 8px;
  cursor: pointer;
  outline: none;
}

.session-space-select.--empty {
  color: var(--color-gray-500);
  font-size: 11px;
  padding: 3px 6px;
}

.session-space-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: none;
  background: none;
  color: var(--color-blue-400);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
}

.session-space-remove:hover {
  color: var(--color-blue-700);
  background: var(--color-blue-100);
}

/* ── Unified Avatar ── */

.ui-avatar {
  display: inline-flex;
  vertical-align: top;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: background 0.1s, color 0.1s, box-shadow 0.15s;
  background: var(--color-gray-100);
  color: var(--color-gray-500);
  /* Reset button defaults when rendered as <button> */
  border: none;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}

/* Shape variants */
.ui-avatar.--square { border-radius: 6px; }
.ui-avatar.--circle { border-radius: 50%; }

/* Size variants */
.ui-avatar.--sm { width: 20px; height: 20px; font-size: 9px; }
.ui-avatar.--md { width: 24px; height: 24px; font-size: 10px; }
.ui-avatar.--lg { width: 28px; height: 28px; font-size: 10px; }

/* States */
.ui-avatar:hover {
  background: var(--color-gray-200);
  color: var(--color-gray-700);
}
.ui-avatar.--active {
  background: var(--color-gray-900);
  color: white;
}

/* Journey avatar circles (legacy alias) */
.journey-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.journey-avatar:hover {
  box-shadow: 0 0 0 2px var(--color-gray-300);
}

/* Small variant for button groups */
.ui-button-group.--sm > * {
  height: var(--ui-button-height-sm);
  padding: var(--ui-button-padding-sm);
  font-size: var(--ui-shared-font-size-sm);
}

/* Small variant for dropdowns — preserve padding-inline-end for arrow */
.ui-dropdown.--sm .--trigger {
  height: var(--ui-button-height-sm);
  padding: var(--ui-button-padding-sm);
  padding-inline-end: 2.5rem;
  font-size: var(--ui-shared-font-size-sm);
}

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

/* ── Sidebar ── */

/* The ui-state wrapper around the sidebar must stretch to fill the flex container */
[component="resizable-sidebar"] {
  display: flex;
  flex-shrink: 0;
  height: 100%;
}

.ui-sidebar {
  width: var(--sidebar-width, 200px);
  border-right: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.ui-sidebar .--body {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  flex: 1;
}

.ui-sidebar .--group + .--group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--color-gray-200);
}

.ui-sidebar .--footer {
  border-top: 1px solid var(--color-gray-200);
  padding: 8px 0;
}

.ui-sidebar .--item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px;
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 6px;
  color: var(--color-gray-600);
  transition: background 0.1s, color 0.1s;
  text-decoration: none;
  overflow: hidden;
}

.ui-sidebar .--item span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ui-sidebar .--item:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-900);
}

.ui-sidebar .--item.active {
  background: var(--color-gray-900);
  color: white;
}

.ui-sidebar .--item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-gray-400);
}

.ui-sidebar .--item:hover svg {
  color: var(--color-gray-600);
}

.ui-sidebar .--item.active svg {
  color: white;
  opacity: 0.8;
}

/* Sidebar resize handle */
.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  z-index: 10;
}

.sidebar-resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  left: 2px;
  width: 2px;
  height: 100%;
  border-radius: 1px;
  transition: background 0.15s;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.--active::after {
  background: var(--color-gray-300);
}

/* ── Bookmarks ── */

.bookmark-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--color-gray-100);
  color: var(--color-gray-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  cursor: pointer;
}

.bookmark-avatar:hover {
  background: var(--color-gray-200);
  color: var(--color-gray-700);
}

.bookmark-avatar.active {
  background: var(--color-gray-900);
  color: white;
}

.bookmark-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-300);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}

.bookmark-toggle:hover {
  color: var(--color-gray-500);
  background: var(--color-gray-100);
}

.bookmark-toggle.active {
  color: var(--color-blue-500);
}

.bookmark-toggle.active:hover {
  color: var(--color-red-500);
  background: var(--color-red-50);
}

/* Collapsible sections in styled text (Streams, Activity log) */
.ui-styled-text details > summary {
  cursor: pointer;
  list-style: none;
}

.ui-styled-text details > summary::-webkit-details-marker {
  display: none;
}

.ui-styled-text details > summary h2 {
  display: inline;
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* Tweet embed component */
.tweet-embed {
  border: 1px solid var(--color-gray-200);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  background: white;
  font-size: 14px;
  line-height: 1.5;
}

.tweet-embed__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tweet-embed__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-gray-600);
  flex-shrink: 0;
}

.tweet-embed__author {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.tweet-embed__name {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-gray-900);
  line-height: 1.2;
}

.tweet-embed__handle {
  font-size: 13px;
  color: var(--color-gray-500);
  line-height: 1.2;
}

.tweet-embed__body {
  color: var(--color-gray-800);
  white-space: pre-wrap;
}

.tweet-embed__body blockquote {
  margin: 0;
  padding: 0;
  border: none;
  font-style: normal;
}

.tweet-embed__footer {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-gray-400);
}

.tweet-embed__footer a {
  color: var(--color-gray-400);
  text-decoration: none;
}

.tweet-embed__footer a:hover {
  color: var(--color-blue-500);
}

/* Markdown Editor Component — invisible editable surface */
.markdown-editor-surface .tiptap {
  outline: none;
}
.markdown-editor-content {
  outline: none;
  min-height: 80px;
}
/* Remove extra spacing from <p> inside list items */
.markdown-editor-surface li > p {
  margin: 0;
}

/* Diagnostics Widget Styles */
.diagnostics-widget-container {
  display: flex;
  align-items: center;
}

.diagnostics-widget {
  display: flex;
  align-items: flex-end;
  gap: 5.6px;
  height: 24px;
}

.diagnostics-widget.--loading {
  opacity: 0.6;
}

.diagnostics-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  width: 5.6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.diagnostics-indicator:focus {
  outline: none;
}

.diagnostics-bar-bg {
  width: 4.2px;
  height: 20px;
  background: var(--color-gray-200);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.diagnostics-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 4px;
  transition: height 0.3s ease, background-color 0.3s ease;
}

.diagnostics-loading {
  font-size: 10px;
  color: var(--color-gray-400);
  padding: 0 4px;
}