/* ============================================================
   管理后台样式 · 靛蓝紫视觉系统
   参考：public/plugins/iosdl（靛蓝紫渐变） + public/plugins/anniversary（macOS 窗口弹窗）
   浅色柔和侧边栏 + 顶栏 + 卡片内容区 + 批量操作条 + 底部翻页
   弹窗统一使用 macOS 窗口模型（红绿灯：黄=收缩 / 绿=放大 / 红=关闭）
   支持手机自适应（1024px / 768px / 480px 断点）
   ============================================================ */
:root {
    /* 主题色（靛蓝紫） */
    --primary-color: #6366f1;
    --primary-light: #eef2ff;
    --primary-dark: #4f46e5;
    --success-color: #22c55e;
    --success-light: #ecfdf3;
    --warning-color: #f59e0b;
    --warning-light: #fffbeb;
    --error-color: #f43f5e;
    --error-light: #fef2f4;

    /* 文字 / 边框 / 背景 */
    --text-primary: #1c1f27;
    --text-secondary: #5b6270;
    --text-muted: #9aa2ae;
    --border-color: #e6e8ef;
    --bg-primary: #f4f5f7;
    --bg-white: #ffffff;
    --bg-soft: #f8f9fc;

    /* 阴影 / 圆角 */
    --shadow-sm: 0 1px 3px rgba(28, 31, 39, 0.06);
    --shadow-md: 0 8px 24px rgba(28, 31, 39, 0.10);
    --shadow-lg: 0 18px 44px rgba(28, 31, 39, 0.14);
    --radius-sm: 9px;
    --radius-md: 14px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;

    /* 侧边栏（浅色柔和） */
    --sidebar-bg: #fbfafc;
    --sidebar-w: 208px;
    --sidebar-w-collapsed: 74px;

    /* 兼容旧变量名 */
    --brand: #4f46e5;
    --brand-2: #7c5cf6;
    --brand-soft: #eef2ff;
    --brand-soft-border: #dbe2ff;
    --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --card-border: #eceef4;
    --body-bg: #f4f5f7;
}

* { scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(28, 31, 39, 0.16); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(28, 31, 39, 0.28); }
*::-webkit-scrollbar-track { background: transparent; }

body {
    background: var(--bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ============================================================
   侧边栏（浅色柔和）
   ============================================================ */
.admin-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s ease, transform 0.3s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 18px;
    color: var(--text-primary); font-size: 16.5px; font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; white-space: nowrap; overflow: hidden;
}
.sidebar-brand .brand-logo {
    width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
    background: var(--brand-grad);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.34);
}
.sidebar-brand .brand-logo i { color: #fff; font-size: 17px; }

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 8px 12px 14px;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
    padding: 12px 12px 6px;
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    font-weight: 700;
}
.nav-item {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; margin: 2px 0;
    color: var(--text-secondary);
    font-size: 13.5px; font-weight: 500;
    border-radius: 11px;
    transition: var(--transition);
    white-space: nowrap;
}
.nav-item:hover { background: var(--brand-soft); color: var(--brand); }
.nav-item.active {
    color: #fff;
    background: var(--brand-grad);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.32);
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; color: var(--text-muted); transition: var(--transition); }
.nav-item:hover i { color: var(--brand); }
.nav-item.active i { color: #fff; }

/* 分组折叠 */
.nav-group { overflow: hidden; margin: 4px 0; }
.nav-toggle {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; user-select: none;
    padding: 10px 12px; margin-top: 2px;
    font-size: 11.5px; color: var(--text-muted);
    letter-spacing: 0.8px; font-weight: 700;
    border-radius: 9px;
    transition: background 0.2s, color 0.2s;
}
.nav-toggle:hover { background: #f2f3f7; color: var(--text-secondary); }
.nav-toggle-t { display: flex; align-items: center; gap: 8px; }
.nav-count {
    font-style: normal; font-size: 11px; font-weight: 600;
    letter-spacing: 0; color: var(--text-muted);
    background: #eef0f6; border-radius: 999px;
    padding: 1px 8px; line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}
.nav-toggle:hover .nav-count { background: #e4e7f2; color: var(--text-secondary); }
.nav-arrow { font-size: 10px; transition: transform 0.3s ease; color: #c0c6d0; }
.nav-toggle.collapsed .nav-arrow { transform: rotate(-90deg); }
.nav-group-items { overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; }
.nav-group-items.collapsed { max-height: 0 !important; opacity: 0; }

.sidebar-footer {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}
/* 管理员卡片 + 右侧两个图标按钮（查看前台 / 退出登录）
   原先是「用户卡片 + 两行大按钮」，约占 170px；改成一行后约 70px，多出的高度全部给菜单 */
.sidebar-user {
    display: flex; align-items: center; gap: 9px; padding: 8px 8px 8px 10px;
    border-radius: 12px; background: #f4f5f7;
}
.sidebar-user .avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: var(--brand-grad); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.sidebar-user .suser-t { flex: 1 1 auto; min-width: 0; }
.sidebar-user .sname {
    display: block; font-size: 13px; color: var(--text-primary); font-weight: 600; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .srole { font-size: 11px; color: var(--text-muted); }
.suser-act { flex: none; display: flex; align-items: center; gap: 4px; }
.suser-btn {
    width: 26px; height: 26px; padding: 0; flex: none;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; border: 1px solid #e3e6ef; background: #fff;
    color: var(--text-muted); font-size: 12.5px; line-height: 1;
    text-decoration: none; cursor: pointer; transition: var(--transition);
}
.suser-btn:hover {
    color: var(--brand); border-color: #c7d2fe; background: #eef2ff;
    text-decoration: none;
}
.suser-btn.suser-quit:hover {
    color: var(--error-color); border-color: var(--error-color); background: var(--error-light);
}

/* 侧边栏折叠态（电脑端） */
.admin-sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.admin-sidebar.collapsed .sidebar-brand { padding: 18px 10px; justify-content: center; }
.admin-sidebar.collapsed .sidebar-brand > span,
.admin-sidebar.collapsed .nav-section,
.admin-sidebar.collapsed .nav-toggle { display: none; }
.admin-sidebar.collapsed .sidebar-nav { padding: 10px 10px; }
.admin-sidebar.collapsed .nav-group-items,
.admin-sidebar.collapsed .nav-group-items.collapsed { display: block !important; max-height: none !important; opacity: 1 !important; }
.admin-sidebar.collapsed .nav-item { padding: 11px 10px; justify-content: center; }
.admin-sidebar.collapsed .nav-item i { margin: 0; font-size: 18px; }
.admin-sidebar.collapsed .sidebar-footer { padding: 10px 8px; }
/* 折叠态导航：左侧图标 + 右侧 4 字（两行两字），整体紧凑（仅电脑端 / 平板端，手机抽屉保持完整文字） */
@media (min-width: 769px) {
    .admin-sidebar.collapsed .nav-item {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 3px 4px;
        margin: 1px 0;
        border-radius: 8px;
    }
    .admin-sidebar.collapsed .nav-item i {
        margin: 0;
        width: 16px;
        font-size: 14px;
    }
    .admin-sidebar.collapsed .nav-item span {
        display: block;
        width: 2em;               /* 一行 2 个字 */
        height: 2.3em;            /* 只显示两行，多余裁掉 */
        overflow: hidden;
        white-space: normal;
        word-break: break-all;
        font-size: 8px;
        line-height: 1.15;
        font-weight: 600;
        text-align: left;
    }
}
/* 折叠态：只保留两个图标按钮，竖排贴底（平板 769px 起同样生效） */
@media (min-width: 769px) {
    .admin-sidebar.collapsed .sidebar-user {
        display: flex; justify-content: center; padding: 6px 4px; background: transparent;
    }
    .admin-sidebar.collapsed .sidebar-user .avatar,
    .admin-sidebar.collapsed .suser-t { display: none; }
    .admin-sidebar.collapsed .suser-act { flex-direction: column; gap: 6px; }
}
/* ============================================================
   折叠态 tooltip —— JS 渲染到 body，完全不受 overflow 限制
   这样 sidebar-nav 可以正常 overflow-y:auto 纵向滚动
   tooltip 又能溢出 sidebar 右边显示
   ============================================================ */
.dyn-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    color: var(--text-primary, #1c1f27);
    padding: 9px 18px 9px 20px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.07);
    background-image: linear-gradient(90deg, var(--brand, #4f46e5) 0, var(--brand, #4f46e5) 3px, transparent 3px);
    background-repeat: no-repeat;
    opacity: 0;
    transform: translateY(-50%) translateX(4px);
    transition: opacity 0.16s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
.dyn-tooltip.show {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
/* 小三角（纯 CSS，tooltip 渲染到 body 所以直接 absolute 定位） */
.dyn-tooltip::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: rgba(255, 255, 255, 0.97);
    filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.06));
}
/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .dyn-tooltip {
        background: rgba(28, 31, 39, 0.97);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    }
    .dyn-tooltip::before {
        border-right-color: rgba(28, 31, 39, 0.97);
    }
}

/* 电脑端侧边栏折叠按钮 */
.sidebar-toggle-btn {
    position: fixed; left: var(--sidebar-w); top: 50%;
    transform: translateY(-50%);
    width: 20px; height: 60px;
    background: var(--brand-grad);
    border: none; border-radius: 0 8px 8px 0;
    cursor: pointer; z-index: 101;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 2px 0 10px rgba(99, 102, 241, 0.32);
    transition: left 0.3s ease, width 0.2s ease;
}
.sidebar-toggle-btn:hover { width: 24px; }
.sidebar-toggle-btn i { font-size: 10px; color: #fff; transition: transform 0.3s ease; }
.sidebar-toggle-btn.collapsed { left: var(--sidebar-w-collapsed); }
.sidebar-toggle-btn.collapsed i { transform: rotate(180deg); }
.sidebar-toggle-btn::after {
    content: '收起菜单';
    position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
    background: rgba(28, 31, 39, 0.9); color: #fff; padding: 8px 12px; border-radius: 8px;
    font-size: 13px; white-space: nowrap; opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s; margin-left: 12px;
    pointer-events: none; box-shadow: 0 4px 14px rgba(28, 31, 39, 0.24);
}
.sidebar-toggle-btn.collapsed::after { content: '展开菜单'; }
.sidebar-toggle-btn:hover::after { opacity: 1; visibility: visible; }

/* ============================================================
   主内容区
   ============================================================ */
.admin-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-primary);
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}
body.collapsed .admin-main,
.admin-sidebar.collapsed ~ .admin-main { margin-left: var(--sidebar-w-collapsed); }

.admin-header {
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 99;
    flex-shrink: 0;
}
.admin-header-left { flex: 1 1 auto; min-width: 0; }
.header-title { font-size: 19px; font-weight: 700; color: var(--text-primary); margin: 0; letter-spacing: -0.2px; }
.header-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-info { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13.5px; }
.admin-info i { color: var(--primary-color); }

/* ============================================================
   顶部动态多标签页（方案 A）
   结构：.admin-tabs > [.tab-scroll > .tab-list > .tab-item...] + .tab-arr-l/r + .tab-more + .tab-menu
   ============================================================ */
.admin-tabs {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px;
    display: flex;
    align-items: stretch;
    gap: 2px;
    position: relative;
    z-index: 97;
    height: 46px;
    transition: height 0.25s ease, padding 0.25s ease, opacity 0.25s ease;
    overflow: visible;
    flex-shrink: 0;
}
.admin-tabs.collapsed { height: 0; padding: 0 12px; opacity: 0; overflow: hidden; }

/* 滚动容器 — flex:1 + min-width:0 是在 flex 里可横向滚动的关键 */
.tab-scroll {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tab-scroll::-webkit-scrollbar { display: none; }

.tab-list {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 3px;
    height: 100%;
    min-width: max-content;
}

/* Tab 本身 */
.tab-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 6px 0 6px;
    height: 30px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, font-weight 0.15s ease;
    text-decoration: none;
    flex-shrink: 0;
    border: 1px solid transparent;
}
.tab-item i { font-size: 12.5px; color: var(--text-muted); transition: color 0.2s ease; }
.tab-item:hover { background: var(--bg-soft); color: var(--text-primary); text-decoration: none; border-color: var(--border-color); }
.tab-item:hover i { color: var(--primary-color); }

/* 未选中标签：淡底色 + 细边框，在白色标签栏上更容易分辨 */
.tab-item:not(.on) {
    background: rgba(15, 23, 42, 0.035);
    border-color: rgba(15, 23, 42, 0.07);
}
.tab-item:not(.on):hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.26);
}

/* 激活态 */
.tab-item.on {
    background: var(--brand-soft);
    color: var(--primary-color);
    font-weight: 600;
    border-color: transparent;
}
.tab-item.on i { color: var(--primary-color); }
.tab-item.on .tab-x:hover { background: rgba(99,102,241,.15); color: var(--primary-color); }
/* 激活态底部渐变线条（悬浮感） */
.tab-item.on::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 2.5px;
    background: var(--brand-grad);
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.35);
}

/* 关闭按钮（×）— 未选中/未悬浮时收起（不占宽度），选中或悬浮时才撑开 */
.tab-x {
    width: 0;
    height: 18px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    opacity: 0;
    margin-left: 0;
    transition: width 0.15s ease, margin-left 0.15s ease, opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.tab-item:hover .tab-x,
.tab-item.on .tab-x { width: 18px; margin-left: 2px; opacity: 1; }
.tab-x:hover { background: #ef4444; color: #fff !important; }

/* 不可关的 tab（首页/站点列表/站点分类）— 不显示关闭按钮 */
/* （JS 里 t.closable=false 时不输出 tab-x，这里不需要额外规则） */

/* 角标 */
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    border-radius: 9px;
    line-height: 1;
    box-shadow: 0 0 0 2px #fff;
    animation: badgePulse 2.4s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* 滚动箭头 */
.tab-arr-l, .tab-arr-r {
    width: 28px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease, background 0.2s ease;
}
.tab-arr-l:hover, .tab-arr-r:hover { color: var(--primary-color); background: var(--bg-soft); }

/* 更多按钮 + 下拉菜单 */
.tab-more {
    width: 32px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease, background 0.2s ease;
    border-left: 1px solid var(--border-color);
}
.tab-more:hover { color: var(--primary-color); background: var(--bg-soft); }

.tab-menu {
    position: absolute;
    top: 100%;
    right: 12px;
    margin-top: 6px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(28, 31, 39, 0.18);
    padding: 6px;
    min-width: 180px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 999;
    animation: tabMenuIn 0.12s ease-out;
}
@keyframes tabMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tab-menu.show { display: flex; }
.tab-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 7px;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.tab-menu button:hover { background: var(--brand-soft); color: var(--primary-color); }
.tab-menu button i { font-size: 13px; width: 16px; text-align: center; }

/* 标签右键菜单：复用 .tab-menu 外观，改成 fixed 跟随鼠标定位 */
.tab-menu.tab-ctx {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    margin: 0;
    z-index: 3000;
}
.tab-menu button.is-disabled { opacity: 0.45; cursor: not-allowed; }
.tab-menu button.is-disabled:hover { background: transparent; color: var(--text-secondary); }

/* header 里的折叠按钮小调整 */
.header-actions .fold-label { margin-left: 2px; }

/* 刷新按钮旋转动画 */
.header-actions #tabRefresh .spin-once { animation: spinOnce 0.35s ease-out; }
@keyframes spinOnce { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ============================================================
   admin-content — iframe 多实例容器
   顶层 window：admin-content 是 iframe 栈容器
   iframe 内：admin-content 才是真正的业务内容区域（保留 padding）
   ============================================================ */
html:not(.is-in-iframe) .admin-content {
    padding: 0;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
html.is-in-iframe .admin-content {
    padding: 9px;
}

/* iframe 栈：absolute 叠放，只有当前显示的那个可见 */
.iframe-stack {
    position: absolute;
    inset: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.iframe-stack > .iframe-wrap {
    position: absolute;
    inset: 0;
    display: none;
    overflow: auto;
    background: var(--bg-color);
}
.iframe-stack > .iframe-wrap.active { display: block; }
.iframe-stack > .iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    /* iframe 在父窗口完全加载好之前不可见（防止侧边栏闪烁） */
    visibility: hidden;
}
/* ready 后显示 + 淡入（等 iframe 内 JS 执行完 is-in-iframe 类已经加上） */
.iframe-stack > .iframe-wrap.is-ready iframe {
    visibility: visible;
    animation: iframeFadeIn 0.18s ease-out;
}
@keyframes iframeFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* SSR 内容直接搬进 iframe-wrap（没有 iframe 元素），继承 padding */
.iframe-stack > .iframe-wrap.is-ssr { padding: 24px; }

/* ============================================================
   iframe 内自动隐藏所有冗余壳（防循环嵌套 + 双侧边栏）
   iframe 只保留 admin-content 的业务内容
   ============================================================ */
html.is-in-iframe body { padding-top: 0 !important; background: var(--bg-color, #fff); }
html.is-in-iframe .admin-sidebar,
html.is-in-iframe .mobile-header,
html.is-in-iframe .mobile-overlay,
html.is-in-iframe .admin-header,
html.is-in-iframe .admin-tabs,
html.is-in-iframe .sidebar-footer,
html.is-in-iframe .sidebar-brand,
html.is-in-iframe .sidebar-toggle-btn { display: none !important; }
html.is-in-iframe .admin-main {
    margin-left: 0 !important;
    min-height: auto !important;
    display: block !important;
    background: transparent !important;
}
html.is-in-iframe .admin-content { padding: 24px !important; }

.admin-content { padding: 24px; }


@media (max-width: 767px) {
    
    html.is-in-iframe .admin-content { padding: 8px !important; }

    .admin-content { padding: 8px; }
    
    .iframe-stack > .iframe-wrap.is-ssr { padding: 8px; }
}



/* ============================================================
   卡片
   ============================================================ */
.panel-card,
.data-card {
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}
.panel-head,
.data-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px; flex-wrap: wrap;
}
.panel-title,
.data-title { font-size: 15.5px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.panel-title i { color: var(--primary-color); }
.panel-body { padding: 20px; }

/* ============================================================
   统计卡片
   ============================================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    padding: 20px;
    display: flex; align-items: center; gap: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.stat-icon.blue   { background: #eef2ff; color: #4f46e5; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.green  { background: #ecfdf3; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.red    { background: #fef2f4; color: #f43f5e; }
.stat-icon.cyan   { background: #ecfeff; color: #0891b2; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.15; color: var(--text-primary); letter-spacing: -0.5px; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   表格
   ============================================================ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13.5px; color: var(--text-primary); }
.table thead th {
    background: var(--bg-soft);
    color: var(--text-secondary);
    font-weight: 600; font-size: 12.5px;
    padding: 12px 16px; text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.2px;
}
.table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.table tbody tr:hover td { background: var(--bg-soft); }
.table tbody tr:last-child td { border-bottom: none; }

/* 选择列 */
.col-check { width: 44px; }
.col-check input[type="checkbox"],
.batch-bar input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary-color); vertical-align: middle;
}

/* ============================================================
   徽章
   ============================================================ */
.badge-soft { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-soft.success { background: var(--success-light); color: #15803d; }
.badge-soft.danger  { background: var(--error-light); color: #be123c; }
.badge-soft.primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-soft.warn    { background: var(--warning-light); color: #b45309; }
.badge-soft.muted   { background: #f1f3f7; color: var(--text-secondary); }
/* 列表里的开关徽标：可点击的按钮形态 */
.sw-cell { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; }
.sw-cell:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(24, 32, 56, .14); filter: brightness(.98); }
.sw-cell:active { transform: translateY(0); box-shadow: none; }
.sw-cell:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.sw-cell.busy { opacity: .5; pointer-events: none; }

/* ============================================================
   操作按钮
   ============================================================ */
.act-btn {
    width: 30px; height: 30px; border-radius: 8px; border: none;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; margin-right: 5px; transition: var(--transition); cursor: pointer;
}
.act-btn:hover { transform: translateY(-1px); }
.act-btn.blue { background: var(--primary-light); color: var(--primary-dark); }
.act-btn.blue:hover { background: var(--primary-color); color: #fff; }
.act-btn.amber { background: var(--warning-light); color: #b45309; }
.act-btn.amber:hover { background: var(--warning-color); color: #fff; }
.act-btn.red { background: var(--error-light); color: #be123c; }
.act-btn.red:hover { background: var(--error-color); color: #fff; }
.act-btn.green { background: var(--success-light); color: #15803d; }
.act-btn.green:hover { background: var(--success-color); color: #fff; }
.act-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ============================================================
   按钮（覆盖 Bootstrap 默认色）
   ============================================================ */
.btn { border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--error-color); border-color: var(--error-color); color: #fff; }
.btn-danger:hover { background: #e11d48; border-color: #e11d48; color: #fff; }
.btn-success { background: var(--success-color); border-color: var(--success-color); color: #fff; }
.btn-default { background: #fff; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-default:hover { border-color: var(--primary-color); color: var(--primary-color); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }

.btn-brand {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--brand-grad); color: #fff; border: none;
    border-radius: var(--radius-sm); padding: 9px 20px; font-weight: 600; font-size: 13.5px;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
    transition: var(--transition); cursor: pointer;
}
.btn-brand:hover { color: #fff; filter: brightness(1.06); transform: translateY(-1px); }
.btn-brand:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-ghost-p {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f1f3f7; color: var(--text-secondary); border: none;
    border-radius: var(--radius-sm); padding: 9px 18px; font-weight: 600; font-size: 13.5px;
    cursor: pointer; transition: var(--transition);
}
.btn-ghost-p:hover { background: #e6e9f0; color: var(--text-primary); }

/* ============================================================
   表单
   ============================================================ */
.form-label { font-size: 13.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 7px; display: block; }
.form-control, .form-select {
    border-radius: var(--radius-sm); border: 1px solid var(--border-color);
    font-size: 13.5px; padding: 9px 13px; background: var(--bg-white); width: 100%;
    color: var(--text-primary);
    transition: var(--transition);
}
.form-control:focus, .form-select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14); outline: none; }
.form-text { font-size: 12px; color: var(--text-muted); display: block; margin-top: 5px; }
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); }
.form-check-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14); }

/* 筛选栏 */
.filter-bar {
    background: #fff;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.filter-bar .form-input,
.filter-bar .form-select { width: auto; min-width: 160px; }
.filter-input {
    height: 38px; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    padding: 0 12px; font-size: 13px; outline: none; background: #fff; color: var(--text-primary);
    transition: var(--transition);
}
.filter-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14); }

/* ============================================================
   批量操作条（柔和绿）
   ============================================================ */
.batch-bar {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 16px;
    background: var(--success-light);
    border-bottom: 1px solid #bbf7d0;
    flex-wrap: wrap;
}
.batch-bar .bb-check {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; color: #15803d; font-weight: 600; cursor: pointer; user-select: none;
}
.batch-bar .bb-del {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; background: var(--error-color); color: #fff;
    border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.batch-bar .bb-del:hover { background: #e11d48; }
.batch-bar .bb-del:disabled { opacity: 0.5; cursor: not-allowed; }
.batch-bar .bb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.batch-bar .bb-right select {
    height: 30px; border: 1px solid var(--border-color); border-radius: 8px;
    padding: 0 8px; font-size: 13px; background: #fff; outline: none; cursor: pointer;
}
.batch-bar .bb-right .bb-sel-num { color: var(--primary-color); font-weight: 700; }

/* ============================================================
   分页
   ============================================================ */
.pagination-wrapper {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.pagination-info { color: var(--text-muted); font-size: 13px; }
.pagination-jump { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.pagination-jump input {
    width: 54px; height: 30px; text-align: center;
    border: 1px solid var(--border-color); border-radius: 8px; font-size: 13px; outline: none;
    transition: var(--transition);
}
.pagination-jump input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14); }
.pagination-jump button {
    height: 30px; padding: 0 12px; border: 1px solid var(--border-color);
    background: #fff; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text-secondary);
    transition: var(--transition);
}
.pagination-jump button:hover { border-color: var(--primary-color); color: var(--primary-color); }

.pagination-p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pagination-p a.page-link-p,
.pagination-p span.page-link-p {
    min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid var(--border-color); color: var(--text-secondary);
    font-size: 13px; font-weight: 600; text-decoration: none; transition: var(--transition);
}
.pagination-p a.page-link-p:hover { border-color: var(--primary-color); color: var(--primary-color); }
.pagination-p .page-link-p.active { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.28); }
.pagination-p .page-link-p.disabled { opacity: 0.45; pointer-events: none; }

/* ============================================================
   分布条 / 空状态
   ============================================================ */
.dist-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dist-name { width: 92px; font-size: 12.5px; color: var(--text-secondary); font-weight: 500; flex-shrink: 0; }
.dist-bar { flex: 1; height: 9px; border-radius: 5px; background: #f1f3f7; overflow: hidden; }
.dist-bar > div { height: 100%; border-radius: 5px; background: var(--brand-grad); transition: width 0.6s; }
.dist-num { width: 40px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--text-primary); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.5; display: block; }

/* ============================================================
   Toast
   ============================================================ */
#toastWrap {
    position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
    z-index: 3000; display: flex; flex-direction: column; gap: 9px; align-items: center;
}
.toast-p {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 19px; border-radius: 12px;
    background: rgba(28, 31, 39, 0.94); color: #fff; font-size: 13.5px; font-weight: 500;
    box-shadow: 0 12px 34px rgba(28, 31, 39, 0.28);
}
.toast-p i { font-size: 15px; }
.toast-p.success i { color: #4ade80; }
.toast-p.error i { color: #fb7185; }

/* ============================================================
   macOS 窗口组件（弹窗统一模型）
   红绿灯：黄=收缩 / 绿=放大 / 红=关闭
   ============================================================ */
.win-mask {
    position: fixed; inset: 0; z-index: 1050;
    background: rgba(17, 20, 32, 0.46);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    padding: 24px;
}
.win-mask.show { display: flex; }

.win-panel {
    position: relative; box-sizing: border-box;
    width: min(640px, calc(100vw - 32px));
    max-height: min(900px, calc(100vh - 48px));
    display: flex; flex-direction: column;
    background: #f4f5f7;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px; overflow: hidden;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
    color: #1c1f27;
    transition: width 0.18s ease, height 0.18s ease;
    animation: winIn 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes winIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

/* 尺寸变体 */
.win-panel.win-sm { width: min(480px, calc(100vw - 32px)); }
.win-panel.win-lg { width: min(820px, calc(100vw - 32px)); }
.win-panel.win-min { width: min(560px, 94vw); height: min(460px, 80vh); }
.win-panel.win-max {
    width: 100vw; height: 100vh;
    max-width: none; max-height: none;
    border: 0; border-radius: 0; box-shadow: none;
}

/* 红绿灯 */
.win-lights { position: absolute; top: 14px; right: 16px; z-index: 12; display: flex; gap: 8px; }
.win-light {
    width: 13px; height: 13px; padding: 0; border: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
    color: rgba(0, 0, 0, 0.55); font-size: 8px; line-height: 1;
    transition: filter 0.15s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.win-light i { opacity: 0; transition: opacity 0.15s ease; pointer-events: none; }
.win-lights:hover .win-light i { opacity: 1; }
.win-light.y { background: #ffbd2e; }
.win-light.g { background: #28c840; }
.win-light.r { background: #ff5f57; }
.win-light:hover { filter: brightness(0.94); }
.win-light:active { transform: scale(0.9); }

/* 头部 */
.win-head { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 12px; padding: 18px 76px 12px 22px; }
.win-head-ico {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-grad); color: #fff; font-size: 16px;
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.32);
}
.win-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 1px; }
.win-title { margin: 0; font-size: 15px; font-weight: 700; color: #23262d; display: flex; align-items: center; gap: 7px; }
.win-title i { color: var(--primary-dark); }
.win-sub { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 主体 */
.win-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 22px 18px; }

/* 字段 */
.win-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin: 14px 0 6px; display: block; }
.win-body .win-label:first-child { margin-top: 4px; }
.win-row { display: flex; gap: 12px; }
.win-row > div { flex: 1 1 0; min-width: 0; }
.win-note {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 12px; border-radius: 12px; margin-top: 12px;
    font-size: 12.5px; line-height: 1.6; color: #b45309;
    background: var(--warning-light); border: 1px solid #fde68a;
}
.win-note i { margin-top: 1px; }
.win-note.soft { color: var(--text-secondary); background: var(--bg-soft); border-color: var(--border-color); }

/* 内部卡片 */
.win-card {
    box-sizing: border-box; padding: 13px 14px;
    border: 1px solid var(--card-border); border-radius: 14px;
    background: #fff;
}
.win-card + .win-card { margin-top: 12px; }
.win-card-t { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.win-card-t i { color: var(--primary-color); }

/* 底部操作 */
.win-foot {
    flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 12px 22px 16px; border-top: 1px solid var(--border-color);
}
.win-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 18px; box-sizing: border-box;
    border: 1px solid var(--border-color); border-radius: 10px;
    background: #fff; color: var(--text-secondary);
    font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.win-btn:hover { border-color: #c7d2fe; background: #f4f6ff; color: var(--primary-dark); }
.win-btn-primary { border-color: transparent; background: var(--brand-grad); color: #fff; }
.win-btn-primary:hover { filter: brightness(1.06); color: #fff; }
.win-btn-danger { border-color: transparent; background: var(--error-color); color: #fff; }
.win-btn-danger:hover { filter: brightness(1.06); color: #fff; }
.win-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* 专注态（隐藏可收缩内容） */
.win-panel.win-focus .win-optional { display: none; }

/* 截图放大预览（tags 页 JS 动态创建） */
.tg-zoom-mask {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(17, 20, 32, 0.82);
    display: none; align-items: center; justify-content: center; padding: 40px;
}
.tg-zoom-mask.show { display: flex; }
.tg-zoom-mask img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.tg-zoom-close {
    position: absolute; top: 22px; right: 24px;
    width: 40px; height: 40px; border-radius: 50%;
    border: none; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 16px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.tg-zoom-close:hover { background: rgba(255, 255, 255, 0.28); }

/* 截图占位（tags / dtcats 页复用） */
.tg-snap-empty {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    width: 100%; height: 100%; color: var(--text-muted); font-size: 11px;
}
.tg-snap-empty i { font-size: 18px; opacity: 0.6; }

/* ============================================================
   图标底色 · 自定义取色弹窗（tags / dtCats 页共用）
   饱和度/明度面板 + 色相条 + 透明度条（棋盘格）+ HEX + 预设
   ============================================================ */
.cpk-mask .win-panel { width: min(430px, calc(100vw - 32px)); }
.cpk-area { position: relative; height: 200px; border-radius: 14px; cursor: crosshair; touch-action: none; }
.cpk-cursor { position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 3px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 3px 8px rgba(0,0,0,.35); transform: translate(-50%,-50%); pointer-events: none; }
.cpk-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.cpk-cur { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background-color: #fff;
    background-image: repeating-conic-gradient(#d9d9de 0% 25%, #ffffff 0% 50%); background-size: 10px 10px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.18); }
.cpk-hue, .cpk-alpha { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 999px; outline: none; cursor: pointer; }
.cpk-hue { flex: 1 1 auto; background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%); }
.cpk-alpha { margin-top: 12px; }
.cpk-hue::-webkit-slider-thumb, .cpk-alpha::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; }
.cpk-hue::-moz-range-thumb, .cpk-alpha::-moz-range-thumb {
    width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; }
.cpk-hex { width: 100%; height: 42px; margin-top: 16px; box-sizing: border-box; border: 1px solid var(--border-color); border-radius: 11px;
    background: #f4f5f7; padding: 0 14px; font-size: 13.5px; color: var(--text-primary); font-family: inherit; outline: none; transition: var(--transition); }
.cpk-hex:focus { background: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(99,102,241,.28); }
.cpk-presets { display: grid; grid-template-columns: repeat(8, 1fr); gap: 9px; margin-top: 16px; }
.cpk-preset { aspect-ratio: 1 / 1; border-radius: 9px; cursor: pointer; border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .12s; }
.cpk-preset:hover { transform: scale(1.1); }
.cpk-preset.active { border-color: #1c1f27; }
/* 自定义底色入口（彩虹环） */
.tg-swatch-cp { background: conic-gradient(from 0deg, #ff453a, #ffd60a, #30d158, #5ac8fa, #0a84ff, #bf5af2, #ff453a); }

/* ============================================================
   确认框（由 admin.js 动态创建，基于窗口模型）
   ============================================================ */
.win-panel.win-confirm { width: min(420px, calc(100vw - 32px)); }
.win-confirm .win-head { padding: 18px 76px 6px 22px; }
.win-confirm .win-head-ico { background: linear-gradient(135deg, #f59e0b, #f43f5e); box-shadow: 0 6px 14px rgba(244, 63, 94, 0.3); }
.win-confirm .win-body { padding: 6px 22px 18px; font-size: 13.5px; line-height: 1.7; color: var(--text-secondary); white-space: pre-line; }

/* ============================================================
   移动端头部 / 遮罩
   ============================================================ */
.mobile-header {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; height: 56px;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000; padding: 0 16px;
    align-items: center; justify-content: space-between;
}
.mobile-menu-btn, .mobile-close-btn {
    width: 40px; height: 40px; background: transparent; border: none;
    color: var(--text-secondary); font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.mobile-header .brand,
.mobile-sidebar-header .brand {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-primary); font-size: 16px; font-weight: 700;
}
.mobile-header .brand i, .mobile-sidebar-header .brand i {
    color: #fff; background: var(--brand-grad);
    width: 26px; height: 26px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.mobile-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(17, 20, 32, 0.5); z-index: 999;
}
.mobile-overlay.show { display: block; }
.mobile-sidebar-header {
    display: none; padding: 8px 12px;
    align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

/* ============================================================
   响应式 - 平板 (769px ~ 1024px)
   侧边栏保持常驻（非抽屉），折叠/展开按钮与电脑端一致：
   贴侧边栏右缘、垂直居中，可正常收起为图标栏
   ============================================================ */

/* ============================================================
   响应式 - 手机 (<=768px)
   ============================================================ */
@media (max-width: 768px) {
    .sidebar-toggle-btn { display: none !important; }
    .mobile-header { display: flex; }
    body { padding-top: 56px; }

    .admin-sidebar,
    .admin-sidebar.collapsed {
        width: 230px !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        top: 0;
    }
    .admin-sidebar.mobile-open { transform: translateX(0); }
    .admin-sidebar .sidebar-brand { display: none; }
    .mobile-sidebar-header { display: flex; }
    .admin-sidebar.collapsed .mobile-sidebar-header { display: flex !important; }

    /* 移动端强制展开全部导航项 */
    .admin-sidebar.collapsed .nav-toggle { display: flex !important; }
    .admin-sidebar.collapsed .nav-item { padding: 10px 12px !important; justify-content: flex-start !important; }
    .admin-sidebar.collapsed .nav-item span { display: inline !important; }
    .admin-sidebar.collapsed .nav-item i { margin-right: 11px !important; font-size: 15px !important; }
    .admin-sidebar.collapsed .nav-item:hover::after { display: none; }
    .admin-sidebar.collapsed .nav-group-items { display: block !important; max-height: none !important; opacity: 1 !important; }

    body.collapsed .admin-main,
    .admin-sidebar.collapsed ~ .admin-main,
    .admin-main { margin-left: 0 !important; }

    .admin-header { padding: 12px 16px; top: 56px; }
    .header-title { font-size: 17px; }
    .admin-content { padding: 16px; }

    /* 标签页：移动端简化 */
    .admin-tabs {
        padding: 0 8px;
        height: 40px;
        top: 108px;
        position: sticky;
    }
    .tab-item { padding: 0 5px; height: 28px; font-size: 10.5px; gap: 2px; }
    .tab-item i { font-size: 11.5px; }
    .tab-x { width: 16px; height: 16px; font-size: 9px; }
    .tab-badge { min-width: 15px; height: 15px; font-size: 9.5px; padding: 0 4px; }
    .tab-arr-l, .tab-arr-r { width: 24px; font-size: 11px; }
    .tab-more { width: 28px; font-size: 12px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 14px; gap: 11px; }
    .stat-icon { width: 42px; height: 42px; border-radius: 11px; font-size: 18px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 12px; }

    .panel-body, .filter-bar { padding: 14px; }
    .batch-bar { padding: 10px 12px; gap: 10px; }
    .batch-bar .bb-right { margin-left: 0; width: 100%; }

    .pagination-wrapper { flex-direction: column; align-items: stretch; gap: 10px; }
    .pagination-jump { justify-content: center; }
    .pagination-p { justify-content: center; }

    .sidebar-nav { max-height: calc(100vh - 120px); overflow-y: auto; -webkit-overflow-scrolling: touch; }

    .win-mask { padding: 12px; }
    .win-panel { width: 100%; max-height: calc(100vh - 24px); }
    .win-panel.win-min { width: 100%; height: auto; }
    .win-head { padding: 18px 70px 10px 16px; }
    .win-body { padding: 4px 16px 16px; }
    .win-foot { padding: 12px 16px 14px; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; }
    .header-actions { width: 100%; }
    .win-row { flex-direction: column; gap: 0; }
}

/* ---------- IP / 归属地：两行展示（上行 IP，下行归属地） ---------- */
.ip-cell { line-height: 1.45; }
.ip-cell .ip-addr { display: block; font-size: 12.5px; color: var(--text-primary); word-break: break-all; }
.ip-cell .ip-location { display: block; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
