/* ===== 三级分销佣金系统 - 浅色高端样式 ===== */
:root {
    --bg-primary: #f5f3ef;
    --bg-secondary: #edeae4;
    --bg-card: #ffffff;
    --border: #e8e4dc;
    --text-primary: #1a1a1a;
    --text-secondary: #5c5c5c;
    --text-muted: #999;
    --gold: #c9952e;
    --gold-light: #e8b84b;
    --gold-dark: #a07820;
    --accent-1: linear-gradient(135deg, #e8a830, #d4891a);
    --accent-2: linear-gradient(135deg, #0ea882, #2ccb6e);
    --accent-3: linear-gradient(135deg, #3d8bfd, #00c4e6);
    --accent-4: linear-gradient(135deg, #8b6fc0, #e8a0d0);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow: 0 4px 24px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.1);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 背景装饰 */
.bg-particles {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-particles::before {
    content: '';
    position: absolute;
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(200,160,60,0.06) 0%, transparent 70%);
    top: -250px; right: -200px;
    animation: float1 20s ease-in-out infinite;
}
.bg-particles::after {
    content: '';
    position: absolute;
    width: 550px; height: 550px;
    background: radial-gradient(circle, rgba(60,140,220,0.04) 0%, transparent 70%);
    bottom: -180px; left: -150px;
    animation: float2 25s ease-in-out infinite;
}
@keyframes float1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-50px, 80px) scale(1.2); }
}
@keyframes float2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, -60px) scale(1.3); }
}

/* 布局 */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    box-shadow: 1px 0 20px rgba(0,0,0,0.03);
}
.sidebar-brand {
    padding: 28px 24px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
    font-size: 20px; font-weight: 700;
    background: var(--accent-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}
.sidebar-brand .subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.sidebar-nav .nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 16px 12px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
}
.nav-item:hover {
    background: #f8f6f1;
    color: var(--text-primary);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(200,150,50,0.1), rgba(200,150,50,0.05));
    color: var(--gold-dark);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--accent-1);
    border-radius: 0 3px 3px 0;
}
.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 36px;
    min-height: 100vh;
}

/* 顶部栏 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}
.page-title span {
    background: var(--accent-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.page-breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    position: fixed;
    top: 16px; right: 16px;
    z-index: 200;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.card:hover {
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.card-title .icon-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    background: var(--accent-1);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}
.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
}
.stat-card .stat-glow {
    position: absolute;
    top: -30px; right: -30px;
    width: 120px; height: 120px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.12;
    pointer-events: none;
}

/* 表格 */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
thead th {
    text-align: left;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 2px solid #eee;
    white-space: nowrap;
    background: #fafaf8;
}
tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f2f0eb;
    white-space: nowrap;
}
tbody tr {
    transition: background var(--transition);
}
tbody tr:hover {
    background: #fbfaf6;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.badge-l1 { background: #fef3e0; color: #c07810; }
.badge-l2 { background: #e5f2ff; color: #2b7bd6; }
.badge-l3 { background: #f0eafa; color: #7b5ea7; }
.badge-success { background: #e0faf0; color: #1a9c5e; }
.badge-warning { background: #fef3e0; color: #c07810; }

/* 金额样式 */
.amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'JetBrains Mono', 'Consolas', monospace;
}
.amount-positive { color: #1a9c5e; }
.amount-zero { color: #ccc; }

/* 表单 */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    background: #fafaf8;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(200,150,50,0.1);
    background: #fff;
}
.form-input::placeholder { color: #c0c0c0; }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23999'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-select option { background: #fff; color: var(--text-primary); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: 0.3px;
}
.btn-primary {
    background: var(--accent-1);
    color: #fff;
    box-shadow: 0 4px 16px rgba(200,150,50,0.25);
}
.btn-secondary {
    background: #f5f3ef;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-danger {
    background: #fff;
    color: #d94a4a;
    border: 1px solid #fcc;
}
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.btn-primary:hover {
    box-shadow: 0 8px 28px rgba(200,150,50,0.35);
}
.btn:active { transform: translateY(0); }

/* 图表区域 */
.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.chart-bar-label {
    min-width: 90px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}
.chart-bar-track {
    flex: 1;
    height: 28px;
    background: #f0ede6;
    border-radius: 50px;
    overflow: hidden;
    position: relative;
}
.chart-bar-fill {
    height: 100%;
    border-radius: 50px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding-left: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    min-width: fit-content;
}
.chart-bar-value {
    width: 100px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'SF Mono', 'JetBrains Mono', 'Consolas', monospace;
    flex-shrink: 0;
    color: var(--text-primary);
}

/* 饼图 (CSS) */
.pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    box-shadow: var(--shadow);
}
.pie-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
}
.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.pie-legend-dot {
    width: 10px; height: 10px;
    border-radius: 3px;
}

/* Toast */
.toast {
    position: fixed;
    top: 24px; right: 24px;
    z-index: 999;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.35s ease;
    box-shadow: var(--shadow-lg);
}
.toast-success {
    background: #e6f9f0;
    border: 1px solid #b8ecd0;
    color: #1a7a4c;
}
.toast-error {
    background: #fef0f0;
    border: 1px solid #fcc;
    color: #c0392b;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #ccc;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 40px rgba(0,0,0,0.1);
    }
    .main-content {
        margin-left: 0;
        padding: 24px 16px;
    }
    .menu-toggle {
        display: flex;
    }
    .topbar {
        margin-top: 16px;
        padding-right: 52px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .page-title {
        font-size: 22px;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .main-content {
        padding: 12px 10px;
    }
    .card {
        padding: 14px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-card .stat-value {
        font-size: 24px;
    }
    .stat-card .stat-icon {
        width: 36px; height: 36px;
        font-size: 16px;
        border-radius: 10px;
    }
    .topbar {
        padding-right: 44px;
        margin-bottom: 20px;
    }
    .page-title {
        font-size: 18px;
    }
    .page-breadcrumb {
        font-size: 11px;
    }
    .chart-bar-label {
        min-width: 40px;
        font-size: 10px;
    }
    .chart-bar-value {
        width: 55px;
        font-size: 10px;
    }
    .chart-bar-track {
        height: 22px;
    }
    tbody td, thead th {
        padding: 10px 8px;
        font-size: 12px;
    }
    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }
    .btn-sm {
        padding: 6px 12px;
        font-size: 11px;
    }
    .modal {
        padding: 20px;
    }
    .modal-title {
        font-size: 18px;
    }
    .pie-chart {
        width: 150px; height: 150px;
    }
    .sidebar {
        width: 240px;
    }
    .sidebar-brand {
        padding: 20px 16px;
    }
    .sidebar-brand .logo {
        font-size: 18px;
    }
    .menu-toggle {
        top: 28px; right: 10px;
        width: 38px; height: 38px;
        border-radius: 10px;
        font-size: 18px;
    }
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.2);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* 百分比进度条渐变 */
.bar-l1 { background: linear-gradient(135deg, #e8a830, #d4891a); }
.bar-l2 { background: linear-gradient(135deg, #3d8bfd, #00c4e6); }
.bar-l3 { background: linear-gradient(135deg, #8b6fc0, #e8a0d0); }

/* 数字等宽 */
.num-counter {
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'JetBrains Mono', 'Consolas', monospace;
}

/* 提示文字 */
.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 多列网格容器 - 自动响应式 */
.grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}
.grid-3col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* 可点击行 */
tr.clickable {
    cursor: pointer;
}
tr.clickable:hover {
    background: #fdfaf2;
}

/* 输入框 range 滑块美化 */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e8e4dc;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--gold);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 分隔线 */
hr {
    border: none;
    border-top: 1px solid var(--border);
}

/* 配置卡片高亮边框 */
.config-preview-card {
    border-left: 3px solid var(--gold);
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background: #fafaf8;
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.page-btn:hover {
    background: var(--bg-card);
    border-color: var(--gold);
    color: var(--gold-dark);
}
.page-active {
    background: var(--accent-1);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(200,150,50,0.25);
}
.page-active:hover {
    background: var(--accent-1);
    color: #fff;
    border-color: transparent;
}
.page-ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
}
.page-info {
    margin-left: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* 可搜索下拉框 */
.searchable-select {
    position: relative;
}
.searchable-input {
    cursor: pointer;
}
.searchable-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 50;
    margin-top: 4px;
}
.searchable-dropdown.active {
    display: block;
}
.searchable-option {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    background: #fff;
    transition: background var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.searchable-option:hover,
.searchable-option.highlight {
    background: #f8f6f1;
}
.searchable-option .opt-name {
    font-weight: 500;
    color: var(--text-primary);
}
.searchable-option .opt-parent {
    font-size: 12px;
    color: var(--text-muted);
}
.searchable-option .opt-id {
    font-size: 11px;
    color: #ccc;
}
.searchable-no-result {
    padding: 16px;
    text-align: center;
    color: #ccc;
    font-size: 13px;
}
