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

:root {
    --primary: #1e40af;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --danger: #dc2626;
    --bg: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ========== 通用组件样式 ========== */

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .bi-search {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 90px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.search-box input::placeholder {
    color: #94a3b8;
}

.search-clear {
    position: absolute;
    right: 78px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

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

.search-btn {
    position: absolute;
    right: 6px;
    background: var(--primary);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px 14px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background 0.15s;
}

.search-btn:hover {
    background: #1e3a8a;
}

.update-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: center;
}

.update-time .bi-clock {
    margin-right: 3px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    flex-shrink: 0;
}

.panel-header h5 {
    margin: 0;
    font-weight: 600;
}

.class-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 2px;
    position: relative;
    border: 1px solid transparent;
}

.class-item:hover {
    background: var(--primary-light);
}

.class-item.has-selection {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.class-item.has-selection .class-id {
    background: var(--success);
    color: #fff;
}

.class-item.active {
    background: #dbeafe;
    color: var(--primary);
    font-weight: 600;
}

.class-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f1f5f9;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.class-item.active .class-id {
    background: var(--primary);
    color: #fff;
}

.class-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.class-list::-webkit-scrollbar,
.subcategory-list::-webkit-scrollbar,
.search-results-list::-webkit-scrollbar {
    width: 5px;
}

.class-list::-webkit-scrollbar-thumb,
.subcategory-list::-webkit-scrollbar-thumb,
.search-results-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.subcategory-group {
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s;
}

.subcategory-group.expanded {
    border-color: #93c5fd;
    overflow: visible;
}

.subcategory-group.has-selection {
    border-color: #bbf7d0;
}

.subcategory-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    background: #fafbfc;
    transition: background 0.15s;
    border-radius: 10px;
}

.subcategory-header:hover {
    background: #f1f5f9;
}

.subcategory-group.expanded .subcategory-header {
    background: #eff6ff;
    position: sticky;
    top: 0;
    z-index: 10;
    border-radius: 10px 10px 0 0;
    border-bottom: 1px solid #dbeafe;
}

.subcategory-group.has-selection .subcategory-header {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.subcategory-group.has-selection .subcategory-code {
    background: var(--success);
    color: #fff;
}

.subcategory-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #e2e8f0;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.subcategory-group.expanded .subcategory-code {
    background: var(--primary);
    color: #fff;
}

.subcategory-name {
    flex: 1;
    font-weight: 500;
}

.subcategory-arrow {
    transition: transform 0.25s ease;
    color: var(--text-muted);
}

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

.subcategory-items {
    display: none;
    background: #fff;
}

.subcategory-group.expanded .subcategory-items {
    display: block;
}

.item-row {
    display: flex;
    align-items: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s ease;
    margin-bottom: 2px;
}

.item-row:hover {
    background: #f1f5f9;
}

.item-row.selected {
    background: #dcfce7;
    color: var(--success);
}

.item-checkbox {
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.15s;
}

.item-row.selected .item-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.item-code {
    color: var(--text-muted);
    flex-shrink: 0;
    font-family: "SF Mono", "Consolas", monospace;
    font-weight: 500;
}

.item-row.selected .item-code {
    color: var(--success);
}

.item-name {
    flex: 1;
}

.panel-placeholder {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.panel-placeholder i {
    margin-bottom: 12px;
    color: #cbd5e1;
}

.search-results-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.search-results-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.search-class-group {
    margin-bottom: 10px;
}

.search-class-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
}

.search-class-header:hover {
    background: #eff6ff;
}

.search-class-header .class-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.search-sub-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-muted);
}

.search-empty i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #cbd5e1;
}

.search-empty p {
    font-size: 0.9rem;
}

.result-group {
    margin-bottom: 16px;
}

.result-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.result-group-header .class-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.result-group-header .class-title {
    font-weight: 600;
    font-size: 1rem;
}

.result-group-header .item-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-delete-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: #fecaca;
    color: var(--danger);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
    transition: background 0.15s;
}

.result-delete-item:hover {
    background: var(--danger);
    color: #fff;
}

.result-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 4px;
}

.result-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--success);
    width: fit-content;
    max-width: 100%;
}

.result-tag .tag-code {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 0.72rem;
    color: #15803d;
    font-weight: 600;
}

.toast-container {
    z-index: 9999;
}

/* ========== AI分级展示 ========== */
.tier-section {
    margin-bottom: 16px;
}

.tier-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 10px;
}

.tier-header i {
    font-size: 1rem;
}

.tier-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.tier-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: 4px;
}

.tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.tier-badge-core {
    background: #fef2f2;
    color: #dc2626;
}

.tier-badge-suggested {
    background: #eff6ff;
    color: #1e40af;
}

.tier-badge-protective {
    background: #f3f4f6;
    color: #6b7280;
}

/* ========== AI分析结果表格 ========== */
.ai-summary-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.ai-summary-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.ai-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ai-summary-table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 12px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.ai-summary-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.ai-summary-table tbody tr:hover {
    background: #fafbfc;
}

.ai-summary-table .class-badge-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 26px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
}

.ai-td-name {
    font-weight: 600;
    color: var(--text);
}

.ai-td-reason {
    color: var(--text-muted);
    font-size: 0.82rem;
    max-width: 200px;
}

.ai-td-items {
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.5;
}

/* ================================================================
   电脑端 (>=1024px) — 左右双栏布局
   ================================================================ */
@media (min-width: 1024px) {
    .mobile-class-bar { display: none !important; }

    .app-container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 16px 20px;
        height: 100%;
        display: grid;
        grid-template-rows: auto 1fr auto;
        grid-template-columns: 1fr;
        overflow: hidden;
    }

    .top-bar {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding-bottom: 12px;
        margin-bottom: 12px;
        border-bottom: 1px solid var(--border);
    }

    .search-box {
        width: 480px;
        max-width: 90%;
    }

    .main-content {
        display: grid;
        grid-template-columns: 170px minmax(0, 900px);
        grid-template-rows: 1fr;
        gap: 16px;
        overflow: hidden;
        min-height: 0;
        justify-content: center;
    }

    .left-panel {
        width: 170px;
        min-width: 170px;
        background: #fff;
        border-radius: 12px;
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    .left-panel .panel-header {
        padding: 14px 16px;
    }

    .left-panel .panel-header h5 {
        font-size: 0.95rem;
    }

    .class-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 8px;
    }

    .class-item {
        padding: 9px 11px;
    }

    .class-id {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .class-name {
        font-size: 0.9rem;
    }

    .right-panel {
        flex: 1;
        background: #fff;
        border-radius: 12px;
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    .right-panel .panel-header {
        padding: 14px 16px;
    }

    .right-panel .panel-header h5 {
        font-size: 0.95rem;
    }

    .subcategory-container {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .subcategory-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 8px;
    }

    .subcategory-header {
        padding: 12px 14px;
    }

    .subcategory-code {
        width: 42px;
        height: 26px;
        font-size: 0.72rem;
        margin-right: 10px;
    }

    .subcategory-name {
        font-size: 0.9rem;
    }

    .subcategory-arrow {
        font-size: 0.8rem;
    }

    .subcategory-items {
        padding: 4px 8px 8px;
    }

    .item-row {
        padding: 7px 12px;
    }

    .item-checkbox {
        width: 18px;
        height: 18px;
        margin-right: 10px;
        font-size: 0.65rem;
    }

    .item-code {
        width: 70px;
        font-size: 0.75rem;
    }

    .item-name {
        font-size: 0.88rem;
    }

    .panel-placeholder i {
        font-size: 4rem;
    }

    .panel-placeholder p {
        font-size: 1rem;
    }

    .bottom-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 0;
        margin-top: 16px;
        border-top: 1px solid var(--border);
    }

    .bottom-bar .btn {
        min-width: 180px;
    }
}

/* ================================================================
   平板端 (768px~1023px) — 紧凑双栏布局
   ================================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    .mobile-class-bar { display: none !important; }

    .app-container {
        padding: 10px 12px;
        height: 100%;
        display: grid;
        grid-template-rows: auto 1fr auto;
        grid-template-columns: 1fr;
        overflow: hidden;
    }

    .top-bar {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        padding-bottom: 10px;
        margin-bottom: 10px;
        border-bottom: 1px solid var(--border);
    }

    .search-box {
        width: 100%;
        max-width: 600px;
    }

    .search-box input {
        padding: 9px 90px 9px 36px;
        font-size: 0.88rem;
    }

    .update-time {
        font-size: 0.74rem;
    }

    .main-content {
        display: grid;
        grid-template-columns: 140px 1fr;
        grid-template-rows: 1fr;
        gap: 10px;
        overflow: hidden;
        min-height: 0;
    }

    .left-panel {
        width: 140px;
        min-width: 140px;
        background: #fff;
        border-radius: 10px;
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    .left-panel .panel-header {
        padding: 10px 12px;
    }

    .left-panel .panel-header h5 {
        font-size: 0.82rem;
    }

    .class-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 6px;
    }

    .class-item {
        padding: 7px 9px;
        gap: 7px;
    }

    .class-id {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
        border-radius: 6px;
    }

    .class-name {
        font-size: 0.78rem;
    }

    .right-panel {
        flex: 1;
        background: #fff;
        border-radius: 10px;
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    .right-panel .panel-header {
        padding: 10px 12px;
    }

    .right-panel .panel-header h5 {
        font-size: 0.82rem;
    }

    .subcategory-container {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .subcategory-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 6px;
    }

    .subcategory-header {
        padding: 9px 11px;
    }

    .subcategory-code {
        width: 38px;
        height: 22px;
        font-size: 0.68rem;
        margin-right: 8px;
    }

    .subcategory-name {
        font-size: 0.82rem;
    }

    .subcategory-arrow {
        font-size: 0.75rem;
    }

    .subcategory-items {
        padding: 3px 6px 6px;
    }

    .item-row {
        padding: 6px 10px;
    }

    .item-checkbox {
        width: 16px;
        height: 16px;
        margin-right: 8px;
        font-size: 0.58rem;
    }

    .item-code {
        width: 60px;
        font-size: 0.7rem;
    }

    .item-name {
        font-size: 0.8rem;
    }

    .panel-placeholder i {
        font-size: 3rem;
    }

    .panel-placeholder p {
        font-size: 0.9rem;
    }

    .bottom-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 12px 0;
        margin-top: 10px;
        border-top: 1px solid var(--border);
    }

    .bottom-bar .btn {
        min-width: 160px;
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

/* ================================================================
   手机端 (<768px) — 经典左右布局：左侧类号列表 + 右侧树形展开
   ================================================================ */
@media (max-width: 767px) {
    html, body {
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
        max-width: 100vw;
    }

    .app-container {
        padding: 0;
        height: 100%;
        max-width: 100vw;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .top-bar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 10px 0;
        margin-bottom: 0;
        border-bottom: none;
        background: #fff;
        flex-shrink: 0;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        padding: 9px 80px 9px 36px;
        font-size: 0.86rem;
        border-radius: 20px;
        background: #f1f5f9;
        border: 1px solid transparent;
    }

    .search-box input:focus {
        background: #fff;
        border-color: var(--primary);
        box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
    }

    .update-time {
        font-size: 0.68rem;
        padding: 3px 0 6px;
    }

    /* 隐藏手机端横向标签栏 */
    .mobile-class-bar {
        display: none !important;
    }

    /* 左右双栏布局 */
    .main-content {
        display: flex;
        flex-direction: row;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    /* 左侧类号列表 */
    .left-panel {
        width: 110px;
        min-width: 110px;
        background: #fff;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
        border-right: 1px solid var(--border);
        box-shadow: none;
        border-radius: 0;
    }

    .left-panel .panel-header {
        display: none;
    }

    .class-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0;
        -webkit-overflow-scrolling: touch;
    }

    .class-list::-webkit-scrollbar {
        width: 0;
    }

    .class-item {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 10px 8px;
        border-radius: 0;
        cursor: pointer;
        margin-bottom: 0;
        position: relative;
        border: none;
        border-bottom: 1px solid #f5f5f5;
        transition: background 0.12s;
    }

    .class-item:active {
        background: #f0f0f0;
    }

    .class-item.has-selection {
        background: #f0fdf4;
    }

    .class-item.has-selection .class-id {
        background: var(--success);
        color: #fff;
    }

    .class-item.active {
        background: #dbeafe;
        color: #1e40af;
        font-weight: 600;
    }

    .class-id {
        width: 24px;
        height: 24px;
        font-size: 0.72rem;
        border-radius: 4px;
        background: #f1f5f9;
        color: var(--text-muted);
        flex-shrink: 0;
    }

    .class-item.active .class-id {
        background: #1e40af;
        color: #fff;
    }

    .class-name {
        font-size: 0.76rem;
        color: #333;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .class-item.active .class-name {
        color: #1e40af;
    }

    /* 右侧内容区 */
    .right-panel {
        flex: 1;
        min-width: 0;
        background: #fff;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border-radius: 0;
        box-shadow: none;
    }

    .right-panel .panel-header {
        padding: 8px 12px;
        border-bottom: 1px solid var(--border);
        background: #fafbfc;
        flex-shrink: 0;
    }

    .right-panel .panel-header h5 {
        font-size: 0.82rem;
    }

    .subcategory-container {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .subcategory-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 4px 6px;
        -webkit-overflow-scrolling: touch;
    }

    .subcategory-group {
        border: none;
        border-radius: 0;
        margin-bottom: 0;
    }

    .subcategory-group.expanded {
        border-color: transparent;
    }

    .subcategory-group.has-selection {
        border-color: transparent;
    }

    .subcategory-header {
        padding: 9px 8px;
        background: transparent;
        border-radius: 0;
        border-bottom: 1px solid #f5f5f5;
    }

    .subcategory-header:hover {
        background: #fafafa;
    }

    .subcategory-group.expanded .subcategory-header {
        background: #fafafa;
        position: sticky;
        top: 0;
        z-index: 10;
        border-bottom: 1px solid #eee;
        border-radius: 0;
    }

    .subcategory-group.has-selection .subcategory-header {
        background: #f0fdf4;
    }

    .subcategory-group.has-selection .subcategory-code {
        background: var(--success);
        color: #fff;
    }

    .subcategory-code {
        width: 40px;
        height: 20px;
        font-size: 0.66rem;
        margin-right: 6px;
        border-radius: 3px;
        background: #e8e8e8;
    }

    .subcategory-group.expanded .subcategory-code {
        background: var(--primary);
        color: #fff;
    }

    .subcategory-name {
        font-size: 0.8rem;
        color: #333;
    }

    .subcategory-arrow {
        font-size: 0.7rem;
    }

    .subcategory-items {
        padding: 2px 0 4px 0;
        background: #fff;
    }

    .item-row {
        padding: 8px 10px 8px 16px;
        margin-bottom: 0;
        border-radius: 0;
        border-bottom: 1px solid #fafafa;
    }

    .item-row:hover {
        background: #fafafa;
    }

    .item-row.selected {
        background: #f0fdf4;
    }

    .item-checkbox {
        width: 18px;
        height: 18px;
        margin-right: 8px;
        font-size: 0.55rem;
        border-radius: 3px;
    }

    .item-code {
        width: 52px;
        font-size: 0.7rem;
        color: #888;
    }

    .item-row.selected .item-code {
        color: var(--success);
    }

    .item-name {
        font-size: 0.8rem;
        color: #333;
    }

    .item-row.selected .item-name {
        color: var(--success);
    }

    .panel-placeholder {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        padding: 40px 20px;
    }

    .panel-placeholder i {
        font-size: 2.5rem;
        color: #e2e8f0;
    }

    .panel-placeholder p {
        font-size: 0.88rem;
        margin-top: 8px;
    }

    .bottom-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 12px;
        margin-top: 0;
        border-top: 1px solid var(--border);
        background: #fff;
        flex-shrink: 0;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .bottom-bar .btn {
        min-width: 0;
        flex: 1;
        font-size: 0.85rem;
        padding: 10px 8px;
        border-radius: 12px;
        font-weight: 600;
    }

    /* 搜索结果手机端适配 */
    .search-results-container {
        flex: 1;
        min-height: 0;
    }

    .search-results-list {
        padding: 8px 12px;
    }

    .search-class-group {
        margin-bottom: 12px;
    }

    .search-class-header {
        padding: 10px 12px;
        font-size: 0.88rem;
        border-radius: 10px;
        margin-bottom: 6px;
    }

    .search-class-header .class-badge {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
        border-radius: 6px;
    }

    .item-row {
        padding: 12px 14px;
        border-radius: 10px;
        margin-bottom: 6px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }

    .item-row:active {
        background: #f1f5f9;
    }

    .item-checkbox {
        width: 22px;
        height: 22px;
        margin-right: 12px;
        font-size: 0.72rem;
        border-radius: 6px;
    }

    .item-code {
        width: 72px;
        font-size: 0.82rem;
    }

    .item-name {
        font-size: 0.92rem;
        font-weight: 500;
    }

    .search-sub-label {
        display: none;
    }

    /* 弹窗手机端适配 */
    .result-group-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .result-group-header .class-badge {
        width: 32px;
        height: 32px;
        font-size: 0.78rem;
    }

    .result-group-header .class-title {
        font-size: 0.88rem;
    }

    .result-group-header .item-count {
        font-size: 0.78rem;
    }

    .result-items {
        gap: 4px;
    }

    .result-tag {
        padding: 4px 8px;
        font-size: 0.78rem;
    }

    .result-tag .tag-code {
        font-size: 0.66rem;
    }

    /* AI表格手机端适配 */
    .ai-summary-section {
        margin-top: 12px;
        padding-top: 12px;
    }

    .ai-summary-title {
        font-size: 0.82rem;
    }

    .ai-summary-table {
        font-size: 0.78rem;
    }

    .ai-summary-table thead th {
        padding: 6px 8px;
        font-size: 0.74rem;
    }

    .ai-summary-table tbody td {
        padding: 8px;
    }

    .ai-summary-table .class-badge-sm {
        width: 26px;
        height: 22px;
        font-size: 0.72rem;
    }

    .ai-td-reason {
        max-width: 120px;
    }
}

/* ========== 页脚样式 ========== */
.site-footer {
    border-top: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-copyright {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.footer-icp {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
}

@media (min-width: 1024px) {
    .site-footer {
        padding: 12px 0 8px;
    }
}
@media (min-width: 768px) and (max-width: 1023px) {
    .site-footer {
        padding: 10px 0 6px;
    }
}
@media (max-width: 767px) {
    .site-footer {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    .footer-content {
        gap: 10px;
    }
    .footer-copyright,
    .footer-icp {
        font-size: 0.7rem;
    }
}

/* AI推荐按钮样式：与"查看已选小类"按钮保持一致 */
#aiTestBtn {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    line-height: 1.5;
    min-width: auto;
    width: auto;
}

#shareBtn {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    line-height: 1.5;
    min-width: auto;
    width: auto;
}

@media (max-width: 767px) {
    #aiTestBtn {
        flex: 0 0 auto;
        font-size: 0.85rem;
        padding: 10px 12px;
        min-width: 0;
        width: auto;
    }

    #shareBtn {
        flex: 0 0 auto;
        font-size: 0.85rem;
        padding: 10px 12px;
        min-width: 0;
        width: auto;
    }
}

/* AI分析沙漏动画 */
.ai-hourglass {
    font-size: 1.8rem;
    display: inline-block;
    animation: ai-hourglass-flip 1.6s ease-in-out infinite;
    transform-origin: center;
}

@keyframes ai-hourglass-flip {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* AI分析沙漏动画 */
.ai-hourglass {
    font-size: 1.8rem;
    display: inline-block;
    animation: ai-hourglass-flip 1.6s ease-in-out infinite;
    transform-origin: center;
}

@keyframes ai-hourglass-flip {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
