:root {
	--bg-canvas: #F5F5F7;
	--surface: #FFFFFF;
	--surface-elevated: #FFFFFF;
	--surface-subtle: #F2F2F7;
	--glass-bg: rgba(246, 246, 248, 0.82);
	--sidebar-bg: rgba(242, 242, 247, 0.72);
	--hover-pill: rgba(0, 0, 0, 0.055);
	--border-hairline: rgba(60, 60, 67, 0.12);
	--border-strong: rgba(60, 60, 67, 0.22);
	--text-primary: #1D1D1F;
	--text-secondary: #6E6E73;
	--text-tertiary: #86868B;
	--accent: #007AFF;
	--accent-hover: #0066D6;
	--accent-soft: rgba(0, 122, 255, 0.11);
	--green: #34C759;
	--green-text: #1B873F;
	--green-soft: rgba(52, 199, 89, 0.13);
	--orange: #FF9500;
	--orange-soft: rgba(255, 149, 0, 0.14);
	--red: #FF3B30;
	--red-soft: rgba(255, 59, 48, 0.12);
	--graph-selected-bg: rgba(0, 122, 255, 0.075);
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
	--shadow-md: 0 10px 28px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
	--shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.20), 0 4px 16px rgba(0, 0, 0, 0.08);
	--font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
	--font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	--ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
	--bg-canvas: #121214;
	--surface: #1C1C1E;
	--surface-elevated: #2C2C2E;
	--surface-subtle: #242426;
	--glass-bg: rgba(28, 28, 30, 0.80);
	--sidebar-bg: rgba(24, 24, 26, 0.78);
	--hover-pill: rgba(255, 255, 255, 0.08);
	--border-hairline: rgba(255, 255, 255, 0.10);
	--border-strong: rgba(255, 255, 255, 0.18);
	--text-primary: #F5F5F7;
	--text-secondary: #98989D;
	--text-tertiary: #6E6E73;
	--accent: #0A84FF;
	--accent-hover: #409CFF;
	--accent-soft: rgba(10, 132, 255, 0.17);
	--green: #30D158;
	--green-text: #32D74B;
	--green-soft: rgba(48, 209, 88, 0.16);
	--orange: #FF9F0A;
	--orange-soft: rgba(255, 159, 10, 0.16);
	--red: #FF453A;
	--red-soft: rgba(255, 69, 58, 0.16);
	--graph-selected-bg: rgba(10, 132, 255, 0.13);
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
	--shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
	--shadow-modal: 0 28px 80px rgba(0, 0, 0, 0.65);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	scrollbar-width: thin;
	scrollbar-color: rgba(142, 142, 147, 0.32) transparent;
}

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(142, 142, 147, 0.32); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(142, 142, 147, 0.52); }

html, body {
	height: 100%;
	font-family: var(--font-sans);
	font-size: 13px;
	background: var(--bg-canvas);
	color: var(--text-primary);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow: hidden;
}

code {
	font-family: var(--font-mono);
	font-size: 0.88em;
	background: var(--surface-subtle);
	padding: 1.5px 5.5px;
	border-radius: 5px;
	border: 1px solid var(--border-hairline);
}

.sf-icon {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
	display: inline-block;
	vertical-align: middle;
}

.sf-icon-sm {
	width: 13px;
	height: 13px;
}

.hidden {
	display: none !important;
}

/* Boot Splash */
.boot-splash {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-canvas);
	z-index: 9999;
}

.boot-card {
	text-align: center;
	padding: 36px 48px;
	border-radius: 18px;
	background: var(--surface);
	border: 1px solid var(--border-hairline);
	box-shadow: var(--shadow-md);
}

.boot-icon { font-size: 36px; color: var(--accent); margin-bottom: 10px; }
.boot-title { font-size: 21px; font-weight: 650; letter-spacing: -0.022em; }
.boot-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.boot-spinner {
	width: 22px;
	height: 22px;
	margin: 18px auto 0;
	border: 2px solid var(--border-hairline);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shell */
.macos-shell {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--bg-canvas);
	color: var(--text-primary);
}

/* Authentic macOS Unified Toolbar */
.topbar {
	height: 52px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 14px;
	background: var(--glass-bg);
	backdrop-filter: saturate(180%) blur(28px);
	-webkit-backdrop-filter: saturate(180%) blur(28px);
	border-bottom: 1px solid var(--border-hairline);
	z-index: 50;
	gap: 10px;
}

.tb-left, .tb-center, .tb-right {
	display: flex;
	align-items: center;
	gap: 6px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 7px;
	font-weight: 650;
	font-size: 14.5px;
	letter-spacing: -0.02em;
	padding: 0 4px;
}

.brand-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 6px;
	background: var(--accent);
	color: #fff;
}

.brand-mark .sf-icon {
	width: 14px;
	height: 14px;
}

.progress-pill {
	font-size: 11.5px;
	font-weight: 600;
	color: var(--text-secondary);
	background: var(--hover-pill);
	padding: 3px 9px;
	border-radius: 999px;
	white-space: nowrap;
	flex-shrink: 0;
}

.branch-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: var(--font-mono);
	font-size: 11.5px;
	font-weight: 550;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent);
	white-space: nowrap;
	flex-shrink: 0;
}

.branch-pill .sf-icon {
	width: 13px;
	height: 13px;
}

/* Segmented Control (Apple Sliding Pill Track) */
.segmented-control {
	position: relative;
	display: inline-flex;
	align-items: center;
	background: var(--hover-pill);
	padding: 2.5px;
	border-radius: 8px;
	gap: 2px;
}

.seg-thumb {
	position: absolute;
	top: 2.5px;
	bottom: 2.5px;
	left: 0;
	border-radius: 6px;
	background: var(--surface-elevated);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.11), 0 0.5px 1px rgba(0, 0, 0, 0.06);
	pointer-events: none;
	z-index: 0;
	opacity: 0;
	transition: transform 0.28s var(--ease-spring), width 0.28s var(--ease-spring), opacity 0.15s ease;
	will-change: transform, width;
}

.seg-btn {
	position: relative;
	z-index: 1;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	font-family: var(--font-sans);
	font-size: 12px;
	font-weight: 550;
	padding: 4.5px 11px;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: color 0.18s var(--ease-spring);
}

.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
	background: transparent;
	color: var(--text-primary);
	box-shadow: none;
}

/* Borderless macOS Toolbar Buttons */
.tb-btn, .tb-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	font-family: var(--font-sans);
	font-size: 12.5px;
	font-weight: 500;
	padding: 5px 9px;
	border-radius: 7px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 0.15s, color 0.15s;
}

.tb-icon-btn {
	width: 29px;
	height: 29px;
	padding: 0;
}

.tb-btn:hover, .tb-icon-btn:hover {
	background: var(--hover-pill);
	color: var(--text-primary);
}

.tb-btn.active {
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 550;
}

/* Secondary & Action Buttons */
.btn-ghost, .btn-mini, .btn-primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	font-family: var(--font-sans);
	border-radius: 7px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: all 0.15s var(--ease-spring);
}

.btn-primary {
	border: none;
	background: var(--accent);
	color: #fff;
	font-size: 12.5px;
	font-weight: 600;
	padding: 6px 13px;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
	background: var(--surface-subtle);
	border: 1px solid var(--border-hairline);
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 550;
	padding: 5px 10px;
}

.btn-ghost:hover { border-color: var(--border-strong); background: var(--hover-pill); }

.btn-mini {
	background: var(--surface-subtle);
	border: 1px solid var(--border-hairline);
	color: var(--text-primary);
	font-size: 11.5px;
	font-weight: 550;
	padding: 3px 9px;
	border-radius: 6px;
}

.btn-mini:hover {
	background: var(--accent-soft);
	color: var(--accent);
	border-color: rgba(0, 122, 255, 0.25);
}

/* Main 3-Column Layout */
.main-layout {
	flex: 1;
	min-height: 0;
	display: flex;
	overflow: hidden;
	position: relative;
}

/* Left Sidebar (macOS Translucent Source List) */
.sidebar {
	width: 244px;
	flex-shrink: 0;
	background: var(--sidebar-bg);
	backdrop-filter: blur(24px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: width 0.24s var(--ease-spring), opacity 0.2s;
}

/* Vertical Split-View Resizers */
.col-resizer {
	width: 7px;
	margin: 0 -3px;
	flex-shrink: 0;
	cursor: col-resize;
	position: relative;
	z-index: 12;
	user-select: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

.col-resizer::before {
	content: "";
	width: 1px;
	height: 100%;
	background: var(--border-hairline);
	transition: width 0.14s, background 0.14s;
}

.col-resizer:hover::before,
.col-resizer.dragging::before {
	width: 3px;
	border-radius: 999px;
	background: var(--accent);
}

body.resizing-col { cursor: col-resize; user-select: none; }
body.resizing-row { cursor: row-resize; user-select: none; }
body.resizing-col .sidebar { transition: none !important; }

.sidebar.collapsed {
	width: 0;
	border-right: none;
	opacity: 0;
	pointer-events: none;
}

.sidebar-header {
	padding: 12px 12px 8px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sidebar-title {
	font-size: 11px;
	font-weight: 650;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-tertiary);
	padding-left: 6px;
}

.search-field-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.search-field-icon {
	position: absolute;
	left: 9px;
	color: var(--text-tertiary);
	pointer-events: none;
	display: flex;
}

.search-field-icon .sf-icon { width: 13px; height: 13px; }

.sidebar-search {
	width: 100%;
	padding: 5.5px 10px 5.5px 28px;
	font-size: 12.5px;
	font-family: var(--font-sans);
	color: var(--text-primary);
	background: var(--surface);
	border: 1px solid var(--border-hairline);
	border-radius: 7px;
	outline: none;
}

.sidebar-search:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.sidebar-list {
	flex: 1;
	overflow-y: auto;
	padding: 2px 8px 16px;
}

.chapter-group { margin-bottom: 12px; }
.chapter-title {
	font-size: 11px;
	font-weight: 650;
	color: var(--text-secondary);
	padding: 6px 8px 4px;
}

.lesson-item, .preset-item {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 8px;
	text-align: left;
	border: none;
	background: transparent;
	color: var(--text-primary);
	font-family: var(--font-sans);
	font-size: 12.5px;
	padding: 6.5px 8px;
	border-radius: 7px;
	cursor: pointer;
	margin-bottom: 1px;
	transition: background 0.12s;
}

.preset-item {
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	padding: 8px 10px;
	margin-bottom: 3px;
}

.preset-top-row {
	display: flex;
	align-items: center;
	gap: 7px;
}

.preset-icon { color: var(--accent); display: flex; }
.preset-name { font-size: 12.5px; font-weight: 600; }
.preset-cat { font-size: 11px; color: var(--text-secondary); padding-left: 22px; }

.lesson-item:hover, .preset-item:hover { background: var(--hover-pill); }
.lesson-item.active, .preset-item.active {
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}

.lesson-num, .lesson-check {
	width: 19px;
	height: 19px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 10.5px;
	font-weight: 600;
	flex-shrink: 0;
}

.lesson-num {
	background: var(--hover-pill);
	color: var(--text-secondary);
}

.lesson-check { color: var(--green-text); }
.lesson-check .sf-icon { width: 16px; height: 16px; }

/* Center Lesson / Repository Pane */
.lesson-pane {
	width: 336px;
	flex-shrink: 0;
	padding: 12px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border-hairline);
	border-radius: 12px;
	padding: 16px;
	box-shadow: var(--shadow-sm);
}

.lesson-eyebrow {
	font-size: 11px;
	font-weight: 650;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--accent);
	margin-bottom: 4px;
}

.lesson-title {
	font-size: 20px;
	font-weight: 650;
	letter-spacing: -0.022em;
	line-height: 1.2;
}

.lesson-subtitle {
	font-size: 13px;
	color: var(--text-secondary);
	margin-top: 5px;
	line-height: 1.45;
}

.lesson-concept {
	margin-top: 12px;
	font-size: 13px;
	line-height: 1.55;
	color: var(--text-primary);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.lesson-concept ul, .lesson-concept ol {
	padding-left: 18px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.repo-meta-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-top: 12px;
}

.repo-meta-item {
	background: var(--surface-subtle);
	border-radius: 8px;
	padding: 7px 9px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.meta-k { font-size: 10.5px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; }
.meta-v { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

.repo-remote-line {
	margin-top: 8px;
	font-size: 11.5px;
	color: var(--text-secondary);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.challenge-list {
	padding-left: 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12.5px;
	color: var(--text-primary);
	line-height: 1.4;
}

.section-label {
	font-size: 11px;
	font-weight: 650;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-tertiary);
	margin-bottom: 8px;
}

.objectives-section {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--border-hairline);
}

.objective-row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 12.5px;
	padding: 7px 10px;
	border-radius: 8px;
	background: var(--surface-subtle);
	margin-bottom: 6px;
	line-height: 1.4;
}

.objective-row.done {
	background: var(--green-soft);
	color: var(--green-text);
}

.obj-icon { display: flex; margin-top: 1px; color: var(--text-tertiary); }
.objective-row.done .obj-icon { color: var(--green-text); }

.congrats-banner {
	margin-top: 10px;
	padding: 10px 12px;
	border-radius: 9px;
	background: var(--green-soft);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 12.5px;
	color: var(--green-text);
}

.badge-gold { font-weight: 650; font-size: 12px; }
.lesson-actions { margin-top: 12px; display: flex; gap: 7px; flex-wrap: wrap; }

.hints-box, .solution-box {
	margin-top: 10px;
	padding: 10px 12px;
	border-radius: 9px;
	background: var(--surface-subtle);
	font-size: 12.5px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.solution-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Status Inspector */
.status-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.status-header .section-label { margin-bottom: 0; }
.status-group { margin-top: 8px; }
.status-group-title { font-size: 11px; font-weight: 650; margin-bottom: 4px; }
.status-group-title.staged { color: var(--green-text); }
.status-group-title.unstaged { color: var(--orange); }
.status-group-title.conflict { color: var(--red); }

.status-row {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 4px 6px;
	border-radius: 6px;
	font-size: 12px;
}
.status-row:hover { background: var(--hover-pill); }

.status-badge {
	width: 18px;
	height: 18px;
	border-radius: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-mono);
	font-size: 10.5px;
	font-weight: 700;
}
.status-badge.staged { background: var(--green-soft); color: var(--green-text); }
.status-badge.unstaged { background: var(--orange-soft); color: var(--orange); }
.status-badge.conflict { background: var(--red-soft); color: var(--red); }

.status-path {
	flex: 1;
	font-family: var(--font-mono);
	font-size: 12px;
	cursor: pointer;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.status-clean, .status-empty { font-size: 12.5px; color: var(--text-secondary); padding: 4px 0; }

/* Right Column: Canvas + Resizer + Terminal */
.workspace-column {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding: 12px;
	gap: 0;
	overflow: hidden;
	position: relative;
}

.workspace-canvas {
	flex: 1;
	min-height: 140px;
	background: var(--surface);
	border: 1px solid var(--border-hairline);
	border-radius: 12px;
	box-shadow: var(--shadow-sm);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.canvas-header {
	padding: 8px 12px;
	border-bottom: 1px solid var(--border-hairline);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
}

.tab-alert {
	display: inline-block;
	background: var(--red);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	padding: 1px 5px;
	border-radius: 999px;
	margin-left: 4px;
}

.conflict-pill, .bisect-pill {
	font-size: 11.5px;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 999px;
	white-space: nowrap;
}
.conflict-pill { background: var(--red-soft); color: var(--red); }
.bisect-pill { background: var(--orange-soft); color: var(--orange); }

.canvas-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.canvas-body > * { animation: tabFadeIn 0.18s ease-out; }
@keyframes tabFadeIn {
	from { opacity: 0.6; transform: translateY(2px); }
	to { opacity: 1; transform: translateY(0); }
}

.diff-content-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }

/* Commit Graph & Inspector */
.graph-split { flex: 1; min-height: 0; display: flex; }
.graph-scroll { flex: 1; overflow: auto; padding: 8px; }
.graph-sha { font-family: var(--font-mono); font-size: 12px; font-weight: 600; fill: var(--text-secondary); }
.graph-pill-text { font-family: var(--font-sans); font-size: 11px; font-weight: 600; }
.graph-msg { font-family: var(--font-sans); font-size: 12.5px; fill: var(--text-primary); }
.graph-node:hover .graph-row-bg { fill: var(--graph-selected-bg); }

.commit-inspector {
	width: 236px;
	flex-shrink: 0;
	border-left: 1px solid var(--border-hairline);
	padding: 12px 14px;
	overflow-y: auto;
	background: var(--surface-subtle);
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.inspector-header { display: flex; align-items: center; gap: 8px; }
.sha-pill {
	font-family: var(--font-mono);
	font-size: 11.5px;
	font-weight: 600;
	background: var(--accent-soft);
	color: var(--accent);
	padding: 2px 7px;
	border-radius: 5px;
}
.inspector-title { font-size: 11.5px; font-weight: 650; color: var(--text-secondary); }
.inspector-msg { font-size: 13px; font-weight: 600; line-height: 1.35; }
.inspector-meta { font-size: 12px; color: var(--text-secondary); }
.inspector-files { display: flex; flex-wrap: wrap; gap: 4px; }
.file-chip {
	font-family: var(--font-mono);
	font-size: 11px;
	background: var(--surface);
	border: 1px solid var(--border-hairline);
	padding: 2px 6px;
	border-radius: 5px;
}
.inspector-actions { margin-top: 4px; display: flex; gap: 6px; }

/* File Editor */
.editor-layout { flex: 1; min-height: 0; display: flex; }
.editor-sidebar {
	width: 196px;
	border-right: 1px solid var(--border-hairline);
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
}
.editor-new-row { display: flex; gap: 4px; }
.mini-input {
	flex: 1;
	min-width: 0;
	padding: 4px 7px;
	font-size: 12px;
	font-family: var(--font-mono);
	background: var(--surface-subtle);
	color: var(--text-primary);
	border: 1px solid var(--border-hairline);
	border-radius: 6px;
	outline: none;
}
.editor-file-list { display: flex; flex-direction: column; gap: 2px; }
.editor-file-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-align: left;
	border: none;
	background: transparent;
	color: var(--text-primary);
	font-family: var(--font-mono);
	font-size: 12px;
	padding: 5.5px 8px;
	border-radius: 6px;
	cursor: pointer;
}
.editor-file-name { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-file-name .sf-icon { width: 13px; height: 13px; color: var(--text-tertiary); }
.editor-file-btn:hover { background: var(--hover-pill); }
.editor-file-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.editor-file-btn.active .sf-icon { color: var(--accent); }

.conflict-dot {
	background: var(--red);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	width: 15px;
	height: 15px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.editor-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.editor-toolbar {
	padding: 7px 12px;
	border-bottom: 1px solid var(--border-hairline);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
.editor-filename { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.editor-actions { display: flex; gap: 6px; }

.conflict-toolbar {
	padding: 7px 12px;
	background: var(--red-soft);
	border-bottom: 1px solid rgba(255, 59, 48, 0.22);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 12px;
	color: var(--red);
}
.conflict-label { display: inline-flex; align-items: center; gap: 6px; }
.conflict-btns { display: flex; gap: 6px; }

.file-textarea {
	flex: 1;
	border: none;
	outline: none;
	resize: none;
	padding: 12px 14px;
	font-family: var(--font-mono);
	font-size: 12.5px;
	line-height: 1.55;
	background: var(--surface);
	color: var(--text-primary);
}

/* Diff Viewer */
.diff-toolbar { padding: 8px 12px; border-bottom: 1px solid var(--border-hairline); }
.diff-file-card { margin: 12px; border: 1px solid var(--border-hairline); border-radius: 9px; overflow: hidden; }
.diff-file-header {
	padding: 7px 12px;
	background: var(--surface-subtle);
	border-bottom: 1px solid var(--border-hairline);
	display: flex;
	justify-content: space-between;
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 600;
}
.diff-badge { text-transform: uppercase; font-size: 10.5px; color: var(--text-secondary); }
.diff-lines { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; overflow-x: auto; }
.diff-line { display: flex; gap: 8px; padding: 1px 10px; white-space: pre; }
.diff-add { background: var(--green-soft); color: var(--green-text); }
.diff-del { background: var(--red-soft); color: var(--red); }
.diff-prefix { user-select: none; opacity: 0.7; }

/* Remote & Reflog */
.remote-header {
	padding: 9px 12px;
	border-bottom: 1px solid var(--border-hairline);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 12.5px;
}
.remote-url { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); margin-left: 6px; }
.remote-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.two-col-cards {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
.subcard {
	background: var(--surface-subtle);
	border: 1px solid var(--border-hairline);
	border-radius: 10px;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.list-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 7px 9px;
	border-radius: 7px;
	background: var(--surface);
	border: 1px solid var(--border-hairline);
	font-size: 12px;
}
.row-btns { display: flex; gap: 4px; }
.reflog-idx { color: var(--accent); font-family: var(--font-mono); font-size: 11px; }
.muted-text { font-size: 12.5px; color: var(--text-secondary); }

/* Empty State */
.empty-state {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 28px;
	gap: 8px;
}
.empty-icon {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--surface-subtle);
	color: var(--text-tertiary);
	display: flex;
	align-items: center;
	justify-content: center;
}
.empty-icon .sf-icon { width: 20px; height: 20px; }
.empty-title { font-size: 14.5px; font-weight: 650; }
.empty-subtitle { font-size: 12.5px; color: var(--text-secondary); max-width: 360px; line-height: 1.45; }

/* Terminal Drag Resizer */
.terminal-resizer {
	height: 12px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: row-resize;
	user-select: none;
}

.resizer-grip {
	width: 38px;
	height: 4px;
	border-radius: 999px;
	background: var(--border-strong);
	transition: background 0.15s, width 0.15s;
}

.terminal-resizer:hover .resizer-grip,
.terminal-resizer.dragging .resizer-grip {
	background: var(--accent);
	width: 56px;
}

/* macOS Terminal Modes (split / half / full / closed) */
.terminal-pane {
	flex-shrink: 0;
	min-height: 140px;
	background: #141519;
	color: #E5E5EA;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	box-shadow: var(--shadow-md);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: border-radius 0.2s var(--ease-spring);
}

.terminal-pane.term-half {
	height: 50% !important;
}

.terminal-pane.term-full {
	position: fixed;
	top: 52px;
	left: 0;
	right: 0;
	bottom: 0;
	height: auto !important;
	border-radius: 0;
	border-left: none;
	border-right: none;
	border-bottom: none;
	z-index: 45;
}

.terminal-pane.term-closed {
	display: none;
}

.terminal-reopen-wrap {
	position: fixed;
	bottom: 16px;
	right: 18px;
	z-index: 40;
}

.reopen-terminal-pill {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	border-radius: 999px;
	background: #1C1C1E;
	color: #F5F5F7;
	border: 1px solid rgba(255, 255, 255, 0.16);
	box-shadow: var(--shadow-md);
	font-family: var(--font-sans);
	font-size: 12.5px;
	font-weight: 550;
	cursor: pointer;
	transition: transform 0.16s var(--ease-spring);
}

.reopen-terminal-pill:hover {
	transform: translateY(-1px);
	border-color: var(--accent);
}

.terminal-chrome {
	height: 36px;
	padding: 0 10px 0 12px;
	background: rgba(255, 255, 255, 0.04);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	display: flex;
	align-items: center;
	gap: 10px;
}

.traffic-lights { display: flex; gap: 6px; flex-shrink: 0; }
.tl {
	width: 11.5px;
	height: 11.5px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	padding: 0;
	transition: filter 0.12s, transform 0.12s;
}
.tl:hover { filter: brightness(1.15); transform: scale(1.08); }
.tl-red { background: #FF5F56; }
.tl-yellow { background: #FFBD2E; }
.tl-green { background: #27C93F; }

.terminal-title {
	font-size: 11.5px;
	font-weight: 600;
	color: #98989D;
	white-space: nowrap;
}

.quick-chips {
	flex: 1;
	min-width: 0;
	display: flex;
	gap: 5px;
	overflow-x: auto;
	scrollbar-width: none;
}
.quick-chips::-webkit-scrollbar { display: none; }

.quick-chip {
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(255, 255, 255, 0.10);
	color: #D1D1D6;
	font-family: var(--font-mono);
	font-size: 11px;
	padding: 2.5px 8px;
	border-radius: 5px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
}
.quick-chip:hover {
	background: rgba(10, 132, 255, 0.28);
	border-color: rgba(10, 132, 255, 0.5);
	color: #fff;
}

.term-win-controls {
	display: flex;
	align-items: center;
	gap: 3px;
	flex-shrink: 0;
}

.term-ctrl-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border: none;
	background: transparent;
	color: #98989D;
	font-family: var(--font-sans);
	font-size: 11px;
	font-weight: 550;
	padding: 4px 7px;
	border-radius: 5px;
	cursor: pointer;
	white-space: nowrap;
}
.term-ctrl-btn .sf-icon { width: 13px; height: 13px; }
.term-ctrl-btn:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
.term-ctrl-btn.active { background: rgba(10, 132, 255, 0.25); color: #64D2FF; }

.terminal-scrollback {
	flex: 1;
	overflow-y: auto;
	padding: 10px 14px;
	font-family: var(--font-mono);
	font-size: 12.5px;
	line-height: 1.5;
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.term-note { color: #64D2FF; font-size: 12px; }
.term-prompt { color: #30D158; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.term-cmd { color: #FFFFFF; font-weight: 600; }
.term-output { font-family: var(--font-mono); font-size: 12px; color: #D1D1D6; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.term-output.error { color: #FF6961; }

.terminal-autocomplete {
	padding: 0 14px;
	font-family: var(--font-mono);
	font-size: 11px;
	color: #8E8E93;
	min-height: 0;
}

.terminal-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(255, 255, 255, 0.02);
}

.term-input {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	color: #FFFFFF;
	font-family: var(--font-mono);
	font-size: 13px;
}

.btn-run {
	background: #0A84FF;
	color: #fff;
	border: none;
	font-family: var(--font-sans);
	font-size: 11.5px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 6px;
	cursor: pointer;
}
.btn-run:hover { background: #409CFF; }

/* Modals & Spotlight */
.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.34);
	backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
}

.modal-sheet {
	width: min(640px, 92vw);
	max-height: 80vh;
	background: var(--surface);
	border: 1px solid var(--border-strong);
	border-radius: 14px;
	box-shadow: var(--shadow-modal);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding: 16px;
	gap: 12px;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 650; }
.palette-input {
	width: 100%;
	padding: 9px 12px;
	font-size: 13.5px;
	font-family: var(--font-sans);
	background: var(--surface-subtle);
	color: var(--text-primary);
	border: 1px solid var(--border-hairline);
	border-radius: 9px;
	outline: none;
}
.palette-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.palette-list, .rebase-steps { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.palette-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 9px;
	background: var(--surface-subtle);
}
.palette-cat { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--accent); margin-right: 6px; }
.palette-cmd { font-weight: 600; }
.palette-sum { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

.rebase-step-row { display: flex; align-items: center; gap: 8px; }
.rebase-select {
	padding: 5px 8px;
	border-radius: 7px;
	background: var(--surface-subtle);
	color: var(--text-primary);
	border: 1px solid var(--border-hairline);
	font-family: var(--font-mono);
	font-size: 12px;
}
.rebase-msg-input {
	flex: 1;
	padding: 6px 9px;
	border-radius: 7px;
	background: var(--surface-subtle);
	color: var(--text-primary);
	border: 1px solid var(--border-hairline);
	font-size: 12.5px;
}
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; }

.toast-pill {
	position: fixed;
	bottom: 20px;
	right: 20px;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--surface-elevated);
	border: 1px solid var(--border-strong);
	box-shadow: var(--shadow-md);
	font-size: 12.5px;
	font-weight: 550;
	z-index: 90;
}

@media (max-width: 1220px) {
	.sidebar { width: 206px; }
	.lesson-pane { width: 286px; }
	.graph-split { flex-direction: column; }
	.commit-inspector {
		width: 100%;
		max-height: 190px;
		border-left: none;
		border-top: 1px solid var(--border-hairline);
		padding: 10px 14px;
		gap: 6px;
	}
	.tb-btn { padding: 4px 7px; font-size: 12px; }
	.seg-btn { padding: 4px 8px; font-size: 11.5px; }
}

/* App page frame: shell fills the window above the credit line */
body { display: flex; flex-direction: column; height: 100dvh; }
#app { flex: 1; min-height: 0; }
.app-credit {
	flex-shrink: 0;
	padding: 5px 12px;
	text-align: center;
	font-size: 11px;
	color: var(--text-secondary);
	background: var(--bg-canvas);
	border-top: 1px solid var(--border-hairline);
}
