:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --border: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #f78166;
  --accent-2: #d29922;
  --code-bg: #161b22;
  --success: #3fb950;
  --danger: #f85149;
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.nav-logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-username {
  color: var(--text);
}

.nav-avatar {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-decoration: none;
}

body {
  padding-top: 72px;
}

.flash {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 6px;
  border: 1px solid;
}

.flash-info {
  background: #0c2d6b22;
  border-color: #1f6feb;
  color: #79c0ff;
}

.flash-error {
  background: #f8514922;
  border-color: var(--danger);
  color: #ffa198;
}

.flash-success {
  background: #3fb95022;
  border-color: var(--success);
  color: #56d364;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.repo-header {
  margin-bottom: 24px;
}

.repo-title {
  font-size: 20px;
  font-weight: 600;
}

.repo-title a {
  color: var(--accent);
}

.repo-description {
  color: var(--text-muted);
  margin-top: 4px;
}

.clone-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 16px;
}

.clone-url {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  background: none;
  border: none;
  outline: none;
  cursor: text;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.file-table th {
  background: var(--bg-secondary);
  padding: 8px 16px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.file-table td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.file-table tr:last-child td {
  border-bottom: none;
}

.file-icon {
  margin-right: 8px;
  color: var(--text-muted);
}

.commit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.commit-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.commit-item:last-child {
  border-bottom: none;
}

.commit-sha {
  font-family: monospace;
  font-size: 12px;
  background: var(--code-bg);
  color: var(--accent-2);
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
}

.commit-sha:hover {
  background: var(--border);
}

.commit-message {
  font-weight: 500;
  margin-bottom: 4px;
}

.commit-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  font-size: 14px;
}

.breadcrumb a {
  color: var(--accent-2);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.blob-viewer {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  padding: 16px;
}

.blob-viewer pre {
  margin: 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre;
}

.markdown-body {
  color: var(--text);
  line-height: 1.6;
}

.markdown-body h1,
.markdown-body h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.markdown-body code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 90%;
}

.markdown-body pre {
  background: var(--code-bg);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
}

.markdown-body a {
  color: var(--accent-2);
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 6px 12px;
}

.form {
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.form input[type="text"],
.form input[type="password"],
.form textarea,
.form select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.form input:focus-visible,
.form textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-color: var(--accent-2);
}

.form .radio-group {
  display: flex;
  gap: 16px;
}

.form .radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  cursor: pointer;
}

.badge-private {
  background: #21262d;
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.badge-public {
  background: #1f3d1f;
  color: var(--success);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}

.hero {
  text-align: center;
  padding: 64px 16px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero p {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.empty-state code {
  background: var(--code-bg);
  padding: 12px 16px;
  border-radius: 6px;
  display: block;
  text-align: left;
  font-family: monospace;
  font-size: 13px;
  margin: 16px 0;
}

footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 64px;
}

@media (max-width: 768px) {
  .container {
    padding: 16px 12px;
  }
  .file-table td:nth-child(2),
  .file-table th:nth-child(2) {
    display: none; /* hide commit message on mobile */
  }
  .commit-item {
    flex-direction: column;
  }
}
/* Utility */
.muted { color: var(--text-muted); }
.text-muted { color: var(--text-muted); }

/* Nav items */
.nav-item { color: var(--text-muted); text-decoration: none; font-size: 14px; }
.nav-item:hover { color: var(--text); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: var(--accent); border-radius: 50%; font-size: 11px; font-weight: 700; color: #0d1117; text-decoration: none; }
.avatar:hover { background: var(--accent-2); }

/* Skip nav */
.skip-nav { position: absolute; left: -9999px; top: 8px; padding: 8px 16px; background: var(--accent); color: #000; z-index: 9999; border-radius: 4px; font-weight: 600; }
.skip-nav:focus { left: 16px; }

/* Badge */
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); }

/* Button variants */
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 4px; }
.btn-outline-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); border-radius: 6px; cursor: pointer; padding: 5px 12px; font-size: 13px; }
.btn-outline-danger:hover { background: var(--danger); color: white; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Repo list */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.repo-list { display: flex; flex-direction: column; gap: 8px; }
.repo-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 16px; }
.repo-card:hover { border-color: var(--accent-2); }
.repo-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.repo-name { font-size: 15px; font-weight: 600; color: var(--accent); }
.repo-desc { color: var(--text-muted); font-size: 13px; margin: 4px 0; }
.repo-meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* User profile */
.user-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.user-avatar { width: 48px; height: 48px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: #0d1117; flex-shrink: 0; }
.user-header h1 { margin: 0 0 4px; font-size: 20px; }
.user-header h1:hover { background: var(--accent-2); }

/* Repo view */
.sep { color: var(--text-muted); margin: 0 4px; }
.clone-bar { display: flex; align-items: center; gap: 8px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; margin-bottom: 16px; }
.repo-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.branch-select { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text); padding: 4px 8px; border-radius: 6px; font-size: 13px; }
.file-name { font-size: 14px; }
.file-message { color: var(--text-muted); font-size: 13px; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Readme */
.readme { margin-top: 24px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.readme-header { background: var(--bg-secondary); padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.readme-body { padding: 16px; }

/* Empty repo */
.empty-repo { margin-top: 24px; padding: 24px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; }
.empty-repo h3 { margin: 0 0 8px; font-size: 16px; }
.code-block { background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; font-size: 13px; color: var(--text-muted); white-space: pre; overflow-x: auto; margin: 0; }

/* SSH key cards */
.key-card { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.key-card:last-child { border-bottom: none; }
.key-info { flex: 1; min-width: 0; }
.key-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.key-title { font-weight: 600; color: var(--text); }
.key-type-badge { font-size: 11px; padding: 1px 8px; border-radius: 20px; background: rgba(247,129,102,0.12); color: var(--accent); border: 1px solid rgba(247,129,102,0.35); font-weight: 500; text-transform: uppercase; }
.key-age { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.key-fingerprint { font-family: Consolas, 'Courier New', monospace; font-size: 12px; color: var(--text-muted); }
.key-actions { flex-shrink: 0; }
.key-list-box { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 24px; overflow: hidden; }
.empty-keys { border: 1px dashed var(--border); border-radius: 8px; padding: 32px; text-align: center; color: var(--text-muted); margin-bottom: 24px; }
.empty-keys h3 { margin: 0 0 8px; color: var(--text); font-size: 16px; }
.empty-keys p { margin: 0 0 16px; font-size: 14px; }
.empty-keys pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; font-size: 12px; text-align: left; display: inline-block; margin: 0; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 4px; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; pointer-events: auto; transition: opacity 0.3s; }
.toast-success { background: #1f4a2e; color: #3fb950; border: 1px solid #238636; }
.toast-error { background: #3d1212; color: #ffa198; border: 1px solid var(--danger); }
.toast-info { background: #0c2d6b; color: #79c0ff; border: 1px solid #1f6feb; }
.toast.fade-out { opacity: 0; }

/* Footer */
.footer { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--border); margin-top: 64px; }
.footer a { color: var(--text-muted); }

/* Mobile */
@media (max-width: 600px) {
  .nav-item { display: none; }
  .clone-bar { flex-direction: column; align-items: stretch; }
  .key-card { flex-direction: column; }
  .key-actions { align-self: flex-end; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hero h1 { font-size: 32px; }
  .file-message { display: none; }
  .file-time { display: none; }
  .commit-item { flex-direction: column; gap: 4px; }
}
