/* ==================== Anthropic 品牌色彩变量 ==================== */
:root {
    --bg-primary: #faf9f5;
    --bg-card: #ffffff;
    --text-primary: #141413;
    --text-secondary: #b0aea5;
    --accent-orange: #d97757;
    --accent-blue: #6a9bcc;
    --accent-green: #788c5d;
    --border-light: #e8e6dc;
    --shadow-soft: 0 4px 20px rgba(20, 20, 19, 0.06);
    --shadow-hover: 0 8px 30px rgba(217, 119, 87, 0.12);
    --sidebar-width: 300px;
    --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Songti SC", STSong, "Noto Serif CJK SC", Georgia, serif;
}

/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    font-family: var(--font-serif);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 选中文本颜色 */
::selection {
    background: rgba(217, 119, 87, 0.2);
    color: var(--text-primary);
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-light);
    padding: 1.5rem 1.2rem;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
    z-index: 10;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
    opacity: 0;
    pointer-events: none;
}

.sidebar-backdrop {
    display: none;
}

.sidebar-toggle {
    position: fixed;
    top: 14px;
    left: calc(var(--sidebar-width) - 46px);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--accent-orange);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 130;
    box-shadow: 0 4px 14px rgba(20, 20, 19, 0.08);
}
.sidebar-toggle:hover {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.sidebar-expand {
    position: fixed;
    top: 14px;
    left: 16px;
    min-width: 96px;
    height: 40px;
    padding: 0 14px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(232, 230, 220, 0.95);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(20, 20, 19, 0.16);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    line-height: 1;
    z-index: 120;
    transition: all 0.2s;
}
.sidebar-expand:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(20, 20, 19, 0.18);
}

/* 侧边栏内容 */
.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.05em;
    border-left: 3px solid var(--accent-orange);
    padding-left: 0.8rem;
    margin-bottom: 1rem;
    font-family: var(--font-sans);
}

/* Details / Summary 折叠 */
.sidebar-details {
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.sidebar-summary {
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    user-select: none;
    transition: background 0.2s;
}
.sidebar-summary:hover {
    background: rgba(217, 119, 87, 0.05);
}
.sidebar-summary::-webkit-details-marker {
    display: none;
}
.sidebar-summary::after {
    content: '▸';
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
}
details[open] > .sidebar-summary::after {
    transform: rotate(90deg);
}

.details-content {
    padding: 0.8rem 1rem;
}

/* 文件上传区 */
.file-upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 14px;
    padding: 1.2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}
.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--accent-orange);
    background: rgba(217, 119, 87, 0.03);
}
.file-upload-area.small {
    padding: 0.6rem;
    border-radius: 10px;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
}
.file-upload-label.small {
    font-size: 0.8rem;
}

.upload-icon {
    font-size: 1.8rem;
}

.upload-hint {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.template-downloads {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.template-downloads.compact {
    margin-top: 0.65rem;
}

.template-download-title {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 500;
}

.template-download-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.btn-template {
    min-height: 34px;
    padding: 0.42rem 0.55rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-template:hover,
.btn-template:focus {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    background: rgba(217, 119, 87, 0.05);
    outline: none;
}

/* 分隔线 */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
    margin: 1rem 0;
}

/* 标题文字 */
.caption {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    font-family: var(--font-sans);
}

/* 按钮 */
.btn-primary {
    background: var(--accent-orange);
    color: white;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.6rem 1.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(217, 119, 87, 0.25);
    font-family: var(--font-sans);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217, 119, 87, 0.35);
    background: #c56646;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 9999px;
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}
.btn-secondary:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.full-width {
    width: 100%;
}

/* 表单元素 */
.form-group {
    margin-bottom: 0.8rem;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: 0.03em;
}

.form-select {
    width: 100%;
    padding: 0.5rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    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 fill='%23b0aea5' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2rem;
}
.form-select:focus {
    border-color: var(--accent-orange);
}

.drill-train-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 800;
}

.drill-train-head strong {
    color: var(--accent-blue);
    font-size: 0.7rem;
    font-weight: 850;
    text-align: right;
}

.dimension-train {
    display: grid;
    gap: 0.42rem;
    margin: 0;
    padding: 0;
}

.dimension-train-car {
    position: relative;
    display: inline-flex;
    width: 100%;
    min-height: 36px;
    cursor: grab;
    align-items: center;
    gap: 0.42rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #faf9f5);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    padding: 0.38rem 0.42rem;
    text-align: left;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.dimension-train-car span {
    display: inline-flex;
    min-width: 32px;
    height: 20px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(116, 113, 104, 0.1);
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 850;
    line-height: 1;
}

.dimension-train-car strong {
    min-width: 0;
    flex: 1;
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 850;
    line-height: 1.2;
}

.dimension-train-car.filtered,
.dimension-train-car.active {
    border-color: rgba(106, 155, 204, 0.42);
    box-shadow: 0 0 0 3px rgba(106, 155, 204, 0.1);
}

.dimension-train-car.filtered span,
.dimension-train-car.active span {
    background: rgba(106, 155, 204, 0.15);
    color: var(--accent-blue);
}

.dimension-train-car.filtered:not(.active) {
    border-color: rgba(120, 140, 93, 0.36);
    box-shadow: 0 0 0 3px rgba(120, 140, 93, 0.08);
}

.dimension-train-car.filtered:not(.active) span {
    background: rgba(120, 140, 93, 0.14);
    color: var(--accent-green);
}

.dimension-train-car.dragging {
    opacity: 0.58;
}

.dimension-train-car.drop-target {
    border-color: rgba(217, 119, 87, 0.62);
    box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.12);
    transform: translateY(-1px);
}

.dimension-train-remove {
    display: inline-flex;
    width: 22px;
    height: 22px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(217, 119, 87, 0.2);
    border-radius: 999px;
    background: rgba(217, 119, 87, 0.07);
    color: var(--accent-orange);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 850;
    line-height: 1;
}

.dimension-train-remove:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

.dimension-train-hint {
    margin: 0.48rem 0 0;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35;
}

.drill-dimension-drawer {
    margin-top: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 0.65rem;
}

.drill-dimension-drawer-title {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 850;
}

.drill-dimension-add-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.drill-dimension-add {
    display: inline-flex;
    min-height: 30px;
    cursor: pointer;
    align-items: center;
    border: 1px solid rgba(106, 155, 204, 0.24);
    border-radius: 999px;
    background: rgba(106, 155, 204, 0.08);
    color: var(--accent-blue);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 750;
    padding: 0.34rem 0.58rem;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.drill-dimension-add:hover {
    border-color: rgba(217, 119, 87, 0.42);
    background: rgba(217, 119, 87, 0.08);
    color: var(--accent-orange);
}

.drill-train-empty {
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    line-height: 1.5;
}

.form-input {
    width: 100%;
    padding: 0.45rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus {
    border-color: var(--accent-orange);
}

/* 多选容器 */
.multiselect-container {
    margin-bottom: 0.65rem;
}

.multiselect-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    font-family: var(--font-sans);
    font-weight: 500;
}

.multiselect-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
    min-height: 28px;
}

.multiselect-chips:empty {
    min-height: 0;
    margin-bottom: 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.1), rgba(106, 155, 204, 0.1));
    border: 1px solid var(--border-light);
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    cursor: default;
}

.chip-remove {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1;
    transition: color 0.15s;
}
.chip-remove:hover {
    color: var(--accent-orange);
}

.multiselect-dropdown {
    width: 100%;
    padding: 0.4rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.multiselect-dropdown:focus {
    border-color: var(--accent-orange);
}

/* 成功/错误消息 */
.msg-success {
    background: rgba(120, 140, 93, 0.1);
    border: 1px solid rgba(120, 140, 93, 0.3);
    border-left: 4px solid var(--accent-green);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.82rem;
    color: var(--accent-green);
    margin: 0.5rem 0;
    font-family: var(--font-sans);
}

.msg-error {
    background: rgba(217, 119, 87, 0.08);
    border: 1px solid rgba(217, 119, 87, 0.3);
    border-left: 4px solid var(--accent-orange);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.82rem;
    color: #c56646;
    margin: 0.5rem 0;
    font-family: var(--font-sans);
}


/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    padding: 1.5rem 2.5rem 2rem;
    overflow-y: auto;
    min-width: 0;
}

/* 标题区域 */
.title-container {
    text-align: center;
    padding: 1.5rem 0;
    position: relative;
    overflow: hidden;
}
.title-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}

.title-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(217, 119, 87, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.title-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.deco-line {
    width: 60px;
    height: 2px;
    border-radius: 1px;
}
.deco-line.left {
    background: linear-gradient(90deg, transparent, var(--accent-orange));
}
.deco-line.right {
    background: linear-gradient(90deg, var(--accent-orange), transparent);
}

.deco-icon {
    font-size: 1.2rem;
    color: var(--accent-orange);
    animation: rotate 8s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.main-header {
    font-size: 3.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-blue) 50%, var(--accent-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    padding: 0.5rem 0;
    letter-spacing: 0.08em;
    font-family: var(--font-sans);
}

.sub-header {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.25em;
    font-weight: 400;
    font-family: var(--font-sans);
}

.title-tags {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.08), rgba(106, 155, 204, 0.08));
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}
.tag:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    background: rgba(217, 119, 87, 0.05);
}

.tag-dot {
    color: var(--border-light);
    font-size: 0.5rem;
}

/* 空状态 */
.empty-state {
    max-width: 800px;
    margin: 2rem auto;
}

.info-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent-blue);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* 使用说明折叠区 */
.usage-details {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.usage-summary {
    padding: 1rem 1.2rem;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    list-style: none;
    user-select: none;
    transition: background 0.2s;
}
.usage-summary:hover {
    background: rgba(217, 119, 87, 0.05);
}
.usage-summary::-webkit-details-marker {
    display: none;
}
.usage-summary::after {
    content: ' ▸';
    color: var(--text-secondary);
    font-size: 0.8rem;
}
details[open] > .usage-summary::after {
    content: ' ▾';
}

.usage-content {
    padding: 1.2rem 1.5rem;
}
.usage-content h3 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.03em;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 1rem;
    margin-top: 1.2rem;
    font-family: var(--font-sans);
    font-size: 1rem;
}
.usage-content h3:first-child {
    margin-top: 0;
}
.usage-content ol {
    padding-left: 1.2rem;
    margin-bottom: 1rem;
}
.usage-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    font-size: 0.9rem;
}

.tip-box {
    background: rgba(106, 155, 204, 0.08);
    border: 1px solid rgba(106, 155, 204, 0.2);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin: 0.8rem 0;
    line-height: 1.5;
}

/* 格式表格 */
.table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
}

.format-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-family: var(--font-sans);
}
.format-table th {
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.12), rgba(106, 155, 204, 0.08));
    padding: 0.6rem 0.8rem;
    text-align: center;
    border: 1px solid var(--border-light);
    font-weight: 600;
    white-space: nowrap;
}
.format-table td {
    padding: 0.5rem 0.8rem;
    text-align: center;
    border: 1px solid var(--border-light);
}
.format-table tr:nth-child(even) {
    background: rgba(250, 249, 245, 0.8);
}


/* ==================== 指标卡片 ==================== */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1.3rem 1.5rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(217, 119, 87, 0.3);
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-sans);
    font-weight: 500;
}

.metric-value {
    color: var(--text-primary);
    font-size: 1.7rem;
    font-weight: 600;
    font-family: var(--font-sans);
}

.metric-delta {
    font-size: 0.88rem;
    font-family: var(--font-sans);
    font-weight: 500;
}
.metric-delta.positive {
    color: var(--accent-green);
}
.metric-delta.negative {
    color: var(--accent-orange);
}


/* ==================== 图表区域 ==================== */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-soft);
}

.chart-section h3 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.03em;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 1rem;
    font-family: var(--font-sans);
    font-size: 1.05rem;
}

.drill-info {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent-blue);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.chart-plot {
    width: 100%;
    min-height: 520px;
}


/* ==================== 数据表格 ==================== */
.data-table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-family: var(--font-sans);
}
.data-table th {
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.15), rgba(106, 155, 204, 0.1));
    color: var(--text-primary);
    padding: 0.7rem 0.8rem;
    text-align: center;
    border: 1px solid var(--border-light);
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.data-table td {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--border-light);
    text-align: right;
    white-space: nowrap;
}
.data-table td:first-child {
    text-align: left;
    font-weight: 500;
}
.data-table tr:nth-child(even) {
    background: rgba(250, 249, 245, 0.8);
}
.data-table tr:hover {
    background: rgba(217, 119, 87, 0.05);
}
.data-table tr.total-row {
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.08), rgba(106, 155, 204, 0.06));
    font-weight: 700;
    border-top: 2px solid var(--border-light);
}
.data-table .val-positive {
    color: var(--accent-green);
}
.data-table .val-negative {
    color: var(--accent-orange);
}


/* ==================== PVM 假设表格 ==================== */
.assumption-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 1rem 0;
    font-family: var(--font-serif);
}
.assumption-table th {
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.15), rgba(106, 155, 204, 0.1));
    color: var(--text-primary);
    padding: 12px 15px;
    text-align: center;
    border: 1px solid var(--border-light);
    font-weight: 600;
    font-family: var(--font-sans);
}
.assumption-table td {
    padding: 10px 15px;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}
.assumption-table tr:nth-child(even) {
    background: rgba(250, 249, 245, 0.8);
}
.assumption-table tr:hover {
    background: rgba(217, 119, 87, 0.08);
}
.assumption-table .product-type {
    font-weight: 600;
    color: var(--accent-orange);
}
.assumption-table .formula {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--text-secondary);
    font-size: 0.82rem;
}
.assumption-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 1rem;
    line-height: 1.5;
}


/* ==================== 图表层级区域 ==================== */
.chart-level-section {
    margin-bottom: 0.5rem;
    overflow-anchor: none;
}

.chart-level-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.chart-level-title {
    font-family: var(--font-sans);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.attribution-view-switch {
    display: inline-flex;
    flex-shrink: 0;
    gap: 0.25rem;
    border: 1px solid rgba(232, 230, 220, 0.92);
    border-radius: 8px;
    background: rgba(250, 249, 245, 0.88);
    padding: 0.25rem;
    font-family: var(--font-sans);
}

.attribution-view-btn {
    min-height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.36rem 0.7rem;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.attribution-view-btn.active {
    background: var(--bg-card);
    color: var(--accent-blue);
    box-shadow: 0 5px 14px rgba(53, 48, 43, 0.08);
}

.attribution-view-btn:hover {
    color: var(--accent-orange);
}

.chart-interaction-guide {
    display: grid;
    gap: 0.45rem;
    margin: 0 0 1.2rem;
    padding: 0.78rem 0.9rem;
    border: 1px solid rgba(106, 155, 204, 0.24);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(106, 155, 204, 0.08), rgba(250, 249, 245, 0.92));
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.82rem;
}

.chart-interaction-title {
    display: block;
    color: var(--accent-blue);
    font-weight: 800;
    line-height: 1.2;
}

.chart-interaction-item {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    line-height: 1.55;
}

.chart-interaction-item::before {
    content: '';
    flex: 0 0 auto;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-orange);
    margin-top: 0.6em;
}

.drill-info-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(106, 155, 204, 0.12), rgba(217, 119, 87, 0.08));
    border: 1px solid rgba(106, 155, 204, 0.3);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    color: var(--accent-blue);
    margin-bottom: 1rem;
    font-family: var(--font-sans);
}

.waterfall-chart-container {
    width: 100%;
    min-height: 520px;
    margin-bottom: 1rem;
    overflow-anchor: none;
}

.waterfall-touch-host {
    display: none;
    margin: -0.25rem 0 1rem;
}

.waterfall-touch-host.visible {
    display: block;
}

.waterfall-touch-host .waterfall-tooltip-card {
    box-shadow: 0 14px 34px rgba(53, 48, 43, 0.1);
    backdrop-filter: none;
}

.waterfall-hover-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 5000;
    width: min(330px, calc(100vw - 24px));
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.16s ease, transform 0.16s ease;
    font-family: var(--font-sans);
}

.waterfall-hover-tooltip.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.waterfall-tooltip-card {
    position: relative;
    overflow: hidden;
    padding: 0.95rem;
    border: 1px solid rgba(232, 230, 220, 0.92);
    border-radius: 12px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(250, 249, 245, 0.96)),
        var(--bg-card);
    box-shadow: 0 24px 60px rgba(53, 48, 43, 0.22), 0 2px 0 rgba(255, 255, 255, 0.72) inset;
    color: var(--text-primary);
    backdrop-filter: blur(16px);
}

.waterfall-tooltip-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-blue), var(--accent-green));
}

.waterfall-tooltip-card.positive::before,
.waterfall-tooltip-card.total::before {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
}

.waterfall-tooltip-card.negative::before {
    background: linear-gradient(90deg, var(--accent-orange), #c56646);
}

.waterfall-tooltip-card.base::before {
    background: linear-gradient(90deg, #b0aea5, var(--accent-blue));
}

.waterfall-tooltip-kicker {
    margin-top: 0.15rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.waterfall-tooltip-title {
    margin-top: 0.2rem;
    color: var(--text-primary);
    font-size: 1.02rem;
    font-weight: 800;
}

.waterfall-tooltip-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.75rem 0;
    padding: 0.68rem 0.75rem;
    border: 1px solid rgba(232, 230, 220, 0.86);
    border-radius: 9px;
    background: rgba(250, 249, 245, 0.84);
}

.waterfall-tooltip-main span {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 700;
}

.waterfall-tooltip-main strong {
    color: var(--text-primary);
    font-size: 1.12rem;
}

.waterfall-tooltip-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.42rem 0.8rem;
    margin-top: 0.72rem;
    font-size: 0.78rem;
}

.waterfall-tooltip-grid span {
    color: var(--text-secondary);
}

.waterfall-tooltip-grid b {
    color: var(--text-primary);
    font-weight: 700;
    text-align: right;
}

.waterfall-effect-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.waterfall-effect-card {
    padding: 0.55rem 0.6rem;
    border: 1px solid rgba(232, 230, 220, 0.86);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.waterfall-effect-card span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
}

.waterfall-effect-card b {
    display: block;
    margin-top: 0.22rem;
    color: var(--text-primary);
    font-size: 0.94rem;
}

.waterfall-effect-card b.positive,
.waterfall-tooltip-grid .positive,
.waterfall-tooltip-main .positive {
    color: var(--accent-green);
}

.waterfall-effect-card b.negative,
.waterfall-tooltip-grid .negative,
.waterfall-tooltip-main .negative {
    color: var(--accent-orange);
}

.waterfall-tooltip-hint {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(232, 230, 220, 0.82);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 700;
}

.waterfall-touch-actions {
    margin-top: 0.8rem;
    padding-top: 0.72rem;
    border-top: 1px solid rgba(232, 230, 220, 0.82);
}

.waterfall-touch-drill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: var(--accent-orange);
    box-shadow: 0 8px 20px rgba(217, 119, 87, 0.22);
    color: #ffffff;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.84rem;
    font-weight: 800;
}

.waterfall-touch-note {
    margin-top: 0.8rem;
    padding: 0.62rem 0.7rem;
    border: 1px solid rgba(106, 155, 204, 0.22);
    border-radius: 8px;
    background: rgba(106, 155, 204, 0.08);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .waterfall-hover-tooltip {
        width: calc(100vw - 28px);
    }

    .waterfall-chart-container {
        min-height: 380px;
    }

    .chart-level-header {
        flex-direction: column;
        gap: 0.65rem;
    }

    .attribution-view-switch {
        width: 100%;
    }

    .attribution-view-btn {
        flex: 1;
        white-space: normal;
    }

    .waterfall-touch-host {
        margin-top: 0;
    }

    .waterfall-touch-host .waterfall-tooltip-card {
        border-radius: 10px;
        padding: 0.85rem;
    }

    .waterfall-hover-tooltip.mobile-mode {
        transform: translateY(6px) scale(0.99);
    }

    .waterfall-hover-tooltip.mobile-mode.visible {
        transform: translateY(0) scale(1);
    }

    .waterfall-tooltip-card {
        border-radius: 10px;
        padding: 0.85rem;
        box-shadow: 0 18px 42px rgba(53, 48, 43, 0.2);
    }

    .waterfall-tooltip-hint {
        color: var(--accent-blue);
    }

    .chart-interaction-guide {
        gap: 0.42rem;
        margin-bottom: 1rem;
        font-size: 0.78rem;
    }
}

.chart-detail-table {
    margin-top: 0;
}

.global-contrib-title {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.75rem;
}


/* ==================== 明细数据表 ==================== */
.detail-table-shell {
    margin: 0.75rem 0 0.25rem;
    position: relative;
}

.detail-table-scroll {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin: 0;
    background: var(--bg-card);
    isolation: isolate;
}

.detail-data-table {
    width: 100%;
    min-width: 1120px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    margin: 0;
    font-family: var(--font-serif);
}

.detail-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 6;
    background: #f4f0e8;
    background-clip: padding-box;
    color: var(--text-primary);
    padding: 0;
    text-align: center;
    border: 1px solid var(--border-light);
    font-weight: 600;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: 0 2px 0 var(--border-light), 0 8px 14px rgba(53, 48, 43, 0.08);
}

.detail-th-inner {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 8px 10px;
}

.detail-th-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-filter-trigger {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.detail-filter-trigger:hover,
.detail-filter-trigger:focus,
.detail-filter-trigger.is-active,
.detail-filter-trigger.is-sorted {
    border-color: rgba(217, 119, 87, 0.35);
    background: rgba(217, 119, 87, 0.09);
    outline: none;
}

.detail-filter-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-secondary);
}

.detail-filter-trigger.is-active .detail-filter-caret,
.detail-filter-trigger.is-sorted .detail-filter-caret {
    border-top-color: var(--accent-orange);
}

.detail-data-table tbody td {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    background: var(--bg-card);
    white-space: nowrap;
}

.detail-data-table thead th:first-child,
.detail-data-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    box-shadow: 2px 0 0 var(--border-light), 8px 0 14px rgba(53, 48, 43, 0.06);
}

.detail-data-table thead th:first-child {
    z-index: 8;
}

.detail-data-table tbody td.num-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-sans);
    font-size: 0.82rem;
}

.detail-data-table tbody td.positive {
    color: var(--accent-green);
    font-weight: 500;
}

.detail-data-table tbody td.negative {
    color: var(--accent-orange);
    font-weight: 500;
}

.detail-data-table tbody tr:nth-child(even) {
    background: rgba(250, 249, 245, 0.8);
}

.detail-data-table tbody tr:nth-child(even) td {
    background: rgba(250, 249, 245, 0.96);
}

.detail-data-table tbody tr:hover {
    background: rgba(217, 119, 87, 0.06);
}

.detail-data-table tbody tr:hover td {
    background: rgba(217, 119, 87, 0.06);
}

.detail-data-table tbody tr.total-row {
    background: linear-gradient(135deg, rgba(106, 155, 204, 0.08), rgba(120, 140, 93, 0.06));
    font-weight: 700;
    border-top: 2px solid var(--border-light);
}

.detail-data-table tbody tr.total-row td {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: #eef5f0;
    font-weight: 700;
    font-family: var(--font-sans);
    box-shadow: 0 -2px 0 var(--border-light), 0 -8px 14px rgba(53, 48, 43, 0.06);
}

.detail-data-table tbody tr.total-row td:first-child {
    z-index: 6;
}

.detail-filter-menu {
    position: fixed;
    z-index: 3000;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-card);
    box-shadow: 0 18px 42px rgba(53, 48, 43, 0.18);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.detail-filter-menu-title {
    margin-bottom: 0.6rem;
    font-size: 0.86rem;
    font-weight: 700;
}

.detail-filter-sort-grid,
.detail-filter-inline-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.detail-filter-sort-grid .wide {
    grid-column: 1 / -1;
}

.detail-filter-divider {
    height: 1px;
    margin: 0.65rem 0;
    background: var(--border-light);
}

.detail-filter-input,
.detail-filter-select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    outline: none;
}

.detail-filter-input {
    padding: 0.45rem 0.6rem;
}

.detail-filter-select {
    padding: 0.45rem 0.6rem;
}

.detail-filter-input:focus,
.detail-filter-select:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.08);
}

.detail-filter-field {
    display: grid;
    gap: 0.5rem;
}

.detail-filter-value-list {
    max-height: 168px;
    overflow: auto;
    margin: 0.55rem 0;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    background: var(--bg-primary);
}

.detail-filter-check-row {
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.55rem;
    border-bottom: 1px solid rgba(226, 222, 211, 0.65);
    font-size: 0.82rem;
    cursor: pointer;
}

.detail-filter-check-row:last-child {
    border-bottom: 0;
}

.detail-filter-check-row:hover {
    background: rgba(217, 119, 87, 0.06);
}

.detail-filter-empty,
.detail-filter-error {
    padding: 0.55rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.detail-filter-error {
    padding: 0;
    color: var(--accent-orange);
}

.detail-filter-footer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-top: 0.7rem;
}

.detail-filter-action {
    min-height: 32px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.detail-filter-action:hover,
.detail-filter-action:focus {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    background: rgba(217, 119, 87, 0.06);
    outline: none;
}

.detail-filter-action.primary {
    border-color: var(--accent-orange);
    background: var(--accent-orange);
    color: #fff;
}


/* ==================== 页脚 ==================== */
.section-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
    margin: 2rem 0;
}

.footer {
    text-align: center;
    padding: 2rem 0;
}

.footer-brand {
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    font-family: var(--font-sans);
}

.footer-sub {
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    font-family: var(--font-sans);
}


/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .main-header {
        font-size: 2.2rem;
    }
    .main-content {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 300px;
    }
    .sidebar {
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        position: fixed;
        left: 0;
        top: 0;
        z-index: 100;
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    .sidebar.collapsed {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 80;
        display: block;
        background: rgba(20, 20, 19, 0.28);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
    .main-content {
        padding: 4rem 1rem 1rem;
    }
    /* 指标卡片 2x2 布局 */
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .metric-card {
        padding: 0.75rem 0.5rem;
    }
    .metric-value {
        font-size: 1.3rem;
    }
    .metric-label {
        font-size: 0.65rem;
    }
    /* 标题区域精简 */
    .main-header {
        font-size: 1.5rem;
        padding: 0.3rem 0;
    }
    .sub-header {
        font-size: 0.7rem;
        letter-spacing: 0.15em;
    }
    .title-container {
        padding: 1rem 0;
    }
    .title-decoration {
        display: none;
    }
    .title-glow {
        display: none;
    }
    .title-tags {
        display: none;
    }
    .sidebar-expand {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    /* 页脚精简 */
    .footer {
        padding: 1rem 0;
    }
    .footer-brand {
        font-size: 0.8rem;
    }
    .footer-sub {
        display: none;
    }
}
