/* Code Wiki — Art Deco Design */

:root {
  --primary: #1e293b;
  --primary-dark: #0f172a;
  --cyan: #06b6d4;
  --cyan-dark: #0891b2;
  --cyan-light: #ecfeff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #d4183d;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ──────────────────────────────────
   HEADER
────────────────────────────────── */

header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Brand link */
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.header-logo {
  height: 44px;
  width: auto;
  flex-shrink: 0;
}

/* Brand text */
.header-brand-text {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--primary);
  line-height: 1.2;
}

/* Backward compat: any h1 inside header */
header h1 {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--primary);
}

header h1 a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-subtitle {
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.05em;
  padding: 0.25rem 0;
  transition: color 0.2s;
  font-weight: 400;
}

.nav-link:hover,
.nav-link.active {
  color: var(--cyan-dark);
}

/* ──────────────────────────────────
   MAIN CONTENT
────────────────────────────────── */

main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2rem;
  width: 100%;
}

.page { display: none; }
.page.active { display: block; }

/* ──────────────────────────────────
   SEARCH PAGE
────────────────────────────────── */

.search-container {
  max-width: 768px;
  margin: 0 auto 2rem;
}

.search-box {
  display: flex;
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 0;
}

#search-input {
  flex: 1;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-btn {
  padding: 0.875rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#search-btn:hover {
  background: var(--cyan-dark);
}

.search-filters {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-card);
  flex-wrap: wrap;
}

.search-filters select {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.search-filters select:focus {
  border-color: var(--cyan);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--cyan-dark);
}

.results-container {
  max-width: 100%;
  margin: 2rem 0;
}

.placeholder-text {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem;
}

/* ──────────────────────────────────
   SEARCH RESULTS
────────────────────────────────── */

.result-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
}

.result-item:hover {
  border-color: var(--cyan);
  background: var(--cyan-light);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.result-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--primary);
}

.result-type {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.result-type.wiki {
  background: #dbeafe;
  color: #1e40af;
}

.result-type.repo {
  background: #dcfce7;
  color: #166534;
}

.result-type.repo-file {
  background: #fef3c7;
  color: #92400e;
}

.result-preview {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.result-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* ──────────────────────────────────
   SECTION HEADERS (decorative)
────────────────────────────────── */

/* Centered divider — Recently Modified Docs */
.section-header-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-header-divider h3 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  margin: 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Cyan accent left — Quick View, Browse Repos */
.section-header-accent {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-header-accent h3,
.section-header-accent h2 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.cyan-accent-bar {
  width: 4rem;
  height: 1px;
  background: var(--cyan);
}

.section-accent-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-accent-header h2 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

/* ──────────────────────────────────
   RECENTLY MODIFIED DOCS SECTION
────────────────────────────────── */

.recent-docs-section {
  margin-bottom: 2rem;
}

.recent-docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.recent-docs-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.recent-docs-table th {
  padding: 0.75rem 2rem;
  text-align: left;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.recent-docs-table td {
  padding: 0.75rem 2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.recent-docs-table tbody tr:last-child td {
  border-bottom: none;
}

.recent-doc-row {
  cursor: pointer;
  transition: background 0.15s;
}

.recent-doc-row:hover {
  background: var(--cyan-light);
}

.recent-doc-name {
  color: var(--text);
  font-weight: 400;
  transition: color 0.2s;
}

.recent-doc-row:hover .recent-doc-name {
  color: var(--cyan-dark);
}

.recent-doc-source {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.recent-doc-date {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.recent-docs-footer {
  padding: 1.25rem 2rem;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.recent-docs-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
}

.recent-docs-link:hover {
  color: var(--cyan-dark);
}

/* ──────────────────────────────────
   QUICK VIEW SECTION
────────────────────────────────── */

.quickview-section {
  margin-top: 0;
  text-align: left;
}

.quickview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.quickview-section h3 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0;
}

#refresh-quickview-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
}

.quickview-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow-x: auto;
  display: block;
  width: 100%;
}

.quickview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.quickview-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.quickview-table th {
  padding: 0.875rem 2rem;
  text-align: left;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.quickview-table th .header-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85em;
  text-transform: none;
  letter-spacing: 0;
}

.quickview-table td {
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: middle;
  text-align: left;
}

.quickview-table tbody tr:last-child td {
  border-bottom: none;
}

.quickview-table tbody tr:hover {
  background: var(--cyan-light);
}

.quickview-table a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.quickview-table a:hover {
  color: var(--cyan-dark);
}

.quickview-table .netlify-link {
  color: var(--text-muted);
}

.quickview-table .netlify-link:hover {
  color: var(--cyan-dark);
}

.quickview-table .no-deploy,
.quickview-table .no-notes {
  color: var(--text-muted);
  font-style: italic;
}

.quickview-table .docs-cell {
  border-left: 1px solid rgba(0, 0, 0, 0.04);
}

.quickview-table .docs-cell a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.quickview-table .docs-cell a:hover {
  color: var(--cyan-dark);
}

.quickview-table .docs-needed {
  color: var(--warning);
  cursor: pointer;
  font-style: italic;
}

.quickview-table .docs-needed:hover {
  text-decoration: underline;
}

.quickview-table .notes-cell {
  max-width: 400px;
  color: var(--text-muted);
  position: relative;
  border-left: 1px solid rgba(0, 0, 0, 0.04);
}

/* Editable notes */
.notes-content {
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  margin: -0.2rem -0.4rem;
  transition: background-color 0.2s;
}

.notes-content .notes-text {
  color: var(--primary);
}

.notes-content .notes-text .no-notes {
  color: var(--primary);
  opacity: 0.5;
}

.notes-content:hover {
  background-color: var(--cyan-light);
}

.notes-content:hover .notes-text {
  color: var(--cyan-dark);
}

/* Notes edit mode */
.notes-edit-form {
  display: flex;
  gap: 0.25rem;
  align-items: flex-start;
}

.notes-edit-input {
  flex: 1;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--cyan);
  min-width: 150px;
  resize: vertical;
  min-height: 2.5em;
  line-height: 1.4;
  outline: none;
}

.notes-edit-input:focus {
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.notes-save-btn,
.notes-cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.notes-save-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.notes-save-btn:hover {
  background: var(--cyan-dark);
  border-color: var(--cyan-dark);
}

.notes-cancel-btn:hover {
  background: var(--bg);
}

.notes-saving {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

.notes-login-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.quickview-table .loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.quickview-description {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.quickview-description .browse-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.quickview-description .browse-link:hover {
  color: var(--cyan-dark);
}

/* Separator row in quickview table */
.quickview-table .separator-row td {
  background: var(--bg);
  padding: 0.5rem 2rem;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  text-align: left;
}

/* ──────────────────────────────────
   BROWSE PAGE — CONTENTS OUTLINE
────────────────────────────────── */

.contents-body {
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.contents-body h1:first-child {
  margin-top: 0;
}

.contents-outline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2.5rem;
}

.contents-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.contents-category {
  margin-bottom: 1.5rem;
}

.contents-category:last-child {
  margin-bottom: 0;
}

.contents-category-link,
.contents-category-name {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  display: inline-block;
  padding: 0.25rem 0;
}

.contents-category-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.contents-category-link:hover {
  color: var(--cyan-dark);
}

.contents-category-name {
  color: var(--text);
}

.contents-docs {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 1.5rem;
}

.contents-docs li {
  padding: 0.375rem 0;
}

.contents-doc-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: color 0.2s;
}

.contents-doc-link::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  display: inline-block;
  flex-shrink: 0;
  transition: background 0.2s;
}

.contents-doc-link:hover {
  color: var(--cyan-dark);
}

.contents-doc-link:hover::before {
  background: var(--cyan);
}

/* ──────────────────────────────────
   BROWSE REPOS SECTION
────────────────────────────────── */

/* Tab view inner header */
.tab-view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tab-view-header h3 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

/* Browse breadcrumb */
.browse-breadcrumb {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.breadcrumb-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb-link:hover {
  color: var(--cyan-dark);
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.breadcrumb-current {
  color: var(--primary);
}

.browse-repos-section {
  margin-top: 0;
}

.browse-repos-section h2 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Repo Tabs */
.repo-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.repo-tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.2s;
}

.repo-tab:hover {
  color: var(--text);
}

.repo-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Repo Views */
.repo-view { display: none; }
.repo-view.active { display: block; }

#repo-list-content {
  max-height: 600px;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

#repo-files-content {
  max-height: 600px;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.repo-files-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.repo-files-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.repo-files-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.repo-files-name {
  font-weight: 500;
  font-size: 1rem;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.repo-files-name:hover {
  color: var(--cyan-dark);
}

span.repo-files-name {
  color: var(--text);
}

.repo-files-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.repo-doc-files {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 1rem;
}

.repo-doc-files li {
  padding: 0.25rem 0;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.repo-doc-files .file-icon {
  flex-shrink: 0;
}

.repo-doc-files a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.repo-doc-files a:hover {
  color: var(--cyan-dark);
}

/* Repo Filters */
.repo-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.repo-filters select,
.repo-filters input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.repo-filters select:focus,
.repo-filters input:focus {
  border-color: var(--cyan);
}

.repo-filters input {
  flex: 1;
  max-width: 300px;
}

.repos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.repo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.repo-card:hover {
  border-color: var(--cyan);
}

.repo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.repo-name {
  font-weight: 500;
  font-size: 1rem;
}

.repo-name a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.repo-name a:hover {
  color: var(--cyan-dark);
}

.repo-status {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.repo-status.synced {
  background: #dcfce7;
  color: #166534;
}

.repo-status.local-only {
  background: #fef3c7;
  color: #92400e;
}

.repo-status.github-only {
  background: #dbeafe;
  color: #1e40af;
}

.repo-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.repo-languages {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.repo-lang {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

/* ──────────────────────────────────
   DOCUMENT VIEW
────────────────────────────────── */

.document-header {
  margin-bottom: 3rem;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
  margin-bottom: 1rem;
}

.back-link:hover {
  color: var(--cyan-dark);
}

.document-meta {
  display: flex;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  align-items: center;
}

.visibility-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.visibility-badge.private {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.document-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4rem;
  line-height: 1.8;
}

.document-content h1,
.document-content h2,
.document-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.document-content h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--text);
}

.document-content h2 {
  font-size: 1.375rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-top: 3.5rem;
}

.document-content h3 {
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: 0.025em;
  color: var(--text);
  margin-top: 2rem;
}

.document-content h1:first-child,
.document-content > div > h1:first-child {
  margin-top: 0;
}

.document-content p {
  margin-bottom: 1rem;
  color: #334155;
}

.document-content code {
  background: var(--bg);
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--text);
}

.document-content pre {
  background: var(--primary);
  color: #e2e8f0;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.document-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.875rem;
  line-height: 1.7;
}

.document-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.document-content th,
.document-content td {
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
}

.document-content th {
  background: var(--bg);
  font-weight: 400;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.document-content tr:hover {
  background: var(--cyan-light);
}

.document-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.document-content ul,
.document-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.document-content li {
  color: #334155;
  margin-bottom: 0.375rem;
}

/* Edit button inside content panels */
.content-edit-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  z-index: 1;
}

/* ──────────────────────────────────
   AUTH PAGES
────────────────────────────────── */

.auth-container {
  max-width: 400px;
  margin: 4rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3rem;
}

.auth-container h2 {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-notice {
  background: #fef3c7;
  color: #92400e;
  padding: 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-group input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--cyan);
}

.form-group input:disabled {
  background: var(--bg);
  cursor: not-allowed;
}

.auth-btn {
  padding: 0.875rem;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
  transition: background 0.2s;
}

.auth-btn:hover {
  background: var(--cyan-dark);
}

.auth-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-switch a:hover {
  color: var(--cyan-dark);
}

/* GitHub Login Button */
.github-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: #24292f;
  color: white;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s;
}

.github-login-btn:hover {
  background: #1b1f24;
}

.github-login-btn svg {
  flex-shrink: 0;
}

.auth-info {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ──────────────────────────────────
   USER NAV
────────────────────────────────── */

.user-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
  letter-spacing: 0.025em;
  transition: color 0.2s;
}

.btn-link:hover {
  color: var(--cyan-dark);
}

/* ──────────────────────────────────
   EDIT BUTTON
────────────────────────────────── */

.edit-btn {
  padding: 0.625rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s;
  margin-left: auto;
}

.edit-btn:hover {
  background: var(--cyan-dark);
}

/* ──────────────────────────────────
   EDITOR PAGE
────────────────────────────────── */

.editor-container {
  max-width: 1000px;
  margin: 0 auto;
}

.editor-header {
  margin-bottom: 3rem;
}

.editor-header .back-link {
  margin-bottom: 0.75rem;
}

.editor-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.editor-header h2 {
  flex: 1;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.editor-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--cyan-dark);
  border-color: var(--cyan-dark);
}

.btn-primary:disabled {
  background: var(--text-muted);
  border-color: var(--text-muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan-dark);
}

.btn-sm {
  padding: 0.375rem 1rem;
  font-size: 0.8rem;
}

/* Frontmatter Editor */
.frontmatter-editor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2rem;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-group select:focus {
  border-color: var(--cyan);
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
}

.editor-toolbar button {
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.editor-toolbar button:hover {
  background: var(--cyan-light);
  color: var(--cyan-dark);
}

/* Editor Main Area */
.editor-main {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 400px;
  border: 1px solid var(--border);
}

.editor-main.split-view {
  grid-template-columns: 1fr 1fr;
}

.editor-pane,
.preview-pane {
  min-height: 400px;
}

.editor-pane textarea {
  width: 100%;
  height: 100%;
  min-height: 600px;
  padding: 1.5rem;
  border: none;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  box-sizing: border-box;
  background: var(--bg-card);
  color: var(--text);
}

.editor-pane textarea:focus {
  outline: none;
}

.preview-pane {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
}

.preview-pane.hidden {
  display: none;
}

/* Commit Section */
.commit-section {
  margin-top: 1rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.commit-section .form-group {
  margin-bottom: 0;
}

/* Editor Status */
.editor-status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  display: none;
}

.editor-status.success {
  display: block;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.editor-status.error {
  display: block;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.editor-status.loading {
  display: block;
  background: #f0f9ff;
  color: #075985;
  border: 1px solid #bae6fd;
}

/* ──────────────────────────────────
   FOOTER
────────────────────────────────── */

footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--cyan-dark);
}

/* ──────────────────────────────────
   LOADING STATE
────────────────────────────────── */

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ──────────────────────────────────
   MODAL
────────────────────────────────── */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2rem;
  min-width: 360px;
  max-width: 90vw;
}

.modal-content h3 {
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}

.modal-content .form-group {
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ──────────────────────────────────
   REPO DOC MODAL
────────────────────────────────── */

.repo-doc-modal-content {
  width: 600px;
  max-width: 90vw;
}

.repo-doc-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.repo-doc-modal-content textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.repo-doc-modal-content textarea:focus {
  border-color: var(--cyan);
}

.repo-doc-modal-content .editor-status {
  margin-bottom: 1rem;
}

/* ──────────────────────────────────
   DOCS VIEW TAB
────────────────────────────────── */

#repo-docs-content {
  max-height: 700px;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.docs-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.docs-view-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.docs-view-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.docs-view-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.docs-view-table th {
  padding: 0.625rem 0.75rem;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
}

.docs-view-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.docs-view-table th.sortable:hover {
  background: var(--border);
}

.docs-view-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: middle;
}

.docs-view-table tbody tr:hover {
  background: var(--cyan-light);
}

.docs-view-table a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.docs-view-table a:hover {
  color: var(--cyan-dark);
}

.docs-view-source {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.docs-view-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ──────────────────────────────────
   PAGINATION
────────────────────────────────── */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ──────────────────────────────────
   RESPONSIVE
────────────────────────────────── */

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.5rem;
  }

  nav {
    flex-wrap: wrap;
    gap: 1rem;
  }

  main {
    padding: 2rem 1.5rem;
  }

  .search-container {
    margin-bottom: 3rem;
  }

  .search-filters {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .repo-filters {
    flex-direction: column;
  }

  .repo-filters input {
    max-width: none;
  }

  .contents-outline {
    padding: 1.5rem;
  }

  .repos-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .editor-main.split-view {
    grid-template-columns: 1fr;
  }

  .preview-pane {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .editor-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-actions {
    justify-content: flex-end;
  }

  .document-content {
    padding: 1.5rem;
  }

  .quickview-table th,
  .quickview-table td,
  .recent-docs-table th,
  .recent-docs-table td {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .section-header-divider h3,
  .section-header-accent h3,
  .section-header-accent h2,
  .section-accent-header h2 {
    font-size: 0.65rem;
  }
}
