@media (max-width: 768px) {
    .container {
        border-radius: 15px;
    }

    .date-picker {
        padding: 15px 20px;
    }

    .date-selector {
        padding: 0 20px 20px;
    }

    .current-date-display {
        font-size: 16px;
    }

    .date-grid {
        gap: 5px;
    }

    .date-cell {
        padding: 8px 0;
        font-size: 13px;
    }

    .tab {
        padding: 15px 0;
        font-size: 16px;
    }

    .tab-content {
        padding: 20px;
    }

    .button-group {
        gap: 10px;
    }

    .filter-btn {
        padding: 10px 15px;
        font-size: 13px;
        min-width: 120px;
    }

    .query-btn {
        padding: 10px 25px;
        font-size: 15px;
    }

    .card {
        padding: 15px;
    }

    .avatar {
        width: 40px;
        height: 40px;
    }

    /* 修改这里：保持标题和统计信息在同一行 */
    .filter-header {
        flex-direction: row; /* 改为 row 而不是 column */
        align-items: center;
        gap: 10px;
    }

    .stats-info {
        width: auto; /* 改为 auto 而不是 100% */
        justify-content: flex-end; /* 改为右对齐 */
        gap: 8px; /* 减小间隔 */
        flex-wrap: wrap; /* 允许换行 */
        color: #003eff;
        font-weight: bold; /* 加粗文本 */
    }

    .stats-item {
        flex: none; /* 改为不伸缩 */
        justify-content: flex-start;
        text-align: left;
    }

    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
    }

    .stat-item {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-item.total .stat-value {
        font-size: 24px;
    }

    .password-container {
        margin: 20px;
        padding: 25px 20px;
    }

    .password-title {
        font-size: 20px;
    }

    .password-input {
        font-size: 16px; /* 防止iOS缩放 */
    }

    .group-cards {
        grid-template-columns: repeat(4, 1fr); /* 平板3列 */
        gap: 16px;
    }

    .group-title {
        font-size: 18px;
    }

    #agent-cards {
        gap: 32px;
    }


    .collect-btn {
        width: 26px;
        height: 26px;
        font-size: 11px;
        margin-left: 6px;
        margin-right: 6px;
    }

    .remove-collection-btn {
        width: 26px;
        height: 26px;
        font-size: 11px;
        margin-left: 6px;
        margin-right: 6px;
    }

    #clear-search {
        padding: 6px 12px;
        font-size: 12px;
        margin-top: 12px;
    }

    .bt-cards-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .bt-card {
        padding: 14px;
    }

    .bt-table th,
    .bt-table td {
        padding: 8px 8px;
        font-size: 12px;
    }

    .bt-table-sm th,
    .bt-table-sm td {
        padding: 6px 6px;
        font-size: 12px;
    }
}




@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 10px;
    }

    .date-picker {
        padding: 12px 15px;
    }

    .date-selector {
        padding: 0 15px 15px;
    }

    .current-date-display {
        font-size: 15px;
    }

    .date-nav {
        gap: 10px;
    }

    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .current-month {
        font-size: 14px;
    }

    .date-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .day-header {
        font-size: 12px;
        padding: 6px 0;
    }

    .date-cell {
        padding: 6px 0;
        font-size: 12px;
    }

    .tab {
        padding: 12px 0;
        font-size: 15px;
    }

    .tab-content {
        padding: 15px;
    }

    .filter-title {
        font-size: 16px;
    }

    .button-group {
        gap: 8px;
    }

    .filter-btn {
        min-width: 100%;
        padding: 12px;
    }

    .query-btn {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
    }

    .card {
        padding: 12px;
    }

    .card-header {
        margin-bottom: 10px;
    }

    .avatar {
        width: 36px;
        height: 36px;
        margin-right: 10px;
    }

    .user-info h3 {
        font-size: 16px;
    }

    .user-info p {
        font-size: 13px;
    }

    .card-content {
        font-size: 14px;
    }

    .ai-detail-scores {
        /*grid-template-columns: 1fr;*/
        gap: 6px;
        padding: 10px;
    }

    .score-item {
        font-size: 13px;
        padding: 3px 4px;
        width: auto;
        min-width: 120px;
    }

    .score-item .score-label {
        font-size: 13px;
        margin-right: 8px;
    }

    .score-item .score-value {
        font-size: 14px;
    }
    .review-content {
        padding: 10px;
    }

    .review-title {
        font-size: 13px;
    }

    .review-text {
        font-size: 13px;
    }

    .header-right {
        gap: 8px; /* 移动端间隔稍小 */
    }

    /* 修改这里：在更小的屏幕上调整布局 */
    .filter-header {
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }

    .stats-info {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 12px; /* 减小字体大小 */
        color: #003eff;
        font-weight: bold; /* 加粗文本 */
    }

    .stats-item {
        flex: 0 0 auto; /* 不伸缩，自动宽度 */
        justify-content: flex-start;
        white-space: nowrap; /* 防止文字换行 */
    }

    .stats-label,
    .stats-value {
        font-size: 12px; /* 减小字体大小 */
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stats-section {
        padding: 15px;
    }


    .password-container {
        margin: 15px;
        padding: 20px 15px;
    }

    .password-title {
        font-size: 18px;
    }

    .button-group {
        gap: 8px;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .filter-btn {
        flex: 0 0 calc(50% - 4px);
        padding: 10px 8px;
        font-size: 12px;
        min-width: auto;
        text-align: center;
        margin-bottom: 8px;
    }

    body {
        padding: 10px;
    }

    .container {
        border-radius: 10px;
    }

    .date-picker {
        padding: 12px 15px;
    }

    .date-selector {
        padding: 0 15px 15px;
    }

    .current-date-display {
        font-size: 15px;
    }

    .date-nav {
        gap: 10px;
    }

    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .current-month {
        font-size: 14px;
    }

    .date-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .day-header {
        font-size: 12px;
        padding: 6px 0;
    }

    .date-cell {
        padding: 6px 0;
        font-size: 12px;
    }

    .tab {
        padding: 12px 0;
        font-size: 15px;
    }

    .tab-content {
        padding: 15px;
    }

    .filter-title {
        font-size: 16px;
    }

    .button-group {
        gap: 8px;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .filter-btn {
        flex: 0 0 calc(50% - 4px);
        padding: 10px 8px;
        font-size: 12px;
        min-width: auto;
        margin-bottom: 8px;
        text-align: center;
    }

    .query-btn {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
        margin-top: 10px;
    }

    /* 统计网格优化 */
    .stats-section {
        padding: 12px;
        margin-bottom: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .stat-item {
        padding: 6px 4px;
        border-radius: 4px;
        min-height: 40px;
    }

    .stat-label {
        font-size: 10px;
        margin-bottom: 2px;
        line-height: 1.2;
    }

    .stat-value {
        font-size: 14px;
        line-height: 1.2;
    }

    .stat-item.total .stat-value {
        font-size: 16px;
    }

    .stat-item.total {
        grid-column: 1 / -1;
        padding: 8px 6px;
        min-height: 44px;
    }

    .ai-detail-scores {
        grid-template-columns: 1fr 1fr;  /* 强制保持两列 */
        gap: 8px 12px;
    }

    /* 奇数个项目时，最后一行左对齐（行业在左边） */
    .ai-detail-scores .score-item:nth-child(9) {
        grid-column: 1 / 2;
    }

    .group-cards {
        grid-template-columns: repeat(3, 1fr); /* 手机2列 */
        gap: 12px;
    }

    .group-title {
        font-size: 17px;
        margin-bottom: 16px;
    }

    .sector-name {
        font-size: 16px;
    }

    .sector-zt-count {
        font-size: 30px;
    }

    #agent-cards {
        gap: 28px;
    }


    .search-container {
        display: grid !important;
        grid-template-columns: 1fr auto auto !important;
        grid-template-areas: "search btn clear" !important;
        gap: 6px !important;
        margin-top: 10px !important;
        align-items: center !important;
        width: calc(100% - 16px) !important;
        margin-left: 8px !important;
        margin-right: 8px !important;
    }

    #search-input {
        grid-area: search !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 10px 12px !important;
        font-size: 14px !important;
        height: 40px !important;
        box-sizing: border-box !important;
        border-radius: 10px !important;
        -webkit-appearance: none !important;
    }

    #search-btn {
        grid-area: btn !important;
        width: auto !important;
        min-width: 65px !important;
        padding: 10px 8px !important;
        font-size: 13px !important;
        height: 40px !important;
        box-sizing: border-box !important;
        border-radius: 10px !important;
    }

    #clear-btn {
        grid-area: clear !important;
        width: auto !important;
        min-width: 65px !important;
        padding: 10px 8px !important;
        font-size: 13px !important;
        height: 40px !important;
        box-sizing: border-box !important;
        border-radius: 10px !important;
    }

    /* ===== 回测页面移动端适配 ===== */

    .bt-cards-row {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .bt-card {
        padding: 12px;
    }

    .bt-card-title {
        font-size: 15px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .bt-card-grid {
        gap: 4px 8px;
    }

    .bt-label {
        font-size: 12px;
    }

    .bt-val {
        font-size: 13px;
    }

    .bt-table {
        font-size: 11px;
        min-width: 520px;
    }

    .bt-table th {
        padding: 8px 6px;
        font-size: 11px;
    }

    .bt-table td {
        padding: 6px;
        font-size: 11px;
    }

    .bt-table-sm {
        min-width: 480px;
    }

    .bt-table-sm th,
    .bt-table-sm td {
        padding: 6px 5px;
        font-size: 11px;
    }

    .bt-table-wrap {
        margin: 0 -8px;
        padding: 0 8px;
        border-radius: 8px;
    }

    .bt-attr-section {
        margin-bottom: 12px;
    }

    .bt-attr-title {
        font-size: 13px;
    }

    .bt-attr-card {
        padding: 10px;
        margin-bottom: 8px;
    }

    .bt-attr-card-name {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .bt-attr-grid {
        grid-template-columns: auto 1fr auto 1fr;
        gap: 3px 6px;
    }

    .bt-attr-grid .bt-label {
        font-size: 11px;
    }

    .bt-attr-grid .bt-val {
        font-size: 12px;
    }

    #backtest .filter-section .button-group {
        gap: 6px;
    }

    #backtest .filter-section .filter-btn {
        flex: 0 0 calc(33.33% - 4px);
        padding: 8px 4px;
        font-size: 12px;
        min-width: auto;
    }

}


/* ===== AI 实盘池筛选栏 移动端适配 ===== */
@media (max-width: 480px) {
    .research-tag-bar {
        gap: 6px;
    }

    .tag-pill {
        padding: 6px 12px;
        font-size: 12px;
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    .research-search-row {
        gap: 6px;
    }

    #research-search-input {
        font-size: 14px;
        padding: 8px 10px;
    }

    .research-search-clear {
        padding: 8px 12px;
        font-size: 12px;
    }

    .research-summary-bar {
        gap: 6px;
    }

    .summary-chip {
        padding: 3px 10px;
        font-size: 11px;
    }

    .summary-chip .chip-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .research-section.section-a,
    .research-section.section-b,
    .research-section.section-c {
        padding-left: 8px;
        border-left-width: 3px;
    }
}

@media (max-width: 360px) {
    .bt-attr-grid {
        grid-template-columns: auto 1fr;
    }

    .bt-table {
        min-width: 450px;
    }

    .bt-table th,
    .bt-table td {
        padding: 5px 4px;
        font-size: 10px;
    }
}


