:root {
  --so-orange: #F48024;
  --so-orange-dark: #c66312;
  --so-blue: #0074cc;
  --so-blue-light: #6ac;
  --bg: #f8f9f9;
  --bg-card: #ffffff;
  --border: #e4e6e8;
  --text: #232629;
  --text-muted: #6a737c;
  --text-light: #848d95;
  --green: #5eba7d;
  --red: #c91d1d;
  --code-bg: #f3f3f3;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
header.topbar {
  background: #ffffff;
  border-top: 3px solid var(--so-orange);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
header.topbar .brand img { height: 28px; vertical-align: middle; }
header.topbar nav { flex: 1; display: flex; gap: 16px; align-items: center; }
header.topbar nav a { color: var(--text-muted); text-decoration: none; padding: 6px 8px; border-radius: 4px; }
header.topbar nav a:hover { background: var(--bg); color: var(--text); }
header.topbar .right { display: flex; gap: 10px; align-items: center; }
header.topbar input[type="search"] {
  border: 1px solid var(--border); border-radius: 3px; padding: 6px 10px; min-width: 280px;
}

main { max-width: 1100px; margin: 16px auto; padding: 0 16px; display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
main.full { grid-template-columns: 1fr; }
aside.side { font-size: 13px; }
aside.side h3 { font-size: 13px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; }
aside.side ul { list-style: none; padding: 0; margin: 0 0 16px; }
aside.side li { padding: 4px 0; border-bottom: 1px dashed var(--border); }

h1, h2, h3 { font-weight: 600; color: var(--text); }
h1.page-title { font-size: 27px; margin: 16px 0 8px; }
h2.section { font-size: 19px; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin: 16px 0 8px; }

a { color: var(--so-blue); text-decoration: none; }
a:hover { color: var(--so-blue-light); text-decoration: underline; }

.btn {
  display: inline-block; padding: 8px 12px; border-radius: 3px;
  background: var(--so-blue); color: #fff !important; border: 1px solid var(--so-blue-light);
  cursor: pointer; font-size: 13px; text-decoration: none;
}
.btn:hover { background: #0063b1; }
.btn.secondary { background: #e1ecf4; color: var(--so-blue) !important; border-color: #7aa7c7; }
.btn.danger { background: var(--red); border-color: #911616; }
.btn.ghost { background: transparent; color: var(--text-muted) !important; border-color: transparent; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 3px; font: inherit;
}
textarea { min-height: 200px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.qcard { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 12px; margin-bottom: 8px; display: grid; grid-template-columns: 92px 1fr; gap: 12px; }
.qcard .stats { font-size: 12px; color: var(--text-muted); display: grid; gap: 4px; align-content: start; text-align: right; }
.qcard .stats .num { font-size: 16px; color: var(--text); }
.qcard .stats .accepted { color: #fff; background: var(--green); padding: 2px 4px; border-radius: 3px; display: inline-block; }
.qcard h3 a { font-size: 16px; }
.qcard .meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.tag { display: inline-block; padding: 2px 6px; border-radius: 3px; background: #e1ecf4; color: #39739d; font-size: 12px; margin-right: 4px; text-decoration: none; }
.tag:hover { background: #cee0ed; color: #2c5777; text-decoration: none; }

.qbody, .abody { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 16px; margin-bottom: 16px; }
.qbody h1 { margin-top: 0; }
.qbody pre, .abody pre, .answer pre { background: var(--code-bg); padding: 12px; border-radius: 3px; overflow-x: auto; }
.qbody code, .abody code, .answer code { background: var(--code-bg); padding: 1px 4px; border-radius: 2px; font-size: 13px; }
.qbody pre code, .abody pre code, .answer pre code { background: transparent; padding: 0; }

.answer { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 16px; margin-bottom: 12px; display: grid; grid-template-columns: 60px 1fr; gap: 12px; }
.answer.accepted { border-left: 3px solid var(--green); }
.vote-col { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); }
.vote-col form { margin: 0; }
.vote-col button { background: none; border: none; cursor: pointer; padding: 4px; font-size: 18px; color: var(--text-muted); }
.vote-col button:hover { color: var(--so-orange); }
.vote-col .score { font-size: 18px; font-weight: 600; color: var(--text); }
.vote-col .accepted-tick { font-size: 22px; color: var(--green); }

.byline { font-size: 12px; color: var(--text-muted); margin-top: 12px; padding: 4px 8px; background: #fbf2d9; border-radius: 3px; display: inline-block; }
.byline strong { color: var(--text); }

.diff { white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; padding: 12px; background: #fafafa; border: 1px solid var(--border); border-radius: 4px; }
.diff .add { color: #237a39; background: #e6f9ec; }
.diff .del { color: #c91d1d; background: #ffeaea; }

table.versions { width: 100%; border-collapse: collapse; font-size: 13px; }
table.versions th, table.versions td { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; }
table.versions th { background: var(--bg); font-weight: 600; }

.flash { background: #fff8dc; border: 1px solid #f0d878; padding: 8px 12px; border-radius: 3px; margin-bottom: 12px; }
.error { color: var(--red); }

footer { color: var(--text-muted); font-size: 12px; max-width: 1100px; margin: 32px auto 16px; padding: 16px; border-top: 1px solid var(--border); }
footer a { color: var(--text-muted); }
footer code { background: var(--code-bg); padding: 1px 4px; border-radius: 2px; }

.repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 12px 0 24px; }
.repo-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 14px; }
.repo-card h3 { margin: 0 0 6px; font-size: 16px; }
.repo-card .meta { color: var(--text-muted); font-size: 12px; }
.repo-card .desc { color: var(--text); font-size: 13px; margin-top: 8px;
                   display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.docs-crumbs { font-size: 14px; margin: 8px 0 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.docs-crumbs .sep { color: var(--text-muted); margin: 0 4px; }

.docs-tree { width: 100%; border-collapse: collapse; margin: 8px 0 16px;
             background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.docs-tree th, .docs-tree td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.docs-tree tr:last-child td { border-bottom: none; }
.docs-tree .icon { width: 24px; text-align: center; color: var(--text-muted); }
.docs-tree .last-edit { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

.tag.private { background: #fbe4e4; color: #8a1414; }
