:root {
	color-scheme: dark;
	--gh-bg: #0d1117;
	--gh-canvas-subtle: #161b22;
	--gh-border: #30363d;
	--gh-text: #e6edf3;
	--gh-muted: #8b949e;
	--gh-accent: #58a6ff;
	--gh-add: #3fb950;
	--gh-del: #f85149;
	--gh-hover: #161b22;
	--gh-file-header-bg: #161b22;
	--gh-active-bg: #16233a;
	--gh-active-outline: #388bfd;
	--gh-rename: #bc8cff;
	--gh-diff-body-bg: #0d1117;
}

* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--gh-text);
	background: var(--gh-canvas-subtle);
}
.review-shell {
	max-width: 100%;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	height: 100vh;
}

.additions { color: var(--gh-add); }
.deletions { color: var(--gh-del); }

/* CodeMirror diff overrides */
.cm-insertedLine { background: rgba(63, 185, 80, 0.15) !important; }
.cm-deletedLine { background: rgba(248, 81, 73, 0.15) !important; }
.cm-changedLine { background: rgba(210, 153, 34, 0.1) !important; }
.cm-insertedText { background: rgba(63, 185, 80, 0.3) !important; }
.cm-deletedText { background: rgba(248, 81, 73, 0.3) !important; }
.cm-changedText { background: transparent !important; }

#editor { flex: 1; overflow: auto; }
#file-list { position: relative; flex-shrink: 0; width: 280px; overflow-y: auto; border-right: 1px solid var(--gh-border); padding: 8px 0; }
.sidebar-resize-handle { position: absolute; top: 0; right: 0; width: 4px; height: 100%; cursor: col-resize; z-index: 10; }
.sidebar-resize-handle:hover { background: var(--gh-active-outline); }

#file-list .file-jump-tree,
#file-list .file-jump-tree ul { list-style: none; margin: 0; padding-left: 14px; }
#file-list .file-jump-tree { padding-left: 0; }
#file-list .file-tree-dir > details > summary {
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; color: var(--gh-muted); font-size: 12px;
    padding: 4px 8px; list-style: none;
}
#file-list .file-tree-dir > details > summary::-webkit-details-marker { display: none; }
#file-list .file-tree-dir > details > summary::before { content: "▾"; font-size: 10px; }
#file-list .file-tree-dir > details:not([open]) > summary::before { content: "▸"; }
#file-list .file-tree-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; flex: 0 0 14px; flex-shrink: 0;
}
#file-list .file-tree-icon svg { width: 14px; height: 14px; }
#file-list .file-tree-icon-folder { color: #d29922; }
#file-list .file-tree-icon-file { color: var(--gh-muted); }
#file-list .file-tree-file-button {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; width: 100%; text-align: left;
    background: transparent; border: none; border-radius: 4px;
    color: var(--gh-text); font: inherit; font-size: 12px;
    padding: 4px 8px; cursor: pointer;
}
#file-list .file-tree-file-button:hover { background: var(--gh-hover); }
#file-list .file-tree-file-button:focus-visible {
    outline: 2px solid var(--gh-active-outline);
    outline-offset: 1px;
}
#file-list .file-tree-file-button.is-active {
    background: var(--gh-active-bg);
    border-left: 2px solid var(--gh-active-outline);
    color: var(--gh-text);
}
#file-list .file-tree-file-main { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
#file-list .file-tree-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#file-list .file-tree-file-diff { display: flex; align-items: center; gap: 6px; font-size: 11px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
#file-list .file-tree-file-status {
    text-transform: capitalize; font-size: 10px; line-height: 1;
    padding: 2px 6px; border: 1px solid var(--gh-border);
    border-radius: 999px; color: var(--gh-muted);
}
#file-list .file-tree-file-status-added,
#file-list .file-tree-file-additions { color: var(--gh-add); }
#file-list .file-tree-file-status-deleted,
#file-list .file-tree-file-deletions { color: var(--gh-del); }
#file-list .file-tree-file-status-renamed { color: var(--gh-rename); }
#file-list .file-tree-file-status-modified { color: var(--gh-accent); }
@media (max-width: 760px) {
    #file-list .file-tree-file-button { flex-wrap: wrap; row-gap: 4px; }
}

.review-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--gh-bg);
}

.cm-editor { height: 100%; }
.cm-scroller { overflow: auto !important; }
.status-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    padding: 0 16px;
    background: var(--gh-bg);
    color: var(--gh-text);
    border-bottom: 1px solid var(--gh-border);
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    white-space: nowrap;
    overflow: hidden;
}
.status-bar-left,
.status-bar-right { display: flex; align-items: center; gap: 10px; }
.status-bar-left > svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; }
.status-bar-item { display: inline-flex; align-items: center; gap: 4px; }
.status-bar-branch {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--gh-text);
}
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--gh-border);
    border-radius: 6px;
    overflow: hidden;
}
.view-toggle-btn {
    background: transparent;
    border: none;
    color: var(--gh-muted);
    font: inherit;
    font-size: 12px;
    padding: 0 10px;
    cursor: pointer;
    height: 28px;
    line-height: 28px;
    white-space: nowrap;
}
.view-toggle-btn:not(:last-child) {
    border-right: 1px solid var(--gh-border);
}
.view-toggle-btn:hover { background: var(--gh-hover); }
.view-toggle-btn.active { background: var(--gh-active-bg); color: var(--gh-text); }
.status-bar-stats { gap: 6px; font-size: 12px; }
.status-bar .additions { color: var(--gh-add); }
.status-bar .deletions { color: var(--gh-del); }
.status-bar-sep { color: var(--gh-muted); margin: 0 3px; }
.binary-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gh-muted);
    font-size: 14px;
}
