* { box-sizing: border-box; }
body {
  margin: 0; color: #172b4d; background: #fff;
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: #0052cc; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 52px;
  background: #0747a6; color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { color: #fff; font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.searchbox { flex: 1; max-width: 480px; }
.searchbox input {
  width: 100%; padding: 6px 12px; border-radius: 4px; border: none;
  background: rgba(255,255,255,.18); color: #fff; outline: none;
}
.searchbox input::placeholder { color: rgba(255,255,255,.7); }
.searchbox input:focus { background: #fff; color: #172b4d; }
.topnav { display: flex; align-items: center; gap: 14px; margin-left: auto; white-space: nowrap; }
.topnav a { color: #deebff; }
.who { color: rgba(255,255,255,.75); }

.layout { display: flex; min-height: calc(100vh - 52px); }
.sidebar {
  width: 280px; flex-shrink: 0; padding: 20px 12px;
  background: #f4f5f7; border-right: 1px solid #dfe1e6;
  overflow-y: auto;
}
.sidebar ul { list-style: none; margin: 0; padding-left: 0; }
.sidebar ul ul { padding-left: 16px; }
.sidebar li { margin: 1px 0; }
.sidebar a, .tree-label {
  display: block; padding: 4px 8px; border-radius: 4px; color: #172b4d;
}
.sidebar a:hover { background: #ebecf0; text-decoration: none; }
.sidebar a.active { background: #deebff; color: #0052cc; font-weight: 600; }
.tree-label { color: #6b778c; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-top: 10px; }

.content { flex: 1; padding: 28px 40px 64px; max-width: 980px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.crumbs { color: #6b778c; font-size: 13px; }
.page-actions { display: flex; gap: 6px; }
.page-title { margin: 8px 0 2px; font-size: 28px; }
.page-meta { color: #6b778c; font-size: 13px; margin-bottom: 20px; }

.btn {
  display: inline-block; padding: 5px 12px; border-radius: 4px;
  background: #f4f5f7; border: 1px solid #dfe1e6; color: #172b4d;
  font-size: 13px; cursor: pointer;
}
.btn:hover { background: #ebecf0; text-decoration: none; }
.btn-primary { background: #0052cc; border-color: #0052cc; color: #fff; }
.btn-primary:hover { background: #0747a6; }
.btn-danger { color: #de350b; }
.linklike { background: none; border: none; color: #deebff; cursor: pointer; font: inherit; padding: 0; }
.inline { display: inline; }

.flash {
  background: #deebff; border: 1px solid #b3d4ff; border-radius: 4px;
  padding: 10px 14px; margin-bottom: 16px;
}
.flash-error { background: #ffebe6; border-color: #ffbdad; }

.md { line-height: 1.7; }
.md h1, .md h2, .md h3 { margin-top: 1.4em; }
.md h1 { font-size: 24px; } .md h2 { font-size: 20px; } .md h3 { font-size: 17px; }
.md pre {
  background: #f4f5f7; border: 1px solid #dfe1e6; border-radius: 4px;
  padding: 12px; overflow-x: auto; font-size: 13px;
}
.md code { background: #f4f5f7; padding: 1px 5px; border-radius: 3px; font-size: 13px; }
.md pre code { background: none; padding: 0; }
.md blockquote {
  margin: 1em 0; padding: 2px 16px; color: #44546f;
  border-left: 3px solid #dfe1e6; background: #fafbfc;
}
.md table, .table { border-collapse: collapse; margin: 1em 0; width: 100%; }
.md th, .md td, .table th, .table td {
  border: 1px solid #dfe1e6; padding: 6px 10px; text-align: left; vertical-align: top;
}
.md th, .table th { background: #f4f5f7; }
.md img { max-width: 100%; }

.edit-form { display: flex; flex-direction: column; gap: 12px; }
.edit-form.narrow { max-width: 420px; }
.edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #6b778c; }
.edit-form label.checkbox { flex-direction: row; align-items: center; }
.edit-form input[type=text], .edit-form input[type=email], .edit-form input[type=password] {
  padding: 7px 10px; border: 1px solid #dfe1e6; border-radius: 4px; font: inherit;
}
.edit-form textarea {
  width: 100%; padding: 12px; border: 1px solid #dfe1e6; border-radius: 4px;
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; resize: vertical;
}
.edit-actions { display: flex; gap: 8px; }
.preview-pane { border: 1px dashed #b3d4ff; border-radius: 4px; padding: 16px 24px; margin-top: 20px; }

.diff {
  background: #fafbfc; border: 1px solid #dfe1e6; border-radius: 4px;
  padding: 12px; overflow-x: auto; font-size: 13px; line-height: 1.5;
}
.diff span { display: block; white-space: pre-wrap; }
.d-add { background: #e3fcef; color: #006644; }
.d-del { background: #ffebe6; color: #bf2600; }
.d-hunk { color: #6554c0; }
.d-head { color: #6b778c; }

.search-results { list-style: none; padding: 0; }
.search-results li { margin-bottom: 18px; }
.snippet { color: #44546f; font-size: 13px; }
.snippet mark { background: #fff0b3; padding: 0 2px; }
.muted { color: #6b778c; font-size: 13px; }
.tag {
  background: #e3fcef; color: #006644; font-size: 11px;
  padding: 1px 6px; border-radius: 8px; vertical-align: middle;
}

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #0747a6;
}
.login-card {
  background: #fff; border-radius: 8px; padding: 36px 40px; width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 20px; margin: 0 0 20px; text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #6b778c; }
.login-card input { padding: 9px 12px; border: 1px solid #dfe1e6; border-radius: 4px; font: inherit; }
.login-card button {
  padding: 10px; background: #0052cc; color: #fff; border: none;
  border-radius: 4px; font: inherit; font-weight: 600; cursor: pointer;
}
.login-card button:hover { background: #0747a6; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid #dfe1e6; }
  .content { padding: 20px; }
  .searchbox { display: none; }
}
