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

body {
    font-family: 'Segoe UI', 'Roboto', 'Noto Sans', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
    background: #eef2f7;
    height: 100vh;
    overflow: hidden;
}

.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

.top-frame {
    background: linear-gradient(135deg, #0b2b3b 0%, #1a4a6f 100%);
    color: white;
    padding: 0 28px;
    height: 70px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.top-frame h1 {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(120deg, #ffffff, #c8e2ff);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.top-frame .sub {
    margin-left: 24px;
    font-size: 0.8rem;
    opacity: 0.85;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 40px;
}

.sub > a {
    text-decoration: none;
    color: white;
}

.sub > a:hover {
    text-decoration: underline;
}

.bottom-split {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #f4f9ff;
    position: relative;
    min-height: 0;
    /* 防止 flex 溢出 */;
}

.left-panel {
    width: 420px;
    min-width: 260px;
    max-width: 70%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.resizer {
    width: 6px;
    background-color: #cbd5e1;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background-color 0.2s;
    z-index: 20;
}
.resizer:hover {
    background-color: #1e6fdf;
}

.right-panel {
    flex: 1;
    background: #fefefe;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* 防止 flex 溢出 */;
}

.right-panel iframe {
    width: 100%;
    flex: 1;
    /* 让 iframe 填满剩余空间 */
    border: none;
    display: block;
    min-height: 0;
    /* 防止 flex 溢出 */;
}

.embedded-left {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.embedded-left .app-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.embedded-left .tab-bar {
    background: #ffffff;
    border-bottom: 1px solid #e9edf2;
    padding: 0 12px;
    gap: 16px;
    display: flex;
    flex-shrink: 0;
}

.embedded-left .tab-button {
    font-size: 0.9rem;
    padding: 12px 4px 10px 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #5b6e8c;
    position: relative;
    white-space: nowrap;
}
.embedded-left .tab-button.active {
    color: #1e6fdf;
}
.embedded-left .tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #1e6fdf;
    border-radius: 3px 3px 0 0;
}

.embedded-left .panel {
    display: none;
    padding: 12px;
    flex: 1;
    overflow: auto;
}
.embedded-left .panel.active-panel {
    display: flex;
    flex-direction: column;
}

.embedded-left .tree-container {
    flex: 1;
    overflow: auto;
    background: #ffffff;
    border-radius: 12px;
}

.embedded-left .result-listbox {
    flex: 1;
    overflow: auto;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #edf2f7;
}

.tree-node {
    list-style: none;
    margin: 0;
    padding-left: 20px;
    min-width: max-content;
}
.tree-node-root {
    padding-left: 0;
}
.tree-item {
    position: relative;
    cursor: pointer;
    padding: 6px 0 6px 28px;
    border-radius: 8px;
    transition: background 0.15s;
    font-size: 0.9rem;
    color: #1e2a3e;
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-width: max-content;
}
.tree-item:hover {
    background: #f0f6fe;
}
.toggle-icon {
    position: absolute;
    left: 0;
    top: 6px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #4b6b8f;
    border-radius: 6px;
    cursor: pointer;
}
.toggle-icon:hover {
    background: #e2e8f0;
}
.node-content {
    white-space: nowrap;
}
.children-wrapper {
    overflow: visible;
}
.children-wrapper.collapsed {
    display: none;
}

.result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #ecf3fa;
    cursor: pointer;
    transition: background 0.12s;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: max-content;
}
.result-item:hover {
    background: #eff6ff;
}
.result-title {
    font-weight: 500;
    color: #0f172a;
    white-space: nowrap;
}
.search-highlight {
    background-color: #ffec9f;
    border-radius: 4px;
    padding: 0 2px;
    font-weight: 600;
    color: #b45309;
}
.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}
.search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 44px;
    outline: none;
    margin-bottom: 12px;
}
.search-input:focus {
    border-color: #1e6fdf;
    box-shadow: 0 0 0 3px rgba(30,111,223,0.2);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* 移动端响应式适配 */
@media (max-width: 1024px) {
    .left-panel {
        width: 340px;
        min-width: 220px;
    }
    .top-frame {
        padding: 0 20px;
        height: 64px;
    }
    .top-frame h1 {
        font-size: 1.4rem;
    }
    .top-frame .sub {
        font-size: 0.7rem;
        padding: 3px 10px;
        margin-left: 16px;
    }
}

@media (max-width: 768px) {
    .bottom-split {
        flex-direction: column;
    }

    .left-panel {
        width: 100% !important;
        max-width: 100% !important;
        min-width: unset;
        height: 40vh;
        max-height: 40vh;
        border-bottom: 2px solid #dde4ec;
        flex-shrink: 0;
    }

    .resizer {
        display: none;
    }

    .right-panel {
        flex: 1;
        height: 60vh;
        min-height: 0;
        overflow: hidden;
    }

    .right-panel iframe {
        flex: 1;
        height: 100%;
        min-height: 0;
    }

    .top-frame {
        padding: 0 16px;
        height: 56px;
        flex-wrap: wrap;
        gap: 4px;
    }
    .top-frame h1 {
        font-size: 1.2rem;
    }
    .top-frame .sub {
        margin-left: 10px;
        font-size: 0.65rem;
        padding: 2px 8px;
    }

    .embedded-left .tab-button {
        font-size: 0.8rem;
        padding: 8px 2px 6px 2px;
    }
    .embedded-left .panel {
        padding: 8px;
    }
    .tree-item {
        font-size: 0.8rem;
        padding: 4px 0 4px 22px;
    }
    .toggle-icon {
        width: 20px;
        height: 20px;
        font-size: 12px;
        top: 4px;
    }
    .result-item {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .search-input {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    .tree-node {
        padding-left: 12px;
    }
}

@media (max-width: 480px) {
    .top-frame {
        height: 50px;
        padding: 0 10px;
    }
    .top-frame h1 {
        font-size: 1.0rem;
    }
    .top-frame .sub {
        margin-left: 6px;
        font-size: 0.55rem;
        padding: 1px 6px;
    }

    .left-panel {
        height: 35vh;
        max-height: 35vh;
    }
    .right-panel {
        height: 65vh;
    }

    .embedded-left .tab-button {
        font-size: 0.7rem;
        padding: 6px 2px 4px 2px;
    }
    .embedded-left .tab-bar {
        gap: 8px;
        padding: 0 8px;
    }
    .tree-item {
        font-size: 0.75rem;
        padding: 3px 0 3px 18px;
    }
    .toggle-icon {
        width: 18px;
        height: 18px;
        font-size: 10px;
        top: 3px;
    }
    .result-item {
        padding: 6px 10px;
        font-size: 0.78rem;
    }
    .search-input {
        font-size: 0.78rem;
        padding: 6px 10px;
        margin-bottom: 8px;
    }
    .tree-node {
        padding-left: 8px;
    }
}

@media (max-width: 360px) {
    .top-frame h1 {
        font-size: 0.85rem;
    }
    .top-frame .sub {
        font-size: 0.5rem;
        padding: 1px 4px;
        margin-left: 4px;
    }
    .left-panel {
        height: 30vh;
        max-height: 30vh;
    }
    .right-panel {
        height: 70vh;
    }
}
