/* ==========================================================================
   BieX 后台 · Typecho 后台美化样式
   作者：沐辰    项目地址：https://bie.cc
   --------------------------------------------------------------------------
   【修改请保留作者信息】
   本插件免费开源，可自由使用、修改与分发，但请保留作者署名与项目地址，
   二次分发时一并保留，请勿删除署名后声称原创或直接转售。感谢配合。

   依赖 Plugin.php 注入的 CSS 变量：
   --bx-primary / --bx-primary-dark / --bx-primary-light
   --bx-primary-faint / --bx-primary-faint2
   --bx-radius / --bx-bg-image / --bx-login-bg / --bx-watermark
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 变量定义
   -------------------------------------------------------------------------- */
:root {
    --bx-bg: #f4f5f7;
    --bx-surface: #ffffff;
    --bx-surface-2: #f7f8fa;
    --bx-surface-3: #eef0f3;
    --bx-sidebar-bg: #ffffff;
    --bx-text: #3b3f45;
    --bx-text-2: #878d98;
    --bx-border: #e7e8eb;
    --bx-shadow-sm: 0 1px 2px rgba(35, 39, 47, 0.06);
    --bx-shadow-md: 0 4px 16px rgba(35, 39, 47, 0.1);
    --bx-shadow-lg: 0 10px 36px rgba(35, 39, 47, 0.16);
    --bx-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --bx-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --bx-trans: all 0.18s ease;
    --bx-sb-w: 232px;
    --bx-rail-w: 64px;
    --bx-topbar-h: 52px;

    /* 状态色：与主色彻底解耦。主色只承担品牌与选中态，
       危险 / 成功 / 警告语义固定，用户切换主色不会污染状态含义。 */
    --bx-ok: #2f8f57;
    --bx-ok-faint: rgba(47, 143, 87, 0.12);
    --bx-warn: #b0701a;
    --bx-warn-faint: rgba(176, 112, 26, 0.13);
    --bx-danger: #b3372d;
    --bx-danger-faint: rgba(179, 55, 45, 0.1);

    /* 圆角刻度：统一以用户设置的 --bx-radius 为基准，
       小控件 / 中控件 / 大容器成比例收敛，避免卡片与按钮圆角断层。 */
    --bx-r-sm: min(var(--bx-radius, 12px), 8px);
    --bx-r-md: min(var(--bx-radius, 12px), 12px);
    --bx-r-lg: var(--bx-radius, 12px);
}

html.biex-dark {
    --bx-bg: #1e2128;
    --bx-surface: #262a33;
    --bx-surface-2: #2c313b;
    --bx-surface-3: #343a46;
    --bx-sidebar-bg: #22262e;
    --bx-text: #d6dae2;
    --bx-text-2: #8b929e;
    --bx-border: #363c47;
    --bx-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --bx-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.36);
    --bx-shadow-lg: 0 10px 36px rgba(0, 0, 0, 0.46);
    --bx-ok: #6cc08a;
    --bx-ok-faint: rgba(108, 192, 138, 0.16);
    --bx-warn: #e0a44f;
    --bx-warn-faint: rgba(224, 164, 79, 0.16);
    --bx-danger: #ec8b81;
    --bx-danger-faint: rgba(236, 139, 129, 0.14);
}

/* --------------------------------------------------------------------------
   2. 全局基础
   -------------------------------------------------------------------------- */
body {
    font-family: var(--bx-font);
    background-color: var(--bx-bg);
    color: var(--bx-text);
    -webkit-font-smoothing: antialiased;
}

/* 背景图（设置后覆盖纯色背景，深色模式自动压暗） */
html:not(.biex-dark) body {
    background: var(--bx-bg-image, none) no-repeat center / cover fixed, var(--bx-bg);
}

html.biex-dark body {
    background:
        linear-gradient(rgba(16, 18, 23, 0.86), rgba(16, 18, 23, 0.92)),
        var(--bx-bg-image, none) no-repeat center / cover fixed,
        var(--bx-bg);
}

body a { color: var(--bx-primary); }

body a:hover { color: var(--bx-primary-dark); }

/* 滚动条 */
html.biex-dark ::-webkit-scrollbar { width: 9px; height: 9px; }
html.biex-dark ::-webkit-scrollbar-thumb { background: #3d4450; border-radius: 9px; }
html.biex-dark ::-webkit-scrollbar-thumb:hover { background: #4a5261; }
html.biex-dark ::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------------------
   2b. 表单控件跨端归一化
   --------------------------------------------------------------------------
   iOS Safari 对 <input>/<select>/<textarea> 一律施加原生外观：
   圆角、内阴影、16px 以下字号还会触发「聚焦自动放大页面」。
   这里统一清掉原生外观并锁死 16px（移动端），后台表单在 iPhone 上不会再跳版。 */
body input,
body textarea,
body select,
body button {
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

body select {
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 15px) calc(50% + 1px), calc(100% - 10px) calc(50% + 1px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 28px;
    color: var(--bx-text);
}

body input[type=checkbox],
body input[type=radio] {
    -webkit-appearance: auto;
    appearance: auto;
    width: 15px;
    height: 15px;
    accent-color: var(--bx-primary);
    vertical-align: -2px;
}

body input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* 触屏设备：点击目标不小于 38px，避免手机上「点不中」 */
@media (hover: none) and (pointer: coarse) {
    body .btn { min-height: 38px; }

    body input[type=text],
    body input[type=password],
    body input[type=email],
    body input[type=search],
    body textarea,
    body select {
        /* 16px 是 iOS 不触发聚焦缩放的临界值，低于它聚焦时整页会被放大 */
        font-size: 16px;
    }
}

/* 移动端：Typecho 原生列表页（文章 / 评论 / 用户）是横向大表格，
   屏幕窄时必然溢出。改为卡片式换行展示，避免整页左右拖动。 */
@media (max-width: 767px) {
    body .typecho-list-table,
    body .typecho-list-table thead,
    body .typecho-list-table tbody,
    body .typecho-list-table tr,
    body .typecho-list-table th,
    body .typecho-list-table td {
        display: block;
        width: auto;
    }

    body .typecho-list-table thead { display: none; }

    body .typecho-list-table tr {
        position: relative;
        margin-bottom: 10px;
        padding: 12px 14px;
        background: var(--bx-surface);
        border: 1px solid var(--bx-border);
        border-radius: var(--bx-r-md);
        box-shadow: var(--bx-shadow-sm);
    }

    body .typecho-list-table td {
        padding: 4px 0;
        border: none !important;
        word-break: break-word;
    }

    body .typecho-list-table td:empty { display: none; }

    /* 选择列固定在卡片右上，便于批量操作 */
    body .typecho-list-table td.typecho-hide,
    body .typecho-list-table td:first-child {
        display: none !important;
        top: 12px;
        right: 12px;
        padding: 0;
    }

    /* 操作列改为整齐的按钮行 */
    body .typecho-list-table td:last-child {
        padding-top: 8px;
        border-top: 1px solid var(--bx-border) !important;
    }

    body .typecho-list-table td:last-child a,
    body .typecho-list-table td:last-child button {
        display: inline-block;
        margin: 4px 8px 0 0;
    }

    /* 写作页：编辑器与侧栏改为纵向堆叠，附件 / 选项面板不再挤成一列 */
    body .typecho-post-area .typecho-post-option,
    body .typecho-post-area .typecho-post-additional {
        float: none;
        width: auto;
    }

    body .typecho-post-area .typecho-label { width: auto; }

    body .typecho-post-area input[type=text],
    body .typecho-post-area textarea,
    body .typecho-post-area select { width: 100%; }

    body .typecho-head-nav .operate { display: none; }
}

/* --------------------------------------------------------------------------
   3. 按钮
   -------------------------------------------------------------------------- */
body .btn {
    border-radius: var(--bx-r-md);
    font-family: var(--bx-font);
    transition: var(--bx-trans);
}



body .btn.primary {
    background-color: var(--bx-primary);
    color: #fff;
    box-shadow: 0 2px 6px var(--bx-primary-faint2);
}

body .btn.primary:hover { background-color: var(--bx-primary-dark); color: #fff; }

body .btn.primary:active,
body .btn.primary.active { background-color: var(--bx-primary-dark); color: #fff; }

body .btn-warn { border-radius: var(--bx-r-md); }

/* --------------------------------------------------------------------------
   4. 表单控件
   -------------------------------------------------------------------------- */
body input[type=text],
body input[type=password],
body input[type=email],
body textarea,
body select {
    border: 1px solid var(--bx-border);
    background: var(--bx-surface);
    color: var(--bx-text);
    border-radius: var(--bx-r-sm);
    font-family: var(--bx-font);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

body input[type=text]:focus,
body input[type=password]:focus,
body input[type=email]:focus,
body textarea:focus,
body select:focus {
    border-color: var(--bx-primary);
    box-shadow: 0 0 0 3px var(--bx-primary-faint);
    outline: none;
}

body select { height: 32px; }

body input[type=radio]:focus-visible,
body input[type=checkbox]:focus-visible {
    outline: 2px solid var(--bx-primary-faint2);
    outline-offset: 2px;
}

/* 编辑器（markdown）自动保存提示等 */
body .typecho-post-area #slug { background: var(--bx-surface-2); }

/* --------------------------------------------------------------------------
   5. 下拉菜单 / 分页 / 标签页
   -------------------------------------------------------------------------- */
body .dropdown-menu {
    border: 1px solid var(--bx-border);
    background: var(--bx-surface);
    border-radius: var(--bx-r-md);
    box-shadow: var(--bx-shadow-lg);
    overflow: hidden;
    padding: 4px 0;
}

body .dropdown-menu a { color: var(--bx-text); }

body .dropdown-menu a:hover { background: var(--bx-primary-faint); color: var(--bx-primary); }

body .typecho-pager a:hover { background: var(--bx-primary-faint); }

body .typecho-pager li.current a { background: var(--bx-primary); color: #fff; }

body .typecho-option-tabs a {
    border: 1px solid var(--bx-border);
    color: var(--bx-text-2);
    border-radius: 6px;
    margin-right: 6px;
    transition: var(--bx-trans);
}

body .typecho-option-tabs a:hover {
    color: var(--bx-primary);
    border-color: var(--bx-primary-light);
    background: var(--bx-surface);
}

body .typecho-option-tabs li.current a,
body .typecho-option-tabs li.active a {
    background: var(--bx-primary);
    border-color: var(--bx-primary);
    color: #fff;
}

/* --------------------------------------------------------------------------
   6. 表格
   -------------------------------------------------------------------------- */
body .typecho-table-wrap {
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
}

body .typecho-list-table th { border-bottom-color: var(--bx-border); }

body .typecho-list-table td { border-top-color: var(--bx-border); }

body .typecho-list-table tbody tr:hover td { background: var(--bx-surface-2); }

body .typecho-list-table tbody tr.checked td { background: var(--bx-primary-faint); }

/* --------------------------------------------------------------------------
   7. 消息通知
   -------------------------------------------------------------------------- */
body .message {
    border-radius: var(--bx-r-sm);
    box-shadow: var(--bx-shadow-sm);
}

/* 提示色走独立状态色变量，不受主色影响（深浅色差异由变量本身承担） */
body .error { background: var(--bx-danger-faint); color: var(--bx-danger); }

body .success { background: var(--bx-ok-faint); color: var(--bx-ok); }

/* --------------------------------------------------------------------------
   8. 卡片化布局（美化设置开启时）
   -------------------------------------------------------------------------- */
html.biex-card .typecho-page-title h2 { font-weight: 600; }

html.biex-card .typecho-table-wrap { padding: 24px; }

html.biex-card .typecho-list-operate {
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
    padding: 12px 16px;
}

html.biex-card .typecho-option-tabs.fix-tabs { margin: 1.2em 0; }

html.biex-card .typecho-option-submit {
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
    padding: 8px 16px;
}

html.biex-card .typecho-foot { padding: 3.5em 0 3em; }

/* --------------------------------------------------------------------------
   8b. 控制台仪表盘（网站概要页）
   -------------------------------------------------------------------------- */
html.biex-card .typecho-dashboard .typecho-page-main { margin-top: 18px; }

/* 首页三块（最近发布的文章 / 最近得到的回复 / 官方最新日志）的纵向间距。
   Typecho 的列布局只给了左右各 10px 内边距，纵向一点没有：窄屏下三个
   col-mb-12 各占整行，于是三块卡片直接贴在一起。这里统一交给 row-gap
   一处负责（同行 Admin Beautify 也是用 gap 解决同一个问题）。
   welcome-board 自带的 margin-bottom 会和 gap 叠加成双倍间距，一并归零。 */
.typecho-dashboard .row.typecho-page-main { row-gap: 16px; }

html.biex-card .typecho-dashboard .typecho-page-main > .welcome-board { margin-bottom: 0; }

/* 关闭「官方最新日志」后整块移除。
   用 :has() 连列容器一起隐藏，否则桌面端会留下一个占着 1/3 宽度的空列。
   Typecho 1.2 的后台样式自身就用了 :has()（如 body:has(.menu-bar[open])），
   所以这里不引入新的浏览器要求。 */
html.biex-nofeed .typecho-dashboard .typecho-page-main > :has(#typecho-message) { display: none; }

@media (min-width: 768px) {
    /* 少了一列之后，剩下两列均分整行，避免右侧空出三分之一 */
    html.biex-nofeed .typecho-dashboard .typecho-page-main:has(> :has(#typecho-message)) > .col-tb-4 {
        flex: 1 1 0;
        max-width: none;
    }
}

/* 欢迎横幅：主色渐变 hero */
/* 欢迎横幅：主色渐变 hero。
   原设计把「目前有 N 篇文章…」整句塞在这里，行高 2、数字 1.8em，
   一大块渐变上飘着一句话，信息扫不出来。现在改为「三格数据 + 快捷入口」，
   纵向体量也随之收小。 */
html.biex-card .typecho-dashboard .welcome-board {
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    padding: 24px 26px 20px;
    color: #fff;
    background: linear-gradient(135deg,
        var(--bx-primary, #a63a50) 0%,
        var(--bx-primary-dark, #893042) 100%);
    border-radius: var(--bx-r-lg);
    box-shadow: 0 6px 24px var(--bx-primary-faint2, rgba(166, 58, 80, 0.35));
}

/* hero 角落的梅花水印 */
html.biex-card .typecho-dashboard .welcome-board::after {
    content: "\2745";
    display: none !important;
    right: 18px;
    bottom: -14px;
    font-size: 96px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

html.biex-card .typecho-dashboard .welcome-board p {
    position: relative;
    z-index: 1;
    margin: 0 0 14px;
    font-size: 1.1em;
    line-height: 2;
}

html.biex-card .typecho-dashboard .welcome-board em {
    display: inline-block;
    padding: 0 4px;
    color: #fff;
    font-size: 1.8em;
    font-style: normal;
    font-weight: 600;
    line-height: 1;
    vertical-align: -0.12em;
}

/* 快捷入口：卡片网格。
   与胶囊相比，卡片的边界更明确 —— "这是个可点击的块"，而不是装饰元素。 */
html.biex-card .typecho-dashboard #start-link {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 14px 0 6px;
    border-bottom: none;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

/* 数据格：大数字 + 小标签。由 biex.js 从原句的三个 <em> 里读出数值后重建。
   建不起来时原句照旧显示（不加 .biex-hero-src），这里不会留下空档。 */
.biex-hero-stats {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 30px;
    margin: 0 0 16px;
}

.biex-hero-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.biex-hero-stat b {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: #fff;
}

.biex-hero-stat span {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.78);
}

/* 原句只在数据格建成后才由 JS 加上这个类隐去 */
html.biex-card .typecho-dashboard .welcome-board .biex-hero-src { display: none; }

html.biex-card .typecho-dashboard #start-link li {
    float: none;
    display: block;
    margin: 0;
    list-style: none;
}

html.biex-card .typecho-dashboard #start-link li a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--bx-text);
    background: #fff;
    border: 1px solid var(--bx-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: var(--bx-trans);
}

html.biex-card .typecho-dashboard #start-link li a:hover {
    color: var(--bx-primary);
    border-color: var(--bx-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 「撰写新文章」是首页最高频的动作，做成实心主按钮，与其余次要入口拉开层级。
   用 href 匹配而不是 :first-child —— Typecho 会把「待审核的评论」「垃圾评论」
   按条件插在前面，顺序不是固定的；href 不会变。 */
html.biex-card .typecho-dashboard #start-link li a[href*="write-post"] {
    color: #fff;
    background: var(--bx-primary);
    border-color: var(--bx-primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

html.biex-card .typecho-dashboard #start-link li a[href*="write-post"]:hover {
    color: #fff;
    background: var(--bx-primary-dark);
    border-color: var(--bx-primary-dark);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

html.biex-card .typecho-dashboard #start-link .balloon {
    margin: 0;
    background: var(--bx-bg-2);
    color: var(--bx-primary);
    border-radius: 999px;
    font-weight: 600;
}

/* 主按钮里的徽标用半透明白，不然在彩色背景上读不清 */
html.biex-card .typecho-dashboard #start-link li a[href*="write-post"] .balloon {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* 最近文章 / 回复 / 官方日志 三卡片 */
html.biex-card .typecho-dashboard .latest-link {
    display: block;
    height: auto;
    padding: 20px 24px 14px;
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
    transition: var(--bx-trans);
}

html.biex-card .typecho-dashboard .latest-link:hover { box-shadow: var(--bx-shadow-md); }

html.biex-card .typecho-dashboard .latest-link h3 {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding-left: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--bx-text);
}

/* 「查看全部」：由 biex.js 追加。让卡片有出口，而不是看完就没路可走 */
html.biex-card .typecho-dashboard .latest-link h3 .biex-more {
    margin-left: auto;
    padding: 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--bx-text-2);
    background: none;
    text-decoration: none !important;
    white-space: nowrap;
    transition: var(--bx-trans);
}

html.biex-card .typecho-dashboard .latest-link h3 .biex-more:hover { color: var(--bx-primary); }

html.biex-card .typecho-dashboard .latest-link h3::before {
    content: "";
    display: none !important;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--bx-primary), var(--bx-primary-dark));
}

html.biex-card .typecho-dashboard .latest-link ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

html.biex-card .typecho-dashboard .latest-link li {
    padding: 6px 8px;
    margin: 0 -8px;
    border-bottom: 1px dashed var(--bx-border);
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--bx-trans);
}

/* 整行可扫读：悬停给一层底色，比只改链接颜色更容易定位 */
html.biex-card .typecho-dashboard .latest-link li:hover { background: var(--bx-surface-2); }

html.biex-card .typecho-dashboard .latest-link li:last-child { border-bottom: none; }

html.biex-card .typecho-dashboard .latest-link li > span {
    display: inline-block;
    width: 37px;
    padding-right: 8px;
    border-right: 1px solid var(--bx-border);
    text-align: right;
    font-family: var(--bx-mono);
    font-size: 11.5px;
    color: var(--bx-text-2);
}

html.biex-card .typecho-dashboard .latest-link a.title { color: var(--bx-text); }

html.biex-card .typecho-dashboard .latest-link a.title:hover { color: var(--bx-primary); }

html.biex-card .typecho-dashboard .latest-link em { color: var(--bx-text-2); font-style: normal; }

/* 版本更新提示 */
html.biex-card .typecho-dashboard .update-check {
    margin-top: 16px;
    padding: 12px 18px;
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
}

/* --------------------------------------------------------------------------
   9. 侧栏（由 biex.js 构建注入）
   -------------------------------------------------------------------------- */
.biex-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    width: var(--bx-sb-w);
    background: var(--bx-sidebar-bg);
    border-right: 1px solid var(--bx-border);
    box-shadow: var(--bx-shadow-sm);
    overflow: hidden;
    transition: transform 0.24s ease;
}

.biex-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    height: 60px;
    padding: 0 16px;
    border-bottom: 1px solid var(--bx-border);
}

.biex-brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: none;
    color: #fff;
    background: linear-gradient(135deg, var(--bx-primary), var(--bx-primary-dark));
    border-radius: 9px;
    box-shadow: 0 3px 8px var(--bx-primary-faint2);
}

.biex-brand-logo svg { display: block; }

.biex-brand-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--bx-text);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 折叠开关：只在桌面端出现 */
.biex-rail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 26px;
    height: 26px;
    margin-left: auto;
    padding: 0;
    color: var(--bx-text-2);
    background: none;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: var(--bx-trans);
}

.biex-rail-toggle:hover { color: var(--bx-primary); background: var(--bx-surface-2); }

.biex-rail-toggle svg { transition: transform 0.2s ease; }

.biex-sidebar-close {
    display: none;
    margin-left: auto;
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bx-surface-2);
    color: var(--bx-text-2);
    border-radius: 8px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

/* 导航主体 */
.biex-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 10px 16px;
    scrollbar-width: thin;
}

.biex-nav::-webkit-scrollbar { width: 5px; }
.biex-nav::-webkit-scrollbar-thumb { background: var(--bx-border); border-radius: 5px; }

.biex-nav-group { margin-top: 6px; }
.biex-nav-group:first-child { margin-top: 0; }

/* 组头（手风琴折叠按钮） */
.biex-nav-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--bx-text);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--bx-trans);
    text-align: left;
}

.biex-nav-head:hover {
    background: var(--bx-surface-2);
    color: var(--bx-primary);
}

.biex-nav-group.is-open > .biex-nav-head { color: var(--bx-primary); }

.biex-nav-group.is-open > .biex-nav-head .biex-nav-ico { color: var(--bx-primary); }

.biex-nav-head .biex-nav-ico { color: var(--bx-text-2); }

.biex-nav-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex: none;
    color: var(--bx-text-2);
    transition: transform 0.2s ease;
}

.biex-nav-group.is-open > .biex-nav-head .biex-nav-arrow {
    transform: rotate(90deg);
    color: var(--bx-primary);
}

/* 子项容器 */
.biex-nav-sub { display: none; padding: 2px 0 4px; }

.biex-nav-group.is-open > .biex-nav-sub { display: block; }

/* 子项链接（也用于单子项组直链） */
.biex-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px 7px 12px;
    margin: 1px 0;
    font-size: 13.5px;
    color: var(--bx-text);
    text-decoration: none !important;
    border-radius: 8px;
    transition: var(--bx-trans);
    position: relative;
}

.biex-nav-sub .biex-nav-link { padding-left: 35px; }

.biex-nav-link:hover {
    background: var(--bx-surface-2);
    color: var(--bx-primary);
}

.biex-nav-link.is-current {
    background: var(--bx-primary-faint);
    color: var(--bx-primary);
    font-weight: 600;
}

.biex-nav-link.is-current::before {
    content: "";
    display: none !important;
    left: 4px;
    width: 3px;
    height: 16px;
    border-radius: 3px;
    background: var(--bx-primary);
}

.biex-nav-sub .biex-nav-link.is-current::before { left: 24px; }

.biex-nav-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: none;
    color: var(--bx-text-2);
}

.biex-nav-link:hover .biex-nav-ico,
.biex-nav-link.is-current .biex-nav-ico { color: var(--bx-primary); }

/* 侧栏底部 */
.biex-nav-foot {
    flex: none;
    border-top: 1px solid var(--bx-border);
    padding: 10px;
}

.biex-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px;
    border-radius: 10px;
    background: var(--bx-surface-2);
}

.biex-user-avatar {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bx-primary-faint);
}

.biex-user-initial {
    width: 30px;
    height: 30px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--bx-primary), var(--bx-primary-dark));
}

.biex-user-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--bx-text) !important;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biex-user-name:hover { color: var(--bx-primary) !important; }

.biex-dark-toggle {
    flex: none;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: var(--bx-surface);
    color: var(--bx-text-2);
    cursor: pointer;
    transition: var(--bx-trans);
}

.biex-dark-toggle:hover { color: var(--bx-primary); box-shadow: var(--bx-shadow-sm); }

/* 网站 / 登出操作区 */
.biex-nav-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.biex-nav-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    padding: 7px 10px;
    font-size: 12.5px;
    color: var(--bx-text-2);
    text-decoration: none !important;
    background: var(--bx-surface-2);
    border: 1px solid var(--bx-border);
    border-radius: 8px;
    transition: var(--bx-trans);
}

.biex-nav-action:hover {
    color: var(--bx-primary);
    border-color: var(--bx-primary-light);
    background: var(--bx-surface);
}

.biex-nav-action-exit:hover {
    color: #a63a50;
    border-color: rgba(166, 58, 80, 0.4);
}

html.biex-dark .biex-nav-action-exit:hover {
    color: #f0b3bd;
    border-color: rgba(240, 179, 189, 0.4);
}

/* 遮罩（移动端） */
.biex-mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9985;
    background: rgba(15, 17, 22, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.24s ease;
}

body.biex-open .biex-mask { display: block; opacity: 1; }

/* 侧栏模式下：隐藏原生导航、内容左移 */
html.biex-js .typecho-head-nav { display: none !important; }

html.biex-js body { padding-left: var(--bx-sb-w); }

/* Typecho 的 .row 固定 width:100vw，只在「body 没有左偏移」时才成立。
   侧栏模式下 body 有 padding-left，100vw 会比可用宽度多出整整一个侧栏，
   于是整行内容向右溢出（列表页、首页都会中招）。
   收回成 100%：配合它自带的 -10px 左右外边距，依旧贴到容器边缘不外溢。
   同行 Admin Beautify 在左侧栏布局下也是这么中和的。 */
html.biex-js .row { width: 100%; }

/* 内容区左右留白。
   Typecho 的 .container 左右只给 10px，而指标卡之间的间隙也是 10px ——
   外层留白 ≤ 内间隙，四张指标卡就从最左一路顶到最右，看着"被撑满"。
   放到 16px，让外层留白大于内间隙。
   全宽度生效：窄屏这 6px 差距肉眼可见；宽屏下容器本就有 max-width，
   多出的 6px 只是让内容不至于贴着容器边缘。
   对齐不受影响：.row 的 -10px 负外边距与列自身的 10px 内边距会自适应 ——
   容器 16 → row 6 → 列内容 16，各页内容依旧落在同一条线上。 */
html.biex-js .container {
    padding-left: 16px;
    padding-right: 16px;
}

/* 移动端顶栏 */
.biex-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9980;
    height: 52px;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: var(--bx-sidebar-bg);
    border-bottom: 1px solid var(--bx-border);
    box-shadow: var(--bx-shadow-sm);
}

.biex-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 9px;
    background: var(--bx-surface-2);
    color: var(--bx-text);
    cursor: pointer;
}

.biex-burger:hover { color: var(--bx-primary); }

.biex-topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--bx-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biex-topbar-ico {
    margin-left: auto;
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--bx-primary), var(--bx-primary-dark));
}

/* 移动端顶栏里的命令面板入口（topbar-ico 已有 margin-left:auto，这里紧贴其后） */
.biex-topbar-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: auto;
    border: none;
    border-radius: 9px;
    background: var(--bx-surface-2);
    color: var(--bx-text-2);
    cursor: pointer;
}

.biex-topbar-search:hover { color: var(--bx-primary); }

.biex-topbar-search + .biex-topbar-ico { margin-left: 8px; }

/* --------------------------------------------------------------------------
   9b. 侧栏折叠（图标轨道）模式
   --------------------------------------------------------------------------
   后台有 8 个以上一级菜单时，232px 的常驻侧栏会明显压缩写作页宽度。
   折叠后只留图标，悬停临时展开（peek），不改变持久状态。 */
@media (min-width: 768px) {
    html.biex-rail body { padding-left: var(--bx-rail-w); }

    html.biex-rail .biex-sidebar { width: var(--bx-rail-w); }

    /* 折叠态：隐藏文字、箭头与用户信息，仅保留图标列 */
    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-brand-name,
    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-text,
    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-arrow,
    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-user-name,
    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-dark-toggle {
        display: none;
    }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-brand {
        justify-content: center;
        padding: 0 8px;
    }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-rail-toggle { margin-left: 0; }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav { padding: 10px 8px 16px; }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-head,
    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-link {
        justify-content: center;
        padding-left: 8px;
        padding-right: 8px;
    }

    /* 折叠态一律平铺子项，点击组头会先展开侧栏 */
    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-sub { display: block; }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-sub .biex-nav-link { padding-left: 8px; }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-link.is-current::before { display: none; }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-user {
        justify-content: center;
        padding: 6px 0;
    }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-actions { flex-direction: column; }

    html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-nav-action span { display: none; }

    html.biex-rail .biex-rail-toggle svg { transform: rotate(180deg); }

    /* 悬停临时展开：盖在内容之上，不推动布局 */
    html.biex-rail .biex-sidebar.biex-rail-peek {
        width: var(--bx-sb-w);
        box-shadow: var(--bx-shadow-lg);
        z-index: 9992;
    }
}

/* --------------------------------------------------------------------------
   10. 响应式：移动端抽屉
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    html.biex-js body {
        padding-left: 0;
        /* 刘海屏：顶栏追加安全区高度，内容不被状态栏遮住 */
        padding-top: calc(var(--bx-topbar-h) + env(safe-area-inset-top, 0px));
    }

    html.biex-js .biex-topbar {
        display: flex;
        height: calc(var(--bx-topbar-h) + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0px);
        padding-left: max(14px, env(safe-area-inset-left, 0px));
        padding-right: max(14px, env(safe-area-inset-right, 0px));
    }

    .biex-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--bx-shadow-lg);
        width: min(288px, 84vw);
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-left: env(safe-area-inset-left, 0px);
    }

    body.biex-open .biex-sidebar { transform: translateX(0); }

    .biex-sidebar-close { display: inline-flex; align-items: center; justify-content: center; }

    /* 移动端不使用折叠模式，避免与抽屉互相打架 */
    .biex-rail-toggle { display: none; }

    /* 抽屉打开时锁住背景滚动，避免"滑动手势穿透到底层页面" */
    body.biex-open { overflow: hidden; }

    /* 顶栏已经把「顶部」交代清楚了（固定 52px，body 也预留了同等高度），
       而 Typecho 给 .typecho-page-title 的 margin-top 是 25px 的桌面量级，
       叠在顶栏下就是一整条空白带。移动端收窄到 12px。 */
    .typecho-page-title { margin-top: 12px; }

    /* 首页在手机上：hero 收紧、数据格降一档、列表行加密。
       三张卡在窄屏各占整行，行距不压一压会拖成很长的滚动。 */
    html.biex-card .typecho-dashboard .welcome-board { padding: 18px 18px 14px; }
    .biex-hero-stats { gap: 4px 20px; margin-bottom: 12px; }
    .biex-hero-stat b { font-size: 22px; }
    /* 快捷入口在手机上不能为了"收密"而做小。
       上一版把 padding 收到 5px/13px、字号 12.5px，算下来只有约 31px 高 ——
       比桌面还小，而这是首页最高频的两个动作，手指目标至少要 40px。
       卡片用 2 列网格布局，比桌面更紧凑但不缩小触控目标。 */
    html.biex-card .typecho-dashboard #start-link {
        padding-top: 12px;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    html.biex-card .typecho-dashboard #start-link li a {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 13px;
    }
    html.biex-card .typecho-dashboard .latest-link { padding: 16px 16px 8px; }
    html.biex-card .typecho-dashboard .latest-link li { padding: 5px 6px; margin: 0 -6px; }
    html.biex-card .typecho-dashboard .latest-link li > span { width: 34px; }

    /* 页脚与登录页也照顾底部安全区（iPhone 手势条） */
    body .typecho-foot { padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)); }

    body.body-100 .typecho-login-wrap {
        padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
    }

    /* 移动端：卡片操作区按钮加大，底部操作不再躲进小图标 */
    .biex-card-actions { padding: 12px; gap: 10px; }

    .biex-menu-btn { width: 34px; height: 34px; }

    /* 指标卡在窄屏两列，数字缩小一档 */
    .biex-metric { padding: 12px 14px; }

    .biex-metric-num { font-size: 20px; }

    /* 工具栏改为纵向堆叠：筛选、排序、搜索各占一行 */
    .biex-toolbar { gap: 8px; }

    .biex-toolbar .biex-sort-wrap,
    .biex-toolbar .biex-search { margin-left: 0; flex: 1 1 100%; max-width: none; }

    .biex-seg { width: 100%; }

    .biex-seg a { flex: 1; text-align: center; }

    /* 标签页横向滚动，不再换行挤压 */
    .biex-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .biex-tabs::-webkit-scrollbar { display: none; }

    .biex-tabs a { flex: none; }

    .biex-tabs .biex-tabs-extra { margin-left: 8px; }

    /* 面板头：标题与操作按钮分成两行 */
    .biex-head { gap: 10px; }

    .biex-head-actions { margin-left: 0; width: 100%; }

    .biex-head-actions .btn { flex: 1; }

    /* 安装预览 / 体检的键值对单列排布 */
    .biex-preview-grid { grid-template-columns: 1fr; }

    .biex-preview-actions .btn { flex: 1 1 auto; }
}

/* 平板竖屏（768–991）：三列网格降到两列，侧栏收窄 */
@media (min-width: 768px) and (max-width: 991px) {
    :root { --bx-sb-w: 208px; }

    .biex-grid,
    .biex-plugin-items {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .biex-toolbar .biex-sort-wrap { margin-left: 0; }

    .biex-search { flex: 1 1 100%; max-width: none; }
}

/* 超宽屏：内容不再无限拉伸，保持可读行宽 */
@media (min-width: 1600px) {
    .biex-panel .container { max-width: 1440px; }

    .biex-grid,
    .biex-plugin-items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   11. 登录页
   -------------------------------------------------------------------------- */
body.body-100 {
    min-height: 100vh;
    background: linear-gradient(150deg, var(--bx-primary) 0%, var(--bx-primary-dark) 55%, #23262e 100%) no-repeat center / cover fixed, var(--bx-bg);
}

body.body-100::before {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--bx-login-bg, none) no-repeat center / cover;
    z-index: -1;
}

html.biex-dark body.body-100 {
    background: linear-gradient(150deg, rgba(30, 33, 40, 0.9), rgba(16, 18, 23, 0.96)) no-repeat center / cover fixed,
        linear-gradient(150deg, var(--bx-primary) 0%, var(--bx-primary-dark) 60%, #16181d 100%);
    color: var(--bx-text);
}

body.body-100 .typecho-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

body.body-100 .typecho-login {
    display: block;
    width: 340px;
    max-width: calc(100vw - 40px);
    padding: 36px 34px 28px;
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-lg);
}

body.body-100 .typecho-login h1 { margin: 0 0 1.4em; text-align: center; }

/* 用梅花 SVG 替换原生 logo */
body.body-100 .typecho-login h1 a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--bx-primary), var(--bx-primary-dark));
    background-image: none !important;
    text-indent: 0 !important;
    text-indent: -9999px;
    box-shadow: 0 8px 22px var(--bx-primary-faint2);
}

body.body-100 .typecho-login h1 a::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 32px 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23ffffff'%3E%3Cellipse cx='12' cy='6.6' rx='2.5' ry='3.4'/%3E%3Cellipse cx='12' cy='6.6' rx='2.5' ry='3.4' transform='rotate(72 12 12)'/%3E%3Cellipse cx='12' cy='6.6' rx='2.5' ry='3.4' transform='rotate(144 12 12)'/%3E%3Cellipse cx='12' cy='6.6' rx='2.5' ry='3.4' transform='rotate(216 12 12)'/%3E%3Cellipse cx='12' cy='6.6' rx='2.5' ry='3.4' transform='rotate(288 12 12)'/%3E%3Ccircle cx='12' cy='12' r='1.7'/%3E%3C/g%3E%3C/svg%3E");
}

body.body-100 .typecho-login .btn-l { border-radius: var(--bx-r-sm); }

body.body-100 .typecho-login input.text-l {
    border-radius: var(--bx-r-sm);
    padding: 10px;
}

body.body-100 .typecho-login .more-link { color: var(--bx-text-2); }

body.body-100 .typecho-login .more-link a { color: var(--bx-primary); }

body.body-100 .typecho-foot { color: rgba(255, 255, 255, 0.66); }

html.biex-dark body.body-100 .typecho-foot { color: var(--bx-text-2); }

body.body-100 .typecho-foot a { color: rgba(255, 255, 255, 0.85); }

html.biex-dark body.body-100 .typecho-foot a { color: var(--bx-text-2); }

/* --------------------------------------------------------------------------
   11b. 版权水印（body::after，文字由 --bx-watermark 提供，未定义则不渲染）
   -------------------------------------------------------------------------- */
body::after {
    content: var(--bx-watermark, none);
    position: fixed;
    right: 4vw;
    bottom: 4vh;
    z-index: -1;
    max-width: 92vw;
    overflow: hidden;
    font-family: var(--bx-font);
    font-size: clamp(64px, 14vw, 190px);
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    color: var(--bx-primary);
    opacity: 0.08;
    pointer-events: none;
    user-select: none;
}

/* 深色模式：略微提高可见度 */
html.biex-dark body::after { opacity: 0.1; }

/* 登录页：深色渐变底上改用白色水印 */
body.body-100::after {
    color: #fff;
    opacity: 0.14;
}

html.biex-dark body.body-100::after { opacity: 0.16; }

/* --------------------------------------------------------------------------
   12. 梅花控制中心面板（manage.php）
   -------------------------------------------------------------------------- */
body.biex-panel .typecho-page-title h2 { font-weight: 600; }

/* 面板顶层区块必须各自占满整行。
   Typecho 的 admin/css/grid.css 把 .container 定义成
   `display:flex; flex-wrap:wrap`，而 Typecho 自己的页面是靠
   <div class="row"><div class="col-mb-12"> 让内容占满整行的。
   面板直接把这些区块放进 .container，它们就退化成按内容宽度排布的
   flex item —— 结果要么内容被撑到右侧溢出，要么标签导航和内容区
   并排（导航留在左边、内容跑到右边）。
   另外 flex item 的 min-width 默认是 auto，不允许收缩到 min-content 以下，
   长路径这类不可断行的文本会顶住不放，所以一并置 0。 */
body.biex-panel .container > * {
    flex: 0 0 100%;
    max-width: 100%;
    min-width: 0;
}

/* 面板头：标题与主操作同排。上传区默认收起，不再抢占首屏 */
.biex-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 0;
}

.biex-head h2 { margin: 0; }

.biex-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* 标签页：下划线导航。与筛选用的分段控件在形态上明确区分，
   避免「导航」和「筛选」长得一样导致误读 */
.biex-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 14px 0 20px;
    border-bottom: 1px solid var(--bx-border);
}

.biex-tabs a {
    padding: 9px 15px;
    margin-bottom: -1px;
    font-size: 13.5px;
    color: var(--bx-text-2);
    text-decoration: none !important;
    border-bottom: 2px solid transparent;
    transition: var(--bx-trans);
}

.biex-tabs a:hover { color: var(--bx-primary); }

.biex-tabs a.is-active {
    color: var(--bx-primary);
    font-weight: 600;
    border-bottom-color: var(--bx-primary);
}

.biex-tabs .biex-tabs-extra { margin-left: auto; }

.biex-section { margin: 0 0 10px; }

/* 指标卡：数据用大数字承载，和导航/筛选在视觉权重上明确区分 */
.biex-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 18px;
}

@media (min-width: 576px) {
    .biex-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.biex-metric {
    padding: 14px 16px;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
}

.biex-metric-num {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--bx-text);
}

.biex-metric-num small {
    margin-left: 2px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--bx-text-2);
}

.biex-metric-label {
    margin-top: 5px;
    font-size: 12.5px;
    color: var(--bx-text-2);
}

.biex-metric-num.is-ok { color: var(--bx-ok); }

.biex-metric-num.is-warn { color: var(--bx-warn); }

/* 站点体检的「失败」计数用危险色。缺了这条，失败数会跟着正文色走，
   和左边已经着色的「通过 / 警告」不成套。 */
.biex-metric-num.is-danger { color: var(--bx-danger); }

/* 分段控件：用于列表筛选，形态与下划线标签页区分开 */
.biex-seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--bx-surface-3);
    border-radius: var(--bx-r-sm);
}

.biex-seg button {
    appearance: none;
    -webkit-appearance: none;
    padding: 5px 13px;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--bx-text-2);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--bx-trans);
}

.biex-seg button:hover { color: var(--bx-primary); }

.biex-seg button.is-active {
    background: var(--bx-surface);
    color: var(--bx-text);
    font-weight: 600;
    box-shadow: var(--bx-shadow-sm);
}

/* 安装预览：两步安装的二次确认面板 */
.biex-preview {
    padding: 18px 20px;
    margin-bottom: 20px;
    background: var(--bx-surface);
    border: 1px solid var(--bx-primary-light);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
}

.biex-preview-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--bx-text);
}

.biex-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 14px 0 0;
}

.biex-preview-item {
    min-width: 0;
    padding: 10px 12px;
    background: var(--bx-surface-2);
    border-radius: var(--bx-r-sm);
}

.biex-preview-item dt {
    margin: 0 0 3px;
    font-size: 12px;
    color: var(--bx-text-2);
}

.biex-preview-item dd {
    margin: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--bx-text);
    word-break: break-all;
}

.biex-preview-warn {
    margin: 14px 0 0;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--bx-danger);
    background: var(--bx-danger-faint);
    border-radius: var(--bx-r-sm);
}

.biex-preview-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.biex-preview-actions .biex-check { margin-right: auto; }

/* 搜索 / 排序工具栏 */
.biex-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
}

/* 筛选在左，排序与搜索靠右 */
.biex-toolbar .biex-sort { margin-left: auto; }

.biex-search {
    position: relative;
    flex: 1 1 240px;
    max-width: 340px;
}

.biex-search-icon {
    display: none !important;
    left: 11px;
    color: var(--bx-text-2);
    pointer-events: none;
}

.biex-search-input {
    width: 100%;
    padding: 7px 30px 7px 33px;
    font-size: 13px;
}

.biex-search-clear {
    display: none !important;
    right: 5px;
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    color: var(--bx-text-2);
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.biex-search-clear:hover { color: var(--bx-primary); }

.biex-sort {
    flex: 0 0 auto;
    min-width: 150px;
    font-size: 13px;
}

.biex-card.is-hidden { display: none; }

.biex-empty-search {
    padding: 34px 0 22px;
    text-align: center;
    color: var(--bx-text-2);
    font-size: 13.5px;
}

.biex-meta-sub { margin-top: 3px; }

/* 主题截图灯箱 */
.biex-theme-screen img { cursor: zoom-in; }

.biex-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 18, 23, 0.84);
    cursor: zoom-out;
    animation: biexFadeIn 0.16s ease;
}

.biex-lightbox img {
    max-width: 92vw;
    max-height: 86vh;
    border-radius: 10px;
    box-shadow: var(--bx-shadow-lg);
}

.biex-lightbox-hint {
    display: none !important;
    bottom: 24px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.72);
    pointer-events: none;
}

@keyframes biexFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 自绘确认弹窗（替代 window.confirm） */
.biex-confirm-mask {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 18, 23, 0.55);
    backdrop-filter: blur(2px);
    animation: biexFadeIn 0.14s ease;
}

.biex-confirm {
    width: 340px;
    max-width: calc(100vw - 40px);
    padding: 22px 24px 18px;
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-lg);
}

.biex-confirm-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--bx-text);
}

.biex-confirm-text {
    margin: 0 0 18px;
    font-size: 13.2px;
    line-height: 1.7;
    color: var(--bx-text-2);
    word-break: break-all;
}

.biex-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 上传区 */
.biex-upload {
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}

.biex-upload[hidden] { display: none; }

.biex-upload-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.biex-upload-head h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--bx-text);
}

.biex-upload-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: auto;
    padding: 0;
    color: var(--bx-text-2);
    background: none;
    border: none;
    border-radius: var(--bx-r-sm);
    cursor: pointer;
    transition: var(--bx-trans);
}

.biex-upload-close:hover { color: var(--bx-primary); background: var(--bx-surface-2); }

.biex-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 150px;
    padding: 26px 18px;
    text-align: center;
    border: 2px dashed var(--bx-border);
    border-radius: var(--bx-r-lg);
    background: var(--bx-surface-2);
    color: var(--bx-text-2);
    transition: var(--bx-trans);
    cursor: pointer;
}

.biex-drop:hover,
.biex-drop.is-dragover {
    border-color: var(--bx-primary);
    background: var(--bx-primary-faint);
    color: var(--bx-primary);
}

.biex-drop-icon { color: inherit; opacity: 0.8; }

.biex-drop-hint { font-size: 13.5px; }

.biex-drop-file {
    font-size: 13px;
    color: var(--bx-primary);
    font-weight: 500;
    word-break: break-all;
}

.biex-drop-file:empty { display: none; }

.biex-file-input {
    display: none !important;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.biex-upload-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 16px;
}

.biex-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--bx-text);
    cursor: pointer;
}

.biex-upload-note {
    margin: 12px 0 0;
    font-size: 12.5px;
    color: var(--bx-text-2);
}

/* 主题网格 */
.biex-grid { display: grid; gap: 20px; }

@media (min-width: 576px) { .biex-grid { grid-template-columns: repeat(2, 1fr); } }

@media (min-width: 992px) { .biex-grid { grid-template-columns: repeat(3, 1fr); } }

/* 注意：这里不能用 overflow: hidden，否则卡片底部的 ⋯ 菜单会被裁掉；
   截图区自身负责裁切 */
.biex-theme-card {
    display: flex;
    flex-direction: column;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
    transition: var(--bx-trans);
}


.biex-theme-card.is-active { border-color: var(--bx-primary); box-shadow: 0 0 0 2px var(--bx-primary-faint); }

.biex-theme-screen {
    position: relative;
    height: 150px;
    background: var(--bx-surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--bx-r-lg) var(--bx-r-lg) 0 0;
}

.biex-theme-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.biex-theme-noscreen {
    font-size: 12.5px;
    color: var(--bx-text-2);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.biex-theme-noscreen::before {
    content: "";
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bx-primary-faint);
}

/* 状态标识：圆点 + 文字。颜色走独立状态色，不占用主色语义 */
.biex-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--bx-text-2);
    white-space: nowrap;
}

.biex-state::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: none;
    border-radius: 50%;
    background: currentColor;
}

.biex-state.is-ok { color: var(--bx-ok); }

.biex-state.is-warn { color: var(--bx-warn); }

.biex-state.is-off { color: var(--bx-text-2); }

.biex-card-body {
    padding: 14px 16px 6px;
    flex: 1;
}

/* 标题行：名称 + 状态标识 */
.biex-card-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.biex-card-title h3,
.biex-card-title h4 {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--bx-text);
    word-break: break-all;
}

.biex-meta {
    margin: 0;
    font-size: 12.5px;
    color: var(--bx-text-2);
    word-break: break-all;
}

.biex-meta-dir {
    display: inline-block;
    padding: 1px 7px;
    margin-top: 5px;
    font-size: 11.5px;
    background: var(--bx-surface-2);
    border: 1px solid var(--bx-border);
    border-radius: 5px;
    color: var(--bx-text-2);
    word-break: break-all;
}

.biex-meta-link {
    color: var(--bx-primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--bx-primary-light);
}

.biex-meta-link:hover {
    color: var(--bx-primary-dark);
    border-bottom: 1px solid var(--bx-primary-dark);
}

.biex-desc {
    margin: 10px 0 0;
    font-size: 12.8px;
    line-height: 1.65;
    color: var(--bx-text-2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.biex-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--bx-border);
    margin-top: auto;
}

.biex-inline-form { display: inline-flex; margin: 0; }

/* 危险按钮：颜色来自独立状态色，切换主色不会影响危险语义 */
.biex-btn-danger { background: var(--bx-danger-faint) !important; color: var(--bx-danger) !important; }

.biex-btn-danger:hover { background: var(--bx-danger) !important; color: #fff !important; }

/* ⋯ 菜单：次要操作与不可逆操作收进来，卡片只保留一个主操作 */
.biex-menu {
    position: relative;
    display: inline-flex;
    margin-left: auto;
}

.biex-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    color: var(--bx-text-2);
    background: none;
    border: 1px solid transparent;
    border-radius: var(--bx-r-sm);
    cursor: pointer;
    transition: var(--bx-trans);
}

.biex-menu-btn:hover {
    color: var(--bx-primary);
    border-color: var(--bx-border);
    background: var(--bx-surface-2);
}

.biex-menu-list {
    display: none !important;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 60;
    display: none;
    min-width: 176px;
    padding: 5px;
    text-align: left;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: var(--bx-r-md);
    box-shadow: var(--bx-shadow-lg);
}

.biex-menu.is-open .biex-menu-list { display: block; }

.biex-menu-list form { margin: 0; }

.biex-menu-list a,
.biex-menu-list button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 7px 10px;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--bx-text);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none !important;
}

.biex-menu-list a:hover,
.biex-menu-list button:hover { background: var(--bx-surface-2); color: var(--bx-primary); }

.biex-menu-list .is-danger { color: var(--bx-danger); }

.biex-menu-list .is-danger:hover { background: var(--bx-danger-faint); color: var(--bx-danger); }

.biex-menu-list button[disabled] { opacity: 0.45; cursor: not-allowed; }

.biex-menu-list button[disabled]:hover { background: none; color: var(--bx-text); }

/* 插件列表 */
.biex-group-title {
    margin: 22px 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--bx-text-2);
    letter-spacing: 1px;
}

.biex-group-title span {
    display: inline-block;
    min-width: 20px;
    margin-left: 6px;
    padding: 0 7px;
    text-align: center;
    line-height: 18px;
    font-size: 11.5px;
    color: var(--bx-primary);
    background: var(--bx-primary-faint);
    border-radius: 999px;
}

.biex-plugin-items { display: grid; gap: 20px; }

@media (min-width: 576px) { .biex-plugin-items { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (min-width: 992px) { .biex-plugin-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 插件卡沿用与主题卡一致的资产卡结构，只是没有截图、用首字图标代替 */
.biex-plugin-card {
    display: flex;
    flex-direction: column;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
    transition: var(--bx-trans);
}

.biex-plugin-card:hover { box-shadow: var(--bx-shadow-md); }

.biex-plugin-card.is-active { border-color: var(--bx-primary-light); }

.biex-plugin-card .biex-card-body { padding: 15px 16px 6px; }

.biex-plugin-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.biex-plugin-monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--bx-primary);
    background: var(--bx-primary-faint);
    border-radius: var(--bx-r-sm);
}

/* 空状态 */
.biex-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--bx-text-2);
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    border: 1px dashed var(--bx-border);
}

/* 使用指南 */
.biex-guide { display: grid; gap: 20px; }

@media (min-width: 768px) { .biex-guide { grid-template-columns: 1fr 1fr; } }

.biex-guide-card {
    padding: 20px 22px;
    background: var(--bx-surface);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-sm);
}

.biex-guide-card h3 {
    margin: 0 0 12px;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--bx-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.biex-version {
    padding: 2px 9px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--bx-primary);
    background: var(--bx-primary-faint);
    border-radius: 999px;
}

.biex-guide-card p { margin: 0 0 12px; font-size: 13.2px; line-height: 1.75; color: var(--bx-text-2); }

.biex-guide-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.biex-guide-list li {
    position: relative;
    padding: 5px 0 5px 22px;
    font-size: 13.2px;
    line-height: 1.7;
    color: var(--bx-text-2);
}

.biex-guide-list li::before {
    content: "";
    display: none !important;
    left: 2px;
    top: 13px;
    width: 8px;
    height: 8px;
    background: var(--bx-primary-faint2);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
}

/* 环境自检未通过项 */
.biex-guide-list li.is-warn { color: #b4761a; }

html.biex-dark .biex-guide-list li.is-warn { color: #e8b866; }

.biex-guide-list li.is-warn::before {
    background: #d9822b;
    border-radius: 50%;
    transform: none;
}

.biex-guide-tip {
    margin-top: 14px !important;
    padding-top: 12px;
    border-top: 1px dashed var(--bx-border);
    font-size: 12.5px;
    color: var(--bx-text-2);
}

/* 上传中状态 */
.biex-upload.is-busy .biex-drop { pointer-events: none; }
.biex-upload.is-busy .biex-drop-hint { opacity: 0.55; }

/* 上传进度条：拖拽区底部一条细线，不打断布局 */
.biex-drop-bar-track {
    display: none !important;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--bx-border);
    border-radius: 0 0 var(--bx-r-lg) var(--bx-r-lg);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.biex-upload.is-busy .biex-drop-bar-track,
.biex-drop.is-done .biex-drop-bar-track { opacity: 1; }

.biex-drop-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--bx-primary), var(--bx-primary-dark));
    transition: width 0.16s linear;
}

/* 拖拽到页面任意位置时的全屏提示 */
.biex-dz-overlay {
    position: fixed;
    inset: 0;
    z-index: 99997;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bx-primary-faint2);
    border: 3px dashed var(--bx-primary);
    pointer-events: none;
}

.biex-dz-text {
    padding: 14px 26px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: var(--bx-primary);
    border-radius: 999px;
    box-shadow: var(--bx-shadow-lg);
}

/* --------------------------------------------------------------------------
   12b. 面板头 / 提示条 / 计数
   -------------------------------------------------------------------------- */
.biex-refresh {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.biex-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 11px 16px;
    font-size: 13px;
    line-height: 1.6;
    text-decoration: none !important;
    border-radius: var(--bx-r-md);
    border: 1px solid transparent;
}

.biex-banner-tag {
    flex: none;
    padding: 2px 9px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
}

.biex-banner-text { flex: 1 1 240px; min-width: 0; }

.biex-banner-go { flex: none; font-weight: 600; white-space: nowrap; }

.biex-banner.is-warn {
    color: var(--bx-warn);
    background: var(--bx-warn-faint);
    border-color: var(--bx-warn-faint);
}

.biex-banner.is-warn .biex-banner-tag { background: var(--bx-warn); color: #fff; }

.biex-banner.is-ok {
    color: var(--bx-ok);
    background: var(--bx-ok-faint);
    border-color: var(--bx-ok-faint);
}

.biex-banner.is-ok .biex-banner-tag { background: var(--bx-ok); color: #fff; }

/* 工具栏右侧计数（筛选后与总数不一致时出现） */
.biex-count {
    flex: none;
    font-size: 12.5px;
    color: var(--bx-text-2);
    font-variant-numeric: tabular-nums;
}

.biex-count.is-quiet { opacity: 0.45; }

/* 标签页上的数字徽标 */
.biex-tab-badge {
    display: inline-block;
    min-width: 17px;
    margin-left: 6px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
    color: #fff;
    background: var(--bx-primary);
    border-radius: 999px;
}

.biex-tab-badge.is-warn { background: var(--bx-warn); }

.biex-sort-wrap { display: inline-flex; margin-left: auto; }

/* 分段控件用链接实现（视图写进地址栏）时的对齐 */
.biex-seg a {
    display: inline-block;
    padding: 5px 13px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--bx-text-2);
    text-decoration: none !important;
    border-radius: 6px;
    white-space: nowrap;
    transition: var(--bx-trans);
}

.biex-seg a:hover { color: var(--bx-primary); }

.biex-seg a.is-active {
    background: var(--bx-surface);
    color: var(--bx-text);
    font-weight: 600;
    box-shadow: var(--bx-shadow-sm);
}

/* --------------------------------------------------------------------------
   12c. 站点体检
   -------------------------------------------------------------------------- */
.biex-health {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.biex-health-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 16px;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: var(--bx-r-md);
    box-shadow: var(--bx-shadow-sm);
}

.biex-health-dot {
    flex: none;
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--bx-text-2);
}

.biex-health-row.is-ok .biex-health-dot { background: var(--bx-ok); }

.biex-health-row.is-warn .biex-health-dot { background: var(--bx-warn); }

.biex-health-row.is-fail .biex-health-dot { background: var(--bx-danger); }

.biex-health-row.is-warn { border-color: var(--bx-warn-faint); }

.biex-health-row.is-fail { border-color: var(--bx-danger-faint); }

.biex-health-main { flex: 1; min-width: 0; }

.biex-health-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
}

.biex-health-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--bx-text);
}

.biex-health-value {
    font-family: var(--bx-mono);
    font-size: 12.5px;
    color: var(--bx-text-2);
    word-break: break-all;
}

.biex-health-row.is-fail .biex-health-value { color: var(--bx-danger); }

.biex-health-row.is-warn .biex-health-value { color: var(--bx-warn); }

.biex-health-hint {
    margin: 4px 0 0;
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--bx-text-2);
    /* 提示里会出现 usr/themes 这类长路径，没有空格可断行。
       不放开的话，整行会被单条路径顶宽，把体检列表撑到右边溢出。 */
    overflow-wrap: anywhere;
}

.biex-health-actions-card { margin-top: 4px; }

/* --------------------------------------------------------------------------
   12d. 备份列表
   -------------------------------------------------------------------------- */
.biex-backup-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.biex-backup-head .biex-guide-tip {
    flex: 1 1 320px;
    padding: 0;
    border: none;
}

.biex-backup-head code {
    font-family: var(--bx-mono);
    font-size: 12px;
    padding: 1px 5px;
    background: var(--bx-surface-2);
    border-radius: 4px;
    word-break: break-all;
}

.biex-backup-list { display: grid; gap: 10px; }

.biex-backup-card {
    display: flex;
    flex-direction: column;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: var(--bx-r-md);
    box-shadow: var(--bx-shadow-sm);
}

.biex-backup-card .biex-card-body { padding: 14px 16px 8px; }

.biex-backup-card .biex-card-actions { padding: 10px 14px; }

.biex-tag {
    flex: none;
    padding: 2px 9px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--bx-text-2);
    background: var(--bx-surface-2);
    border: 1px solid var(--bx-border);
    border-radius: 999px;
}

.biex-tag.is-theme {
    color: var(--bx-primary);
    background: var(--bx-primary-faint);
    border-color: transparent;
}

.biex-meta-item { margin-right: 10px; }

.biex-meta-item.is-quiet {
    font-family: var(--bx-mono);
    font-size: 11.5px;
    opacity: 0.75;
}

/* 命令面板定位到卡片时的闪烁提示 */
.biex-card.is-flash {
    animation: biexFlash 1.4s ease;
    border-color: var(--bx-primary) !important;
}

@keyframes biexFlash {
    0%, 100% { box-shadow: var(--bx-shadow-sm); }
    30% { box-shadow: 0 0 0 4px var(--bx-primary-faint2); }
}

/* --------------------------------------------------------------------------
   12e. 轻提示（Toast）
   -------------------------------------------------------------------------- */
.biex-toasts {
    position: fixed;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    transform: translateX(-50%);
    pointer-events: none;
}

.biex-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(460px, 92vw);
    padding: 10px 12px 10px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--bx-text);
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-left: 3px solid var(--bx-primary);
    border-radius: var(--bx-r-md);
    box-shadow: var(--bx-shadow-lg);
    pointer-events: auto;
    animation: biexToastIn 0.18s ease;
}

.biex-toast.is-error { border-left-color: var(--bx-danger); }

.biex-toast.is-ok { border-left-color: var(--bx-ok); }

.biex-toast-text { flex: 1; min-width: 0; word-break: break-word; }

.biex-toast-close {
    flex: none;
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    color: var(--bx-text-2);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.biex-toast-close:hover { color: var(--bx-text); background: var(--bx-surface-2); }

@keyframes biexToastIn {
}

/* 头像全部源都失败时的首字母兜底 */
.biex-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: none;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--bx-primary), var(--bx-primary-dark));
    border-radius: 50%;
}

/* --------------------------------------------------------------------------
   12f. 命令面板（Ctrl/⌘ + K）
   -------------------------------------------------------------------------- */
.biex-palette-mask {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
    background: rgba(16, 18, 23, 0.5);
    backdrop-filter: blur(3px);
    animation: biexFadeIn 0.14s ease;
}

.biex-palette {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    max-height: 68vh;
    overflow: hidden;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: var(--bx-r-lg);
    box-shadow: var(--bx-shadow-lg);
    animation: biexPaletteIn 0.16s ease;
}

@keyframes biexPaletteIn {
}

.biex-palette-field {
    flex: none;
    padding: 14px 16px;
    border-bottom: 1px solid var(--bx-border);
}

.biex-palette-input {
    width: 100% !important;
    padding: 0 !important;
    font-size: 15px !important;
    color: var(--bx-text);
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.biex-palette-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    overscroll-behavior: contain;
}

.biex-palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--bx-text);
    text-decoration: none !important;
    border-radius: var(--bx-r-sm);
}

.biex-palette-item.is-active,
.biex-palette-item:hover {
    color: var(--bx-primary);
    background: var(--bx-primary-faint);
}

.biex-palette-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.biex-palette-group { flex: none; font-size: 12px; color: var(--bx-text-2); }

.biex-palette-empty {
    margin: 0;
    padding: 28px 16px;
    text-align: center;
    font-size: 13.5px;
    color: var(--bx-text-2);
}

.biex-palette-foot {
    flex: none;
    padding: 9px 16px;
    font-size: 11.5px;
    color: var(--bx-text-2);
    border-top: 1px solid var(--bx-border);
    background: var(--bx-surface-2);
}

.biex-palette-foot kbd {
    display: inline-block;
    min-width: 18px;
    padding: 1px 5px;
    margin: 0 2px;
    font-family: var(--bx-mono);
    font-size: 10.5px;
    text-align: center;
    color: var(--bx-text-2);
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-bottom-width: 2px;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   13. 雪花点缀
   -------------------------------------------------------------------------- */
.biex-snow {
    position: fixed;
    top: -12px;
    /* 位于侧栏(9990)与顶栏(9980)之下，避免飘雪压在导航上 */
    z-index: 9950;
    color: var(--bx-primary-faint2);
    pointer-events: none;
    user-select: none;
    animation: biex-snow-fall linear infinite;
    will-change: transform;
}

/* 下落与横向摆动合并为单条 transform 动画，避免 margin 动画触发 layout */
@keyframes biex-snow-fall {
    0% {
        transform: translate3d(0, -4vh, 0) rotate(0deg);
        opacity: 0;
    }
    6% { opacity: 1; }
    50% { transform: translate3d(var(--bx-sway, 24px), 50vh, 0) rotate(45deg); }
    100% {
        transform: translate3d(0, 104vh, 0) rotate(90deg);
        opacity: 0.9;
    }
}

/* --------------------------------------------------------------------------
   14. 无障碍与动效偏好
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .biex-snow { display: none; }

    body .btn,
    .biex-sidebar,
    .biex-mask,
    .biex-theme-card,
    .biex-plugin-card,
    .biex-nav-link,
    .biex-toast,
    .biex-palette { transition: none !important; animation: none !important; }

    .biex-card.is-flash { animation: none !important; box-shadow: 0 0 0 3px var(--bx-primary-faint2); }
}

/* 键盘可达性：统一可见焦点圈（鼠标点击不显示） */
body a:focus-visible,
body button:focus-visible,
body input:focus-visible,
body select:focus-visible,
body textarea:focus-visible,
.biex-nav-link:focus-visible,
.biex-nav-head:focus-visible,
.biex-menu-btn:focus-visible,
.biex-tabs a:focus-visible,
.biex-seg a:focus-visible {
    outline: 2px solid var(--bx-primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* 高对比度偏好：边框加重，保证弱视环境下区块可辨 */
@media (prefers-contrast: more) {
    :root { --bx-border: #b9bcc4; }

    html.biex-dark { --bx-border: #5b6373; }
}

/* 打印时隐藏装饰元素 */
@media print {
    .biex-sidebar, .biex-topbar, .biex-mask, .biex-snow,
    .biex-toasts, .biex-palette-mask, .biex-dz-overlay { display: none !important; }
}

/* 折叠态：logo 单独居中，不被开关按钮挤偏 */
html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-brand {
    justify-content: center !important;
    padding: 0 !important;
    position: relative;
}
html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-brand-logo {
    margin: 0 auto;
}
html.biex-rail .biex-sidebar:not(.biex-rail-peek) .biex-rail-toggle {
    display: none !important;
}

/* ===== Awwwards 级精修层 ===== */
/* 1. Hero 渐变柔化：降低饱和、加微妙光晕 */
html.biex-card .typecho-dashboard .welcome-board {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--bx-primary) 88%, #fff) 0%,
        var(--bx-primary) 55%,
        var(--bx-primary-dark) 100%) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px -8px var(--bx-primary-faint2, rgba(166,58,80,.4)) !important;
}
/* 2. 快捷按钮：玻璃质感 + 悬浮上浮 */
html.biex-card .typecho-dashboard #start-link li a {
    background: rgba(255,255,255,.92) !important;
    backdrop-filter: blur(8px);
    border-radius: 10px !important;
    font-weight: 500;
    transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, border-color .2s !important;
}
html.biex-card .typecho-dashboard #start-link li a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(0,0,0,.18) !important;
}
/* 3. 卡片：更大圆角 + 更柔阴影 + 悬浮微抬 */
html.biex-card .typecho-dashboard .latest-link {
    border-radius: 14px !important;
    transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s !important;
}
html.biex-card .typecho-dashboard .latest-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px -12px rgba(0,0,0,.18) !important;
}
/* 4. 数字：更精致的字重和字距 */
.biex-hero-stat b { font-weight: 700; letter-spacing: -0.02em; }
/* 5. 导航项：平滑过渡 + 选中态光晕 */
.biex-nav-link {
    transition: all .18s ease !important;
    border-radius: 10px !important;
}
.biex-nav-link:hover { transform: translateX(2px); }
/* 6. 页面标题：更醒目 */
.typecho-page-title h2 { letter-spacing: -0.01em; }

/* 精修微调：按钮不透明 + 卡片标题不竖排 */
html.biex-card .typecho-dashboard #start-link li a {
    background: #fff !important;
    backdrop-filter: none;
}
html.biex-card .typecho-dashboard .latest-link h3 {
    white-space: normal;
    word-break: keep-all;
}

/* 撰写新文章按钮：白底深字（之前红底白字被全局白底覆盖后白字看不见） */
html.biex-card .typecho-dashboard #start-link li a[href*="write-post"] {
    color: var(--bx-text) !important;
    background: #fff !important;
    border-color: var(--bx-border) !important;
}
html.biex-card .typecho-dashboard #start-link li a[href*="write-post"]:hover {
    color: var(--bx-primary) !important;
    background: #fff !important;
    border-color: var(--bx-primary) !important;
}

/* 按钮层级：主按钮突出，次按钮低调 */
html.biex-card .typecho-dashboard #start-link li a[href*="write-post"] {
    background: #fff !important;
    color: var(--bx-primary) !important;
    font-weight: 600 !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(0,0,0,.2) !important;
}
html.biex-card .typecho-dashboard #start-link li a[href*="write-post"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,.28) !important;
}
html.biex-card .typecho-dashboard #start-link li a:not([href*="write-post"]) {
    background: rgba(255,255,255,.15) !important;
    color: rgba(255,255,255,.92) !important;
    border: 1px solid rgba(255,255,255,.25) !important;
    box-shadow: none !important;
}
html.biex-card .typecho-dashboard #start-link li a:not([href*="write-post"]):hover {
    background: rgba(255,255,255,.25) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.4) !important;
    transform: translateY(-2px);
}

#start-link li a { text-decoration: none !important; }

/* ===== 仪表盘统计卡片 ===== */
.biex-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.biex-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 14px;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: 14px;
    text-decoration: none !important;
    transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s;
}
.biex-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -10px rgba(0,0,0,.15);
    border-color: var(--bx-primary);
}
.biex-stat-card .bsi-icon { font-size: 26px; line-height: 1; }
.biex-stat-card .bsi-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--bx-text);
    letter-spacing: -0.02em;
    line-height: 1;
}
.biex-stat-card .bsi-label {
    font-size: 13px;
    color: var(--bx-text-2);
}

/* 统计卡片：横跨整行，不被三列网格挤压 */
.typecho-dashboard .row > .biex-stats-grid {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 4px;
}

/* 统计：单长条卡片内分 6 列 */
.typecho-dashboard .row > .biex-stats-grid {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    background: var(--bx-surface);
    border: 1px solid var(--bx-border);
    border-radius: 14px;
    padding: 18px 8px;
    box-shadow: var(--bx-shadow-sm);
}
.biex-stat-card {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    flex-direction: column !important;
    padding: 6px 8px !important;
    transition: background .2s !important;
}
.biex-stat-card:hover {
    transform: none !important;
    background: var(--bx-surface-2) !important;
    box-shadow: none !important;
}
.biex-stat-card .bsi-num { font-size: 24px; }
.biex-stat-card .bsi-icon { font-size: 20px; }
@media (max-width: 900px) {
    .typecho-dashboard .row > .biex-stats-grid { grid-template-columns: repeat(3, 1fr); gap: 10px 0; }
}
@media (max-width: 600px) {
    .typecho-dashboard .row > .biex-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Joe 主题设置页：撑满宽度 */
.joe_config {
    width: 100% !important;
    max-width: none !important;
}
.joe_config > form {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* Joe 主题设置页：父容器撑满 */
.options-header ~ .row .col-tb-8,
.typecho-page-main .col-tb-8.col-tb-offset-2 {
    width: 100% !important;
    margin-left: 0 !important;
}

/* Joe 设置页 col 撑满 row */
.typecho-page-main > .col-tb-8.col-tb-offset-2 {
    width: 100% !important;
    margin-left: 0 !important;
}

/* Joe 设置页：覆盖 Typecho grid 的 flex-basis 和 max-width */
.typecho-page-main > .col-tb-8.col-tb-offset-2 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}
