/* ============================================================
   侧栏共享样式 —— 所有 include sidebar.html 的页面统一引用本文件
   （main.html / dashboard.html / browse.html / desktop_entry.html
     / reconcile.html / stay.html）

   ⚠️ 约定：以后改侧栏样式【只改这里】，不要再写回各个模板。
   历史上因为样式分散写在每个模板里，main/reconcile/stay 三个页面漏写，
   导致侧栏被 flex 压窄、"时好时坏"（2026-09-27 统一修复）。
   ============================================================ */

.sidebar{width:240px;min-width:240px;background:#f7f8fa;border-right:1px solid #e5e6eb;display:flex;flex-direction:column;overflow-y:auto;transition:width .2s,min-width .2s;flex-shrink:0;}
.sidebar.collapsed{width:0;min-width:0;border-right:none;overflow:hidden;}

.sidebar-backdrop{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.3);z-index:49;}
.sidebar-backdrop.active{display:block;}

.sidebar-brand{display:flex;align-items:center;padding:12px 16px;height:48px;border-bottom:1px solid #e5e6eb;gap:8px;flex-shrink:0;}
.sidebar-brand .star{color:#f5a623;font-size:16px;}
.sidebar-brand span{font-size:14px;font-weight:600;color:#1f2329;white-space:nowrap;}

.sidebar-search{padding:8px 12px;flex-shrink:0;}
.sidebar-search input{width:100%;padding:5px 8px;border:1px solid #dee0e3;border-radius:4px;font-size:13px;background:#fff;color:#646a73;box-sizing:border-box;}
.sidebar-search input:focus{outline:none;border-color:#3370ff;}

.nav-section{padding:4px 0;}
.nav-section-title{padding:6px 16px;font-size:12px;color:#8f959e;font-weight:500;user-select:none;}
.nav-item{display:flex;align-items:center;padding:6px 16px;cursor:pointer;font-size:13px;color:#1f2329;border-radius:0;transition:background .1s;gap:8px;white-space:nowrap;text-decoration:none;}
.nav-item:hover{background:#eff0f1;}
.nav-item.active{background:#e1eaff;color:#3370ff;font-weight:500;}
.nav-item .dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;}

.sidebar-footer{margin-top:auto;padding:8px 12px;border-top:1px solid #e5e6eb;flex-shrink:0;}
.sidebar-footer a{display:flex;align-items:center;gap:6px;color:#8f959e;text-decoration:none;font-size:13px;padding:6px 4px;}
.sidebar-footer a:hover{color:#3370ff;}

/* 小屏：侧栏改为浮层，默认收起 */
@media (max-width:768px){
  .sidebar{position:fixed;left:0;top:0;height:100vh;z-index:50;box-shadow:2px 0 8px rgba(0,0,0,.1);}
}

/* ---- 工具区：菜单项可自定义排序（sidebar.html 动态渲染）---- */
.nav-section-title{display:flex;align-items:center;justify-content:space-between;gap:6px;}
.nav-section-title .tool-title{flex:1 1 auto;white-space:nowrap;}
.tool-sort-btn{margin-left:auto;flex:0 0 auto;font-size:11px;color:#8f959e;cursor:pointer;padding:1px 6px;border-radius:4px;border:1px solid transparent;}
.tool-sort-btn:hover{background:#eef0f1;color:#3370ff;}
.tool-sort-btn.on{background:#e1eaff;color:#3370ff;border-color:#c7d8ff;}
.nav-item.sorting{cursor:default;background:#fafbfc;}
.nav-item.sorting:hover{background:#fafbfc;}
.nav-item .tool-mv{display:none;margin-left:auto;gap:3px;align-items:center;}
.nav-item.sorting .tool-mv{display:flex;}
.tool-mv button{width:22px;height:22px;line-height:1;padding:0;border:1px solid #dee0e3;background:#fff;border-radius:4px;cursor:pointer;font-size:12px;color:#646a73;}
.tool-mv button:hover:not(:disabled){border-color:#3370ff;color:#3370ff;}
.tool-mv button:disabled{opacity:.3;cursor:default;}

