/* app/static/css/app.css */

/* Weiers CRM 全局样式 */

body {
    background-color: #f8f9fa;
    padding-top: 56px;
    /* 避开固定顶部栏 */
}

/* ---------- 顶部栏 ---------- */
.topbar {
    height: 56px;
    background: #ffffff;
    border-bottom: 1px solid #dee2e6;
    z-index: 1030;
}

.topbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    color: #212529;
    text-decoration: none;
}

.topbar-brand:hover {
    color: #0d6efd;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    background: #ffffff;
}

@media (min-width: 992px) {
    .sidebar.offcanvas-lg {
        position: fixed;
        top: 56px;
        bottom: 0;
        left: 0;
        width: 220px;
        overflow-y: auto;
        border-right: 1px solid #dee2e6;
        visibility: visible;
        transform: none;
        z-index: 1020;
    }

    .content-area {
        margin-left: 220px;
    }
}

.sidebar .nav-link {
    color: #212529;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

.sidebar .nav-link:hover {
    background-color: #e9ecef;
}

.sidebar .nav-group>button {
    color: #495057;
}

.sidebar .nav-link.active {
    color: #ffffff !important;
}


/* ---------- 响应式表格：≤768px 卡片化 ---------- */
@media (max-width: 767.98px) {
    .table-card-mobile {
        border-collapse: separate;
        border-spacing: 0;
    }

    .table-card-mobile thead {
        display: none;
    }

    .table-card-mobile tbody,
    .table-card-mobile tr,
    .table-card-mobile td {
        display: block;
        width: 100%;
    }

    .table-card-mobile tr {
        margin-bottom: .75rem;
        border: 1px solid #dee2e6;
        border-radius: .5rem;
        padding: .5rem .75rem;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    }

    .table-card-mobile td {
        border: 0;
        padding: .3rem 0;
        text-align: left !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: .75rem;
    }

    .table-card-mobile td::before {
        content: attr(data-label);
        font-weight: 500;
        color: #6c757d;
        flex-shrink: 0;
        font-size: .875rem;
    }

    /* 无 data-label 的 td（如操作列）不显示前缀 */
    .table-card-mobile td:not([data-label])::before,
    .table-card-mobile td[data-label=""]::before {
        content: none;
    }

    /* 操作列：按钮铺满，触屏友好 */
    .table-card-mobile td.table-actions {
        display: flex;
        justify-content: flex-end;
        gap: .5rem;
        padding-top: .5rem;
        margin-top: .25rem;
        border-top: 1px dashed #dee2e6;
    }

    .table-card-mobile td.table-actions .btn {
        flex: 1;
        margin: 0;
    }

    /* 空数据行（colspan）：去掉卡片样式，居中 */
    .table-card-mobile tr:has(td[colspan]) {
        border: 0;
        padding: 0;
        box-shadow: none;
    }

    .table-card-mobile tr:has(td[colspan]) td {
        display: block;
        text-align: center !important;
        padding: 2rem 0;
    }

    .table-card-mobile tr:has(td[colspan]) td::before {
        content: none;
    }
}