/* ============================================================
 *  admin-index.css - 后台外壳（index.html）的布局样式
 * ------------------------------------------------------------
 *  只管"外壳这一层"：侧栏、顶栏、页签栏、内容区、状态栏，
 *  以及外壳自带的两个浮层（菜单屏蔽面板、页签右键菜单）。
 *  业务页里的表格、按钮、表单在 admin-common.css，别把它们的样式写到这里。
 *
 *  配色一律走主题 token（var(--x, 兜底)），不写死色值：
 *  换肤改的是 token，这里写死的颜色会在换肤后纹丝不动。
 * ============================================================ */

/* ---------- 骨架：左栏定宽 + 右侧竖向流 ---------- */
.framework {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- 侧栏 ---------- */
.sidebar {
    width: 246px;
    min-width: 246px;
    background: var(--sidebar-bg, #ffffff);
    color: var(--sidebar-text, #475569);
    display: flex;
    flex-direction: column;
    transition: width 0.22s ease, min-width 0.22s ease;
    overflow: hidden;
    z-index: 60;
    border-right: 1px solid var(--border-divider, #eef2f6);
}
.sidebar.collapsed { width: 64px; min-width: 64px; }

/* 品牌区 */
.sidebar-brand {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: var(--sidebar-brand-bg, #f8fafc);
    color: var(--sidebar-text-active, #0f172a);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-divider, #eef2f6);
}
.sidebar-brand .brand-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: var(--radius-md, 8px);
    background: var(--color-primary-soft, #e9e8fc);
    color: var(--color-primary, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
/* 侧栏 LOGO 来自数据容器 backend_config.backend_logo：未配置时继续显示那枚图标 */
.sidebar-brand .brand-logo { display: none; height: 28px; max-width: 132px; object-fit: contain; flex-shrink: 0; }
.sidebar-brand.has-logo .brand-logo { display: block; }
.sidebar-brand.has-logo .brand-icon { display: none; }
.sidebar-brand .brand-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
/* 关闭口只在窄屏（侧栏是抽屉时）出现 */
.brand-close {
    display: none;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--sidebar-text, #475569);
    font-size: 15px;
    cursor: pointer;
    border-radius: var(--radius-sm, 4px);
}
.brand-close:hover { background: var(--surface-header, #f1f5f9); color: var(--text-primary, #0f172a); }

/* 搜索框：整条就是输入框本体，图标在框内的左侧
   （外圈留白用 margin 而不是 padding，padding 一让给留白就没法给框内左侧用） */
.sidebar-search {
    margin: 12px 14px 6px;
    height: 34px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border: 1px solid var(--sidebar-input-border, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    /* 底色取侧栏那一组 token，不用全局 surface-soft：输入框是嵌在深色侧栏里的，
       刷一块浅灰上去，白色文字跟着一起看不见（专业深蓝就是这个症状） */
    background: var(--sidebar-input-bg, #f1f5f9);
    transition: border-color 0.18s, box-shadow 0.18s;
}
/* 图标是弹性项而不是绝对定位：绝对定位要靠 top:50% 再补一个魔数才能对齐 34px 高的框，
   交给 align-items 就没有这笔账。 */
.sidebar-search i {
    flex-shrink: 0;
    margin-right: 8px;
    font-size: 12px;
    line-height: 1;
    color: var(--sidebar-text, #475569);
    pointer-events: none;
}
/* 边框、底色和圆角都在整条上，输入框自身透明无边框，才能和左侧图标同处一个框内 */
.sidebar-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--sidebar-text-active, #0f172a);
    font-size: 13px;
    outline: none;
}
.sidebar-search input::placeholder { color: var(--sidebar-text, #475569); opacity: 1; }
/* 焦点圈画在框上：光标在输入框里，但用户看到的"输入框"是连着图标的那一整块 */
.sidebar-search:focus-within {
    border-color: var(--color-primary, #4f46e5);
    box-shadow: 0 0 0 3px var(--color-primary-soft, #e9e8fc);
}

/* 菜单树 */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0 12px;
}
.sidebar-menu::-webkit-scrollbar { width: 6px; }
.sidebar-menu::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--sidebar-text, #475569) 22%, transparent);
    border-radius: 3px;
}
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }

/* 侧栏的任意一层都是同样一行 .menu-item > a。
 * 目录（有子项）和叶子共用这一个行盒，只差两件事：有没有折叠箭头、
 * 点这一行是展开子项还是开页签。层级只由下面那组 .menu-depth-N 表达。
 *
 * 这里只留一种 DOM，不给目录单开 <button class="menu-group-head">：
 * 两套标签要维持同一个行盒规格，尺寸就得写两遍，改一处漏一处，
 * "目录行与叶子行看起来不同规格"就是这么来的。 */
.menu-item { position: relative; }
.menu-item > a {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 10px;
    padding: 0 10px;
    height: 40px;
    border-radius: var(--radius-lg, 12px);
    color: var(--sidebar-text, #475569);
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.menu-item > a:hover {
    background: var(--sidebar-child-bg, rgba(79,70,229,0.05));
    color: var(--sidebar-text-active, #0f172a);
}
/* 目录行：字重加一档、展开时给一层底色，行盒尺寸与叶子完全一致。
   这两条必须排在下面的 .menu-item.active 之前：同为"两 class + a"的权重，
   谁在后面谁说了算，而"既有地址又有子项"的脏数据行是可能同时带上
   active 与 open 的——那种时候要保留的是选中态那一块实心底色。 */
.menu-node > a { font-weight: 600; }
.menu-node.open > a {
    background: var(--sidebar-child-bg, rgba(79,70,229,0.05));
    color: var(--sidebar-text-active, #0f172a);
}
.menu-item.active > a {
    background: var(--sidebar-active-bg, #4f46e5);
    color: var(--text-invert, #ffffff);
    box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--tint-primary, rgb(79,70,229)) 90%, transparent);
}
.menu-item.active > a .menu-icon { color: var(--text-invert, #ffffff); }

.menu-icon {
    width: 18px;
    flex-shrink: 0;
    text-align: center;
    font-size: 14px;
}
.menu-icon i { font-style: normal; }
.menu-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.menu-arrow { font-size: 10px; flex-shrink: 0; transition: transform 0.18s; }

/* 行尾的角标（未读数量那一类）。渲染端在没有数字时压根不产出这个节点，
   所以这里没有"显示 0"的形态，也不用给它留位置。
   底色走 --color-danger-solid、字走 --color-danger-solid-text：
   这一行随时可能是选中态（实心靛蓝底 + 白字），软底色压上去会糊成一片，
   而这对实心组合在四套主题下都与 --sidebar-active-bg 拉得开。 */
.menu-badge {
    flex-shrink: 0;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--color-danger-solid, #be123c);
    color: var(--color-danger-solid-text, #ffffff);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

/* 子项容器与层级缩进
 * 缩进必须单调递增：深度由渲染端直接落成 menu-depth-N 类，每层只往右让 12px。
 * 别按"套了几层 .menu-children"反推 padding，再给目录下的子节点单加一条覆盖——
 * 那样算出来是 20 → 10 → 24 且第四层不再变，三级菜单比二级还靠左，
 * 父子看不出层级，超过两层的菜单必踩。
 * 行盒宽度不变（左右 margin 还是 10px），所以 hover/选中那一片底色始终对齐同一列，
 * 只有内容跟着层级走。 */
.menu-children { display: none; }
.menu-item.open > .menu-children { display: block; }
.menu-item.open > a { color: var(--sidebar-text-active, #0f172a); }
.menu-item.open > a .menu-arrow { transform: rotate(90deg); }
.menu-depth-1 > a { padding-left: 22px; }
.menu-depth-2 > a { padding-left: 34px; }
.menu-depth-3 > a { padding-left: 46px; }
.menu-depth-4 > a { padding-left: 58px; }
/* 第六层及更深按这一档给（侧栏走不到那么深，钳位是为了别让缩进吃掉标题的宽度） */
.menu-depth-5 > a { padding-left: 70px; }

/* 折叠态：只留图标那一列。目录行与叶子行现在是同一个选择器命中的同一种行，
   外边距和行高天然一致；层级缩进由 padding: 0 一并抹掉（权重高过上面那组
   .menu-depth-N），所以收起后图标仍是一列对齐的。 */
.sidebar.collapsed .brand-name,
.sidebar.collapsed .menu-title,
.sidebar.collapsed .menu-arrow,
.sidebar.collapsed .menu-hide-btn span,
.sidebar.collapsed .btn-logout span { display: none; }
.sidebar.collapsed .sidebar-search { display: none; }
.sidebar.collapsed .sidebar-brand { padding: 0 17px; }
.sidebar.collapsed .menu-item > a {
    justify-content: center;
    height: 40px;
    margin: 2px 12px;
    padding: 0;
}
.sidebar.collapsed .menu-item > a .menu-icon { margin: 0; font-size: 17px; }

/* 折叠态只留图标那一列：行里放不下图标加一枚胶囊（行宽 40px，图标 17 + 间距 10 + 角标最小 20
   就已经溢出被 overflow 裁掉），所以改挂在行的右上角。
   定位基准是 .menu-item（它就是 position:relative），因此不会被那个 <a> 的 overflow:hidden 裁。
   窄屏的抽屉是整块出现的（那条 @media (max-width:1024px) 把 .menu-title 又放回来了），
   角标该回到行内跟着标题走，所以这套挂法只在宽屏生效。 */
@media (min-width: 1025px) {
    .sidebar.collapsed .menu-badge {
        position: absolute;
        top: 4px;
        right: 8px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 8px;
        font-size: 10px;
        line-height: 16px;
    }
}
.sidebar.collapsed .sidebar-footer { padding: 10px 8px; }

/* 底部工具 */
.sidebar-footer {
    flex-shrink: 0;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border-divider, #eef2f6);
}
.menu-hide-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-md, 8px);
    color: var(--sidebar-text, #475569);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.16s, color 0.16s;
}
.menu-hide-btn:hover {
    background: var(--sidebar-child-bg, rgba(79,70,229,0.05));
    color: var(--sidebar-text-active, #0f172a);
}
.menu-hide-btn i { font-size: 14px; width: 18px; text-align: center; }
.sidebar-footer .btn-logout {
    height: 34px;
    justify-content: flex-start;
    padding: 0 10px;
    border-radius: var(--radius-md, 8px);
    background: transparent;
    border: none;
    color: var(--sidebar-text, #475569);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-footer .btn-logout:hover {
    background: var(--color-danger-soft, #fbe3e8);
    border-color: transparent;
    color: var(--color-danger, #e11d48);
}
.sidebar-footer .btn-logout i { font-size: 14px; width: 18px; text-align: center; }

/* 窄屏抽屉背后的那层遮罩（宽屏不出现） */
.sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--shadow-base, rgb(15,23,42)) 35%, transparent);
    z-index: 55;
}

/* ---------- 右栏：顶栏 / 页签 / 内容 / 状态 ---------- */
.right-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface-page, #f6f7fb);
}

.topbar {
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    /* 不做"半透明 + 背景模糊"：backdrop-filter 会让顶栏成为后代的包含块，
       顶栏里向下弹出的换肤面板会被顶栏自己的边界裁掉半截（真机上就是这么发现的）。
       顶栏本来也不压在任何滚动内容上，实色反而更干净。 */
    background: var(--surface-card, #ffffff);
    border-bottom: 1px solid var(--border-divider, #eef2f6);
}
.topbar-toggle {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary, #475569);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.16s, color 0.16s;
}
.topbar-toggle:hover { background: var(--surface-header, #f1f5f9); color: var(--text-primary, #0f172a); }

/* 面包屑：业务名（安装/容器给的值）在前，当前页在后 */
.topbar-crumb {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    overflow: hidden;
    white-space: nowrap;
}
.crumb-root { color: var(--text-muted, #5c6a7d); }
.crumb-sep { color: var(--text-placeholder, #94a3b8); }
.crumb-current { color: var(--text-primary, #0f172a); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-base, #e2e8f0);
    background: var(--surface-card, #ffffff);
    color: var(--text-secondary, #475569);
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.16s, color 0.16s, box-shadow 0.16s;
}
.topbar-icon-btn:hover {
    border-color: var(--color-primary, #4f46e5);
    color: var(--color-primary, #4f46e5);
    box-shadow: 0 2px 8px var(--shadow-sm, rgba(15,23,42,0.06));
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px 0 6px;
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--border-base, #e2e8f0);
    background: var(--surface-card, #ffffff);
    font-size: 13px;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: border-color 0.16s, box-shadow 0.16s;
}
.topbar-user:hover {
    border-color: var(--color-primary, #4f46e5);
    box-shadow: 0 2px 8px var(--shadow-sm, rgba(15,23,42,0.06));
}
.topbar-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

/* 页签栏 */
.tab-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 6px 16px;
    background: transparent;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
}
.tab-bar-wrap::-webkit-scrollbar { height: 0; }
.tab-bar-wrap.dragging { cursor: grabbing; user-select: none; }
.tab-bar-wrap.dragging .tab-btn,
.tab-bar-wrap.dragging .tab-close { cursor: grabbing; pointer-events: none; }

/* 一个页签 = 一颗胶囊。这里刻意用 span 不用 button：
   HTML 解析器遇到 button 套 button 会先把外层闭合掉，页签会被拆成两半。 */
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 8px 0 12px;
    border: 1px solid var(--border-base, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    background: var(--surface-card, #ffffff);
    color: var(--text-secondary, #475569);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.16s, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.tab-btn:hover {
    color: var(--color-primary, #4f46e5);
    box-shadow: 0 2px 8px var(--shadow-sm, rgba(15,23,42,0.06));
}
.tab-btn.active {
    color: var(--color-primary-soft-text, #4338ca);
    background: var(--color-primary-soft, #e9e8fc);
    border-color: color-mix(in srgb, var(--color-primary, #4f46e5) 35%, transparent);
    font-weight: 600;
}
/* 子页权限被撤销：标记该选项卡，待其退出后由外壳关闭 */
.tab-btn.tab-denied {
    color: var(--color-danger, #e11d48);
    background: var(--color-danger-soft, #fbe3e8);
    border-color: color-mix(in srgb, var(--color-danger, #e11d48) 35%, transparent);
}
.tab-btn.tab-denied .tab-label { text-decoration: line-through; }
.tab-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.tab-close {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    color: var(--text-muted, #5c6a7d);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tab-close:hover {
    background: var(--color-danger-solid, #be123c);
    color: var(--color-danger-solid-text, #ffffff);
}

/* 内容区：业务页整幅嵌进来，页签切换只显隐，不重载 */
.content-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    padding: 0 16px 12px;
    /* 只有一行一列的格子网：所有页签都叠在同一格里，切换改的只是画不画。
       不能退回 display:none——iframe 一被移出布局，里面那页滚到哪儿就归零了，
       切回来表单还在、滚动位置却没了，正是这一条要保住的东西。 */
    display: grid;
    grid-template-rows: 1fr;
    grid-template-columns: 1fr;
}
.content-area > * {
    grid-row: 1;
    grid-column: 1;
    min-height: 0;
}
.content-area iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: var(--surface-card, #ffffff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 1px 3px var(--shadow-sm, rgba(15,23,42,0.06));
}
/* 页签切换就是这一条：切走的那页只是不绘制、不接点击，布局与滚动位置都原样留着 */
.content-area > .hidden {
    visibility: hidden;
    pointer-events: none;
}

/* ---------- 内容页窗口上方的"回到顶部"突出条 ----------
   常驻的话它就是一块新的视觉焦点，反而打断读表，所以只在真滚起来之后滑出来；
   出现时也只给一条 26px 的浅灰带，醒目靠"位置 + 动效"，不靠颜色，
   hover 才落到主色浅底上。
   收放用 max-height 而不是 display：高度归零才把这一格交还给内容区，不留空槽；
   visibility 延迟到收起动画结束才关掉，跟专注模式那几条同一个写法——
   否则收起的过程中内容会提前跳上来，而且隐藏期间它不该还留在 Tab 序里。 */
.scroll-top-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 26px;
    max-height: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    /* 分隔线只在亮出来这一档才有：常驻的话哪怕收成 0 高，这条 1px 也会占掉一格，
       "收着既不占位"就成了空话 */
    border: none;
    background: var(--surface-soft, #f8fafc);
    color: var(--text-muted, #5c6a7d);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: max-height 0.18s ease, opacity 0.18s ease, visibility 0s linear 0.18s,
        background-color 0.16s, color 0.16s;
}
.scroll-top-bar.show {
    max-height: 26px;
    opacity: 1;
    visibility: visible;
    border-top: 1px solid var(--border-divider, #eef2f6);
    /* 出现这一段 visibility 要立刻跟上，否则前 180ms 是一条透明的带子 */
    transition: max-height 0.18s ease, opacity 0.18s ease, visibility 0s,
        background-color 0.16s, color 0.16s;
}
.scroll-top-bar:hover {
    background: var(--color-primary-soft, #e9e8fc);
    color: var(--color-primary-soft-text, #4338ca);
}
.scroll-top-bar i { font-size: 12px; }

/* 状态栏 */
.status-bar {
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--surface-card, #ffffff);
    border-top: 1px solid var(--border-divider, #eef2f6);
    font-size: 12px;
    color: var(--text-muted, #5c6a7d);
}

/* 状态栏右侧的网站备案号：默认不占位，读到值才由 JS 加上 .show。
   备案号是对外公示信息，收在状态栏一隅、不抢内容视线即可，不做成按钮样式 */
.status-filing {
    display: none;
    color: var(--text-muted, #5c6a7d);
    text-decoration: none;
    white-space: nowrap;
    /* 容器里那串是可以填很长的：窄屏状态栏挤不下时用省略号收住，
       而不是把字溢到栏外去。overflow 这一句同时也让它作为弹性项能被压缩 */
    overflow: hidden;
    text-overflow: ellipsis;
    /* 别让备案号把左边那句页面名挤瘪：最多占掉栏宽的一半多一点点，剩下的留给页面名 */
    max-width: 55%;
}
.status-filing.show { display: block; }
.status-filing:hover {
    color: var(--color-primary-soft-text, #4338ca);
    text-decoration: underline;
}

/* 欢迎页（没有页签时占住内容区）：整页当"桌面"用——背景图层垫底、内容左对齐浮在上面，
   文件夹/窗口/工具条的样式在 admin-desktop.css */
.welcome-page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: linear-gradient(165deg, var(--surface-page, #f6f7fb) 0%, var(--color-primary-soft, #e9e8fc) 130%);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 1px 3px var(--shadow-sm, rgba(15,23,42,0.06));
    color: var(--text-muted, #5c6a7d);
    font-size: 14px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 时钟控件：居中摆，像锁屏页的大钟；下面的问候与文件夹仍靠左 */
.welcome-clock {
    align-self: center;
    text-align: center;
}
.welcome-time {
    font-size: 60px;
    font-weight: 300;
    color: var(--text-primary, #0f172a);
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 8px;
}
.welcome-date {
    font-size: 15px;
    color: var(--text-muted, #5c6a7d);
    letter-spacing: 1px;
}

/* 问候语：跟时钟一起居中，两者合成桌面顶部那一组 */
.welcome-greeting {
    align-self: center;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary, #0f172a);
}
.welcome-business-card {
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--border-divider, #eef2f6);
    border-radius: var(--radius-lg, 12px);
    padding: 24px;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.welcome-business-card:hover {
    border-color: var(--color-primary-soft, #e9e8fc);
    box-shadow: 0 2px 8px var(--shadow-sm, rgba(15,23,42,0.06));
}
.welcome-business-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.welcome-business-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    display: flex;
    align-items: center;
    gap: 8px;
}
.welcome-business-title i {
    color: var(--color-primary, #4f46e5);
    font-size: 16px;
}
.welcome-business-edit {
    font-size: 13px;
    color: var(--color-primary, #4f46e5);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.18s;
}
.welcome-business-edit:hover {
    color: var(--color-primary-hover, #4338ca);
}
/* 分组容器：块级纵向排列，一组接一组（用 flex 会让各组并排挤到一行里） */
.welcome-business-groups {
    display: block;
}
.welcome-business-group {
    margin-top: 18px;
}
.welcome-business-group:first-child {
    margin-top: 0;
}
/* 分组标题：主色边条 + 主色文字，与业务表单的分组同一视觉重量，不会被当成普通数据行读过去 */
.welcome-business-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary, #4f46e5);
    letter-spacing: 0.3px;
    line-height: 1.5;
    padding: 2px 0 6px 9px;
    margin-bottom: 4px;
    border-left: 3px solid var(--color-primary, #4f46e5);
    border-bottom: 1px solid var(--border-divider, #eef2f6);
}
.welcome-business-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}
.welcome-business-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    width: 50%;
    padding: 7px 8px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-divider, #eef2f6);
    min-height: 34px;
}
.welcome-business-label {
    font-size: 12px;
    color: var(--text-secondary, #475569);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.5;
}
.welcome-business-label::after {
    content: '：';
}
.welcome-business-value {
    font-size: 13px;
    color: var(--text-primary, #0f172a);
    word-break: break-all;
    line-height: 1.5;
    min-width: 0;
}
/* 窄屏放不下"标签：值"两栏，整卡改单列 */
@media (max-width: 768px) {
    .welcome-business-item {
        width: 100%;
    }
}
.welcome-business-empty {
    text-align: center;
    padding: 24px 16px;
}
.welcome-business-empty i {
    font-size: 32px;
    color: var(--text-secondary, #475569);
    opacity: 0.5;
    margin-bottom: 12px;
}
.welcome-business-empty p {
    font-size: 14px;
    color: var(--text-secondary, #475569);
    margin-bottom: 16px;
}
.welcome-business-empty .btn {
    min-width: 120px;
}
.welcome-business-empty .btn i {
    color: inherit;
}

/* 业务信息未完善提醒（status=0时独占显示） */
.welcome-business-reminder-only {
    text-align: center;
    padding: 32px 20px;
}
.welcome-business-reminder-only i {
    font-size: 40px;
    color: #d97706;
    margin-bottom: 16px;
    display: block;
}
.welcome-business-reminder-only p {
    font-size: 15px;
    color: #92400e;
    margin-bottom: 20px;
    line-height: 1.6;
}
.welcome-business-reminder-only .btn {
    min-width: 140px;
}
.welcome-business-reminder-only .btn i {
    color: inherit;
}

/* 审核状态徽标 */
.welcome-business-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.welcome-business-badge.badge-neutral {
    background: var(--surface-header, #f1f5f9);
    color: var(--text-muted, #5c6a7d);
}
.welcome-business-badge.badge-warning {
    background: #fef3c7;
    color: #92400e;
}
.welcome-business-badge.badge-success {
    background: #d1fae5;
    color: #065f46;
}
.welcome-business-badge.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* 富文本、图片等独占整行的字段 */
.welcome-business-item-full {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
}
.welcome-business-richtext {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary, #0f172a);
    word-break: break-word;
    overflow-wrap: break-word;
}
.welcome-business-richtext img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm, 6px);
}
.welcome-business-richtext a {
    color: var(--color-primary, #4f46e5);
}
.welcome-business-richtext p {
    margin: 0 0 8px;
}
.welcome-business-richtext:empty {
    display: none;
}

/* 业务卡片内的图片缩略图 */
.welcome-business-thumb {
    max-width: 120px;
    max-height: 80px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-divider, #eef2f6);
    cursor: pointer;
    object-fit: cover;
    transition: box-shadow 0.18s, transform 0.18s;
}
.welcome-business-thumb:hover {
    box-shadow: 0 2px 8px rgba(15,23,42,0.18);
    transform: scale(1.03);
}

/* 业务卡片内的文件链接 */
.welcome-business-file {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-primary, #4f46e5);
    text-decoration: none;
    font-size: 13px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.welcome-business-file:hover {
    color: var(--color-primary-hover, #4338ca);
    text-decoration: underline;
}
.welcome-business-file i {
    flex-shrink: 0;
    font-size: 14px;
}

/* 图片预览浮层 */
.welcome-img-preview {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.welcome-img-preview.is-visible {
    display: flex;
}
.welcome-img-preview img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    cursor: default;
}
.welcome-img-preview-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.welcome-img-preview-close:hover {
    opacity: 1;
}

/* 页签右键菜单 */
.tab-context-menu {
    display: none;
    position: fixed;
    z-index: 9999;
    min-width: 168px;
    padding: 5px;
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--border-base, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 12px 32px var(--shadow-lg, rgba(15,23,42,0.14));
}
.tab-context-menu .ctx-item {
    padding: 8px 12px;
    border-radius: var(--radius-md, 8px);
    font-size: 13px;
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    white-space: nowrap;
}
.tab-context-menu .ctx-item:hover {
    background: var(--color-primary-soft, #e9e8fc);
    color: var(--color-primary-soft-text, #4338ca);
}
.tab-context-menu.show { display: block; }

/* ---------- 菜单屏蔽面板（居中弹窗，改动只影响本机视图） ---------- */
/* 面板与遮罩默认收起，靠 .show 展开（显隐由脚本加类，不写行内 style） */
.menu-hide-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--shadow-base, rgb(15,23,42)) 38%, transparent);
    z-index: 99998;
}
.menu-hide-overlay.show { display: block; }
.menu-hide-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-height: 72vh;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface-card, #ffffff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 20px 48px var(--shadow-lg, rgba(15,23,42,0.14));
    z-index: 99999;
}
.menu-hide-panel.show { display: flex; }
.menu-hide-header {
    flex-shrink: 0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-divider, #eef2f6);
}
.menu-hide-header h3 { font-size: 15px; font-weight: 600; color: var(--text-primary, #0f172a); margin: 0; }
.menu-hide-close {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    font-size: 18px;
    color: var(--text-muted, #5c6a7d);
    cursor: pointer;
    border-radius: var(--radius-sm, 4px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.menu-hide-close:hover { background: var(--surface-header, #f1f5f9); color: var(--text-primary, #0f172a); }
.menu-hide-body { flex: 1; overflow-y: auto; padding: 12px 20px; }
.menu-hide-body::-webkit-scrollbar { width: 4px; }
.menu-hide-body::-webkit-scrollbar-thumb { background: var(--border-input, #cbd5e1); border-radius: 2px; }
.menu-hide-group { margin-bottom: 12px; }
.menu-hide-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    padding: 6px 0;
    border-bottom: 1px solid var(--border-divider, #eef2f6);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.menu-hide-group-title label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.menu-hide-group-title input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--color-primary, #4f46e5);
    margin: 0;
}
/* 屏蔽面板的层级：子项列表是嵌套的，这一条 padding 套几层累计几层，
   所以三级及更深的菜单不用另写规则也能看出父子关系。 */
.menu-hide-child-list { padding-left: 14px; }
.menu-hide-child-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary, #475569);
}
.menu-hide-child-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--color-primary, #4f46e5);
    margin: 0;
}
.menu-hide-child-item label { cursor: pointer; }
.menu-hide-footer {
    flex-shrink: 0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-divider, #eef2f6);
}
.menu-hide-restore {
    border: 1px solid var(--border-input, #cbd5e1);
    background: var(--surface-card, #ffffff);
    color: var(--text-secondary, #475569);
    font-size: 13px;
    padding: 6px 16px;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.menu-hide-restore:hover { border-color: var(--color-danger, #e11d48); color: var(--color-danger, #e11d48); }
.menu-hide-confirm {
    border: none;
    background: var(--color-primary-solid, #4338ca);
    color: var(--color-primary-solid-text, #ffffff);
    font-size: 13px;
    padding: 6px 20px;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: background 0.15s;
}
.menu-hide-confirm:hover { background: var(--color-primary-solid-hover, #3930ac); }

/* 菜单里 opentype=dialog 打开的就是这一帧：整块铺满弹窗正文，不留内边距
   （旧实现是在脚本里写行内 style，样式一律回到 CSS 里） */
.float-dialog-body > .dialog-frame { display: block; width: 100%; height: 100%; border: none; }
.float-dialog-body:has(> .dialog-frame) { padding: 0; overflow: hidden; }

/* ---------- 停靠条（最小化掉的浮窗那一排）让开侧栏 ----------
   它原本 left:0 一路铺到 right:0，正压着浏览器底边左侧那一段——那正是侧栏底部
   "菜单显示屏蔽 / 退出登录"的地盘：最小化一个弹窗，登出入口就点不到了。
   停靠条是 admin-common.js 直接挂到 body 上的，业务页里也在用它，所以只在外壳这份
   CSS 里收这条规则：业务页没有 .sidebar，:has 不成立，仍旧整条铺满。
   专注模式那条写最后：侧栏此时已经滑出可视范围，底边左侧没有东西要避让，再留 246px
   反而是平白空一截。折叠态权重比展开态高一级，收起后按 64px 让。 */
@media (min-width: 1025px) {
    body:has(.sidebar) .float-dock {
        /* 246 已经含侧栏那 1px 右边框（全局 border-box），正好贴着右栏左边缘 */
        left: 246px;
        /* 折叠动画 0.22s，这边同一条时长，让开的位置跟着侧栏一起走而不是瞬间跳 */
        transition: left 0.22s ease;
    }
    body:has(.sidebar.collapsed) .float-dock { left: 64px; }
    body.focus-mode:has(.sidebar) .float-dock { left: 0; }
}

/* 菜单首次加载时占位的那一行（拿到数据即被整片替换） */
.menu-loading { padding: 20px; text-align: center; font-size: 13px; color: var(--text-muted, #5c6a7d); }

/* ---------- 窄屏：侧栏改成正经抽屉，靠折叠按钮唤出 ---------- */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        min-width: 260px;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 0 12px 40px var(--shadow-lg, rgba(15,23,42,0.14));
    }
    .sidebar.nav-open { transform: translateX(0); }
    /* 折叠类在窄屏没有意义：抽屉要么整块出现，要么整块收起 */
    .sidebar.collapsed { width: 260px; min-width: 260px; }
    .sidebar.collapsed .brand-name,
    .sidebar.collapsed .menu-title,
    .sidebar.collapsed .menu-hide-btn span,
    .sidebar.collapsed .btn-logout span { display: block; }
    /* 搜索框整条是弹性布局，还原时不能统一给 block */
    .sidebar.collapsed .sidebar-search { display: flex; }
    .brand-close { display: flex; align-items: center; justify-content: center; }
    .sidebar-scrim.show { display: block; }
    /* 窄屏是抽屉整块盖在页面上，让开左边那一列无从谈起，只能改层级：
       抽屉展开时停靠条退到遮罩(55)与侧栏(60)之下，跟其余被盖住的内容一个待遇，
       收掉抽屉即恢复。这里要 !important：admin-common.js 的 _syncMask() 会按当前
       顶层浮窗给停靠条写行内 z-index，行内样式压在规则上面。 */
    body:has(.sidebar.nav-open) .float-dock { z-index: 54 !important; }
    .content-area { padding: 0 10px 10px; }
    .topbar { padding: 0 14px; }
    .crumb-root { display: none; }
    .crumb-sep { display: none; }
    .menu-hide-panel { width: 92vw; }
}
