:root{
  --bg:#0f1419; --panel:#161c24; --panel2:#1c2430; --line:#26303d;
  --text:#e6edf3; --muted:#8b98a8; --accent:#4aa3ff; --accent2:#2b6cb0;
  --code:#0b0f14;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{
  background:var(--bg); color:var(--text);
  font:15px/1.6 -apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}
.muted{color:var(--muted)}
code{background:var(--code); padding:.1em .35em; border-radius:4px; font-size:.9em}

/* ---------- Login ---------- */
.login-body{display:grid; place-items:center; height:100vh}
.login-card{
  background:var(--panel); border:1px solid var(--line); border-radius:14px;
  padding:34px 30px; width:320px; text-align:center;
  box-shadow:0 12px 40px rgba(0,0,0,.45);
}
.login-logo{font-size:40px; margin-bottom:4px}
.login-card h1{margin:.2em 0 0; font-size:22px}
.login-card .muted{margin:.2em 0 18px; font-size:13px}
.login-card input[type=password]{
  width:100%; padding:11px 12px; margin-bottom:12px;
  background:var(--panel2); border:1px solid var(--line); border-radius:8px;
  color:var(--text); font-size:15px;
}
.login-card button{
  width:100%; padding:11px; border:0; border-radius:8px;
  background:var(--accent); color:#fff; font-size:15px; font-weight:600; cursor:pointer;
}
.login-card button:hover{background:var(--accent2)}
.err{background:#3a1d1d; color:#ff9b9b; border:1px solid #5a2a2a;
  padding:8px 10px; border-radius:8px; font-size:13px; margin:0 0 12px}

/* ---------- Topbar ---------- */
.topbar{
  display:flex; align-items:center; gap:16px;
  height:56px; padding:0 18px;
  background:var(--panel); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:5;
}
.brand{font-weight:700; font-size:17px; color:var(--text)}
.brand:hover{text-decoration:none}
.search{flex:1; max-width:520px}
.search input{
  width:100%; padding:9px 12px;
  background:var(--panel2); border:1px solid var(--line); border-radius:8px; color:var(--text);
}
.logout{color:var(--muted); font-size:14px}

/* ---------- Layout ---------- */
.layout{display:flex; height:calc(100vh - 56px)}
.sidebar{
  width:300px; flex:none; overflow:auto;
  background:var(--panel); border-right:1px solid var(--line); padding:12px 10px;
}
.content{flex:1; overflow:auto; padding:28px 40px; max-width:900px}

/* ---------- Tree ---------- */
.tree{list-style:none; margin:0; padding:0 0 0 4px}
.tree .tree{padding-left:14px; border-left:1px solid var(--line); margin-left:6px}
.tree li{margin:1px 0}
.tree summary{cursor:pointer; padding:3px 4px; border-radius:6px; color:var(--muted); font-weight:600}
.tree summary:hover{background:var(--panel2); color:var(--text)}
.tree .note a{display:block; padding:3px 8px; border-radius:6px; color:var(--text)}
.tree .note a:hover{background:var(--panel2); text-decoration:none}
.tree .note a.active{background:var(--accent2); color:#fff}

/* ---------- Note body ---------- */
.crumb{color:var(--muted); font-size:12.5px; margin-bottom:14px}
.note-body{font-size:15.5px}
.note-body h1{font-size:28px; border-bottom:1px solid var(--line); padding-bottom:.25em}
.note-body h2{font-size:22px; margin-top:1.4em}
.note-body h3{font-size:18px}
.note-body blockquote{
  margin:1em 0; padding:.4em 1em; border-left:3px solid var(--accent2);
  background:var(--panel); color:var(--muted)
}
.note-body pre{background:var(--code); padding:14px; border-radius:8px; overflow:auto}
.note-body table{border-collapse:collapse; width:100%; margin:1em 0}
.note-body th,.note-body td{border:1px solid var(--line); padding:7px 10px; text-align:left}
.note-body th{background:var(--panel2)}
.note-body a.wikilink{color:var(--accent)}
.note-body img{max-width:100%}
.note-body ul,.note-body ol{padding-left:1.4em}
.note-body input[type=checkbox]{margin-right:.5em}

/* ---------- Search results ---------- */
.results{list-style:none; padding:0}
.results li{padding:12px 14px; border:1px solid var(--line); border-radius:10px; margin-bottom:10px; background:var(--panel)}
.results .path{color:var(--muted); font-size:12px; margin-top:2px}
.results .snippet{color:var(--muted); font-size:13px; margin-top:6px}

@media(max-width:760px){
  .sidebar{position:fixed; left:0; top:56px; bottom:0; transform:translateX(-100%); transition:.2s; z-index:4}
  .content{padding:18px}
}
