/* ══════════════════════════════════════════════════════════════════
   Shared sidebar — injected into #sidebar-mount via partials/sidebar.js
   改导航样式只改这一个文件。active 由 sidebar.js 按 pathname 自动加。
   兼容两套设计变量：market 系(--panel/--text2/--text3) + dashboard 系
   (--bg-subtle/--text-soft)，未定义时 fallback 到硬编码默认；深色模式
   由各页 html[data-theme="dark"] 重定义变量自动适配。
   ══════════════════════════════════════════════════════════════════ */

/* ── Shell layout (272px 侧栏 + 自适应主区) ── */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
@media (max-width: 1024px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ── Sidebar 容器 ── */
.sidebar {
    background: var(--panel, var(--bg-subtle, #ffffff));
    border-right: 1px solid var(--line, #e2e8f0);
    display: flex; flex-direction: column;
    /* 固定满屏不随主区滚动：plan badge 始终停在左下角 */
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}
.sidebar .brand { padding: 18px 20px; border-bottom: 1px solid var(--line, #e2e8f0); }
.sidebar .brand a { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.sidebar .brand img { width: 28px; height: 28px; border-radius: 6px; }
.sidebar .brand .name { font-weight: 800; font-size: 17px; color: var(--text, #0f172a); }
.sidebar .brand .name span { color: var(--accent, #6366f1); }

/* ── Nav 列表 ── */
.nav { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text3, var(--text-muted, #94a3b8)); padding: 16px 16px 4px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 1rem;
    font-size: 14px; font-weight: 500; font-family: inherit;
    color: var(--text2, var(--text-soft, #475569));
    text-decoration: none;
    border: 1px solid transparent;       /* 预留 border，避免 active 时高度跳变 */
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.nav-item:hover { background: var(--hover, #f1f5f9); color: var(--text, #0f172a); }
.nav-item.active { background: var(--hover, #f1f5f9); color: var(--text, #0f172a); border-color: var(--line, #e2e8f0); font-weight: 600; }
.nav-item i { width: 20px; text-align: center; font-size: 13px; flex-shrink: 0; }

/* ── More Tools 折叠头 + 子项 ── */
.more-btn {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; width: 100%; text-align: left; cursor: pointer;
    background: none; font-family: inherit;
    border: 1px solid transparent;
}
.more-btn .chev { font-size: 10px; transition: transform .2s; flex-shrink: 0; }
.more-btn .chev.open { transform: rotate(180deg); }
.sub-items { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line, #e2e8f0); display: flex; flex-direction: column; gap: 2px; }
.sub-items .nav-item { padding: 9px 14px; font-size: 13px; }

/* ── Plan badge 卡片：把刺眼橙渐变改成柔和琥珀，融入界面 ── */
.vercel-promo { background: rgba(240,180,41,0.08) !important; border: 1px solid rgba(240,180,41,0.2) !important; color: var(--text, #0f172a) !important; }
.vercel-promo .bg-white\/25, .vercel-promo .bg-white\/20, .vercel-promo .bg-white\/30 { background: rgba(240,180,41,0.15) !important; color: #f0b429 !important; }
.vercel-promo .text-white, .vercel-promo .text-white\/85, .vercel-promo .text-white\/80, .vercel-promo .text-white\/60 { color: var(--text3, #9d9da8) !important; }
.vercel-promo a, .vercel-promo span, .vercel-promo div { border-color: var(--line, #e2e8f0) !important; }

/* 兜底：万一某页没定义 x-cloak */
[x-cloak] { display: none !important; }

/* ── Floating user chip (viewport top-right, all pages) ──
   独立 fixed 定位，不在 .sidebar 内 → 移动端 sidebar 隐藏时仍可用。
   z-index 90：压过各页 sticky 页头(z-10/50)，低于全屏遮罩(200+)。 */
.user-chip { position: fixed; top: 14px; right: 18px; z-index: 90; }
@media (max-width: 1024px) { .user-chip { top: 10px; right: 10px; } }
.user-chip-inner {
    display: flex; align-items: center; gap: 4px;
    background: var(--panel, var(--bg-subtle, #ffffff));
    border: 1px solid var(--line, #e2e8f0); border-radius: 999px;
    padding: 4px; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.10);
}
.user-chip-signin {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--panel, var(--bg-subtle, #ffffff));
    border: 1px solid var(--line, #e2e8f0); border-radius: 999px;
    padding: 8px 14px; font-size: 13px; font-weight: 600;
    color: var(--text, #0f172a); text-decoration: none;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.10);
    transition: border-color .12s ease, color .12s ease;
}
.user-chip-signin:hover { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }
.user-chip-bell {
    position: relative; width: 32px; height: 32px; border: 0; padding: 0;
    background: transparent; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--text3, #94a3b8);
    transition: background .12s ease;
}
.user-chip-bell:hover { background: var(--hover, #f1f5f9); }
.user-chip-bell.has-unread { color: var(--amber, #f0b429); }
.user-chip-badge {
    position: absolute; top: -3px; right: -5px;
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
    background: #ef4444; color: #fff;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.user-chip-avatar {
    width: 32px; height: 32px; border: 0; padding: 0; border-radius: 50%;
    background: var(--accent, #6366f1); color: #fff;
    font-size: 13px; font-weight: 700; text-transform: uppercase;
    cursor: pointer; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.user-chip-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── 账户菜单 + 通知面板(锚定 chip 下方) ── */
.user-menu, .notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--panel, var(--bg-subtle, #ffffff));
    border: 1px solid var(--line, #e2e8f0); border-radius: 0.9rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    z-index: 95; overflow: hidden;
}
.user-menu { width: 240px; }
.user-menu-hd { padding: 12px 14px; border-bottom: 1px solid var(--line, #e2e8f0); }
.user-menu-name { font-size: 13px; font-weight: 700; color: var(--text, #0f172a); }
.user-menu-email { font-size: 11px; color: var(--text3, #94a3b8); margin-top: 2px; word-break: break-all; }
.user-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 14px; border: 0; background: transparent;
    font-size: 13px; font-family: inherit; text-align: left;
    color: var(--text, #0f172a); text-decoration: none; cursor: pointer;
    transition: background .12s ease;
}
.user-menu-item i { width: 14px; text-align: center; color: var(--text3, #94a3b8); flex-shrink: 0; }
.user-menu-item:hover { background: var(--hover, #f1f5f9); }
.user-menu-item.danger, .user-menu-item.danger i { color: #dc2626; }
.user-menu-count {
    margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: #ef4444; color: #fff;
    font-size: 10px; font-weight: 700; line-height: 18px; text-align: center;
}
.notif-panel { width: 340px; max-width: calc(100vw - 24px); }
.notif-panel-hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--line, #e2e8f0);
    font-size: 12px; font-weight: 700; color: var(--text, #0f172a);
}
.notif-markall {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: 11px; font-weight: 600; color: var(--accent, #6366f1); font-family: inherit;
}
.notif-panel-bd { max-height: 320px; overflow-y: auto; }
.notif-empty { padding: 24px 14px; text-align: center; font-size: 12px; color: var(--text3, #94a3b8); }
.notif-item {
    padding: 10px 14px; cursor: pointer;
    border-bottom: 1px solid var(--line, #e2e8f0);
    transition: background .12s ease;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--hover, #f1f5f9); }
.notif-item.unread { border-left: 3px solid var(--amber, #f0b429); padding-left: 11px; }
.notif-item-title { font-size: 12px; font-weight: 600; color: var(--text, #0f172a); }
.notif-item.unread .notif-item-title { font-weight: 700; }
.notif-item-body {
    font-size: 11px; color: var(--text2, var(--text-soft, #475569)); margin-top: 2px;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-item-time { font-size: 10px; color: var(--text3, #94a3b8); margin-top: 4px; }
