/**
 * 组件样式
 */

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
    user-select: none;
    position: relative;
    overflow: hidden;
    font-family: var(--font-body);
    letter-spacing: 0.02em;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

/* 主按钮 — 鎏金质感 */
.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(166, 124, 82, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(166, 124, 82, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    box-shadow: 0 1px 4px rgba(166, 124, 82, 0.3),
                inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 描边按钮 — 金边效果 */
.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-300);
    color: var(--primary-700);
    font-weight: 600;
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary-500);
    color: var(--primary-600);
    background-color: var(--primary-50);
    box-shadow: 0 2px 8px rgba(166, 124, 82, 0.15);
}

/* 危险按钮 */
.btn-danger {
    background: linear-gradient(135deg, #d4623a 0%, #c23a2b 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(194, 58, 43, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: none;
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(194, 58, 43, 0.4);
    transform: translateY(-1px);
}

/* 幽灵按钮 */
.btn-ghost {
    background-color: transparent;
    color: var(--text-muted);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--primary);
    background-color: var(--primary-50);
}

/* 成功按钮 */
.btn-success {
    background: linear-gradient(135deg, #7eb899 0%, #5a8a72 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(90, 138, 114, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: none;
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(90, 138, 114, 0.4);
    transform: translateY(-1px);
}

/* 信息按钮 */
.btn-info {
    background: linear-gradient(135deg, #7a9ab4 0%, #5b7fa3 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(91, 127, 163, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: none;
}

.btn-info:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(91, 127, 163, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-icon {
    padding: var(--space-sm);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
    padding: var(--space-xs);
}

.btn-icon.btn-lg {
    width: 48px;
    height: 48px;
    padding: var(--space-md);
}

/* 按钮组 */
.btn-group {
    display: inline-flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.btn-group .btn {
    border-radius: 0;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.btn-group .btn:last-child {
    border-right: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* 印章风格按钮 */
.btn-seal {
    background: var(--accent-cinnabar);
    color: #fff;
    font-family: var(--font-title);
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 4px;
    transform: rotate(-2deg);
    box-shadow: 2px 2px 8px rgba(194, 58, 43, 0.3);
}

.btn-seal:hover:not(:disabled) {
    transform: rotate(0deg) scale(1.05);
    box-shadow: 4px 4px 12px rgba(194, 58, 43, 0.4);
}

/* 文字按钮 */
.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    padding: var(--space-xs) var(--space-sm);
    font-weight: 500;
}

.btn-text:hover:not(:disabled) {
    color: var(--primary-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ========== 卡片 ========== */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
    transition: all var(--transition-normal);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-300);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-gradient-vertical);
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: var(--space-lg);
    right: var(--space-lg);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-300), transparent);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-title);
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.card-body {
    padding: var(--space-lg);
    position: relative;
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
    background-color: var(--surface-alt);
    position: relative;
}

.card-footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: var(--space-lg);
    right: var(--space-lg);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-300), transparent);
}

/* 卡片变体 — 金边卡片 */
.card-gold {
    border: 2px solid transparent;
    background: 
        linear-gradient(var(--surface), var(--surface)) padding-box,
        var(--primary-gradient) border-box;
    box-shadow: 0 4px 20px rgba(166, 124, 82, 0.15);
}

.card-gold::before {
    opacity: 1;
}

/* 卡片变体 — 宣纸卡片 */
.card-paper {
    background: var(--surface-warm);
    border-color: var(--primary-200);
    box-shadow: 
        0 2px 8px rgba(166, 124, 82, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.card-paper .card-header {
    background: var(--primary-gradient-soft);
    border-bottom-color: var(--primary-200);
}

/* 卡片变体 — 悬浮感卡片 */
.card-elevated {
    box-shadow: var(--shadow-lg);
    border: none;
    background: var(--surface);
}

.card-elevated:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

/* 卡片角标装饰 */
.card-corner-ribbon {
    position: absolute;
    top: 12px;
    right: -32px;
    transform: rotate(45deg);
    background: var(--primary-gradient);
    color: white;
    padding: 4px 40px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 统计卡片增强 */
.card-stat {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.card-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
}

.card-stat-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient-soft);
    border-radius: var(--radius-md);
}

.card-stat-content {
    flex: 1;
}

.card-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    font-family: var(--font-title);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-highlight {
    border: 2px solid transparent;
    background: 
        linear-gradient(var(--surface), var(--surface)) padding-box,
        var(--primary-gradient) border-box;
    box-shadow: 0 4px 20px rgba(166, 124, 82, 0.2);
}

.card-highlight::before {
    opacity: 1;
}

/* ========== 输入框 ========== */
.input, .select, .textarea {
    width: 100%;
    padding: 10px var(--space-md);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--surface);
    color: var(--text);
    transition: all var(--transition-fast);
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.input:hover, .select:hover, .textarea:hover {
    border-color: var(--primary-300);
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-100),
                0 2px 8px rgba(166, 124, 82, 0.1);
    background-color: var(--surface);
}

.input:disabled {
    background-color: var(--surface-alt);
    opacity: 0.6;
    cursor: not-allowed;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-hint);
    font-style: normal;
}

/* 输入组 — 带前后缀 */
.input-group {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--surface);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.input-group:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-100),
                0 2px 8px rgba(166, 124, 82, 0.1);
}

.input-group:hover {
    border-color: var(--primary-300);
}

.input-group .input {
    border: none;
    border-radius: 0;
    background: transparent;
    flex: 1;
    min-width: 0;
}

.input-group .input:focus {
    box-shadow: none;
}

.input-group .input-prefix,
.input-group .input-suffix {
    display: flex;
    align-items: center;
    padding: 0 var(--space-md);
    background-color: var(--surface-alt);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    border-right: 1px solid var(--border);
    min-height: 42px;
}

.input-group .input-suffix {
    border-right: none;
    border-left: 1px solid var(--border);
}

/* 表单组 */
.form-group {
    margin-bottom: var(--space-md);
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-family: var(--font-title);
    letter-spacing: 0.02em;
}

.form-group label .required {
    color: var(--accent-cinnabar);
    margin-left: 2px;
    font-weight: 700;
}

.form-group .form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.form-group.has-error .input,
.form-group.has-error .select,
.form-group.has-error .textarea,
.form-group.has-error .input-group {
    border-color: var(--danger);
    background-color: var(--danger-light);
}

.form-group.has-error .input:focus,
.form-group.has-error .select:focus,
.form-group.has-error .textarea:focus,
.form-group.has-error .input-group:focus-within {
    box-shadow: 0 0 0 4px rgba(180, 84, 77, 0.15);
}

.form-group .form-error {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-group.has-success .input,
.form-group.has-success .select,
.form-group.has-success .textarea {
    border-color: var(--success);
}

/* 标签页增强 */
.tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-lg);
    position: relative;
}

.tabs::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-300), transparent);
    pointer-events: none;
}

.tab {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    font-family: var(--font-title);
    letter-spacing: 0.02em;
}

.tab:hover {
    color: var(--text);
    background-color: var(--primary-50);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp var(--transition-normal) ease-out;
}

/* 徽章增强 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.02em;
    font-family: var(--font-body);
}

.badge-primary { 
    background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
    color: var(--primary-700);
}

.badge-success { 
    background: linear-gradient(135deg, #e6f0e9 0%, #d4e5da 100%);
    color: var(--success);
}

.badge-warning { 
    background: linear-gradient(135deg, #faf0dc 0%, #f5e4c0 100%);
    color: var(--warning);
}

.badge-danger { 
    background: linear-gradient(135deg, #f6e4e2 0%, #f0d0cd 100%);
    color: var(--danger);
}

.badge-info { 
    background: linear-gradient(135deg, #e2ebf2 0%, #cddbe6 100%);
    color: var(--info);
}

.badge-muted { 
    background-color: var(--surface-alt); 
    color: var(--text-muted); 
}

.badge-gold {
    background: var(--gold-gradient);
    color: var(--gold-900);
    font-weight: 700;
}

/* 表格增强 */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: var(--primary-gradient-vertical);
}

.data-table th {
    padding: 12px var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--primary-200);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
    font-family: var(--font-title);
    letter-spacing: 0.02em;
}

.data-table td {
    padding: 10px var(--space-md);
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    transition: background-color var(--transition-fast);
}

.data-table tbody tr {
    transition: all var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--primary-50);
}

.data-table tbody tr.selected {
    background-color: var(--primary-100);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 表格斑马纹 */
.data-table.zebra tbody tr:nth-child(even) {
    background-color: var(--surface-alt);
}

.data-table.zebra tbody tr:hover {
    background-color: var(--primary-50);
}

/* ========== 表格 ========== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background-color: var(--surface-alt);
}

.data-table th {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tbody tr:hover {
    background-color: var(--surface-alt);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 768px) {
    .table-wrap.mobile-table {
        border: none;
        border-radius: 0;
    }

    .table-wrap.mobile-table .data-table thead {
        display: none;
    }

    .table-wrap.mobile-table .data-table,
    .table-wrap.mobile-table .data-table tbody,
    .table-wrap.mobile-table .data-table tr,
    .table-wrap.mobile-table .data-table td {
        display: block;
        width: 100%;
    }

    .table-wrap.mobile-table .data-table tr {
        margin-bottom: var(--space-md);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: var(--space-md);
        background-color: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .table-wrap.mobile-table .data-table td {
        border-bottom: 1px dashed var(--border);
        padding: var(--space-sm) 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .table-wrap.mobile-table .data-table td:last-child {
        border-bottom: none;
    }

    .table-wrap.mobile-table .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.8rem;
        flex-shrink: 0;
        margin-right: var(--space-md);
        min-width: 80px;
    }

    .table-wrap.mobile-table .data-table td .btn-group,
    .table-wrap.mobile-table .data-table td .flex {
        justify-content: flex-end;
    }

    .table-wrap.mobile-table .data-table .badge {
        margin-left: auto;
    }

    /* 手机端表格：会员价等嵌套内容纵向排列 */
    .table-wrap.mobile-table .data-table td > div > div {
        text-align: right;
    }

    /* 手机端表格：操作按钮区 */
    .table-wrap.mobile-table .data-table td .flex.gap-xs {
        gap: var(--space-xs);
    }

    .table-wrap.mobile-table .data-table td .btn-icon.btn-sm {
        width: 32px;
        height: 32px;
        min-height: 32px;
        font-size: 0.75rem;
    }

    /* 手机端表格：售价列的会员价缩小 */
    .table-wrap.mobile-table .data-table td .text-sm.text-muted {
        font-size: 0.75rem;
    }
}

/* 可编辑单元格 */
.cell-editable {
    cursor: text;
    border-radius: var(--radius-sm);
    padding: 2px var(--space-sm);
    transition: background-color var(--transition-fast);
}

.cell-editable:hover {
    background-color: var(--surface-alt);
}

.cell-editable.editing {
    background-color: var(--bg);
    box-shadow: inset 0 0 0 2px var(--primary);
}

/* ========== 徽章 ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
}

.badge-primary { background-color: rgba(139, 94, 60, 0.15); color: var(--primary); }
.badge-success { background-color: rgba(74, 124, 89, 0.15); color: var(--success); }
.badge-warning { background-color: rgba(201, 123, 42, 0.15); color: var(--warning); }
.badge-danger  { background-color: rgba(169, 68, 66, 0.15); color: var(--danger); }
.badge-info    { background-color: rgba(58, 107, 138, 0.15); color: var(--info); }
.badge-muted   { background-color: var(--surface-alt); color: var(--text-muted); }

/* ========== 提示框 ========== */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    font-size: 0.9rem;
}

.alert-success { background-color: rgba(74, 124, 89, 0.1); border: 1px solid rgba(74, 124, 89, 0.3); }
.alert-warning { background-color: rgba(201, 123, 42, 0.1); border: 1px solid rgba(201, 123, 42, 0.3); }
.alert-danger  { background-color: rgba(169, 68, 66, 0.1); border: 1px solid rgba(169, 68, 66, 0.3); }
.alert-info    { background-color: rgba(58, 107, 138, 0.1); border: 1px solid rgba(58, 107, 138, 0.3); }

/* ========== Toast 通知 ========== */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    animation: toast-in var(--transition-normal);
}

.toast.removing {
    animation: toast-out var(--transition-normal) forwards;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-danger  { border-left: 4px solid var(--danger); }
.toast-info    { border-left: 4px solid var(--info); }

@keyframes toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

/* ========== 模态框 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: fade-in var(--transition-fast);
}

.modal {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modal-in var(--transition-normal);
}

.modal-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modal-in {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ========== 骨架屏 ========== */
.skeleton {
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== 统计卡片 ========== */
.card-stat {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
}

.card-stat-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.card-stat-content {
    flex: 1;
}

.card-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.card-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-highlight {
    border: 2px solid var(--primary);
}

/* ========== 表单组 ========== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

/* ========== 输入组 ========== */
.input-group {
    display: flex;
    gap: 4px;
}

.input-group .input {
    flex: 1;
}

/* ========== 复选框 ========== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ========== 图例 ========== */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-light, rgba(0,0,0,0.04));
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    background: var(--surface-alt);
    border-radius: 20px;
    transition: background 0.2s;
}

.legend-item:hover {
    background: var(--primary-50, #faf6f0);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8);
}

.legend-label {
    color: var(--text-secondary);
    white-space: nowrap;
}

.legend-value {
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ========== AI 定价建议 ========== */
.ai-score-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--primary-50, #faf6f0) 0%, var(--surface) 100%);
    border-radius: var(--radius-md);
}

@media (max-width: 768px) {
    .ai-score-wrap {
        flex-direction: column;
        text-align: center;
    }
}

.ai-score-ring {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-score-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ai-score-ring .ai-score-svg circle {
    transition: stroke-dashoffset 0.8s ease;
}

.ai-score-healthy { color: #22c55e; }
.ai-score-attention { color: #f59e0b; }
.ai-score-critical { color: #ef4444; }

.ai-score-num {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Songti SC', serif;
    z-index: 1;
}

.ai-score-info {
    flex: 1;
}

.ai-score-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.ai-score-max {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.ai-score-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.ai-badge-healthy { background: rgba(34,197,94,0.12); color: #16a34a; }
.ai-badge-attention { background: rgba(245,158,11,0.12); color: #d97706; }
.ai-badge-critical { background: rgba(239,68,68,0.12); color: #dc2626; }

.ai-score-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-stat-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 2px 0 8px;
}

.ai-dot-healthy { background: #22c55e; }
.ai-dot-attention { background: #f59e0b; }
.ai-dot-critical { background: #ef4444; }

.ai-alert-card {
    margin-bottom: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}

.ai-alert-healthy { border-left: 3px solid #22c55e; }
.ai-alert-attention { border-left: 3px solid #f59e0b; }
.ai-alert-critical { border-left: 3px solid #ef4444; }

.ai-alert-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.ai-alert-score {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.ai-alert-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.ai-alert-msg {
    color: var(--text-secondary);
}

.ai-alert-tip {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    padding-left: 10px;
    border-left: 2px solid var(--border, #e0d6c8);
}

.ai-recommend {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, var(--primary-50, #faf6f0) 0%, var(--surface-alt) 100%);
    border-radius: var(--radius-sm);
}

.ai-recommend-title {
    margin-bottom: var(--space-sm);
    font-size: 1rem;
}

.ai-recommend-item {
    font-size: 0.85rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== 图表响应式 ========== */
.chart-canvas {
    display: block;
    width: 100%;
    height: 260px;
}

@media (max-width: 768px) {
    .chart-canvas {
        height: 220px;
    }
}

/* ========== 表格行选中 ========== */
.data-table tr.selected {
    background-color: rgba(139, 94, 60, 0.08);
}

.data-table tr:hover {
    background-color: var(--surface-alt);
}

/* ========== 表格底栏 ========== */
.table-footer {
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========== 分隔线 ========== */
.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-lg) 0;
}

/* ========== 工具类补全 ========== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-2xl { font-size: 1.5rem; }
.font-bold { font-weight: 700; }
.rounded { border-radius: var(--radius-md); }
.bg-muted { background-color: var(--surface-alt); }

.w-full { width: 100%; }
.gap-xs { gap: 4px; }

.p-xs { padding: 4px; }
.p-sm { padding: var(--space-sm); }
.p-lg { padding: var(--space-lg); }
.mt-xs { margin-top: 4px; }

.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.skeleton-line {
    height: 14px;
    margin-bottom: var(--space-sm);
}

.skeleton-line:last-child {
    width: 60%;
}

/* ========== 空状态 ========== */
.empty-state {
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.95rem;
    margin-bottom: var(--space-md);
}

/* ========== 进度条 ========== */
.progress {
    width: 100%;
    height: 8px;
    background-color: var(--surface-alt);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.progress-bar-success { background-color: var(--success); }
.progress-bar-warning { background-color: var(--warning); }
.progress-bar-danger  { background-color: var(--danger); }

/* ========== 开关 ========== */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background-color: var(--border);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    cursor: pointer;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.switch input:checked + .switch-slider {
    background-color: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

/* ========== 新手引导 ========== */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fade-in var(--transition-fast);
}

.onboarding-overlay.fade-out {
    animation: fade-out var(--transition-fast) forwards;
}

.onboarding-highlight {
    position: fixed;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 4px var(--primary), 0 0 0 9999px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 10001;
    transition: all var(--transition-normal);
}

.onboarding-tooltip {
    position: fixed;
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-lg);
    max-width: 360px;
    width: calc(100vw - 32px);
    z-index: 10002;
    animation: modal-in var(--transition-normal);
}

.onboarding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.onboarding-step {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.onboarding-skip {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.onboarding-skip:hover {
    color: var(--text);
    background-color: var(--surface-alt);
}

.onboarding-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

.onboarding-content {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.onboarding-actions {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.onboarding-actions .btn {
    min-height: 40px;
    padding: var(--space-sm) var(--space-md);
}

.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border);
    transition: background-color var(--transition-fast);
}

.onboarding-dot.active {
    background-color: var(--primary);
    width: 20px;
    border-radius: var(--radius-full);
}

.onboarding-dot.completed {
    background-color: var(--primary-light);
}

@keyframes fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@media (max-width: 768px) {
    .onboarding-tooltip {
        max-width: none;
        width: calc(100vw - 32px);
        left: 50% !important;
        right: auto;
        transform: translateX(-50%);
    }

    .onboarding-highlight {
        border-radius: var(--radius-md);
    }
}

/* ========== 标签页 ========== */
.tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-lg);
}

.tab {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fade-in var(--transition-normal);
}

/* ========== 折叠面板 ========== */
.collapse {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    overflow: hidden;
}

.collapse-header {
    padding: var(--space-md) var(--space-lg);
    background-color: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-fast);
}

.collapse-header:hover {
    background-color: var(--bg);
}

.collapse-arrow {
    transition: transform var(--transition-fast);
}

.collapse.expanded .collapse-arrow {
    transform: rotate(90deg);
}

.collapse-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.collapse.expanded .collapse-body {
    max-height: 2000px;
    padding: var(--space-lg);
}

/* ========== 说明书 ========== */
.manual-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-lg);
    align-items: start;
}

.manual-toc {
    position: sticky;
    top: var(--space-md);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.manual-toc-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-dark);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-sm);
}

.manual-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.manual-toc-list li {
    margin-bottom: 2px;
}

.manual-toc-list a {
    display: block;
    padding: 6px 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.manual-toc-list a:hover {
    background-color: var(--bg);
    color: var(--text);
    border-left-color: var(--primary-light);
}

.manual-content {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    min-width: 0;
}

.manual-section {
    padding: var(--space-lg) 0;
    border-bottom: 1px dashed var(--border);
    scroll-margin-top: 80px;
}

.manual-section:last-of-type {
    border-bottom: none;
}

.manual-h2 {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--primary-dark);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--primary-light);
    display: inline-block;
}

.manual-h3 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-md);
}

.manual-feature {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background-color: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.manual-feature-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.manual-feature strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
}

.manual-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.manual-step {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background-color: var(--surface-alt);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.manual-step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.manual-step-body h3 {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.manual-product-card {
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
}

.manual-product-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.manual-product-card h3 {
    font-family: var(--font-title);
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.manual-product-card ul {
    text-align: left;
    list-style: none;
    padding: 0;
    margin-top: var(--space-sm);
}

.manual-product-card ul li {
    padding: 4px 0;
    border-bottom: 1px dashed var(--border);
}

.manual-product-card ul li:last-child {
    border-bottom: none;
}

.manual-product-card code {
    font-size: 0.8rem;
    background-color: var(--surface);
    padding: 2px 6px;
    border-radius: 3px;
}

.manual-formula {
    background-color: var(--surface-alt);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.manual-formula h3 {
    font-family: var(--font-title);
    color: var(--primary-dark);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.manual-formula-code {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow-x: auto;
    margin: var(--space-sm) 0;
    line-height: 1.6;
}

.manual-tip {
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg);
    border-left: 3px solid var(--info);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
    font-size: 0.9rem;
}

.manual-tip strong {
    color: var(--primary-dark);
    margin-right: 4px;
}

.manual-faq {
    background-color: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.manual-faq[open] {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(139, 94, 60, 0.08);
}

.manual-faq summary {
    padding: var(--space-md);
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    background-color: var(--surface);
    list-style: none;
    position: relative;
    padding-right: 40px;
}

.manual-faq summary::-webkit-details-marker {
    display: none;
}

.manual-faq summary::after {
    content: '▸';
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    transition: transform var(--transition-fast);
}

.manual-faq[open] summary::after {
    transform: translateY(-50%) rotate(90deg);
}

.manual-faq p {
    padding: 0 var(--space-md) var(--space-md);
    color: var(--text);
    line-height: 1.7;
}

.manual-faq code {
    font-size: 0.85em;
    background-color: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--primary-dark);
}

.manual-ol, .manual-ul {
    padding-left: var(--space-lg);
    line-height: 1.8;
}

.manual-ol li, .manual-ul li {
    margin-bottom: var(--space-xs);
}

.manual-footer {
    margin-top: var(--space-xl);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    text-align: center;
}

/* 打印样式 */
@media print {
    .app-header, .manual-toc, .page-header .flex, .btn {
        display: none !important;
    }
    .manual-layout {
        grid-template-columns: 1fr;
    }
    .manual-content {
        border: none;
        padding: 0;
    }
    .manual-section {
        page-break-inside: avoid;
    }
    .manual-h2 {
        color: #000;
        border-bottom-color: #000;
    }
}

/* 移动端：说明书目录改为顶部折叠 */
@media (max-width: 768px) {
    .manual-layout {
        grid-template-columns: 1fr;
    }

    .manual-toc {
        position: static;
        max-height: none;
    }

    .manual-toc-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }

    .manual-toc-list a {
        font-size: 0.8rem;
        padding: 4px 6px;
    }

    .manual-content {
        padding: var(--space-md);
    }

    .manual-h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .manual-toc-list {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   工作台 — 分层定价公式展示
   ============================================================ */

.tiered-formula-overview {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
    border-radius: 12px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--primary-200);
}

.formula-overview-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.formula-overview-icon {
    font-size: 1.3em;
}

.formula-overview-desc {
    font-size: 0.9rem;
    color: var(--primary-800);
    line-height: 1.6;
    font-weight: 500;
}

.formula-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-md);
}

.formula-mini-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: var(--space-md);
    transition: all 0.25s ease;
}

.formula-mini-card:hover {
    border-color: var(--primary-300);
    box-shadow: 0 4px 12px rgba(166, 124, 82, 0.12);
    transform: translateY(-2px);
}

.formula-mini-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.formula-mini-icon {
    font-size: 1.2em;
}

.formula-mini-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.formula-mini-formula {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 10px;
    font-family: var(--font-mono);
    background: var(--surface-alt);
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 2px solid var(--primary);
}

.formula-mini-tiers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tier-tag {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.tier-drain {
    background: #ecfdf5;
    color: #047857;
}

.tier-push1 {
    background: #eff6ff;
    color: #1d4ed8;
}

.tier-push2 {
    background: #fef3c7;
    color: #b45309;
}

.tier-profit {
    background: #fdf2f8;
    color: #be185d;
}

.tier-crystal1 {
    background: #f0f9ff;
    color: #0369a1;
}

.tier-crystal2 {
    background: #f0fdf4;
    color: #15803d;
}

.tier-crystal3 {
    background: #fffbeb;
    color: #b45309;
}

.tier-crystal4 {
    background: #faf5ff;
    color: #7c3aed;
}

.tier-accessory1 {
    background: #fef2f2;
    color: #b91c1c;
}

.tier-accessory2 {
    background: #ecfdf5;
    color: #047857;
}

.tier-accessory3 {
    background: #eff6ff;
    color: #1d4ed8;
}

.tier-accessory-note {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.tier-combine {
    background: var(--primary-50);
    color: var(--primary-700);
}

.formula-tip {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: #fffbeb;
    border-radius: 8px;
    border: 1px solid #fde68a;
    font-size: 0.85rem;
    color: #78350f;
}

.formula-tip-icon {
    font-size: 1.1em;
    flex-shrink: 0;
}

/* ============================================================
   公式参数配置区 — 精细化样式
   ============================================================ */

/* 公式区块 */
.formula-block {
    margin-bottom: var(--space-md);
}

.formula-block summary {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.formula-icon {
    font-size: 1.2em;
    line-height: 1;
}

.formula-block-body {
    padding: var(--space-md);
}

/* 公式说明卡 */
.formula-explain {
    background: var(--surface-alt);
    border-radius: 8px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border-left: 3px solid var(--primary);
}

.formula-explain-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: 6px;
    align-items: baseline;
}

.formula-explain-row:last-child {
    margin-bottom: 0;
}

.formula-explain-label {
    flex-shrink: 0;
    min-width: 48px;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 0.85rem;
}

.formula-explain-row code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--primary-dark);
    display: inline-block;
}

/* 小节标题 */
.formula-section-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-md);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.formula-section-title:first-child {
    margin-top: 0;
}

/* 参数单元格 */
.param-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.param-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.param-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    transition: border-color 0.2s;
}

.param-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.param-input-wrap .input {
    border: none;
    border-radius: 0;
    flex: 1;
}

.param-prefix,
.param-suffix {
    padding: 0 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--surface-alt);
    font-weight: 600;
    user-select: none;
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.param-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-top: 2px;
}

/* 配置区底部操作栏 */
.formula-config-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 2px dashed var(--border);
}

/* ============================================================
   自定义公式 — 模板选择样式
   ============================================================ */

/* 已有公式列表 */
.custom-formula-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-alt);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.custom-formula-item:hover {
    border-color: var(--primary-light);
}

.custom-formula-info {
    flex: 1;
}

/* 模板卡片网格 */
.formula-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}

.formula-template-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
    position: relative;
}

.formula-template-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.formula-template-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.formula-template-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.formula-template-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text);
}

.formula-template-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 8px;
}

.formula-template-example {
    font-size: 0.75rem;
    color: var(--primary-dark);
    background: var(--surface-alt);
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    line-height: 1.3;
}

/* grid-4 */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

@media (max-width: 768px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .formula-template-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== 经营阶段预设按钮 ========== */
.btn-preset {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-title);
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text);
    min-width: 110px;
}

.btn-preset:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-preset .preset-icon {
    font-size: 1.1rem;
}

.btn-preset .preset-name {
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
}

.btn-preset .preset-desc {
    font-size: 0.68rem;
    opacity: 0.7;
}

.btn-preset-startup {
    border-color: #5c9ee7;
    color: #2c5aa0;
}

.btn-preset-startup:hover {
    background-color: #e8f0fe;
    border-color: #2c5aa0;
}

.btn-preset-growth {
    border-color: #f5a623;
    color: #c47d1a;
}

.btn-preset-growth:hover {
    background-color: #fff9e6;
    border-color: #c47d1a;
}

.btn-preset-brand {
    border-color: #8b5e3c;
    color: #5c3d28;
}

.btn-preset-brand:hover {
    background-color: #fdf6ed;
    border-color: #5c3d28;
}

@media (max-width: 768px) {
    .btn-preset {
        min-width: 80px;
        padding: 6px 10px;
    }

    .btn-preset .preset-name {
        font-size: 0.75rem;
    }

    .btn-preset .preset-desc {
        font-size: 0.62rem;
    }
}

/* ===== 产品列表排序 ===== */
.sort-control { flex-wrap: nowrap; }

.col-drag { width: 32px; text-align: center; }
.sort-handle {
    cursor: grab;
    color: var(--text-muted);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    display: inline-block;
    padding: 2px 4px;
}
.sort-handle:active { cursor: grabbing; }

tr.dragging { opacity: .5; background: var(--surface-hover); }
tr.drag-over td { box-shadow: inset 0 2px 0 0 var(--primary); }

.product-card-move { display: flex; gap: 4px; align-items: center; }
.product-card-move .btn { line-height: 1; }

.opacity-40 { opacity: .4; }

.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== 产品列表分页 ===== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.btn-pagination {
    min-width: 32px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all .15s ease;
}
.btn-pagination:hover:not(:disabled):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-pagination.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}
.btn-pagination:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 2px;
}
@media (max-width: 768px) {
    .pagination-bar {
        justify-content: center;
    }
}
