/* ============================================================
   SuperQuant — Apple-inspired Design System
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Noto Sans CJK SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body.no-page-scroll { overflow: hidden; }

/* --- 导航栏 (Frosted Glass) --- */
.topnav {
    position: sticky; top: 0; z-index: 500;
    display: flex; align-items: center; gap: 24px;
    background: rgba(29,29,31,0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    color: #f5f5f7; padding: 0 32px; height: 48px;
}
.topnav .logo {
    color: #f5f5f7; text-decoration: none; font-size: 17px; font-weight: 700;
    letter-spacing: -0.3px;
}
.nav-links a {
    color: rgba(245,245,247,0.8); text-decoration: none; font-size: 13px;
    font-weight: 500; transition: color 0.25s ease;
}
.nav-links a:hover { color: #fff; }
.nav-search { margin-left: auto; }
.nav-search input {
    padding: 6px 16px; border: none; border-radius: 20px;
    width: 200px; font-size: 13px;
    background: rgba(255,255,255,0.15); color: #f5f5f7;
    outline: none; transition: all 0.25s ease;
}
.nav-search input::placeholder { color: rgba(245,245,247,0.5); }
.nav-search input:focus {
    background: rgba(255,255,255,0.25); width: 260px;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.3);
}

/* --- 容器 --- */
.container { max-width: 1120px; margin: 0 auto; padding: 32px 24px; }

/* --- 首页 Hero --- */
.hero { text-align: center; padding: 80px 0 48px; }
.hero h1 {
    font-size: 48px; font-weight: 700; letter-spacing: -0.5px;
    color: #1d1d1f; margin-bottom: 8px;
}
.hero p { color: #86868b; font-size: 18px; margin-bottom: 32px; font-weight: 400; }
.search-box {
    display: flex; justify-content: center; gap: 10px;
    max-width: 580px; margin: 0 auto;
}
.search-box input {
    flex: 1; padding: 14px 24px; border: none; border-radius: 28px;
    font-size: 16px; background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    outline: none; transition: all 0.25s ease;
    color: #1d1d1f;
}
.search-box input:focus {
    box-shadow: 0 2px 16px rgba(0,113,227,0.15), 0 0 0 3px rgba(0,113,227,0.2);
}
.search-box input::placeholder { color: #86868b; }
.search-box button, .compare-form button, .screen-form button {
    padding: 12px 28px; background: #0071e3; color: #fff; border: none;
    border-radius: 28px; cursor: pointer; font-size: 15px; font-weight: 600;
    transition: all 0.25s ease; letter-spacing: -0.2px;
}
.search-box button:hover, .compare-form button:hover, .screen-form button:hover {
    background: #0077ed; transform: scale(1.02);
}

/* --- Quick Section & Chips --- */
.quick-section { margin-top: 40px; }
.quick-section h3 {
    margin-bottom: 14px; color: #1d1d1f; font-size: 20px; font-weight: 600;
    letter-spacing: -0.2px;
}
.compare-form { display: flex; gap: 10px; }
.compare-form input {
    flex: 1; padding: 12px 20px; border: none; border-radius: 24px;
    font-size: 14px; background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    outline: none; transition: all 0.25s ease;
}
.compare-form input:focus {
    box-shadow: 0 2px 12px rgba(0,113,227,0.12), 0 0 0 3px rgba(0,113,227,0.15);
}

.stock-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
    display: inline-block; padding: 10px 20px; background: #fff; border: none;
    border-radius: 24px; text-decoration: none; color: #1d1d1f;
    font-size: 14px; font-weight: 500;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: all 0.25s ease;
}
.chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    color: #0071e3;
}

/* --- 筛选页面 --- */
.screen-form {
    background: #fff; padding: 24px 28px; border-radius: 16px; margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.form-row label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #1d1d1f; }
.form-row input, .form-row select {
    padding: 8px 14px; border: 1px solid #d2d2d7; border-radius: 12px;
    font-size: 13px; width: 90px; background: #fff; outline: none;
    transition: border-color 0.2s ease;
}
.form-row input:focus, .form-row select:focus { border-color: #0071e3; }
.form-row select { width: 160px; }

.result-count { margin-bottom: 14px; color: #86868b; font-size: 14px; }

.data-table {
    width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px;
    overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.06); font-size: 13px;
}
.data-table th {
    background: #fafafa; padding: 12px 16px; text-align: left;
    font-weight: 600; border-bottom: 1px solid #e8e8ed; color: #86868b; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.data-table td { padding: 10px 16px; border-bottom: 1px solid #f2f2f7; }
.data-table tr:hover { background: #f5f5f7; }
.data-table a { color: #0071e3; text-decoration: none; font-weight: 500; }

.error-msg {
    background: #fff3cd; color: #856404; padding: 14px 20px;
    border-radius: 12px; margin-bottom: 20px; font-size: 14px;
}

/* --- Segment Control (Sheet Tabs) --- */
.sheet-tabs-bar {
    position: sticky; top: 48px; z-index: 400;
    background: #f5f5f7;
    margin: -32px -24px 12px;
    padding: 32px 24px 10px;
}
.sheet-tabs {
    display: inline-flex; gap: 4px;
    background: rgba(0,0,0,0.06); border-radius: 12px;
    padding: 3px;
}
.sheet-tab {
    padding: 8px 20px; font-size: 13px; color: #1d1d1f; cursor: pointer;
    border-radius: 10px; font-weight: 500; white-space: nowrap;
    transition: all 0.25s ease; border: none; background: transparent;
}
.sheet-tab:hover { color: #0071e3; }
.sheet-tab.active {
    background: #fff; color: #1d1d1f; font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1), 0 0 0 0.5px rgba(0,0,0,0.04);
}

/* --- Tab Panel --- */
.tab-panel { }

/* --- 模块卡片 --- */
.btn-panel { display: flex; flex-direction: column; gap: 20px; }
.module-card {
    background: #fff; border: none; border-radius: 16px;
    padding: 24px 24px 18px; position: relative;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: box-shadow 0.25s ease;
}
.module-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.module-title {
    position: static; background: none; padding: 0;
    font-size: 13px; color: #86868b; font-weight: 600;
    margin-bottom: 14px; letter-spacing: 0.3px; text-transform: uppercase;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ind-btn {
    padding: 10px 22px; background: #f5f5f7; border: none; border-radius: 20px;
    font-size: 14px; color: #1d1d1f; cursor: pointer; font-weight: 500;
    transition: all 0.25s ease;
}
.ind-btn:hover {
    background: #e8e8ed; transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.ind-btn:active { transform: translateY(0); }
.ind-btn-add {
    padding: 10px 16px; font-size: 18px; font-weight: 400; color: #0071e3;
    background: #f0f1ff; border-radius: 20px; line-height: 1;
}
.ind-btn-add:hover {
    background: #e0e2ff; transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,113,227,0.15);
}
.ind-btn-special {
    background: #0071e3; color: #fff; font-weight: 600;
}
.ind-btn-special:hover {
    background: #0077ed; color: #fff;
    box-shadow: 0 4px 12px rgba(0,113,227,0.3);
}

/* --- 弹窗 --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex; justify-content: center; align-items: center;
}
.modal-layer2 { z-index: 1100; background: rgba(0,0,0,0.4); }
.modal-box {
    background: #fff; border-radius: 20px; padding: 28px;
    width: 90%; max-width: 840px; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modal-fadein 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-box-wide { max-width: 1020px; }
@keyframes modal-fadein {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 32px; height: 32px; border-radius: 50%;
    background: #f5f5f7; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #86868b; line-height: 1; z-index: 10;
    transition: all 0.2s ease;
}
.modal-close:hover { background: #e8e8ed; color: #1d1d1f; }

/* --- 报表工具栏 --- */
.stmt-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0; gap: 16px; flex-wrap: wrap;
    position: sticky; top: 92px; z-index: 100;
    background: #f5f5f7; padding: 10px 0 8px;
}
.stmt-controls {
    display: flex; gap: 12px; align-items: center; flex-shrink: 0;
}
.stmt-controls label {
    font-size: 13px; color: #86868b; display: flex; align-items: center; gap: 6px;
    font-weight: 500;
}
.stmt-controls select {
    padding: 6px 12px; border: 1px solid #d2d2d7; border-radius: 10px;
    font-size: 13px; background: #fff; cursor: pointer; outline: none;
    color: #1d1d1f; font-weight: 500;
    transition: border-color 0.2s ease;
}
.stmt-controls select:focus { border-color: #0071e3; }

/* --- 报表子标签 (Mini Segment) --- */
.stmt-tabs {
    display: inline-flex; gap: 3px;
    background: rgba(0,0,0,0.06); border-radius: 10px;
    padding: 3px; border: none;
}
.stmt-tab {
    padding: 6px 16px; font-size: 13px; color: #1d1d1f; cursor: pointer;
    border: none; border-radius: 8px; font-weight: 500;
    background: transparent; transition: all 0.25s ease;
}
.stmt-tab:hover { color: #0071e3; }
.stmt-tab.active {
    background: #fff; color: #1d1d1f; font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 0 0 0.5px rgba(0,0,0,0.04);
    margin-bottom: 0;
    border-color: transparent;
}

/* --- 报表表格 --- */
.stmt-table-wrap {
    overflow: auto; position: relative; border-radius: 12px;
    background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-top: 8px;
    height: calc(100vh - 170px);
    overscroll-behavior: contain;
}

.stmt-table {
    border-collapse: separate; border-spacing: 0;
    background: #fff; font-size: 13px; min-width: 100%;
}
.stmt-table th {
    background: #fafafa; padding: 10px 16px; text-align: right;
    font-weight: 600; border-bottom: 1px solid #e8e8ed; white-space: nowrap;
    color: #86868b; font-size: 12px;
    position: sticky; top: 0; z-index: 4;
}
.stmt-table th.stmt-label-col {
    text-align: left; min-width: 240px; color: #86868b;
}
.stmt-table td {
    padding: 9px 16px; text-align: right;
    border-bottom: 1px solid #f2f2f7; white-space: nowrap;
    transition: background 0.15s ease;
}
.stmt-table td:first-child { text-align: left; white-space: normal; }

/* 固定第一列 */
.stmt-table th:first-child,
.stmt-table td:first-child {
    position: sticky; left: 0; z-index: 2;
    background: #fff;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}
.stmt-table th:first-child { background: #fafafa; z-index: 5; }

/* 报表行级别 */
.stmt-section td {
    background: #f5f5f7; font-weight: 600; color: #1d1d1f;
    font-size: 13px;
}
.stmt-section td:first-child { padding-left: 12px; background: #f5f5f7; }
.stmt-item td:first-child { padding-left: 28px; }
.stmt-subtotal td { font-weight: 600; border-top: 1px solid #d2d2d7; }
.stmt-subtotal td:first-child { padding-left: 16px; }
.stmt-total td {
    font-weight: 700; border-top: 1.5px solid #86868b;
    background: #fafafa; color: #1d1d1f;
}
.stmt-total td:first-child { padding-left: 8px; background: #fafafa; }

/* sticky 列 — 行级别背景 */
.stmt-section td:first-child { background: #f5f5f7; }
.stmt-subtotal td:first-child { background: #fff; }
.stmt-total td:first-child { background: #fafafa; }

/* 负数 */
.stmt-negative { color: #ff3b30; }

/* 可点击行 */
.stmt-table tbody tr.stmt-clickable { cursor: pointer; }
.stmt-table tbody tr.stmt-clickable:hover td { background: #f0f1ff; }
.stmt-table tbody tr.stmt-clickable:hover td:first-child { background: #f0f1ff; }

/* 普通 hover */
.stmt-table tbody tr:hover td { background: #f5f5f7; }
.stmt-table tbody tr:hover td:first-child { background: #f5f5f7; }

/* --- 杜邦树 --- */
.dp-legend { display: flex; gap: 16px; margin-bottom: 20px; align-items: center; }
.dp-legend-item { display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 500; }
.dp-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dp-legend-hint { margin-left: auto; font-size: 12px; color: #86868b; }

.dp-tree { padding: 12px 0 30px; }
.dp-level { display: flex; justify-content: center; }
.dp-vline { width: 2px; height: 20px; background: #d2d2d7; margin: 0 auto; }

.dp-node {
    display: inline-block; text-align: center; border-radius: 10px;
    font-size: 13px; font-weight: 500; transition: all 0.25s ease;
    white-space: nowrap;
}
.dp-clickable { cursor: pointer; }
.dp-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,113,227,0.2); }

.dp-l1 {
    background: #0071e3; color: #fff; padding: 14px 32px;
    font-size: 16px; font-weight: 600; border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0,113,227,0.25);
}
.dp-l1:hover { background: #0077ed; }
.dp-l1 small { font-weight: 400; opacity: 0.85; }

.dp-l2 {
    background: #fff; border: 2px solid #0071e3; color: #0071e3;
    padding: 10px 22px; font-weight: 600;
}
.dp-l2:hover { background: #f0f1ff; }

.dp-l3 {
    background: #fff; border: 2px solid #34c759; color: #1d1d1f;
    padding: 8px 16px; font-size: 12px;
}
.dp-l3:hover { background: #f0faf0; border-color: #28a745; }

.dp-l4 {
    background: #f5f5f7; border: 1px solid #e8e8ed; color: #555;
    padding: 6px 12px; font-size: 12px; border-radius: 8px;
}
.dp-l4:hover { background: #f0f1ff; border-color: #0071e3; color: #0071e3; }

/* 分支布局 */
.dp-branch { width: 100%; }
.dp-branch-items { display: flex; justify-content: center; align-items: flex-start; }
.dp-branch-3 .dp-branch-items { gap: 0; }
.dp-branch-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.dp-branch-op { width: 30px; text-align: center; font-size: 16px; color: #aeaeb2; font-weight: bold; padding-top: 8px; flex-shrink: 0; }

.dp-hline-group { position: relative; height: 20px; margin-bottom: 0; }
.dp-hline { position: absolute; top: 0; left: 20%; right: 20%; height: 2px; background: #d2d2d7; }
.dp-hline-group::before,
.dp-hline-group::after,
.dp-hline-group .dp-hline::before {
    content: ''; position: absolute; width: 2px; height: 20px; background: #d2d2d7;
}
.dp-hline-group::before { left: 20%; top: 0; }
.dp-hline-group::after { right: 20%; top: 0; }
.dp-hline-group .dp-hline::before { left: 50%; top: -20px; height: 20px; }
.dp-hline-group .dp-hline::after { content: ''; position: absolute; left: 50%; top: 0; width: 2px; height: 0; }

.dp-pair { display: flex; align-items: center; gap: 6px; }
.dp-pair-op { font-size: 14px; color: #aeaeb2; font-weight: bold; }
.dp-sublabel { font-size: 11px; color: #86868b; margin-bottom: 6px; }
.dp-leaf-row { display: flex; gap: 6px; margin-bottom: 6px; justify-content: center; flex-wrap: wrap; }

/* --- 股票页面（保留兼容） --- */
.stock-header { margin-bottom: 20px; }
.stock-header h1 { font-size: 24px; display: inline; font-weight: 700; }
.stock-header .code { color: #86868b; font-weight: normal; font-size: 18px; }
.industry-tag {
    display: inline-block; margin-left: 12px; padding: 4px 12px;
    background: #f0f1ff; color: #0071e3; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.stock-actions { margin-top: 10px; }
.stock-actions a { color: #0071e3; text-decoration: none; font-size: 13px; font-weight: 500; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card {
    background: #fff; border-radius: 16px; padding: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.layer-title {
    font-size: 17px; color: #1d1d1f; margin: 32px 0 14px;
    font-weight: 600; letter-spacing: -0.2px;
}

/* --- 响应式 --- */
@media (max-width: 768px) {
    .topnav { padding: 0 16px; gap: 12px; }
    .nav-search input { width: 140px; }
    .nav-search input:focus { width: 180px; }
    .hero h1 { font-size: 32px; }
    .hero p { font-size: 16px; }
    .search-box input { padding: 12px 18px; font-size: 15px; }
    .container { padding: 20px 14px; }
    .charts-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .stmt-table { font-size: 12px; }
    .stmt-table th.stmt-label-col { min-width: 160px; }
    .stmt-table td, .stmt-table th { padding: 6px 10px; }
    .sheet-tabs { border-radius: 10px; }
    .sheet-tab { padding: 6px 14px; font-size: 12px; }
    .module-card { padding: 20px 16px 14px; border-radius: 12px; }
    .ind-btn { padding: 8px 16px; font-size: 13px; }
    .stmt-toolbar { flex-direction: column; align-items: flex-start; }
}
