* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #1a202c;
    color: #333333;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* 1. NAVBAR HEADER */
.navbar {
    height: 48px;
    background-color: #0d1527;
    color: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 12px 0 0;
    border-bottom: 1px solid #2d3748;
    z-index: 10;
    gap: 12px;
    flex-shrink: 0;
}

.menu-icon {
    width: 45px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    color: #e2e8f0;
    background-color: #1e293b;
    transition: all 0.2s;
}

.menu-icon:hover {
    background-color: #dd6b20;
    color: #ffffff;
}

.nav-title {
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 0.5px;
}

/* 2. MAIN WORKSPACE & SIDEBAR */
.main-content {
    display: flex;
    flex: 1;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    width: 100%;
    position: relative;
    background-color: #ffffff;
    overflow: hidden;
}

.sidebar {
    display: flex;
    height: 100%;
    z-index: 8;
    background-color: #0d1527;
}

.category-tabs {
    width: 45px;
    background-color: #0d1527;
    display: none;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    align-items: center;
    height: 100%;
    border-right: 1px solid #1a202c;
    flex-shrink: 0;
}

.category-tabs.active {
    display: flex;
}

.tab-btn {
    width: 32px;
    height: 32px;
    background-color: #2d3748;
    color: #a0aec0;
    border: none;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn.active {
    background-color: #dd6b20;
    color: #ffffff;
}

.sub-panel {
    width: 210px;
    background-color: #e8ecf1;
    height: 100%;
    border-right: 1px solid #cbd5e1;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    padding: 12px 8px;
    flex-shrink: 0;
}

.sub-panel.active {
    display: flex;
}

.panel-title {
    font-size: 12px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 12px;
    text-transform: uppercase;
}

/* CÂY MENU ACCORDION */
.tree-node {
    display: flex;
    flex-direction: column;
    margin-bottom: 3px;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 13px;
    color: #0f172a;
    user-select: none;
    border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}

.tree-header.level-1 {
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    margin-top: 4px;
}

.tree-header.level-2 {
    font-weight: 500;
}

/* MỤC CON CUỐI CÙNG */
.tree-item {
    font-size: 12px;
    color: #334155;
    padding: 3px 6px 3px 18px;
    cursor: pointer;
    display: block;
    user-select: none;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.tree-item:hover,
.tree-header:hover {
    color: #dd6b20;
}

.tree-header.active-selected,
.tree-item.active-selected {
    color: #dd6b20 !important;
    background-color: #fdba744d;
    font-weight: bold;
}

.tree-header.parent-active {
    color: #dd6b20 !important;
    background-color: #fdba7426;
    font-weight: bold;
}

.tree-arrow {
    font-size: 11px;
    font-family: monospace;
    width: 12px;
    display: inline-block;
    color: #334155;
}

.tree-body {
    padding-left: 12px;
    display: none;
    flex-direction: column;
}

.tree-node.open > .tree-body {
    display: flex;
}

/* KHUNG HIỂN THỊ DẠNG THUMBNAIL */
.thumb-container {
    max-height: 310px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 4px;
}

.thumb-container::-webkit-scrollbar {
    width: 4px;
}

.thumb-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.thumb-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 6px 0;
}

.thumb-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #ffffff;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    margin-bottom: 6px;
}

.thumb-label {
    font-size: 11px;
    font-weight: 600;
    color: #4a5568;
    text-align: center;
}

.thumb-item {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    background-color: #edf2f7;
    display: block;
}

.thumb-item.active {
    border-color: #dd6b20;
    box-shadow: 0 0 0 1px #dd6b20;
}

/* 3. PREVIEW VIEWPORT (CẮT GỌT VỪA KHUNG KHÔNG TRÀN SÀN) */
.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.preview-header {
    height: 36px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-bottom: 1px solid #edf2f7;
    background-color: #ffffff;
    flex-shrink: 0;
}

.preview-header span {
    font-size: 12px;
    font-weight: bold;
    color: #4a5568;
}

.cabin-viewport {
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100% - 36px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    overflow: hidden;
}

.company-logo-img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    display: block;
}

.cabin-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: calc(100% - 16px);
    max-height: calc(100% - 16px);
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

.layer-frame   { z-index: 5; } 
.layer-tran    { z-index: 4; } 
.layer-san     { z-index: 3; } 
.layer-vach    { z-index: 2; } 
.layer-tran-bg { z-index: 1; }

img:not([src]), 
img[src=""] {
    display: none !important;
}

/* TỐI ƯU CHO GIAO DIỆN MOBILE */
@media (max-width: 768px) {
    .sub-panel {
        width: 230px;
        padding: 10px 6px;
    }

    .tree-header.level-1 {
        font-size: 15px;
        padding: 8px 6px;
    }

    .tree-header.level-2 {
        font-size: 14px;
        padding: 8px 6px;
    }

    .tree-item {
        font-size: 13px;
        padding: 8px 8px 8px 22px;
        line-height: 1.4;
    }

    .tree-arrow {
        font-size: 13px;
        width: 16px;
    }

    .cabin-viewport {
        padding: 4px;
    }

    .cabin-layer {
        max-width: calc(100% - 8px);
        max-height: calc(100% - 8px);
    }
}