﻿/* ============================================================
   MK-KG 管理后台 - 全局样式
   与 WPF 客户端保持视觉一致
   ============================================================ */

:root {
    --color-primary: #4A90E2;
    --color-primary-hover: #3D7EC7;
    --color-primary-light: #EAF2FD;
    --color-danger: #D94444;
    --color-danger-hover: #C23A3A;
    --color-danger-light: #FFE4E4;
    --color-success: #2EAA5C;
    --color-success-light: #E4F7EA;
    --color-warning: #E8940E;
    --color-warning-light: #FFF2DB;
    --color-bg: #F0F2F5;
    --color-white: #FFFFFF;
    --color-border: #E0E0E0;
    --color-border-light: #E8ECF1;
    --color-border-input: #D0D5DD;
    --color-text: #333333;
    --color-text-sub: #666666;
    --color-text-muted: #999999;
    --color-text-disabled: #CCCCCC;
    --color-table-header-bg: #F7F9FC;
    --color-table-header-text: #555555;
    --color-table-row-hover: #FFF9EE;
    --header-height: 48px;
    --sidebar-width: 180px;
    --radius: 4px;
    --radius-lg: 8px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

/* ============================================================
   Layout
   ============================================================ */
.admin-root {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--color-bg);
}

/* ============================================================
   顶栏
   ============================================================ */
.admin-header {
    height: var(--header-height);
    background: #2c3e50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 200;
}

    .admin-header .header-left {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .admin-header .hamburger {
        display: none;
        background: transparent;
        border: none;
        color: white;
        font-size: 22px;
        cursor: pointer;
        padding: 4px 10px;
        border-radius: 4px;
        user-select: none;
    }

        .admin-header .hamburger:hover {
            background: rgba(255,255,255,0.1);
        }

    .admin-header .logo {
        font-size: 16px;
        font-weight: 600;
        white-space: nowrap;
    }

    .admin-header .user-info {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 14px;
    }

    .admin-header .user-name {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.btn-logout {
    background: transparent;
    color: #ffd7d7;
    border: 1px solid #ffd7d7;
    padding: 5px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

    .btn-logout:hover {
        background: var(--color-danger);
        color: white;
        border-color: var(--color-danger);
    }

/* ============================================================
   Body / 侧边栏 / 内容区
   ============================================================ */
.admin-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* 隐藏的 checkbox（CSS checkbox hack） */
.sb-toggle {
    display: none;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--color-table-header-bg);
    border-right: 1px solid var(--color-border-light);
    padding: 12px 0;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

    .admin-sidebar .nav-item {
        display: block;
        padding: 11px 20px;
        color: #555;
        text-decoration: none;
        font-size: 14px;
        border-left: 3px solid transparent;
        white-space: nowrap;
    }

        .admin-sidebar .nav-item:hover {
            background: var(--color-primary-light);
            color: var(--color-primary);
            text-decoration: none;
        }

        .admin-sidebar .nav-item.active {
            background: var(--color-primary-light);
            color: var(--color-primary);
            font-weight: 600;
            border-left-color: var(--color-primary);
        }

.admin-content {
    flex: 1;
    padding: 24px 32px;
    overflow: auto;
    min-width: 0;
}

/* 遮罩（默认隐藏，仅手机显示） */
.admin-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 90;
    cursor: pointer;
}

/* ============================================================
   通用组件
   ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

    .page-header h1 {
        margin: 0;
        font-size: 22px;
    }

.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 14px;
}

    .card h2 {
        margin: 0 0 14px 0;
        font-size: 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

.btn-primary, .btn-secondary, .btn-danger, .btn-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

    .btn-primary:hover:not(:disabled) {
        background: var(--color-primary-hover);
        border-color: var(--color-primary-hover);
    }

.btn-secondary {
    background: white;
    color: var(--color-text-sub);
    border-color: var(--color-border-input);
}

    .btn-secondary:hover:not(:disabled) {
        background: var(--color-table-header-bg);
    }

.btn-danger {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

    .btn-danger:hover:not(:disabled) {
        background: var(--color-danger-hover);
    }

.btn-mini {
    height: 26px;
    padding: 0 10px;
    font-size: 12px;
    background: white;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

    .btn-mini:hover:not(:disabled) {
        background: var(--color-primary-light);
    }

    .btn-primary:disabled, .btn-secondary:disabled,
    .btn-danger:disabled, .btn-mini:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
    margin-right: 4px;
}

    .icon-btn:hover:not(:disabled) {
        background: var(--color-table-header-bg);
        border-color: var(--color-primary);
    }

    .icon-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

/* ============================================================
   数据表格
   ============================================================ */
.data-table-wrap {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .data-table th {
        background: var(--color-table-header-bg);
        padding: 10px 12px;
        text-align: left;
        border-bottom: 1px solid var(--color-border-light);
        color: var(--color-table-header-text);
        font-weight: 600;
        white-space: nowrap;
    }

        .data-table th.num {
            text-align: right;
        }

    .data-table td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--color-border-light);
        vertical-align: top;
    }

        .data-table td.num {
            text-align: right;
        }

    .data-table tbody tr:hover {
        background: var(--color-table-row-hover);
    }

/* ============================================================
   Badge
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
}

.badge-admin {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-user {
    background: #E4F0FF;
    color: var(--color-primary);
}

.badge-green {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-red {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-blue {
    background: #E4F0FF;
    color: var(--color-primary);
}

.badge-orange {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-gray {
    background: #F0F2F5;
    color: var(--color-text-sub);
}

/* ============================================================
   输入框 / 弹窗
   ============================================================ */
.modal-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border-input);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

    .modal-input:focus {
        border-color: var(--color-primary);
    }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal {
    background: white;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    min-width: 320px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 85vh;
    overflow: auto;
}

.modal-wide {
    max-width: 520px;
}

.modal h3 {
    margin: 0 0 14px 0;
    font-size: 16px;
}

.modal p {
    margin: 0 0 14px 0;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--color-text-sub);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.empty {
    color: var(--color-text-disabled);
    text-align: center;
    padding: 24px 12px;
    font-size: 13px;
}

/* ============================================================
   Tab 栏
   ============================================================ */
.tabs {
    display: flex;
    gap: 2px;
    margin: 0;
    border-bottom: 1px solid var(--color-border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 10px 18px;
    font-size: 14px;
    color: var(--color-text-sub);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    transition: color 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.tab-badge {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: normal;
    margin-left: 2px;
}

.tab:hover {
    color: var(--color-primary);
    background: transparent;
}

.tab.active {
    color: var(--color-primary);
    font-weight: 600;
    border-bottom-color: var(--color-primary);
    background: transparent;
}

.tabs + .card,
.tabs + * > .card {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}

/* ============================================================
   筛选栏（全局）
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 14px 16px;
    background: var(--color-table-header-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

    .filter-bar .filter-item {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

        .filter-bar .filter-item label {
            font-size: 12px;
            color: var(--color-text-sub);
        }

    .filter-bar .filter-input {
        padding: 7px 10px;
        border: 1px solid var(--color-border-input);
        border-radius: var(--radius);
        font-size: 13px;
        font-family: inherit;
        width: 180px;
        outline: none;
        box-sizing: border-box;
        background: white;
    }

        .filter-bar .filter-input:focus {
            border-color: var(--color-primary);
        }

    .filter-bar select.filter-input {
        height: 32px;
        cursor: pointer;
    }

/* ============================================================
   记录数提示条
   ============================================================ */
.data-summary {
    padding: 10px 16px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-sub);
    font-size: 13px;
    margin-bottom: 12px;
}

/* ============================================================
   分页栏
   ============================================================ */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 10px 4px;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-info {
    color: var(--color-text-sub);
    font-size: 13px;
}

.data-pager {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pager-info {
    color: var(--color-text-sub);
    font-size: 13px;
}

/* ============================================================
   设备提示
   ============================================================ */
.device-hint {
    font-size: 12px;
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* ============================================================
   用户详情页专用
   ============================================================ */
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.btn-back {
    background: white;
    color: var(--color-primary);
    border: 1px solid var(--color-border-input);
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}

    .btn-back:hover {
        background: var(--color-table-header-bg);
    }

.username-tag {
    color: var(--color-text-muted);
    font-size: 14px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 32px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

    .info-item.wide {
        grid-column: span 4;
    }

    .info-item label {
        color: var(--color-text-muted);
        font-size: 12px;
    }

    .info-item > span {
        color: var(--color-text);
        font-size: 14px;
        word-break: break-word;
    }

.version-tag {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: normal;
}

.badge-pending {
    background: var(--color-warning-light);
    color: var(--color-warning);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: normal;
}

.settings-meta {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-bottom: 10px;
}

.config-editor {
    width: 100%;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px;
    padding: 12px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    outline: none;
    resize: vertical;
    box-sizing: border-box;
    background: #FAFBFC;
    line-height: 1.5;
}

    .config-editor:focus {
        border-color: var(--color-primary);
        background: white;
    }

.settings-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.force-apply-label {
    color: var(--color-text-sub);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.settings-footer .actions {
    display: flex;
    gap: 10px;
}

.error-text {
    color: var(--color-danger);
    margin-top: 10px;
    font-size: 13px;
}

.success-text {
    color: var(--color-success);
    margin-top: 10px;
    font-size: 13px;
}

/* ============================================================
   响应式：手机 < 768px
   ============================================================ */
@media (max-width: 767px) {

    /* ---- 整体布局 ---- */
    .admin-content {
        padding: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

        .page-header h1 {
            font-size: 18px;
        }

    .card {
        padding: 14px;
    }

        .card h2 {
            font-size: 15px;
        }

    /* ---- 顶栏 ---- */
    .admin-header .hamburger {
        display: inline-flex;
    }

    .admin-header .user-name {
        display: none;
    }

    .admin-header .logo {
        font-size: 15px;
    }

    /* ---- 侧边栏：抽屉模式 ---- */
    .admin-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
        overflow-y: auto;
    }

    .sb-toggle:checked ~ .admin-body .admin-sidebar {
        transform: translateX(0);
    }

    .sb-toggle:checked ~ .admin-body .admin-overlay {
        display: block;
    }

    /* ---- 按钮触屏友好 ---- */
    .btn-primary, .btn-secondary, .btn-danger {
        height: 38px;
        padding: 0 16px;
        font-size: 14px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    /* ---- 弹窗 ---- */
    .modal {
        max-width: 100%;
        min-width: auto;
        padding: 16px;
    }

    .modal-input {
        padding: 10px 12px;
        font-size: 15px;
    }

    /* ---- 表格 → 卡片 ---- */
    .data-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    .responsive-table {
        min-width: auto;
        font-size: 13px;
    }

        .responsive-table thead {
            display: none;
        }

        .responsive-table tbody {
            display: block;
        }

        .responsive-table tr {
            display: block;
            background: white;
            border: 1px solid var(--color-border);
            border-radius: var(--radius);
            margin-bottom: 10px;
            padding: 10px 12px;
        }

        .responsive-table td {
            display: block;
            padding: 4px 0;
            border: none;
            text-align: left !important;
            white-space: normal !important;
        }

            .responsive-table td[data-label]::before {
                content: attr(data-label) "：";
                color: var(--color-text-muted);
                font-size: 12px;
                margin-right: 4px;
            }

            .responsive-table td.actions-cell {
                display: flex;
                flex-wrap: wrap;
                gap: 6px;
                margin-top: 10px;
                padding-top: 10px;
                border-top: 1px dashed var(--color-border-light);
            }

                .responsive-table td.actions-cell .icon-btn {
                    margin-right: 0;
                }

    /* Tab 手机：等宽平分 */
    .tabs {
        gap: 0;
        border-bottom: 1px solid var(--color-border-light);
        overflow: visible;
    }

    .tab {
        flex: 1 1 0;
        min-width: 0;
        padding: 9px 4px;
        font-size: 12.5px;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tab-badge {
        display: none;
    }

    /* ---- 筛选栏：竖排 ---- */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

        .filter-bar .filter-item {
            width: 100%;
        }

        .filter-bar .filter-input {
            width: 100%;
        }

        .filter-bar button {
            width: 100%;
        }

    /* ---- 记录数 + 分页 ---- */
    .data-summary {
        font-size: 12px;
        padding: 8px 12px;
    }

    .data-pager {
        justify-content: center;
    }

    /* ---- 设备提示：手机完整换行 ---- */
    .device-hint {
        max-width: 100%;
        white-space: normal;
        word-break: break-all;
        overflow: visible;
    }

    /* ---- 用户详情页 ---- */
    .header-left {
        width: 100%;
    }

        .header-left h1 {
            font-size: 18px;
            flex: 1;
            min-width: 0;
        }

    .page-header .header-right {
        width: 100%;
    }

        .page-header .header-right button {
            width: 100%;
        }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .info-item.wide {
        grid-column: span 1;
    }

    .config-editor {
        font-size: 11.5px;
        padding: 10px;
    }

    .settings-footer {
        flex-direction: column;
        align-items: stretch;
    }

        .settings-footer .force-apply-label {
            margin-bottom: 8px;
        }

        .settings-footer .actions {
            width: 100%;
        }

            .settings-footer .actions button {
                flex: 1;
            }
}

/* ============================================================
   字段速查折叠面板
   ============================================================ */
.ref-panel {
    background: var(--color-table-header-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

    .ref-panel > summary {
        padding: 10px 14px;
        cursor: pointer;
        font-size: 13px;
        color: var(--color-primary);
        user-select: none;
        list-style: none;
        font-weight: 600;
    }

        .ref-panel > summary::-webkit-details-marker {
            display: none;
        }

        .ref-panel > summary::before {
            content: "▶";
            display: inline-block;
            transition: transform 0.15s;
            font-size: 10px;
            margin-right: 8px;
            vertical-align: middle;
        }

    .ref-panel[open] > summary::before {
        transform: rotate(90deg);
    }

    .ref-panel > summary:hover {
        background: var(--color-primary-light);
    }

.ref-content {
    padding: 4px 14px 14px 14px;
    border-top: 1px solid var(--color-border-light);
    max-height: 500px;
    overflow-y: auto;
}

.ref-group {
    margin-top: 14px;
}

    .ref-group h4 {
        margin: 0 0 8px 0;
        font-size: 13px;
        color: var(--color-text);
        padding-bottom: 4px;
        border-bottom: 1px solid var(--color-border-light);
        font-weight: 600;
    }

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

    .ref-table th {
        text-align: left;
        padding: 6px 8px;
        color: var(--color-text-muted);
        font-weight: 600;
        font-size: 11px;
        border-bottom: 1px solid var(--color-border-light);
    }

    .ref-table td {
        padding: 6px 8px;
        border-bottom: 1px solid #F5F7FA;
        vertical-align: top;
        word-break: break-word;
    }

        .ref-table td code {
            background: #FFF9EE;
            color: #B66A00;
            padding: 1px 5px;
            border-radius: 3px;
            font-family: Consolas, "Courier New", monospace;
            font-size: 11.5px;
            white-space: nowrap;
        }

        .ref-table td:last-child {
            color: var(--color-text-muted);
            white-space: nowrap;
            font-size: 11.5px;
        }

/* 手机：速查表变卡片 */
@media (max-width: 767px) {
    .ref-content {
        max-height: 420px;
        padding: 4px 10px 10px 10px;
    }

    .ref-table thead {
        display: none;
    }

    .ref-table,
    .ref-table tbody,
    .ref-table tr,
    .ref-table td {
        display: block;
        width: 100%;
    }

        .ref-table tr {
            background: white;
            border: 1px solid var(--color-border-light);
            border-radius: var(--radius);
            padding: 8px 10px;
            margin-bottom: 8px;
        }

        .ref-table td {
            padding: 3px 0;
            border: none;
            text-align: left;
            word-break: break-word;
        }

            .ref-table td:nth-child(1) code {
                display: inline-block;
                background: #FFF9EE;
                color: #B66A00;
                padding: 2px 6px;
                border-radius: 3px;
                font-family: Consolas, "Courier New", monospace;
                font-size: 11.5px;
                white-space: normal;
                word-break: break-all;
            }

            .ref-table td:nth-child(2) {
                color: var(--color-text);
                font-size: 12px;
                margin-top: 4px;
            }

            .ref-table td:nth-child(3) {
                color: var(--color-text-muted);
                font-size: 11.5px;
                margin-top: 2px;
            }

                .ref-table td:nth-child(3)::before {
                    content: "默认：";
                    color: var(--color-text-muted);
                }
}

/* ============================================================
   权限设置弹窗（Feature Dialog）
   ============================================================ */
.feature-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--color-border-light);
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: #FAFBFC;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    font-size: 13px;
    color: var(--color-text-sub);
}

    .feature-item:hover {
        background: var(--color-primary-light);
        border-color: var(--color-primary);
    }

    .feature-item.on {
        background: var(--color-primary-light);
        border-color: var(--color-primary);
        color: var(--color-primary);
        font-weight: 600;
    }

    .feature-item input[type="checkbox"] {
        flex-shrink: 0;
        margin: 0;
        width: 16px;
        height: 16px;
        cursor: pointer;
    }

@media (max-width: 360px) {
    .feature-list {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   可排序表头
   ============================================================ */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, background 0.15s;
}

    .data-table th.sortable:hover {
        color: var(--color-primary);
        background: var(--color-primary-light);
    }

    .data-table th.sortable::after {
        content: "⇅";
        display: inline-block;
        margin-left: 6px;
        font-size: 11px;
        color: var(--color-text-disabled);
        opacity: 0.7;
        vertical-align: middle;
    }

    .data-table th.sortable.asc::after {
        content: "▲";
        color: var(--color-primary);
        opacity: 1;
    }

    .data-table th.sortable.desc::after {
        content: "▼";
        color: var(--color-primary);
        opacity: 1;
    }

/* ============================================================
   排序工具条（移动端专用，桌面端用表头点击）
   ============================================================ */
.sort-bar-mobile {
    display: none;
}

.sort-select {
    padding: 7px 10px;
    border: 1px solid var(--color-border-input);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: var(--color-text);
    outline: none;
    cursor: pointer;
}

    .sort-select:focus {
        border-color: var(--color-primary);
    }

@media (max-width: 767px) {
    .sort-bar-mobile {
        display: flex;
        gap: 8px;
        align-items: center;
        margin-bottom: 12px;
        flex-wrap: wrap;
    }

        .sort-bar-mobile .sort-select {
            flex: 1 1 120px;
            height: 36px;
        }

        .sort-bar-mobile .sort-dir-btn {
            height: 36px;
            padding: 0 14px;
            font-size: 13px;
        }
}