/* ============================================================
   模板2: 简约扁平版 (Bootstrap5 浅色 · 蓝主色 · 顶部布局)
   浅色背景 + 深色文字 + 顶部导航, 隐藏星空背景
   ============================================================ */
:root {
    --bg-deep: #f4f6fa;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f9fc;
    --bg-sidebar: #ffffff;
    --border-subtle: rgba(13, 110, 253, 0.15);
    --border-glow: rgba(13, 110, 253, 0.4);
    --accent-cyan: #0d6efd;   /* primary */
    --accent-purple: #6c757d; /* secondary */
    --accent-green: #198754;
    --accent-orange: #fd7e14;
    --accent-red: #dc3545;
    --accent-blue: #0d6efd;
    --text-primary: #1f2937;
    --text-secondary: #5b6675;
    --text-muted: #9aa3b2;
    --glow-cyan: 0 0 16px rgba(13, 110, 253, 0.18);
    --glow-purple: 0 0 16px rgba(108, 117, 125, 0.18);
    --radius: 8px;
    --radius-lg: 8px;
    --btn-color: #0d6efd;
    --sidebar-w: 240px;
    --transition: 0.2s ease;
}

/* 浅色下隐藏深色星空背景 */
body::before, body::after { opacity: 0.12; filter: grayscale(1); }

/* 顶部布局: 侧边栏变顶部横向导航 */
.sidebar {
    position: fixed; top: 0; left: 0; right: 0; bottom: auto;
    width: 100%; height: 56px;
    flex-direction: row; display: flex; align-items: center;
    padding: 0 16px; gap: 4px;
    border-right: none; border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    z-index: 1040; overflow: visible;
}
.sidebar-logo {
    font-size: 16px; white-space: nowrap; padding: 0 18px 0 0;
    border-bottom: none; background: none; flex-shrink: 0;
}
/* 导航区横向排列 */
.sidebar-nav {
    flex: 1; display: flex; flex-direction: row; align-items: center;
    padding: 0; overflow: visible; gap: 2px;
}
.nav-item {
    display: inline-flex; white-space: nowrap;
    padding: 8px 14px; border-left: none; border-bottom: 3px solid transparent;
}
.nav-item.active {
    border-left: none; border-bottom-color: var(--accent-cyan);
    background: linear-gradient(0deg, rgba(13, 110, 253, 0.10), transparent);
}
.nav-group { display: inline-flex; align-items: center; position: relative; }
.nav-group-header {
    display: inline-flex; align-items: center;
    padding: 8px 14px; border-left: none; border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.nav-group.open .nav-group-header { border-left: none; border-bottom-color: var(--accent-cyan); }
/* 子菜单作为下拉浮层 */
.nav-sub {
    position: absolute; top: 100%; left: 0;
    min-width: 184px; padding: 6px 0;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--glow-cyan);
    z-index: 1100;
}
.nav-group.open > .nav-sub { display: block; }
.nav-sub-item { white-space: nowrap; padding: 9px 18px; border-left: none; }
.nav-sub-item.active { border-left: none; }
/* 嵌套子分组(配置中心 ▸ 小程序管理/公众号管理/支付管理): 强制正常文档流,
   用高优先级+显式视觉样式确保分组标题不可能消失 */
.nav-sub > .nav-group {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
.nav-sub > .nav-group > .nav-sub {
    position: static !important;
    display: none !important;
}
.nav-sub > .nav-group.open > .nav-sub {
    display: block !important;
}
.nav-sub > .nav-group > .nav-group-header {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 10px 18px !important;
    margin: 2px 0 0 0 !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    white-space: nowrap !important;
    background: linear-gradient(135deg, rgba(13,110,253,0.04), transparent) !important;
    cursor: pointer !important;
    line-height: 1.4 !important;
}
.nav-sub > .nav-group > .nav-group-header:hover {
    background: linear-gradient(135deg, rgba(13,110,253,0.10), transparent) !important;
}
.nav-sub > .nav-group > .nav-sub > .nav-sub-item {
    padding-left: 34px !important;
}
/* 三层嵌套(支付管理 ▸ 微信商户管理): 同样强制文档流 */
.nav-sub > .nav-group > .nav-sub > .nav-group {
    position: static !important;
    display: block !important;
}
.nav-sub > .nav-group > .nav-sub > .nav-group > .nav-group-header {
    display: block !important;
    padding: 8px 18px 8px 42px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--accent-cyan) !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}
.sidebar-footer { margin-left: auto; padding: 0 4px; border-top: none; flex-shrink: 0; }
.content { margin-left: 0; margin-top: 56px; }

.nav-item:hover { background: rgba(13, 110, 253, 0.06); }
.nav-group.open .nav-group-header { border-bottom-color: var(--accent-cyan); }
.data-table tbody tr:hover { background: rgba(13, 110, 253, 0.05); }
.btn-save { background: linear-gradient(135deg, var(--btn-color), #0a58ca); color: #fff; }
.login-btn { background: linear-gradient(135deg, var(--btn-color), #0a58ca); }
