/* ==========================================
   Loading / Toast
   ========================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  text-align: center;
  color: var(--text-primary);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 200ms ease;
  max-width: 400px;
}

.toast-success {
  background: var(--accent-green);
  color: white;
}

.toast-error {
  background: var(--accent-red);
  color: white;
}

.toast-info {
  background: var(--accent-blue);
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}


/* ==========================================
   Empty State
   ========================================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 16px;
  margin-bottom: 16px;
}


/* ==========================================
   Tabs
   ========================================== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}


/* ==========================================
   GIT INTEGRATION
   ========================================== */
.git-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.commits-list {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.commit-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.commit-item:last-child {
  border-bottom: none;
}

.commit-hash .commit-link,
.commit-hash .commit-hash-text {
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
  font-size: 12px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent-blue);
  text-decoration: none;
}

.commit-link:hover {
  text-decoration: underline;
}

.commit-message {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commit-date {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}


/* ==========================================
   DIFF VIEWER
   ========================================== */
.diff-summary {
  margin-bottom: 12px;
}

.diff-stat {
  display: flex;
  gap: 12px;
  font-size: 13px;
  align-items: center;
}

.diff-stat-files {
  color: var(--text-secondary);
}

.diff-stat-additions {
  color: var(--accent-green);
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
}

.diff-stat-deletions {
  color: var(--accent-red);
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
}

.diff-file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.diff-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
}

.diff-file-item:hover {
  background: var(--bg-hover);
}

.diff-file-status {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.diff-added .diff-file-status {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
}

.diff-modified .diff-file-status {
  background: rgba(234, 179, 8, 0.15);
  color: var(--accent-yellow);
}

.diff-deleted .diff-file-status {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.diff-renamed .diff-file-status {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
}

.diff-file-path {
  color: var(--text-primary);
  font-size: 12px;
}

.diff-content {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 600px;
}

.diff-pre {
  margin: 0;
  padding: 0;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.5;
}

.diff-line {
  padding: 0 12px;
  white-space: pre;
  min-height: 1.5em;
}

.diff-line-add {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent-green);
}

.diff-line-del {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

.diff-line-hunk {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue);
  font-style: italic;
}

.diff-line-header {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.diff-line-meta {
  color: var(--text-muted);
  font-weight: 600;
}


/* ==========================================
   Users View
   ========================================== */
.user-card {
  min-height: auto;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}


/* ==========================================
   Comments (automated)
   ========================================== */
.comment-automated {
  border-left: 3px solid var(--accent-yellow);
  background: rgba(234, 179, 8, 0.05);
}

.comment-author {
  font-weight: 600;
  font-size: 12px;
  color: var(--accent-purple);
}

.comment-automated .comment-author {
  color: var(--accent-yellow);
}


/* ==========================================
   User Gate
   ========================================== */
.user-gate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.user-gate.hidden {
  display: none;
}

.user-gate-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.user-gate-card h2 {
  font-size: 22px;
  margin-top: 12px;
  margin-bottom: 8px;
}

.user-gate-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.user-gate-icon {
  font-size: 48px;
}

.user-gate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.user-gate-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.user-gate-item:hover {
  border-color: var(--accent-blue);
  background: var(--bg-hover);
}

.user-gate-item-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: white;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-gate-create {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.user-gate-create input {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.user-gate-create input:focus {
  border-color: var(--accent-blue);
}


/* ==========================================
   User Profile
   ========================================== */
.user-profile-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.user-profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.user-profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-profile-info h2 {
  font-size: 24px;
  margin-bottom: 2px;
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}


/* ==========================================
   Quick Search (Command Palette)
   ========================================== */
.quick-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.quick-search-overlay.hidden {
  display: none;
}

.quick-search-container {
  width: 520px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.quick-search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.quick-search-input-wrapper svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

#quick-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text-primary);
  font-family: inherit;
}

#quick-search-input::placeholder {
  color: var(--text-muted);
}

.quick-search-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 0;
}

.quick-search-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 16px 4px;
}

.quick-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s;
}

.quick-search-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}


/* ==========================================
   Activity Feed (Notification Bell)
   ========================================== */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
}

.notification-bell:hover {
  background: var(--bg-tertiary);
}

.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  overflow-y: auto;
  margin-top: 4px;
}

.notification-dropdown.hidden {
  display: none;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.notification-item:hover {
  background: var(--bg-tertiary);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-unread {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--accent-blue);
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  font-weight: 600;
}


/* ==========================================
   Markdown Preview
   ========================================== */
.markdown-preview-box {
  font-size: 13px;
  line-height: 1.6;
}


/* ==========================================
   Light Theme
   ========================================== */
[data-theme="light"] {
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  --bg-hover: #E2E8F0;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #CBD5E1;
  --border-light: #E2E8F0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] #sidebar {
  background: #FFFFFF;
  border-right: 1px solid #E2E8F0;
}

[data-theme="light"] .top-bar {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
}

[data-theme="light"] .stat-card,
[data-theme="light"] .card {
  background: #FFFFFF;
  border-color: #E2E8F0;
}

[data-theme="light"] .kanban-column {
  background: #F1F5F9;
}

[data-theme="light"] .story-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
}

[data-theme="light"] .modal-container {
  background: #FFFFFF;
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: #F8FAFC;
  color: #0F172A;
  border-color: #CBD5E1;
}

[data-theme="light"] .nav-link:hover {
  background: #F1F5F9;
}

[data-theme="light"] .nav-link.active {
  background: #EFF6FF;
  color: #2563EB;
}

[data-theme="light"] .sidebar-toggle-btn {
  background: #FFFFFF;
  color: #475569;
  border-color: #E2E8F0;
}


/* ==========================================
   Sticky Notes
   ========================================== */
.sticky-note {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.sticky-note-text {
  width: 100%;
  min-height: 60px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}

.sticky-note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}


/* ==========================================
   Command Palette
   ========================================== */
.command-palette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
}

.command-palette.hidden {
  display: none;
}

.command-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.command-palette-dialog {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.command-palette-dialog input {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
}

.command-palette-results {
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 0;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.1s;
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.command-palette-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
}


/* ==========================================
   Scroll to Top Button
   ========================================== */
.scroll-to-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: opacity 0.2s, transform 0.2s;
}

.scroll-to-top-btn:hover {
  transform: scale(1.1);
}

.scroll-to-top-btn.hidden {
  opacity: 0;
  pointer-events: none;
}


/* ==========================================
   Mention Links
   ========================================== */
.mention-link {
  color: var(--accent-blue);
  font-weight: 500;
  text-decoration: none;
}

.mention-link:hover {
  text-decoration: underline;
}


/* ==========================================
   Activity Feed
   ========================================== */
.activity-feed-list {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.activity-item:hover {
  background: var(--bg-tertiary);
}


/* ==========================================
   Hover Highlight
   ========================================== */
.hover-highlight:hover {
  background: var(--bg-tertiary);
}


/* ==========================================
   Context Menu
   ========================================== */
.context-menu .dropdown-item,
.nav-context-menu .dropdown-item {
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
.context-menu .dropdown-item:hover,
.nav-context-menu .dropdown-item:hover {
  background: var(--bg-tertiary);
}


/* ========== Inline File Diff ========== */
.inline-file-diff {
  margin: 4px 0 8px 0;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11px;
  line-height: 1.5;
  max-height: 400px;
  overflow: auto;
  white-space: pre;
  color: var(--text-secondary);
}
.inline-file-diff .diff-add {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
}
.inline-file-diff .diff-del {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}
.inline-file-diff .diff-header {
  color: var(--accent-blue);
  font-weight: 600;
}


/* ========== Test Run Groups ========== */
.test-run-group {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.test-run-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s;
}
.test-run-group-header:hover {
  background: var(--border);
}
.test-run-group-body {
  padding: 8px 12px;
}
.test-run-group .test-result-item {
  margin-bottom: 6px;
}


/* ========== Code blocks in Markdown ========== */
pre code.hljs {
  display: block;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}
code:not(.hljs) {
  background: var(--bg-tertiary);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--accent-blue);
}


/* ========== Commit Modal Story Info ========== */
.commit-story-info {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
}
.commit-story-info h4 {
  margin: 0 0 6px 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.commit-changes-summary {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12px;
}
.commit-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.15s;
}
.commit-file-item:hover {
  color: var(--accent-blue);
}


/* Quick Add FAB */
.quick-add-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
  transition: all 0.2s;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.quick-add-fab:hover {
  transform: scale(1.1) rotate(90deg);
  background: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5);
}
.quick-add-fab.top {
    bottom: auto;
    top: 24px;
}


/* Calendar View */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.cal-month-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  color: var(--text-primary);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.cal-header {
  background: var(--bg-tertiary);
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  min-height: 100px;
  padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: relative;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-empty { background: var(--bg-primary); opacity: 0.5; }
.cal-today { background: rgba(59, 130, 246, 0.08); }
.cal-has-stories { }
.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.cal-today-num {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.2);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day-stories { display: flex; flex-direction: column; gap: 2px; }
.cal-story {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.cal-story:hover { background: var(--bg-hover); }
.cal-story-overdue { border-left: 2px solid var(--accent-red); }
.cal-story-id {
  font-family: monospace;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.cal-story-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
.cal-story-more {
  font-size: 10px;
  color: var(--accent-blue);
  padding: 1px 4px;
  cursor: default;
}


/* ==========================================
   View Toggle Buttons
   ========================================== */
.view-toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.view-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--accent-blue);
  color: white;
}

.view-toggle-btn + .view-toggle-btn {
  border-left: 1px solid var(--border);
}


/* ==========================================
   Document Tree UI
   ========================================== */
.doc-tree-folder.collapsed .doc-tree-contents {
  display: none;
}

.doc-tree-folder.collapsed .doc-tree-arrow {
  transform: rotate(-90deg);
}


/* ==========================================
   WYSIWYG Editor
   ========================================== */
.wysiwyg-editor:focus {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.wysiwyg-editor h1,
.wysiwyg-editor h2,
.wysiwyg-editor h3 {
  margin-top: 0.5em;
}

.wysiwyg-editor p {
  margin: 0.85em 0;
}

.wysiwyg-editor ul,
.wysiwyg-editor ol {
  padding-left: 24px;
  margin: 0.4em 0;
}

.wysiwyg-editor ul {
  list-style-type: disc;
}

.wysiwyg-editor ol {
  list-style-type: decimal;
}

.wysiwyg-editor li {
  margin: 2px 0;
}

.wysiwyg-editor blockquote {
  border-left: 3px solid var(--accent-blue);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 0.4em 0;
}

.wysiwyg-editor code {
  background: var(--bg-tertiary);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.wysiwyg-editor pre {
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.4em 0;
}

.wysiwyg-editor pre code {
  background: none;
  padding: 0;
}

.wysiwyg-editor[data-placeholder]::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  font-style: italic;
  position: absolute;
}


/* ==========================================
   Document Annotations
   ========================================== */
.doc-highlight {
  background: rgba(255, 213, 79, 0.35);
  border-radius: 2px;
}

.doc-strikethrough {
  background: transparent;
  text-decoration: line-through;
  text-decoration-color: var(--accent-red);
  text-decoration-thickness: 3px;
  color: inherit;
}

.doc-anno-btn.active {
  background: var(--accent-blue) !important;
  color: #fff !important;
}
