/* --- The Git view (Chat | Files | Git) --- */
/* One column at every width. The panel scrolls; nothing inside it does, which
   is what keeps a 300-line diff and a 180-character path inside their row on a
   320px phone as much as on a 1280px desk. Every text that could be long wraps
   (overflow-wrap: anywhere) or ellipsises, and every flex child that holds one
   carries min-width: 0 — without it a flex item refuses to shrink below its
   content and pushes the row wider than the panel. */
#git-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

#gv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex: 0 0 auto;
  min-width: 0;
}
#gv-tabs { display: flex; gap: 2px; flex: 0 0 auto; }
.gv-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 9px;
  cursor: pointer;
  border-radius: var(--radius);
}
@media (hover: hover) { .gv-tab:hover { color: var(--text); background: var(--bg-hover); } }
.gv-tab.active { color: var(--accent); font-weight: 600; background: rgba(78,168,222,0.1); }

/* The summary is the first thing to give up room: the tabs and the ↻ are
   controls, and it is a label. */
#gv-summary {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
}
#gv-summary > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gv-summary .gv-branch { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; }
#gv-summary .gv-upstream { font-family: var(--mono); }
#gv-refresh {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  display: flex;
}
@media (hover: hover) { #gv-refresh:hover { color: var(--text); background: var(--bg-hover); } }

#gv-panes {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 24px;
  min-width: 0;
}

.gv-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 12px 4px;
}
.gv-section .gv-n { opacity: 0.7; }

.gv-empty, .gv-loading, .gv-note, .gv-error {
  padding: 14px 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.gv-error { color: var(--red); }
.gv-note { padding: 6px 12px; font-size: 12px; }

.gv-row-wrap { border-bottom: 1px solid var(--border); }

/* --- A changed file --- */
.gv-file {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
@media (hover: hover) { .gv-file:hover, .gv-commit:hover { background: var(--bg-hover); } }
.gv-file.open, .gv-commit.open { background: var(--bg-surface2); }
.gv-code {
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-muted);
}
.gv-code-M, .gv-code-T { color: var(--orange); }
.gv-code-A, .gv-code-new { color: var(--green); }
.gv-code-D { color: var(--red); }
.gv-code-R, .gv-code-C { color: var(--blue); }
.gv-code-U { color: var(--red); }
/* The path is the one thing here with no bound on its length. It wraps rather
   than ellipsises: the tail of a path is the half that identifies the file, so
   cutting it is cutting the useful end. */
.gv-path {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.gv-old { color: var(--text-muted); text-decoration: line-through; }

/* --- A commit row --- */
.gv-commit {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.gv-sha {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}
.gv-subject {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gv-author {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gv-when { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; }
.gv-more {
  display: block;
  margin: 12px auto;
  padding: 6px 16px;
  background: var(--bg-surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
}
@media (hover: hover) { .gv-more:hover { background: var(--bg-hover); } }

/* --- What opens under a row --- */
/* The chat's own .diff lives in here unchanged (08-tools.css): same rows, same
   gutter, same colours. Only the frame around it is this file's. */
.gv-body {
  padding: 6px 0 10px;
  background: var(--bg);
  font-size: 12px;
  overflow-x: hidden;
  min-width: 0;
}
.gv-body .diff { font-family: var(--mono); font-size: 12px; line-height: 1.45; }
.gv-patch-file {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 12px;
  overflow-wrap: anywhere;
}
.gv-hunk {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 12px;
  overflow-wrap: anywhere;
}
.gv-patch-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 12px;
  overflow-wrap: anywhere;
}
.gv-message {
  padding: 6px 12px 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}
.gv-stat {
  margin: 0 12px 8px;
  padding: 6px 8px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.gv-cut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.gv-full {
  padding: 4px 10px;
  background: var(--bg-surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
}
@media (hover: hover) { .gv-full:hover { background: var(--bg-hover); } }

/* --- Branches & worktrees --- */
.gv-branch-row, .gv-worktree {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  min-width: 0;
}
.gv-branch-row.head .gv-bname, .gv-worktree.current .gv-bname { color: var(--accent); font-weight: 600; }
.gv-mark {
  flex: 0 0 auto;
  width: 14px;
  color: var(--accent);
  font-family: var(--mono);
  display: inline-flex;
  align-items: center;
}
.gv-bname {
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.gv-upstream {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface2);
  border-radius: var(--radius);
  padding: 1px 6px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.gv-upstream.gone { color: var(--red); }
/* A worktree path is absolute and often long; it takes the whole row and wraps
   under everything else rather than pushing the row wide. */
.gv-wpath {
  flex: 1 1 100%;
  order: 10;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  min-width: 0;
}
.gv-tag {
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 6px;
}
/* The @nick is the point of the pane: it says WHO is standing in that tree. */
.gv-who {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(78,168,222,0.12);
  border-radius: var(--radius);
  padding: 1px 6px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.gv-who.self { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }

/* A phone has less room for the header row: the summary drops to its own line
   under the tabs rather than fighting them for width. */
@media (max-width: 480px) {
  #gv-header { flex-wrap: wrap; row-gap: 4px; }
  #gv-summary { order: 10; flex-basis: 100%; }
  .gv-tab { padding: 4px 7px; }
  .gv-commit { flex-wrap: wrap; }
  .gv-author { flex: 0 1 auto; }
}
