
        :root {
            --sidebar-width: 260px;
            --header-height: 60px;
            --body-bg: #f8f9fa;
            --border-color: #eaecf0;
            --primary-blue: #36c;
        }

        body {
            font-family: 'Inter', -apple-system, sans-serif;
            margin: 0; padding: 0;
            background-color: var(--body-bg);
            display: block; /* Reset from previous flex-column to prevent layout collapse */
        }

        /* --- Header --- */
        header { 
            background: #fff; border-bottom: 1px solid var(--border-color); 
            height: var(--header-height); display: flex; align-items: center; 
            padding: 0 20px; position: fixed; top: 0; left: 0; right: 0; z-index: 1001; 
        }
        .logo { font-weight: 800; text-decoration: none; color: #000; font-size: 1.2rem; }

        /* --- Sidebar --- */
        .sidebar {
            width: var(--sidebar-width);
            background: #fff;
            border-right: 1px solid var(--border-color);
            position: fixed;
            top: var(--header-height);
            bottom: 0;
            left: 0;
            z-index: 1000;
            overflow-y: auto;
        }

        .sidebar-nav { padding: 20px 0; }
        .nav-item {
            display: flex; align-items: center; padding: 12px 24px;
            color: #202122; text-decoration: none; font-size: 14px; font-weight: 500;
        }
        .nav-item:hover { background: #f8f9fa; color: var(--primary-blue); }
        .nav-item i { margin-right: 12px; width: 18px; color: #72777d; }

        /* --- Layout & Content --- */
        .main-container {
            margin-top: var(--header-height);
            margin-left: var(--sidebar-width);
            padding: 30px;
            position: relative;
            min-height: calc(100vh - var(--header-height));
            z-index: 1; /* Ensures content stays below modals but above background */
        }

        /* 🛡️ FIX: Ensure everything inside main is clickable */
        .main-content {
            position: relative;
            pointer-events: auto !important; 
        }

        .alert-box { padding: 12px 20px; border-radius: 4px; margin-bottom: 20px; }
        .alert-success { background: #dff0d8; color: #3c763d; border: 1px solid #d6e9c6; }
        .alert-error { background: #fee7e6; color: #d33; border: 1px solid #ebccd1; }

        /* Dialog / Modals */
        dialog { border: none; border-radius: 6px; padding: 0; width: 90%; max-width: 600px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
        dialog::backdrop { background: rgba(0,0,0,0.5); }
        
        @media (max-width: 992px) {
            .sidebar { transform: translateX(-100%); transition: 0.3s; }
            .sidebar.active { transform: translateX(0); }
            .main-container { margin-left: 0; }
        }

        /* TomSelect Dropdown Fix */
        .ts-dropdown { z-index: 10000 !important; }
    

    /* --- PROPERTY CARD LAYOUT --- */
    .statements-section { 
        background-color: transparent;
        border: none;
        box-shadow: none;
        margin-top: 20px;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .statement-group { 
        background: #fff;
        border: 1px solid #c8ccd1; 
        border-radius: 4px; 
        display: flex; 
        box-shadow: 0 1px 2px rgba(0,0,0,0.03);
        transition: box-shadow 0.2s, border-color 0.2s;
        overflow: hidden; /* This clips content by default */
    }
    
    .statement-group:hover {
        border-color: #a2a9b1;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    }

    /* Left Column: Property Name */
    .property-label { 
        width: 220px; 
        flex-shrink: 0; 
        padding: 15px; 
        background-color: #f8f9fa; 
        border-right: 1px solid #eaecf0; 
        font-weight: 600; 
        color: #202122; 
        word-wrap: break-word;
        display: flex;
        align-items: flex-start;
    }
    .property-label a { color: #202122; text-decoration: none; }
    .property-label a:hover { color: #36c; text-decoration: underline; }

    /* Right Column: List of Values */
    .statement-listview { 
        flex-grow: 1; 
        display: flex; 
        flex-direction: column; 
        background: #fff;
    }
    
    .statement-view {
        padding: 12px 15px;
        border-bottom: 1px solid #eaecf0;
    }
    
    /* Remove border from the last item IF the add-value box isn't active */
    .statement-view:last-of-type { border-bottom: none; }

    /* --- ADD VALUE SECTION (Footer) --- */
    .wb-add-value-wrapper {
        padding: 8px 15px;
        background-color: #f8f9fa; /* Gray Background */
        border-top: 1px solid #eaecf0;
        transition: background 0.2s;
        
        /* ✅ FLEXBOX: Pushes the link to the right */
        display: flex;
        justify-content: flex-end; 
    }

    .wb-add-value-wrapper:hover {
        background-color: #f0f0f0; 
    }

    .btn-add-value-trigger {
        color: #36c; /* Blue Text */
        font-size: 0.9rem;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        font-weight: 500;
    }
    
    .btn-add-value-trigger:hover { 
        text-decoration: underline;
    }
    
    /* The form container inside the list */
    .wb-new-value-form-container {
        padding: 15px;
        background: #fcfcfc;
        border-top: 1px solid #eaecf0;
    }

    /* --- EDITING TOOLS --- */
    .value-display { display: flex; align-items: baseline; justify-content: space-between; }
    .value-content { font-size: 1rem; color: #202122; flex-grow: 1; line-height: 1.5; }
    .edit-toolbar { visibility: hidden; opacity: 0; display: inline-flex; gap: 10px; margin-left: 10px; transition: opacity 0.2s; }
    .statement-group:hover .edit-toolbar { visibility: visible; opacity: 1; }
    .toolbar-btn { background: none; border: none; cursor: pointer; color: #72777d; font-size: 0.85rem; padding: 0; }
    .toolbar-btn:hover { color: #36c; }
    .wb-edit-interface { background: #f8f9fa; border: 1px solid #a2a9b1; padding: 15px; border-radius: 2px; margin-top: 10px; }

    /* Details & Gallery */
    .wb-details-container { margin-top: 6px; font-size: 0.9rem; color: #54595d; }
    .wb-qualifier-row { display: flex; gap: 5px; margin-bottom: 2px; }
    .wb-qualifier-prop { font-weight: bold; color: #72777d; }
    .gallery-grid { display: flex; flex-wrap: wrap; gap: 15px; padding: 15px; }
    .gallery-item { width: 160px; border: 1px solid #c8ccd1; background: #fff; padding: 5px; text-decoration: none; display: flex; flex-direction: column; }
    .gallery-item:hover { border-color: #36c; }
    .gallery-img-wrapper { width: 100%; height: 160px; background: #f8f9fa; display: flex; align-items: center; justify-content: center; overflow: hidden; }
    .gallery-img-wrapper img { max-width: 100%; max-height: 100%; object-fit: contain; }
    
    /* ✅ FIX: Force TomSelect Dropdown to appear on top */
    .ts-dropdown, .ts-dropdown.plugin-optgroup_columns .ts-dropdown-content {
        z-index: 99999 !important;
    }

    @media (max-width: 768px) {
        .statement-group { flex-direction: column; }
        .property-label { width: 100%; border-right: none; border-bottom: 1px solid #eaecf0; background: #f0f0f0; padding: 10px 15px; }
        .edit-toolbar { visibility: visible !important; opacity: 1 !important; }
        .wb-add-value-wrapper { justify-content: flex-end; }
    }
    .hidden { display: none !important; }
    
/* Vertical Rail Hierarchy */
.wb-qualifiers-edit, .wb-references-edit {
    position: relative;
    margin-left: 1.5rem;
    padding-left: 1rem;
}

/* The vertical lines connecting nested data */
.wb-qualifiers-edit::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: #cbd5e1; /* Slate rail */
}

.wb-references-edit::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: #34d399; /* Emerald rail for sources */
}

/* Ghost Inputs: Clean look that becomes a field on focus */
.wb-input-minimal {
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 8px;
    width: 100%;
    transition: all 0.2s ease;
    border-radius: 2px;
}

.wb-input-minimal:hover, .wb-input-minimal:focus {
    background: #fff;
    border: 1px solid #a2a9b1;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    outline: none;
}
