/* --- Behind-branch warning banner --- */
.diff-behind-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #fef9c3;
  border: 1px solid #d97706;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 9px;
  color: #92400e;
  margin-top: 6px;
  margin-bottom: 2px;
}
[data-theme="dark"] .diff-behind-warning {
  background: rgba(217, 119, 6, 0.15);
  border-color: #b45309;
  color: #fbbf24;
}
.diff-sync-btn {
  flex-shrink: 0;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 600;
  border-radius: 3px;
  border: 1px solid #d97706;
  background: #fff;
  color: #92400e;
  cursor: pointer;
  line-height: 1.6;
}
.diff-sync-btn:hover {
  background: #fef3c7;
}
[data-theme="dark"] .diff-sync-btn {
  background: rgba(217, 119, 6, 0.2);
  border-color: #b45309;
  color: #fbbf24;
}
[data-theme="dark"] .diff-sync-btn:hover {
  background: rgba(217, 119, 6, 0.35);
}
/* Modal-level behind warning (larger) */
#modal-diff-behind:not(.hidden) {
  display: flex;
}
#modal-diff-behind {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fef9c3;
  border: 1px solid #d97706;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: #92400e;
  margin-bottom: 10px;
}
[data-theme="dark"] #modal-diff-behind {
  background: rgba(217, 119, 6, 0.15);
  border-color: #b45309;
  color: #fbbf24;
}
#modal-diff-behind .diff-sync-btn {
  font-size: 11px;
  padding: 2px 10px;
}

/* --- Commit message in Changes tab --- */
#modal-commit-message:not(.hidden) {
  display: block;
}
#modal-commit-message {
  margin-bottom: 10px;
}
.commit-message-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.commit-message-body {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Diff block (waiting task cards) --- */
.diff-block {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 9px;
  line-height: 1.5;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  max-height: 12em;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 8px;
}
.diff-add {
  color: #1a6638;
}
.diff-del {
  color: #8c2424;
}
.diff-hunk {
  color: #2c5b9a;
}
.diff-header {
  color: #7a5810;
}
[data-theme="dark"] .diff-add {
  color: #3fb950;
}
[data-theme="dark"] .diff-del {
  color: #ff7b72;
}
[data-theme="dark"] .diff-hunk {
  color: #79c0ff;
}
[data-theme="dark"] .diff-header {
  color: #e3b341;
}

/* --- Card-level file-split diffs --- */
.diff-block .diff-file {
  border-radius: 3px;
  margin-bottom: 2px;
}
.diff-block .diff-file-summary {
  padding: 2px 4px;
}
.diff-block .diff-filename {
  font-size: 9px;
  font-weight: 500;
}
.diff-block .diff-stats {
  font-size: 8px;
  gap: 3px;
}
.diff-block .diff-block-modal {
  font-size: 9px;
  line-height: 1.4;
  padding: 2px 4px;
  max-height: none;
}
.diff-card-hidden {
  display: none;
}
.diff-card-expand {
  text-align: center;
  padding: 2px 0;
}
.diff-card-expand button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 9px;
  font-style: italic;
  cursor: pointer;
  padding: 2px 6px;
}
.diff-card-expand button:hover {
  color: var(--text);
}
.diff-block .text-v-muted {
  font-size: 9px;
}

/* --- Diff per-file (modal detail view) --- */
.diff-file {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}
.diff-file-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-input);
  cursor: pointer;
  list-style: none;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 1;
}
.diff-file-summary::-webkit-details-marker {
  display: none;
}
.diff-file[open] .diff-file-summary {
  border-bottom: 1px solid var(--border);
}
.diff-filename {
  font-size: 13px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  color: var(--text);
  font-weight: 600;
}
.diff-stats {
  display: flex;
  gap: 6px;
  font-size: 11px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}
.diff-block-modal {
  padding: 8px 0;
  font-size: 0;
  max-height: none;
  margin-top: 0;
  border: none;
  border-radius: 0;
}
.diff-block-modal .diff-line {
  display: block;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1.5;
}
.diff-block-modal .diff-line.diff-add {
  background: #dafbe1;
}
.diff-block-modal .diff-line.diff-del {
  background: #ffebe9;
}
.diff-block-modal .diff-line.diff-hunk {
  background: rgba(56, 139, 253, 0.1);
  color: #0550ae;
}
.diff-block-modal .diff-line.diff-header {
  color: var(--text-muted);
}
[data-theme="dark"] .diff-block-modal .diff-line.diff-add {
  background: rgba(46, 160, 67, 0.15);
}
[data-theme="dark"] .diff-block-modal .diff-line.diff-del {
  background: rgba(248, 81, 73, 0.15);
}
[data-theme="dark"] .diff-block-modal .diff-line.diff-hunk {
  background: rgba(56, 139, 253, 0.15);
  color: #79c0ff;
}
[data-theme="dark"] .diff-block-modal .diff-line.diff-header {
  color: var(--text-muted);
}

/* --- Syntax highlighting tokens inside diff blocks (GitHub-inspired) --- */
.diff-block-modal .hljs-keyword,
.diff-block-modal .hljs-template-tag,
.diff-block-modal .hljs-type,
.diff-block-modal .hljs-variable.language_,
.explorer-preview .hljs-keyword,
.explorer-preview .hljs-template-tag,
.explorer-preview .hljs-type,
.explorer-preview .hljs-variable.language_ {
  color: #d73a49;
}
.diff-block-modal .hljs-title,
.diff-block-modal .hljs-title.class_,
.diff-block-modal .hljs-title.class_.inherited__,
.diff-block-modal .hljs-title.function_,
.explorer-preview .hljs-title,
.explorer-preview .hljs-title.class_,
.explorer-preview .hljs-title.class_.inherited__,
.explorer-preview .hljs-title.function_ {
  color: #6f42c1;
}
.diff-block-modal .hljs-attr,
.diff-block-modal .hljs-attribute,
.diff-block-modal .hljs-literal,
.diff-block-modal .hljs-meta,
.diff-block-modal .hljs-number,
.diff-block-modal .hljs-operator,
.diff-block-modal .hljs-selector-attr,
.diff-block-modal .hljs-selector-class,
.diff-block-modal .hljs-selector-id,
.diff-block-modal .hljs-variable,
.explorer-preview .hljs-attr,
.explorer-preview .hljs-attribute,
.explorer-preview .hljs-literal,
.explorer-preview .hljs-meta,
.explorer-preview .hljs-number,
.explorer-preview .hljs-operator,
.explorer-preview .hljs-selector-attr,
.explorer-preview .hljs-selector-class,
.explorer-preview .hljs-selector-id,
.explorer-preview .hljs-variable {
  color: #005cc5;
}
.diff-block-modal .hljs-meta .hljs-string,
.diff-block-modal .hljs-regexp,
.diff-block-modal .hljs-string,
.explorer-preview .hljs-meta .hljs-string,
.explorer-preview .hljs-regexp,
.explorer-preview .hljs-string {
  color: #032f62;
}
.diff-block-modal .hljs-built_in,
.diff-block-modal .hljs-symbol,
.explorer-preview .hljs-built_in,
.explorer-preview .hljs-symbol {
  color: #e36209;
}
.diff-block-modal .hljs-code,
.diff-block-modal .hljs-comment,
.diff-block-modal .hljs-formula,
.explorer-preview .hljs-code,
.explorer-preview .hljs-comment,
.explorer-preview .hljs-formula {
  color: #6a737d;
}
.diff-block-modal .hljs-name,
.diff-block-modal .hljs-quote,
.diff-block-modal .hljs-selector-pseudo,
.diff-block-modal .hljs-selector-tag,
.explorer-preview .hljs-name,
.explorer-preview .hljs-quote,
.explorer-preview .hljs-selector-pseudo,
.explorer-preview .hljs-selector-tag {
  color: #22863a;
}
.diff-block-modal .hljs-section,
.explorer-preview .hljs-section {
  color: #005cc5;
  font-weight: 700;
}
.diff-block-modal .hljs-bullet,
.explorer-preview .hljs-bullet {
  color: #735c0f;
}

[data-theme="dark"] .diff-block-modal .hljs-keyword,
[data-theme="dark"] .diff-block-modal .hljs-template-tag,
[data-theme="dark"] .diff-block-modal .hljs-type,
[data-theme="dark"] .diff-block-modal .hljs-variable.language_,
[data-theme="dark"] .explorer-preview .hljs-keyword,
[data-theme="dark"] .explorer-preview .hljs-template-tag,
[data-theme="dark"] .explorer-preview .hljs-type,
[data-theme="dark"] .explorer-preview .hljs-variable.language_ {
  color: #ff7b72;
}
[data-theme="dark"] .diff-block-modal .hljs-title,
[data-theme="dark"] .diff-block-modal .hljs-title.class_,
[data-theme="dark"] .diff-block-modal .hljs-title.class_.inherited__,
[data-theme="dark"] .diff-block-modal .hljs-title.function_,
[data-theme="dark"] .explorer-preview .hljs-title,
[data-theme="dark"] .explorer-preview .hljs-title.class_,
[data-theme="dark"] .explorer-preview .hljs-title.class_.inherited__,
[data-theme="dark"] .explorer-preview .hljs-title.function_ {
  color: #d2a8ff;
}
[data-theme="dark"] .diff-block-modal .hljs-attr,
[data-theme="dark"] .diff-block-modal .hljs-attribute,
[data-theme="dark"] .diff-block-modal .hljs-literal,
[data-theme="dark"] .diff-block-modal .hljs-meta,
[data-theme="dark"] .diff-block-modal .hljs-number,
[data-theme="dark"] .diff-block-modal .hljs-operator,
[data-theme="dark"] .diff-block-modal .hljs-selector-attr,
[data-theme="dark"] .diff-block-modal .hljs-selector-class,
[data-theme="dark"] .diff-block-modal .hljs-selector-id,
[data-theme="dark"] .diff-block-modal .hljs-variable,
[data-theme="dark"] .explorer-preview .hljs-attr,
[data-theme="dark"] .explorer-preview .hljs-attribute,
[data-theme="dark"] .explorer-preview .hljs-literal,
[data-theme="dark"] .explorer-preview .hljs-meta,
[data-theme="dark"] .explorer-preview .hljs-number,
[data-theme="dark"] .explorer-preview .hljs-operator,
[data-theme="dark"] .explorer-preview .hljs-selector-attr,
[data-theme="dark"] .explorer-preview .hljs-selector-class,
[data-theme="dark"] .explorer-preview .hljs-selector-id,
[data-theme="dark"] .explorer-preview .hljs-variable {
  color: #79c0ff;
}
[data-theme="dark"] .diff-block-modal .hljs-meta .hljs-string,
[data-theme="dark"] .diff-block-modal .hljs-regexp,
[data-theme="dark"] .diff-block-modal .hljs-string,
[data-theme="dark"] .explorer-preview .hljs-meta .hljs-string,
[data-theme="dark"] .explorer-preview .hljs-regexp,
[data-theme="dark"] .explorer-preview .hljs-string {
  color: #a5d6ff;
}
[data-theme="dark"] .diff-block-modal .hljs-built_in,
[data-theme="dark"] .diff-block-modal .hljs-symbol,
[data-theme="dark"] .explorer-preview .hljs-built_in,
[data-theme="dark"] .explorer-preview .hljs-symbol {
  color: #ffa657;
}
[data-theme="dark"] .diff-block-modal .hljs-code,
[data-theme="dark"] .diff-block-modal .hljs-comment,
[data-theme="dark"] .diff-block-modal .hljs-formula,
[data-theme="dark"] .explorer-preview .hljs-code,
[data-theme="dark"] .explorer-preview .hljs-comment,
[data-theme="dark"] .explorer-preview .hljs-formula {
  color: #8b949e;
}
[data-theme="dark"] .diff-block-modal .hljs-name,
[data-theme="dark"] .diff-block-modal .hljs-quote,
[data-theme="dark"] .diff-block-modal .hljs-selector-pseudo,
[data-theme="dark"] .diff-block-modal .hljs-selector-tag,
[data-theme="dark"] .explorer-preview .hljs-name,
[data-theme="dark"] .explorer-preview .hljs-quote,
[data-theme="dark"] .explorer-preview .hljs-selector-pseudo,
[data-theme="dark"] .explorer-preview .hljs-selector-tag {
  color: #7ee787;
}
[data-theme="dark"] .diff-block-modal .hljs-section,
[data-theme="dark"] .explorer-preview .hljs-section {
  color: #1f6feb;
  font-weight: 700;
}
[data-theme="dark"] .diff-block-modal .hljs-bullet,
[data-theme="dark"] .explorer-preview .hljs-bullet {
  color: #f2cc60;
}

/* --- Workspace separators in multi-repo diffs --- */
.diff-workspace-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.diff-workspace-header:first-child {
  border-top: none;
  margin-top: 0;
}
.diff-workspace-label {
  color: var(--accent);
  font-weight: 600;
}
