/* ─── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --canvas:          #ffffff;
  --canvas-subtle:   #f6f8fa;
  --canvas-inset:    #f0f2f5;
  --border:          #d0d7de;
  --border-muted:    #e1e4e8;
  --fg:              #1f2328;
  --fg-muted:        #656d76;
  --fg-subtle:       #8b949e;
  --accent:          #0969da;
  --accent-hover:    #0550ae;
  --success:         #1a7f37;
  --danger:          #cf222e;
  --danger-subtle:   #fff0ee;
  --warning:         #9a6700;
  --warning-subtle:  #fffbe5;
  --header-bg:       #24292f;
  --header-fg:       #ffffff;
  --sidebar-bg:      #f6f8fa;
  --sidebar-w:       272px;
  --radius:          6px;
  --radius-lg:       8px;
  --shadow-sm:       0 1px 0 rgba(27,31,36,0.04);
  --shadow-md:       0 3px 6px rgba(140,149,159,0.15);
  --shadow-lg:       0 8px 24px rgba(140,149,159,0.2);
  --font:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono:       ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

/* ─── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
* { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.6; color: var(--fg); background: var(--canvas); -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.25; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }
pre { font-family: var(--font-mono); }
code { font-family: var(--font-mono); }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ─── Site Header ────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  color: var(--header-fg);
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--header-fg);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.header-logo:hover { text-decoration: none; opacity: 0.85; }
.header-badge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  color: rgba(255,255,255,0.8);
}
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-link {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.header-link:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: #1f883d;
  border-color: rgba(31,35,40,0.15);
  color: #fff;
}
.btn-primary:hover { background: #1a7f37; }
.btn-danger {
  background: var(--canvas);
  border-color: var(--border);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-subtle); border-color: rgba(207,34,46,0.4); }
.btn-outline {
  background: var(--canvas);
  border-color: var(--border);
  color: var(--fg);
}
.btn-outline:hover { background: var(--canvas-subtle); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--fg); }
.form-input {
  display: block;
  width: 100%;
  padding: 6px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--fg);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(9,105,218,0.12); }
.form-group { margin-bottom: 16px; }
.form-group-grow { flex: 1; min-width: 0; }
.form-group-actions { flex-shrink: 0; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-error {
  background: var(--danger-subtle);
  border-color: rgba(207,34,46,0.3);
  color: var(--danger);
}

/* ─── Badge / Pill ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 500;
  height: 20px;
  border-radius: 20px;
  background: rgba(31,35,40,0.08);
  color: var(--fg-muted);
  vertical-align: middle;
  margin-left: 6px;
}

/* ─── Login Page ─────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas-subtle);
  padding: 40px 16px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-header svg { margin: 0 auto 12px; color: var(--fg-muted); }
.login-header h1 { font-size: 20px; margin-bottom: 4px; }
.login-header p { color: var(--fg-muted); font-size: 14px; }
.login-form { margin-top: 4px; }

/* ─── Admin Main ─────────────────────────────────────────────────────────────── */
.admin-body { background: var(--canvas-subtle); min-height: 100vh; }
.admin-main { padding: 32px 0 64px; }

/* ─── Sections ───────────────────────────────────────────────────────────────── */
.section { margin-bottom: 40px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 17px; font-weight: 600; }

/* ─── Repo Grid (Admin) ──────────────────────────────────────────────────────── */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.repo-card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.repo-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--fg-muted);
}
.repo-name { font-weight: 600; color: var(--fg); font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-visibility {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  flex-shrink: 0;
}
.repo-desc { font-size: 13px; color: var(--fg-muted); margin-bottom: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.repo-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.repo-lang, .repo-stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--fg-muted); }
.repo-updated { font-size: 12px; color: var(--fg-subtle); margin-left: auto; }
.lang-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ─── New Link Panel ─────────────────────────────────────────────────────────── */
.new-link-panel {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.new-link-form .form-group { margin-bottom: 0; }

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead { background: var(--canvas-subtle); border-bottom: 1px solid var(--border); }
.table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border-muted); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--canvas-subtle); }
.row-muted td { opacity: 0.55; }
.td-label { font-weight: 500; }
.td-url { max-width: 320px; }
.td-date { white-space: nowrap; color: var(--fg-muted); }
.td-views { color: var(--fg-muted); text-align: right; }
.td-actions { width: 80px; }
.url-cell { display: flex; align-items: center; gap: 8px; }
.url-text { font-family: var(--font-mono); font-size: 12px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.btn-copy {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 6px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  transition: background 0.15s;
}
.btn-copy:hover { background: var(--canvas-subtle); color: var(--fg); }

/* Copy toast */
.url-cell { position: relative; }
.copy-toast {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%) translateX(4px);
  background: #1f2328;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 10;
}
.copy-toast-show { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ─── Status / Expiry Badges ─────────────────────────────────────────────────── */
.expiry-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.expiry-ok      { background: #dafbe1; color: var(--success); }
.expiry-warn    { background: var(--warning-subtle); color: var(--warning); }
.expiry-expired { background: var(--canvas-inset); color: var(--fg-muted); }
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-active::before   { background: var(--success); }
.status-inactive::before { background: var(--fg-subtle); }

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-muted);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
}

/* ─── Viewer Body ────────────────────────────────────────────────────────────── */
.viewer-body { background: var(--canvas); min-height: 100vh; }

/* ─── Viewer Hero ────────────────────────────────────────────────────────────── */
.viewer-hero {
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border);
  padding: 32px 0;
}
.viewer-hero-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.viewer-hero-sub { color: var(--fg-muted); font-size: 14px; }

/* ─── Repo Grid (Viewer Dashboard) ──────────────────────────────────────────── */
.repo-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 24px 0;
}
@media (max-width: 900px) { .repo-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .repo-list { grid-template-columns: 1fr; } }
.repo-list-item {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.repo-list-item:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.06); text-decoration: none; }
.repo-list-item:hover .rli-name { color: var(--accent); text-decoration: underline; }
.rli-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--fg-muted); }
.rli-name { font-size: 15px; font-weight: 600; color: var(--accent); flex: 1; }
.rli-arrow { opacity: 0; transition: opacity 0.15s, transform 0.15s; }
.repo-list-item:hover .rli-arrow { opacity: 1; transform: translateX(2px); }
.rli-desc { color: var(--fg-muted); font-size: 13px; margin-bottom: 12px; line-height: 1.5; flex: 1; }
.rli-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: auto; }
.rli-lang { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--fg-muted); }
.rli-stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--fg-muted); }
.rli-updated { font-size: 12px; color: var(--fg-subtle); }

/* ─── Repo Sub-header ────────────────────────────────────────────────────────── */
.repo-subheader {
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 100;
}
.repo-subheader-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
}
.repo-breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 14px; min-width: 0; }
.breadcrumb-link { color: var(--accent); font-weight: 500; white-space: nowrap; }
.breadcrumb-sep { color: var(--fg-subtle); }
.breadcrumb-current { font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-tabs { display: flex; gap: 0; flex-shrink: 0; }
.repo-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 52px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.repo-tab:hover { color: var(--fg); text-decoration: none; }
.repo-tab.active { color: var(--fg); border-bottom-color: #fd8c73; font-weight: 600; }

/* ─── Repo Layout (sidebar + content) ───────────────────────────────────────── */
.repo-body { padding: 0; }
.repo-layout { display: flex; min-height: calc(100vh - 108px); align-items: flex-start; }

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.repo-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 108px);
  position: sticky;
  top: 108px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
}
.sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--canvas-subtle);
}
.branch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}

/* ─── File Tree ──────────────────────────────────────────────────────────────── */
.file-tree { padding: 8px 0; }
.tree-root { padding: 0 4px; }
.tree-children { padding: 0; }
.tree-item { display: block; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 12px;
  font-size: 13px;
  color: var(--fg);
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s;
  text-decoration: none;
}
.tree-row:hover { background: rgba(31,35,40,0.06); text-decoration: none; color: var(--fg); }
.tree-file.active > .tree-row { background: rgba(9,105,218,0.08); color: var(--accent); font-weight: 500; }
.tree-file.active > .tree-row:hover { background: rgba(9,105,218,0.12); }
.tree-name { overflow: hidden; text-overflow: ellipsis; }
.tree-spacer { width: 12px; flex-shrink: 0; }
.tree-file-icon { flex-shrink: 0; }
.tree-chevron {
  flex-shrink: 0;
  transition: transform 0.15s;
  color: var(--fg-subtle);
}
.tree-dir .tree-children { display: none; padding-left: 18px; }
.tree-dir.open > .tree-toggle .tree-chevron { transform: rotate(90deg); }
.tree-dir.open > .tree-children { display: block; }
/* When children don't have hidden attr set by JS */
.tree-children:not([hidden]) { display: block; }

/* ─── Repo Content Area ──────────────────────────────────────────────────────── */
.repo-content { flex: 1; min-width: 0; padding: 24px 32px; }

/* ─── Repo Stats Bar ─────────────────────────────────────────────────────────── */
.repo-stats-bar {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.repo-description { font-size: 14px; color: var(--fg-muted); margin-bottom: 12px; }
.language-bar {
  height: 8px;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  margin-bottom: 8px;
  background: var(--border-muted);
}
.lang-segment { height: 100%; }
.language-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.lang-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.lang-legend-name { font-weight: 500; }
.lang-legend-pct { color: var(--fg-muted); }

/* ─── Panels ─────────────────────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.panel-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.panel-link { font-size: 12px; color: var(--accent); }

/* ─── Recent Commits ─────────────────────────────────────────────────────────── */
.recent-commits {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}
.commit-list-compact { }
.commit-item-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-muted);
}
.commit-item-compact:last-child { border-bottom: 0; }
.commit-avatar { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; }
.commit-compact-body { flex: 1; min-width: 0; }
.commit-compact-msg { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commit-compact-meta { font-size: 12px; color: var(--fg-muted); }
.commit-sha-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 6px;
  color: var(--fg-muted);
  flex-shrink: 0;
}

/* ─── README ─────────────────────────────────────────────────────────────────── */
.readme-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.markdown-body {
  padding: 24px 32px;
  max-width: none;
}
.file-markdown { padding: 32px; }

/* Markdown content styles */
.markdown-body h1 { font-size: 1.75em; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin: 24px 0 16px; }
.markdown-body h2 { font-size: 1.4em; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin: 24px 0 14px; }
.markdown-body h3 { font-size: 1.15em; margin: 20px 0 12px; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { margin: 16px 0 10px; }
.markdown-body p { margin-bottom: 14px; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; margin-bottom: 14px; }
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body code {
  background: var(--canvas-inset);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.875em;
}
.markdown-body pre {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}
.markdown-body pre code { background: none; border: none; padding: 0; font-size: 13px; }
.markdown-body blockquote {
  border-left: 3px solid var(--border);
  padding: 4px 0 4px 16px;
  color: var(--fg-muted);
  margin: 16px 0;
}
.markdown-body table { border-collapse: collapse; width: 100%; margin-bottom: 16px; }
.markdown-body table th, .markdown-body table td { border: 1px solid var(--border); padding: 8px 12px; }
.markdown-body table th { background: var(--canvas-subtle); font-weight: 600; }
.markdown-body hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.markdown-body img { max-width: 100%; border-radius: var(--radius); }
.markdown-body a { color: var(--accent); }

/* ─── File Panel ─────────────────────────────────────────────────────────────── */
.file-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.file-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border);
}
.file-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--fg-muted); }
.file-actions { display: flex; gap: 8px; }

/* ─── Code Table ─────────────────────────────────────────────────────────────── */
.code-wrap { overflow: auto; max-height: calc(100vh - 200px); }
.code-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; }
.line-num {
  width: 1%;
  min-width: 52px;
  padding: 0 16px 0 12px;
  text-align: right;
  color: var(--fg-subtle);
  user-select: none;
  white-space: nowrap;
  border-right: 1px solid var(--border-muted);
  background: var(--canvas-subtle);
  font-size: 12px;
  vertical-align: top;
}
.line-num:target, tr:target .line-num { background: #fffbe5; color: var(--warning); }
.line-code {
  padding: 0 16px;
  white-space: pre;
  vertical-align: top;
  color: var(--fg);
}
.line-code .hljs { background: none; padding: 0; }

/* ─── Binary / Image preview ─────────────────────────────────────────────────── */
.image-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--canvas-subtle);
  min-height: 200px;
}
.image-preview img { max-height: 600px; object-fit: contain; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.binary-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--fg-muted);
  text-align: center;
}

/* ─── Commits Page ───────────────────────────────────────────────────────────── */
.commits-page { padding: 24px 0 48px; }
.commits-header { margin-bottom: 24px; }
.commits-title { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.branch-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--canvas-inset);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
.commit-day-group { margin-bottom: 28px; }
.commit-day-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 0;
}
.commit-list {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  background: var(--canvas);
}
.commit-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-muted);
}
.commit-item:last-child { border-bottom: 0; }
.commit-item:hover { background: var(--canvas-subtle); }
.commit-left { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
.commit-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.commit-avatar-lg { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.commit-info { flex: 1; min-width: 0; }
.commit-subject-row { margin-bottom: 3px; }
.commit-subject { font-size: 14px; font-weight: 500; word-break: break-word; }
.commit-meta-row { font-size: 12px; color: var(--fg-muted); display: flex; align-items: center; gap: 6px; }
.commit-author { font-weight: 500; }
.commit-dot { color: var(--fg-subtle); }
.commit-sha {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  color: var(--fg-muted);
}
.commit-expand-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 11px;
  padding: 1px 5px;
  margin-left: 6px;
  cursor: pointer;
  vertical-align: middle;
}
.commit-body {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
  background: var(--canvas-inset);
  border-radius: var(--radius);
  padding: 10px;
}

/* ─── Pagination ─────────────────────────────────────────────────────────────── */
.pagination { display: flex; justify-content: space-between; margin-top: 24px; }
.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  transition: background 0.15s;
  text-decoration: none;
}
.pagination-btn:hover { background: var(--canvas-subtle); text-decoration: none; }

/* ─── Invalid / 404 ──────────────────────────────────────────────────────────── */
.invalid-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas-subtle);
  padding: 40px 16px;
}
.invalid-card {
  text-align: center;
  max-width: 420px;
}
.invalid-icon { color: var(--fg-subtle); margin: 0 auto 20px; }
.invalid-title { font-size: 22px; margin-bottom: 10px; }
.invalid-desc { color: var(--fg-muted); font-size: 15px; line-height: 1.6; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(31,35,40,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(31,35,40,0.35); }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .repo-layout { flex-direction: column; }
  .repo-sidebar {
    width: 100%;
    position: static;
    max-height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .repo-content { padding: 16px; }
  .repo-subheader-inner { flex-direction: column; align-items: flex-start; height: auto; padding: 12px 0; gap: 8px; }
  .repo-tabs { width: 100%; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .repo-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .table th:nth-child(n+3), .table td:nth-child(n+3) { display: none; }
}
