* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  height: 100vh;
  overflow: hidden;
}

.header {
  background: #141414;
  padding: 15px 20px;
  border-bottom: 1px solid #141414;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

h1 { 
  font-size: 20px;
  color: #fefefe;
}

#status {
  color: #fefefe;
  font-size: 13px;
}

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

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #fefefe;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-center span {
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Shared header button base */
.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid #fefefe;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #fefefe;
  font-weight: 500;
  transition: all 0.15s;
  height: 32px;
  box-sizing: border-box;
  white-space: nowrap;
}

.header-btn:hover {
  background: rgba(254, 254, 254, 0.1);
}

.header-btn i {
  font-size: 16px;
  line-height: 1;
  vertical-align: middle;
}

.header-btn span {
  line-height: 1;
  vertical-align: middle;
}

/* Specific button variants */
.explorer-toggle-btn {
  /* inherits from .header-btn */
}

.explorer-toggle-btn:hover {
  background: rgba(254, 254, 254, 0.1);
}

.explorer-toggle-btn.active {
  border-color: #ff6b9d;
  color: #ff6b9d;
  background: transparent;
}

.explorer-toggle-btn i {
  font-size: 16px;
}

/* Make active (close) button icon pink */
.explorer-toggle-btn.active i.ph {
  color: #ff6b9d;
}

.help-btn {
  /* inherits from .header-btn */
}

.help-btn:hover {
  background: rgba(254, 254, 254, 0.1);
}

.help-btn i {
  font-size: 16px;
}

/* All icons default to dark */
i.ph {
  color: #141414;
}

/* Save dropdown styles */
.save-dropdown {
  display: flex;
  position: relative;
}

.save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  background: #ec4899;
  border: 1px solid #ec4899;
  border-radius: 6px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  cursor: pointer;
  font-size: 13px;
  color: white;
  font-weight: 500;
  transition: all 0.15s;
  height: 32px;
  box-sizing: border-box;
  white-space: nowrap;
}

.save-btn:hover {
  background: #db2777;
  border-color: #db2777;
}

.save-btn i {
  font-size: 16px;
  color: white;
}

.save-dropdown-toggle {
  padding: 8px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255,255,255,0.2);
  background: #ec4899;
  border: 1px solid #ec4899;
  border-radius: 6px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  transition: all 0.15s;
}

.save-dropdown-toggle:hover {
  background: #db2777;
  border-color: #db2777;
}

.save-dropdown-toggle i {
  font-size: 16px;
  color: white;
}

.save-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  z-index: 100;
}

.save-dropdown-menu.open {
  display: block;
}

.save-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #ec4899;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.save-dropdown-item:hover {
  background: #db2777;
}

.save-dropdown-item i {
  font-size: 16px;
  color: white;
}

/* Header icons stay light */
.header i.ph {
  color: #fefefe;
}

/* Explicitly set icon colors in specific contexts */
.folder-header i.ph,
.file-explorer-header i.ph,
.bubble-menu i.ph {
  color: #141414;
}

.main-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* File Browser */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: white;
  border-right: 1px solid #141414;
  display: flex;
  flex-direction: column;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  opacity: 1;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  opacity: 0;
  border-right: none;
}

.file-explorer-header {
  padding: 16px 20px;
  border-bottom: 1px solid #141414;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: white;
}

.file-explorer-header i {
  font-size: 18px;
  color: #666;
}

.folder-accordion {
  flex: 1;
  overflow-y: auto;
}

.folder-section {
  border-bottom: 1px solid #eee;
}

.folder-header {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  text-transform: capitalize;
  transition: background 0.1s;
}

.folder-header:hover {
  background: #f8f8f8;
}

.folder-header.drag-over {
  background: #dbeafe;
  outline: 2px dashed #3b82f6;
  outline-offset: -2px;
}

.folder-header .chevron {
  font-size: 14px;
  color: #666;
  transition: transform 0.2s;
}

.folder-files {
  display: none;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 10px 44px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  transition: background 0.1s;
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-comment-badge {
  background-color: #d4145a;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  margin-left: 8px;
  flex-shrink: 0;
}

.file-item[draggable="true"] {
  cursor: grab;
}

.file-item[draggable="true"]:active {
  cursor: grabbing;
}

.file-item.dragging {
  opacity: 0.5;
}

.file-item:hover {
  background: #f8f8f8;
}

.file-item.active {
  background: rgba(212, 20, 90, 0.1);
  color: #d4145a;
  border-left: 3px solid #d4145a;
  padding-left: 41px;
}

/* AI Sidebar */
.ai-sidebar {
  width: 600px;
  min-width: 320px;
  max-width: 1000px;
  background: #fefefe;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Resize Handle */
.resize-handle {
  width: 1px;
  background: #141414;
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
}

/* Wider invisible hit area for easier grabbing */
.resize-handle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  right: -8px;
  bottom: 0;
  cursor: col-resize;
}

.resize-handle:hover {
  background: #ec4899;
}

.ai-chat {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.ai-icon-welcome {
  display: flex;
  justify-content: center;
  padding: 24px 0 16px 0;
  position: static;
  background: transparent;
}

.ai-icon-welcome i {
  font-size: 20px;
  color: #141414;
  width: 48px;
  height: 48px;
  background: #f5f5f5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-message {
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 0;
}

.ai-message.user {
  background: #fefefe;
  border: 1px solid #141414;
  padding: 12px 16px;
  border-radius: 12px;
  color: #141414;
  white-space: pre-wrap;
  margin: 8px 0;
  width: fit-content;
  max-width: 80%;
  align-self: flex-end;
  margin-left: auto;
}

.ai-message.assistant {
  /* No bubble styling - plain text like Claude.ai */
  margin-right: 20px;
  color: #141414;
}

/* Markdown content styling for AI messages */
.markdown-content {
  line-height: 1.4;
  white-space: normal;
}

/* Aggressive margin reset */
.markdown-content * {
  margin: 0;
  padding: 0;
}

.markdown-content p {
  margin-bottom: 2px;
  line-height: 1.5;
}

.markdown-content p:last-child {
  margin-bottom: 0;
}

.markdown-content strong {
  font-weight: 600;
  color: #141414;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content ul,
.markdown-content ol {
  margin: 2px 0;
  padding-left: 20px;
}

.markdown-content hr {
  margin: 20px 0;
  padding: 0;
  border: none;
  border-top: 1px solid #e5e5e5;
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ol {
  list-style-type: decimal;
}

.markdown-content ul li,
.markdown-content ol li {
  margin: 4px 0 !important;
  padding: 0 0 0 4px !important;
  line-height: 1.3 !important;
  height: auto !important;
  min-height: 0 !important;
}

.markdown-content code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  font-family: 'Monaco', 'Courier New', monospace;
  color: #d4145a;
}

.markdown-content pre {
  background: #f5f5f5;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: #141414;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  font-weight: 600;
  margin: 12px 0 8px 0;
}

.markdown-content h1 {
  font-size: 18px;
}

.markdown-content h2 {
  font-size: 16px;
}

.markdown-content h3 {
  font-size: 15px;
}

.markdown-content h4 {
  font-size: 14px;
}

.markdown-content blockquote {
  border-left: 3px solid #ec4899;
  padding-left: 12px;
  margin: 8px 0;
  color: #666;
}

/* Table styling */
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  table-layout: fixed;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #e5e5e5;
  padding: 8px;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.markdown-content th {
  background: #f5f5f5;
  font-weight: 600;
  color: #141414;
}

.markdown-content td {
  background: #ffffff;
}

.markdown-content tr:hover td {
  background: #fafafa;
}

.markdown-content a {
  color: #ec4899;
  text-decoration: underline;
}

.markdown-content a:hover {
  color: #db2777;
}

/* INSERT block styles */
.insert-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 1rem 0;
}

.insert-context {
  font-size: 12px;
  color: #6b7280;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #f3e8ff;
}

.insert-context .context-label {
  color: #9ca3af;
}

.insert-context .context-filename {
  color: #7c3aed;
  font-weight: 500;
}

.insert-content {
  background: #fdf2f8;
  border: 1px dashed #ec4899;
  border-radius: 8px;
  padding: 1rem;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.insert-content > *:first-child {
  margin-top: 0;
}

.insert-content > *:last-child {
  margin-bottom: 0;
}

.insert-content p {
  margin: 0.75rem 0;
}

.insert-content ul,
.insert-content ol {
  margin: 0.75rem 0;
}

.insert-apply-btn {
  align-self: flex-end;
  background: #ec4899;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
  margin-top: 0.5rem;
}

.insert-apply-btn:hover {
  background: #db2777;
}

.insert-apply-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.insert-apply-btn:disabled:hover {
  background: #9ca3af;
}

.insert-apply-btn[data-state="applied"] {
  background: #10b981;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.insert-apply-btn[data-state="applied"]:hover {
  background: #059669;
}

.undo-link {
  text-decoration: underline;
  cursor: pointer;
}

.undo-link:hover {
  opacity: 0.8;
}

.clear-chat-container {
  position: sticky;
  bottom: 0;
  padding: 8px;
  display: flex;
  justify-content: flex-end;
  background: transparent;
  pointer-events: none;
  margin-top: auto;
}

.clear-chat-btn {
  pointer-events: auto;
  border: none;
  background: #f5f5f5;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.clear-chat-btn:hover {
  color: #6b7280;
  background: #f9fafb;
}

.clear-chat-btn:active {
  color: #1f2937;
}

.ai-input-area {
  position: relative;
  padding: 12px;
  border-top: 1px solid #141414;
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-input-area input {
  flex: 1;
  padding: 12px 48px 12px 12px;
  border: 1px solid #141414;
  border-radius: 8px;
  background: #fefefe;
  font-size: 14px;
  color: #1f2937;
}

.create-issues-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #ec4899;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.create-issues-btn:hover {
  background: #db2777;
}

.create-issues-btn:active {
  transform: scale(0.98);
}

.create-issues-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.create-issues-btn:disabled:hover {
  background: #9ca3af;
  transform: none;
}

.ai-input-area input:focus {
  outline: none;
  border-color: #ec4899;
}

.ai-input-area input::placeholder {
  color: #9ca3af;
}

.send-btn-inline {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
}

.send-btn-inline:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.send-btn-inline:active {
  background: #e5e7eb;
  transform: translateY(-50%) scale(0.95);
}

.send-btn-inline:disabled {
  color: #d1d5db;
  cursor: not-allowed;
}

.send-btn-inline:disabled:hover {
  background: transparent;
}

/* Save button */
#saveBtn {
  background: #d4145a;
  border: 1px solid #d4145a;
}

#saveBtn:hover {
  background: #b01149;
  border-color: #b01149;
}

#saveBtn:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Main Content - contains editor and comments panel */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Editor Area */
.editor-area {
  flex: 1;
  min-width: 600px;
  display: flex;
  flex-direction: column;
  background: white;
  overflow: hidden;
  transition: flex 0.2s ease;
}

.editor-area.comments-open {
  flex: 1 1 0;
}

/* Legacy class name support */
.editor-container {
  flex: 1;
  min-width: 600px;
  display: flex;
  flex-direction: column;
  background: white;
  overflow: hidden;
  transition: flex 0.2s ease;
}

.editor-container.comments-open {
  flex: 1 1 0;
}

/* Section Navigation */
.section-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
  background: #fafafa;
  border-bottom: 1px solid #e5e5e5;
  container-type: inline-size;
}

.version-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  background: #3a3a3a;
  border: 1px solid #555;
  border-radius: 4px;
  color: #e0e0e0;
  font-family: monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.section-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
}

/* Toolbar icons on the right */
.toolbar-right-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* History icon button */
.toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  padding: 0;
  color: #666;
  min-width: 24px;
  height: 24px;
}

.toolbar-icon-btn:hover {
  color: #0969da;
  transform: scale(1.1);
}

.toolbar-icon-btn i {
  font-size: 18px;
}

/* Milestone button for "Ready for development" */
.milestone-button-container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  margin-left: 12px;
}

.milestone-button {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.milestone-button:not(:disabled):hover {
  color: #ec4899;
}

.milestone-button-container:not(.disabled):not(.completed):hover {
  border-color: #ec4899;
  background: #fdf2f8;
}

.milestone-button-container.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f5f5f5;
}

.milestone-button:disabled {
  cursor: not-allowed;
  color: #999;
}

/* Completed milestone state (v1.0 reached) */
.milestone-button-container.completed {
  background: #f0fdf4;
  border-color: #16a34a;
  cursor: default;
}

.milestone-button-container.completed:hover {
  background: #f0fdf4 !important;
  border-color: #16a34a !important;
  cursor: default !important;
}

.milestone-button-container.completed .milestone-icon {
  color: #16a34a;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.milestone-button-container.completed .milestone-label {
  color: #166534;
  cursor: default;
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  user-select: none;
}

.milestone-button-container.completed:hover .milestone-label {
  color: #166534 !important;
  cursor: default !important;
}

.section-nav-item {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.section-nav-item:hover {
  background: #fff;
  border-color: #e5e5e5;
  color: #333;
}

.section-nav-item.active {
  background: #fff;
  border-color: #ec4899;
  color: #ec4899;
}

.section-nav-item.complete {
  background: #f0fdf4;
  border-color: #16a34a;
  color: #166534;
}

.section-nav-item.complete.active {
  background: #dcfce7;
  border-color: #16a34a;
  color: #166534;
}

@container (max-width: 750px) {
  .section-nav {
    gap: 3px;
  }
  .section-nav-item {
    padding: 4px 8px;
    font-size: 12px;
  }
}

.editor {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

/* TipTap Editor */
.ProseMirror {
  padding: 40px;
  outline: none;
  min-height: 100%;
  font-size: 15px;
  line-height: 1.6;
}

.ProseMirror h1 { 
  font-size: 32px; 
  font-weight: 700; 
  margin: 24px 0 16px 0; 
  color: #141414;
  line-height: 1.2;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: none;
  padding: 0;
}

.ProseMirror h2 { 
  font-size: 1.5em; 
  font-weight: 600; 
  margin: 1.5em 0 0.5em; 
  line-height: 1.3;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: none;
  padding: 0;
}

.ProseMirror h3 { 
  font-size: 1.25em; 
  font-weight: 600; 
  margin: 1.25em 0 0.5em; 
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: none;
  padding: 0;
}

.ProseMirror h4 {
  font-size: 14px;
  font-weight: 600;
  color: #141414;
  margin: 1rem 0 0.5rem 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: none;
  line-height: 1.4;
}

.ProseMirror p { 
  margin: 0.75em 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: none;
  padding: 0;
}

.ProseMirror ul, .ProseMirror ol { 
  margin: 0.75em 0; 
  padding-left: 2em;
}

.ProseMirror li { 
  margin: 0.25em 0;
}

.ProseMirror li p { 
  margin: 0.25em 0;
}

.ProseMirror strong { 
  font-weight: 600;
}

.ProseMirror em { 
  font-style: italic;
}

.ProseMirror code { 
  background: #f5f5f5; 
  padding: 2px 6px; 
  border-radius: 3px; 
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

.ProseMirror pre {
  background: #f5f5f5;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1em 0;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

.ProseMirror pre code {
  background: none;
  padding: 0;
}

.ProseMirror table {
  border-collapse: collapse;
  margin: 1.5em 0;
  width: 100%;
  position: relative;
}

.ProseMirror th, .ProseMirror td {
  border: 1px solid #141414;
  padding: 10px 14px;
  text-align: left;
  min-width: 100px;
  position: relative;
}

.ProseMirror th {
  background: #f9f9f9;
  font-weight: 600;
  position: relative;
}

.ProseMirror .column-resize-handle {
  position: absolute;
  right: -8px;
  top: 0;
  bottom: 0;
  width: 16px;
  background-color: transparent;
  cursor: col-resize;
}

.ProseMirror .column-resize-handle:hover {
  background-color: rgba(0, 102, 204, 0.1);
}

/* Comment highlight in editor */
.ProseMirror span.comment-highlight {
  background-color: rgba(250, 204, 21, 0.35);
}

.ProseMirror span.comment-highlight:hover {
  background-color: rgba(250, 204, 21, 0.5);
}

.ProseMirror hr {
  border: none;
  border-top: 2px solid #e5e5e5;
  margin: 3em 0;
}

/* Floating bubble menu */
.bubble-menu {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.1s;
  display: flex;
  background: white;
  border: 1px solid #141414;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 4px;
  gap: 2px;
}

.bubble-menu button {
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.bubble-menu button:hover {
  background: #f5f5f5;
}

.bubble-menu button.is-active {
  background: rgba(212, 20, 90, 0.1);
  color: #d4145a;
}

.bubble-menu button i {
  font-size: 18px;
}

.bubble-menu .divider {
  width: 1px;
  height: 24px;
  background: #e0e0e0;
  margin: 0 4px;
}

/* Heading dropdown */
.heading-dropdown {
  position: relative;
  display: inline-block;
}

.heading-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid #141414;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 140px;
  z-index: 1000;
}

.heading-dropdown-content.show {
  display: block;
}

.heading-dropdown-content button {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
}

.heading-dropdown-content button:hover {
  background: #f5f5f5;
}

/* Slash command menu */
.slash-menu {
  position: absolute;
  background: white;
  border: 1px solid #141414;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 200px;
  z-index: 1000;
}

.slash-menu-item {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.slash-menu-item:hover, .slash-menu-item.selected {
  background: #f5f5f5;
}

.slash-menu-item .label {
  font-weight: 500;
}

.slash-menu-item .desc {
  font-size: 12px;
  color: #999;
}

/* Link popover */
.link-popover {
  display: none;
  position: fixed;
  background: white;
  border: 1px solid #141414;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 12px;
  min-width: 320px;
  max-width: 400px;
  z-index: 2000;
}

.link-popover-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #141414;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.link-input:focus {
  outline: none;
  border-color: #d4145a;
}

.link-results {
  display: none;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-top: 4px;
}

.link-results-header {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
}

.link-result-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.link-result-item:hover {
  background: #f5f5f5;
}

.link-result-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 2px;
}

.link-result-folder {
  font-size: 12px;
  color: #666;
}

.link-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.link-cancel,
.link-apply {
  padding: 6px 16px;
  border: 1px solid #141414;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s;
}

.link-cancel {
  background: white;
  color: #333;
}

.link-cancel:hover {
  background: #f5f5f5;
}

.link-apply {
  background: #d4145a;
  color: #fefefe;
  border-color: #d4145a;
}

.link-apply:hover {
  background: #b01149;
  border-color: #b01149;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 14px;
}

.loading { 
  padding: 16px;
  color: #666; 
  font-style: italic; 
  font-size: 13px;
}

#status { 
  color: #666; 
  font-size: 13px; 
}

/* Placeholder */
.ProseMirror p.is-editor-empty:first-child::before {
  content: "Type '/' for commands...";
  color: #aaa;
  pointer-events: none;
  height: 0;
  float: left;
}

/* Table context menu */
.table-context-menu {
  display: none;
  position: fixed;
  background: white;
  border: 1px solid #141414;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 180px;
  z-index: 2000;
}

.table-context-item {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  color: #333;
}

.table-context-item:hover {
  background: #f5f5f5;
}

.table-context-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 4px 0;
}

/* Modal styles */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(20, 20, 20, 0.8); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: white; border: 1px solid #141414; border-radius: 8px; width: 90%; max-width: 500px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
.modal-large { max-width: 800px; max-height: 90vh; }
.modal-large .modal-body { max-height: calc(90vh - 140px); overflow-y: auto; }
.modal-header { padding: 20px; border-bottom: 1px solid #141414; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 600; color: #141414; }
.modal-close { background: none; border: none; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; }
.modal-close i { font-size: 20px; color: #141414; }
.modal-body { padding: 20px; }
.modal-body label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; color: #141414; }
.modal-body label:not(:first-child) { margin-top: 16px; }
.modal-body input[type="text"], .modal-body select { width: 100%; padding: 10px 12px; border: 1px solid #141414; border-radius: 6px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
.modal-body textarea, #changelogEntry { width: 100%; min-height: 100px; padding: 12px; font-size: 14px; border: 1px solid #d1d5db; border-radius: 6px; resize: vertical; font-family: inherit; box-sizing: border-box; line-height: 1.5; }
#changelogEntry { margin-bottom: 8px; }
.modal-body select { width: 100%; padding: 10px 36px 10px 12px; border: 1px solid #141414; border-radius: 6px; font-size: 14px; font-family: inherit; box-sizing: border-box; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%23141414' d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; }
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { outline: none; border-color: #d4145a; box-shadow: 0 0 0 3px rgba(212, 20, 90, 0.1); }
.modal-body select:focus { outline: none; border-color: #d4145a; box-shadow: 0 0 0 3px rgba(212, 20, 90, 0.1); }
.modal-hint { margin-top: 8px; font-size: 13px; color: #666; font-style: italic; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #141414; display: flex; justify-content: flex-end; gap: 12px; }
.segmented-control { display: flex; gap: 0; margin-bottom: 20px; border: 1px solid #141414; border-radius: 6px; overflow: hidden; }
.segment-btn { flex: 1; padding: 10px 16px; background: white; color: #141414; border: none; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.15s; border-right: 1px solid #141414; }
.segment-btn:last-child { border-right: none; }
.segment-btn:hover:not(.active) { background: rgba(212, 20, 90, 0.05); }
.segment-btn.active { background: #d4145a; color: #fefefe; }
.btn-secondary { padding: 8px 16px; background: white; color: #141414; border: 1px solid #141414; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-secondary:hover { background: #f5f5f5; }
.btn-primary { padding: 8px 16px; background: #d4145a; color: #fefefe; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-primary:hover { background: #b01149; }
.btn-primary:disabled { background: #999; cursor: not-allowed; }
.btn-danger { padding: 8px 16px; background: #d4145a; color: #fefefe; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-danger:hover { background: #b01149; }
.btn-danger:disabled { background: #999; cursor: not-allowed; }
.btn-outline-danger {
  /* inherits from .header-btn */
  border-color: #fefefe;
}

.btn-outline-danger:hover {
  background: #d4145a;
  border-color: #d4145a;
}

.btn-outline-danger i {
  font-size: 16px;
  color: #fefefe;
}
.new-crd-btn { padding: 10px 20px 10px 44px; margin: 0; background: transparent; border: none; border-bottom: 1px solid #f5f5f5; cursor: pointer; font-size: 13px; color: #666; font-weight: 500; display: flex; align-items: center; gap: 8px; transition: all 0.15s; width: 100%; text-align: left; }
.new-crd-btn:hover { background: rgba(212, 20, 90, 0.05); color: #d4145a; }
.new-crd-btn i { font-size: 16px; color: #666; }
.new-crd-btn:hover i { color: #d4145a; }

/* Help modal content styles */
#helpContent { font-size: 14px; line-height: 1.6; }
#helpContent h1 { font-size: 24px; margin: 0 0 16px 0; color: #141414; }
#helpContent h2 { font-size: 18px; margin: 24px 0 12px 0; color: #141414; border-bottom: 1px solid #141414; padding-bottom: 8px; }
#helpContent h3 { font-size: 16px; margin: 16px 0 8px 0; color: #141414; }
#helpContent p { margin: 8px 0; color: #333; }
#helpContent ul, #helpContent ol { margin: 8px 0 8px 20px; }
#helpContent code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; font-family: 'Monaco', 'Courier New', monospace; font-size: 13px; }
#helpContent pre { background: #f5f5f5; padding: 12px; border-radius: 6px; overflow-x: auto; border: 1px solid #141414; }
#helpContent table { border-collapse: collapse; width: 100%; margin: 12px 0; }
#helpContent th, #helpContent td { border: 1px solid #141414; padding: 8px 12px; text-align: left; }
#helpContent th { background: #f5f5f5; font-weight: 600; }
#helpContent strong { font-weight: 600; color: #141414; }

/* Task lists - matching TipTap's actual rendered structure */
ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0;
  margin: 16px 0;
}

li.task-item-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  padding: 0;
}

li.task-item-wrapper > label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

li.task-item-wrapper > label > input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

li.task-item-wrapper > label > span {
  display: none;
}

li.task-item-wrapper > div {
  flex: 1;
}

li.task-item-wrapper > div > p {
  margin: 0;
}

/* v1.0 Milestone Gate Styling */
li.task-item-wrapper[data-milestone-gate="true"] {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 12px;
  margin: 16px 0;
  border-radius: 6px;
}

li.task-item-wrapper[data-milestone-gate="true"] > div > p {
  font-weight: 600;
  color: #92400e;
}

/* Disabled state when prerequisites not met */
li.task-item-wrapper[data-milestone-disabled="true"] {
  background: #f3f4f6;
  border-left-color: #9ca3af;
}

li.task-item-wrapper[data-milestone-disabled="true"] > div > p {
  color: #6b7280;
}

/* Inline status message below milestone checkbox */
.milestone-status-message {
  font-size: 12px;
  margin-top: 6px;
  padding-left: 24px;
  font-style: italic;
}

/* Regular bullet lists */
ul:not([data-type="taskList"]) {
  list-style: disc;
  padding-left: 24px;
  margin: 12px 0;
}

ul:not([data-type="taskList"]) li {
  margin: 4px 0;
  padding-left: 4px;
}

/* Make links visually clickable */
.ProseMirror a {
  color: #d4145a;
  text-decoration: underline;
  cursor: pointer;
}

.ProseMirror a:hover {
  color: #b01149;
}

/* Save status indicator */
.save-status {
  font-size: 12px;
  color: #666;
  margin-left: 8px;
  font-style: italic;
}

.save-status.saving {
  color: #d4145a;
}

.save-status.saved {
  color: #4caf50;
}

.save-status.error {
  color: #f44336;
}

/* AI Chat typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #ec4899;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

/* AI Sidebar transitions */
.ai-sidebar {
  transition: width 0.3s ease;
}

/* AI message improvements */
.ai-message {
  transition: all 0.2s ease;
}

.ai-message:hover {
  background: rgba(255,255,255,0.05);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #141414;
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 10000;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success {
  background: #10b981;
}

.toast.toast-error {
  background: #ef4444;
}

.toast.toast-info {
  background: #3b82f6;
}