/* Prompts Panel CSS - componentized from prompts.html */

/* Prompt sidebar (inside prompts panel) */
#prompts-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  --pe-editor-shell-bg: #171822;
  --pe-editor-paper-bg: var(--bg);
  --pe-editor-paper-fg: #d1d5e8;
  --pe-editor-paper-muted: var(--fg-dim);
  --pe-editor-paper-border: var(--border);
  --pe-editor-paper-shadow: 0 1px 3px rgba(0,0,0,0.2);
  --pe-editor-code-bg: var(--bg-lighter);
  --pe-editor-code-border: rgba(59, 66, 97, 0.5);
  --pe-editor-quote-bg: rgba(122, 162, 247, 0.04);
  --pe-editor-selection-bg: rgba(122, 162, 247, 0.32);
  --pe-editor-selection-fg: inherit;
  --pe-editor-focus-shadow: 0 0 0 3px var(--focus-ring), var(--pe-editor-paper-shadow);
}
#prompts-panel.active { display: flex; }

html[data-theme="light"] #prompts-panel {
  --pe-editor-shell-bg: #eef1f6;
  --pe-editor-paper-bg: #ffffff;
  --pe-editor-paper-fg: var(--fg);
  --pe-editor-paper-muted: var(--fg-dim);
  --pe-editor-paper-border: rgba(15,23,42,0.10);
  --pe-editor-paper-shadow: 0 22px 48px rgba(15,23,42,0.10), 0 1px 2px rgba(15,23,42,0.06);
  --pe-editor-code-bg: #f3f5f8;
  --pe-editor-code-border: rgba(15,23,42,0.10);
  --pe-editor-quote-bg: rgba(59,102,224,0.075);
  --pe-editor-selection-bg: #dbeafe;
  --pe-editor-selection-fg: #0f172a;
}

#prompts-panel-inner {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Prompt sub-topbar */
.prompts-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.prompts-topbar .btn { font-size: 11px; padding: 3px 10px; }

/* Prompt sidebar */
#prompt-sidebar {
  width: 280px;
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-header .search-row { display: flex; gap: 4px; }
.sidebar-header input {
  flex: 1;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 11px;
  outline: none;
}
.sidebar-header input:focus { border-color: var(--accent); }
.prompt-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px 32px 32px;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.prompt-filter-row .prompt-filter-select {
  min-width: 0;
  width: 100%;
  height: 28px;
}
.prompt-filter-row .prompt-filter-icon-btn {
  width: 32px;
  min-width: 32px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
  line-height: 1;
}
.prompt-filter-row .prompt-create-folder-btn {
  font-size: 15px;
  font-weight: 700;
}
.sidebar-header input.ai-active {
  border-color: var(--purple, #bb9af7);
  background: rgba(187, 154, 247, 0.08);
}
.pe-ai-search-toggle {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  padding: 4px 7px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s;
}
.pe-ai-search-toggle:hover { border-color: var(--purple, #bb9af7); color: var(--purple, #bb9af7); }
.pe-ai-search-toggle.active {
  background: var(--purple, #bb9af7);
  border-color: var(--purple, #bb9af7);
  color: #1a1b26;
}
.ai-result-reason {
  font-size: 10px;
  color: var(--purple, #bb9af7);
  margin-top: 2px;
  line-height: 1.3;
  font-style: italic;
}
.ai-result-score {
  font-size: 9px;
  background: var(--purple, #bb9af7);
  color: #1a1b26;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
  flex-shrink: 0;
}
.pe-ai-searching {
  padding: 16px;
  text-align: center;
  color: var(--fg-dim);
  font-size: 12px;
}
.pe-ai-searching .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--purple, #bb9af7);
  border-radius: 50%;
  animation: pe-spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes pe-spin { to { transform: rotate(360deg); } }

/* Folder tree */
.folder-tree {
  flex: 0 0 auto;
  overflow-y: auto;
  padding: 4px 6px;
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 2px;
  transition: background 0.1s;
  position: relative;
}
.folder-item:hover { background: var(--bg-lighter); }
.folder-item.active { background: var(--accent); color: #1a1b26; }
.folder-item .folder-icon { font-size: 14px; }
.folder-item .folder-count {
  margin-left: auto;
  font-size: 10px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 8px;
  color: var(--fg-dim);
}
.folder-item .folder-actions {
  display: none;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}
.folder-item:hover .folder-actions { display: flex; }
.folder-item:hover .folder-count { display: none; }
.folder-item .folder-actions .act-btn {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
  transition: all 0.1s;
}
.folder-item .folder-actions .act-btn:hover { background: var(--bg); color: var(--fg); }
.folder-item.drag-over { border-top: 2px solid var(--accent); }
.folder-item .drag-handle {
  cursor: grab;
  color: var(--fg-dim);
  opacity: 0;
  font-size: 10px;
  flex-shrink: 0;
  user-select: none;
}
.folder-item:hover .drag-handle { opacity: 0.5; }
.folder-item .drag-handle:hover { opacity: 1; }
.folder-rename-input {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  outline: none;
  width: 100%;
}

/* Prompt list */
.prompt-list {
  border-top: 1px solid var(--border);
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.prompt-item {
  padding: 8px 8px 8px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 3px;
  border-left: 3px solid transparent;
  transition: background 0.1s;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.prompt-item:hover { background: var(--bg-lighter); }
.prompt-item.active { background: var(--bg-lighter); border-left-color: var(--accent); }
.prompt-item.pinned { border-left-color: var(--yellow); }
.prompt-item.active.pinned { border-left-color: var(--yellow); }
.prompt-item.drag-over-above { box-shadow: 0 -2px 0 0 var(--accent); }
.prompt-item.drag-over-below { box-shadow: 0 2px 0 0 var(--accent); }
.prompt-item.drag-group {
  outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px;
  background: rgba(122,162,247,0.12);
}
.prompt-item.drag-group::after {
  content: 'Drop to group'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 9px; color: var(--accent); background: var(--bg); padding: 2px 8px;
  border-radius: 4px; border: 1px solid var(--accent); pointer-events: none; z-index: 2;
}
.prompt-item.drag-over-above::after, .prompt-item.drag-over-below::after {
  content: ''; /* clear group label */
}

/* Lifecycle section headers */
.lc-section-header {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px 4px 8px; margin-top: 2px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--fg-dim); user-select: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 3;
}
.lc-section-header:hover { background: var(--bg-light); }
.lc-section-chevron { font-size: 8px; width: 10px; color: var(--fg-dim); }
.lc-section-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.lc-section-label { flex: 1; }
.lc-section-count {
  font-size: 9px; font-weight: 500; color: var(--fg-dim);
  background: var(--bg-lighter); padding: 0 5px; border-radius: 8px;
}

/* Tree grouping */
.prompt-group { margin-bottom: 2px; }
.prompt-group .group-header {
  display: flex; align-items: center; gap: 0; position: relative;
}
/* Chevron overlaps the drag-handle area so group parent aligns with regular items */
.prompt-group .group-toggle {
  position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2;
}
.prompt-group .group-chevron {
  font-size: 7px; color: var(--fg-dim); transition: transform 0.15s;
}
.prompt-group.expanded .group-chevron { transform: rotate(90deg); }
.prompt-group .group-header .prompt-item { flex: 1; }
.prompt-group .group-header .prompt-item .drag-handle { visibility: hidden; }
.prompt-group .group-badge {
  position: absolute; right: 4px; top: 4px;
  font-size: 9px; color: var(--fg-dim); background: var(--bg-lighter); padding: 1px 6px;
  border-radius: 8px; pointer-events: none; z-index: 1;
}
.prompt-group .group-children {
  display: none; padding-left: 8px;
  border-left: 1px solid var(--border); margin-left: 10px; margin-top: -2px;
}
.prompt-group.expanded .group-children { display: block; }
.prompt-group .group-children .prompt-item { font-size: 11px; padding: 5px 8px 5px 6px; }
.prompt-group .group-children .prompt-item .prompt-meta { font-size: 9px; }
.group-add-child {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; margin: 2px 0;
  font-size: 11px; color: var(--fg-dim);
  cursor: pointer; border-radius: 4px;
  transition: all 0.15s;
}
.group-add-child:hover { color: var(--accent); background: var(--bg-lighter); }
.group-add-child span { font-size: 13px; font-weight: 600; }

/* Children panel (composite prompt view in editor) */
#pe-children-panel {
  margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px;
}
.children-panel-loading {
  padding: 12px; text-align: center; color: var(--fg-dim); font-size: 12px;
}
.children-panel-header {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; padding: 0 4px;
}
.children-panel-title {
  font-size: 12px; font-weight: 600; color: var(--fg);
}
.children-panel-hint {
  font-size: 10px; color: var(--fg-dim); font-style: italic;
}
.children-panel-list {
  display: flex; flex-direction: column; gap: 6px;
}
.children-panel-item {
  display: flex; gap: 10px; padding: 8px 10px; border-radius: 6px;
  background: var(--bg-lighter); cursor: pointer; transition: background 0.15s;
}
.children-panel-item:hover { background: var(--bg-hover, rgba(255,255,255,0.06)); }
.children-panel-item-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent, #7aa2f7); color: var(--bg); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.children-panel-item-body { flex: 1; min-width: 0; }
.children-panel-item-title {
  font-size: 12px; font-weight: 600; color: var(--fg); margin-bottom: 2px;
}
.children-panel-item-preview {
  font-size: 11px; color: var(--fg-dim); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Group creation placeholder (skeleton loading) */
.prompt-group-creating {
  padding: 8px 12px; margin-bottom: 2px; border-radius: 6px;
  background: var(--bg-lighter); position: relative; overflow: hidden;
}
.prompt-group-creating::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 200%; height: 100%;
  background: linear-gradient(90deg, transparent 25%, rgba(122,162,247,0.08) 50%, transparent 75%);
  animation: pe-shimmer 1.5s infinite;
}
@keyframes pe-shimmer { to { transform: translateX(50%); } }
.prompt-group-creating .skeleton-header {
  display: flex; align-items: center; gap: 8px;
}
.prompt-group-creating .skeleton-icon {
  width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--purple, #bb9af7); border-radius: 50%;
  animation: pe-spin 0.6s linear infinite;
}
.prompt-group-creating .skeleton-title {
  font-size: 11px; color: var(--fg-dim);
}
.prompt-group-creating .skeleton-bar {
  height: 6px; border-radius: 3px; background: var(--border); margin-top: 6px; width: 60%;
}

/* Drop zone for ungrouping */
.ungroup-drop-zone {
  display: none; padding: 6px; text-align: center; font-size: 10px;
  color: var(--fg-dim); border: 1px dashed var(--border); border-radius: 6px;
  margin: 4px 0; transition: all 0.2s;
}
.ungroup-drop-zone.visible { display: block; }
.ungroup-drop-zone.drag-over { border-color: var(--accent); background: rgba(122,162,247,0.08); color: var(--accent); }
.prompt-item .drag-handle {
  cursor: grab;
  color: var(--fg-dim);
  opacity: 0;
  font-size: 10px;
  padding: 2px 0;
  flex-shrink: 0;
  user-select: none;
  transition: opacity 0.1s;
}
.prompt-item:hover .drag-handle { opacity: 0.5; }
.prompt-item .drag-handle:hover { opacity: 1; }
.prompt-item .prompt-content { flex: 1; min-width: 0; }
.prompt-item .prompt-title {
  font-weight: 500;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt-item .prompt-meta {
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: var(--fg-dim);
}
.prompt-item .prompt-meta .tag {
  background: var(--bg);
  padding: 0 5px;
  border-radius: 3px;
}
.prompt-item .prompt-actions {
  display: none;
  gap: 2px;
  flex-shrink: 0;
}
.prompt-item:hover .prompt-actions { display: flex; }
.prompt-item .prompt-actions .act-btn {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1;
  transition: all 0.1s;
}
.prompt-item .prompt-actions .act-btn:hover { background: var(--bg); color: var(--fg); }
.prompt-item .prompt-actions .act-btn.pin-active { color: var(--yellow); }
.prompt-item.starred .prompt-title::before { content: '\2605 '; color: var(--yellow); }
.prompt-item .pin-badge { color: var(--yellow); font-size: 10px; margin-right: 2px; }

/* Multi-select bulk bar */
#pe-bulk-bar { background: var(--bg-lighter); font-size: 11px; }
#pe-bulk-bar .btn { font-size: 10px; padding: 2px 8px; }
.pe-select-cb { accent-color: var(--accent); width: 14px; height: 14px; flex-shrink: 0; }

/* Editor area */
#pe-editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Editor toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.toolbar-group {
  display: flex;
  gap: 2px;
  padding-right: 10px;
  border-right: 1px solid var(--border);
  margin-right: 6px;
}
.toolbar-group:last-child { border-right: none; }
.toolbar-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--fg-dim);
  padding: 5px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.12s;
}
.toolbar-btn:hover { background: var(--bg-lighter); color: var(--fg); }
.toolbar-btn.active { background: var(--accent); color: #1a1b26; }
#pe-nav-back, #pe-nav-fwd { font-size: 16px; padding: 3px 8px; }
#pe-nav-back:disabled, #pe-nav-fwd:disabled { opacity: 0.25; cursor: default; }
#pe-nav-back:not(:disabled), #pe-nav-fwd:not(:disabled) { color: var(--accent); }
#pe-nav-back:not(:disabled):hover, #pe-nav-fwd:not(:disabled):hover { background: var(--accent); color: #1a1b26; }

/* Meta bar (title, tags, context type) */
.pe-meta-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
  flex-shrink: 0;
}
.pe-meta-bar input {
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 17px;
  font-weight: 600;
  outline: none;
  flex: 1;
  min-width: 0;
  letter-spacing: -0.01em;
}
.pe-meta-bar input::placeholder { color: var(--fg-dim); }
.pe-meta-bar select {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  outline: none;
}
.tags-input {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.tag-chip {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}
.tag-chip .tag-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 12px;
}
.tag-chip .tag-remove:hover { opacity: 1; }
.tags-input input {
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 11px;
  outline: none;
  width: 80px;
  padding: 2px 0;
}

/* Send dropdown */
.send-dropdown-wrap {
  position: relative;
  display: inline-flex;
}
.send-dropdown-wrap .btn-main {
  border-radius: 6px 0 0 6px;
  border-right: none;
}
.send-dropdown-wrap .btn-caret {
  border-radius: 0 6px 6px 0;
  padding: 5px 6px;
  border-left: 1px solid rgba(26,27,38,0.3);
  min-width: 0;
}
.send-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  overflow: hidden;
}
.send-dropdown.open { display: block; }
.send-dropdown-section {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.send-dropdown-section:last-child { border-bottom: none; }
.send-dropdown-section .section-label {
  padding: 6px 12px 2px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-dim);
  letter-spacing: 0.5px;
}
.send-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.1s;
}
.send-dropdown-item:hover { background: var(--bg-lighter); }
.send-dropdown-item .item-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.send-dropdown-item .item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-dropdown-item .item-meta { font-size: 10px; color: var(--fg-dim); flex-shrink: 0; }
.send-dropdown-item.disabled { opacity: 0.4; cursor: not-allowed; }
.send-dropdown-item.disabled:hover { background: transparent; }

/* Usage badges */
.usage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--fg-dim);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.usage-badge:hover { color: var(--fg); border-color: var(--accent); }

/* Rich text editor */
.editor-wrapper {
  flex: 1;
  overflow: auto;
  padding: 40px 48px;
  background: var(--pe-editor-shell-bg);
}
.ProseMirror {
  width: 740px;
  margin: 0 auto;
  min-height: 400px;
  outline: none;
  color: var(--pe-editor-paper-fg);
  caret-color: var(--accent);
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  line-height: 1.8;
  padding: 36px 44px;
  background: var(--pe-editor-paper-bg);
  border: 1px solid var(--pe-editor-paper-border);
  border-radius: 10px;
  box-shadow: var(--pe-editor-paper-shadow);
}
.ProseMirror:focus {
  border-color: var(--accent);
  box-shadow: var(--pe-editor-focus-shadow);
}
.ProseMirror::selection,
.ProseMirror *::selection {
  background: var(--pe-editor-selection-bg);
  color: var(--pe-editor-selection-fg);
}
.ProseMirror p { margin-bottom: 12px; }
.ProseMirror > p:first-child > strong:only-child,
.ProseMirror > p:first-child > b:only-child {
  font-size: 1.6em;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--fg);
}
.ProseMirror > p:empty { margin-bottom: 8px; }
.ProseMirror h1 { font-size: 1.75em; font-weight: 700; margin: 32px 0 14px; color: var(--fg); letter-spacing: -0.02em; line-height: 1.3; }
.ProseMirror h2 { font-size: 1.4em; font-weight: 600; margin: 28px 0 12px; color: var(--fg); letter-spacing: -0.01em; line-height: 1.35; }
.ProseMirror h3 { font-size: 1.15em; font-weight: 600; margin: 22px 0 8px; color: var(--fg); line-height: 1.4; }
.ProseMirror ul, .ProseMirror ol { padding-left: 28px; margin-bottom: 12px; }
.ProseMirror li { margin-bottom: 5px; }
.ProseMirror li p { margin-bottom: 5px; }
.ProseMirror blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
  color: var(--pe-editor-paper-muted);
  margin: 14px 0;
  background: var(--pe-editor-quote-bg);
  border-radius: 0 6px 6px 0;
}
.ProseMirror a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(122, 162, 247, 0.35); text-underline-offset: 2px; transition: text-decoration-color 0.15s; }
.ProseMirror a:hover { text-decoration-color: var(--accent); }
.ProseMirror code {
  background: var(--pe-editor-code-bg);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.87em;
  border: 1px solid var(--pe-editor-code-border);
}
.ProseMirror pre {
  background: var(--pe-editor-code-bg);
  border: 1px solid var(--pe-editor-code-border);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 16px 0;
  overflow-x: auto;
}
.ProseMirror pre code { background: none; padding: 0; border-radius: 0; border: none; font-size: 0.87em; display: block; white-space: pre; }
.ProseMirror hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.ProseMirror strong { font-weight: 700; color: var(--fg); }
.ProseMirror em { font-style: italic; }
.ProseMirror img { max-width: 100%; border-radius: 8px; margin: 14px 0; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s, box-shadow 0.15s; }
.ProseMirror img.img-selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.ProseMirror.is-editor-empty::before,
.ProseMirror .is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--pe-editor-paper-muted);
  pointer-events: none;
  float: left;
  height: 0;
}

/* Version panel */
#pe-version-panel {
  display: none;
  width: 300px;
  background: var(--bg-light);
  border-left: 1px solid var(--border);
  flex-direction: column;
  overflow: hidden;
}
#pe-version-panel.active { display: flex; }
.version-header {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.version-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.version-item {
  padding: 8px;
  border-radius: 5px;
  margin-bottom: 4px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}
.version-item:hover { background: var(--bg-lighter); }
.version-item.active { border-left-color: var(--accent); background: var(--bg-lighter); }
.version-item .v-num { font-size: 12px; font-weight: 600; color: var(--accent); }
.version-item .v-date { font-size: 10px; color: var(--fg-dim); }
.version-item .v-msg { font-size: 11px; color: var(--fg-dim); margin-top: 2px; }

/* Image annotation overlay */
.annotation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.annotation-overlay.active { display: flex; }
.annotation-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--bg-light);
  border-radius: 8px;
  margin-bottom: 8px;
}
.annotation-toolbar .tool-btn {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.1s;
}
.annotation-toolbar .tool-btn:hover { border-color: var(--accent); }
.annotation-toolbar .tool-btn.active { background: var(--accent); color: #1a1b26; border-color: var(--accent); }
.annotation-canvas-container {
  position: relative;
  max-width: 90vw;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.annotation-canvas-container img { max-width: 100%; display: block; }
.annotation-canvas-container canvas { position: absolute; top: 0; left: 0; cursor: crosshair; }

/* Domain navigation */
.domain-nav {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* Collapsed mode: horizontal pill row */
.domain-nav.collapsed {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px 6px;
  align-items: center;
}
.domain-nav-toggle {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: all 0.1s;
  line-height: 1;
}
.domain-nav-toggle:hover { background: var(--bg-lighter); color: var(--fg); }
/* Pill style for collapsed nav items */
.domain-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 10px;
  background: var(--bg);
  color: var(--fg-dim);
  border: 1px solid var(--border);
  transition: all 0.1s;
  white-space: nowrap;
  line-height: 1.4;
}
.domain-nav-pill:hover { border-color: var(--accent); color: var(--fg); }
.domain-nav-pill.active { background: var(--accent); color: #1a1b26; border-color: var(--accent); }
.domain-nav-pill .pill-count {
  font-size: 9px; font-weight: 600; opacity: 0.7;
}
.domain-nav-pill.active .pill-count { opacity: 0.8; }
/* Expanded mode (original vertical layout) */
.domain-nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  transition: background 0.1s;
  color: var(--fg);
}
.domain-nav-item:hover { background: var(--bg-lighter); }
.domain-nav-item.active { background: var(--accent); color: #1a1b26; }
.domain-nav-icon { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; }
.domain-nav-label { flex: 1; }
.domain-nav-count {
  font-size: 9px; font-weight: 500; color: var(--fg-dim);
  background: var(--bg); padding: 0 5px; border-radius: 8px;
}
.domain-nav-item.active .domain-nav-count { background: rgba(0,0,0,0.2); color: #1a1b26; }
.domain-nav-section {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--fg-dim);
  padding: 6px 8px 2px; margin-top: 2px;
}

/* Domain tag chips in prompt items */
.domain-chip {
  display: inline-block;
  font-size: 9px;
  padding: 0 5px;
  border-radius: 3px;
  font-weight: 500;
  line-height: 1.6;
}
.domain-chip.coding { background: rgba(122,162,247,0.15); color: var(--accent); }
.domain-chip.ops { background: rgba(255,158,100,0.15); color: #ff9e64; }
.domain-chip.writing { background: rgba(187,154,247,0.15); color: #bb9af7; }
.domain-chip.research { background: rgba(125,207,182,0.15); color: #7dcfb6; }
.domain-chip.personal { background: rgba(224,175,104,0.15); color: #e0af68; }
.domain-chip.meta { background: rgba(137,180,250,0.15); color: #89b4fa; }
.domain-chip.general { background: var(--bg-lighter); color: var(--fg-dim); }

/* Slash command picker */
.slash-picker {
  position: fixed;
  z-index: 300;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 260px;
  max-width: 340px;
  max-height: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  overflow: hidden;
}
.slash-picker-header {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.slash-picker-list {
  overflow-y: auto;
  max-height: 260px;
  padding: 4px;
}
.slash-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.1s;
}
.slash-picker-item:hover, .slash-picker-item.active { background: var(--bg-lighter); }
.slash-picker-item .skill-name { font-weight: 500; color: var(--fg); }
.slash-picker-item .skill-freq {
  margin-left: auto;
  font-size: 9px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 8px;
  color: var(--fg-dim);
}
.slash-picker-item .skill-source {
  font-size: 9px;
  color: var(--fg-dim);
}

/* Empty state */
.pe-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  color: var(--fg-dim);
  text-align: center;
  padding: 40px;
}
.pe-empty-state h3 { color: var(--fg); font-size: 16px; }
.pe-empty-state p { font-size: 13px; line-height: 1.6; max-width: 400px; }

/* Prompt panel tabs */
.pe-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.pe-panel-tab {
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  color: var(--fg-dim);
  border-bottom: 2px solid transparent;
  transition: all 0.1s;
}
.pe-panel-tab:hover { color: var(--fg); }
.pe-panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Prompts modal overrides */
.pe-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.pe-modal-overlay.hidden { display: none; }
.pe-modal {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  min-width: 420px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}
.pe-modal h3 { margin-bottom: 14px; font-size: 15px; }
.pe-modal label { display: block; font-size: 12px; color: var(--fg-dim); margin-bottom: 4px; margin-top: 10px; }
.pe-modal input,
.pe-modal select,
.pe-modal textarea {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 13px;
  outline: none;
}
.pe-modal input:focus,
.pe-modal select:focus,
.pe-modal textarea:focus { border-color: var(--accent); }
.pe-modal textarea { min-height: 80px; resize: vertical; font-family: 'SF Mono', monospace; }
.pe-modal .btn-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Prompts status bar */
#pe-statusbar {
  display: flex;
  align-items: center;
  height: 24px;
  background: var(--bg-light);
  border-top: 1px solid var(--border);
  padding: 0 12px;
  font-size: 10px;
  color: var(--fg-dim);
  gap: 12px;
  flex-shrink: 0;
}
#pe-statusbar .status-item { display: flex; align-items: center; gap: 4px; }

/* Backup table inside prompts panel */
#prompts-panel .perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
#prompts-panel .perm-table th {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 500;
}
#prompts-panel .perm-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
